import { ChangeEvent } from 'react'; import { Color } from '../types.js'; export type SliderSize = 'xs' | 'sm' | 'md'; /** * Visual presentation. * * - `'thumb'` (default): a thin track with a prominent, draggable thumb. * - `'track'`: a thick track that is the primary surface, with a slim flush handle. Use when the filled track itself should read as the main control. */ export type SliderVariant = 'thumb' | 'track'; /** * Mapping between the user value (passed via `value`, emitted by `onChange`) and the internal slider position (linear 0..1 across the track). * * - `'linear'` (default): position = (value - min) / (max - min). * - `'log'`: equal pixel motion produces equal *ratio* change. Requires `min > 0`. * - Object with `toSlider`/`fromSlider`: custom bidirectional mapping. * * `toSlider(value) -> position` in [0, 1]; `fromSlider(position) -> value`. */ export type SliderScale = 'linear' | 'log' | { toSlider: (value: number) => number; fromSlider: (position: number) => number; }; export interface SliderProps { /** Controlled value. When omitted, the component falls back to uncontrolled mode using `defaultValue`. */ value?: number; /** Initial value (uncontrolled). Default `0`. * * Ignored when `value` is provided. */ defaultValue?: number; /** Default `0`. */ min?: number; /** Default `100`. */ max?: number; /** * Step size for the emitted value. Default `1`. * * For non-linear `scale`, the user value is rounded to the nearest `step` after the inverse mapping - so a `log` slider with `step={1}` still emits integer values, but those steps are spaced logarithmically on the track. */ step?: number; /** Slider size token. Drives track and thumb dimensions. Default `'sm'`. */ size?: SliderSize; /** Visual presentation. Default `'thumb'`. See {@link SliderVariant}. */ variant?: SliderVariant; /** * Fully round the track corners (`rounded-full`) instead of the size-based radius. Default `false`. * * Only affects `variant="track"` - the thumb variant's track is already a thin pill, so this is a no-op there. */ rounded?: boolean; /** Visually dim the slider and disable interaction. */ disabled?: boolean; /** Block dragging without the disabled visual treatment. */ readOnly?: boolean; /** Render the focus ring flush against the slider (`inset-0`) instead of offset outside it (`-inset-1.5`). Use when the slider sits at the edge of an `overflow` container, where the offset ring would add unwanted scroll overflow. Default `false`. */ tightFocusRing?: boolean; /** Fires while the user drags or types a new value (subject to `debounce` / `throttle`). */ onChange?: (value: number, event?: ChangeEvent) => void; /** Extra classes for the slider container. */ className?: string; /** * Accent color for the active track segment and thumb. * * Defaults to the theme accent for `variant="thumb"`. For `variant="track"` it is left unset unless explicitly passed, so the filled track inherits any surrounding `cladd-color-*` context (a neutral surface otherwise). */ color?: Color; /** Outline ring on the thumb surface. Default `true`. */ thumbOutline?: boolean; /** * Render the active range as a bold filled accent (`gradient-fill`) instead of the subtle raised `gradient` surface. Default `false`. * * Only affects `variant="track"`. */ rangeFill?: boolean; /** * Outline ring on the active range surface. Default `true`. * * Only affects `variant="track"`. */ rangeOutline?: boolean; /** * Reserved - currently unused in the rendered output (the underlying `` is always present). Kept for parity with other form components. */ input?: boolean; /** Debounce onChange calls in ms. Fires once after the user stops changing for N ms. Defaults to 0 (immediate). */ debounce?: number; /** Throttle onChange calls in ms. Fires immediately, then at most once per N ms while changing, with a trailing call for the final value. Defaults to 0 (immediate). * * Takes precedence over `debounce` when both are set. * */ throttle?: number; /** * Value-to-position mapping. Default `'linear'`. * * Use `'log'` (requires `min > 0`) for ranges where ratios matter more than absolute differences - audio frequency, zoom, price brackets. * Pass a custom `{ toSlider, fromSlider }` pair for any other curve (quadratic, S-curve, etc.). * * `min`, `max`, and `value` are always in user-value space. `step` is applied to the emitted value after the inverse mapping (see `step`). */ scale?: SliderScale; } /** Shape of `Slider` defaults that can be supplied via `CladdProvider`'s `defaults` prop. */ export type SliderDefaultProps = Partial>; export declare function Slider(props: SliderProps): import("react/jsx-runtime").JSX.Element; //# sourceMappingURL=Slider.d.ts.map