{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "progress",
  "title": "Progress",
  "description": "Linear progress in four variants: spring-filled determinate, indeterminate double sweep, moving stripes and segmented steps.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://goodui.dev/r/goodui-motion.json",
    "https://goodui.dev/r/locale.json"
  ],
  "files": [
    {
      "path": "registry/components/numbers/progress.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport { cn } from \"@/lib/utils\"\nimport { useLabels } from \"@/lib/goodui-locale\"\nimport { GooduiTokens, spring as springs } from \"@/lib/goodui-motion\"\n\nconst CSS = `\n@keyframes pc-progress-sweep { 0% { transform: translateX(-100%) scaleX(.6) } 60% { transform: translateX(160%) scaleX(1) } 100% { transform: translateX(260%) scaleX(.6) } }\n@keyframes pc-progress-sweep-2 { 0% { transform: translateX(-120%) } 100% { transform: translateX(480%) } }\n@keyframes pc-progress-stripes { from { transform: translateX(-1rem) } to { transform: translateX(0) } }\n.pc-progress-sweep { position: absolute; inset-block: 0; left: 0; width: 40%; border-radius: inherit; animation: pc-progress-sweep 1.6s var(--pc-ease-in-out) infinite; }\n.pc-progress-sweep-2 { position: absolute; inset-block: 0; left: 0; width: 22%; border-radius: inherit; animation: pc-progress-sweep-2 1.6s var(--pc-ease-in-out) .8s infinite; transform: translateX(-120%); }\n.pc-progress-stripes::after {\n  content: \"\"; position: absolute; top: 0; bottom: 0; left: -1rem; right: 0;\n  background-image: linear-gradient(45deg, rgb(255 255 255 / .22) 25%, transparent 25%, transparent 50%, rgb(255 255 255 / .22) 50%, rgb(255 255 255 / .22) 75%, transparent 75%, transparent);\n  background-size: 1rem 1rem;\n  animation: pc-progress-stripes .8s linear infinite;\n}\n@media (prefers-reduced-motion: reduce) {\n  .pc-progress-sweep { animation: none; transform: none; width: 100%; opacity: .45 }\n  .pc-progress-sweep-2 { display: none }\n  .pc-progress-stripes::after { animation: none }\n}\n`\n\nexport type ProgressVariant = \"determinate\" | \"indeterminate\" | \"striped\" | \"steps\"\n\nexport type ProgressProps = Omit<React.ComponentProps<\"div\">, \"children\"> & {\n  /** Current value, 0 to max. Ignored by the indeterminate variant. */\n  value?: number\n  /** Value that counts as complete. For steps, set it to the step count so value is the number of finished steps. */\n  max?: number\n  /** determinate: spring fill. indeterminate: looping sweep for unknown duration. striped: fill with moving stripes. steps: one segment per step. */\n  variant?: ProgressVariant\n  /** Number of segments for the steps variant. */\n  steps?: number\n  /** Bar height: sm 4px, md 8px, lg 12px. */\n  size?: \"sm\" | \"md\" | \"lg\"\n  /** Optional label above the bar. */\n  label?: React.ReactNode\n  /** Show the percentage (or \"step x of n\") next to the label. */\n  showValue?: boolean\n  /** Classes for the filled part, e.g. \"bg-emerald-500\". */\n  indicatorClassName?: string\n  /** Text for built-in controls and screen readers; pass translations here. */\n  labels?: Partial<ProgressLabels>\n}\n\n/** Built-in text: the fallback accessible name and the steps variant's \"Step x of n\". */\nexport type ProgressLabels = { progress: string; stepOf: (step: number, count: number) => string }\nconst DEFAULT_LABELS: ProgressLabels = { progress: \"Progress\", stepOf: (step, count) => `Step ${step} of ${count}` }\n\nconst HEIGHT = { sm: \"h-1\", md: \"h-2\", lg: \"h-3\" }\n\n/** Progress bar with four variants: spring fill, indeterminate sweep, moving stripes and filling steps. */\nexport function Progress({\n  value = 0,\n  max = 100,\n  variant = \"determinate\",\n  steps = 4,\n  size = \"md\",\n  label,\n  showValue = false,\n  indicatorClassName,\n  labels,\n  className,\n  ...props\n}: ProgressProps) {\n  const l = useLabels(\"progress\", DEFAULT_LABELS, labels)\n  const reduce = useReducedMotion() ?? false\n  const ratio = max > 0 ? Math.min(Math.max(value / max, 0), 1) : 0\n  const spring = reduce ? { duration: 0 } : springs.morph\n  const indeterminate = variant === \"indeterminate\"\n  const stepCount = Math.max(1, Math.round(steps))\n  const done = Math.round(ratio * stepCount * 100) / 100\n  const valueText = variant === \"steps\" ? l.stepOf(Math.min(Math.floor(done) + (done < stepCount ? 1 : 0), stepCount), stepCount) : `${Math.round(ratio * 100)}%`\n  const labelId = React.useId()\n\n  // The track holds no text, so RTL simply mirrors it: fills and sweeps then run from the inline start.\n  const track = cn(\"relative w-full overflow-hidden rounded-full bg-muted rtl:-scale-x-100\", HEIGHT[size])\n  const fill = cn(\"bg-primary\", indicatorClassName)\n\n  return (\n    <div className={cn(\"w-full\", className)} {...props}>\n      <GooduiTokens />\n      <style href=\"pc-progress\" precedence=\"default\">\n        {CSS}\n      </style>\n      {(label || (showValue && !indeterminate)) && (\n        <div className=\"mb-2 flex items-baseline justify-between gap-3 text-sm\">\n          <span id={labelId} className=\"truncate font-medium\">\n            {label}\n          </span>\n          {showValue && !indeterminate && <span className=\"shrink-0 tabular-nums text-muted-foreground\">{valueText}</span>}\n        </div>\n      )}\n      <div\n        role=\"progressbar\"\n        aria-labelledby={label ? labelId : undefined}\n        aria-label={label ? undefined : l.progress}\n        aria-valuemin={indeterminate ? undefined : 0}\n        aria-valuemax={indeterminate ? undefined : max}\n        aria-valuenow={indeterminate ? undefined : Math.min(Math.max(value, 0), max)}\n        aria-valuetext={indeterminate ? undefined : valueText}\n        aria-busy={indeterminate || undefined}\n        className={variant === \"steps\" ? cn(\"flex w-full gap-1.5\", HEIGHT[size]) : track}\n      >\n        {variant === \"indeterminate\" && (\n          <>\n            <div className={cn(\"pc-progress-sweep\", fill)} />\n            <div className={cn(\"pc-progress-sweep-2\", fill)} />\n          </>\n        )}\n        {(variant === \"determinate\" || variant === \"striped\") && (\n          <motion.div\n            className={cn(\"absolute inset-0 overflow-hidden rounded-full\", fill, variant === \"striped\" && \"pc-progress-stripes\")}\n            initial={{ x: \"-100%\" }}\n            // Fading out at 0 hides the 1px sliver that sub-pixel rounding can leave at the track edge.\n            animate={{ x: `${(ratio - 1) * 100}%`, opacity: ratio > 0 ? 1 : 0 }}\n            transition={reduce ? spring : { ...spring, opacity: { duration: 0.15, delay: ratio > 0 ? 0 : 0.3 } }}\n          />\n        )}\n        {variant === \"steps\" &&\n          Array.from({ length: stepCount }, (_, i) => {\n            const part = Math.min(Math.max(done - i, 0), 1)\n            return (\n              <div key={i} className=\"relative h-full flex-1 overflow-hidden rounded-full bg-muted rtl:-scale-x-100\">\n                <motion.div\n                  className={cn(\"absolute inset-0 rounded-full\", fill)}\n                  initial={{ x: \"-100%\" }}\n                  animate={{ x: `${(part - 1) * 100}%`, opacity: part > 0 ? 1 : 0 }}\n                  transition={reduce ? spring : { ...spring, opacity: { duration: 0.15, delay: part > 0 ? 0 : 0.3 } }}\n                />\n              </div>\n            )\n          })}\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/goodui/progress.tsx"
    }
  ],
  "categories": [
    "components",
    "numbers"
  ],
  "type": "registry:component"
}