import * as React from 'react'; import { OverrideProps } from '@mui/types'; import { CreateSlotsAndSlotProps, SlotCommonProps, SlotProps } from '../types/slot'; import { UseSliderParameters } from '../internal/hooks/useSlider'; export type SliderSlot = 'root' | 'mark' | 'markLabel' | 'rail' | 'track' | 'thumb' | 'valueLabel' | 'input'; export interface SliderSlots { /** * The component that renders the root. * @default 'span' */ root?: React.ElementType; /** * The component that renders the track. * @default 'span' */ track?: React.ElementType; /** * The component that renders the rail. * @default 'span' */ rail?: React.ElementType; /** * The component that renders the thumb. * @default 'span' */ thumb?: React.ElementType; /** * The component that renders the mark. * @default 'span' */ mark?: React.ElementType; /** * The component that renders the mark label. * @default 'span' */ markLabel?: React.ElementType; /** * The component that renders the value label. * @default 'span' */ valueLabel?: React.ElementType; /** * The component that renders the input. * @default 'input' */ input?: React.ElementType; } export type SliderSlotsAndSlotProps = CreateSlotsAndSlotProps, SliderOwnerState>; track: SlotProps<'span', Record, SliderOwnerState>; rail: SlotProps<'span', Record, SliderOwnerState>; thumb: SlotProps<'span', Record, SliderOwnerState>; mark: SlotProps<'span', Record, SliderOwnerState & { percent?: number; }>; markLabel: SlotProps<'span', Record, SliderOwnerState>; valueLabel: SlotProps<'span', Record, SliderOwnerState>; input: SlotProps<'input', Record, SliderOwnerState>; }>; export type SliderTypeMap> = { props: P & Omit & { /** * The label of the slider. */ 'aria-label'?: string; /** * A string value that provides a user-friendly name for the current value of the slider. */ 'aria-valuetext'?: string; /** * Accepts a function which returns a string value that provides a user-friendly name for the thumb labels of the slider. * This is important for screen reader users. * @param {number} index The thumb label's index to format. * @returns {string} */ getAriaLabel?: (index: number) => string; /** * Accepts a function which returns a string value that provides a user-friendly name for the current value of the slider. * This is important for screen reader users. * @param {number} value The thumb label's value to format. * @param {number} index The thumb label's index to format. * @returns {string} */ getAriaValueText?: (value: number, index: number) => string; /** * The track presentation: * * - `normal` the track will render a bar representing the slider value. * - `inverted` the track will render a bar representing the remaining slider value. * - `false` the track will render without a bar. * @default 'normal' */ track?: 'normal' | false | 'inverted'; /** * The format function the value label's value. * * When a function is provided, it should have the following signature: * * - {number} value The value label's value to format * - {number} index The value label's index to format * @param {any} x * @returns {any} * @default function Identity(x) { * return x; * } */ valueLabelFormat?: string | ((value: number, index: number) => React.ReactNode); /** * Controls when the value label is displayed: * * - `auto` the value label will display when the thumb is hovered or focused. * - `on` will display persistently. * - `off` will never display. * @default 'off' */ valueLabelDisplay?: 'on' | 'auto' | 'off'; } & SliderSlotsAndSlotProps; defaultComponent: D; }; export type SliderProps = OverrideProps, D>; export interface SliderOwnerState extends SliderProps, Record { /** * If `true`, the thumb is in dragging state. */ dragging: boolean; /** * If `true`, some of the marks has `label` property. */ marked: boolean; }