{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stepper",
  "title": "Stepper",
  "description": "An accessible step indicator with horizontal and vertical layouts, numbered and minimal variants, animated progress connectors, draw-in checkmarks, an error state and optional clickable steps.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/stepper/stepper.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface StepperStep {\n  label: string;\n  description?: string;\n  error?: boolean;\n}\n\nexport type StepperOrientation = \"horizontal\" | \"vertical\";\nexport type StepperVariant = \"numbered\" | \"minimal\";\nexport type StepperSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface StepperProps {\n  steps?: StepperStep[];\n  currentStep?: number;\n  defaultStep?: number;\n  onStepChange?: (step: number) => void;\n  orientation?: StepperOrientation;\n  variant?: StepperVariant;\n  size?: StepperSize;\n  theme?: \"dark\" | \"light\";\n  accentColor?: string;\n  clickable?: boolean;\n  className?: string;\n}\n\nconst DEFAULT_STEPS: StepperStep[] = [\n  { label: \"Account\", description: \"Create your login\" },\n  { label: \"Profile\", description: \"Tell us about you\" },\n  { label: \"Workspace\", description: \"Name your team\" },\n  { label: \"Launch\", description: \"Review and go live\" },\n];\n\nconst PALETTES = {\n  dark: { text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.5)\", line: \"rgba(255,255,255,0.12)\", ring: \"rgba(255,255,255,0.22)\", error: \"#FF7A6B\" },\n  light: { text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.5)\", line: \"rgba(10,10,10,0.12)\", ring: \"rgba(10,10,10,0.22)\", error: \"#E5484D\" },\n};\n\nconst SIZES: Record<StepperSize, { circle: number; font: number; label: number; desc: number; gap: number }> = {\n  sm: { circle: 26, font: 12, label: 13, desc: 11.5, gap: 8 },\n  md: { circle: 34, font: 14, label: 14.5, desc: 12.5, gap: 10 },\n  lg: { circle: 42, font: 16, label: 16, desc: 13.5, gap: 12 },\n};\n\nfunction readableTextOn(hex: string): string {\n  const h = hex.replace(\"#\", \"\");\n  const full = h.length === 3 ? h.split(\"\").map((c) => c + c).join(\"\") : h;\n  const r = parseInt(full.slice(0, 2), 16);\n  const g = parseInt(full.slice(2, 4), 16);\n  const b = parseInt(full.slice(4, 6), 16);\n  return 0.299 * r + 0.587 * g + 0.114 * b > 150 ? \"#0A0A0A\" : \"#FFFFFF\";\n}\n\nexport function Stepper({ steps = DEFAULT_STEPS, currentStep, defaultStep = 0, onStepChange, orientation = \"horizontal\", variant = \"numbered\", size = \"md\", theme = \"dark\", accentColor = \"#F2A841\", clickable = false, className }: StepperProps) {\n  const p = PALETTES[theme];\n  const s = SIZES[size];\n  const [internal, setInternal] = React.useState(defaultStep);\n  const isControlled = currentStep !== undefined;\n  const current = Math.min(steps.length - 1, Math.max(0, isControlled ? currentStep : internal));\n  const vertical = orientation === \"vertical\";\n  const minimal = variant === \"minimal\";\n  const circle = minimal ? Math.round(s.circle * 0.42) : s.circle;\n  const onAccent = readableTextOn(accentColor);\n\n  const go = (i: number) => {\n    if (!clickable || i === current) return;\n    if (!isControlled) setInternal(i);\n    onStepChange?.(i);\n  };\n\n  return (\n    <ol className={cn(\"m-0 flex list-none p-0\", vertical ? \"flex-col\" : \"w-full\", className)} style={{ fontFamily: \"Inter, sans-serif\" }}>\n      {steps.map((step, i) => {\n        const complete = i < current;\n        const active = i === current;\n        const color = step.error ? p.error : accentColor;\n        const last = i === steps.length - 1;\n        const filled = complete && !step.error;\n\n        const circleEl = (\n          <span\n            className=\"relative flex shrink-0 items-center justify-center rounded-full font-bold tabular-nums\"\n            style={{\n              width: circle,\n              height: circle,\n              fontSize: s.font,\n              color: filled ? onAccent : step.error ? p.error : active ? color : p.muted,\n              background: filled ? color : active || step.error ? `color-mix(in srgb, ${color} 14%, transparent)` : \"transparent\",\n              border: `${minimal ? 2 : 1.5}px solid ${filled || active || step.error ? color : p.ring}`,\n              boxShadow: active && !minimal ? `0 0 0 4px color-mix(in srgb, ${color} 18%, transparent)` : \"0 0 0 0 transparent\",\n              transition: \"background 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease\",\n            }}\n          >\n            {!minimal && (\n              <>\n                {filled ? (\n                  <svg width={circle * 0.5} height={circle * 0.5} viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n                    <motion.path d=\"M3 8.2L6.4 11.6L13 4.4\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" initial={{ pathLength: 0 }} animate={{ pathLength: 1 }} transition={{ duration: 0.28, ease: \"easeOut\" }} />\n                  </svg>\n                ) : step.error ? (\n                  \"!\"\n                ) : (\n                  i + 1\n                )}\n              </>\n            )}\n            {minimal && active && <motion.span className=\"absolute rounded-full\" style={{ inset: -6, border: `1.5px solid ${color}` }} initial={{ scale: 0.7, opacity: 0.8 }} animate={{ scale: 1.25, opacity: 0 }} transition={{ duration: 1.4, ease: \"easeOut\", repeat: Infinity }} />}\n            {minimal && filled && <span className=\"block rounded-full\" style={{ width: circle * 0.5, height: circle * 0.5, background: onAccent }} />}\n          </span>\n        );\n\n        const text = (\n          <span className={cn(\"flex flex-col\", vertical ? \"items-start text-left\" : \"items-center text-center\")} style={{ gap: 2 }}>\n            <span className=\"font-semibold tracking-[-0.01em]\" style={{ fontSize: s.label, color: active || complete ? p.text : p.muted, transition: \"color 0.25s ease\" }}>\n              {step.label}\n            </span>\n            {step.description && (\n              <span style={{ fontSize: s.desc, color: p.muted, lineHeight: 1.4 }}>{step.description}</span>\n            )}\n          </span>\n        );\n\n        const body = clickable ? (\n          <button type=\"button\" onClick={() => go(i)} aria-current={active ? \"step\" : undefined} className={cn(\"flex cursor-pointer border-none bg-transparent p-0 outline-none focus-visible:ring-2 rounded-lg\", vertical ? \"flex-row items-start\" : \"flex-col items-center\")} style={{ gap: s.gap, [\"--tw-ring-color\" as string]: accentColor }}>\n            {circleEl}\n            {text}\n          </button>\n        ) : (\n          <div aria-current={active ? \"step\" : undefined} className={cn(\"flex\", vertical ? \"flex-row items-start\" : \"flex-col items-center\")} style={{ gap: s.gap }}>\n            {circleEl}\n            {text}\n          </div>\n        );\n\n        if (vertical) {\n          return (\n            <li key={i} className=\"relative flex\" style={{ paddingBottom: last ? 0 : 26 }}>\n              {body}\n              {!last && (\n                <span aria-hidden=\"true\" className=\"absolute overflow-hidden\" style={{ left: circle / 2 - 1, top: circle + 6, bottom: 6, width: 2, borderRadius: 2, background: p.line }}>\n                  <motion.span key=\"v\" className=\"block w-full\" style={{ background: accentColor, originY: 0, height: \"100%\" }} initial={false} animate={{ scaleY: complete ? 1 : 0 }} transition={{ duration: 0.4, ease: [0.16, 1, 0.3, 1] }} />\n                </span>\n              )}\n            </li>\n          );\n        }\n\n        return (\n          <li key={i} className=\"relative flex flex-1 justify-center\">\n            {body}\n            {!last && (\n              <span aria-hidden=\"true\" className=\"absolute overflow-hidden\" style={{ top: circle / 2 - 1, left: `calc(50% + ${circle / 2 + 10}px)`, right: `calc(-50% + ${circle / 2 + 10}px)`, height: 2, borderRadius: 2, background: p.line }}>\n                <motion.span key=\"h\" className=\"block h-full\" style={{ background: accentColor, originX: 0, width: \"100%\" }} initial={false} animate={{ scaleX: complete ? 1 : 0 }} transition={{ duration: 0.4, ease: [0.16, 1, 0.3, 1] }} />\n              </span>\n            )}\n          </li>\n        );\n      })}\n    </ol>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}