{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "components-slider",
  "type": "registry:component",
  "title": "Slider",
  "description": "One value on a track, or the two ends of a range",
  "author": "sudo-kw <https://github.com/sudo-kw>",
  "dependencies": [
    "@gpuix/native@0.11.0",
    "@gpuix/react@0.11.0"
  ],
  "registryDependencies": [
    "https://gpuixui.sudokw.com/gpuix-primitives.json"
  ],
  "files": [
    {
      "path": "packages/components/src/slider.tsx",
      "target": "@ui/gpuixui/components/slider.tsx",
      "type": "registry:component",
      "content": "/** @jsxImportSource @gpuix/react */\nimport type { Props } from \"@gpuix/react\";\nimport {\n  RangeSlider,\n  Slider as PrimitiveSlider,\n  type SliderOrientation,\n} from \"../primitives/slider.js\";\nimport { isSliderSpan, sliderMode, type SliderValue } from \"./slider/logic.js\";\n\nexport { isSliderSpan } from \"./slider/logic.js\";\nexport type { SliderValue } from \"./slider/logic.js\";\n\nexport interface SliderProps extends Omit<Props, \"onChange\"> {\n  readonly value?: SliderValue;\n\n  readonly defaultValue?: SliderValue;\n\n  readonly onValueChange?: (value: SliderValue) => void;\n\n  readonly onValueCommit?: (value: SliderValue) => void;\n\n  readonly min?: number;\n\n  readonly max?: number;\n\n  readonly step?: number;\n  readonly disabled?: boolean;\n\n  readonly invalid?: boolean;\n\n  readonly orientation?: SliderOrientation;\n\n  readonly label?: string;\n\n  readonly description?: string;\n\n  readonly formatValue?: (value: number) => string;\n\n  readonly className?: string;\n\n  readonly testId?: string;\n}\n\nexport const Slider = (props: SliderProps) => {\n  const {\n    value,\n    defaultValue,\n    onValueChange,\n    onValueCommit,\n    min,\n    max,\n    step,\n    disabled,\n    invalid,\n    orientation,\n    label,\n    description,\n    formatValue,\n    className,\n    testId,\n    ...host\n  } = props;\n  const shared = {\n    ...host,\n    min,\n    max,\n    step,\n    disabled,\n    invalid,\n    orientation,\n    label,\n    description,\n    formatValue,\n    className,\n    testId,\n    onValueChange: (next: SliderValue) => onValueChange?.(next),\n    onValueCommit: (next: SliderValue) => onValueCommit?.(next),\n  };\n\n  return sliderMode(value, defaultValue) === \"range\" ? (\n    <RangeSlider\n      {...shared}\n      value={isSliderSpan(value) ? value : undefined}\n      defaultValue={isSliderSpan(defaultValue) ? defaultValue : undefined}\n    />\n  ) : (\n    <PrimitiveSlider\n      {...shared}\n      value={typeof value === \"number\" ? value : undefined}\n      defaultValue={typeof defaultValue === \"number\" ? defaultValue : undefined}\n    />\n  );\n};\n\nexport const sliderMeta = {\n  name: \"Slider\",\n  tier: 1,\n  status: \"done\",\n  gpuixSupport: \"partial\",\n  limitations: [\n    \"No `aria-valuenow`, `aria-valuemin`, `aria-valuemax` or `aria-orientation`: each thumb announces its value through `aria-valuetext`\",\n    \"No value tooltip: the primitive publishes no popup beside a thumb, so a visible value is a `Label` the caller composes\",\n    \"A vertical track has no natural length; give it a definite height\",\n  ],\n  docs: \"docs/slider.mdx\",\n  example: \"examples/slider.example.tsx\",\n  testFile: \"src/behaviour/slider.test.tsx\",\n} as const;\n"
    },
    {
      "path": "packages/components/src/slider/logic.ts",
      "target": "@ui/gpuixui/components/slider/logic.ts",
      "type": "registry:lib",
      "content": "export type SliderValue = number | readonly [number, number];\n\nexport const isSliderSpan = (\n  value: unknown,\n): value is readonly [number, number] =>\n  Array.isArray(value) &&\n  value.length === 2 &&\n  value.every((end) => typeof end === \"number\" && Number.isFinite(end));\n\nexport const sliderMode = (\n  value: unknown,\n  defaultValue: unknown,\n): \"single\" | \"range\" =>\n  isSliderSpan(value ?? defaultValue) ? \"range\" : \"single\";\n"
    }
  ],
  "docs": "[Slider](https://gpuixui.sudokw.com/components/slider) — These are GPUix native components: the files render through GPUix's reconciler against `@gpuix/react`, not the DOM, and need the per-platform `@gpuix/native` binding. The CLI installs the `@gpuixui/*` runtime the components import as registry items, so the copied tree resolves on its own; wrap it in `ThemeProvider` before it renders.",
  "meta": {
    "url": "/components/slider",
    "kind": "component",
    "runtime": "gpuix",
    "registry": "gpuixui"
  }
}