@mui/material 5.11.5 → 5.11.6

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 (188) hide show
  1. package/Accordion/accordionClasses.d.ts +18 -18
  2. package/AccordionActions/accordionActionsClasses.d.ts +10 -10
  3. package/AccordionDetails/accordionDetailsClasses.d.ts +8 -8
  4. package/AccordionSummary/accordionSummaryClasses.d.ts +22 -22
  5. package/Alert/alertClasses.d.ts +44 -44
  6. package/AlertTitle/alertTitleClasses.d.ts +8 -8
  7. package/AppBar/appBarClasses.d.ts +28 -28
  8. package/Autocomplete/autocompleteClasses.d.ts +54 -54
  9. package/Avatar/avatarClasses.d.ts +20 -20
  10. package/AvatarGroup/avatarGroupClasses.d.ts +10 -10
  11. package/Backdrop/backdropClasses.d.ts +10 -10
  12. package/Badge/badgeClasses.d.ts +56 -56
  13. package/BottomNavigation/BottomNavigation.js +0 -0
  14. package/BottomNavigation/bottomNavigationClasses.d.ts +8 -8
  15. package/BottomNavigationAction/bottomNavigationActionClasses.d.ts +14 -14
  16. package/Box/Box.d.ts +3 -2
  17. package/Breadcrumbs/breadcrumbsClasses.d.ts +14 -14
  18. package/Button/Button.js +0 -2
  19. package/Button/buttonClasses.d.ts +100 -100
  20. package/ButtonBase/buttonBaseClasses.d.ts +12 -12
  21. package/ButtonBase/touchRippleClasses.d.ts +20 -20
  22. package/ButtonGroup/ButtonGroupContext.d.ts +18 -18
  23. package/ButtonGroup/buttonGroupClasses.d.ts +58 -58
  24. package/CHANGELOG.md +74 -0
  25. package/Card/cardClasses.d.ts +8 -8
  26. package/CardActionArea/cardActionAreaClasses.d.ts +12 -12
  27. package/CardActions/cardActionsClasses.d.ts +10 -10
  28. package/CardContent/cardContentClasses.d.ts +8 -8
  29. package/CardHeader/cardHeaderClasses.d.ts +18 -18
  30. package/CardMedia/cardMediaClasses.d.ts +12 -12
  31. package/Checkbox/checkboxClasses.d.ts +18 -18
  32. package/Chip/chipClasses.d.ts +96 -96
  33. package/CircularProgress/circularProgressClasses.d.ts +26 -26
  34. package/ClickAwayListener/index.d.ts +2 -2
  35. package/Collapse/collapseClasses.d.ts +18 -18
  36. package/Container/containerClasses.d.ts +6 -6
  37. package/Dialog/DialogContext.d.ts +6 -6
  38. package/Dialog/dialogClasses.d.ts +36 -36
  39. package/DialogActions/dialogActionsClasses.d.ts +10 -10
  40. package/DialogContent/dialogContentClasses.d.ts +10 -10
  41. package/DialogContentText/dialogContentTextClasses.d.ts +8 -8
  42. package/DialogTitle/dialogTitleClasses.d.ts +8 -8
  43. package/Divider/dividerClasses.d.ts +34 -34
  44. package/Drawer/drawerClasses.d.ts +30 -30
  45. package/Fab/fabClasses.d.ts +26 -26
  46. package/FilledInput/filledInputClasses.d.ts +40 -40
  47. package/FormControl/FormControlContext.d.ts +17 -17
  48. package/FormControl/formControlClasses.d.ts +14 -14
  49. package/FormControl/useFormControl.d.ts +2 -2
  50. package/FormControlLabel/formControlLabelClasses.d.ts +20 -20
  51. package/FormGroup/formGroupClasses.d.ts +12 -12
  52. package/FormHelperText/formHelperTextClasses.d.ts +22 -22
  53. package/FormLabel/formLabelClasses.d.ts +22 -22
  54. package/Grid/gridClasses.d.ts +48 -48
  55. package/Icon/iconClasses.d.ts +24 -24
  56. package/IconButton/iconButtonClasses.d.ts +34 -34
  57. package/ImageList/imageListClasses.d.ts +16 -16
  58. package/ImageListItem/imageListItemClasses.d.ts +18 -18
  59. package/ImageListItemBar/imageListItemBarClasses.d.ts +30 -30
  60. package/Input/inputClasses.d.ts +34 -34
  61. package/InputAdornment/inputAdornmentClasses.d.ts +24 -24
  62. package/InputBase/inputBaseClasses.d.ts +46 -46
  63. package/InputLabel/inputLabelClasses.d.ts +32 -32
  64. package/LinearProgress/linearProgressClasses.d.ts +42 -42
  65. package/Link/getTextDecoration.d.ts +15 -15
  66. package/Link/linkClasses.d.ts +18 -18
  67. package/List/listClasses.d.ts +14 -14
  68. package/ListItem/listItemClasses.d.ts +30 -30
  69. package/ListItemAvatar/listItemAvatarClasses.d.ts +10 -10
  70. package/ListItemButton/listItemButtonClasses.d.ts +22 -22
  71. package/ListItemIcon/listItemIconClasses.d.ts +10 -10
  72. package/ListItemSecondaryAction/listItemSecondaryActionClasses.d.ts +10 -10
  73. package/ListItemText/listItemTextClasses.d.ts +18 -18
  74. package/ListSubheader/listSubheaderClasses.d.ts +18 -18
  75. package/Menu/menuClasses.d.ts +12 -12
  76. package/MenuItem/menuItemClasses.d.ts +20 -20
  77. package/MobileStepper/mobileStepperClasses.d.ts +22 -22
  78. package/NativeSelect/nativeSelectClasses.d.ts +32 -32
  79. package/OutlinedInput/outlinedInputClasses.d.ts +36 -36
  80. package/Pagination/paginationClasses.d.ts +14 -14
  81. package/PaginationItem/paginationItemClasses.d.ts +42 -42
  82. package/Paper/paperClasses.d.ts +39 -39
  83. package/Popover/popoverClasses.d.ts +10 -10
  84. package/Popper/Popper.d.ts +37 -37
  85. package/Radio/radioClasses.d.ts +16 -16
  86. package/RadioGroup/RadioGroupContext.d.ts +11 -11
  87. package/RadioGroup/useRadioGroup.d.ts +4 -4
  88. package/Rating/ratingClasses.d.ts +40 -40
  89. package/ScopedCssBaseline/scopedCssBaselineClasses.d.ts +8 -8
  90. package/Select/selectClasses.d.ts +30 -30
  91. package/Skeleton/skeletonClasses.d.ts +26 -26
  92. package/Slider/Slider.d.ts +215 -35
  93. package/Slider/Slider.js +7 -7
  94. package/Slider/SliderValueLabel.d.ts +15 -15
  95. package/Slider/SliderValueLabel.js +3 -0
  96. package/Slider/SliderValueLabel.types.d.ts +24 -24
  97. package/Slider/index.d.ts +2 -0
  98. package/Slider/index.js +2 -1
  99. package/Slider/sliderClasses.d.ts +58 -29
  100. package/Slider/sliderClasses.js +5 -3
  101. package/Snackbar/snackbarClasses.d.ts +20 -20
  102. package/SnackbarContent/snackbarContentClasses.d.ts +12 -12
  103. package/SpeedDial/speedDialClasses.d.ts +22 -22
  104. package/SpeedDialAction/speedDialActionClasses.d.ts +20 -20
  105. package/SpeedDialIcon/speedDialIconClasses.d.ts +18 -18
  106. package/Step/StepContext.d.ts +20 -20
  107. package/Step/stepClasses.d.ts +16 -16
  108. package/StepButton/stepButtonClasses.d.ts +14 -14
  109. package/StepConnector/stepConnectorClasses.d.ts +26 -26
  110. package/StepContent/stepContentClasses.d.ts +12 -12
  111. package/StepIcon/stepIconClasses.d.ts +16 -16
  112. package/StepLabel/stepLabelClasses.d.ts +28 -28
  113. package/Stepper/StepperContext.d.ts +18 -18
  114. package/Stepper/stepperClasses.d.ts +14 -14
  115. package/SvgIcon/svgIconClasses.d.ts +26 -26
  116. package/SwipeableDrawer/SwipeableDrawer.d.ts +15 -0
  117. package/SwipeableDrawer/SwipeableDrawer.js +48 -17
  118. package/Switch/switchClasses.d.ts +32 -32
  119. package/Tab/tabClasses.d.ts +26 -26
  120. package/TabScrollButton/tabScrollButtonClasses.d.ts +12 -12
  121. package/Table/tableClasses.d.ts +10 -10
  122. package/TableBody/tableBodyClasses.d.ts +8 -8
  123. package/TableCell/tableCellClasses.d.ts +32 -32
  124. package/TableContainer/tableContainerClasses.d.ts +8 -8
  125. package/TableFooter/tableFooterClasses.d.ts +8 -8
  126. package/TableHead/tableHeadClasses.d.ts +8 -8
  127. package/TablePagination/tablePaginationClasses.d.ts +28 -28
  128. package/TableRow/tableRowClasses.d.ts +16 -16
  129. package/TableSortLabel/tableSortLabelClasses.d.ts +16 -16
  130. package/Tabs/tabsClasses.d.ts +32 -32
  131. package/TextField/textFieldClasses.d.ts +8 -8
  132. package/ToggleButton/toggleButtonClasses.d.ts +24 -24
  133. package/ToggleButtonGroup/toggleButtonGroupClasses.d.ts +18 -18
  134. package/Toolbar/toolbarClasses.d.ts +14 -14
  135. package/Tooltip/tooltipClasses.d.ts +30 -30
  136. package/Typography/typographyClasses.d.ts +50 -50
  137. package/Unstable_Grid2/Grid2.d.ts +4 -4
  138. package/Unstable_Grid2/Grid2Props.d.ts +15 -15
  139. package/Unstable_Grid2/grid2Classes.d.ts +5 -5
  140. package/Unstable_Grid2/index.d.ts +4 -4
  141. package/className/index.d.ts +1 -1
  142. package/darkScrollbar/index.d.ts +28 -28
  143. package/generateUtilityClass/index.d.ts +2 -2
  144. package/generateUtilityClasses/index.d.ts +1 -1
  145. package/index.js +1 -1
  146. package/internal/switchBaseClasses.d.ts +12 -12
  147. package/legacy/BottomNavigation/BottomNavigation.js +0 -0
  148. package/legacy/Button/Button.js +0 -2
  149. package/legacy/Slider/Slider.js +7 -7
  150. package/legacy/Slider/SliderValueLabel.js +3 -0
  151. package/legacy/Slider/index.js +2 -1
  152. package/legacy/Slider/sliderClasses.js +5 -3
  153. package/legacy/SwipeableDrawer/SwipeableDrawer.js +50 -17
  154. package/legacy/index.js +1 -1
  155. package/locale/index.d.ts +75 -75
  156. package/modern/BottomNavigation/BottomNavigation.js +0 -0
  157. package/modern/Button/Button.js +0 -2
  158. package/modern/Slider/Slider.js +7 -7
  159. package/modern/Slider/SliderValueLabel.js +3 -0
  160. package/modern/Slider/index.js +2 -1
  161. package/modern/Slider/sliderClasses.js +5 -3
  162. package/modern/SwipeableDrawer/SwipeableDrawer.js +47 -17
  163. package/modern/index.js +1 -1
  164. package/node/BottomNavigation/BottomNavigation.js +0 -0
  165. package/node/Button/Button.js +0 -2
  166. package/node/Slider/Slider.js +6 -6
  167. package/node/Slider/SliderValueLabel.js +3 -0
  168. package/node/Slider/index.js +12 -2
  169. package/node/Slider/sliderClasses.js +6 -3
  170. package/node/SwipeableDrawer/SwipeableDrawer.js +48 -17
  171. package/node/index.js +1 -1
  172. package/package.json +3 -3
  173. package/styles/CssVarsProvider.d.ts +16 -16
  174. package/styles/excludeVariablesFromRoot.d.ts +5 -5
  175. package/styles/getOverlayAlpha.d.ts +2 -2
  176. package/transitions/index.d.ts +1 -1
  177. package/transitions/transition.d.ts +13 -13
  178. package/transitions/utils.d.ts +23 -23
  179. package/types/OverridableComponentAugmentation.d.ts +31 -31
  180. package/umd/material-ui.development.js +63 -33
  181. package/umd/material-ui.production.min.js +20 -20
  182. package/useMediaQuery/useMediaQuery.d.ts +31 -31
  183. package/useTouchRipple/index.d.ts +1 -1
  184. package/useTouchRipple/useTouchRipple.d.ts +28 -28
  185. package/utils/getScrollbarSize.d.ts +2 -2
  186. package/utils/ownerDocument.d.ts +2 -2
  187. package/utils/ownerWindow.d.ts +2 -2
  188. package/utils/setRef.d.ts +2 -2
