{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "progress",
  "type": "registry:ui",
  "title": "Progress",
  "description": "A bar for a known share done or an indeterminate wait, on the native progress element so the value is announced.",
  "dependencies": [],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/theme.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/ui/progress.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/progress.tsx",
      "content": "import { cn } from '../lib/utils';\n\nexport interface ProgressProps {\n  /** Required: what is progressing (\"Upload\", \"Profile completeness\"). */\n  label: string;\n  /** 0 to `max`. Omit for an indeterminate bar: work is happening and the end is unknown. */\n  value?: number;\n  max?: number;\n  /** Show the label and the percentage above the bar. */\n  showValue?: boolean;\n  className?: string;\n}\n\n/** A bar for a task with a known share done, on the native <progress> element, so the value is announced with no script. */\nexport function Progress({ label, value, max = 100, showValue, className }: ProgressProps) {\n  const known = value !== undefined;\n  const pct = known ? Math.round((Math.min(Math.max(value, 0), max) / max) * 100) : undefined;\n  return (\n    <div className={cn('flex flex-col gap-1.5', className)}>\n      {showValue && (\n        <div className=\"flex items-baseline justify-between gap-3 text-kh-small\">\n          <span className=\"font-medium text-kh-ink\" aria-hidden>{label}</span>\n          <span className=\"text-kh-muted\" aria-hidden>{known ? `${pct}%` : 'Working…'}</span>\n        </div>\n      )}\n      <progress\n        aria-label={label}\n        value={known ? Math.min(Math.max(value, 0), max) : undefined}\n        max={max}\n        className={cn(\n          'block h-2 w-full appearance-none overflow-hidden rounded-kh-pill border-0 bg-kh-surface-3 [color:var(--kh-accent)]',\n          '[&::-webkit-progress-bar]:bg-kh-surface-3 [&::-webkit-progress-value]:rounded-kh-pill [&::-webkit-progress-value]:bg-kh-accent [&::-webkit-progress-value]:transition-[width] [&::-webkit-progress-value]:duration-(--kh-dur)',\n          '[&::-moz-progress-bar]:rounded-kh-pill [&::-moz-progress-bar]:bg-kh-accent',\n          !known && 'animate-pulse bg-kh-accent/40 [&::-webkit-progress-bar]:bg-kh-accent/40',\n        )}\n      />\n    </div>\n  );\n}\n"
    }
  ]
}
