@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.
- package/Alert/Alert.d.ts +34 -3
- package/Alert/Alert.js +46 -9
- package/Autocomplete/Autocomplete.d.ts +10 -0
- package/Autocomplete/Autocomplete.js +27 -11
- package/AvatarGroup/AvatarGroup.d.ts +18 -1
- package/AvatarGroup/AvatarGroup.js +25 -6
- package/Backdrop/Backdrop.d.ts +33 -3
- package/Backdrop/Backdrop.js +46 -11
- package/Badge/Badge.d.ts +11 -3
- package/Badge/Badge.js +11 -3
- package/ButtonBase/TouchRipple.js +1 -1
- package/CHANGELOG.md +134 -0
- package/Chip/Chip.js +8 -4
- package/FilledInput/FilledInput.js +48 -9
- package/FormControl/FormControl.js +29 -29
- package/FormControlLabel/FormControlLabel.d.ts +12 -0
- package/FormControlLabel/FormControlLabel.js +17 -5
- package/Input/Input.js +49 -10
- package/InputBase/InputBase.d.ts +34 -3
- package/InputBase/InputBase.js +45 -8
- package/ListItem/ListItem.d.ts +32 -3
- package/ListItem/ListItem.js +43 -11
- package/ListItemButton/ListItemButton.js +2 -2
- package/MenuItem/MenuItem.js +2 -2
- package/Modal/Modal.d.ts +11 -3
- package/Modal/Modal.js +11 -3
- package/NativeSelect/NativeSelectInput.js +11 -9
- package/OutlinedInput/OutlinedInput.js +26 -8
- package/PaginationItem/PaginationItem.d.ts +19 -7
- package/PaginationItem/PaginationItem.js +31 -22
- package/README.md +1 -0
- package/Radio/Radio.js +2 -1
- package/RadioGroup/RadioGroup.js +12 -12
- package/Select/Select.d.ts +3 -3
- package/Select/Select.js +3 -3
- package/Slider/Slider.d.ts +14 -2
- package/Slider/Slider.js +12 -3
- package/StepLabel/StepLabel.d.ts +11 -0
- package/StepLabel/StepLabel.js +15 -3
- package/SwipeableDrawer/SwipeableDrawer.js +10 -2
- package/Tooltip/Tooltip.d.ts +43 -6
- package/Tooltip/Tooltip.js +69 -32
- package/Unstable_Grid2/Grid2Props.d.ts +1 -1
- package/esm/Alert/Alert.js +46 -9
- package/esm/Autocomplete/Autocomplete.js +27 -11
- package/esm/AvatarGroup/AvatarGroup.js +25 -6
- package/esm/Backdrop/Backdrop.js +46 -11
- package/esm/Badge/Badge.js +11 -3
- package/esm/ButtonBase/TouchRipple.js +1 -1
- package/esm/Chip/Chip.js +8 -4
- package/esm/FilledInput/FilledInput.js +48 -9
- package/esm/FormControl/FormControl.js +29 -29
- package/esm/FormControlLabel/FormControlLabel.js +17 -5
- package/esm/Input/Input.js +49 -10
- package/esm/InputBase/InputBase.js +45 -8
- package/esm/ListItem/ListItem.js +43 -11
- package/esm/ListItemButton/ListItemButton.js +2 -2
- package/esm/MenuItem/MenuItem.js +2 -2
- package/esm/Modal/Modal.js +11 -3
- package/esm/NativeSelect/NativeSelectInput.js +11 -9
- package/esm/OutlinedInput/OutlinedInput.js +26 -8
- package/esm/PaginationItem/PaginationItem.js +31 -22
- package/esm/Radio/Radio.js +2 -1
- package/esm/RadioGroup/RadioGroup.js +12 -12
- package/esm/Select/Select.js +3 -3
- package/esm/Slider/Slider.js +12 -3
- package/esm/StepLabel/StepLabel.js +15 -3
- package/esm/SwipeableDrawer/SwipeableDrawer.js +9 -2
- package/esm/Tooltip/Tooltip.js +69 -32
- package/index.js +1 -1
- package/legacy/Alert/Alert.js +48 -9
- package/legacy/Autocomplete/Autocomplete.js +27 -10
- package/legacy/AvatarGroup/AvatarGroup.js +26 -6
- package/legacy/Backdrop/Backdrop.js +48 -11
- package/legacy/Badge/Badge.js +11 -3
- package/legacy/ButtonBase/TouchRipple.js +1 -1
- package/legacy/Chip/Chip.js +8 -4
- package/legacy/FilledInput/FilledInput.js +49 -9
- package/legacy/FormControl/FormControl.js +29 -29
- package/legacy/FormControlLabel/FormControlLabel.js +17 -4
- package/legacy/Input/Input.js +50 -10
- package/legacy/InputBase/InputBase.js +47 -8
- package/legacy/ListItem/ListItem.js +49 -13
- package/legacy/ListItemButton/ListItemButton.js +7 -5
- package/legacy/MenuItem/MenuItem.js +6 -4
- package/legacy/Modal/Modal.js +11 -3
- package/legacy/NativeSelect/NativeSelectInput.js +11 -9
- package/legacy/OutlinedInput/OutlinedInput.js +27 -8
- package/legacy/PaginationItem/PaginationItem.js +32 -22
- package/legacy/Radio/Radio.js +2 -1
- package/legacy/RadioGroup/RadioGroup.js +14 -14
- package/legacy/Select/Select.js +3 -3
- package/legacy/Slider/Slider.js +12 -3
- package/legacy/StepLabel/StepLabel.js +16 -3
- package/legacy/SwipeableDrawer/SwipeableDrawer.js +9 -2
- package/legacy/Tooltip/Tooltip.js +64 -23
- package/legacy/index.js +1 -1
- package/modern/Alert/Alert.js +45 -8
- package/modern/Autocomplete/Autocomplete.js +26 -10
- package/modern/AvatarGroup/AvatarGroup.js +24 -5
- package/modern/Backdrop/Backdrop.js +45 -10
- package/modern/Badge/Badge.js +11 -3
- package/modern/ButtonBase/TouchRipple.js +1 -1
- package/modern/Chip/Chip.js +8 -4
- package/modern/FilledInput/FilledInput.js +46 -9
- package/modern/FormControl/FormControl.js +29 -29
- package/modern/FormControlLabel/FormControlLabel.js +15 -5
- package/modern/Input/Input.js +47 -10
- package/modern/InputBase/InputBase.js +43 -8
- package/modern/ListItem/ListItem.js +43 -11
- package/modern/ListItemButton/ListItemButton.js +2 -2
- package/modern/MenuItem/MenuItem.js +2 -2
- package/modern/Modal/Modal.js +11 -3
- package/modern/NativeSelect/NativeSelectInput.js +11 -9
- package/modern/OutlinedInput/OutlinedInput.js +25 -7
- package/modern/PaginationItem/PaginationItem.js +31 -22
- package/modern/Radio/Radio.js +2 -1
- package/modern/RadioGroup/RadioGroup.js +12 -12
- package/modern/Select/Select.js +3 -3
- package/modern/Slider/Slider.js +12 -3
- package/modern/StepLabel/StepLabel.js +13 -3
- package/modern/SwipeableDrawer/SwipeableDrawer.js +9 -2
- package/modern/Tooltip/Tooltip.js +59 -18
- package/modern/index.js +1 -1
- package/package.json +4 -4
- package/umd/material-ui.development.js +617 -234
- package/umd/material-ui.production.min.js +20 -20
package/RadioGroup/RadioGroup.js
CHANGED
|
@@ -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
|
-
|
|
70
|
-
|
|
72
|
+
onChange(event) {
|
|
73
|
+
setValueState(event.target.value);
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
if (onChange) {
|
|
76
|
+
onChange(event, event.target.value);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
76
79
|
|
|
77
|
-
|
|
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
|
package/Select/Select.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
*/
|
package/Slider/Slider.d.ts
CHANGED
|
@@ -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
|
|
31
|
-
*
|
|
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
|
|
613
|
-
*
|
|
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
|
-
*
|
|
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]),
|
package/StepLabel/StepLabel.d.ts
CHANGED
|
@@ -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
|
*/
|
package/StepLabel/StepLabel.js
CHANGED
|
@@ -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
|
-
},
|
|
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
|
-
|
|
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
|
-
|
|
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, {
|
package/Tooltip/Tooltip.d.ts
CHANGED
|
@@ -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
|
|
26
|
-
*
|
|
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
|
|
37
|
-
*
|
|
38
|
-
*
|
|
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
|
*/
|
package/Tooltip/Tooltip.js
CHANGED
|
@@ -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
|
|
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 (
|
|
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 = (
|
|
618
|
-
const TransitionComponent = (
|
|
619
|
-
const TooltipComponent = (
|
|
620
|
-
const ArrowComponent = (
|
|
621
|
-
const popperProps = (0, _base.appendOwnerState)(PopperComponent, (0, _extends2.default)({}, PopperProps, componentsProps.popper
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
const
|
|
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
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
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
|
|
697
|
-
*
|
|
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
|
|
709
|
-
*
|
|
710
|
-
*
|
|
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
|
*/
|
package/esm/Alert/Alert.js
CHANGED
|
@@ -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
|
|
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 = (
|
|
163
|
-
const AlertCloseIcon = (
|
|
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
|
-
},
|
|
196
|
+
}, closeButtonProps, {
|
|
193
197
|
children: /*#__PURE__*/_jsx(AlertCloseIcon, _extends({
|
|
194
198
|
fontSize: "small"
|
|
195
|
-
},
|
|
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
|
|
247
|
-
*
|
|
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
|
|
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
|
*/
|