@@ -1,24 +1,39 @@
1
1
  import * as React from 'react';
2
- import {
3
- ExtendSliderUnstyledTypeMap,
4
- ExtendSliderUnstyled,
5
- SliderUnstyledTypeMap,
6
- SliderValueLabelProps,
7
- } from '@mui/base/SliderUnstyled';
2
+ import { SlotComponentProps } from '@mui/base';
3
+ import { Mark } from '@mui/base/SliderUnstyled';
8
4
  import { SxProps } from '@mui/system';
9
5
  import { OverridableStringUnion } from '@mui/types';
10
6
  import { Theme } from '../styles';
11
- import { OverrideProps } from '../OverridableComponent';
7
+ import { OverrideProps, OverridableComponent } from '../OverridableComponent';
8
+ import SliderValueLabelComponent from './SliderValueLabel';
9
+ import { SliderClasses } from './sliderClasses';
12
10
 
13
11
  export interface SliderPropsColorOverrides {}
14
12
 
15
13
  export interface SliderPropsSizeOverrides {}
16
14
 
17
- export type SliderTypeMap<
18
- D extends React.ElementType = 'span',
19
- P = {},
20
- > = ExtendSliderUnstyledTypeMap<{
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 SliderTypeMap<D extends React.ElementType = 'span', P = {}> {
21
24
  props: P & {
25
+ /**
26
+ * The label of the slider.
27
+ */
28
+ 'aria-label'?: string;
29
+ /**
30
+ * The id of the element containing a label for the slider.
31
+ */
32
+ 'aria-labelledby'?: string;
33
+ /**
34
+ * A string value that provides a user-friendly name for the current value of the slider.
35
+ */
36
+ 'aria-valuetext'?: string;
22
37
  /**
23
38
  * The color of the component.
24
39
  * It supports both default and custom theme colors, which can be added as shown in the
@@ -53,38 +68,209 @@ export type SliderTypeMap<
53
68
  *
54
69
  * @default {}
55
70
  */
56
- componentsProps?: SliderUnstyledTypeMap['props']['slotProps'];
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
+ };
57
85
  /**
58
86
  * Override or extend the styles applied to the component.
59
87
  */
60
- classes?: SliderUnstyledTypeMap['props']['classes'] & {
61
- /** Class name applied to the root element if `color="primary"`. */
62
- colorPrimary?: string;
63
- /** Class name applied to the root element if `color="secondary"`. */
64
- colorSecondary?: string;
65
- /** Class name applied to the root element if `size="small"`. */
66
- sizeSmall?: string;
67
- /** Class name applied to the thumb element if `color="primary"`. */
68
- thumbColorPrimary?: string;
69
- /** Class name applied to the thumb element if `color="secondary"`. */
70
- thumbColorSecondary?: string;
71
- /** Class name applied to the thumb element if `size="small"`. */
72
- thumbSizeSmall?: string;
73
- };
88
+ classes?: Partial<SliderClasses>;
89
+ /**
90
+ * The default value. Use when the component is not controlled.
91
+ */
92
+ defaultValue?: number | number[];
93
+ /**
94
+ * If `true`, the component is disabled.
95
+ * @default false
96
+ */
97
+ disabled?: boolean;
98
+ /**
99
+ * If `true`, the active thumb doesn't swap when moving pointer over a thumb while dragging another thumb.
100
+ * @default false
101
+ */
102
+ disableSwap?: boolean;
103
+ /**
104
+ * Accepts a function which returns a string value that provides a user-friendly name for the thumb labels of the slider.
105
+ * This is important for screen reader users.
106
+ * @param {number} index The thumb label's index to format.
107
+ * @returns {string}
108
+ */
109
+ getAriaLabel?: (index: number) => string;
110
+ /**
111
+ * Accepts a function which returns a string value that provides a user-friendly name for the current value of the slider.
112
+ * This is important for screen reader users.
113
+ * @param {number} value The thumb label's value to format.
114
+ * @param {number} index The thumb label's index to format.
115
+ * @returns {string}
116
+ */
117
+ getAriaValueText?: (value: number, index: number) => string;
118
+ /**
119
+ * Marks indicate predetermined values to which the user can move the slider.
120
+ * If `true` the marks are spaced according the value of the `step` prop.
121
+ * If an array, it should contain objects with `value` and an optional `label` keys.
122
+ * @default false
123
+ */
124
+ marks?: boolean | Mark[];
125
+ /**
126
+ * The maximum allowed value of the slider.
127
+ * Should not be equal to min.
128
+ * @default 100
129
+ */
130
+ max?: number;
131
+ /**
132
+ * The minimum allowed value of the slider.
133
+ * Should not be equal to max.
134
+ * @default 0
135
+ */
136
+ min?: number;
137
+ /**
138
+ * Name attribute of the hidden `input` element.
139
+ */
140
+ name?: string;
141
+ /**
142
+ * Callback function that is fired when the slider's value changed.
143
+ *
144
+ * @param {Event} event The event source of the callback.
145
+ * You can pull out the new value by accessing `event.target.value` (any).
146
+ * **Warning**: This is a generic event not a change event.
147
+ * @param {number | number[]} value The new value.
148
+ * @param {number} activeThumb Index of the currently moved thumb.
149
+ */
150
+ onChange?: (event: Event, value: number | number[], activeThumb: number) => void;
151
+ /**
152
+ * Callback function that is fired when the `mouseup` is triggered.
153
+ *
154
+ * @param {React.SyntheticEvent | Event} event The event source of the callback. **Warning**: This is a generic event not a change event.
155
+ * @param {number | number[]} value The new value.
156
+ */
157
+ onChangeCommitted?: (event: React.SyntheticEvent | Event, value: number | number[]) => void;
158
+ /**
159
+ * The component orientation.
160
+ * @default 'horizontal'
161
+ */
162
+ orientation?: 'horizontal' | 'vertical';
163
+ /**
164
+ * A transformation function, to change the scale of the slider.
165
+ * @param {any} x
166
+ * @returns {any}
167
+ * @default function Identity(x) {
168
+ * return x;
169
+ * }
170
+ */
171
+ scale?: (value: number) => number;
74
172
  /**
75
173
  * The size of the slider.
76
174
  * @default 'medium'
77
175
  */
78
176
  size?: OverridableStringUnion<'small' | 'medium', SliderPropsSizeOverrides>;
177
+ /**
178
+ * The props used for each slot inside the Slider.
179
+ * @default {}
180
+ */
181
+ slotProps?: {
182
+ root?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
183
+ track?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
184
+ rail?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
185
+ thumb?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
186
+ mark?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
187
+ markLabel?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
188
+ valueLabel?: SlotComponentProps<
189
+ typeof SliderValueLabelComponent,
190
+ SliderComponentsPropsOverrides,
191
+ SliderOwnerState
192
+ >;
193
+ input?: SlotComponentProps<'input', SliderComponentsPropsOverrides, SliderOwnerState>;
194
+ };
195
+ /**
196
+ * The components used for each slot inside the Slider.
197
+ * Either a string to use a HTML element or a component.
198
+ * @default {}
199
+ */
200
+ slots?: {
201
+ root?: React.ElementType;
202
+ track?: React.ElementType;
203
+ rail?: React.ElementType;
204
+ thumb?: React.ElementType;
205
+ mark?: React.ElementType;
206
+ markLabel?: React.ElementType;
207
+ valueLabel?: React.ElementType;
208
+ input?: React.ElementType;
209
+ };
210
+ /**
211
+ * The granularity with which the slider can step through values. (A "discrete" slider.)
212
+ * The `min` prop serves as the origin for the valid values.
213
+ * We recommend (max - min) to be evenly divisible by the step.
214
+ *
215
+ * When step is `null`, the thumb can only be slid onto marks provided with the `marks` prop.
216
+ * @default 1
217
+ */
218
+ step?: number | null;
79
219
  /**
80
220
  * The system prop that allows defining system overrides as well as additional CSS styles.
81
221
  */
82
222
  sx?: SxProps<Theme>;
223
+ /**
224
+ * Tab index attribute of the hidden `input` element.
225
+ */
226
+ tabIndex?: number;
227
+ /**
228
+ * The track presentation:
229
+ *
230
+ * - `normal` the track will render a bar representing the slider value.
231
+ * - `inverted` the track will render a bar representing the remaining slider value.
232
+ * - `false` the track will render without a bar.
233
+ * @default 'normal'
234
+ */
235
+ track?: 'normal' | false | 'inverted';
236
+ /**
237
+ * The value of the slider.
238
+ * For ranged sliders, provide an array with two values.
239
+ */
240
+ value?: number | number[];
241
+ /**
242
+ * Controls when the value label is displayed:
243
+ *
244
+ * - `auto` the value label will display when the thumb is hovered or focused.
245
+ * - `on` will display persistently.
246
+ * - `off` will never display.
247
+ * @default 'off'
248
+ */
249
+ valueLabelDisplay?: 'on' | 'auto' | 'off';
250
+ /**
251
+ * The format function the value label's value.
252
+ *
253
+ * When a function is provided, it should have the following signature:
254
+ *
255
+ * - {number} value The value label's value to format
256
+ * - {number} index The value label's index to format
257
+ * @param {any} x
258
+ * @returns {any}
259
+ * @default function Identity(x) {
260
+ * return x;
261
+ * }
262
+ */
263
+ valueLabelFormat?: string | ((value: number, index: number) => React.ReactNode);
83
264
  };
84
265
  defaultComponent: D;
85
- }>;
266
+ }
86
267
 
