import * as React from 'react'; import { View } from 'react-native'; import type { ZestUIComponentProps, Orientation } from '../../types'; import type { ZestChangeEventDetails } from '../../utils/createChangeEventDetails'; import type { REASONS } from '../../utils/reasons'; import { type Direction } from '../../direction-provider/DirectionContext'; /** * How the thumbs of a range slider behave when one is dragged into another. */ export type SliderThumbCollisionBehavior = 'push' | 'swap' | 'none'; /** * Groups all parts of the slider. * Renders a ``. * * Drop the web-only props: `name`/`form` (React Native has no form submission), * `largeStep` (a PageUp/PageDown affordance), and `thumbAlignment` — the latter * is pure CSS inset positioning, and here the consumer places the thumb itself * from `state.values`. */ export declare function SliderRoot(componentProps: SliderRoot.Props): React.JSX.Element; export interface SliderRootState { /** * The writing direction the slider is laid out for. A horizontal slider runs * right to left under `'rtl'`, so position your thumb and indicator from the * track's *start* — React Native's direction-aware `start` style prop does * this for you, and `left` does not. */ direction: Direction; /** * Whether the component should ignore user interaction. */ disabled: boolean; /** * Whether a thumb is currently being dragged. */ dragging: boolean; /** * The maximum allowed value. */ max: number; /** * The minimum allowed value. */ min: number; /** * The component orientation. */ orientation: Orientation; /** * The current value of every thumb. */ values: readonly number[]; } export interface SliderRootProps extends Omit, 'value'> { /** * The value of the slider. Pass an array for a range slider. * * To render an uncontrolled slider, use the `defaultValue` prop instead. */ value?: Value | undefined; /** * The initial value of the slider. * * To render a controlled slider, use the `value` prop instead. */ defaultValue?: Value | undefined; /** * Event handler called while a thumb is being dragged. */ onValueChange?: ((value: Value, eventDetails: SliderRoot.ChangeEventDetails) => void) | undefined; /** * Event handler called once the drag ends. */ onValueCommitted?: ((value: Value, eventDetails: SliderRoot.ChangeEventDetails) => void) | undefined; /** * The minimum allowed value. * @default 0 */ min?: number | undefined; /** * The maximum allowed value. * @default 100 */ max?: number | undefined; /** * The granularity the value must adhere to. * @default 1 */ step?: number | undefined; /** * Returns a human-readable text alternative for a thumb's value, announced by * assistive technology. * * Renamed from upstream's `getAriaValueText`: on React Native this feeds * `accessibilityValue.text`, not `aria-valuetext`. The third argument is the * thumb's index, so the two ends of a range can read differently. * * @example * ```tsx * * `${index === 0 ? 'Minimum' : 'Maximum'} ${text}` * } * /> * ``` */ getAccessibilityValueText?: ((formattedValue: string, value: number, index: number) => string) | undefined; /** * The minimum number of steps to keep between the thumbs of a range slider. * @default 0 */ minStepsBetweenValues?: number | undefined; /** * How the thumbs of a range slider behave when one is dragged into another. * * - `'push'`: the dragged thumb pushes the ones in its way along the track. * - `'swap'`: thumbs trade places when one is dragged past another. * `minStepsBetweenValues` is not enforced while they cross — thumbs allowed * to pass each other cannot be held apart while they do it. * - `'none'`: a thumb stops at its neighbour and the excess movement is * dropped. * * @default 'push' */ thumbCollisionBehavior?: SliderThumbCollisionBehavior | undefined; /** * Whether the component should ignore user interaction. * @default false */ disabled?: boolean | undefined; /** * @default 'horizontal' */ orientation?: Orientation | undefined; /** * Options for formatting the value in `Slider.Value`. */ format?: Intl.NumberFormatOptions | undefined; /** * The locale used to format the value in `Slider.Value`. */ locale?: Intl.LocalesArgument | undefined; } export type SliderRootChangeEventReason = typeof REASONS.drag | typeof REASONS.none; export type SliderRootChangeEventDetails = ZestChangeEventDetails; export declare namespace SliderRoot { type State = SliderRootState; type Props = SliderRootProps; type ChangeEventReason = SliderRootChangeEventReason; type ChangeEventDetails = SliderRootChangeEventDetails; } //# sourceMappingURL=SliderRoot.d.ts.map