@mui/material 5.10.11 → 5.10.13

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 (127) hide show
  1. package/Alert/Alert.d.ts +34 -3
  2. package/Alert/Alert.js +46 -9
  3. package/Autocomplete/Autocomplete.d.ts +10 -0
  4. package/Autocomplete/Autocomplete.js +27 -11
  5. package/AvatarGroup/AvatarGroup.d.ts +18 -1
  6. package/AvatarGroup/AvatarGroup.js +25 -6
  7. package/Backdrop/Backdrop.d.ts +33 -3
  8. package/Backdrop/Backdrop.js +46 -11
  9. package/Badge/Badge.d.ts +11 -3
  10. package/Badge/Badge.js +11 -3
  11. package/ButtonBase/TouchRipple.js +1 -1
  12. package/CHANGELOG.md +134 -0
  13. package/Chip/Chip.js +8 -4
  14. package/FilledInput/FilledInput.js +48 -9
  15. package/FormControl/FormControl.js +29 -29
  16. package/FormControlLabel/FormControlLabel.d.ts +12 -0
  17. package/FormControlLabel/FormControlLabel.js +17 -5
  18. package/Input/Input.js +49 -10
  19. package/InputBase/InputBase.d.ts +34 -3
  20. package/InputBase/InputBase.js +45 -8
  21. package/ListItem/ListItem.d.ts +32 -3
  22. package/ListItem/ListItem.js +43 -11
  23. package/ListItemButton/ListItemButton.js +2 -2
  24. package/MenuItem/MenuItem.js +2 -2
  25. package/Modal/Modal.d.ts +11 -3
  26. package/Modal/Modal.js +11 -3
  27. package/NativeSelect/NativeSelectInput.js +11 -9
  28. package/OutlinedInput/OutlinedInput.js +26 -8
  29. package/PaginationItem/PaginationItem.d.ts +19 -7
  30. package/PaginationItem/PaginationItem.js +31 -22
  31. package/README.md +1 -0
  32. package/Radio/Radio.js +2 -1
  33. package/RadioGroup/RadioGroup.js +12 -12
  34. package/Select/Select.d.ts +3 -3
  35. package/Select/Select.js +3 -3
  36. package/Slider/Slider.d.ts +14 -2
  37. package/Slider/Slider.js +12 -3
  38. package/StepLabel/StepLabel.d.ts +11 -0
  39. package/StepLabel/StepLabel.js +15 -3
  40. package/SwipeableDrawer/SwipeableDrawer.js +10 -2
  41. package/Tooltip/Tooltip.d.ts +43 -6
  42. package/Tooltip/Tooltip.js +69 -32
  43. package/Unstable_Grid2/Grid2Props.d.ts +1 -1
  44. package/esm/Alert/Alert.js +46 -9
  45. package/esm/Autocomplete/Autocomplete.js +27 -11
  46. package/esm/AvatarGroup/AvatarGroup.js +25 -6
  47. package/esm/Backdrop/Backdrop.js +46 -11
  48. package/esm/Badge/Badge.js +11 -3
  49. package/esm/ButtonBase/TouchRipple.js +1 -1
  50. package/esm/Chip/Chip.js +8 -4
  51. package/esm/FilledInput/FilledInput.js +48 -9
  52. package/esm/FormControl/FormControl.js +29 -29
  53. package/esm/FormControlLabel/FormControlLabel.js +17 -5
  54. package/esm/Input/Input.js +49 -10
  55. package/esm/InputBase/InputBase.js +45 -8
  56. package/esm/ListItem/ListItem.js +43 -11
  57. package/esm/ListItemButton/ListItemButton.js +2 -2
  58. package/esm/MenuItem/MenuItem.js +2 -2
  59. package/esm/Modal/Modal.js +11 -3
  60. package/esm/NativeSelect/NativeSelectInput.js +11 -9
  61. package/esm/OutlinedInput/OutlinedInput.js +26 -8
  62. package/esm/PaginationItem/PaginationItem.js +31 -22
  63. package/esm/Radio/Radio.js +2 -1
  64. package/esm/RadioGroup/RadioGroup.js +12 -12
  65. package/esm/Select/Select.js +3 -3
  66. package/esm/Slider/Slider.js +12 -3
  67. package/esm/StepLabel/StepLabel.js +15 -3
  68. package/esm/SwipeableDrawer/SwipeableDrawer.js +9 -2
  69. package/esm/Tooltip/Tooltip.js +69 -32
  70. package/index.js +1 -1
  71. package/legacy/Alert/Alert.js +48 -9
  72. package/legacy/Autocomplete/Autocomplete.js +27 -10
  73. package/legacy/AvatarGroup/AvatarGroup.js +26 -6
  74. package/legacy/Backdrop/Backdrop.js +48 -11
  75. package/legacy/Badge/Badge.js +11 -3
  76. package/legacy/ButtonBase/TouchRipple.js +1 -1
  77. package/legacy/Chip/Chip.js +8 -4
  78. package/legacy/FilledInput/FilledInput.js +49 -9
  79. package/legacy/FormControl/FormControl.js +29 -29
  80. package/legacy/FormControlLabel/FormControlLabel.js +17 -4
  81. package/legacy/Input/Input.js +50 -10
  82. package/legacy/InputBase/InputBase.js +47 -8
  83. package/legacy/ListItem/ListItem.js +49 -13
  84. package/legacy/ListItemButton/ListItemButton.js +7 -5
  85. package/legacy/MenuItem/MenuItem.js +6 -4
  86. package/legacy/Modal/Modal.js +11 -3
  87. package/legacy/NativeSelect/NativeSelectInput.js +11 -9
  88. package/legacy/OutlinedInput/OutlinedInput.js +27 -8
  89. package/legacy/PaginationItem/PaginationItem.js +32 -22
  90. package/legacy/Radio/Radio.js +2 -1
  91. package/legacy/RadioGroup/RadioGroup.js +14 -14
  92. package/legacy/Select/Select.js +3 -3
  93. package/legacy/Slider/Slider.js +12 -3
  94. package/legacy/StepLabel/StepLabel.js +16 -3
  95. package/legacy/SwipeableDrawer/SwipeableDrawer.js +9 -2
  96. package/legacy/Tooltip/Tooltip.js +64 -23
  97. package/legacy/index.js +1 -1
  98. package/modern/Alert/Alert.js +45 -8
  99. package/modern/Autocomplete/Autocomplete.js +26 -10
  100. package/modern/AvatarGroup/AvatarGroup.js +24 -5
  101. package/modern/Backdrop/Backdrop.js +45 -10
  102. package/modern/Badge/Badge.js +11 -3
  103. package/modern/ButtonBase/TouchRipple.js +1 -1
  104. package/modern/Chip/Chip.js +8 -4
  105. package/modern/FilledInput/FilledInput.js +46 -9
  106. package/modern/FormControl/FormControl.js +29 -29
  107. package/modern/FormControlLabel/FormControlLabel.js +15 -5
  108. package/modern/Input/Input.js +47 -10
  109. package/modern/InputBase/InputBase.js +43 -8
  110. package/modern/ListItem/ListItem.js +43 -11
  111. package/modern/ListItemButton/ListItemButton.js +2 -2
  112. package/modern/MenuItem/MenuItem.js +2 -2
  113. package/modern/Modal/Modal.js +11 -3
  114. package/modern/NativeSelect/NativeSelectInput.js +11 -9
  115. package/modern/OutlinedInput/OutlinedInput.js +25 -7
  116. package/modern/PaginationItem/PaginationItem.js +31 -22
  117. package/modern/Radio/Radio.js +2 -1
  118. package/modern/RadioGroup/RadioGroup.js +12 -12
  119. package/modern/Select/Select.js +3 -3
  120. package/modern/Slider/Slider.js +12 -3
  121. package/modern/StepLabel/StepLabel.js +13 -3
  122. package/modern/SwipeableDrawer/SwipeableDrawer.js +9 -2
  123. package/modern/Tooltip/Tooltip.js +59 -18
  124. package/modern/index.js +1 -1
  125. package/package.json +4 -4
  126. package/umd/material-ui.development.js +617 -234
  127. package/umd/material-ui.production.min.js +20 -20
