@mui/material 5.14.6 → 5.14.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/Accordion/Accordion.d.ts +2 -2
  2. package/AccordionSummary/AccordionSummary.d.ts +22 -20
  3. package/AppBar/AppBar.d.ts +33 -31
  4. package/Avatar/Avatar.d.ts +49 -50
  5. package/Backdrop/Backdrop.d.ts +87 -85
  6. package/Badge/Badge.d.ts +2 -2
  7. package/BottomNavigation/BottomNavigation.d.ts +35 -33
  8. package/BottomNavigationAction/BottomNavigationAction.d.ts +39 -37
  9. package/Breadcrumbs/Breadcrumbs.d.ts +69 -67
  10. package/Button/Button.d.ts +72 -73
  11. package/ButtonBase/ButtonBase.d.ts +83 -81
  12. package/ButtonGroup/ButtonGroup.d.ts +72 -70
  13. package/CHANGELOG.md +136 -2
  14. package/Card/Card.d.ts +19 -18
  15. package/CardActionArea/CardActionArea.d.ts +15 -13
  16. package/CardContent/CardContent.d.ts +18 -16
  17. package/CardHeader/CardHeader.d.ts +77 -67
  18. package/CardMedia/CardMedia.d.ts +30 -28
  19. package/Chip/Chip.d.ts +84 -82
  20. package/CircularProgress/CircularProgress.d.ts +1 -1
  21. package/CircularProgress/CircularProgress.js +1 -1
  22. package/Container/Container.d.ts +35 -33
  23. package/DialogContentText/DialogContentText.d.ts +14 -12
  24. package/DialogTitle/DialogTitle.d.ts +18 -16
  25. package/Divider/Divider.d.ts +49 -50
  26. package/Fab/Fab.d.ts +59 -56
  27. package/FormControl/FormControl.d.ts +74 -72
  28. package/FormHelperText/FormHelperText.d.ts +52 -50
  29. package/FormLabel/FormLabel.d.ts +7 -4
  30. package/Grid/Grid.d.ts +69 -68
  31. package/Hidden/Hidden.d.ts +10 -10
  32. package/Icon/Icon.d.ts +50 -48
  33. package/IconButton/IconButton.d.ts +52 -50
  34. package/ImageList/ImageList.d.ts +41 -39
  35. package/ImageListItem/ImageListItem.d.ts +28 -26
  36. package/ImageListItem/ImageListItem.js +2 -1
  37. package/InputAdornment/InputAdornment.d.ts +39 -37
  38. package/InputBase/InputBase.js +1 -1
  39. package/InputLabel/InputLabel.d.ts +58 -56
  40. package/InputLabel/InputLabel.js +2 -1
  41. package/Link/Link.d.ts +37 -39
  42. package/List/List.d.ts +34 -35
  43. package/ListItem/ListItem.d.ts +53 -49
  44. package/ListItemButton/ListItemButton.d.ts +9 -3
  45. package/ListSubheader/ListSubheader.d.ts +38 -36
  46. package/MenuItem/MenuItem.d.ts +47 -44
  47. package/MenuList/MenuList.d.ts +37 -35
  48. package/Modal/Modal.d.ts +172 -178
  49. package/PaginationItem/PaginationItem.d.ts +85 -83
  50. package/Paper/Paper.d.ts +2 -2
  51. package/Popover/Popover.d.ts +2 -1
  52. package/Popover/Popover.js +20 -6
  53. package/Radio/Radio.js +3 -2
  54. package/Radio/radioClasses.d.ts +2 -0
  55. package/Radio/radioClasses.js +1 -1
  56. package/ScopedCssBaseline/ScopedCssBaseline.d.ts +25 -23
  57. package/Select/SelectInput.js +9 -5
  58. package/Skeleton/Skeleton.d.ts +42 -40
  59. package/Slider/Slider.d.ts +249 -247
  60. package/Snackbar/Snackbar.d.ts +4 -4
  61. package/Snackbar/Snackbar.js +4 -4
  62. package/Stack/Stack.d.ts +39 -38
  63. package/Step/Step.d.ts +46 -44
  64. package/StepButton/StepButton.d.ts +27 -25
  65. package/Stepper/Stepper.d.ts +45 -44
  66. package/SvgIcon/SvgIcon.d.ts +77 -75
  67. package/SwipeableDrawer/SwipeableDrawer.js +4 -4
  68. package/Tab/Tab.d.ts +52 -50
  69. package/TabScrollButton/TabScrollButton.d.ts +3 -2
  70. package/Table/Table.d.ts +35 -33
  71. package/TableBody/TableBody.d.ts +18 -16
  72. package/TableContainer/TableContainer.d.ts +18 -16
  73. package/TableFooter/TableFooter.d.ts +18 -16
  74. package/TableHead/TableHead.d.ts +18 -16
  75. package/TablePagination/TablePagination.d.ts +113 -112
  76. package/TableRow/TableRow.d.ts +28 -26
  77. package/TableSortLabel/TableSortLabel.d.ts +40 -36
  78. package/Tabs/Tabs.d.ts +153 -150
  79. package/ToggleButton/ToggleButton.d.ts +72 -70
  80. package/Toolbar/Toolbar.d.ts +29 -27
  81. package/Typography/Typography.d.ts +2 -2
  82. package/index.js +1 -1
  83. package/legacy/CircularProgress/CircularProgress.js +1 -1
  84. package/legacy/ImageListItem/ImageListItem.js +2 -1
  85. package/legacy/InputBase/InputBase.js +1 -1
  86. package/legacy/InputLabel/InputLabel.js +2 -1
  87. package/legacy/Popover/Popover.js +22 -5
  88. package/legacy/Radio/Radio.js +3 -2
  89. package/legacy/Radio/radioClasses.js +1 -1
  90. package/legacy/Select/SelectInput.js +9 -5
  91. package/legacy/Snackbar/Snackbar.js +4 -4
  92. package/legacy/SwipeableDrawer/SwipeableDrawer.js +4 -4
  93. package/legacy/index.js +1 -1
  94. package/modern/CircularProgress/CircularProgress.js +1 -1
  95. package/modern/ImageListItem/ImageListItem.js +2 -1
  96. package/modern/InputBase/InputBase.js +1 -1
  97. package/modern/InputLabel/InputLabel.js +2 -1
  98. package/modern/Popover/Popover.js +20 -6
  99. package/modern/Radio/Radio.js +3 -2
  100. package/modern/Radio/radioClasses.js +1 -1
  101. package/modern/Select/SelectInput.js +8 -5
  102. package/modern/Snackbar/Snackbar.js +4 -4
  103. package/modern/SwipeableDrawer/SwipeableDrawer.js +4 -4
  104. package/modern/index.js +1 -1
  105. package/node/CircularProgress/CircularProgress.js +1 -1
  106. package/node/ImageListItem/ImageListItem.js +2 -1
  107. package/node/InputBase/InputBase.js +1 -1
  108. package/node/InputLabel/InputLabel.js +2 -1
  109. package/node/Popover/Popover.js +20 -6
  110. package/node/Radio/Radio.js +3 -2
  111. package/node/Radio/radioClasses.js +1 -1
  112. package/node/Select/SelectInput.js +9 -5
  113. package/node/Snackbar/Snackbar.js +4 -4
  114. package/node/SwipeableDrawer/SwipeableDrawer.js +4 -4
  115. package/node/index.js +1 -1
  116. package/package.json +5 -5
  117. package/umd/material-ui.development.js +75 -34
  118. package/umd/material-ui.production.min.js +7 -7
