{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "progress-bar",
  "type": "registry:ui",
  "title": "ProgressBar",
  "description": "ProgressBar communicates the progress of a task or loading operation.",
  "dependencies": [
    "@radix-ui/react-progress@^1.1.8",
    "@remixicon/react@^4.9.0",
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "https://wideset.co/r/field-label.json",
    "https://wideset.co/r/helper-text.json",
    "https://wideset.co/r/motion.json",
    "https://wideset.co/r/styles.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/components/progress-bar/ProgressBar.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/progress-bar/ProgressBar.tsx",
      "content": "'use client';\n\nimport * as ProgressPrimitive from '@radix-ui/react-progress';\nimport { RiCheckboxCircleFill, RiErrorWarningFill } from '@remixicon/react';\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport { FieldLabel } from '../field-label/FieldLabel';\nimport { HelperText } from '../helper-text/HelperText';\nimport type { ProgressBarProps } from './ProgressBar.types';\nimport {\n  progressBarCircleIconVariants,\n  progressBarCircleMotionVariants,\n  progressBarIndicatorMotionVariants,\n  progressBarIndicatorVariants,\n} from './ProgressBar.variants';\n\nconst ProgressBar = React.forwardRef<\n  React.ComponentRef<typeof ProgressPrimitive.Root>,\n  ProgressBarProps\n>(\n  (\n    {\n      className,\n      value,\n      max: maxProp,\n      getValueLabel,\n      asChild,\n      label,\n      description,\n      fixedWidth,\n      variant = 'default',\n      type = 'bar',\n      defaultMotion,\n      ...props\n    },\n    ref,\n  ) => {\n    const motion = useDefaultMotion(defaultMotion);\n    const labelId = React.useId();\n    const hasOwnName = Boolean(props['aria-label'] || props['aria-labelledby']);\n    const fallbackName = hasOwnName || label ? undefined : 'Progress';\n    const max = typeof maxProp === 'number' && maxProp > 0 ? maxProp : 100;\n    const clampedValue =\n      typeof value === 'number' && !Number.isNaN(value) ? Math.min(Math.max(value, 0), max) : 0;\n    const progressValue = Math.round((clampedValue / max) * 100);\n\n    if (Number.isNaN(value)) {\n      // eslint-disable-next-line no-console\n      console.warn('ProgressBar received NaN for `value` prop.');\n    }\n\n    if (type === 'circle') {\n      const size = 20;\n      const strokeWidth = 2.5;\n      const radius = size / 2 - strokeWidth / 2;\n      const circumference = 2 * Math.PI * radius;\n      const fraction = progressValue / 100;\n      const dashArray = circumference;\n      const offset = circumference * (1 - fraction);\n\n      const icons: Record<typeof variant, React.ReactNode> = {\n        default: (\n          <svg\n            width={size}\n            height={size}\n            viewBox={`0 0 ${size} ${size}`}\n            className=\"shrink-0\"\n            aria-hidden=\"true\"\n            focusable=\"false\"\n          >\n            <circle\n              cx={size / 2}\n              cy={size / 2}\n              r={radius}\n              className=\"fill-none stroke-(--border-color-ws-dynamic-secondary-default)\"\n              strokeWidth={strokeWidth}\n            />\n            <circle\n              cx={size / 2}\n              cy={size / 2}\n              r={radius}\n              className={cn(\n                'stroke-ws-dynamic-primary-default fill-none',\n                progressBarCircleMotionVariants({ enabled: motion }),\n              )}\n              strokeWidth={strokeWidth}\n              strokeLinecap=\"round\"\n              strokeDasharray={dashArray}\n              strokeDashoffset={offset}\n              transform={`rotate(-90 ${size / 2} ${size / 2})`}\n            />\n          </svg>\n        ),\n        success: (\n          <RiCheckboxCircleFill\n            aria-hidden=\"true\"\n            focusable=\"false\"\n            className={progressBarCircleIconVariants({ variant: 'success' })}\n          />\n        ),\n        error: (\n          <RiErrorWarningFill\n            aria-hidden=\"true\"\n            focusable=\"false\"\n            className={progressBarCircleIconVariants({ variant: 'error' })}\n          />\n        ),\n      };\n\n      return (\n        <div\n          data-slot=\"progress-bar\"\n          ref={ref}\n          {...props}\n          className={cn('gap-ws-5 inline-flex items-center', className)}\n          role=\"progressbar\"\n          aria-valuenow={clampedValue}\n          aria-valuemin={0}\n          aria-valuemax={max}\n          // The circle has no visible label, so `label` names it when no ARIA name is given.\n          aria-label={hasOwnName ? props['aria-label'] : (label ?? 'Progress')}\n        >\n          <div className={fixedWidth ? 'w-ws-14' : undefined}>\n            <span className=\"typography-label-sm text-ws-static-subtle\">{`${progressValue}%`}</span>\n          </div>\n\n          {icons[variant]}\n        </div>\n      );\n    }\n\n    return (\n      <div className=\"gap-ws-5 flex w-full flex-col\">\n        {label && (\n          <div className=\"gap-ws-3 flex items-center justify-between\">\n            <FieldLabel id={labelId}>{label}</FieldLabel>\n            <span className=\"typography-label-sm text-ws-static-subtle\">{`${progressValue}%`}</span>\n          </div>\n        )}\n\n        <ProgressPrimitive.Root\n          ref={ref}\n          value={clampedValue}\n          max={max}\n          getValueLabel={getValueLabel}\n          asChild={asChild}\n          className={cn(\n            'h-ws-3 relative w-full overflow-hidden rounded-full bg-(--ws-dynamic-stroke-secondary-default)',\n            className,\n          )}\n          aria-labelledby={label ? labelId : undefined}\n          data-slot=\"progress-bar\"\n          aria-label={fallbackName}\n          {...props}\n        >\n          <ProgressPrimitive.Indicator\n            className={cn(\n              progressBarIndicatorVariants({ variant }),\n              progressBarIndicatorMotionVariants({ enabled: motion }),\n            )}\n            style={{ transform: `translateX(-${100 - (progressValue || 0)}%)` }}\n          />\n        </ProgressPrimitive.Root>\n\n        {description && (\n          <HelperText\n            key={variant}\n            state={variant}\n            showIcon={variant === 'success' || variant === 'error'}\n          >\n            {description}\n          </HelperText>\n        )}\n      </div>\n    );\n  },\n);\nProgressBar.displayName = 'ProgressBar';\n\nexport { ProgressBar };\n"
    },
    {
      "path": "src/components/progress-bar/ProgressBar.types.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/progress-bar/ProgressBar.types.ts",
      "content": "import type * as ProgressPrimitive from '@radix-ui/react-progress';\n\nimport type { MotionProps } from '@/lib/wideset/motion/Motion.types';\n\nexport type ProgressBarProps = React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> &\n  MotionProps & {\n    /** Semantic state — controls color for both bar fill and circle icon. */\n    variant?: 'default' | 'success' | 'error';\n    /** Label shown above the bar (bar type only); it also names the bar. */\n    label?: string;\n    /** Helper text shown below the indicator (bar type only). */\n    description?: string;\n    /** Shape of the progress indicator. */\n    type?: 'bar' | 'circle';\n    /** Aligns the percentage label to a fixed width to prevent layout shift during animation (circle type only). */\n    fixedWidth?: boolean;\n  };\n"
    },
    {
      "path": "src/components/progress-bar/ProgressBar.variants.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/progress-bar/ProgressBar.variants.ts",
      "content": "import { cva } from 'class-variance-authority';\n\nimport { fillTravelMotion } from '@/lib/wideset/motion/recipes';\n\nexport const progressBarIndicatorVariants = cva('size-full flex-1 rounded-full', {\n  variants: {\n    variant: {\n      default: 'bg-ws-dynamic-primary-default',\n      success: 'bg-(--ws-semantic-stroke-positive)',\n      error: 'bg-(--ws-semantic-stroke-negative)',\n    },\n  },\n  defaultVariants: {\n    variant: 'default',\n  },\n});\n\nexport const progressBarCircleIconVariants = cva('size-ws-control-md', {\n  variants: {\n    variant: {\n      success: 'text-(--ws-dynamic-stroke-success-strong-default)',\n      error: 'text-(--ws-dynamic-text-danger-default)',\n    },\n  },\n});\n\nexport const progressBarIndicatorMotionVariants = cva('', {\n  variants: {\n    enabled: { true: fillTravelMotion, false: '' },\n  },\n  defaultVariants: { enabled: true },\n});\n\nexport const progressBarCircleMotionVariants = cva('', {\n  variants: {\n    enabled: { true: 'transition-[stroke-dashoffset] ease-linear', false: '' },\n  },\n  defaultVariants: { enabled: true },\n});\n"
    }
  ],
  "meta": {
    "version": "1.0.0",
    "commit": "8bb3627"
  }
}
