1 | import * as React from 'react';
|
2 | import { SxProps } from '@mui/system';
|
3 | import { OverridableStringUnion } from '@mui/types';
|
4 | import { Mark } from './useSlider.types';
|
5 | import { SlotComponentProps } from '../utils/types';
|
6 | import { Theme } from '../styles';
|
7 | import { OverrideProps, OverridableComponent } from '../OverridableComponent';
|
8 | import SliderValueLabelComponent from './SliderValueLabel';
|
9 | import { SliderClasses } from './sliderClasses';
|
10 |
|
11 | export interface SliderPropsColorOverrides {}
|
12 |
|
13 | export interface SliderPropsSizeOverrides {}
|
14 |
|
15 | export interface SliderComponentsPropsOverrides {}
|
16 |
|
17 | export interface SliderOwnerState extends SliderProps {
|
18 | dragging: boolean;
|
19 | marked: boolean;
|
20 | focusedThumbIndex: number;
|
21 | }
|
22 |
|
23 | export interface SliderOwnProps {
|
24 | |
25 |
|
26 |
|
27 | 'aria-label'?: string;
|
28 | |
29 |
|
30 |
|
31 | 'aria-labelledby'?: string;
|
32 | |
33 |
|
34 |
|
35 | 'aria-valuetext'?: string;
|
36 | |
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | color?: OverridableStringUnion<
|
43 | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning',
|
44 | SliderPropsColorOverrides
|
45 | >;
|
46 | |
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | components?: {
|
54 | Root?: React.ElementType;
|
55 | Track?: React.ElementType;
|
56 | Rail?: React.ElementType;
|
57 | Thumb?: React.ElementType;
|
58 | Mark?: React.ElementType;
|
59 | MarkLabel?: React.ElementType;
|
60 | ValueLabel?: React.ElementType;
|
61 | Input?: React.ElementType;
|
62 | };
|
63 | |
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | componentsProps?: {
|
72 | root?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
73 | track?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
74 | rail?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
75 | thumb?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
76 | mark?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
77 | markLabel?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
78 | valueLabel?: SlotComponentProps<
|
79 | typeof SliderValueLabelComponent,
|
80 | SliderComponentsPropsOverrides,
|
81 | SliderOwnerState
|
82 | >;
|
83 | input?: SlotComponentProps<'input', SliderComponentsPropsOverrides, SliderOwnerState>;
|
84 | };
|
85 | |
86 |
|
87 |
|
88 | classes?: Partial<SliderClasses>;
|
89 | |
90 |
|
91 |
|
92 | className?: string;
|
93 | |
94 |
|
95 |
|
96 | defaultValue?: number | number[];
|
97 | |
98 |
|
99 |
|
100 |
|
101 | disabled?: boolean;
|
102 | |
103 |
|
104 |
|
105 |
|
106 | disableSwap?: boolean;
|
107 | |
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | getAriaLabel?: (index: number) => string;
|
114 | |
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 | getAriaValueText?: (value: number, index: number) => string;
|
122 | |
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 | marks?: boolean | Mark[];
|
129 | |
130 |
|
131 |
|
132 |
|
133 |
|
134 | max?: number;
|
135 | |
136 |
|
137 |
|
138 |
|
139 |
|
140 | min?: number;
|
141 | |
142 |
|
143 |
|
144 | name?: string;
|
145 | |
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 | onChange?: (event: Event, value: number | number[], activeThumb: number) => void;
|
155 | |
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 | onChangeCommitted?: (event: React.SyntheticEvent | Event, value: number | number[]) => void;
|
162 | |
163 |
|
164 |
|
165 |
|
166 | orientation?: 'horizontal' | 'vertical';
|
167 | |
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 | scale?: (value: number) => number;
|
176 | |
177 |
|
178 |
|
179 |
|
180 | shiftStep?: number;
|
181 | |
182 |
|
183 |
|
184 |
|
185 | size?: OverridableStringUnion<'small' | 'medium', SliderPropsSizeOverrides>;
|
186 | |
187 |
|
188 |
|
189 |
|
190 | slotProps?: {
|
191 | root?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
192 | track?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
193 | rail?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
194 | thumb?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
195 | mark?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
196 | markLabel?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
|
197 | valueLabel?: SlotComponentProps<
|
198 | typeof SliderValueLabelComponent,
|
199 | SliderComponentsPropsOverrides,
|
200 | SliderOwnerState
|
201 | >;
|
202 | input?: SlotComponentProps<'input', SliderComponentsPropsOverrides, SliderOwnerState>;
|
203 | };
|
204 | |
205 |
|
206 |
|
207 |
|
208 |
|
209 | slots?: {
|
210 | root?: React.ElementType;
|
211 | track?: React.ElementType;
|
212 | rail?: React.ElementType;
|
213 | thumb?: React.ElementType;
|
214 | mark?: React.ElementType;
|
215 | markLabel?: React.ElementType;
|
216 | valueLabel?: React.ElementType;
|
217 | input?: React.ElementType;
|
218 | };
|
219 | |
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 | step?: number | null;
|
228 | |
229 |
|
230 |
|
231 | sx?: SxProps<Theme>;
|
232 | |
233 |
|
234 |
|
235 | tabIndex?: number;
|
236 | |
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 | track?: 'normal' | false | 'inverted';
|
245 | |
246 |
|
247 |
|
248 |
|
249 | value?: number | number[];
|
250 | |
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 | valueLabelDisplay?: 'on' | 'auto' | 'off';
|
259 | |
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 | valueLabelFormat?: string | ((value: number, index: number) => React.ReactNode);
|
273 | }
|
274 |
|
275 | export interface SliderTypeMap<
|
276 | RootComponent extends React.ElementType = 'span',
|
277 | AdditionalProps = {},
|
278 | > {
|
279 | props: AdditionalProps & SliderOwnProps;
|
280 | defaultComponent: RootComponent;
|
281 | }
|
282 |
|
283 | export interface SliderValueLabelProps extends React.HTMLAttributes<HTMLSpanElement> {
|
284 | children: React.ReactElement<unknown>;
|
285 | index: number;
|
286 | open: boolean;
|
287 | value: React.ReactNode;
|
288 | }
|
289 |
|
290 | type SliderRootProps = NonNullable<SliderTypeMap['props']['componentsProps']>['root'];
|
291 | type SliderMarkProps = NonNullable<SliderTypeMap['props']['componentsProps']>['mark'];
|
292 | type SliderMarkLabelProps = NonNullable<SliderTypeMap['props']['componentsProps']>['markLabel'];
|
293 | type SliderRailProps = NonNullable<SliderTypeMap['props']['componentsProps']>['rail'];
|
294 | type SliderTrackProps = NonNullable<SliderTypeMap['props']['componentsProps']>['track'];
|
295 | type SliderThumbProps = NonNullable<SliderTypeMap['props']['componentsProps']>['thumb'];
|
296 |
|
297 | export declare const SliderRoot: React.FC<SliderRootProps>;
|
298 | export declare const SliderMark: React.FC<SliderMarkProps>;
|
299 | export declare const SliderMarkLabel: React.FC<SliderMarkLabelProps>;
|
300 | export declare const SliderRail: React.FC<SliderRailProps>;
|
301 | export declare const SliderTrack: React.FC<SliderTrackProps>;
|
302 | export declare const SliderThumb: React.FC<SliderThumbProps>;
|
303 | export declare const SliderValueLabel: React.FC<SliderValueLabelProps>;
|
304 |
|
305 | /**
|
306 | *
|
307 | * Demos:
|
308 | *
|
309 | * - [Slider](https:
|
310 | *
|
311 | * API:
|
312 | *
|
313 | * - [Slider API](https:
|
314 | */
|
315 | declare const Slider: OverridableComponent<SliderTypeMap>;
|
316 |
|
317 | export type SliderProps<
|
318 | RootComponent extends React.ElementType = SliderTypeMap['defaultComponent'],
|
319 | AdditionalProps = {},
|
320 | > = OverrideProps<SliderTypeMap<RootComponent, AdditionalProps>, RootComponent> & {
|
321 | component?: React.ElementType;
|
322 | };
|
323 |
|
324 | export default Slider;
|
325 |
|
\ | No newline at end of file |