@@ -65,22 +65,22 @@ const RadioGroup = /*#__PURE__*/React.forwardRef(function RadioGroup(props, ref)
65
65
  }
66
66
  }), []);
67
67
  const handleRef = (0, _useForkRef.default)(ref, rootRef);
68
+ const name = (0, _useId.default)(nameProp);
69
+ const contextValue = React.useMemo(() => ({
70
+ name,
68
71
 
69
- const handleChange = event => {
70
- setValueState(event.target.value);
72
+ onChange(event) {
73
+ setValueState(event.target.value);
71
74
 
72
- if (onChange) {
73
- onChange(event, event.target.value);
74
- }
75
- };
75
+ if (onChange) {
76
+ onChange(event, event.target.value);
77
+ }
78
+ },
76
79
 
77
- const name = (0, _useId.default)(nameProp);
80
+ value
81
+ }), [name, onChange, setValueState, value]);
78
82
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioGroupContext.default.Provider, {
79
- value: {
80
- name,
81
- onChange: handleChange,
82
- value
83
- },
83
+ value: contextValue,
84
84
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormGroup.default, (0, _extends2.default)({
85
85
  role: "radiogroup",
86
86
  ref: handleRef
@@ -98,20 +98,20 @@ export interface SelectProps<T = unknown>
98
98
  *
99
99
  * @param {SelectChangeEvent<T>} event The event source of the callback.
100
100
  * You can pull out the new value by accessing `event.target.value` (any).
101
- * **Warning**: This is a generic event not a change event unless the change event is caused by browser autofill.
101
+ * **Warning**: This is a generic event, not a change event, unless the change event is caused by browser autofill.
102
102
  * @param {object} [child] The react element that was selected when `native` is `false` (default).
103
103
  */
104
104
  onChange?: SelectInputProps<T>['onChange'];
105
105
  /**
106
106
  * Callback fired when the component requests to be closed.
107
- * Use in controlled mode (see open).
107
+ * Use it in either controlled (see the `open` prop), or uncontrolled mode (to detect when the Select collapes).
108
108
  *
109
109
  * @param {object} event The event source of the callback.
110
110
  */
111
111
  onClose?: (event: React.SyntheticEvent) => void;
112
112
  /**
113
113
  * Callback fired when the component requests to be opened.
114
- * Use in controlled mode (see open).
114
+ * Use it in either controlled (see the `open` prop), or uncontrolled mode (to detect when the Select expands).
115
115
  *
116
116
  * @param {object} event The event source of the callback.
117
117
  */
package/Select/Select.js CHANGED
@@ -270,14 +270,14 @@ process.env.NODE_ENV !== "production" ? Select.propTypes
270
270
  *
271
271
  * @param {SelectChangeEvent<T>} event The event source of the callback.
272
272
  * You can pull out the new value by accessing `event.target.value` (any).
273
- * **Warning**: This is a generic event not a change event unless the change event is caused by browser autofill.
273
+ * **Warning**: This is a generic event, not a change event, unless the change event is caused by browser autofill.
274
274
  * @param {object} [child] The react element that was selected when `native` is `false` (default).
275
275
  */
276
276
  onChange: _propTypes.default.func,
277
277
 
278
278
  /**
279
279
  * Callback fired when the component requests to be closed.
280
- * Use in controlled mode (see open).
280
+ * Use it in either controlled (see the `open` prop), or uncontrolled mode (to detect when the Select collapes).
281
281
  *
282
282
  * @param {object} event The event source of the callback.
283
283
  */
@@ -285,7 +285,7 @@ process.env.NODE_ENV !== "production" ? Select.propTypes
285
285
 
286
286
  /**
287
287
  * Callback fired when the component requests to be opened.
288
- * Use in controlled mode (see open).
288
+ * Use it in either controlled (see the `open` prop), or uncontrolled mode (to detect when the Select expands).
289
289
  *
290
290
  * @param {object} event The event source of the callback.
291
291
  */
@@ -27,8 +27,11 @@ export type SliderTypeMap<
27
27
  */
28
28
  color?: OverridableStringUnion<'primary' | 'secondary', SliderPropsColorOverrides>;
29
29
  /**
30
- * The components used for each slot inside the Slider.
31
- * Either a string to use a HTML element or a component.
30
+ * The components used for each slot inside.
31
+ *
32
+ * This prop is an alias for the `slots` prop.
33
+ * It's recommended to use the `slots` prop instead.
34
+ *
32
35
  * @default {}
33
36
  */
34
37
  components?: {
@@ -41,6 +44,15 @@ export type SliderTypeMap<
41
44
  ValueLabel?: React.ElementType;
42
45
  Input?: React.ElementType;
43
46
  };
47
+ /**
48
+ * The extra props for the slot components.
49
+ * You can override the existing props or add new ones.
50
+ *
51
+ * This prop is an alias for the `slotProps` prop.
52
+ * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
53
+ *
54
+ * @default {}
55
+ */
44
56
  componentsProps?: SliderUnstyledTypeMap['props']['slotProps'];
45
57
  /**
46
58
  * Override or extend the styles applied to the component.
package/Slider/Slider.js CHANGED
@@ -609,8 +609,11 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes
609
609
  .oneOfType([_propTypes.default.oneOf(['primary', 'secondary']), _propTypes.default.string]),
610
610
 
611
611
  /**
612
- * The components used for each slot inside the Slider.
613
- * Either a string to use a HTML element or a component.
612
+ * The components used for each slot inside.
613
+ *
614
+ * This prop is an alias for the `slots` prop.
615
+ * It's recommended to use the `slots` prop instead.
616
+ *
614
617
  * @default {}
615
618
  */
616
619
  components: _propTypes.default.shape({
@@ -625,7 +628,13 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes
625
628
  }),
626
629
 
627
630
  /**
628
- * @ignore
631
+ * The extra props for the slot components.
632
+ * You can override the existing props or add new ones.
633
+ *
634
+ * This prop is an alias for the `slotProps` prop.
635
+ * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
636
+ *
637
+ * @default {}
629
638
  */
630
639
  componentsProps: _propTypes.default.shape({
631
640
  input: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
@@ -38,6 +38,17 @@ export interface StepLabelProps extends StandardProps<React.HTMLAttributes<HTMLD
38
38
  * The optional node to display.
39
39
  */
40
40
  optional?: React.ReactNode;
41
+ /**
42
+ * The props used for each slot inside.
43
+ * @default {}
44
+ */
45
+ slotProps?: {
46
+ /**
47
+ * Props applied to the label element.
48
+ * @default {}
49
+ */
50
+ label?: React.HTMLProps<HTMLSpanElement>;
51
+ };
41
52
  /**
42
53
  * The component to render in place of the [`StepIcon`](/material-ui/api/step-icon/).
43
54
  */
@@ -33,7 +33,7 @@ var _stepLabelClasses = _interopRequireWildcard(require("./stepLabelClasses"));
33
33
 
34
34
  var _jsxRuntime = require("react/jsx-runtime");
35
35
 
36
- const _excluded = ["children", "className", "componentsProps", "error", "icon", "optional", "StepIconComponent", "StepIconProps"];
36
+ const _excluded = ["children", "className", "componentsProps", "error", "icon", "optional", "slotProps", "StepIconComponent", "StepIconProps"];
37
37
 
38
38
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
39
 
@@ -135,6 +135,8 @@ const StepLabelLabelContainer = (0, _styled.default)('span', {
135
135
  }
136
136
  }));
137
137
  const StepLabel = /*#__PURE__*/React.forwardRef(function StepLabel(inProps, ref) {
138
+ var _slotProps$label;
139
+
138
140
  const props = (0, _useThemeProps.default)({
139
141
  props: inProps,
140
142
  name: 'MuiStepLabel'
@@ -146,6 +148,7 @@ const StepLabel = /*#__PURE__*/React.forwardRef(function StepLabel(inProps, ref)
146
148
  error = false,
147
149
  icon: iconProp,
148
150
  optional,
151
+ slotProps = {},
149
152
  StepIconComponent: StepIconComponentProp,
150
153
  StepIconProps
151
154
  } = props,
@@ -176,6 +179,7 @@ const StepLabel = /*#__PURE__*/React.forwardRef(function StepLabel(inProps, ref)
176
179
  orientation
177
180
  });
178
181
  const classes = useUtilityClasses(ownerState);
182
+ const labelSlotProps = (_slotProps$label = slotProps.label) != null ? _slotProps$label : componentsProps.label;
179
183
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StepLabelRoot, (0, _extends2.default)({
180
184
  className: (0, _clsx.default)(classes.root, className),
181
185
  ref: ref,
@@ -194,9 +198,9 @@ const StepLabel = /*#__PURE__*/React.forwardRef(function StepLabel(inProps, ref)
194
198
  className: classes.labelContainer,
195
199
  ownerState: ownerState,
196
200
  children: [children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StepLabelLabel, (0, _extends2.default)({
197
- className: classes.label,
198
201
  ownerState: ownerState
199
- }, componentsProps.label, {
202
+ }, labelSlotProps, {
203
+ className: (0, _clsx.default)(classes.label, labelSlotProps == null ? void 0 : labelSlotProps.className),
200
204
  children: children
201
205
  })) : null, optional]
202
206
  })]
@@ -249,6 +253,14 @@ process.env.NODE_ENV !== "production" ? StepLabel.propTypes
249
253
  */
250
254
  optional: _propTypes.default.node,
251
255
 
256
+ /**
257
+ * The props used for each slot inside.
258
+ * @default {}
259
+ */
260
+ slotProps: _propTypes.default.shape({
261
+ label: _propTypes.default.object
262
+ }),
263
+
252
264
  /**
253
265
  * The component to render in place of the [`StepIcon`](/material-ui/api/step-icon/).
254
266
  */
@@ -14,6 +14,8 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
14
14
 
15
15
  var React = _interopRequireWildcard(require("react"));
16
16
 
17
+ var _reactDom = require("react-dom");
18
+
17
19
  var _propTypes = _interopRequireDefault(require("prop-types"));
18
20
 
19
21
  var _utils = require("@mui/utils");
@@ -246,7 +248,9 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
246
248
 
247
249
  claimedSwipeInstance = null;
248
250
  touchDetected.current = false;
249
- setMaybeSwiping(false); // The swipe wasn't started.
251
+ (0, _reactDom.flushSync)(() => {
252
+ setMaybeSwiping(false);
253
+ }); // The swipe wasn't started.
250
254
 
251
255
  if (!swipeInstance.current.isSwiping) {
252
256
  swipeInstance.current.isSwiping = null;
@@ -448,7 +452,9 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
448
452
  claimedSwipeInstance = null;
449
453
  swipeInstance.current.startX = currentX;
450
454
  swipeInstance.current.startY = currentY;
451
- setMaybeSwiping(true);
455
+ (0, _reactDom.flushSync)(() => {
456
+ setMaybeSwiping(true);
457
+ });
452
458
 
453
459
  if (!open && paperRef.current) {
454
460
  // The ref may be null when a parent component updates while swiping.
@@ -504,6 +510,8 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
504
510
  BackdropProps: (0, _extends2.default)({}, BackdropProps, {
505
511
  ref: backdropRef
506
512
  })
513
+ }, variant === 'temporary' && {
514
+ keepMounted: true
507
515
  }, ModalPropsProp),
508
516
  hideBackdrop: hideBackdrop,
509
517
  PaperProps: (0, _extends2.default)({}, PaperProps, {
@@ -22,20 +22,26 @@ export interface TooltipProps extends StandardProps<React.HTMLAttributes<HTMLDiv
22
22
  */
23
23
  classes?: Partial<TooltipClasses>;
24
24
  /**
25
- * The components used for each slot inside the Tooltip.
26
- * Either a string to use a HTML element or a component.
25
+ * The components used for each slot inside.
26
+ *
27
+ * This prop is an alias for the `slots` prop.
28
+ * It's recommended to use the `slots` prop instead.
29
+ *
27
30
  * @default {}
28
31
  */
29
32
  components?: {
30
- Popper?: React.ElementType;
33
+ Popper?: React.ElementType<PopperProps>;
31
34
  Transition?: React.ElementType;
32
35
  Tooltip?: React.ElementType;
33
36
  Arrow?: React.ElementType;
34
37
  };
35
38
  /**
36
- * The props used for each slot inside the Tooltip.
37
- * Note that `componentsProps.popper` prop values win over `PopperProps`
38
- * and `componentsProps.transition` prop values win over `TransitionProps` if both are applied.
39
+ * The extra props for the slot components.
40
+ * You can override the existing props or add new ones.
41
+ *
42
+ * This prop is an alias for the `slotProps` prop.
43
+ * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
44
+ *
39
45
  * @default {}
40
46
  */
41
47
  componentsProps?: {
@@ -155,6 +161,37 @@ export interface TooltipProps extends StandardProps<React.HTMLAttributes<HTMLDiv
155
161
  * @default {}
156
162
  */
157
163
  PopperProps?: Partial<PopperProps>;
164
+ /**
165
+ * The extra props for the slot components.
166
+ * You can override the existing props or add new ones.
167
+ *
168
+ * This prop is an alias for the `componentsProps` prop, which will be deprecated in the future.
169
+ *
170
+ * @default {}
171
+ */
172
+ slotProps?: {
173
+ popper?: Partial<PopperProps> & TooltipComponentsPropsOverrides;
174
+ transition?: TransitionProps & TooltipComponentsPropsOverrides;
175
+ tooltip?: React.HTMLProps<HTMLDivElement> &
176
+ MUIStyledCommonProps &
177
+ TooltipComponentsPropsOverrides;
178
+ arrow?: React.HTMLProps<HTMLSpanElement> &
179
+ MUIStyledCommonProps &
180
+ TooltipComponentsPropsOverrides;
181
+ };
182
+ /**
183
+ * The components used for each slot inside.
184
+ *
185
+ * This prop is an alias for the `components` prop, which will be deprecated in the future.
186
+ *
187
+ * @default {}
188
+ */
189
+ slots?: {
190
+ popper?: React.ElementType<PopperProps>;
191
+ transition?: React.ElementType;
192
+ tooltip?: React.ElementType;
193
+ arrow?: React.ElementType;
194
+ };
158
195
  /**
159
196
  * The system prop that allows defining system overrides as well as additional CSS styles.
160
197
  */
@@ -50,7 +50,7 @@ var _tooltipClasses = _interopRequireWildcard(require("./tooltipClasses"));
50
50
 
51
51
  var _jsxRuntime = require("react/jsx-runtime");
52
52
 
53
- const _excluded = ["arrow", "children", "classes", "components", "componentsProps", "describeChild", "disableFocusListener", "disableHoverListener", "disableInteractive", "disableTouchListener", "enterDelay", "enterNextDelay", "enterTouchDelay", "followCursor", "id", "leaveDelay", "leaveTouchDelay", "onClose", "onOpen", "open", "placement", "PopperComponent", "PopperProps", "title", "TransitionComponent", "TransitionProps"];
53
+ const _excluded = ["arrow", "children", "classes", "components", "componentsProps", "describeChild", "disableFocusListener", "disableHoverListener", "disableInteractive", "disableTouchListener", "enterDelay", "enterNextDelay", "enterTouchDelay", "followCursor", "id", "leaveDelay", "leaveTouchDelay", "onClose", "onOpen", "open", "placement", "PopperComponent", "PopperProps", "slotProps", "slots", "title", "TransitionComponent", "TransitionProps"];
54
54
 
55
55
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
56
56
 
@@ -250,7 +250,7 @@ function composeEventHandler(handler, eventHandler) {
250
250
 
251
251
 
252
252
  const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
253
- var _components$Popper, _ref, _components$Transitio, _components$Tooltip, _components$Arrow, _componentsProps$popp;
253
+ var _ref, _slots$popper, _ref2, _ref3, _slots$transition, _ref4, _slots$tooltip, _ref5, _slots$arrow, _slotProps$popper, _ref6, _slotProps$popper2, _slotProps$transition, _slotProps$tooltip, _ref7, _slotProps$tooltip2, _slotProps$arrow, _ref8, _slotProps$arrow2;
254
254
 
255
255
  const props = (0, _useThemeProps.default)({
256
256
  props: inProps,
@@ -279,6 +279,8 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
279
279
  placement = 'bottom',
280
280
  PopperComponent: PopperComponentProp,
281
281
  PopperProps = {},
282
+ slotProps = {},
283
+ slots = {},
282
284
  title,
283
285
  TransitionComponent: TransitionComponentProp = _Grow.default,
284
286
  TransitionProps
@@ -496,7 +498,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
496
498
  }, [handleClose, open]);
497
499
  const handleRef = (0, _useForkRef.default)(children.ref, focusVisibleRef, setChildNode, ref); // There is no point in displaying an empty tooltip.
498
500
 
499
- if (typeof title !== 'number' && !title) {
501
+ if (!title && title !== 0) {
500
502
  open = false;
501
503
  }
502
504
 
@@ -614,14 +616,20 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
614
616
  touch: ignoreNonTouchEvents.current
615
617
  });
616
618
  const classes = useUtilityClasses(ownerState);
617
- const PopperComponent = (_components$Popper = components.Popper) != null ? _components$Popper : TooltipPopper;
618
- const TransitionComponent = (_ref = (_components$Transitio = components.Transition) != null ? _components$Transitio : TransitionComponentProp) != null ? _ref : _Grow.default;
619
- const TooltipComponent = (_components$Tooltip = components.Tooltip) != null ? _components$Tooltip : TooltipTooltip;
620
- const ArrowComponent = (_components$Arrow = components.Arrow) != null ? _components$Arrow : TooltipArrow;
621
- const popperProps = (0, _base.appendOwnerState)(PopperComponent, (0, _extends2.default)({}, PopperProps, componentsProps.popper), ownerState);
622
- const transitionProps = (0, _base.appendOwnerState)(TransitionComponent, (0, _extends2.default)({}, TransitionProps, componentsProps.transition), ownerState);
623
- const tooltipProps = (0, _base.appendOwnerState)(TooltipComponent, (0, _extends2.default)({}, componentsProps.tooltip), ownerState);
624
- const tooltipArrowProps = (0, _base.appendOwnerState)(ArrowComponent, (0, _extends2.default)({}, componentsProps.arrow), ownerState);
619
+ const PopperComponent = (_ref = (_slots$popper = slots.popper) != null ? _slots$popper : components.Popper) != null ? _ref : TooltipPopper;
620
+ const TransitionComponent = (_ref2 = (_ref3 = (_slots$transition = slots.transition) != null ? _slots$transition : components.Transition) != null ? _ref3 : TransitionComponentProp) != null ? _ref2 : _Grow.default;
621
+ const TooltipComponent = (_ref4 = (_slots$tooltip = slots.tooltip) != null ? _slots$tooltip : components.Tooltip) != null ? _ref4 : TooltipTooltip;
622
+ const ArrowComponent = (_ref5 = (_slots$arrow = slots.arrow) != null ? _slots$arrow : components.Arrow) != null ? _ref5 : TooltipArrow;
623
+ const popperProps = (0, _base.appendOwnerState)(PopperComponent, (0, _extends2.default)({}, PopperProps, (_slotProps$popper = slotProps.popper) != null ? _slotProps$popper : componentsProps.popper, {
624
+ className: (0, _clsx.default)(classes.popper, PopperProps == null ? void 0 : PopperProps.className, (_ref6 = (_slotProps$popper2 = slotProps.popper) != null ? _slotProps$popper2 : componentsProps.popper) == null ? void 0 : _ref6.className)
625
+ }), ownerState);
626
+ const transitionProps = (0, _base.appendOwnerState)(TransitionComponent, (0, _extends2.default)({}, TransitionProps, (_slotProps$transition = slotProps.transition) != null ? _slotProps$transition : componentsProps.transition), ownerState);
627
+ const tooltipProps = (0, _base.appendOwnerState)(TooltipComponent, (0, _extends2.default)({}, (_slotProps$tooltip = slotProps.tooltip) != null ? _slotProps$tooltip : componentsProps.tooltip, {
628
+ className: (0, _clsx.default)(classes.tooltip, (_ref7 = (_slotProps$tooltip2 = slotProps.tooltip) != null ? _slotProps$tooltip2 : componentsProps.tooltip) == null ? void 0 : _ref7.className)
629
+ }), ownerState);
630
+ const tooltipArrowProps = (0, _base.appendOwnerState)(ArrowComponent, (0, _extends2.default)({}, (_slotProps$arrow = slotProps.arrow) != null ? _slotProps$arrow : componentsProps.arrow, {
631
+ className: (0, _clsx.default)(classes.arrow, (_ref8 = (_slotProps$arrow2 = slotProps.arrow) != null ? _slotProps$arrow2 : componentsProps.arrow) == null ? void 0 : _ref8.className)
632
+ }), ownerState);
625
633
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
626
634
  children: [/*#__PURE__*/React.cloneElement(children, childrenProps), /*#__PURE__*/(0, _jsxRuntime.jsx)(PopperComponent, (0, _extends2.default)({
627
635
  as: PopperComponentProp != null ? PopperComponentProp : _Popper.default,
@@ -641,25 +649,19 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
641
649
  id: id,
642
650
  transition: true
643
651
  }, interactiveWrapperListeners, popperProps, {
644
- className: (0, _clsx.default)(classes.popper, PopperProps == null ? void 0 : PopperProps.className, (_componentsProps$popp = componentsProps.popper) == null ? void 0 : _componentsProps$popp.className),
645
652
  popperOptions: popperOptions,
646
653
  children: ({
647
654
  TransitionProps: TransitionPropsInner
648
- }) => {
649
- var _componentsProps$tool, _componentsProps$arro;
650
-
651
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionComponent, (0, _extends2.default)({
652
- timeout: theme.transitions.duration.shorter
653
- }, TransitionPropsInner, transitionProps, {
654
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(TooltipComponent, (0, _extends2.default)({}, tooltipProps, {
655
- className: (0, _clsx.default)(classes.tooltip, (_componentsProps$tool = componentsProps.tooltip) == null ? void 0 : _componentsProps$tool.className),
656
- children: [title, arrow ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ArrowComponent, (0, _extends2.default)({}, tooltipArrowProps, {
657
- className: (0, _clsx.default)(classes.arrow, (_componentsProps$arro = componentsProps.arrow) == null ? void 0 : _componentsProps$arro.className),
658
- ref: setArrowRef
659
- })) : null]
660
- }))
661
- }));
662
- }
655
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionComponent, (0, _extends2.default)({
656
+ timeout: theme.transitions.duration.shorter
657
+ }, TransitionPropsInner, transitionProps, {
658
+ "data-foo": "bar",
659
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(TooltipComponent, (0, _extends2.default)({}, tooltipProps, {
660
+ children: [title, arrow ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ArrowComponent, (0, _extends2.default)({}, tooltipArrowProps, {
661
+ ref: setArrowRef
662
+ })) : null]
663
+ }))
664
+ }))
663
665
  }))]
664
666
  });
665
667
  });