87
- export { SliderValueLabelProps };
268
+ export interface SliderValueLabelProps extends React.HTMLAttributes<HTMLSpanElement> {
269
+ children: React.ReactElement;
270
+ index: number;
271
+ open: boolean;
272
+ value: number;
273
+ }
88
274
 
89
275
  type SliderRootProps = NonNullable<SliderTypeMap['props']['componentsProps']>['root'];
90
276
  type SliderMarkProps = NonNullable<SliderTypeMap['props']['componentsProps']>['mark'];
@@ -111,17 +297,11 @@ export declare const SliderValueLabel: React.FC<SliderValueLabelProps>;
111
297
  *
112
298
  * - [Slider API](https://mui.com/material-ui/api/slider/)
113
299
  */
114
- declare const Slider: ExtendSliderUnstyled<SliderTypeMap>;
115
-
116
- export type SliderClassKey = keyof NonNullable<SliderTypeMap['props']['classes']>;
300
+ declare const Slider: OverridableComponent<SliderTypeMap>;
117
301
 
118
302
  export type SliderProps<
119
303
  D extends React.ElementType = SliderTypeMap['defaultComponent'],
120
304
  P = {},
121
305
  > = OverrideProps<SliderTypeMap<D, P>, D>;
122
306
 
123
- export type SliderClasses = Record<SliderClassKey, string>;
124
-
125
- export declare const sliderClasses: SliderClasses;
126
-
127
307
  export default Slider;
package/Slider/Slider.js CHANGED
@@ -6,15 +6,15 @@ import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
7
  import { chainPropTypes } from '@mui/utils';
8
8
  import { isHostComponent, useSlotProps, unstable_composeClasses as composeClasses } from '@mui/base';
9
- import { useSlider, getSliderUtilityClass } from '@mui/base/SliderUnstyled';
9
+ import { useSlider } from '@mui/base/SliderUnstyled';
10
10
  import { alpha, lighten, darken } from '@mui/system';
11
11
  import useThemeProps from '../styles/useThemeProps';
12
12
  import styled, { slotShouldForwardProp } from '../styles/styled';
13
13
  import useTheme from '../styles/useTheme';
14
14
  import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
15
15
  import capitalize from '../utils/capitalize';
16
- import SliderValueLabelComponent from './SliderValueLabel';
17
- import sliderClasses from './sliderClasses';
16
+ import SliderValueLabel from './SliderValueLabel';
17
+ import sliderClasses, { getSliderUtilityClass } from './sliderClasses';
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
20
20
  const valueToPercent = (value, min, max) => (value - min) * 100 / (max - min);
@@ -261,7 +261,7 @@ process.env.NODE_ENV !== "production" ? SliderThumb.propTypes /* remove-proptype
261
261
  children: PropTypes.node
262
262
  } : void 0;
263
263
  export { SliderThumb };
264
- const SliderValueLabel = styled(SliderValueLabelComponent, {
264
+ const StyledSliderValueLabel = styled(SliderValueLabel, {
265
265
  name: 'MuiSlider',
266
266
  slot: 'ValueLabel',
267
267
  overridesResolver: (props, styles) => styles.valueLabel
@@ -319,7 +319,7 @@ const SliderValueLabel = styled(SliderValueLabelComponent, {
319
319
  fontSize: theme.typography.pxToRem(12),
320
320
  padding: '0.25rem 0.5rem'
321
321
  }));
322
- process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes /* remove-proptypes */ = {
322
+ process.env.NODE_ENV !== "production" ? StyledSliderValueLabel.propTypes /* remove-proptypes */ = {
323
323
  // ----------------------------- Warning --------------------------------
324
324
  // | These PropTypes are generated from the TypeScript type definitions |
325
325
  // | To update them edit the d.ts file and run "yarn proptypes" |
@@ -329,7 +329,7 @@ process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes /* remove-pro
329
329
  */
330
330
  children: PropTypes.node
331
331
  } : void 0;
332
- export { SliderValueLabel };
332
+ export { StyledSliderValueLabel as SliderValueLabel };
333
333
  const SliderMark = styled('span', {
334
334
  name: 'MuiSlider',
335
335
  slot: 'Mark',
@@ -523,7 +523,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
523
523
  const RailSlot = (_ref2 = (_slots$rail = slots == null ? void 0 : slots.rail) != null ? _slots$rail : components.Rail) != null ? _ref2 : SliderRail;
524
524
  const TrackSlot = (_ref3 = (_slots$track = slots == null ? void 0 : slots.track) != null ? _slots$track : components.Track) != null ? _ref3 : SliderTrack;
525
525
  const ThumbSlot = (_ref4 = (_slots$thumb = slots == null ? void 0 : slots.thumb) != null ? _slots$thumb : components.Thumb) != null ? _ref4 : SliderThumb;
526
- const ValueLabelSlot = (_ref5 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref5 : SliderValueLabel;
526
+ const ValueLabelSlot = (_ref5 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref5 : StyledSliderValueLabel;
527
527
  const MarkSlot = (_ref6 = (_slots$mark = slots == null ? void 0 : slots.mark) != null ? _slots$mark : components.Mark) != null ? _ref6 : SliderMark;
528
528
  const MarkLabelSlot = (_ref7 = (_slots$markLabel = slots == null ? void 0 : slots.markLabel) != null ? _slots$markLabel : components.MarkLabel) != null ? _ref7 : SliderMarkLabel;
529
529
  const InputSlot = (_ref8 = (_slots$input = slots == null ? void 0 : slots.input) != null ? _slots$input : components.Input) != null ? _ref8 : 'input';
@@ -1,15 +1,15 @@
1
- import * as React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { SliderValueLabelProps } from './SliderValueLabel.types';
4
- /**
5
- * @ignore - internal component.
6
- */
7
- declare function SliderValueLabel(props: SliderValueLabelProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
8
- declare namespace SliderValueLabel {
9
- var propTypes: {
10
- children: PropTypes.Validator<PropTypes.ReactElementLike>;
11
- className: PropTypes.Requireable<string>;
12
- value: PropTypes.Requireable<PropTypes.ReactNodeLike>;
13
- };
14
- }
15
- export default SliderValueLabel;
1
+ import * as React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { SliderValueLabelProps } from './SliderValueLabel.types';
4
+ /**
5
+ * @ignore - internal component.
6
+ */
7
+ declare function SliderValueLabel(props: SliderValueLabelProps): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
8
+ declare namespace SliderValueLabel {
9
+ var propTypes: {
10
+ children: PropTypes.Validator<PropTypes.ReactElementLike>;
11
+ className: PropTypes.Requireable<string>;
12
+ value: PropTypes.Requireable<PropTypes.ReactNodeLike>;
13
+ };
14
+ }
15
+ export default SliderValueLabel;
@@ -26,6 +26,9 @@ export default function SliderValueLabel(props) {
26
26
  value
27
27
  } = props;
28
28
  const classes = useValueLabelClasses(props);
29
+ if (!children) {
30
+ return null;
31
+ }
29
32
  return /*#__PURE__*/React.cloneElement(children, {
30
33
  className: clsx(children.props.className)
31
34
  }, /*#__PURE__*/_jsxs(React.Fragment, {
@@ -1,24 +1,24 @@
1
- /// <reference types="react" />
2
- export interface SliderValueLabelProps {
3
- children: React.ReactElement;
4
- className?: string;
5
- style?: React.CSSProperties;
6
- /**
7
- * If `true`, the value label is visible.
8
- */
9
- open: boolean;
10
- /**
11
- * The value of the slider.
12
- * For ranged sliders, provide an array with two values.
13
- */
14
- value: number;
15
- /**
16
- * Controls when the value label is displayed:
17
- *
18
- * - `auto` the value label will display when the thumb is hovered or focused.
19
- * - `on` will display persistently.
20
- * - `off` will never display.
21
- * @default 'off'
22
- */
23
- valueLabelDisplay?: 'on' | 'auto' | 'off';
24
- }
1
+ /// <reference types="react" />
2
+ export interface SliderValueLabelProps {
3
+ children?: React.ReactElement;
4
+ className?: string;
5
+ style?: React.CSSProperties;
6
+ /**
7
+ * If `true`, the value label is visible.
8
+ */
9
+ open: boolean;
10
+ /**
11
+ * The value of the slider.
12
+ * For ranged sliders, provide an array with two values.
13
+ */
14
+ value: number;
15
+ /**
16
+ * Controls when the value label is displayed:
17
+ *
18
+ * - `auto` the value label will display when the thumb is hovered or focused.
19
+ * - `on` will display persistently.
20
+ * - `off` will never display.
21
+ * @default 'off'
22
+ */
23
+ valueLabelDisplay?: 'on' | 'auto' | 'off';
24
+ }
package/Slider/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export { default } from './Slider';
2
2
  export * from './Slider';
3
+
3
4
  export { default as sliderClasses } from './sliderClasses';
5
+ export * from './sliderClasses';
package/Slider/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default } from './Slider';
2
2
  export * from './Slider';
3
- export { default as sliderClasses } from './sliderClasses';
3
+ export { default as sliderClasses } from './sliderClasses';
4
+ export * from './sliderClasses';
@@ -1,29 +1,58 @@
1
- declare const sliderClasses: {
2
- colorPrimary: string;
3
- colorSecondary: string;
4
- sizeSmall: string;
5
- thumbColorPrimary: string;
6
- thumbColorSecondary: string;
7
- thumbSizeSmall: string;
8
- root: string;
9
- marked: string;
10
- vertical: string;
11
- disabled: string;
12
- dragging: string;
13
- rail: string;
14
- track: string;
15
- trackFalse: string;
16
- trackInverted: string;
17
- thumb: string;
18
- active: string;
19
- focusVisible: string;
20
- valueLabel: string;
21
- valueLabelOpen: string;
22
- valueLabelCircle: string;
23
- valueLabelLabel: string;
24
- mark: string;
25
- markActive: string;
26
- markLabel: string;
27
- markLabelActive: string;
28
- };
29
- export default sliderClasses;
1
+ export interface SliderClasses {
2
+ /** Class name applied to the root element. */
3
+ root: string;
4
+ /** Class name applied to the root element if `color="primary"`. */
5
+ colorPrimary: string;
6
+ /** Class name applied to the root element if `color="secondary"`. */
7
+ colorSecondary: string;
8
+ /** Class name applied to the root element if `marks` is provided with at least one label. */
9
+ marked: string;
10
+ /** Class name applied to the root element if `orientation="vertical"`. */
11
+ vertical: string;
12
+ /** State class applied to the root and thumb element if `disabled={true}`. */
13
+ disabled: string;
14
+ /** State class applied to the root if a thumb is being dragged. */
15
+ dragging: string;
16
+ /** Class name applied to the rail element. */
17
+ rail: string;
18
+ /** Class name applied to the track element. */
19
+ track: string;
20
+ /** Class name applied to the root element if `track={false}`. */
21
+ trackFalse: string;
22
+ /** Class name applied to the root element if `track="inverted"`. */
23
+ trackInverted: string;
24
+ /** Class name applied to the thumb element. */
25
+ thumb: string;
26
+ /** State class applied to the thumb element if it's active. */
27
+ active: string;
28
+ /** State class applied to the thumb element if keyboard focused. */
29
+ focusVisible: string;
30
+ /** Class name applied to the mark element. */
31
+ mark: string;
32
+ /** Class name applied to the mark element if active (depending on the value). */
33
+ markActive: string;
34
+ /** Class name applied to the mark label element. */
35
+ markLabel: string;
36
+ /** Class name applied to the mark label element if active (depending on the value). */
37
+ markLabelActive: string;
38
+ /** Class name applied to the root element if `size="small"`. */
39
+ sizeSmall: string;
40
+ /** Class name applied to the thumb element if `color="primary"`. */
41
+ thumbColorPrimary: string;
42
+ /** Class name applied to the thumb element if `color="secondary"`. */
43
+ thumbColorSecondary: string;
44
+ /** Class name applied to the thumb element if `size="small"`. */
45
+ thumbSizeSmall: string;
46
+ /** Class name applied to the thumb label element. */
47
+ valueLabel: string;
48
+ /** Class name applied to the thumb label element if it's open. */
49
+ valueLabelOpen: string;
50
+ /** Class name applied to the thumb label's circle element. */
51
+ valueLabelCircle: string;
52
+ /** Class name applied to the thumb label's label element. */
53
+ valueLabelLabel: string;
54
+ }
55
+ export type SliderClassKey = keyof SliderClasses;
56
+ export declare function getSliderUtilityClass(slot: string): string;
57
+ declare const sliderClasses: SliderClasses;
58
+ export default sliderClasses;
@@ -1,5 +1,7 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
3
- import { sliderUnstyledClasses } from '@mui/base/SliderUnstyled';
4
- const sliderClasses = _extends({}, sliderUnstyledClasses, generateUtilityClasses('MuiSlider', ['colorPrimary', 'colorSecondary', 'thumbColorPrimary', 'thumbColorSecondary', 'sizeSmall', 'thumbSizeSmall']));
2
+ import generateUtilityClass from '../generateUtilityClass';
3
+ export function getSliderUtilityClass(slot) {
4
+ return generateUtilityClass('MuiSlider', slot);
5
+ }
6
+ const sliderClasses = generateUtilityClasses('MuiSlider', ['root', 'active', 'colorPrimary', 'colorSecondary', 'disabled', 'dragging', 'focusVisible', 'mark', 'markActive', 'marked', 'markLabel', 'markLabelActive', 'rail', 'sizeSmall', 'thumb', 'thumbColorPrimary', 'thumbColorSecondary', 'track', 'trackInverted', 'trackFalse', 'thumbSizeSmall', 'valueLabel', 'valueLabelOpen', 'valueLabelCircle', 'valueLabelLabel', 'vertical']);
5
7
  export default sliderClasses;
@@ -1,20 +1,20 @@
1
- export interface SnackbarClasses {
2
- /** Styles applied to the root element. */
3
- root: string;
4
- /** Styles applied to the root element if `anchorOrigin={{ 'top', 'center' }}`. */
5
- anchorOriginTopCenter: string;
6
- /** Styles applied to the root element if `anchorOrigin={{ 'bottom', 'center' }}`. */
7
- anchorOriginBottomCenter: string;
8
- /** Styles applied to the root element if `anchorOrigin={{ 'top', 'right' }}`. */
9
- anchorOriginTopRight: string;
10
- /** Styles applied to the root element if `anchorOrigin={{ 'bottom', 'right' }}`. */
11
- anchorOriginBottomRight: string;
12
- /** Styles applied to the root element if `anchorOrigin={{ 'top', 'left' }}`. */
13
- anchorOriginTopLeft: string;
14
- /** Styles applied to the root element if `anchorOrigin={{ 'bottom', 'left' }}`. */
15
- anchorOriginBottomLeft: string;
16
- }
17
- export type SnackbarClassKey = keyof SnackbarClasses;
18
- export declare function getSnackbarUtilityClass(slot: string): string;
19
- declare const snackbarClasses: SnackbarClasses;
20
- export default snackbarClasses;
1
+ export interface SnackbarClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ /** Styles applied to the root element if `anchorOrigin={{ 'top', 'center' }}`. */
5
+ anchorOriginTopCenter: string;
6
+ /** Styles applied to the root element if `anchorOrigin={{ 'bottom', 'center' }}`. */
7
+ anchorOriginBottomCenter: string;
8
+ /** Styles applied to the root element if `anchorOrigin={{ 'top', 'right' }}`. */
9
+ anchorOriginTopRight: string;
10
+ /** Styles applied to the root element if `anchorOrigin={{ 'bottom', 'right' }}`. */
11
+ anchorOriginBottomRight: string;
12
+ /** Styles applied to the root element if `anchorOrigin={{ 'top', 'left' }}`. */
13
+ anchorOriginTopLeft: string;
14
+ /** Styles applied to the root element if `anchorOrigin={{ 'bottom', 'left' }}`. */
15
+ anchorOriginBottomLeft: string;
16
+ }
17
+ export type SnackbarClassKey = keyof SnackbarClasses;
18
+ export declare function getSnackbarUtilityClass(slot: string): string;
19
+ declare const snackbarClasses: SnackbarClasses;
20
+ export default snackbarClasses;
@@ -1,12 +1,12 @@
1
- export interface SnackbarContentClasses {
2
- /** Styles applied to the root element. */
3
- root: string;
4
- /** Styles applied to the message wrapper element. */
5
- message: string;
6
- /** Styles applied to the action wrapper element if `action` is provided. */
7
- action: string;
8
- }
9
- export type SnackbarContentClassKey = keyof SnackbarContentClasses;
10
- export declare function getSnackbarContentUtilityClass(slot: string): string;
11
- declare const snackbarContentClasses: SnackbarContentClasses;
12
- export default snackbarContentClasses;
1
+ export interface SnackbarContentClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ /** Styles applied to the message wrapper element. */
5
+ message: string;
6
+ /** Styles applied to the action wrapper element if `action` is provided. */
7
+ action: string;
8
+ }
9
+ export type SnackbarContentClassKey = keyof SnackbarContentClasses;
10
+ export declare function getSnackbarContentUtilityClass(slot: string): string;
11
+ declare const snackbarContentClasses: SnackbarContentClasses;
12
+ export default snackbarContentClasses;