{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "slider",
  "type": "registry:ui",
  "title": "Slider",
  "description": "A single-value slider on the native range input, with the filled track following the value; keys and role come from the browser.",
  "dependencies": [],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/theme.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/ui/slider.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/slider.tsx",
      "content": "import { forwardRef, useCallback, useEffect, useRef, type InputHTMLAttributes } from 'react';\nimport { cn } from '../lib/utils';\n\nexport interface SliderProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'children'> {\n  /** Required unless a <label htmlFor> names it. */\n  'aria-label'?: string;\n  min?: number;\n  max?: number;\n  step?: number;\n}\n\n/**\n * A single-value slider on the native range input: the browser supplies the arrow, Home, End and Page keys and the\n * slider role. The filled part of the track follows the value through a CSS variable set after render, so the\n * server-rendered HTML carries no inline style.\n */\nexport const Slider = forwardRef<HTMLInputElement, SliderProps>(function Slider({ className, min = 0, max = 100, step = 1, onInput, onChange, ...rest }, ref) {\n  const own = useRef<HTMLInputElement | null>(null);\n  const paint = useCallback(() => {\n    const el = own.current;\n    if (!el) return;\n    const lo = Number(el.min || 0);\n    const hi = Number(el.max || 100);\n    const share = hi > lo ? ((Number(el.value) - lo) / (hi - lo)) * 100 : 0;\n    el.style.setProperty('--kh-slider-fill', `${share}%`);\n  }, []);\n  useEffect(paint, [paint, rest.value, min, max]);\n  return (\n    <input\n      ref={(el) => {\n        own.current = el;\n        if (typeof ref === 'function') ref(el);\n        else if (ref) ref.current = el;\n      }}\n      type=\"range\"\n      min={min}\n      max={max}\n      step={step}\n      onInput={(e) => { paint(); onInput?.(e); }}\n      onChange={(e) => { paint(); onChange?.(e); }}\n      className={cn(\n        'h-11 w-full min-w-0 cursor-pointer appearance-none bg-transparent disabled:cursor-not-allowed disabled:opacity-50',\n        'focus-visible:outline-none',\n        '[&::-webkit-slider-runnable-track]:h-1.5 [&::-webkit-slider-runnable-track]:rounded-kh-pill [&::-webkit-slider-runnable-track]:bg-[linear-gradient(to_right,var(--kh-accent)_var(--kh-slider-fill,0%),var(--kh-surface-3)_var(--kh-slider-fill,0%))]',\n        '[&::-moz-range-track]:h-1.5 [&::-moz-range-track]:rounded-kh-pill [&::-moz-range-track]:bg-[linear-gradient(to_right,var(--kh-accent)_var(--kh-slider-fill,0%),var(--kh-surface-3)_var(--kh-slider-fill,0%))]',\n        '[&::-webkit-slider-thumb]:-mt-[7px] [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:size-5 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-kh-surface [&::-webkit-slider-thumb]:bg-kh-ink [&::-webkit-slider-thumb]:shadow-kh-2',\n        '[&::-moz-range-thumb]:size-5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-kh-surface [&::-moz-range-thumb]:bg-kh-ink [&::-moz-range-thumb]:shadow-kh-2',\n        '[&:focus-visible::-webkit-slider-thumb]:outline-2 [&:focus-visible::-webkit-slider-thumb]:outline-offset-2 [&:focus-visible::-webkit-slider-thumb]:outline-(--kh-focus)',\n        '[&:focus-visible::-moz-range-thumb]:outline-2 [&:focus-visible::-moz-range-thumb]:outline-offset-2 [&:focus-visible::-moz-range-thumb]:outline-(--kh-focus)',\n        className,\n      )}\n      {...rest}\n    />\n  );\n});\n"
    }
  ]
}
