@mui/material 5.2.7 → 5.4.0

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 (152) hide show
  1. package/Autocomplete/Autocomplete.d.ts +7 -0
  2. package/Autocomplete/Autocomplete.js +22 -10
  3. package/Backdrop/Backdrop.js +3 -1
  4. package/Badge/Badge.js +6 -7
  5. package/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  6. package/Button/buttonClasses.d.ts +1 -1
  7. package/ButtonBase/TouchRipple.js +1 -2
  8. package/CHANGELOG.md +284 -33
  9. package/FilledInput/FilledInput.js +4 -1
  10. package/FormControlLabel/FormControlLabel.js +14 -4
  11. package/FormControlLabel/formControlLabelClasses.d.ts +2 -0
  12. package/FormControlLabel/formControlLabelClasses.js +1 -1
  13. package/FormGroup/FormGroup.js +14 -3
  14. package/FormGroup/formGroupClasses.d.ts +2 -0
  15. package/FormGroup/formGroupClasses.js +1 -1
  16. package/FormHelperText/FormHelperText.js +7 -9
  17. package/Grid/Grid.js +2 -4
  18. package/Input/Input.js +4 -1
  19. package/InputAdornment/InputAdornment.js +6 -9
  20. package/InputBase/InputBase.js +4 -1
  21. package/InputLabel/InputLabel.js +4 -0
  22. package/ListItem/ListItem.js +3 -1
  23. package/Modal/Modal.js +3 -1
  24. package/OutlinedInput/NotchedOutline.js +14 -16
  25. package/OutlinedInput/OutlinedInput.js +1 -1
  26. package/README.md +5 -4
  27. package/Radio/RadioButtonIcon.js +2 -6
  28. package/Select/Select.d.ts +9 -1
  29. package/Select/Select.js +10 -1
  30. package/Select/SelectInput.d.ts +1 -0
  31. package/Select/SelectInput.js +32 -13
  32. package/Slider/Slider.d.ts +2 -0
  33. package/Slider/Slider.js +126 -53
  34. package/StepLabel/StepLabel.js +3 -1
  35. package/SvgIcon/SvgIcon.js +9 -9
  36. package/SwipeableDrawer/SwipeArea.js +1 -3
  37. package/TextField/TextField.d.ts +1 -0
  38. package/TextField/TextField.js +2 -1
  39. package/Tooltip/Tooltip.js +6 -1
  40. package/index.d.ts +7 -2
  41. package/index.js +6 -3
  42. package/internal/SwitchBase.js +2 -6
  43. package/legacy/Autocomplete/Autocomplete.js +23 -10
  44. package/legacy/Backdrop/Backdrop.js +3 -1
  45. package/legacy/Badge/Badge.js +6 -7
  46. package/legacy/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  47. package/legacy/ButtonBase/TouchRipple.js +1 -2
  48. package/legacy/FilledInput/FilledInput.js +4 -1
  49. package/legacy/FormControlLabel/FormControlLabel.js +14 -4
  50. package/legacy/FormControlLabel/formControlLabelClasses.js +1 -1
  51. package/legacy/FormGroup/FormGroup.js +14 -3
  52. package/legacy/FormGroup/formGroupClasses.js +1 -1
  53. package/legacy/FormHelperText/FormHelperText.js +7 -9
  54. package/legacy/Grid/Grid.js +2 -4
  55. package/legacy/Input/Input.js +4 -1
  56. package/legacy/InputAdornment/InputAdornment.js +6 -9
  57. package/legacy/InputBase/InputBase.js +4 -1
  58. package/legacy/InputLabel/InputLabel.js +4 -0
  59. package/legacy/ListItem/ListItem.js +3 -1
  60. package/legacy/Modal/Modal.js +3 -1
  61. package/legacy/OutlinedInput/NotchedOutline.js +14 -16
  62. package/legacy/OutlinedInput/OutlinedInput.js +1 -1
  63. package/legacy/Radio/RadioButtonIcon.js +2 -6
  64. package/legacy/Select/Select.js +11 -1
  65. package/legacy/Select/SelectInput.js +36 -16
  66. package/legacy/Slider/Slider.js +127 -54
  67. package/legacy/StepLabel/StepLabel.js +3 -1
  68. package/legacy/SvgIcon/SvgIcon.js +9 -9
  69. package/legacy/SwipeableDrawer/SwipeArea.js +1 -3
  70. package/legacy/TextField/TextField.js +2 -1
  71. package/legacy/Tooltip/Tooltip.js +6 -1
  72. package/legacy/index.js +6 -3
  73. package/legacy/internal/SwitchBase.js +2 -6
  74. package/legacy/useMediaQuery/useMediaQuery.js +86 -31
  75. package/legacy/utils/shouldSpreadAdditionalProps.js +7 -0
  76. package/modern/Autocomplete/Autocomplete.js +21 -9
  77. package/modern/Backdrop/Backdrop.js +3 -1
  78. package/modern/Badge/Badge.js +6 -7
  79. package/modern/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  80. package/modern/ButtonBase/TouchRipple.js +1 -2
  81. package/modern/FilledInput/FilledInput.js +4 -1
  82. package/modern/FormControlLabel/FormControlLabel.js +14 -4
  83. package/modern/FormControlLabel/formControlLabelClasses.js +1 -1
  84. package/modern/FormGroup/FormGroup.js +14 -3
  85. package/modern/FormGroup/formGroupClasses.js +1 -1
  86. package/modern/FormHelperText/FormHelperText.js +7 -9
  87. package/modern/Grid/Grid.js +2 -4
  88. package/modern/Input/Input.js +4 -1
  89. package/modern/InputAdornment/InputAdornment.js +6 -9
  90. package/modern/InputBase/InputBase.js +4 -1
  91. package/modern/InputLabel/InputLabel.js +4 -0
  92. package/modern/ListItem/ListItem.js +3 -1
  93. package/modern/Modal/Modal.js +3 -1
  94. package/modern/OutlinedInput/NotchedOutline.js +14 -16
  95. package/modern/OutlinedInput/OutlinedInput.js +1 -1
  96. package/modern/Radio/RadioButtonIcon.js +2 -6
  97. package/modern/Select/Select.js +10 -1
  98. package/modern/Select/SelectInput.js +32 -13
  99. package/modern/Slider/Slider.js +126 -53
  100. package/modern/StepLabel/StepLabel.js +3 -1
  101. package/modern/SvgIcon/SvgIcon.js +8 -8
  102. package/modern/SwipeableDrawer/SwipeArea.js +1 -3
  103. package/modern/TextField/TextField.js +2 -1
  104. package/modern/Tooltip/Tooltip.js +6 -1
  105. package/modern/index.js +6 -3
  106. package/modern/internal/SwitchBase.js +2 -6
  107. package/modern/useMediaQuery/useMediaQuery.js +68 -26
  108. package/modern/utils/shouldSpreadAdditionalProps.js +7 -0
  109. package/node/Autocomplete/Autocomplete.js +22 -10
  110. package/node/Backdrop/Backdrop.js +3 -1
  111. package/node/Badge/Badge.js +8 -8
  112. package/node/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  113. package/node/ButtonBase/TouchRipple.js +1 -2
  114. package/node/FilledInput/FilledInput.js +4 -1
  115. package/node/FormControlLabel/FormControlLabel.js +15 -4
  116. package/node/FormControlLabel/formControlLabelClasses.js +1 -1
  117. package/node/FormGroup/FormGroup.js +15 -3
  118. package/node/FormGroup/formGroupClasses.js +1 -1
  119. package/node/FormHelperText/FormHelperText.js +6 -9
  120. package/node/Grid/Grid.js +2 -4
  121. package/node/Input/Input.js +4 -1
  122. package/node/InputAdornment/InputAdornment.js +5 -9
  123. package/node/InputBase/InputBase.js +4 -1
  124. package/node/InputLabel/InputLabel.js +4 -0
  125. package/node/ListItem/ListItem.js +3 -1
  126. package/node/Modal/Modal.js +3 -1
  127. package/node/OutlinedInput/NotchedOutline.js +12 -16
  128. package/node/OutlinedInput/OutlinedInput.js +1 -1
  129. package/node/Radio/RadioButtonIcon.js +2 -6
  130. package/node/Select/Select.js +10 -1
  131. package/node/Select/SelectInput.js +31 -13
  132. package/node/Slider/Slider.js +112 -45
  133. package/node/StepLabel/StepLabel.js +3 -1
  134. package/node/SvgIcon/SvgIcon.js +9 -9
  135. package/node/SwipeableDrawer/SwipeArea.js +1 -3
  136. package/node/TextField/TextField.js +2 -1
  137. package/node/Tooltip/Tooltip.js +6 -1
  138. package/node/index.js +41 -16
  139. package/node/internal/SwitchBase.js +2 -6
  140. package/node/useMediaQuery/useMediaQuery.js +68 -26
  141. package/node/utils/shouldSpreadAdditionalProps.js +15 -0
  142. package/package.json +7 -7
  143. package/styles/ThemeProvider.d.ts +1 -1
  144. package/styles/components.d.ts +452 -113
  145. package/styles/createTheme.d.ts +12 -6
  146. package/styles/overrides.d.ts +16 -4
  147. package/styles/useThemeProps.d.ts +2 -1
  148. package/umd/material-ui.development.js +2988 -4926
  149. package/umd/material-ui.production.min.js +21 -21
  150. package/useMediaQuery/useMediaQuery.d.ts +4 -0
  151. package/useMediaQuery/useMediaQuery.js +68 -26
  152. package/utils/shouldSpreadAdditionalProps.js +7 -0