@@ -1,34 +1,36 @@
1
- import { SxProps } from '@mui/system';
2
1
  import * as React from 'react';
2
+ import { SxProps } from '@mui/system';
3
3
  import { Theme } from '../styles';
4
4
  import { OverridableComponent, OverrideProps } from '../OverridableComponent';
5
5
  import { ScopedCssBaselineClasses } from './scopedCssBaselineClasses';
6
6
 
7
+ export interface ScopedCssBaselineOwnProps {
8
+ /**
9
+ * The content of the component.
10
+ */
11
+ children?: React.ReactNode;
12
+ /**
13
+ * Override or extend the styles applied to the component.
14
+ */
15
+ classes?: Partial<ScopedCssBaselineClasses>;
16
+ /**
17
+ * Enable `color-scheme` CSS property to use `theme.palette.mode`.
18
+ * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
19
+ * For browser support, check out https://caniuse.com/?search=color-scheme
20
+ */
21
+ enableColorScheme?: boolean;
22
+ /**
23
+ * The system prop that allows defining system overrides as well as additional CSS styles.
24
+ */
25
+ sx?: SxProps<Theme>;
26
+ }
27
+
7
28
  export interface ScopedCssBaselineTypeMap<
8
29
  AdditionalProps = {},
9
- DefaultComponent extends React.ElementType = 'div',
30
+ RootComponent extends React.ElementType = 'div',
10
31
  > {
11
- props: AdditionalProps & {
12
- /**
13
- * The content of the component.
14
- */
15
- children?: React.ReactNode;
16
- /**
17
- * Override or extend the styles applied to the component.
18
- */
19
- classes?: Partial<ScopedCssBaselineClasses>;
20
- /**
21
- * Enable `color-scheme` CSS property to use `theme.palette.mode`.
22
- * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
23
- * For browser support, check out https://caniuse.com/?search=color-scheme
24
- */
25
- enableColorScheme?: boolean;
26
- /**
27
- * The system prop that allows defining system overrides as well as additional CSS styles.
28
- */
29
- sx?: SxProps<Theme>;
30
- };
31
- defaultComponent: DefaultComponent;
32
+ props: AdditionalProps & ScopedCssBaselineOwnProps;
33
+ defaultComponent: RootComponent;
32
34
  }
