import type { JSX, ValidComponent } from "@solidjs/web"; import type { ThumbCollisionBehavior } from "../../internals/slider-utils/resolve-thumb-collision.js"; import type { BaseUIComponentProps, Orientation } from "../../internals/types.js"; import { type SliderRootChangeEventDetails, type SliderRootChangeEventReason, type SliderRootCommitEventDetails, type SliderRootState } from "../slider-root-context.js"; export type { SliderRootChangeEventDetails, SliderRootChangeEventReason, SliderRootCommitEventDetails, SliderRootState, }; type SliderValueShape = number | readonly number[]; export interface SliderRootProps extends BaseUIComponentProps<"div", SliderRootState> { /** Tag/component to render. Defaults to `"div"`. */ as?: ValidComponent; /** * Controlled value. For range sliders, an array of numbers. While not * `undefined` the consumer owns the state — pair with * {@link onValueChange}. When omitted, the slider manages its own value * (seeded from {@link defaultValue}). */ value?: Value | undefined; /** * Initial value when uncontrolled. For range sliders, an array of * numbers. Read once at mount; defaults to `min`. To render a controlled * slider, use the `value` prop instead. */ defaultValue?: Value | undefined; /** Disable all interaction. */ disabled?: boolean | undefined; /** `Intl.NumberFormat` options for value formatting. */ format?: Intl.NumberFormatOptions | undefined; /** Locale for `Intl.NumberFormat`. Defaults to runtime locale. */ locale?: Intl.LocalesArgument | undefined; /** Maximum value. Must be > min. @default 100 */ max?: number | undefined; /** Minimum value. Must be < max. @default 0 */ min?: number | undefined; /** Minimum number of steps between adjacent thumbs in a range slider. */ minStepsBetweenValues?: number | undefined; /** Form name for native submission. */ name?: string | undefined; /** Owner form id. */ form?: string | undefined; /** @default 'horizontal' */ orientation?: Orientation | undefined; /** @default 1 */ step?: number | undefined; /** Step used for Shift+Arrow and Page keys. @default 10 */ largeStep?: number | undefined; /** How colliding thumbs behave during drag. @default 'push' */ thumbCollisionBehavior?: ThumbCollisionBehavior | undefined; /** * How thumbs are aligned relative to the control edges: * - `'center'`: the thumb's center is pinned to the control's min/max * edges (thumb overshoots at the endpoints). * - `'edge'`: the thumb is inset by half its width so its *edge* aligns * with the control edge. A ResizeObserver measures the thumb + control * and writes CSS custom properties (`--position`, `--start-position`, * `--relative-size`) to keep geometry in sync. * - `'edge-client-only'`: same as `'edge'` but skips the SSR prehydration * script (not yet ported in this Solid build). For client-only apps the * two behave identically. * @default 'center' */ thumbAlignment?: "center" | "edge" | "edge-client-only" | undefined; /** Explicit `aria-labelledby`. Composes with registered labels. */ "aria-labelledby"?: string | undefined; /** Fires on every value update. */ onValueChange?: ((value: Value extends number ? number : readonly number[], eventDetails: SliderRootChangeEventDetails) => void) | undefined; /** Fires on `pointerup` / commit. */ onValueCommitted?: ((value: Value extends number ? number : readonly number[], eventDetails: SliderRootCommitEventDetails) => void) | undefined; } /** * Groups all parts of the slider. Renders a `
`. * * Solid 2 adaptations of Base UI React's `SliderRoot`: * * - No top-level reactive reads — every `props.X` access is wrapped in an * accessor. Reactive state (`values`, `active`, `dragging`, `indicator * Position`) is signal-backed. * - The CompositeList is used for thumb registration (1:1 with React); * `thumbMap` is exposed as an accessor via `onMapChange` so `` * can subscribe to thumb-id changes reactively. * - Field integration goes through `useFieldControlValidation` — registers * the control into the surrounding `` via the unified hook. * - `LabelableProvider` is injected inside the `children` getter so * `` + thumb inputs discover each other via the provider's * context. * - `thumbAlignment="edge"` / `"edge-client-only"` work on the client via * a ResizeObserver in `` that writes `--position` / * `--start-position` / `--relative-size` CSS vars. The SSR prehydration * `