@@ -1,7 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
4
- const _excluded = ["aria-describedby", "aria-label", "autoFocus", "autoWidth", "children", "className", "defaultValue", "disabled", "displayEmpty", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"];
4
+
5
+ var _span;
6
+
7
+ const _excluded = ["aria-describedby", "aria-label", "autoFocus", "autoWidth", "children", "className", "defaultOpen", "defaultValue", "disabled", "displayEmpty", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"];
5
8
  import * as React from 'react';
6
9
  import { isFragment } from 'react-is';
7
10
  import PropTypes from 'prop-types';
@@ -113,6 +116,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
113
116
  autoWidth,
114
117
  children,
115
118
  className,
119
+ defaultOpen,
116
120
  defaultValue,
117
121
  disabled,
118
122
  displayEmpty,
@@ -142,6 +146,11 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
142
146
  default: defaultValue,
143
147
  name: 'Select'
144
148
  });
149
+ const [openState, setOpenState] = useControlled({
150
+ controlled: openProp,
151
+ default: defaultOpen,
152
+ name: 'Select'
153
+ });
145
154
  const inputRef = React.useRef(null);
146
155
  const displayRef = React.useRef(null);
147
156
  const [displayNode, setDisplayNode] = React.useState(null);
@@ -149,7 +158,6 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
149
158
  current: isOpenControlled
