{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stepper",
  "title": "Stepper",
  "description": "A stepper component for multi-step processes.",
  "dependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/components/ui/stepper.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"@/stories/lib/utils\";\nimport { createContext, useContext, useState } from \"react\";\nimport { Check } from \"phosphor-react\";\n\ntype StepState = \"inactive\" | \"active\" | \"completed\";\ntype Orientation = \"horizontal\" | \"vertical\";\ntype StepStyle = \"numbered\" | \"icon\";\ntype TrailType = \"line\" | \"dotted\";\n\ninterface StepperConfig {\n  activeStep: number;\n  setActiveStep: (n: number) => void;\n  orientation: Orientation;\n  totalSteps: number;\n  stepStyle: StepStyle;\n  trailType: TrailType;\n  showTitle: boolean;\n  showDescription: boolean;\n}\n\ninterface StepperProviderProps {\n  children: React.ReactNode;\n  orientation?: Orientation;\n  steps?: number; // 2–7\n  stepStyle?: StepStyle;\n  trailType?: TrailType;\n  showTitle?: boolean;\n  showDescription?: boolean;\n}\n\nconst StepperContext = createContext<StepperConfig | null>(null);\n\nexport function StepperProvider({\n  children,\n  orientation = \"horizontal\",\n  steps = 3,\n  stepStyle = \"icon\",\n  trailType = \"line\",\n  showTitle = true,\n  showDescription = true,\n}: StepperProviderProps) {\n  const [activeStep, setActiveStep] = useState(1);\n\n  return (\n    <StepperContext.Provider\n      value={{\n        activeStep,\n        setActiveStep,\n        orientation,\n        totalSteps: steps,\n        stepStyle,\n        trailType,\n        showTitle,\n        showDescription,\n      }}\n    >\n      <div\n        className={cn(\n          \"flex w-full\",\n          orientation === \"horizontal\"\n            ? \"flex-row items-start justify-between\"\n            : \"flex-col\",\n        )}\n      >\n        {children}\n      </div>\n    </StepperContext.Provider>\n  );\n}\n\nexport function useStepper() {\n  const ctx = useContext(StepperContext);\n  if (!ctx) throw new Error(\"useStepper must be used within StepperProvider\");\n  return ctx;\n}\n\ninterface StepperItemProps {\n  step: number;\n  title: string;\n  description?: string;\n  icon?: React.ReactNode;\n}\n\nexport function StepperItem({\n  step,\n  title,\n  description,\n  icon,\n}: StepperItemProps) {\n  const {\n    activeStep,\n    setActiveStep,\n    orientation,\n    totalSteps,\n    stepStyle,\n    trailType,\n    showTitle,\n    showDescription,\n  } = useStepper();\n\n  let state: StepState = \"inactive\";\n  if (step < activeStep) state = \"completed\";\n  else if (step === activeStep) state = \"active\";\n\n  const trailClasses =\n    trailType === \"line\" ? \"bg-muted\" : \"border-b-2 border-dashed border-muted\";\n\n  const trailVerticalClasses =\n    trailType === \"line\" ? \"bg-muted\" : \"border-l border-dashed border-muted\";\n\n  return (\n    <div\n      className={cn(\n        \"relative flex  \",\n        orientation === \"horizontal\"\n          ? \"flex-1 flex-col justify-center items-start\"\n          : \"flex-row justify-start gap-4 items-start min-h-20\",\n      )}\n    >\n      {/* Connector trail */}\n      {step !== totalSteps && (\n        <div\n          className={cn(\n            \"absolute\",\n            orientation === \"horizontal\"\n              ? \"left-[calc(10%)] right-[calc(-10%+10px)] top-5 h-0.5\"\n              : \"top-[calc(50%)] bottom-[calc(-50%+10px)] left-5 w-0.5\",\n            orientation === \"horizontal\" ? trailClasses : trailVerticalClasses,\n            state === \"completed\" && \" border-secondary  \",\n            state === \"completed\" && trailType === \"line\" && \" bg-secondary \",\n          )}\n        />\n      )}\n\n      {/* Step button */}\n      <button\n        onClick={() => setActiveStep(step)}\n        className={cn(\n          \"z-10 flex h-10 w-10 items-center justify-center rounded-full border transition\",\n          state === \"completed\"\n            ? \"bg-primary text-white\"\n            : \"bg-white border-muted text-muted-foreground\",\n          state === \"active\" && \"ring-2 ring-secondary text-primary font-bold\",\n        )}\n      >\n        {state === \"completed\" ? (\n          <Check size={20} weight=\"bold\" />\n        ) : stepStyle === \"numbered\" ? (\n          step\n        ) : (\n          icon\n        )}\n      </button>\n\n      {/* Labels */}\n      <div\n        className={cn(\n          \"mt-3 flex flex-col\",\n          orientation === \"horizontal\"\n            ? \"items-start text-start\"\n            : \"items-start text-start\",\n        )}\n      >\n        {showTitle && (\n          <div className={cn(\"text-sm font-semibold transition lg:text-base\")}>\n            {title}\n          </div>\n        )}\n        {showDescription && description && (\n          <div\n            className={cn(\n              \"sr-only text-xs text-muted-foreground transition md:not-sr-only lg:text-sm\",\n              // state === \"active\" && \"text-primary\"\n            )}\n          >\n            {description}\n          </div>\n        )}\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "components/ui/stepper.tsx"
    }
  ],
  "type": "registry:ui"
}