33
35
  /**
34
36
  *
@@ -109,6 +109,7 @@ const useUtilityClasses = ownerState => {
109
109
  * @ignore - internal component.
110
110
  */
111
111
  const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref) {
112
+ var _MenuProps$slotProps;
112
113
  const {
113
114
  'aria-describedby': ariaDescribedby,
114
115
  'aria-label': ariaLabel,
@@ -432,6 +433,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
432
433
  error
433
434
  });
434
435
  const classes = useUtilityClasses(ownerState);
436
+ const paperProps = _extends({}, MenuProps.PaperProps, (_MenuProps$slotProps = MenuProps.slotProps) == null ? void 0 : _MenuProps$slotProps.paper);
435
437
  return /*#__PURE__*/_jsxs(React.Fragment, {
436
438
  children: [/*#__PURE__*/_jsx(SelectSelect, _extends({
437
439
  ref: handleDisplayRef,
@@ -493,11 +495,13 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
493
495
  role: 'listbox',
494
496
  disableListWrap: true
495
497
  }, MenuProps.MenuListProps),
496
- PaperProps: _extends({}, MenuProps.PaperProps, {
497
- style: _extends({
498
- minWidth: menuMinWidth
499
- }, MenuProps.PaperProps != null ? MenuProps.PaperProps.style : null)
500
- }),
498
+ slotProps: {
499
+ paper: _extends({}, paperProps, {
500
+ style: _extends({
501
+ minWidth: menuMinWidth
502
+ }, paperProps != null ? paperProps.style : null)
503
+ })
504
+ },
501
505
  children: items
502
506
  }))]
503
507
  });
@@ -7,49 +7,51 @@ import { SkeletonClasses } from './skeletonClasses';
7
7
 
8
8
  export interface SkeletonPropsVariantOverrides {}
9
9
 