150
159
  } = React.useRef(openProp != null);
151
160
  const [menuMinWidthState, setMenuMinWidthState] = React.useState();
152
- const [openState, setOpenState] = React.useState(false);
153
161
  const handleRef = useForkRef(ref, inputRefProp);
154
162
  const handleDisplayRef = React.useCallback(node => {
155
163
  displayRef.current = node;
@@ -164,7 +172,17 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
164
172
  },
165
173
  node: inputRef.current,
166
174
  value
167
- }), [value]);
175
+ }), [value]); // Resize menu on `defaultOpen` automatic toggle.
176
+
177
+ React.useEffect(() => {
178
+ if (defaultOpen && openState && displayNode && !isOpenControlled) {
179
+ setMenuMinWidthState(autoWidth ? null : displayNode.clientWidth);
180
+ displayRef.current.focus();
181
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
182
+
183
+ }, [displayNode, autoWidth]); // `isOpenControlled` is ignored because the component should never switch between controlled and uncontrolled modes.
184
+ // `defaultOpen` and `openState` are ignored to avoid unnecessary callbacks.
185
+
168
186
  React.useEffect(() => {
169
187
  if (autoFocus) {
170
188
  displayRef.current.focus();
@@ -300,7 +318,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
300
318
  }
301
319
  };
302
320
 
303
- const open = displayNode !== null && (isOpenControlled ? openProp : openState);
321
+ const open = displayNode !== null && openState;
304
322
 
305
323
  const handleBlur = event => {
306
324
  // if open event.stopImmediatePropagation
@@ -467,16 +485,11 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
467
485
  className: clsx(classes.select, className, SelectDisplayProps.className) // The id is required for proper a11y
468
486
  ,
469
487
  id: buttonId,
470
- children: isEmpty(display) ?
471
- /*#__PURE__*/
472
- // notranslate needed while Google Translate will not fix zero-width space issue
473
- // eslint-disable-next-line react/no-danger
474
- _jsx("span", {
488
+ children: isEmpty(display) ? // notranslate needed while Google Translate will not fix zero-width space issue
489
+ _span || (_span = /*#__PURE__*/_jsx("span", {
475
490
  className: "notranslate",
476
- dangerouslySetInnerHTML: {
477
- __html: '​'
478
- }
479
- }) : display
491
+ children: "\u200B"
492
+ })) : display
480
493
  })), /*#__PURE__*/_jsx(SelectNativeInput, _extends({
481
494
  value: Array.isArray(value) ? value.join(',') : value,
482
495
  name: name,
@@ -559,6 +572,12 @@ process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
559
572
  */
560
573
  className: PropTypes.string,
561
574
 
575
+ /**
576
+ * If `true`, the component is toggled on mount. Use when the component open state is not controlled.
577
+ * You can only use it when the `native` prop is `false` (default).
578
+ */
579
+ defaultOpen: PropTypes.bool,
580
+
562
581
  /**
563
582
  * The default value. Use when the component is not controlled.
564
583
  */
@@ -1,20 +1,21 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["components", "componentsProps", "color", "size"];
3
+ const _excluded = ["component", "components", "componentsProps", "color", "size"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
7
  import { chainPropTypes } from '@mui/utils';
8
- import { generateUtilityClasses, isHostComponent } from '@mui/base';
8
+ import { generateUtilityClasses } from '@mui/base';
9
9
  import SliderUnstyled, { SliderValueLabelUnstyled, sliderUnstyledClasses, getSliderUtilityClass } 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
+ import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
14
15
  import capitalize from '../utils/capitalize';
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
16
17
  export const sliderClasses = _extends({}, sliderUnstyledClasses, generateUtilityClasses('MuiSlider', ['colorPrimary', 'colorSecondary', 'thumbColorPrimary', 'thumbColorSecondary', 'sizeSmall', 'thumbSizeSmall']));
17
- export const SliderRoot = styled('span', {
18
+ const SliderRoot = styled('span', {
18
19
  name: 'MuiSlider',
19
20
  slot: 'Root',
20
21
  overridesResolver: (props, styles) => {
@@ -80,7 +81,21 @@ export const SliderRoot = styled('span', {
80
81
  }
81
82
  }
82
83
  }));
83
- export const SliderRail = styled('span', {
84
+ process.env.NODE_ENV !== "production" ? SliderRoot.propTypes
85
+ /* remove-proptypes */
86
+ = {
87
+ // ----------------------------- Warning --------------------------------
88
+ // | These PropTypes are generated from the TypeScript type definitions |
89
+ // | To update them edit the d.ts file and run "yarn proptypes" |
90
+ // ----------------------------------------------------------------------
91
+
92
+ /**
93
+ * @ignore
94
+ */
95
+ children: PropTypes.node
96
+ } : void 0;
97
+ export { SliderRoot };
98
+ const SliderRail = styled('span', {
84
99
  name: 'MuiSlider',
85
100
  slot: 'Rail',
86
101
  overridesResolver: (props, styles) => styles.rail
@@ -105,7 +120,21 @@ export const SliderRail = styled('span', {
105
120
  }, ownerState.track === 'inverted' && {
106
121
  opacity: 1
107
122
  }));
108
- export const SliderTrack = styled('span', {
123
+ process.env.NODE_ENV !== "production" ? SliderRail.propTypes
124
+ /* remove-proptypes */
125
+ = {
126
+ // ----------------------------- Warning --------------------------------
127
+ // | These PropTypes are generated from the TypeScript type definitions |
128
+ // | To update them edit the d.ts file and run "yarn proptypes" |
129
+ // ----------------------------------------------------------------------
130
+
131
+ /**
132
+ * @ignore
133
+ */
134
+ children: PropTypes.node
135
+ } : void 0;
136
+ export { SliderRail };
137
+ const SliderTrack = styled('span', {
109
138
  name: 'MuiSlider',
110
139
  slot: 'Track',
111
140
  overridesResolver: (props, styles) => styles.track
@@ -141,7 +170,21 @@ export const SliderTrack = styled('span', {
141
170
  borderColor: color
142
171
  });
143
172
  });
144
- export const SliderThumb = styled('span', {
173
+ process.env.NODE_ENV !== "production" ? SliderTrack.propTypes
174
+ /* remove-proptypes */
175
+ = {
176
+ // ----------------------------- Warning --------------------------------
177
+ // | These PropTypes are generated from the TypeScript type definitions |
178
+ // | To update them edit the d.ts file and run "yarn proptypes" |
179
+ // ----------------------------------------------------------------------
180
+
181
+ /**
182
+ * @ignore
183
+ */
184
+ children: PropTypes.node
185
+ } : void 0;
186
+ export { SliderTrack };
187
+ const SliderThumb = styled('span', {
145
188
  name: 'MuiSlider',
146
189
  slot: 'Thumb',
147
190
  overridesResolver: (props, styles) => {
@@ -213,7 +256,21 @@ export const SliderThumb = styled('span', {
213
256
  }
214
257
  }
215
258
  }));
216
- export const SliderValueLabel = styled(SliderValueLabelUnstyled, {
259
+ process.env.NODE_ENV !== "production" ? SliderThumb.propTypes
260
+ /* remove-proptypes */
261
+ = {
262
+ // ----------------------------- Warning --------------------------------
263
+ // | These PropTypes are generated from the TypeScript type definitions |
264
+ // | To update them edit the d.ts file and run "yarn proptypes" |
265
+ // ----------------------------------------------------------------------
266
+
267
+ /**
268
+ * @ignore
269
+ */
270
+ children: PropTypes.node
271
+ } : void 0;
272
+ export { SliderThumb };
273
+ const SliderValueLabel = styled(SliderValueLabelUnstyled, {
217
274
  name: 'MuiSlider',
218
275
  slot: 'ValueLabel',
219
276
  overridesResolver: (props, styles) => styles.valueLabel
@@ -257,7 +314,21 @@ export const SliderValueLabel = styled(SliderValueLabelUnstyled, {
257
314
  backgroundColor: 'inherit'
258
315
  }
259
316
  }));
260
- export const SliderMark = styled('span', {
317
+ process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes
318
+ /* remove-proptypes */
319
+ = {
320
+ // ----------------------------- Warning --------------------------------
321
+ // | These PropTypes are generated from the TypeScript type definitions |
322
+ // | To update them edit the d.ts file and run "yarn proptypes" |
323
+ // ----------------------------------------------------------------------
324
+
325
+ /**
326
+ * @ignore
327
+ */
328
+ children: PropTypes.node
329
+ } : void 0;
330
+ export { SliderValueLabel };
331
+ const SliderMark = styled('span', {
261
332
  name: 'MuiSlider',
262
333
  slot: 'Mark',
263
334
  shouldForwardProp: prop => slotShouldForwardProp(prop) && prop !== 'markActive',
@@ -282,7 +353,21 @@ export const SliderMark = styled('span', {
282
353
  backgroundColor: theme.palette.background.paper,
283
354
  opacity: 0.8
284
355
  }));
285
- export const SliderMarkLabel = styled('span', {
356
+ process.env.NODE_ENV !== "production" ? SliderMark.propTypes
357
+ /* remove-proptypes */
358
+ = {
359
+ // ----------------------------- Warning --------------------------------
360
+ // | These PropTypes are generated from the TypeScript type definitions |
361
+ // | To update them edit the d.ts file and run "yarn proptypes" |
362
+ // ----------------------------------------------------------------------
363
+
364
+ /**
365
+ * @ignore
366
+ */
367
+ children: PropTypes.node
368
+ } : void 0;
369
+ export { SliderMark };
370
+ const SliderMarkLabel = styled('span', {
286
371
  name: 'MuiSlider',
287
372
  slot: 'MarkLabel',
288
373
  shouldForwardProp: prop => slotShouldForwardProp(prop) && prop !== 'markLabelActive',
@@ -310,7 +395,9 @@ export const SliderMarkLabel = styled('span', {
310
395
  }, markLabelActive && {
311
396
  color: theme.palette.text.primary
312
397
  }));
313
- SliderRoot.propTypes = {
398
+ process.env.NODE_ENV !== "production" ? SliderMarkLabel.propTypes
399
+ /* remove-proptypes */
400
+ = {
314
401
  // ----------------------------- Warning --------------------------------
315
402
  // | These PropTypes are generated from the TypeScript type definitions |
316
403
  // | To update them edit the d.ts file and run "yarn proptypes" |
@@ -319,40 +406,9 @@ SliderRoot.propTypes = {
319
406
  /**
320
407
  * @ignore
321
408
  */
322
- children: PropTypes.node,
323
-
324
- /**
325
- * @ignore
326
- */
327
- ownerState: PropTypes.shape({
328
- 'aria-label': PropTypes.string,
329
- 'aria-labelledby': PropTypes.string,
330
- 'aria-valuetext': PropTypes.string,
331
- classes: PropTypes.object,
332
- color: PropTypes.oneOf(['primary', 'secondary']),
333
- defaultValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number]),
334
- disabled: PropTypes.bool,
335
- getAriaLabel: PropTypes.func,
336
- getAriaValueText: PropTypes.func,
337
- isRtl: PropTypes.bool,
338
- marks: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.shape({
339
- label: PropTypes.node,
340
- value: PropTypes.number.isRequired
341
- })), PropTypes.bool]),
342
- max: PropTypes.number,
343
- min: PropTypes.number,
344
- name: PropTypes.string,
345
- onChange: PropTypes.func,
346
- onChangeCommitted: PropTypes.func,
347
- orientation: PropTypes.oneOf(['horizontal', 'vertical']),
348
- scale: PropTypes.func,
349
- step: PropTypes.number,
350
- track: PropTypes.oneOf(['inverted', 'normal', false]),
351
- value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number]),
352
- valueLabelDisplay: PropTypes.oneOf(['auto', 'off', 'on']),
353
- valueLabelFormat: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
354
- })
355
- };
409
+ children: PropTypes.node
410
+ } : void 0;
411
+ export { SliderMarkLabel };
356
412
 
357
413
  const extendUtilityClasses = ownerState => {
358
414
  const {
@@ -366,10 +422,6 @@ const extendUtilityClasses = ownerState => {
366
422
  });
367
423
  };
368
424
 
369
- const shouldSpreadOwnerState = Component => {
370
- return !Component || !isHostComponent(Component);
371
- };
372
-
373
425
  const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
374
426
  const props = useThemeProps({
375
427
  props: inputProps,
@@ -379,6 +431,8 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
379
431
  const isRtl = theme.direction === 'rtl';
380
432
 
381
433
  const {
434
+ // eslint-disable-next-line react/prop-types
435
+ component = 'span',
382
436
  components = {},
383
437
  componentsProps = {},
384
438
  color = 'primary',
@@ -404,25 +458,26 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
404
458
  MarkLabel: SliderMarkLabel
405
459
  }, components),
406
460
  componentsProps: _extends({}, componentsProps, {
407
- root: _extends({}, componentsProps.root, shouldSpreadOwnerState(components.Root) && {
461
+ root: _extends({}, componentsProps.root, shouldSpreadAdditionalProps(components.Root) && {
462
+ as: component,
408
463
  ownerState: _extends({}, componentsProps.root?.ownerState, {
409
464
  color,
410
465
  size
411
466
  })
412
467
  }),
413
- thumb: _extends({}, componentsProps.thumb, shouldSpreadOwnerState(components.Thumb) && {
468
+ thumb: _extends({}, componentsProps.thumb, shouldSpreadAdditionalProps(components.Thumb) && {
414
469
  ownerState: _extends({}, componentsProps.thumb?.ownerState, {
415
470
  color,
416
471
  size
417
472
  })
418
473
  }),
419
- track: _extends({}, componentsProps.track, shouldSpreadOwnerState(components.Track) && {
474
+ track: _extends({}, componentsProps.track, shouldSpreadAdditionalProps(components.Track) && {
420
475
  ownerState: _extends({}, componentsProps.track?.ownerState, {
421
476
  color,
422
477
  size
423
478
  })
424
479
  }),
425
- valueLabel: _extends({}, componentsProps.valueLabel, shouldSpreadOwnerState(components.ValueLabel) && {
480
+ valueLabel: _extends({}, componentsProps.valueLabel, shouldSpreadAdditionalProps(components.ValueLabel) && {
426
481
  ownerState: _extends({}, componentsProps.valueLabel?.ownerState, {
427
482
  color,
428
483
  size
@@ -496,6 +551,7 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes
496
551
  * @default {}
497
552
  */
498
553
  components: PropTypes.shape({
554
+ Input: PropTypes.elementType,
499
555
  Mark: PropTypes.elementType,
500
556
  MarkLabel: PropTypes.elementType,
501
557
  Rail: PropTypes.elementType,
@@ -509,7 +565,24 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes
509
565
  * The props used for each slot inside the Slider.
510
566
  * @default {}
511
567
  */
512
- componentsProps: PropTypes.object,
568
+ componentsProps: PropTypes.shape({
569
+ input: PropTypes.object,
570
+ mark: PropTypes.object,
571
+ markLabel: PropTypes.object,
572
+ rail: PropTypes.object,
573
+ root: PropTypes.object,
574
+ thumb: PropTypes.object,
575
+ track: PropTypes.object,
576
+ valueLabel: PropTypes.shape({
577
+ className: PropTypes.string,
578
+ components: PropTypes.shape({
579
+ Root: PropTypes.elementType
580
+ }),
581
+ style: PropTypes.object,
582
+ value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number]),
583
+ valueLabelDisplay: PropTypes.oneOf(['auto', 'off', 'on'])
584
+ })
585
+ }),
513
586
 
514
587
  /**
515
588
  * The default value. Use when the component is not controlled.
@@ -205,7 +205,9 @@ process.env.NODE_ENV !== "production" ? StepLabel.propTypes
205
205
  * The props used for each slot inside.
206
206
  * @default {}
207
207
  */
208
- componentsProps: PropTypes.object,
208
+ componentsProps: PropTypes.shape({
209
+ label: PropTypes.object
210
+ }),
209
211
 
210
212
  /**
211
213
  * If `true`, the step is marked as failed.
@@ -43,19 +43,19 @@ const SvgIconRoot = styled('svg', {
43
43
  display: 'inline-block',
44
44
  fill: 'currentColor',
45
45
  flexShrink: 0,
46
- transition: theme.transitions.create('fill', {
47
- duration: theme.transitions.duration.shorter
46
+ transition: theme.transitions?.create?.('fill', {
47
+ duration: theme.transitions?.duration?.shorter
48
48
  }),
49
49
  fontSize: {
50
50
  inherit: 'inherit',
51
- small: theme.typography.pxToRem(20),
52
- medium: theme.typography.pxToRem(24),
53
- large: theme.typography.pxToRem(35)
51
+ small: theme.typography?.pxToRem?.(20) || '1.25rem',
52
+ medium: theme.typography?.pxToRem?.(24) || '1.5rem',
53
+ large: theme.typography?.pxToRem?.(35) || '2.1875'
54
54
  }[ownerState.fontSize],
55
55
  // TODO v5 deprecate, v6 remove for sx
56
- color: theme.palette[ownerState.color]?.main ?? {
57
- action: theme.palette.action.active,
58
- disabled: theme.palette.action.disabled,
56
+ color: theme.palette?.[ownerState.color]?.main ?? {
57
+ action: theme.palette?.action?.active,
58
+ disabled: theme.palette?.action?.disabled,
59
59
  inherit: undefined
60
60
  }[ownerState.color]
61
61
  }));
@@ -8,9 +8,7 @@ import styled from '../styles/styled';
8
8
  import capitalize from '../utils/capitalize';
9
9
  import { isHorizontal } from '../Drawer/Drawer';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
- const SwipeAreaRoot = styled('div', {
12
- skipSx: true
13
- })(({
11
+ const SwipeAreaRoot = styled('div')(({
14
12
  theme,
15
13
  ownerState
16
14
  }) => _extends({
@@ -191,7 +191,7 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
191
191
  variant: variant,
192
192
  ownerState: ownerState
193
193
  }, other, {
194
- children: [label && /*#__PURE__*/_jsx(InputLabel, _extends({
194
+ children: [label != null && label !== '' && /*#__PURE__*/_jsx(InputLabel, _extends({
195
195
  htmlFor: id,
196
196
  id: inputLabelId
197
197
  }, InputLabelProps, {
@@ -296,6 +296,7 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes
296
296
 
297
297
  /**
298
298
  * Props applied to the [`InputLabel`](/api/input-label/) element.
299
+ * Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
299
300
  */
300
301
  InputLabelProps: PropTypes.object,
301
302
 
@@ -673,7 +673,12 @@ process.env.NODE_ENV !== "production" ? Tooltip.propTypes
673
673
  * and `componentsProps.transition` prop values win over `TransitionProps` if both are applied.
674
674
  * @default {}
675
675
  */
676
- componentsProps: PropTypes.object,
676
+ componentsProps: PropTypes.shape({
677
+ arrow: PropTypes.object,
678
+ popper: PropTypes.object,
679
+ tooltip: PropTypes.object,
680
+ transition: PropTypes.object
681
+ }),
677
682
 
678
683
  /**
679
684
  * Set to `true` if the `title` acts as an accessible description.
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.2.7
1
+ /** @license MUI v5.4.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -8,7 +8,6 @@ import * as colors from './colors';
8
8
  export { colors };
9
9
  export * from './styles';
10
10
  export * from './utils';
11
- export * from '@mui/base';
12
11
  export { default as Accordion } from './Accordion';
13
12
  export * from './Accordion';
14
13
  export { default as AccordionActions } from './AccordionActions';
@@ -273,4 +272,8 @@ export * from './Zoom'; // createFilterOptions is exported from Autocomplete
273
272
  export { default as useAutocomplete } from './useAutocomplete';
274
273
  export { default as GlobalStyles } from './GlobalStyles';
275
274
  export * from './GlobalStyles';
276
- export { StyledEngineProvider } from './styles';
275
+ export { StyledEngineProvider } from './styles';
276
+ export { default as unstable_composeClasses } from '@mui/base/composeClasses';
277
+ export { default as generateUtilityClass } from '@mui/base/generateUtilityClass';
278
+ export * from '@mui/base/generateUtilityClass';
279
+ export { default as generateUtilityClasses } from '@mui/base/generateUtilityClasses';
@@ -29,9 +29,7 @@ const useUtilityClasses = ownerState => {
29
29
  return composeClasses(slots, getSwitchBaseUtilityClass, classes);
30
30
  };
31
31
 
32
- const SwitchBaseRoot = styled(ButtonBase, {
33
- skipSx: true
34
- })(({
32
+ const SwitchBaseRoot = styled(ButtonBase)(({
35
33
  ownerState
36
34
  }) => _extends({
37
35
  padding: 9,
@@ -41,9 +39,7 @@ const SwitchBaseRoot = styled(ButtonBase, {
41
39
  }, ownerState.edge === 'end' && {
42
40
  marginRight: ownerState.size === 'small' ? -3 : -12
43
41
  }));
44
- const SwitchBaseInput = styled('input', {
45
- skipSx: true
46
- })({
42
+ const SwitchBaseInput = styled('input')({
47
43
  cursor: 'inherit',
48
44
  position: 'absolute',
49
45
  opacity: 0,
@@ -5,32 +5,8 @@ import useEnhancedEffect from '../utils/useEnhancedEffect';
5
5
  * @deprecated Not used internally. Use `MediaQueryListEvent` from lib.dom.d.ts instead.
6
6
  */
7
7
 
8
- export default function useMediaQuery(queryInput, options = {}) {
9
- const theme = useTheme(); // Wait for jsdom to support the match media feature.
10
- // All the browsers MUI support have this built-in.
11
- // This defensive check is here for simplicity.
12
- // Most of the time, the match media logic isn't central to people tests.
13
-
8
+ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
14
9
  const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
15
- const {
16
- defaultMatches = false,
17
- matchMedia = supportMatchMedia ? window.matchMedia : null,
18
- noSsr = false,
19
- ssrMatchMedia = null
20
- } = getThemeProps({
21
- name: 'MuiUseMediaQuery',
22
- props: options,
23
- theme
24
- });
25
-
26
- if (process.env.NODE_ENV !== 'production') {
27
- if (typeof queryInput === 'function' && theme === null) {
28
- console.error(['MUI: The `query` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\n'));
29
- }
30
- }
31
-
32
- let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
33
- query = query.replace(/^@media( ?)/m, '');
34
10
  const [match, setMatch] = React.useState(() => {
35
11
  if (noSsr && supportMatchMedia) {
36
12
  return matchMedia(query).matches;
@@ -62,13 +38,79 @@ export default function useMediaQuery(queryInput, options = {}) {
62
38
  }
63
39
  };
64
40
 
65
- updateMatch();
41
+ updateMatch(); // TODO: Use `addEventListener` once support for Safari < 14 is dropped
42
+
66
43
  queryList.addListener(updateMatch);
67
44
  return () => {
68
45
  active = false;
69
46
  queryList.removeListener(updateMatch);
70
47
  };
71
48
  }, [query, matchMedia, supportMatchMedia]);
49
+ return match;
50
+ } // eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
51
+
52
+
53
+ const maybeReactUseSyncExternalStore = React['useSyncExternalStore' + ''];
54
+
55
+ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia) {
56
+ const getDefaultSnapshot = React.useCallback(() => defaultMatches, [defaultMatches]);
57
+ const getServerSnapshot = React.useMemo(() => {
58
+ if (ssrMatchMedia !== null) {
59
+ const {
60
+ matches
61
+ } = ssrMatchMedia(query);
62
+ return () => matches;
63
+ }
64
+
65
+ return getDefaultSnapshot;
66
+ }, [getDefaultSnapshot, query, ssrMatchMedia]);
67
+ const [getSnapshot, subscribe] = React.useMemo(() => {
68
+ if (matchMedia === null) {
69
+ return [getDefaultSnapshot, () => () => {}];
70
+ }
71
+
72
+ const mediaQueryList = matchMedia(query);
73
+ return [() => mediaQueryList.matches, notify => {
74
+ // TODO: Use `addEventListener` once support for Safari < 14 is dropped
75
+ mediaQueryList.addListener(notify);
76
+ return () => {
77
+ mediaQueryList.removeListener(notify);
78
+ };
79
+ }];
80
+ }, [getDefaultSnapshot, matchMedia, query]);
81
+ const match = maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
82
+ return match;
83
+ }
84
+
85
+ export default function useMediaQuery(queryInput, options = {}) {
86
+ const theme = useTheme(); // Wait for jsdom to support the match media feature.
87
+ // All the browsers MUI support have this built-in.
88
+ // This defensive check is here for simplicity.
89
+ // Most of the time, the match media logic isn't central to people tests.
90
+
91
+ const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
92
+ const {
93
+ defaultMatches = false,
94
+ matchMedia = supportMatchMedia ? window.matchMedia : null,
95
+ ssrMatchMedia = null,
96
+ noSsr
97
+ } = getThemeProps({
98
+ name: 'MuiUseMediaQuery',
99
+ props: options,
100
+ theme
101
+ });
102
+
103
+ if (process.env.NODE_ENV !== 'production') {
104
+ if (typeof queryInput === 'function' && theme === null) {
105
+ console.error(['MUI: The `query` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\n'));
106
+ }
107
+ }
108
+
109
+ let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
110
+ query = query.replace(/^@media( ?)/m, ''); // TODO: Drop `useMediaQueryOld` and use `use-sync-external-store` shim in `useMediaQueryNew` once the package is stable
111
+
112
+ const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
113
+ const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
72
114
 
73
115
  if (process.env.NODE_ENV !== 'production') {
74
116
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -0,0 +1,7 @@
1
+ import { isHostComponent } from '@mui/base';
2
+
3
+ const shouldSpreadAdditionalProps = Slot => {
4
+ return !Slot || !isHostComponent(Slot);
5
+ };
6
+
7
+ export default shouldSpreadAdditionalProps;