{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stepper",
  "type": "registry:ui",
  "title": "Stepper",
  "description": "The stepper primitive.",
  "dependencies": [
    "lucide-react@^1.49.0"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/theme.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/ui/stepper.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/stepper.tsx",
      "content": "import { Check } from 'lucide-react';\nimport { cn } from '../lib/utils';\n\nexport interface StepperStep {\n  label: string;\n  description?: string;\n}\n\nexport interface StepperProps {\n  steps: StepperStep[];\n  /** The step the person is on, counting from 0. Steps before it are complete; steps after it are upcoming. */\n  current: number;\n  /** Names the list. Required: \"Booking progress\". */\n  'aria-label': string;\n  /** What assistive tech hears beside each step, so state is never colour alone. Pass them translated. */\n  labels?: { complete: string; current: string; upcoming: string };\n  /** With this, a completed step is a button that goes back to it. */\n  onStepSelect?: (index: number) => void;\n  className?: string;\n}\n\n/**\n * Where someone is in a flow of known length: numbered steps, the current one marked with aria-current=\"step\", and each step's\n * state said in words for assistive tech and shown by an icon or number. Horizontal in a wide container, a list down the side in a\n * narrow one. It shows progress; moving on is up to the buttons around it.\n */\nexport function Stepper({ steps, current, labels = { complete: 'Completed', current: 'Current step', upcoming: 'Upcoming' }, onStepSelect, className, ...aria }: StepperProps) {\n  return (\n    <div className={cn('@container', className)}>\n    <ol className=\"flex flex-col gap-4 @md:flex-row @md:gap-0\" {...aria}>\n      {steps.map((s, i) => {\n        const state = i < current ? 'complete' : i === current ? 'current' : 'upcoming';\n        const body = (\n          <>\n            <span\n              aria-hidden\n              className={cn(\n                'inline-flex size-8 shrink-0 items-center justify-center rounded-kh-pill border text-kh-small font-semibold tabular-nums',\n                state === 'complete' && 'border-kh-ink bg-kh-ink text-kh-on-ink',\n                state === 'current' && 'border-kh-ink bg-kh-surface text-kh-ink ring-2 ring-kh-ink ring-offset-2 ring-offset-kh-canvas',\n                state === 'upcoming' && 'border-kh-line-strong bg-kh-surface text-kh-muted',\n              )}\n            >\n              {state === 'complete' ? <Check className=\"size-4\" /> : i + 1}\n            </span>\n            <span className=\"flex min-w-0 flex-col text-left\">\n              <span className={cn('text-kh-small font-medium', state === 'upcoming' ? 'text-kh-muted' : 'text-kh-ink')}>\n                {s.label}\n                <span className=\"sr-only\">, {labels[state]}</span>\n              </span>\n              {s.description && <span className=\"text-kh-caption text-kh-muted\">{s.description}</span>}\n            </span>\n          </>\n        );\n        return (\n          <li key={i} aria-current={state === 'current' ? 'step' : undefined} className={cn('relative flex min-w-0 items-start', i < steps.length - 1 ? '@md:flex-1' : '@md:flex-none')}>\n            {onStepSelect && state === 'complete' ? (\n              <button type=\"button\" onClick={() => onStepSelect(i)} className=\"flex items-start gap-3 rounded-kh text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--kh-focus)\">\n                {body}\n              </button>\n            ) : (\n              <div className=\"flex items-start gap-3\">{body}</div>\n            )}\n            {i < steps.length - 1 && (\n              <>\n                <span aria-hidden className={cn('absolute -bottom-4 left-4 top-9 w-px @md:hidden', i < current ? 'bg-kh-ink' : 'bg-kh-line-strong')} />\n                <span aria-hidden className={cn('mx-3 mt-4 hidden h-px min-w-6 flex-1 @md:block', i < current ? 'bg-kh-ink' : 'bg-kh-line-strong')} />\n              </>\n            )}\n          </li>\n        );\n      })}\n    </ol>\n    </div>\n  );\n}\n"
    }
  ]
}
