{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "slider",
  "title": "Slider",
  "description": "A labeled slider on the Field contract: pass `label`, and a `defaultValue` (or `value` with `onValueChange`).",
  "dependencies": [
    "@base-ui/react@^1.8.0"
  ],
  "registryDependencies": [
    "@ouro/field",
    "@ouro/lib-env",
    "@ouro/lib-page-direction",
    "@ouro/lib-touch-target",
    "@ouro/lib-use-dev-messages",
    "@ouro/lib-use-field"
  ],
  "files": [
    {
      "path": "registry/ouro/components/ouro/slider/slider-styles.ts",
      "content": "export { controlClass, indicatorClass, rootClass, sampleClass, thumbClass, trackClass, valueClass, widestTexts };\n\n// Class strings for Slider, apart from the component so its file\n// exports only components (React Fast Refresh). Class strings are literal so the app's\n// Tailwind finds them when it compiles.\n\n/**\n * The slider's row: the control, then the value when `showValue` is on.\n *\n * @internal\n */\nconst rootClass = \"m-0 box-border flex w-full min-w-0 items-center gap-3\";\n\n/**\n * The area that takes presses: as tall as a control on phones (44px), so a press near the\n * track still lands, stepping down to desktop density with a fine pointer from `sm`. Its\n * inline padding is half a thumb, so a thumb at either end stays inside the field. A vertical\n * finger drag over it scrolls the page (`touch-action: pan-y`); a sideways one slides. It fades\n * to half opacity when disabled.\n *\n * @internal\n * @claim \"The area that takes presses: as\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider looks > gives the thumb a 44px hit area only on a coarse pointer)\n * @claim \"The area that takes presses: as\" registry/ouro/components/ouro/slider/slider.touch.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.touch.test.tsx::gives the thumb a 44px hit area and the control a 44px height, also on a landscape phone)\n */\nconst controlClass =\n  \"relative box-border flex min-w-0 flex-1 items-center px-2.5 select-none touch-pan-y cursor-pointer \" +\n  \"h-(--ouro-slider-h) [--ouro-slider-h:calc(var(--spacing)*11)] sm:pointer-fine:[--ouro-slider-h:calc(var(--spacing)*6)] \" +\n  \"data-disabled:cursor-not-allowed data-disabled:opacity-50\";\n\n/**\n * The rail the thumbs run on.\n *\n * @internal\n */\nconst trackClass = \"relative h-1.5 w-full rounded-full bg-muted select-none\";\n\n/**\n * The filled part of the rail: the primary color, or the destructive one when the field\n * has an error.\n *\n * @internal\n */\nconst indicatorClass =\n  \"rounded-full bg-primary select-none group-data-[ouro-invalid]/slider:bg-destructive\";\n\n/**\n * A thumb: a 20px knob with a 44px hit area on a coarse pointer (its `TouchTarget`), an\n * outline while its input has keyboard focus, and a press that grows it slightly.\n *\n * @internal\n * @claim \"A thumb: a 20px knob with\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider looks > gives the thumb a 44px hit area only on a coarse pointer)\n * @claim \"A thumb: a 20px knob with\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider looks > outlines the thumb while its input has keyboard focus)\n * @claim \"A thumb: a 20px knob with\" registry/ouro/components/ouro/slider/slider.touch.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.touch.test.tsx::gives the thumb a 44px hit area and the control a 44px height, also on a landscape phone)\n */\nconst thumbClass =\n  \"relative box-border size-5 [--corner-shape:round] [corner-shape:round] rounded-full border-2 border-solid border-primary bg-background select-none \" +\n  \"shadow-(--shadow-sm) \" +\n  \"outline-ring outline-offset-2 has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-solid \" +\n  \"[transition:scale_var(--ouro-duration-press)_var(--ouro-ease-out),border-color_var(--ouro-duration-fast)_ease] \" +\n  \"motion-safe:data-dragging:scale-110 \" +\n  \"group-data-[ouro-invalid]/slider:border-destructive data-disabled:cursor-not-allowed\";\n\n/**\n * The formatted value at the end of the row, in tabular figures, as wide as the widest value\n * (hidden pseudo-elements with the ends' text hold the width) so the track keeps its length. When\n * disabled it turns the muted color rather than fading, so it keeps a readable contrast.\n *\n * @internal\n */\nconst valueClass =\n  \"m-0 grid shrink-0 justify-items-end text-sm leading-5 text-foreground tabular-nums whitespace-nowrap group-data-disabled/slider:text-muted-foreground\";\n\n/** A hidden sample of the widest value text, stacked under the value to hold its width. */\nconst sampleClass = \"invisible col-start-1 row-start-1 before:content-[attr(data-ouro-slider-sample)]\";\n\n/**\n * Samples of the widest value text a slider shows, so the track keeps its length: each end's integer\n * part with the step's decimals (Base UI's defaults are 0, 100 and a step of 1), plus values in each\n * power of ten, since compact notation (\"1.1K\") can be wider than either end.\n *\n * @claim \"Samples of the widest value\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::the value's widest texts > samples each end with the step's decimals and each power of ten in range, both signs, ends included)\n * @claim \"Samples of the widest value\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::the value's widest texts > reserves the samples for the slider's own range, step and format, and Base UI's 0 to 100 by default)\n * @internal\n */\nfunction widestTexts(min: number, max: number, step: number, locale: Intl.LocalesArgument, format: Intl.NumberFormatOptions | undefined): string[] {\n  const number = new Intl.NumberFormat(locale, format);\n  const decimals = (String(step).split(\".\")[1] ?? \"\").length;\n  const withDecimals = (end: number) => {\n    const whole = Math.trunc(end);\n    return decimals === 0 ? end : Math.sign(end || 1) * (Math.abs(whole) + Number(`0.${\"8\".repeat(decimals)}`));\n  };\n  const values = [withDecimals(min), withDecimals(max)];\n  for (let power = 1; power <= Math.max(Math.abs(min), Math.abs(max)); power *= 10) {\n    for (const magnitude of [1.8 * power, 8.8 * power, 10 * power - step]) {\n      for (const value of [magnitude, -magnitude]) {\n        const snapped = min + Math.round((value - min) / step) * step;\n        if (snapped >= min && snapped <= max) values.push(snapped);\n      }\n    }\n  }\n  return [...new Set(values.map((value) => number.format(value)))];\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/slider/slider-styles.ts"
    },
    {
      "path": "registry/ouro/components/ouro/slider/slider.tsx",
      "content": "\"use client\";\n\nimport { Slider as BaseSlider } from \"@base-ui/react/slider\";\nimport { cloneElement, useId, useLayoutEffect, useMemo, useRef, useSyncExternalStore, type JSX, type ReactElement, type ReactNode, type Ref } from \"react\";\nimport { Field } from \"@/registry/ouro/components/ouro/field/field\";\nimport { contractWarnings } from \"@/registry/ouro/components/ouro/field/field-styles\";\nimport { PageDirection } from \"@/registry/ouro/lib/ouro/page-direction\";\nimport { TouchTarget } from \"@/registry/ouro/lib/ouro/touch-target\";\nimport { FieldOwnerContext, useField, useFormErrors, type ReadonlyErrorMessages } from \"@/registry/ouro/lib/ouro/use-field\";\nimport { useDevWarnings } from \"@/registry/ouro/lib/ouro/use-dev-messages\";\nimport {\n  controlClass,\n  indicatorClass,\n  rootClass,\n  sampleClass,\n  thumbClass,\n  trackClass,\n  valueClass,\n  widestTexts,\n} from \"@/registry/ouro/components/ouro/slider/slider-styles\";\n\n/** A slider's value: one number, or one per thumb for a range. */\nexport type SliderValue = number | readonly number[];\n\n/** The value Slider reports: a number for one thumb, an array for a range. */\nexport type SliderOutput<Value extends SliderValue> = Value extends readonly number[] ? number[] : number;\n\n/** Props for {@link Slider}. A `value` or `defaultValue` array gives a thumb per value. */\nexport interface SliderProps<Value extends SliderValue = number> {\n  /**\n   * What the slider sets, shown above it and read as its name. Required: every control\n   * needs a name. To hide it visually, keep it and add `hideLabel`.\n   * @claim \"Required: every control needs a name\" registry/ouro/components/ouro/slider/slider.test-d.ts verify:fileLine(registry/ouro/components/ouro/slider/slider.test-d.ts, /expectTypeOf<\\{\\sdefaultValue:\\s40\\s\\}>\\(\\)\\.not\\.toExtend<SliderProps>/)\n   */\n  label: string;\n  /** Hides the label visually; screen readers still read it as the slider's name. */\n  hideLabel?: boolean | undefined;\n  /** Supporting text under the label, read after the label through `aria-describedby`. */\n  description?: ReactNode | undefined;\n  /**\n   * What is wrong, from your server action or client check. The message (or several, as a\n   * list) shows under the slider, which gets `aria-invalid` and the destructive color. A message is text or a React node (one with a link); an empty string or array means valid.\n   */\n  error?: ReadonlyErrorMessages | undefined;\n  /** Disables the slider and fades it. */\n  disabled?: boolean | undefined;\n  /** The form field name the value submits under; a range submits one entry per thumb. */\n  name?: string | undefined;\n  /**\n   * The value, when you control it. An array gives a thumb per value: `value={[20, 80]}`\n   * is a range.\n   */\n  value?: Value | undefined;\n  /** The starting value, when the slider keeps its own. An array gives a range: `defaultValue={[20, 80]}`. */\n  defaultValue?: Value | undefined;\n  /** Called with the new value as the user drags, presses the track or uses the keyboard: a number, or an array for a range. */\n  onValueChange?: ((value: SliderOutput<Value>) => void) | undefined;\n  /**\n   * Called once the user lets go (or with each key press), with the final value. Use it to save.\n   *\n   * @claim \"Called once the user lets go\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider > steps with the keyboard and reports the value)\n   * @claim \"Called once the user lets go\" https://base-ui.com/react/components/slider verify:urlOk(https://base-ui.com/react/components/slider)\n   */\n  onValueCommitted?: ((value: SliderOutput<Value>) => void) | undefined;\n  /**\n   * The lowest value. @default 0\n   *\n   * @claim \"The lowest value\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider > is a labeled range input built on the Field contract)\n   * @claim \"The lowest value\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider > takes large steps with Page Up, Page Down and Shift with an arrow)\n   */\n  min?: number | undefined;\n  /**\n   * The highest value. @default 100\n   *\n   * @claim \"The highest value\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider > is a labeled range input built on the Field contract)\n   * @claim \"The highest value\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider > takes large steps with Page Up, Page Down and Shift with an arrow)\n   */\n  max?: number | undefined;\n  /** The distance between values. @default 1 */\n  step?: number | undefined;\n  /** The step for Page Up, Page Down and Shift with an arrow key. @default 10 */\n  largeStep?: number | undefined;\n  /**\n   * How the value reads, as `Intl.NumberFormat` options, for `showValue` and screen readers:\n   * `{ style: \"percent\" }`, `{ style: \"currency\", currency: \"EUR\" }`.\n   */\n  format?: Intl.NumberFormatOptions | undefined;\n  /** The locale for `format`. @default the browser's, once hydrated; en-US in the server's HTML */\n  locale?: Intl.LocalesArgument | undefined;\n  /** Shows the formatted value at the end of the slider; a range shows both ends: `$10 – $40`. */\n  showValue?: boolean | undefined;\n  /**\n   * What each thumb of a range is called, before the label: screen readers hear\n   * \"Minimum, Price\". Translate them with your app.\n   * @default [\"Minimum\", \"Maximum\"]\n   * @claim \"What each thumb of a range\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider > gives a value array a thumb per value, each named)\n   * @claim \"What each thumb of a range\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider > translates the thumb names)\n   */\n  thumbLabels?: readonly string[] | undefined;\n  /**\n   * Layout only: margins, width, grid placement (`mt-4`, `col-span-2`). Appearance classes\n   * warn in development; style sliders in your theme.\n   */\n  className?: string | undefined;\n  /** The first thumb's `<input type=\"range\">`. */\n  ref?: Ref<HTMLInputElement> | undefined;\n\n  /** Not a prop. Ouro UI uses `error`: `<Slider error=\"Required.\">`. */\n  errorMessage?: { 'Use <Slider error=\"Required.\">': never };\n  /** Not a prop. Ouro UI uses `description`: `<Slider description=\"...\">`. */\n  helperText?: { 'Use <Slider description=\"...\">': never };\n  /** Not a prop. `error` marks the slider invalid: `<Slider error=\"What is wrong\">`. */\n  isInvalid?: { 'Use <Slider error=\"What is wrong\">': never };\n  /** Not a prop. `error` marks the slider invalid: `<Slider error=\"What is wrong\">`. */\n  invalid?: { 'Use <Slider error=\"What is wrong\">': never };\n  /** Not a prop. Ouro UI uses `disabled`: `<Slider disabled>`. */\n  isDisabled?: { 'Use <Slider disabled>': never };\n  /**\n   * Not a prop. A slider always has a value, so it is never missing: `<Slider defaultValue={50}>`.\n   *\n   * @claim \"A slider always has a value\" registry/ouro/components/ouro/slider/slider.test-d.ts verify:fileLine(registry/ouro/components/ouro/slider/slider.test-d.ts, /@ts-expect-error\\srequired\\sis\\sa\\shint:\\sa\\sslider\\salways\\shas\\sa\\svalue\\./)\n   */\n  required?: { 'A slider always has a value: <Slider defaultValue={50}>': never };\n  /**\n   * Not a prop. A slider always has a value, so it is never missing: `<Slider defaultValue={50}>`.\n   *\n   * @claim \"A slider always has a value\" registry/ouro/components/ouro/slider/slider.test-d.ts verify:fileLine(registry/ouro/components/ouro/slider/slider.test-d.ts, /@ts-expect-error\\srequired\\sis\\sa\\shint:\\sa\\sslider\\salways\\shas\\sa\\svalue\\./)\n   */\n  isRequired?: { 'A slider always has a value: <Slider defaultValue={50}>': never };\n  /** Not a prop. A value array gives a thumb per value: `<Slider defaultValue={[20, 80]}>`. */\n  range?: { 'Pass a value array: <Slider defaultValue={[20, 80]}>': never };\n  /** Not a prop. Ouro UI uses `min`: `<Slider min={1}>`. */\n  minValue?: { 'Use <Slider min={1}>': never };\n  /** Not a prop. Ouro UI uses `max`: `<Slider max={10}>`. */\n  maxValue?: { 'Use <Slider max={10}>': never };\n  /** Not a prop. Slider reports the value itself: `<Slider onValueChange={(value) => …}>`. */\n  onChange?: { 'Use <Slider onValueChange={(value) => ...}>': never };\n  /** Not a prop. Ouro UI uses `showValue`: `<Slider showValue>`. */\n  valueLabelDisplay?: { 'Use <Slider showValue>': never };\n  /** Not a prop. Ouro UI uses `showValue`: `<Slider showValue>`. */\n  showTooltip?: { 'Use <Slider showValue>': never };\n}\n\n/** Field's messages and root name Slider. */\nconst owner = { name: \"Slider\", data: \"slider\" };\n\n/**\n * A range's label names its group, with an id the server knows, and each thumb has its own\n * name, so the label points at no single input.\n * @claim \"A range's label names its group\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider > gives a value array a thumb per value, each named)\n * @claim \"A range's label names its group\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider development messages > warns when a range has the wrong number of thumb names)\n */\nfunction rangeOwner(labelId: string) {\n  return {\n    ...owner,\n    frame: (label: ReactElement, rest: ReactNode) => (\n      <>\n        {cloneElement(label as ReactElement<{ htmlFor?: string | undefined; id?: string }>, { htmlFor: undefined, id: labelId })}\n        {rest}\n      </>\n    ),\n  };\n}\n\n/** An empty subscription: here `useSyncExternalStore` only tells the server and hydration apart from the browser. */\n// Stryker disable next-line ArrowFunction: React takes an unsubscribe of undefined as none, and this store never changes.\nconst noSubscription = () => () => {};\n\n/**\n * The locale the value reads in on the server and during hydration when no `locale` is given: the\n * reader's is unknown there, so both use this one, and the reader's browser switches to its own\n * once it has hydrated the server's HTML.\n *\n * @claim \"The locale the value reads in\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider across locales > renders the same value text on a server in any locale, and shows the reader's once hydrated)\n */\nconst SERVER_LOCALE = \"en-US\";\n\n/** The default names for a range's thumbs: Minimum and Maximum, with Middle between. */\nfunction defaultThumbLabels(count: number): string[] {\n  return Array.from({ length: count }, (_, index) => (index === 0 ? \"Minimum\" : index === count - 1 ? \"Maximum\" : \"Middle\"));\n}\n\n/**\n * A labeled slider on the Field contract: pass `label`, and a `defaultValue` (or `value`\n * with `onValueChange`). A value array, `defaultValue={[20, 80]}`, gives a range with a thumb\n * per value. `showValue` shows the value, formatted with `format`. Each thumb has a 44px\n * touch area on phones.\n *\n * Use `NumberField` instead when people need an exact number, and `RadioGroup` for a few\n * named choices.\n * In a right-to-left page (`dir=\"rtl\"` on `<html>`) the track runs from the right, and ArrowLeft raises the value.\n *\n *\n * @group Forms\n * @claim \"In a right-to-left page\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider > raises the value with ArrowLeft in a right-to-left page, where the track runs from the right)\n * @see https://ui.ouroboros.bot/docs/slider\n *\n * @example\n * <Slider label=\"Servings\" name=\"servings\" defaultValue={4} min={1} max={12} showValue />\n * <Slider label=\"Price\" name=\"price\" defaultValue={[10, 40]} format={{ style: \"currency\", currency: \"USD\" }} showValue />\n * @claim \"Each thumb has a 44px touch\" registry/ouro/components/ouro/slider/slider.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.test.tsx::Slider looks > gives the thumb a 44px hit area only on a coarse pointer)\n * @claim \"Each thumb has a 44px touch\" registry/ouro/components/ouro/slider/slider.touch.test.tsx verify:testExists(registry/ouro/components/ouro/slider/slider.touch.test.tsx::gives the thumb a 44px hit area and the control a 44px height, also on a landscape phone)\n */\nexport function Slider<Value extends SliderValue = number>(props: SliderProps<Value>): JSX.Element {\n  const {\n    label,\n    hideLabel,\n    description,\n    error,\n    disabled,\n    name,\n    value,\n    defaultValue,\n    onValueChange,\n    onValueCommitted,\n    min,\n    max,\n    step,\n    largeStep,\n    format,\n    locale,\n    showValue,\n    thumbLabels: thumbLabelsProp,\n    className,\n    ref,\n    // Guard props (hint types), dropped here so they never reach the DOM.\n    errorMessage,\n    helperText,\n    isInvalid,\n    invalid,\n    isDisabled,\n    required,\n    isRequired,\n    range,\n    minValue,\n    maxValue,\n    onChange,\n    valueLabelDisplay,\n    showTooltip,\n  } = props;\n  const form = useFormErrors();\n  // A change drops a Form error for this name, as typing does in a text field.\n  const handleValueChange = (next: number | number[]) => {\n    if (name !== undefined) form?.clear(name);\n    (onValueChange as ((value: number | number[]) => void) | undefined)?.(next);\n  };\n  const current = value ?? defaultValue;\n  const count = Array.isArray(current) ? current.length : 1;\n  const isRange = Array.isArray(current);\n  const thumbLabels = thumbLabelsProp ?? defaultThumbLabels(count);\n  const labelId = `${useId()}-label`;\n  const fieldOwner = useMemo(() => (isRange ? rangeOwner(labelId) : owner), [isRange, labelId]);\n\n  useDevWarnings(\n    \"Slider\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => {\n          const always = \"a slider always has a value\";\n          return [\n            ...contractWarnings(\"Slider\", { errorMessage, helperText, isInvalid, invalid, isDisabled }),\n            required !== undefined && [`required is not a prop; ${always}`, \"<Slider defaultValue={50}>\"],\n            isRequired !== undefined && [`isRequired is not a prop; ${always}`, \"<Slider defaultValue={50}>\"],\n            range !== undefined && [\"range is not a prop; a value array gives a thumb per value\", \"<Slider defaultValue={[20, 80]}>\"],\n            minValue !== undefined && [\"minValue is not a prop\", `<Slider min={${String(minValue)}}>`],\n            maxValue !== undefined && [\"maxValue is not a prop\", `<Slider max={${String(maxValue)}}>`],\n            onChange !== undefined && [\"onChange is not a prop\", \"<Slider onValueChange={(value) => …}>\"],\n            valueLabelDisplay !== undefined && [\"valueLabelDisplay is not a prop\", \"<Slider showValue>\"],\n            showTooltip !== undefined && [\"showTooltip is not a prop\", \"<Slider showValue>\"],\n            isRange &&\n              thumbLabels.length !== count && [\n                `thumbLabels has ${thumbLabels.length} names for ${count} thumbs`,\n                `<Slider thumbLabels={[${defaultThumbLabels(count)\n                  .map((name) => `\"${name}\"`)\n                  .join(\", \")}]}>`,\n              ],\n          ];\n        }\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n\n  return (\n    <FieldOwnerContext.Provider value={fieldOwner}>\n      <Field label={label} hideLabel={hideLabel} description={description} error={error} disabled={disabled} name={name} className={className}>\n        <SliderControl\n          label={label}\n          labelId={isRange ? labelId : undefined}\n          isRange={isRange}\n          count={count}\n          thumbLabels={thumbLabels}\n          showValue={showValue}\n          inputRef={ref}\n          rootProps={{\n            value: value as number | number[] | undefined,\n            defaultValue: defaultValue as number | number[] | undefined,\n            onValueChange: handleValueChange,\n            onValueCommitted: onValueCommitted as ((value: number | number[]) => void) | undefined,\n            min,\n            max,\n            step,\n            largeStep,\n            format,\n            locale,\n          }}\n        />\n      </Field>\n    </FieldOwnerContext.Provider>\n  );\n}\n\n/** The Base UI slider inside the Field, where it reads the field's server-known description ids. */\nfunction SliderControl({\n  label,\n  labelId,\n  isRange,\n  count,\n  thumbLabels,\n  showValue,\n  inputRef,\n  rootProps,\n}: {\n  label: string;\n  labelId: string | undefined;\n  isRange: boolean;\n  count: number;\n  thumbLabels: readonly string[];\n  showValue: boolean | undefined;\n  inputRef: Ref<HTMLInputElement> | undefined;\n  rootProps: Pick<\n    BaseSlider.Root.Props,\n    \"value\" | \"defaultValue\" | \"min\" | \"max\" | \"step\" | \"largeStep\" | \"format\" | \"locale\"\n  > & {\n    onValueChange: ((value: number | number[]) => void) | undefined;\n    onValueCommitted: ((value: number | number[]) => void) | undefined;\n  };\n}): JSX.Element {\n  const field = useField()!;\n  // Ouro's own invalid state (the error prop or the Form's error for this name), not Base UI's,\n  // which would count it as a failed check and block the next submit.\n  const invalid = field.invalid;\n  // Base UI builds each thumb's range input itself and takes aria-invalid only from its own\n  // checks, so Ouro's state and the control marker go on the inputs directly.\n  const rootRef = useRef<HTMLDivElement>(null);\n  useLayoutEffect(() => {\n    for (const input of rootRef.current!.querySelectorAll('input[type=\"range\"]')) {\n      input.setAttribute(\"data-ouro-control\", \"slider\");\n      input.setAttribute(\"data-ouro-part\", \"thumb\");\n      if (invalid) input.setAttribute(\"aria-invalid\", \"true\");\n      else input.removeAttribute(\"aria-invalid\");\n    }\n  });\n  const { onValueChange, onValueCommitted, ...shared } = rootProps;\n  // Without a locale, the reader's is unknown on the server and during hydration, so both read\n  // en-US (Base UI keeps a formatter per locale, so the page's default never leaks in from a\n  // formatter made earlier) and the reader's browser switches to its own once hydrated.\n  const hydrated = useSyncExternalStore(\n    noSubscription,\n    () => true,\n    // Stryker disable next-line ArrowFunction: undefined, like false, reads as not yet hydrated.\n    () => false,\n  );\n  const locale = shared.locale ?? (hydrated ? undefined : SERVER_LOCALE);\n  // Without a locale, the samples are in the reader's, which the server cannot know: it and\n  // hydration reserve nothing, and the browser fills them in, so the server's HTML hydrates as it is.\n  // Worked out once per range and format, not on every value a drag passes through.\n  const { locale: sampleLocale, format, min, max, step } = shared;\n  const texts = useMemo(\n    () => (hydrated || sampleLocale !== undefined ? widestTexts(min ?? 0, max ?? 100, step ?? 1, sampleLocale, format) : []),\n    [hydrated, sampleLocale, format, min, max, step],\n  );\n  const samples = isRange ? texts.map((text) => `${text} – ${text}`) : texts;\n  const directed = (\n    <BaseSlider.Root\n      ref={rootRef}\n      {...shared}\n      locale={locale}\n      {...(invalid ? { \"data-ouro-invalid\": \"\" } : {})}\n      onValueChange={onValueChange && ((next) => onValueChange(next as number | number[]))}\n      onValueCommitted={onValueCommitted && ((next) => onValueCommitted(next as number | number[]))}\n      aria-labelledby={labelId}\n      aria-describedby={field.describedBy}\n      className={`group/slider ${rootClass}`}\n    >\n      <BaseSlider.Control\n        data-ouro-slider-control=\"\"\n        className={controlClass}\n      >\n        <BaseSlider.Track className={trackClass}>\n          <BaseSlider.Indicator data-ouro-slider-indicator=\"\" className={indicatorClass} />\n          {Array.from({ length: count }, (_, index) => (\n            <BaseSlider.Thumb\n              key={index}\n              index={index}\n              data-ouro-slider-thumb=\"\"\n              inputRef={index === 0 ? inputRef : undefined}\n              aria-label={isRange ? `${thumbLabels[index] ?? index + 1}, ${label}` : undefined}\n              aria-describedby={field.describedBy}\n              className={thumbClass}\n            >\n              <TouchTarget />\n            </BaseSlider.Thumb>\n          ))}\n        </BaseSlider.Track>\n      </BaseSlider.Control>\n      {showValue && (\n        <BaseSlider.Value\n          data-ouro-slider-value=\"\"\n          className={valueClass}\n        >\n          {(formatted) => (\n            <>\n              <span className=\"col-start-1 row-start-1\">{formatted.join(\" – \")}</span>\n              {/* Empty, so they stay out of the text: each shows its sample as a hidden pseudo-element. */}\n              {samples.map((sample) => (\n                <span key={sample} aria-hidden=\"true\" data-ouro-slider-sample={sample} className={sampleClass} />\n              ))}\n            </>\n          )}\n        </BaseSlider.Value>\n      )}\n    </BaseSlider.Root>\n  );\n  return <PageDirection of={rootRef}>{directed}</PageDirection>;\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/slider/slider.tsx"
    }
  ],
  "docs": "A labeled slider on the Field contract: pass `label`, and a `defaultValue` (or `value` with `onValueChange`). Import: import { Slider } from \"@/components/ouro/slider/slider\", with @/components replaced by your components alias (aliases.components in components.json, such as ~/components). Also installed: field, the helpers they import in lib/ouro. Needs ouro-base in your stylesheet: add that item once per app, from the same place as this one, if you have not. Docs: https://ui.ouroboros.bot/docs/slider.md Ouro UI v1.3.257.",
  "type": "registry:ui"
}