{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "progress",
  "title": "Progress",
  "description": "A progress component.",
  "dependencies": [
    "class-variance-authority"
  ],
  "files": [
    {
      "path": "registry/default/progress/progress.tsx",
      "content": "\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { Progress as BaseProgress } from \"@base-ui/react/progress\";\r\nimport { cva, type VariantProps } from \"class-variance-authority\";\r\n\r\nimport { cn } from \"@/lib/utils\";\r\n\r\ninterface ProgressContextValue {\r\n  size?: \"sm\" | \"md\" | \"lg\";\r\n  animated?: boolean;\r\n  value?: number | null;\r\n  min?: number;\r\n  max?: number;\r\n  completed?: boolean;\r\n}\r\n\r\nconst ProgressContext = React.createContext<ProgressContextValue>({});\r\n\r\nconst progressRootVariants = cva(\"w-full\", {\r\n  variants: {\r\n    size: {\r\n      sm: \"space-y-1\",\r\n      md: \"space-y-1.5\",\r\n      lg: \"space-y-2\",\r\n    },\r\n  },\r\n  defaultVariants: {\r\n    size: \"md\",\r\n  },\r\n});\r\n\r\ninterface ProgressRootProps\r\n  extends React.ComponentProps<typeof BaseProgress.Root>,\r\n    VariantProps<typeof progressRootVariants> {\r\n  animated?: boolean;\r\n}\r\n\r\nfunction ProgressRoot({\r\n  className,\r\n  children,\r\n  size,\r\n  animated = false,\r\n  value,\r\n  min = 0,\r\n  max = 100,\r\n  ...props\r\n}: ProgressRootProps) {\r\n  const completed = value !== null && value !== undefined && value >= max;\r\n\r\n  const contextValue = React.useMemo(\r\n    () => ({\r\n      size: size ?? undefined,\r\n      animated,\r\n      value,\r\n      min,\r\n      max,\r\n      completed,\r\n    }),\r\n    [size, animated, value, min, max, completed],\r\n  );\r\n\r\n  return (\r\n    <ProgressContext.Provider value={contextValue}>\r\n      <BaseProgress.Root\r\n        value={value}\r\n        min={min}\r\n        max={max}\r\n        data-slot=\"progress\"\r\n        className={cn(progressRootVariants({ size }), className)}\r\n        {...props}\r\n      >\r\n        {children}\r\n      </BaseProgress.Root>\r\n    </ProgressContext.Provider>\r\n  );\r\n}\r\n\r\nconst progressTrackVariants = cva(\r\n  \"relative w-full overflow-hidden rounded-full bg-primary/15 shadow-[inset_0_1px_2px_0_oklch(0.18_0_0_/_0.06)]\",\r\n  {\r\n    variants: {\r\n      size: {\r\n        sm: \"h-2\",\r\n        md: \"h-2.5\",\r\n        lg: \"h-3.5\",\r\n      },\r\n    },\r\n    defaultVariants: {\r\n      size: \"md\",\r\n    },\r\n  },\r\n);\r\n\r\ninterface ProgressTrackProps\r\n  extends React.ComponentProps<typeof BaseProgress.Track> {\r\n  striped?: boolean;\r\n}\r\n\r\nfunction ProgressTrack({\r\n  className,\r\n  children,\r\n  striped,\r\n  ...props\r\n}: ProgressTrackProps) {\r\n  const { size } = React.useContext(ProgressContext);\r\n\r\n  return (\r\n    <BaseProgress.Track\r\n      data-slot=\"progress-track\"\r\n      className={cn(\r\n        progressTrackVariants({ size }),\r\n        striped &&\r\n          \"from-primary/10 to-primary/20 bg-gradient-to-r bg-[length:1rem_1rem]\",\r\n        className,\r\n      )}\r\n      {...props}\r\n    >\r\n      {children}\r\n    </BaseProgress.Track>\r\n  );\r\n}\r\n\r\nfunction ProgressIndicator({\r\n  className,\r\n  ...props\r\n}: React.ComponentProps<typeof BaseProgress.Indicator>) {\r\n  const { animated, completed } = React.useContext(ProgressContext);\r\n\r\n  return (\r\n    <BaseProgress.Indicator\r\n      data-slot=\"progress-indicator\"\r\n      className={cn(\r\n        \"bg-primary h-full rounded-full shadow-[0_1px_2px_0_oklch(0.22_0_0_/_0.10)]\",\r\n        animated && \"transition-all duration-500 ease-out\",\r\n        completed && \"bg-green-500\",\r\n        className,\r\n      )}\r\n      {...props}\r\n    />\r\n  );\r\n}\r\n\r\nconst progressLabelVariants = cva(\"font-medium\", {\r\n  variants: {\r\n    size: {\r\n      sm: \"text-xs\",\r\n      md: \"text-sm\",\r\n      lg: \"text-base\",\r\n    },\r\n  },\r\n  defaultVariants: {\r\n    size: \"md\",\r\n  },\r\n});\r\n\r\nfunction ProgressLabel({\r\n  className,\r\n  ...props\r\n}: React.ComponentProps<typeof BaseProgress.Label>) {\r\n  const { size } = React.useContext(ProgressContext);\r\n\r\n  return (\r\n    <BaseProgress.Label\r\n      data-slot=\"progress-label\"\r\n      className={cn(progressLabelVariants({ size }), className)}\r\n      {...props}\r\n    />\r\n  );\r\n}\r\n\r\nconst progressValueVariants = cva(\"text-muted-foreground\", {\r\n  variants: {\r\n    size: {\r\n      sm: \"text-xs\",\r\n      md: \"text-sm\",\r\n      lg: \"text-base\",\r\n    },\r\n  },\r\n  defaultVariants: {\r\n    size: \"md\",\r\n  },\r\n});\r\n\r\ninterface ProgressValueProps\r\n  extends React.ComponentProps<typeof BaseProgress.Value> {\r\n  format?: (value: number | null, min: number, max: number) => string;\r\n}\r\n\r\nfunction ProgressValue({\r\n  className,\r\n  format,\r\n  children,\r\n  ...props\r\n}: ProgressValueProps) {\r\n  const {\r\n    size,\r\n    value,\r\n    min = 0,\r\n    max = 100,\r\n    completed,\r\n  } = React.useContext(ProgressContext);\r\n\r\n  if (completed) {\r\n    return (\r\n      <span\r\n        data-slot=\"progress-value\"\r\n        className={cn(\r\n          progressValueVariants({ size }),\r\n          \"text-green-600\",\r\n          className,\r\n        )}\r\n      >\r\n        Complete\r\n      </span>\r\n    );\r\n  }\r\n\r\n  if (format && value !== null && value !== undefined) {\r\n    return (\r\n      <span\r\n        data-slot=\"progress-value\"\r\n        className={cn(progressValueVariants({ size }), className)}\r\n      >\r\n        {format(value, min, max)}\r\n      </span>\r\n    );\r\n  }\r\n\r\n  return (\r\n    <BaseProgress.Value\r\n      data-slot=\"progress-value\"\r\n      className={cn(progressValueVariants({ size }), className)}\r\n      {...props}\r\n    >\r\n      {children}\r\n    </BaseProgress.Value>\r\n  );\r\n}\r\n\r\n// Legacy default export for backward compatibility\r\nfunction Progress({ className, children, ...props }: ProgressRootProps) {\r\n  return (\r\n    <ProgressRoot className={className} {...props}>\r\n      {children}\r\n      <ProgressTrack>\r\n        <ProgressIndicator />\r\n      </ProgressTrack>\r\n    </ProgressRoot>\r\n  );\r\n}\r\n\r\nexport {\r\n  Progress,\r\n  ProgressRoot,\r\n  ProgressTrack,\r\n  ProgressIndicator,\r\n  ProgressLabel,\r\n  ProgressValue,\r\n  type ProgressRootProps,\r\n  type ProgressTrackProps,\r\n  type ProgressValueProps,\r\n};\r\n",
      "type": "registry:ui",
      "target": "components/ui/cubby-ui/progress.tsx"
    }
  ],
  "type": "registry:ui"
}