10
+ export interface SkeletonOwnProps {
11
+ /**
12
+ * The animation.
13
+ * If `false` the animation effect is disabled.
14
+ * @default 'pulse'
15
+ */
16
+ animation?: 'pulse' | 'wave' | false;
17
+ /**
18
+ * Optional children to infer width and height from.
19
+ */
20
+ children?: React.ReactNode;
21
+ /**
22
+ * Override or extend the styles applied to the component.
23
+ */
24
+ classes?: Partial<SkeletonClasses>;
25
+ /**
26
+ * Height of the skeleton.
27
+ * Useful when you don't want to adapt the skeleton to a text element but for instance a card.
28
+ */
29
+ height?: number | string;
30
+ /**
31
+ * The system prop that allows defining system overrides as well as additional CSS styles.
32
+ */
33
+ sx?: SxProps<Theme>;
34
+ /**
35
+ * The type of content that will be rendered.
36
+ * @default 'text'
37
+ */
38
+ variant?: OverridableStringUnion<
39
+ 'text' | 'rectangular' | 'rounded' | 'circular',
40
+ SkeletonPropsVariantOverrides
41
+ >;
42
+ /**
43
+ * Width of the skeleton.
44
+ * Useful when the skeleton is inside an inline element with no width of its own.
45
+ */
46
+ width?: number | string;
47
+ }
48
+
10
49
  export interface SkeletonTypeMap<
11
50
  AdditionalProps = {},
12
- DefaultComponent extends React.ElementType = 'span',
51
+ RootComponent extends React.ElementType = 'span',
13
52
  > {
14
- props: AdditionalProps & {
15
- /**
16
- * The animation.
17
- * If `false` the animation effect is disabled.
18
- * @default 'pulse'
19
- */
20
- animation?: 'pulse' | 'wave' | false;
21
- /**
22
- * Optional children to infer width and height from.
23
- */
24
- children?: React.ReactNode;
25
- /**
26
- * Override or extend the styles applied to the component.
27
- */
28
- classes?: Partial<SkeletonClasses>;
29
- /**
30
- * Height of the skeleton.
31
- * Useful when you don't want to adapt the skeleton to a text element but for instance a card.
32
- */
33
- height?: number | string;
34
- /**
35
- * The system prop that allows defining system overrides as well as additional CSS styles.
36
- */
37
- sx?: SxProps<Theme>;
38
- /**
39
- * The type of content that will be rendered.
40
- * @default 'text'
41
- */
42
- variant?: OverridableStringUnion<
43
- 'text' | 'rectangular' | 'rounded' | 'circular',
44
- SkeletonPropsVariantOverrides
45
- >;
46
- /**
47
- * Width of the skeleton.
48
- * Useful when the skeleton is inside an inline element with no width of its own.
49
- */
50
- width?: number | string;
51
- };
52
- defaultComponent: DefaultComponent;
53
+ props: AdditionalProps & SkeletonOwnProps;
54
+ defaultComponent: RootComponent;
53
55
  }
54
56
 