@@ -693,8 +695,11 @@ process.env.NODE_ENV !== "production" ? Tooltip.propTypes
693
695
  className: _propTypes.default.string,
694
696
 
695
697
  /**
696
- * The components used for each slot inside the Tooltip.
697
- * Either a string to use a HTML element or a component.
698
+ * The components used for each slot inside.
699
+ *
700
+ * This prop is an alias for the `slots` prop.
701
+ * It's recommended to use the `slots` prop instead.
702
+ *
698
703
  * @default {}
699
704
  */
700
705
  components: _propTypes.default.shape({
@@ -705,9 +710,12 @@ process.env.NODE_ENV !== "production" ? Tooltip.propTypes
705
710
  }),
706
711
 
707
712
  /**
708
- * The props used for each slot inside the Tooltip.
709
- * Note that `componentsProps.popper` prop values win over `PopperProps`
710
- * and `componentsProps.transition` prop values win over `TransitionProps` if both are applied.
713
+ * The extra props for the slot components.
714
+ * You can override the existing props or add new ones.
715
+ *
716
+ * This prop is an alias for the `slotProps` prop.
717
+ * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
718
+ *
711
719
  * @default {}
712
720
  */
713
721
  componentsProps: _propTypes.default.shape({
@@ -830,6 +838,35 @@ process.env.NODE_ENV !== "production" ? Tooltip.propTypes
830
838
  */
831
839
  PopperProps: _propTypes.default.object,
832
840
 
841
+ /**
842
+ * The extra props for the slot components.
843
+ * You can override the existing props or add new ones.
844
+ *
845
+ * This prop is an alias for the `componentsProps` prop, which will be deprecated in the future.
846
+ *
847
+ * @default {}
848
+ */
849
+ slotProps: _propTypes.default.shape({
850
+ arrow: _propTypes.default.object,
851
+ popper: _propTypes.default.object,
852
+ tooltip: _propTypes.default.object,
853
+ transition: _propTypes.default.object
854
+ }),
855
+
856
+ /**
857
+ * The components used for each slot inside.
858
+ *
859
+ * This prop is an alias for the `components` prop, which will be deprecated in the future.
860
+ *
861
+ * @default {}
862
+ */
863
+ slots: _propTypes.default.shape({
864
+ arrow: _propTypes.default.elementType,
865
+ popper: _propTypes.default.elementType,
866
+ tooltip: _propTypes.default.elementType,
867
+ transition: _propTypes.default.elementType
868
+ }),
869
+
833
870
  /**
834
871
  * The system prop that allows defining system overrides as well as additional CSS styles.
835
872
  */
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  import { OverrideProps } from '@mui/types';
3
3
  import { SxProps, SystemProps } from '@mui/system';
4
4
  import { GridBaseProps } from '@mui/system/Unstable_Grid';
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["action", "children", "className", "closeText", "color", "components", "componentsProps", "icon", "iconMapping", "onClose", "role", "severity", "variant"];
3
+ const _excluded = ["action", "children", "className", "closeText", "color", "components", "componentsProps", "icon", "iconMapping", "onClose", "role", "severity", "slotProps", "slots", "variant"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -128,7 +128,7 @@ const defaultIconMapping = {
128
128
  })
129
129
  };
130
130
  const Alert = /*#__PURE__*/React.forwardRef(function Alert(inProps, ref) {
131
- var _components$CloseButt, _components$CloseIcon;
131
+ var _ref, _slots$closeButton, _ref2, _slots$closeIcon, _slotProps$closeButto, _slotProps$closeIcon;
132
132
 
133
133
  const props = useThemeProps({
134
134
  props: inProps,
@@ -148,6 +148,8 @@ const Alert = /*#__PURE__*/React.forwardRef(function Alert(inProps, ref) {
148
148
  onClose,
149
149
  role = 'alert',
150
150
  severity = 'success',
151
+ slotProps = {},
152
+ slots = {},
151
153
  variant = 'standard'
152
154
  } = props,
153
155
  other = _objectWithoutPropertiesLoose(props, _excluded);
@@ -159,8 +161,10 @@ const Alert = /*#__PURE__*/React.forwardRef(function Alert(inProps, ref) {
159
161
  });
160
162
 
161
163
  const classes = useUtilityClasses(ownerState);
162
- const AlertCloseButton = (_components$CloseButt = components.CloseButton) != null ? _components$CloseButt : IconButton;
163
- const AlertCloseIcon = (_components$CloseIcon = components.CloseIcon) != null ? _components$CloseIcon : CloseIcon;
164
+ const AlertCloseButton = (_ref = (_slots$closeButton = slots.closeButton) != null ? _slots$closeButton : components.CloseButton) != null ? _ref : IconButton;
165
+ const AlertCloseIcon = (_ref2 = (_slots$closeIcon = slots.closeIcon) != null ? _slots$closeIcon : components.CloseIcon) != null ? _ref2 : CloseIcon;
166
+ const closeButtonProps = (_slotProps$closeButto = slotProps.closeButton) != null ? _slotProps$closeButto : componentsProps.closeButton;
167
+ const closeIconProps = (_slotProps$closeIcon = slotProps.closeIcon) != null ? _slotProps$closeIcon : componentsProps.closeIcon;
164
168
  return /*#__PURE__*/_jsxs(AlertRoot, _extends({
165
169
  role: role,
166
170
  elevation: 0,
@@ -189,10 +193,10 @@ const Alert = /*#__PURE__*/React.forwardRef(function Alert(inProps, ref) {
189
193
  title: closeText,
190
194
  color: "inherit",
191
195
  onClick: onClose
192
- }, componentsProps.closeButton, {
196
+ }, closeButtonProps, {
193
197
  children: /*#__PURE__*/_jsx(AlertCloseIcon, _extends({
194
198
  fontSize: "small"
195
- }, componentsProps.closeIcon))
199
+ }, closeIconProps))
196
200
  }))
197
201
  }) : null]
198
202
  }));
