{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "linear-progress-bars",
  "title": "Linear Progress Bars",
  "description": "A card of linear progress rows, plain ratio bars, file-upload rows with icons/subtitles/shimmer, milestone ticks, and an inline variant, with scroll-triggered fill animation.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/linear-progress-bars/linear-progress-bars.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, useInView } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\n// ─── Icons ───────────────────────────────────────────────────────────────────\n\nfunction Spinner({ color, active }: { color: string; active: boolean }) {\n  return (\n    <motion.svg\n      width={16}\n      height={16}\n      viewBox=\"0 0 16 16\"\n      fill=\"none\"\n      style={{ flexShrink: 0, willChange: \"transform\" }}\n      animate={active ? { rotate: 360 } : { rotate: 0 }}\n      transition={{ duration: 1.1, repeat: active ? Infinity : 0, ease: \"linear\" }}\n    >\n      <circle cx=\"8\" cy=\"8\" r=\"6\" stroke={color} strokeOpacity=\"0.22\" strokeWidth=\"2.2\" />\n      <path d=\"M14 8A6 6 0 0 0 8 2\" stroke={color} strokeWidth=\"2.2\" strokeLinecap=\"round\" />\n    </motion.svg>\n  );\n}\n\nfunction CheckCircle({ color }: { color: string }) {\n  return (\n    <svg width={18} height={18} viewBox=\"0 0 18 18\" fill=\"none\" style={{ flexShrink: 0 }}>\n      <circle cx=\"9\" cy=\"9\" r=\"8\" fill={color} fillOpacity=\"0.1\" stroke={color} strokeWidth=\"1.5\" />\n      <path d=\"M5.5 9.5 8 12l4.5-5.5\" stroke={color} strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\nfunction XCircle({ color }: { color: string }) {\n  return (\n    <svg width={18} height={18} viewBox=\"0 0 18 18\" fill=\"none\" style={{ flexShrink: 0 }}>\n      <circle cx=\"9\" cy=\"9\" r=\"8\" fill={color} fillOpacity=\"0.1\" stroke={color} strokeWidth=\"1.5\" />\n      <path d=\"M6 6l6 6M12 6l-6 6\" stroke={color} strokeWidth=\"1.8\" strokeLinecap=\"round\" />\n    </svg>\n  );\n}\n\nfunction CloseX({ color }: { color: string }) {\n  return (\n    <svg width={14} height={14} viewBox=\"0 0 14 14\" fill=\"none\" style={{ flexShrink: 0 }}>\n      <path d=\"M3 3l8 8M11 3l-8 8\" stroke={color} strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n    </svg>\n  );\n}\n\nfunction InfoDot({ color }: { color: string }) {\n  return (\n    <svg width={14} height={14} viewBox=\"0 0 14 14\" fill=\"none\" style={{ flexShrink: 0 }}>\n      <circle cx=\"7\" cy=\"7\" r=\"6.2\" stroke={color} strokeWidth=\"1.2\" />\n      <circle cx=\"7\" cy=\"4.6\" r=\"0.72\" fill={color} />\n      <path d=\"M7 6.5v3.2\" stroke={color} strokeWidth=\"1.3\" strokeLinecap=\"round\" />\n    </svg>\n  );\n}\n\nfunction RowIcon({ icon, color, active }: { icon?: LinearProgressBarRow[\"icon\"]; color: string; active: boolean }) {\n  if (icon === \"spinner\") return <Spinner color={color} active={active} />;\n  if (icon === \"check\") return <CheckCircle color={color} />;\n  if (icon === \"x\") return <XCircle color={color} />;\n  if (icon === \"close\") return <CloseX color={color} />;\n  return null;\n}\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface LinearProgressRatioRow {\n  kind: \"ratio\";\n  label: string;\n  value: number;\n  maxValue: number;\n  colorStart: string;\n  colorEnd: string;\n  height?: number;\n}\n\nexport interface LinearProgressBarRow {\n  kind: \"bar\";\n  label?: string;\n  labelSub?: string;\n  labelRight?: string;\n  pct: number;\n  colorStart: string;\n  colorEnd: string;\n  height?: number;\n  capStyle?: \"glow\" | \"dot\" | \"line\" | \"none\";\n  capColor?: string;\n  shimmer?: boolean;\n  milestones?: number;\n  subtitle?: string;\n  subtitleColor?: string;\n  inline?: boolean;\n  duration?: number;\n  showInfo?: boolean;\n  icon?: \"spinner\" | \"check\" | \"x\" | \"close\" | \"none\";\n}\n\nexport type LinearProgressRow = LinearProgressRatioRow | LinearProgressBarRow;\n\nexport interface LinearProgressBarsProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  theme?: \"light\" | \"dark\";\n  scrollReveal?: boolean;\n  animationDuration?: number;\n  rows?: LinearProgressRow[];\n  cardBg?: string;\n  cardRadius?: number;\n  cardBorderWidth?: number;\n  cardBorderColor?: string;\n  cardShadow?: \"none\" | \"soft\" | \"medium\" | \"strong\";\n  cardPaddingY?: number;\n  cardPaddingX?: number;\n}\n\nfunction buildDefaultRows(animationDuration: number): LinearProgressRow[] {\n  return [\n    { kind: \"ratio\", label: \"Progress A\", value: 368, maxValue: 500, colorStart: \"#34d399\", colorEnd: \"#10b981\", height: 9 },\n    { kind: \"ratio\", label: \"Progress B\", value: 211, maxValue: 500, colorStart: \"#fb923c\", colorEnd: \"#f97316\", height: 9 },\n    { kind: \"ratio\", label: \"Progress C\", value: 96, maxValue: 500, colorStart: \"#f87171\", colorEnd: \"#ef4444\", height: 9 },\n    {\n      kind: \"bar\",\n      label: \"brand-assets.zip\",\n      labelSub: \"(21.2 MB)\",\n      labelRight: \"67%\",\n      pct: 67,\n      colorStart: \"#6366f1\",\n      colorEnd: \"#8b5cf6\",\n      height: 8,\n      subtitle: \"14.2 MB of 21.2 MB · 8 seconds remaining\",\n      showInfo: true,\n      icon: \"spinner\",\n      capStyle: \"glow\",\n      shimmer: true,\n    },\n    {\n      kind: \"bar\",\n      label: \"quarterly-report.pdf\",\n      labelRight: \"100%\",\n      pct: 100,\n      colorStart: \"#10b981\",\n      colorEnd: \"#10b981\",\n      height: 8,\n      subtitle: \"12.8 MB · Saved to Cloud Storage\",\n      showInfo: true,\n      icon: \"check\",\n      duration: animationDuration * 0.75,\n    },\n    {\n      kind: \"bar\",\n      label: \"prototype-v4.fig\",\n      pct: 38,\n      colorStart: \"#ef4444\",\n      colorEnd: \"#f87171\",\n      height: 8,\n      subtitle: \"Upload interrupted · Tap to retry\",\n      subtitleColor: \"#ef4444\",\n      showInfo: true,\n      icon: \"x\",\n      duration: animationDuration * 0.5,\n    },\n    {\n      kind: \"bar\",\n      label: \"Cloud Storage\",\n      labelRight: \"24.8 GB / 100 GB\",\n      pct: 25,\n      colorStart: \"#3b82f6\",\n      colorEnd: \"#06b6d4\",\n      height: 10,\n      milestones: 4,\n      subtitle: \"Est. full in 18 months\",\n      duration: animationDuration * 0.92,\n    },\n    {\n      kind: \"bar\",\n      label: \"Generating design tokens\",\n      labelRight: \"318 / 400 tasks\",\n      pct: 79,\n      colorStart: \"#f59e0b\",\n      colorEnd: \"#ef4444\",\n      height: 10,\n      subtitle: \"~22 seconds remaining\",\n      capStyle: \"dot\",\n    },\n    {\n      kind: \"bar\",\n      label: \"Bandwidth\",\n      labelRight: \"61%\",\n      pct: 61,\n      colorStart: \"#06b6d4\",\n      colorEnd: \"#8b5cf6\",\n      height: 7,\n      showInfo: true,\n      icon: \"spinner\",\n      shimmer: true,\n      inline: true,\n      duration: animationDuration * 0.92,\n    },\n    {\n      kind: \"bar\",\n      label: \"Monthly Transfer\",\n      labelRight: \"1.2 TB / 2 TB\",\n      pct: 61,\n      colorStart: \"#ec4899\",\n      colorEnd: \"#f97316\",\n      height: 10,\n      subtitle: \"(650 GB / 1.12 TB) · 17 days remaining\",\n      icon: \"close\",\n      capStyle: \"line\",\n      shimmer: true,\n    },\n  ];\n}\n\n// ─── Track (shared bar visual) ───────────────────────────────────────────────\n\nfunction Track({\n  pct,\n  colorStart,\n  colorEnd,\n  height,\n  capStyle,\n  capColor,\n  shimmer,\n  milestones,\n  inline,\n  duration,\n  animated,\n  isDark,\n  label,\n}: {\n  pct: number;\n  colorStart: string;\n  colorEnd: string;\n  height: number;\n  capStyle: \"glow\" | \"dot\" | \"line\" | \"none\";\n  capColor?: string;\n  shimmer: boolean;\n  milestones: number;\n  inline: boolean;\n  duration: number;\n  animated: boolean;\n  isDark: boolean;\n  label?: string;\n}) {\n  const trackBg = isDark ? \"#1e1e1e\" : \"#f0f0f8\";\n  const bg = colorStart === colorEnd ? colorStart : `linear-gradient(90deg, ${colorStart}, ${colorEnd})`;\n  const cap = capColor ?? colorEnd;\n  const target = animated ? pct : 0;\n  const ease = [0.25, 0.46, 0.45, 0.94] as const;\n  const tr = { duration, ease };\n\n  const milePositions = milestones > 1 ? Array.from({ length: milestones - 1 }, (_, i) => Math.round(((i + 1) / milestones) * 100)) : [];\n\n  return (\n    <div\n      role=\"progressbar\"\n      aria-valuenow={pct}\n      aria-valuemin={0}\n      aria-valuemax={100}\n      aria-label={label}\n      className={cn(\"relative rounded-full overflow-visible\", inline ? \"flex-1\" : \"w-full\")}\n      style={{ height, backgroundColor: trackBg }}\n    >\n      {milePositions.map((pos) => (\n        <div\n          key={pos}\n          className=\"absolute top-1/2 z-[2] -translate-x-1/2 -translate-y-1/2 rounded-[1px] pointer-events-none\"\n          style={{ left: `${pos}%`, width: 1.5, height: height * 0.55, backgroundColor: isDark ? \"#3a3a3a\" : \"#d1d5db\" }}\n        />\n      ))}\n\n      <motion.div\n        className=\"absolute inset-y-0 left-0 overflow-hidden rounded-full\"\n        style={{ background: bg }}\n        initial={{ width: \"0%\" }}\n        animate={{ width: `${target}%` }}\n        transition={tr}\n      >\n        <div\n          className=\"pointer-events-none absolute inset-0\"\n          style={{ height: \"45%\", background: \"linear-gradient(180deg,rgba(255,255,255,0.22) 0%,transparent 100%)\" }}\n        />\n        {shimmer && (\n          <motion.div\n            className=\"pointer-events-none absolute top-0 bottom-0\"\n            style={{ width: \"55%\", background: \"linear-gradient(90deg,transparent,rgba(255,255,255,0.35) 50%,transparent)\" }}\n            animate={{ x: [\"-120%\", \"320%\"] }}\n            transition={{ repeat: Infinity, repeatDelay: 2.2, duration: 1.5, ease: \"easeInOut\" }}\n          />\n        )}\n      </motion.div>\n\n      {capStyle !== \"none\" && (\n        <motion.div\n          className=\"absolute top-1/2 z-[3] -translate-x-1/2 -translate-y-1/2 pointer-events-none\"\n          initial={{ left: \"0%\" }}\n          animate={{ left: `${target}%` }}\n          transition={tr}\n        >\n          {capStyle === \"glow\" && (\n            <div\n              className=\"rounded-full bg-white\"\n              style={{ width: height + 4, height: height + 4, border: `2px solid ${cap}`, boxShadow: `0 0 0 3px ${cap}33,0 0 14px 5px ${cap}55` }}\n            />\n          )}\n          {capStyle === \"dot\" && (\n            <div className=\"rounded-full bg-white shadow-[0_2px_6px_rgba(0,0,0,0.16)]\" style={{ width: height + 4, height: height + 4, border: `2px solid ${cap}` }} />\n          )}\n          {capStyle === \"line\" && <div className=\"rounded-[2px] bg-white shadow-[0_1px_4px_rgba(0,0,0,0.18)]\" style={{ width: 3, height: height + 6 }} />}\n        </motion.div>\n      )}\n    </div>\n  );\n}\n\n// ─── Ratio row ────────────────────────────────────────────────────────────────\n\nfunction RatioRow({ row, animated, isDark, duration }: { row: LinearProgressRatioRow; animated: boolean; isDark: boolean; duration: number }) {\n  const textPrimary = isDark ? \"#f3f4f6\" : \"#111827\";\n  const textValue = isDark ? \"#d1d5db\" : \"#374151\";\n  const trackBg = isDark ? \"#1e1e1e\" : \"#efefef\";\n  const pct = row.maxValue > 0 ? Math.min(100, Math.max(0, (row.value / row.maxValue) * 100)) : 0;\n  const target = animated ? pct : 0;\n  const bg = row.colorStart === row.colorEnd ? row.colorStart : `linear-gradient(90deg, ${row.colorStart}, ${row.colorEnd})`;\n  const height = row.height ?? 9;\n\n  return (\n    <div className=\"flex flex-col gap-2.5\">\n      <div className=\"flex items-center justify-between\">\n        <span style={{ fontSize: 14.5, fontWeight: 500, color: textPrimary, letterSpacing: \"-0.015em\" }}>{row.label}</span>\n        <span style={{ fontSize: 14.5, fontWeight: 600, color: textValue, letterSpacing: \"-0.02em\", fontVariantNumeric: \"tabular-nums\" }}>{row.value}</span>\n      </div>\n      <div role=\"progressbar\" aria-valuenow={Math.round(pct)} aria-valuemin={0} aria-valuemax={100} aria-label={row.label} className=\"relative rounded-full overflow-hidden\" style={{ height, backgroundColor: trackBg }}>\n        <motion.div className=\"absolute inset-y-0 left-0 rounded-full\" style={{ background: bg }} initial={{ width: \"0%\" }} animate={{ width: `${target}%` }} transition={{ duration, ease: [0.25, 0.46, 0.45, 0.94] }} />\n      </div>\n    </div>\n  );\n}\n\n// ─── Bar row ──────────────────────────────────────────────────────────────────\n\nfunction BarRow({ row, animated, isDark, defaultDuration, closeIconColor }: { row: LinearProgressBarRow; animated: boolean; isDark: boolean; defaultDuration: number; closeIconColor: string }) {\n  const textPrimary = isDark ? \"#f3f4f6\" : \"#111827\";\n  const textMuted = isDark ? \"#6b7280\" : \"#9ca3af\";\n  const textValue = isDark ? \"#d1d5db\" : \"#374151\";\n  const subColor = row.subtitleColor ?? textMuted;\n  const height = row.height ?? 8;\n  const iconColor = row.icon === \"spinner\" ? row.colorEnd : row.colorStart;\n\n  const icon = row.icon && row.icon !== \"none\" ? <RowIcon icon={row.icon} color={row.icon === \"close\" ? closeIconColor : iconColor} active={animated} /> : null;\n\n  const track = (\n    <Track\n      pct={row.pct}\n      colorStart={row.colorStart}\n      colorEnd={row.colorEnd}\n      height={height}\n      capStyle={row.capStyle ?? \"none\"}\n      capColor={row.capColor}\n      shimmer={row.shimmer ?? false}\n      milestones={row.milestones ?? 0}\n      inline={row.inline ?? false}\n      duration={row.duration ?? defaultDuration}\n      animated={animated}\n      isDark={isDark}\n      label={row.label}\n    />\n  );\n\n  if (row.inline) {\n    return (\n      <div className=\"flex items-center gap-2.5\">\n        {row.label && (\n          <div className=\"flex items-center gap-1.5\">\n            <span style={{ fontSize: 13.5, fontWeight: 500, color: textPrimary, whiteSpace: \"nowrap\", letterSpacing: \"-0.01em\" }}>{row.label}</span>\n            {row.showInfo && <InfoDot color={textMuted} />}\n          </div>\n        )}\n        {track}\n        {row.labelRight && (\n          <span style={{ fontSize: 13, fontWeight: 600, color: textValue, whiteSpace: \"nowrap\", letterSpacing: \"-0.025em\", fontVariantNumeric: \"tabular-nums\" }}>{row.labelRight}</span>\n        )}\n        {icon}\n      </div>\n    );\n  }\n\n  return (\n    <div className=\"flex flex-col gap-1.5\">\n      {(row.label || row.labelRight || icon) && (\n        <div className=\"flex items-center justify-between gap-2\">\n          <div className=\"flex min-w-0 items-center gap-1.5 overflow-hidden\">\n            {row.label && <span style={{ fontSize: 13.5, fontWeight: 500, color: textPrimary, letterSpacing: \"-0.01em\", overflow: \"hidden\", textOverflow: \"ellipsis\", whiteSpace: \"nowrap\" }}>{row.label}</span>}\n            {row.showInfo && <InfoDot color={textMuted} />}\n            {row.labelSub && <span style={{ fontSize: 12, color: textMuted, whiteSpace: \"nowrap\", flexShrink: 0 }}>{row.labelSub}</span>}\n          </div>\n          <div className=\"flex shrink-0 items-center gap-1.5\">\n            {row.labelRight && <span style={{ fontSize: 13, fontWeight: 600, color: textValue, letterSpacing: \"-0.025em\", fontVariantNumeric: \"tabular-nums\" }}>{row.labelRight}</span>}\n            {icon}\n          </div>\n        </div>\n      )}\n      {track}\n      {row.subtitle && <span style={{ fontSize: 11.5, color: subColor, letterSpacing: \"-0.005em\" }}>{row.subtitle}</span>}\n    </div>\n  );\n}\n\n// ─── Main component ──────────────────────────────────────────────────────────\n\nexport function LinearProgressBars({\n  theme = \"light\",\n  scrollReveal = true,\n  animationDuration = 1.2,\n  rows,\n  cardBg = \"#ffffff\",\n  cardRadius = 20,\n  cardBorderWidth = 0,\n  cardBorderColor = \"#e5e7eb\",\n  cardShadow = \"medium\",\n  cardPaddingY = 28,\n  cardPaddingX = 32,\n  className,\n  ...props\n}: LinearProgressBarsProps) {\n  const isDark = theme === \"dark\";\n  const resolvedRows = rows ?? buildDefaultRows(animationDuration);\n  const ref = React.useRef<HTMLDivElement>(null);\n  const isInView = useInView(ref, { once: true, amount: 0.15 });\n  const [animated, setAnimated] = React.useState(!scrollReveal);\n\n  React.useEffect(() => {\n    if (!scrollReveal || !isInView) return;\n    const id = setTimeout(() => setAnimated(true), 0);\n    return () => clearTimeout(id);\n  }, [scrollReveal, isInView]);\n\n  const shadowValue = {\n    none: \"none\",\n    soft: isDark ? \"0 8px 24px rgba(0,0,0,0.45)\" : \"0 4px 16px rgba(0,0,0,0.06)\",\n    medium: isDark ? \"0 0 0 1px rgba(255,255,255,0.07), 0 32px 64px rgba(0,0,0,0.7)\" : \"0 0 0 1px rgba(0,0,0,0.05), 0 20px 60px rgba(0,0,0,0.07)\",\n    strong: isDark ? \"0 0 0 1px rgba(255,255,255,0.09), 0 48px 96px rgba(0,0,0,0.85)\" : \"0 0 0 1px rgba(0,0,0,0.08), 0 32px 80px rgba(0,0,0,0.15)\",\n  }[cardShadow];\n\n  const dividerColor = isDark ? \"rgba(255,255,255,0.06)\" : \"rgba(0,0,0,0.055)\";\n  const closeIconColor = isDark ? \"#5b6370\" : \"#9ca3af\";\n\n  return (\n    <div\n      ref={ref}\n      className={cn(\"flex w-full flex-col gap-5 box-border\", className)}\n      style={{\n        backgroundColor: cardBg,\n        borderRadius: cardRadius,\n        padding: `${cardPaddingY}px ${cardPaddingX}px`,\n        border: cardBorderWidth > 0 ? `${cardBorderWidth}px solid ${cardBorderColor}` : \"none\",\n        boxShadow: shadowValue,\n      }}\n      {...props}\n    >\n      {resolvedRows.map((row, i) => (\n        <React.Fragment key={i}>\n          {i > 0 && <div style={{ height: 1, background: dividerColor }} />}\n          {row.kind === \"ratio\" ? (\n            <RatioRow row={row} animated={animated} isDark={isDark} duration={animationDuration} />\n          ) : (\n            <BarRow row={row} animated={animated} isDark={isDark} defaultDuration={animationDuration} closeIconColor={closeIconColor} />\n          )}\n        </React.Fragment>\n      ))}\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}