55
57
  /**
@@ -20,256 +20,258 @@ export interface SliderOwnerState extends SliderProps {
20
20
  focusedThumbIndex: number;
21
21
  }
22
22
 
23
+ export interface SliderOwnProps {
24
+ /**
25
+ * The label of the slider.
26
+ */
27
+ 'aria-label'?: string;
28
+ /**
29
+ * The id of the element containing a label for the slider.
30
+ */
31
+ 'aria-labelledby'?: string;
32
+ /**
33
+ * A string value that provides a user-friendly name for the current value of the slider.
34
+ */
35
+ 'aria-valuetext'?: string;
36
+ /**
37
+ * The color of the component.
38
+ * It supports both default and custom theme colors, which can be added as shown in the
39
+ * [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
40
+ * @default 'primary'
41
+ */
42
+ color?: OverridableStringUnion<'primary' | 'secondary', SliderPropsColorOverrides>;
43
+ /**
44
+ * The components used for each slot inside.
45
+ *
46
+ * This prop is an alias for the `slots` prop.
47
+ * It's recommended to use the `slots` prop instead.
48
+ *
49
+ * @default {}
50
+ */
51
+ components?: {
52
+ Root?: React.ElementType;
53
+ Track?: React.ElementType;
54
+ Rail?: React.ElementType;
55
+ Thumb?: React.ElementType;
56
+ Mark?: React.ElementType;
57
+ MarkLabel?: React.ElementType;
58
+ ValueLabel?: React.ElementType;
59
+ Input?: React.ElementType;
60
+ };
61
+ /**
62
+ * The extra props for the slot components.
63
+ * You can override the existing props or add new ones.
64
+ *
65
+ * This prop is an alias for the `slotProps` prop.
66
+ * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
67
+ *
68
+ * @default {}
69
+ */
70
+ componentsProps?: {
71
+ root?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
72
+ track?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
73
+ rail?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
74
+ thumb?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
75
+ mark?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
76
+ markLabel?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
77
+ valueLabel?: SlotComponentProps<
78
+ typeof SliderValueLabelComponent,
79
+ SliderComponentsPropsOverrides,
80
+ SliderOwnerState
81
+ >;
82
+ input?: SlotComponentProps<'input', SliderComponentsPropsOverrides, SliderOwnerState>;
83
+ };
84
+ /**
85
+ * Override or extend the styles applied to the component.
86
+ */
87
+ classes?: Partial<SliderClasses>;
88
+ /**
89
+ * @ignore
90
+ */
91
+ className?: string;
92
+ /**
93
+ * The default value. Use when the component is not controlled.
94
+ */
95
+ defaultValue?: number | number[];
96
+ /**
97
+ * If `true`, the component is disabled.
98
+ * @default false
99
+ */
100
+ disabled?: boolean;
101
+ /**
102
+ * If `true`, the active thumb doesn't swap when moving pointer over a thumb while dragging another thumb.
103
+ * @default false
104
+ */
105
+ disableSwap?: boolean;
106
+ /**
107
+ * Accepts a function which returns a string value that provides a user-friendly name for the thumb labels of the slider.
108
+ * This is important for screen reader users.
109
+ * @param {number} index The thumb label's index to format.
110
+ * @returns {string}
111
+ */
112
+ getAriaLabel?: (index: number) => string;
113
+ /**
114
+ * Accepts a function which returns a string value that provides a user-friendly name for the current value of the slider.
115
+ * This is important for screen reader users.
116
+ * @param {number} value The thumb label's value to format.
117
+ * @param {number} index The thumb label's index to format.
118
+ * @returns {string}
119
+ */
120
+ getAriaValueText?: (value: number, index: number) => string;
121
+ /**
122
+ * Marks indicate predetermined values to which the user can move the slider.
123
+ * If `true` the marks are spaced according the value of the `step` prop.
124
+ * If an array, it should contain objects with `value` and an optional `label` keys.
125
+ * @default false
126
+ */
127
+ marks?: boolean | Mark[];
128
+ /**
129
+ * The maximum allowed value of the slider.
130
+ * Should not be equal to min.
131
+ * @default 100
132
+ */
133
+ max?: number;
134
+ /**
135
+ * The minimum allowed value of the slider.
136
+ * Should not be equal to max.
137
+ * @default 0
138
+ */
139
+ min?: number;
140
+ /**
141
+ * Name attribute of the hidden `input` element.
142
+ */
143
+ name?: string;
144
+ /**
145
+ * Callback function that is fired when the slider's value changed.
146
+ *
147
+ * @param {Event} event The event source of the callback.
148
+ * You can pull out the new value by accessing `event.target.value` (any).
149
+ * **Warning**: This is a generic event not a change event.
150
+ * @param {number | number[]} value The new value.
151
+ * @param {number} activeThumb Index of the currently moved thumb.
152
+ */
153
+ onChange?: (event: Event, value: number | number[], activeThumb: number) => void;
154
+ /**
155
+ * Callback function that is fired when the `mouseup` is triggered.
156
+ *
157
+ * @param {React.SyntheticEvent | Event} event The event source of the callback. **Warning**: This is a generic event not a change event.
158
+ * @param {number | number[]} value The new value.
159
+ */
160
+ onChangeCommitted?: (event: React.SyntheticEvent | Event, value: number | number[]) => void;
161
+ /**
162
+ * The component orientation.
163
+ * @default 'horizontal'
164
+ */
165
+ orientation?: 'horizontal' | 'vertical';
166
+ /**
167
+ * A transformation function, to change the scale of the slider.
168
+ * @param {any} x
169
+ * @returns {any}
170
+ * @default function Identity(x) {
171
+ * return x;
172
+ * }
173
+ */
174
+ scale?: (value: number) => number;
175
+ /**
176
+ * The size of the slider.
177
+ * @default 'medium'
178
+ */
179
+ size?: OverridableStringUnion<'small' | 'medium', SliderPropsSizeOverrides>;
180
+ /**
181
+ * The props used for each slot inside the Slider.
182
+ * @default {}
183
+ */
184
+ slotProps?: {
185
+ root?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
186
+ track?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
187
+ rail?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
188
+ thumb?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
189
+ mark?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
190
+ markLabel?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
191
+ valueLabel?: SlotComponentProps<
192
+ typeof SliderValueLabelComponent,
193
+ SliderComponentsPropsOverrides,
194
+ SliderOwnerState
195
+ >;
196
+ input?: SlotComponentProps<'input', SliderComponentsPropsOverrides, SliderOwnerState>;
197
+ };
198
+ /**
199
+ * The components used for each slot inside the Slider.
200
+ * Either a string to use a HTML element or a component.
201
+ * @default {}
202
+ */
203
+ slots?: {
204
+ root?: React.ElementType;
205
+ track?: React.ElementType;
206
+ rail?: React.ElementType;
207
+ thumb?: React.ElementType;
208
+ mark?: React.ElementType;
209
+ markLabel?: React.ElementType;
210
+ valueLabel?: React.ElementType;
211
+ input?: React.ElementType;
212
+ };
213
+ /**
214
+ * The granularity with which the slider can step through values. (A "discrete" slider.)
215
+ * The `min` prop serves as the origin for the valid values.
216
+ * We recommend (max - min) to be evenly divisible by the step.
217
+ *
218
+ * When step is `null`, the thumb can only be slid onto marks provided with the `marks` prop.
219
+ * @default 1
220
+ */
221
+ step?: number | null;
222
+ /**
223
+ * The system prop that allows defining system overrides as well as additional CSS styles.
224
+ */
225
+ sx?: SxProps<Theme>;
226
+ /**
227
+ * Tab index attribute of the hidden `input` element.
228
+ */
229
+ tabIndex?: number;
230
+ /**
231
+ * The track presentation:
232
+ *
233
+ * - `normal` the track will render a bar representing the slider value.
234
+ * - `inverted` the track will render a bar representing the remaining slider value.
235
+ * - `false` the track will render without a bar.
236
+ * @default 'normal'
237
+ */
238
+ track?: 'normal' | false | 'inverted';
239
+ /**
240
+ * The value of the slider.
241
+ * For ranged sliders, provide an array with two values.
242
+ */
243
+ value?: number | number[];
244
+ /**
245
+ * Controls when the value label is displayed:
246
+ *
247
+ * - `auto` the value label will display when the thumb is hovered or focused.
248
+ * - `on` will display persistently.
249
+ * - `off` will never display.
250
+ * @default 'off'
251
+ */
252
+ valueLabelDisplay?: 'on' | 'auto' | 'off';
253
+ /**
254
+ * The format function the value label's value.
255
+ *
256
+ * When a function is provided, it should have the following signature:
257
+ *
258
+ * - {number} value The value label's value to format
259
+ * - {number} index The value label's index to format
260
+ * @param {any} x
261
+ * @returns {any}
262
+ * @default function Identity(x) {
263
+ * return x;
264
+ * }
265
+ */
266
+ valueLabelFormat?: string | ((value: number, index: number) => React.ReactNode);
267
+ }
268
+
23
269
  export interface SliderTypeMap<