@@ -243,8 +247,11 @@ process.env.NODE_ENV !== "production" ? Alert.propTypes
243
247
  .oneOfType([PropTypes.oneOf(['error', 'info', 'success', 'warning']), PropTypes.string]),
244
248
 
245
249
  /**
246
- * The components used for each slot inside the Alert.
247
- * Either a string to use a HTML element or a component.
250
+ * The components used for each slot inside.
251
+ *
252
+ * This prop is an alias for the `slots` prop.
253
+ * It's recommended to use the `slots` prop instead.
254
+ *
248
255
  * @default {}
249
256
  */
250
257
  components: PropTypes.shape({
@@ -253,7 +260,12 @@ process.env.NODE_ENV !== "production" ? Alert.propTypes
253
260
  }),
254
261
 
255
262
  /**
256
- * The props used for each slot inside.
263
+ * The extra props for the slot components.
264
+ * You can override the existing props or add new ones.
265
+ *
266
+ * This prop is an alias for the `slotProps` prop.
267
+ * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
268
+ *
257
269
  * @default {}
258
270
  */
259
271
  componentsProps: PropTypes.shape({
@@ -300,6 +312,31 @@ process.env.NODE_ENV !== "production" ? Alert.propTypes
300
312
  */
301
313
  severity: PropTypes.oneOf(['error', 'info', 'success', 'warning']),
302
314
 
315
+ /**
316
+ * The extra props for the slot components.
317
+ * You can override the existing props or add new ones.
318
+ *
319
+ * This prop is an alias for the `componentsProps` prop, which will be deprecated in the future.
320
+ *
321
+ * @default {}
322
+ */
323
+ slotProps: PropTypes.shape({
324
+ closeButton: PropTypes.object,
325
+ closeIcon: PropTypes.object
326
+ }),
327
+
328
+ /**
329
+ * The components used for each slot inside.
330
+ *
331
+ * This prop is an alias for the `components` prop, which will be deprecated in the future.
332
+ *
333
+ * @default {}
334
+ */
335
+ slots: PropTypes.shape({
336
+ closeButton: PropTypes.elementType,
337
+ closeIcon: PropTypes.elementType
338
+ }),
339
+
303
340
  /**
304
341
  * The system prop that allows defining system overrides as well as additional CSS styles.
305
342
  */