{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "progress-tracker",
  "type": "registry:ui",
  "title": "ProgressTracker",
  "description": "A horizontal progress indicator made of coloured step segments.",
  "dependencies": [
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "https://wideset.co/r/styles.json",
    "https://wideset.co/r/tooltip.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/components/progress-tracker/ProgressTracker.context.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/progress-tracker/ProgressTracker.context.tsx",
      "content": "'use client';\n\nimport { createContext, useContext } from 'react';\n\nimport type { ProgressTrackerContextValue } from './ProgressTracker.types';\n\nexport const ProgressTrackerContext = createContext<ProgressTrackerContextValue | undefined>(\n  undefined,\n);\n\nexport const useProgressTrackerContext = () => {\n  const context = useContext(ProgressTrackerContext);\n\n  if (!context) {\n    throw new Error('useProgressTrackerContext must be used within a ProgressTracker');\n  }\n\n  return context;\n};\n"
    },
    {
      "path": "src/components/progress-tracker/ProgressTracker.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/progress-tracker/ProgressTracker.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { ProgressTrackerContext } from './ProgressTracker.context';\nimport type {\n  ProgressTrackerProps,\n  ProgressTrackerStepProps,\n  ProgressTrackerWithSubComponents,\n} from './ProgressTracker.types';\nimport { ProgressTrackerStep } from './ProgressTrackerStep';\n\nconst defaultStepAriaLabel = (stepIndex: number) => `Step ${stepIndex + 1}`;\n\nconst ProgressTracker = React.forwardRef<HTMLDivElement, ProgressTrackerProps>(\n  (\n    {\n      className,\n      steps,\n      children,\n      activeStep = 0,\n      interactive = false,\n      onStepClick,\n      stepAriaLabel = defaultStepAriaLabel,\n      ...props\n    },\n    ref,\n  ) => {\n    const stepsCount = children ? React.Children.count(children) : (steps?.length ?? 0);\n    const clampedActiveStep =\n      typeof activeStep === 'number' && !Number.isNaN(activeStep)\n        ? Math.min(Math.max(activeStep, 0), stepsCount)\n        : 0;\n\n    if (Number.isNaN(activeStep)) {\n      console.warn('ProgressTracker received NaN for `activeStep` prop.');\n    }\n\n    const renderedSteps = children\n      ? React.Children.toArray(children).map((child, index) => {\n          if (React.isValidElement(child)) {\n            return React.cloneElement(child as React.ReactElement<ProgressTrackerStepProps>, {\n              stepIndex: index,\n              key: child.key ?? index,\n            });\n          }\n\n          return child;\n        })\n      : steps?.map((step, index) => (\n          <ProgressTrackerStep key={`progress-step-${index}`} stepIndex={index} {...step} />\n        ));\n\n    return (\n      <ProgressTrackerContext.Provider\n        value={{ activeStep: clampedActiveStep, interactive, onStepClick, stepAriaLabel }}\n      >\n        <div\n          ref={ref}\n          // No gap: each step already carries a 2px inset on both sides, so\n          // touching boxes leave the 4px separation Figma draws between lines.\n          className={cn('flex w-full items-center', className)}\n          {...(interactive\n            ? { role: 'group' }\n            : {\n                role: 'progressbar',\n                'aria-valuenow': clampedActiveStep,\n                'aria-valuemin': 0,\n                'aria-valuemax': stepsCount,\n              })}\n          data-slot=\"progress-tracker\"\n          {...props}\n        >\n          {renderedSteps}\n        </div>\n      </ProgressTrackerContext.Provider>\n    );\n  },\n) as ProgressTrackerWithSubComponents;\n\nProgressTracker.displayName = 'ProgressTracker';\nProgressTracker.Step = ProgressTrackerStep;\n\nexport { ProgressTracker, ProgressTrackerStep };\n"
    },
    {
      "path": "src/components/progress-tracker/ProgressTracker.types.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/progress-tracker/ProgressTracker.types.ts",
      "content": "import type { VariantProps } from 'class-variance-authority';\nimport type {\n  ForwardRefExoticComponent,\n  HTMLAttributes,\n  PropsWithoutRef,\n  ReactNode,\n  RefAttributes,\n} from 'react';\n\nimport type { TooltipContentProps } from '../tooltip/Tooltip.types';\nimport type { progressTrackerStepVariants } from './ProgressTracker.variants';\nimport type { ProgressTrackerStep as ProgressTrackerStepComponent } from './ProgressTrackerStep';\n\ntype ProgressTrackerStepStatus = VariantProps<typeof progressTrackerStepVariants>['status'];\n\nexport interface ProgressTrackerStep {\n  /** Visual status of the step segment. When omitted, status is derived automatically from `activeStep`. */\n  status?: ProgressTrackerStepStatus;\n  /** Tooltip shown on hover. Accepts Tooltip.Content props. */\n  tooltip?: TooltipContentProps;\n}\n\n/** An individual stage in the progress indicator. */\nexport type ProgressTrackerStepProps = Omit<\n  HTMLAttributes<HTMLDivElement>,\n  'children' | 'onClick'\n> &\n  ProgressTrackerStep & {\n    /** @internal Index injected by ProgressTracker — do not set manually. */\n    stepIndex?: number;\n  };\n\n/** A compact row of progress segments with optional tooltips. */\nexport type ProgressTrackerProps = HTMLAttributes<HTMLDivElement> & {\n  /** Array-driven step definitions. Each entry may have an optional `status` override and `tooltip`. Mutually exclusive with `children`. */\n  steps?: ProgressTrackerStep[];\n  /** Compose steps manually using `ProgressTracker.Step`. Takes precedence over `steps`. */\n  children?: ReactNode;\n  /** Index of the currently active step. Steps before it are marked completed; steps after are incomplete. Clamped to `[0, stepsCount]`. */\n  activeStep?: number;\n  /** Renders each step as a `<button>`. Enables hover/active states and `onStepClick`. */\n  interactive?: boolean;\n  /** Callback fired when a step is clicked. Receives the zero-based `stepIndex`. */\n  onStepClick?: (stepIndex: number) => void;\n  /** Accessible name of each interactive step button, from its zero-based index. Defaults to `Step 1`, `Step 2`, … */\n  stepAriaLabel?: (stepIndex: number) => string;\n};\n\nexport type ProgressTrackerContextValue = {\n  activeStep: number;\n  interactive: boolean;\n  onStepClick?: (stepIndex: number) => void;\n  stepAriaLabel: (stepIndex: number) => string;\n};\n\nexport type ProgressTrackerWithSubComponents = ForwardRefExoticComponent<\n  PropsWithoutRef<ProgressTrackerProps> & RefAttributes<HTMLDivElement>\n> & {\n  Step: typeof ProgressTrackerStepComponent;\n};\n"
    },
    {
      "path": "src/components/progress-tracker/ProgressTracker.variants.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/progress-tracker/ProgressTracker.variants.ts",
      "content": "import { cva } from 'class-variance-authority';\n\nexport const progressTrackerStepVariants = cva(\n  // Figma models the bar as an 8px interactive box (Size/5) whose visible line is\n  // 4px — the remaining height is a Gap/2 inset on every side. `bg-clip-content`\n  // paints only that inner 4px band, so the hit area is 8px without the bar\n  // looking any thicker. Adjacent bars butt together (container gap 0); the 4px\n  // visual separation is the two 2px insets meeting.\n  'outline-ws-dynamic-primary-strong-default h-ws-5 p-ws-2 w-full rounded-full bg-clip-content outline-offset-2 transition-colors focus-visible:outline-2',\n  {\n    variants: {\n      status: {\n        incomplete: 'bg-(--ws-dynamic-stroke-secondary-default)',\n        completed: 'bg-ws-dynamic-success-default',\n        active: 'bg-(--ws-dynamic-stroke-primary-strong-default)',\n        error: 'bg-(--ws-dynamic-stroke-danger-strong-default)',\n      },\n      interactive: {\n        true: 'cursor-pointer',\n        false: '',\n      },\n    },\n    compoundVariants: [\n      {\n        interactive: true,\n        status: 'incomplete',\n        class:\n          'hover:bg-(--ws-dynamic-stroke-secondary-hover) active:bg-(--ws-dynamic-stroke-secondary-pressed)',\n      },\n      {\n        interactive: true,\n        status: 'completed',\n        class: 'hover:bg-ws-dynamic-success-hover active:bg-ws-dynamic-success-pressed',\n      },\n      {\n        interactive: true,\n        status: 'active',\n        class:\n          'hover:bg-(--ws-dynamic-stroke-primary-strong-hover) active:bg-(--ws-dynamic-stroke-primary-strong-pressed)',\n      },\n      {\n        interactive: true,\n        status: 'error',\n        class:\n          'hover:bg-(--ws-dynamic-stroke-danger-strong-hover) active:bg-(--ws-dynamic-stroke-danger-strong-pressed)',\n      },\n    ],\n    defaultVariants: {\n      status: 'incomplete',\n      interactive: false,\n    },\n  },\n);\n"
    },
    {
      "path": "src/components/progress-tracker/ProgressTrackerStep.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/progress-tracker/ProgressTrackerStep.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { Tooltip } from '../tooltip/Tooltip';\nimport { useProgressTrackerContext } from './ProgressTracker.context';\nimport type {\n  ProgressTrackerStep as ProgressTrackerStepData,\n  ProgressTrackerStepProps,\n} from './ProgressTracker.types';\nimport { progressTrackerStepVariants } from './ProgressTracker.variants';\n\n/**\n * One exported name, two meanings. `ProgressTrackerStep` has always been the public type for one\n * step's data; the component needs the same name to be importable as `<ProgressTrackerStep>` in a\n * React Server Component. A type and a value may share a name when both are declared in one\n * module, so the data type is aliased here next to the component.\n */\ntype ProgressTrackerStep = ProgressTrackerStepData;\n\nconst ProgressTrackerStep = React.forwardRef<\n  HTMLDivElement | HTMLButtonElement,\n  ProgressTrackerStepProps\n>(({ className, status, tooltip, stepIndex = 0, ...props }, ref) => {\n  const { activeStep, interactive, onStepClick, stepAriaLabel } = useProgressTrackerContext();\n\n  const computedStatus =\n    status ??\n    (stepIndex < activeStep ? 'completed' : stepIndex === activeStep ? 'active' : 'incomplete');\n\n  const stepBaseClassName = cn(\n    progressTrackerStepVariants({ status: computedStatus, interactive }),\n    className,\n  );\n\n  const stepElement = interactive ? (\n    <button\n      ref={ref as React.Ref<HTMLButtonElement>}\n      type=\"button\"\n      aria-label={stepAriaLabel(stepIndex)}\n      aria-current={computedStatus === 'active' ? 'step' : undefined}\n      onClick={() => {\n        onStepClick?.(stepIndex);\n      }}\n      className={stepBaseClassName}\n      data-slot=\"progress-tracker-step\"\n      {...(props as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n    />\n  ) : (\n    <div\n      ref={ref as React.Ref<HTMLDivElement>}\n      className={stepBaseClassName}\n      data-slot=\"progress-tracker-step\"\n      {...(props as React.HTMLAttributes<HTMLDivElement>)}\n    />\n  );\n\n  if (tooltip) {\n    return (\n      <Tooltip variant=\"inverse\">\n        <Tooltip.Trigger asChild>{stepElement}</Tooltip.Trigger>\n        <Tooltip.Content\n          side=\"bottom\"\n          {...tooltip}\n          className={cn('typography-body-strong-md', tooltip.className)}\n        />\n      </Tooltip>\n    );\n  }\n\n  return stepElement;\n});\n\nProgressTrackerStep.displayName = 'ProgressTracker.Step';\n\nexport { ProgressTrackerStep };\n"
    }
  ],
  "meta": {
    "version": "1.0.0",
    "commit": "8bb3627"
  }
}