24
- DefaultComponent extends React.ElementType = 'span',
270
+ RootComponent extends React.ElementType = 'span',
25
271
  AdditionalProps = {},
26
272
  > {
27
- props: AdditionalProps & {
28
- /**
29
- * The label of the slider.
30
- */
31
- 'aria-label'?: string;
32
- /**
33
- * The id of the element containing a label for the slider.
34
- */
35
- 'aria-labelledby'?: string;
36
- /**
37
- * A string value that provides a user-friendly name for the current value of the slider.
38
- */
39
- 'aria-valuetext'?: string;
40
- /**
41
- * The color of the component.
42
- * It supports both default and custom theme colors, which can be added as shown in the
43
- * [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
44
- * @default 'primary'
45
- */
46
- color?: OverridableStringUnion<'primary' | 'secondary', SliderPropsColorOverrides>;
47
- /**
48
- * The components used for each slot inside.
49
- *
50
- * This prop is an alias for the `slots` prop.
51
- * It's recommended to use the `slots` prop instead.
52
- *
53
- * @default {}
54
- */
55
- components?: {
56
- Root?: React.ElementType;
57
- Track?: React.ElementType;
58
- Rail?: React.ElementType;
59
- Thumb?: React.ElementType;
60
- Mark?: React.ElementType;
61
- MarkLabel?: React.ElementType;
62
- ValueLabel?: React.ElementType;
63
- Input?: React.ElementType;
64
- };
65
- /**
66
- * The extra props for the slot components.
67
- * You can override the existing props or add new ones.
68
- *
69
- * This prop is an alias for the `slotProps` prop.
70
- * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
71
- *
72
- * @default {}
73
- */
74
- componentsProps?: {
75
- root?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
76
- track?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
77
- rail?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
78
- thumb?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
79
- mark?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
80
- markLabel?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
81
- valueLabel?: SlotComponentProps<
82
- typeof SliderValueLabelComponent,
83
- SliderComponentsPropsOverrides,
84
- SliderOwnerState
85
- >;
86
- input?: SlotComponentProps<'input', SliderComponentsPropsOverrides, SliderOwnerState>;
87
- };
88
- /**
89
- * Override or extend the styles applied to the component.
90
- */
91
- classes?: Partial<SliderClasses>;
92
- /**
93
- * @ignore
94
- */
95
- className?: string;
96
- /**
97
- * The default value. Use when the component is not controlled.
98
- */
99
- defaultValue?: number | number[];
100
- /**
101
- * If `true`, the component is disabled.
102
- * @default false
103
- */
104
- disabled?: boolean;
105
- /**
106
- * If `true`, the active thumb doesn't swap when moving pointer over a thumb while dragging another thumb.
107
- * @default false
108
- */
109
- disableSwap?: boolean;
110
- /**
111
- * Accepts a function which returns a string value that provides a user-friendly name for the thumb labels of the slider.
112
- * This is important for screen reader users.
113
- * @param {number} index The thumb label's index to format.
114
- * @returns {string}
115
- */
116
- getAriaLabel?: (index: number) => string;
117
- /**
118
- * Accepts a function which returns a string value that provides a user-friendly name for the current value of the slider.
119
- * This is important for screen reader users.
120
- * @param {number} value The thumb label's value to format.
121
- * @param {number} index The thumb label's index to format.
122
- * @returns {string}
123
- */
124
- getAriaValueText?: (value: number, index: number) => string;
125
- /**
126
- * Marks indicate predetermined values to which the user can move the slider.
127
- * If `true` the marks are spaced according the value of the `step` prop.
128
- * If an array, it should contain objects with `value` and an optional `label` keys.
129
- * @default false
130
- */
131
- marks?: boolean | Mark[];
132
- /**
133
- * The maximum allowed value of the slider.
134
- * Should not be equal to min.
135
- * @default 100
136
- */
137
- max?: number;
138
- /**
139
- * The minimum allowed value of the slider.
140
- * Should not be equal to max.
141
- * @default 0
142
- */
143
- min?: number;
144
- /**
145
- * Name attribute of the hidden `input` element.
146
- */
147
- name?: string;
148
- /**
149
- * Callback function that is fired when the slider's value changed.
150
- *
151
- * @param {Event} event The event source of the callback.
152
- * You can pull out the new value by accessing `event.target.value` (any).
153
- * **Warning**: This is a generic event not a change event.
154
- * @param {number | number[]} value The new value.
155
- * @param {number} activeThumb Index of the currently moved thumb.
156
- */
157
- onChange?: (event: Event, value: number | number[], activeThumb: number) => void;
158
- /**
159
- * Callback function that is fired when the `mouseup` is triggered.
160
- *
161
- * @param {React.SyntheticEvent | Event} event The event source of the callback. **Warning**: This is a generic event not a change event.
162
- * @param {number | number[]} value The new value.
163
- */
164
- onChangeCommitted?: (event: React.SyntheticEvent | Event, value: number | number[]) => void;
165
- /**
166
- * The component orientation.
167
- * @default 'horizontal'
168
- */
169
- orientation?: 'horizontal' | 'vertical';
170
- /**
171
- * A transformation function, to change the scale of the slider.
172
- * @param {any} x
173
- * @returns {any}
174
- * @default function Identity(x) {
175
- * return x;
176
- * }
177
- */
178
- scale?: (value: number) => number;
179
- /**
180
- * The size of the slider.
181
- * @default 'medium'
182
- */
183
- size?: OverridableStringUnion<'small' | 'medium', SliderPropsSizeOverrides>;
184
- /**
185
- * The props used for each slot inside the Slider.
186
- * @default {}
187
- */
188
- slotProps?: {
189
- root?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
190
- track?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
191
- rail?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
192
- thumb?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
193
- mark?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
194
- markLabel?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
195
- valueLabel?: SlotComponentProps<
196
- typeof SliderValueLabelComponent,
197
- SliderComponentsPropsOverrides,
198
- SliderOwnerState
199
- >;
200
- input?: SlotComponentProps<'input', SliderComponentsPropsOverrides, SliderOwnerState>;
201
- };
202
- /**
203
- * The components used for each slot inside the Slider.
204
- * Either a string to use a HTML element or a component.
205
- * @default {}
206
- */
207
- slots?: {
208
- root?: React.ElementType;
209
- track?: React.ElementType;
210
- rail?: React.ElementType;
211
- thumb?: React.ElementType;
212
- mark?: React.ElementType;
213
- markLabel?: React.ElementType;
214
- valueLabel?: React.ElementType;
215
- input?: React.ElementType;
216
- };
217
- /**
218
- * The granularity with which the slider can step through values. (A "discrete" slider.)
219
- * The `min` prop serves as the origin for the valid values.
220
- * We recommend (max - min) to be evenly divisible by the step.
221
- *
222
- * When step is `null`, the thumb can only be slid onto marks provided with the `marks` prop.
223
- * @default 1
224
- */
225
- step?: number | null;
226
- /**
227
- * The system prop that allows defining system overrides as well as additional CSS styles.
228
- */
229
- sx?: SxProps<Theme>;
230
- /**
231
- * Tab index attribute of the hidden `input` element.
232
- */
233
- tabIndex?: number;
234
- /**
235
- * The track presentation:
236
- *
237
- * - `normal` the track will render a bar representing the slider value.
238
- * - `inverted` the track will render a bar representing the remaining slider value.
239
- * - `false` the track will render without a bar.
240
- * @default 'normal'
241
- */
242
- track?: 'normal' | false | 'inverted';
243
- /**
244
- * The value of the slider.
245
- * For ranged sliders, provide an array with two values.
246
- */
247
- value?: number | number[];
248
- /**
249
- * Controls when the value label is displayed:
250
- *
251
- * - `auto` the value label will display when the thumb is hovered or focused.
252
- * - `on` will display persistently.
253
- * - `off` will never display.
254
- * @default 'off'
255
- */
256
- valueLabelDisplay?: 'on' | 'auto' | 'off';
257
- /**
258
- * The format function the value label's value.
259
- *
260
- * When a function is provided, it should have the following signature:
261
- *
262
- * - {number} value The value label's value to format
263
- * - {number} index The value label's index to format
264
- * @param {any} x
265
- * @returns {any}
266
- * @default function Identity(x) {
267
- * return x;
268
- * }
269
- */
270
- valueLabelFormat?: string | ((value: number, index: number) => React.ReactNode);
271
- };
272
- defaultComponent: DefaultComponent;
273
+ props: AdditionalProps & SliderOwnProps;
274
+ defaultComponent: RootComponent;
273
275
  }
274
276
 
275
277
  export interface SliderValueLabelProps extends React.HTMLAttributes<HTMLSpanElement> {