import { type ComponentProps, type KeyboardEvent, type PointerEvent as ReactPointerEvent, type ReactNode, type RefObject } from 'react';
import { type SliderRange } from '../core/slider.js';
/**
* Unstyled Carbon `Slider` (one thumb, or two for a range), the behaviour of the styled Slider
* without a single class: each `Thumb` is a `role="slider"` Tab stop; ← / ↓ and → / ↑ move by
* `step` (× `stepMultiplier` with Shift), Home / End jump to the ends. A press on the `Control`
* moves the thumb pressed, else the nearer one, to the nearest step, focuses it, and the drag
* follows the pointer anywhere on the page. Two thumbs never pass each other. An `Input` is the
* number box beside the track: a number in range applies while typing; on blur or Enter one out
* of range is clamped (`corrected` in the context holds the typed number to announce) and text
* that isn't a number makes the slider invalid (`notANumber`). A disabled or read-only slider
* changes nothing and shows no error. An uncontrolled slider goes back to `defaultValue` with its form.
*
* Values are arrays, one entry per thumb (`[value]`, or `[lower, upper]`); an entry of `value`
* left `undefined` keeps that thumb uncontrolled. `onValueChange` follows every change,
* `onValueCommit` the committed ones (pointer released, a key, a box committed).
*
* State shows as data attributes to style on: `data-disabled`, `data-readonly`, `data-invalid` and
* `data-dragging` (any thumb dragged) on `Group`, `Control`, `Track` and `Indicator`; the same on
* `Thumb` plus `data-index`, its `data-dragging` being its own drag; `data-index`, `data-disabled`,
* `data-readonly` and `data-invalid` on `Input` (no `data-dragging`); only `data-disabled` on
* `Label`; none on `HiddenInput`. `data-orientation="horizontal"` on `Group` and `Control`. `Control` sets
* `--slider-range-start` and `--slider-range-end`: where the filled part starts (0 with one thumb)
* and ends, as 0…1 of the track, to place the thumbs and the `Indicator` with.
*
* ```tsx
*
* Price
*
*
*
*
*
*
*
*
*
* ```
*/
export interface RootProps {
/** One entry per thumb (controlled); an `undefined` entry keeps that thumb uncontrolled. */
value?: readonly (number | undefined)[];
/** Default `[min]`. */
defaultValue?: readonly number[];
/** Every change: the values after it. */
onValueChange?: (values: number[]) => void;
/** Committed changes: the pointer released, a key, a number box committed. */
onValueCommit?: (values: number[]) => void;
min?: number;
max?: number;
step?: number;
/** Shift + arrow moves by `step × stepMultiplier` (Carbon default 4). */
stepMultiplier?: number;
disabled?: boolean;
/** Keeps the values; a thumb leaves the Tab order unless you give it `tabIndex={0}`. */
readOnly?: boolean;
/** Shows the error (`aria-invalid`, `data-invalid`), as text in a box that isn't a number does. */
invalid?: boolean;
children?: ReactNode;
}
export interface SliderContextValue {
/** One per thumb, on the track and in order. */
values: number[];
min: number;
max: number;
step: number;
disabled: boolean;
readOnly: boolean;
/** Neither disabled nor read-only. */
interactive: boolean;
/** The error shows: `invalid`, or text that isn't a number, while interactive. */
invalid: boolean;
/** A number box was committed with text that isn't a number. */
notANumber: boolean;
/** The out-of-range number a box was clamped from (to announce), until the next change. */
corrected: number | undefined;
/** The thumb being dragged, or null. */
dragging: number | null;
/** A box's text while it differs from its value. */
editing: readonly (string | undefined)[];
labelId: string;
thumbId: (index: number) => string;
/** Where a thumb may go: the track, between its neighbours. */
boundsOf: (index: number) => SliderRange;
/** Moves a thumb; true when it changed. `final` also reports it as committed. */
commit: (index: number, next: number, final: boolean) => boolean;
focusThumb: (index: number, options?: FocusOptions) => void;
/** The parts' handlers. */
keyDown: (index: number, event: KeyboardEvent) => void;
startDrag: (event: ReactPointerEvent) => void;
typeText: (index: number, text: string) => void;
commitText: (index: number) => void;
/** The parts' elements. */
control: RefObject;
setThumb: (index: number, el: HTMLElement | null) => void;
setInput: (index: number, el: HTMLInputElement | null) => void;
}
/** The state of the enclosing `Slider.Root` (values, disabled, the error …). */
export declare function useSliderContext(part?: string): SliderContextValue;
export declare function Root({ value, defaultValue, onValueChange, onValueCommit, min, max, step, stepMultiplier, disabled, readOnly, invalid, children }: Readonly): import("react").JSX.Element;
/** The slider's name: a click on it focuses the first thumb (a `role="slider"` can't be a label's control). */
export declare function Label({ htmlFor, ...rest }: Readonly>): import("react").JSX.Element;
/** The labelled group around the track, its end labels and the boxes (as ``). */
export declare function Group(props: Readonly>): import("react").JSX.Element;
/** The pointer area: a press moves the nearer thumb there and starts a drag. Sets `--slider-range-start` / `--slider-range-end`. */
export declare function Control({ ref, style, ...rest }: Readonly>): import("react").JSX.Element;
/** The rail. */
export declare function Track(props: Readonly>): import("react").JSX.Element;
/** The filled part, from `--slider-range-start` to `--slider-range-end`. */
export declare function Indicator(props: Readonly>): import("react").JSX.Element;
export interface ThumbProps extends ComponentProps<'div'> {
/** Which value it moves (default 0). */
index?: number;
}
/**
* A thumb: `role="slider"` with its value and bounds (a neighbour bounds it), named by `Label`
* unless you give it `aria-label` / `aria-labelledby`. Give `aria-valuetext` for a formatted value.
*/
export declare function Thumb({ index, id, tabIndex, ref, ...rest }: Readonly): import("react").JSX.Element;
export interface InputProps extends Omit, 'type' | 'value' | 'defaultValue' | 'min' | 'max' | 'step'> {
/** Which value it edits (default 0). */
index?: number;
}
/** A number box beside the track: typing in range applies at once; blur or Enter clamps (or flags text that isn't a number). */
export declare function Input({ index, ref, ...rest }: Readonly): import("react").JSX.Element;
export interface HiddenInputProps extends Omit, 'type' | 'value' | 'defaultValue'> {
/** Which value it submits (default 0). */
index?: number;
}
/** Submits a value with its form under `name` (nothing while disabled). */
export declare function HiddenInput({ index, ...rest }: Readonly): import("react").JSX.Element;