@mui/material 6.4.5 → 6.4.7
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/Accordion/Accordion.d.ts +14 -12
- package/Alert/Alert.d.ts +3 -15
- package/Backdrop/Backdrop.d.ts +14 -12
- package/CHANGELOG.md +58 -0
- package/CardHeader/CardHeader.d.ts +4 -20
- package/Checkbox/Checkbox.d.ts +45 -9
- package/Checkbox/Checkbox.js +51 -21
- package/Dialog/Dialog.d.ts +4 -4
- package/Drawer/Drawer.d.ts +92 -1
- package/Drawer/Drawer.js +108 -36
- package/InputBase/inputBaseClasses.d.ts +15 -6
- package/Menu/Menu.d.ts +88 -1
- package/Menu/Menu.js +58 -19
- package/Modal/Modal.js +9 -10
- package/Popover/Popover.d.ts +60 -6
- package/Popover/Popover.js +78 -51
- package/Radio/Radio.d.ts +45 -1
- package/Radio/Radio.js +61 -16
- package/Rating/Rating.d.ts +59 -1
- package/Rating/Rating.js +131 -45
- package/Select/SelectInput.js +8 -8
- package/Snackbar/Snackbar.d.ts +79 -2
- package/Snackbar/Snackbar.js +110 -32
- package/SpeedDial/SpeedDial.d.ts +8 -6
- package/SpeedDialAction/SpeedDialAction.d.ts +82 -1
- package/SpeedDialAction/SpeedDialAction.js +108 -30
- package/StepContent/StepContent.d.ts +2 -2
- package/SwipeableDrawer/SwipeableDrawer.d.ts +28 -2
- package/SwipeableDrawer/SwipeableDrawer.js +60 -13
- package/Switch/Switch.js +2 -0
- package/Tabs/Tabs.d.ts +129 -29
- package/Tabs/Tabs.js +120 -52
- package/Tabs/tabsClasses.d.ts +4 -0
- package/Tabs/tabsClasses.js +1 -1
- package/Tooltip/Tooltip.d.ts +20 -12
- package/index.js +1 -1
- package/internal/SwitchBase.d.ts +35 -1
- package/internal/SwitchBase.js +84 -30
- package/modern/Checkbox/Checkbox.js +51 -21
- package/modern/Drawer/Drawer.js +108 -36
- package/modern/Menu/Menu.js +58 -19
- package/modern/Modal/Modal.js +9 -10
- package/modern/Popover/Popover.js +78 -51
- package/modern/Radio/Radio.js +61 -16
- package/modern/Rating/Rating.js +131 -45
- package/modern/Select/SelectInput.js +8 -8
- package/modern/Snackbar/Snackbar.js +110 -32
- package/modern/SpeedDialAction/SpeedDialAction.js +108 -30
- package/modern/SwipeableDrawer/SwipeableDrawer.js +60 -13
- package/modern/Switch/Switch.js +2 -0
- package/modern/Tabs/Tabs.js +120 -52
- package/modern/Tabs/tabsClasses.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internal/SwitchBase.js +84 -30
- package/modern/styles/createThemeNoVars.js +7 -2
- package/modern/version/index.js +2 -2
- package/node/Checkbox/Checkbox.js +51 -21
- package/node/Drawer/Drawer.js +108 -36
- package/node/Menu/Menu.js +58 -19
- package/node/Modal/Modal.js +9 -10
- package/node/Popover/Popover.js +78 -51
- package/node/Radio/Radio.js +61 -16
- package/node/Rating/Rating.js +132 -46
- package/node/Select/SelectInput.js +8 -8
- package/node/Snackbar/Snackbar.js +110 -32
- package/node/SpeedDialAction/SpeedDialAction.js +108 -30
- package/node/SwipeableDrawer/SwipeableDrawer.js +60 -13
- package/node/Switch/Switch.js +2 -0
- package/node/Tabs/Tabs.js +120 -52
- package/node/Tabs/tabsClasses.js +1 -1
- package/node/index.js +1 -1
- package/node/internal/SwitchBase.js +84 -30
- package/node/styles/createThemeNoVars.js +7 -2
- package/node/version/index.js +2 -2
- package/package.json +5 -5
- package/styles/ThemeProvider.d.ts +6 -0
- package/styles/ThemeProviderWithVars.d.ts +1 -0
- package/styles/createThemeNoVars.js +7 -2
- package/styles/index.d.ts +1 -0
- package/version/index.js +2 -2
package/node/Radio/Radio.js
CHANGED
|
@@ -24,6 +24,7 @@ var _rootShouldForwardProp = _interopRequireDefault(require("../styles/rootShoul
|
|
|
24
24
|
var _zeroStyled = require("../zero-styled");
|
|
25
25
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
26
26
|
var _createSimplePaletteValueFilter = _interopRequireDefault(require("../utils/createSimplePaletteValueFilter"));
|
|
27
|
+
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
27
28
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
28
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
30
|
const useUtilityClasses = ownerState => {
|
|
@@ -132,6 +133,9 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
132
133
|
className,
|
|
133
134
|
disabled: disabledProp,
|
|
134
135
|
disableRipple = false,
|
|
136
|
+
slots = {},
|
|
137
|
+
slotProps = {},
|
|
138
|
+
inputProps,
|
|
135
139
|
...other
|
|
136
140
|
} = props;
|
|
137
141
|
const muiFormControl = (0, _useFormControl.default)();
|
|
@@ -162,23 +166,46 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
162
166
|
name = radioGroup.name;
|
|
163
167
|
}
|
|
164
168
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}),
|
|
170
|
-
checkedIcon: /*#__PURE__*/React.cloneElement(checkedIcon, {
|
|
171
|
-
fontSize: defaultCheckedIcon.props.fontSize ?? size
|
|
172
|
-
}),
|
|
173
|
-
disabled: disabled,
|
|
174
|
-
ownerState: ownerState,
|
|
175
|
-
classes: classes,
|
|
176
|
-
name: name,
|
|
177
|
-
checked: checked,
|
|
178
|
-
onChange: onChange,
|
|
179
|
-
ref: ref,
|
|
169
|
+
const externalInputProps = slotProps.input ?? inputProps;
|
|
170
|
+
const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
|
|
171
|
+
ref,
|
|
172
|
+
elementType: RadioRoot,
|
|
180
173
|
className: (0, _clsx.default)(classes.root, className),
|
|
181
|
-
|
|
174
|
+
shouldForwardComponentProp: true,
|
|
175
|
+
externalForwardedProps: {
|
|
176
|
+
slots,
|
|
177
|
+
slotProps,
|
|
178
|
+
...other
|
|
179
|
+
},
|
|
180
|
+
getSlotProps: handlers => ({
|
|
181
|
+
...handlers,
|
|
182
|
+
onChange: (event, ...args) => {
|
|
183
|
+
handlers.onChange?.(event, ...args);
|
|
184
|
+
onChange(event, ...args);
|
|
185
|
+
}
|
|
186
|
+
}),
|
|
187
|
+
ownerState,
|
|
188
|
+
additionalProps: {
|
|
189
|
+
type: 'radio',
|
|
190
|
+
icon: /*#__PURE__*/React.cloneElement(icon, {
|
|
191
|
+
fontSize: icon.props.fontSize ?? size
|
|
192
|
+
}),
|
|
193
|
+
checkedIcon: /*#__PURE__*/React.cloneElement(checkedIcon, {
|
|
194
|
+
fontSize: checkedIcon.props.fontSize ?? size
|
|
195
|
+
}),
|
|
196
|
+
disabled,
|
|
197
|
+
name,
|
|
198
|
+
checked,
|
|
199
|
+
slots,
|
|
200
|
+
slotProps: {
|
|
201
|
+
// Do not forward `slotProps.root` again because it's already handled by the `RootSlot` in this file.
|
|
202
|
+
input: typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RootSlot, {
|
|
207
|
+
...rootSlotProps,
|
|
208
|
+
classes: classes
|
|
182
209
|
});
|
|
183
210
|
});
|
|
184
211
|
process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ = {
|
|
@@ -230,10 +257,12 @@ process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ =
|
|
|
230
257
|
id: _propTypes.default.string,
|
|
231
258
|
/**
|
|
232
259
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
260
|
+
* @deprecated Use `slotProps.input` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
233
261
|
*/
|
|
234
262
|
inputProps: _propTypes.default.object,
|
|
235
263
|
/**
|
|
236
264
|
* Pass a ref to the `input` element.
|
|
265
|
+
* @deprecated Use `slotProps.input.ref` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
237
266
|
*/
|
|
238
267
|
inputRef: _refType.default,
|
|
239
268
|
/**
|
|
@@ -259,6 +288,22 @@ process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ =
|
|
|
259
288
|
* @default 'medium'
|
|
260
289
|
*/
|
|
261
290
|
size: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['medium', 'small']), _propTypes.default.string]),
|
|
291
|
+
/**
|
|
292
|
+
* The props used for each slot inside.
|
|
293
|
+
* @default {}
|
|
294
|
+
*/
|
|
295
|
+
slotProps: _propTypes.default.shape({
|
|
296
|
+
input: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
297
|
+
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
298
|
+
}),
|
|
299
|
+
/**
|
|
300
|
+
* The components used for each slot inside.
|
|
301
|
+
* @default {}
|
|
302
|
+
*/
|
|
303
|
+
slots: _propTypes.default.shape({
|
|
304
|
+
input: _propTypes.default.elementType,
|
|
305
|
+
root: _propTypes.default.elementType
|
|
306
|
+
}),
|
|
262
307
|
/**
|
|
263
308
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
264
309
|
*/
|
package/node/Rating/Rating.js
CHANGED
|
@@ -7,7 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.default = void 0;
|
|
10
|
-
var
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var React = _react;
|
|
11
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
14
|
var _clamp = _interopRequireDefault(require("@mui/utils/clamp"));
|
|
@@ -24,6 +25,7 @@ var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
|
24
25
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
25
26
|
var _slotShouldForwardProp = _interopRequireDefault(require("../styles/slotShouldForwardProp"));
|
|
26
27
|
var _ratingClasses = _interopRequireWildcard(require("./ratingClasses"));
|
|
28
|
+
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
27
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
30
|
function getDecimalPrecision(num) {
|
|
29
31
|
const decimalPart = num.toString().split('.')[1];
|
|
@@ -227,7 +229,9 @@ function RatingItem(props) {
|
|
|
227
229
|
readOnly,
|
|
228
230
|
ownerState,
|
|
229
231
|
ratingValue,
|
|
230
|
-
ratingValueRounded
|
|
232
|
+
ratingValueRounded,
|
|
233
|
+
slots = {},
|
|
234
|
+
slotProps = {}
|
|
231
235
|
} = props;
|
|
232
236
|
const isFilled = highlightSelectedOnly ? itemValue === ratingValue : itemValue <= ratingValue;
|
|
233
237
|
const isHovered = itemValue <= hover;
|
|
@@ -239,10 +243,14 @@ function RatingItem(props) {
|
|
|
239
243
|
// Update to const id = useId(); when React 17 support is dropped.
|
|
240
244
|
// More details: https://github.com/mui/material-ui/issues/40997
|
|
241
245
|
const id = `${name}-${(0, _utils.unstable_useId)()}`;
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
246
|
+
const externalForwardedProps = {
|
|
247
|
+
slots,
|
|
248
|
+
slotProps
|
|
249
|
+
};
|
|
250
|
+
const [IconSlot, iconSlotProps] = (0, _useSlot.default)('icon', {
|
|
251
|
+
elementType: RatingIcon,
|
|
245
252
|
className: (0, _clsx.default)(classes.icon, isFilled ? classes.iconFilled : classes.iconEmpty, isHovered && classes.iconHover, isFocused && classes.iconFocus, isActive && classes.iconActive),
|
|
253
|
+
externalForwardedProps,
|
|
246
254
|
ownerState: {
|
|
247
255
|
...ownerState,
|
|
248
256
|
iconEmpty: !isFilled,
|
|
@@ -251,6 +259,29 @@ function RatingItem(props) {
|
|
|
251
259
|
iconFocus: isFocused,
|
|
252
260
|
iconActive: isActive
|
|
253
261
|
},
|
|
262
|
+
additionalProps: {
|
|
263
|
+
value: itemValue
|
|
264
|
+
},
|
|
265
|
+
internalForwardedProps: {
|
|
266
|
+
// TODO: remove this in v7 because `IconContainerComponent` is deprecated
|
|
267
|
+
// only forward if `slots.icon` is NOT provided
|
|
268
|
+
as: IconContainerComponent
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
const [LabelSlot, labelSlotProps] = (0, _useSlot.default)('label', {
|
|
272
|
+
elementType: RatingLabel,
|
|
273
|
+
externalForwardedProps,
|
|
274
|
+
ownerState: {
|
|
275
|
+
...ownerState,
|
|
276
|
+
emptyValueFocused: undefined
|
|
277
|
+
},
|
|
278
|
+
additionalProps: {
|
|
279
|
+
style: labelProps?.style,
|
|
280
|
+
htmlFor: id
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
const container = /*#__PURE__*/(0, _jsxRuntime.jsx)(IconSlot, {
|
|
284
|
+
...iconSlotProps,
|
|
254
285
|
children: emptyIcon && !isFilled ? emptyIcon : icon
|
|
255
286
|
});
|
|
256
287
|
if (readOnly) {
|
|
@@ -260,13 +291,8 @@ function RatingItem(props) {
|
|
|
260
291
|
});
|
|
261
292
|
}
|
|
262
293
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
263
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
264
|
-
|
|
265
|
-
...ownerState,
|
|
266
|
-
emptyValueFocused: undefined
|
|
267
|
-
},
|
|
268
|
-
htmlFor: id,
|
|
269
|
-
...labelProps,
|
|
294
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(LabelSlot, {
|
|
295
|
+
...labelSlotProps,
|
|
270
296
|
children: [container, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
271
297
|
className: classes.visuallyHidden,
|
|
272
298
|
children: getLabelText(itemValue)
|
|
@@ -307,7 +333,9 @@ process.env.NODE_ENV !== "production" ? RatingItem.propTypes = {
|
|
|
307
333
|
ownerState: _propTypes.default.object.isRequired,
|
|
308
334
|
ratingValue: _propTypes.default.number,
|
|
309
335
|
ratingValueRounded: _propTypes.default.number,
|
|
310
|
-
readOnly: _propTypes.default.bool.isRequired
|
|
336
|
+
readOnly: _propTypes.default.bool.isRequired,
|
|
337
|
+
slotProps: _propTypes.default.object,
|
|
338
|
+
slots: _propTypes.default.object
|
|
311
339
|
} : void 0;
|
|
312
340
|
const defaultIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Star.default, {
|
|
313
341
|
fontSize: "inherit"
|
|
@@ -344,6 +372,8 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
344
372
|
readOnly = false,
|
|
345
373
|
size = 'medium',
|
|
346
374
|
value: valueProp,
|
|
375
|
+
slots = {},
|
|
376
|
+
slotProps = {},
|
|
347
377
|
...other
|
|
348
378
|
} = props;
|
|
349
379
|
const name = (0, _utils.unstable_useId)(nameProp);
|
|
@@ -481,16 +511,50 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
481
511
|
size
|
|
482
512
|
};
|
|
483
513
|
const classes = useUtilityClasses(ownerState);
|
|
484
|
-
|
|
485
|
-
|
|
514
|
+
const externalForwardedProps = {
|
|
515
|
+
slots,
|
|
516
|
+
slotProps
|
|
517
|
+
};
|
|
518
|
+
const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
|
|
486
519
|
ref: handleRef,
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
520
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
521
|
+
elementType: RatingRoot,
|
|
522
|
+
externalForwardedProps: {
|
|
523
|
+
...externalForwardedProps,
|
|
524
|
+
...other,
|
|
525
|
+
component
|
|
526
|
+
},
|
|
527
|
+
getSlotProps: handlers => ({
|
|
528
|
+
...handlers,
|
|
529
|
+
onMouseMove: event => {
|
|
530
|
+
handleMouseMove(event);
|
|
531
|
+
handlers.onMouseMove?.(event);
|
|
532
|
+
},
|
|
533
|
+
onMouseLeave: event => {
|
|
534
|
+
handleMouseLeave(event);
|
|
535
|
+
handlers.onMouseLeave?.(event);
|
|
536
|
+
}
|
|
537
|
+
}),
|
|
538
|
+
ownerState,
|
|
539
|
+
additionalProps: {
|
|
540
|
+
role: readOnly ? 'img' : null,
|
|
541
|
+
'aria-label': readOnly ? getLabelText(value) : null
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
const [LabelSlot, labelSlotProps] = (0, _useSlot.default)('label', {
|
|
545
|
+
className: (0, _clsx.default)(classes.label, classes.labelEmptyValue),
|
|
546
|
+
elementType: RatingLabel,
|
|
547
|
+
externalForwardedProps,
|
|
548
|
+
ownerState
|
|
549
|
+
});
|
|
550
|
+
const [DecimalSlot, decimalSlotProps] = (0, _useSlot.default)('decimal', {
|
|
551
|
+
className: classes.decimal,
|
|
552
|
+
elementType: RatingDecimal,
|
|
553
|
+
externalForwardedProps,
|
|
554
|
+
ownerState
|
|
555
|
+
});
|
|
556
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, {
|
|
557
|
+
...rootSlotProps,
|
|
494
558
|
children: [Array.from(new Array(max)).map((_, index) => {
|
|
495
559
|
const itemValue = index + 1;
|
|
496
560
|
const ratingItemProps = {
|
|
@@ -511,41 +575,42 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
511
575
|
ratingValue: value,
|
|
512
576
|
ratingValueRounded: valueRounded,
|
|
513
577
|
readOnly,
|
|
514
|
-
ownerState
|
|
578
|
+
ownerState,
|
|
579
|
+
slots,
|
|
580
|
+
slotProps
|
|
515
581
|
};
|
|
516
582
|
const isActive = itemValue === Math.ceil(value) && (hover !== -1 || focus !== -1);
|
|
517
583
|
if (precision < 1) {
|
|
518
584
|
const items = Array.from(new Array(1 / precision));
|
|
519
|
-
return /*#__PURE__*/(0,
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
585
|
+
return /*#__PURE__*/(0, _react.createElement)(DecimalSlot, {
|
|
586
|
+
...decimalSlotProps,
|
|
587
|
+
key: itemValue,
|
|
588
|
+
className: (0, _clsx.default)(decimalSlotProps.className, isActive && classes.iconActive),
|
|
589
|
+
iconActive: isActive
|
|
590
|
+
}, items.map(($, indexDecimal) => {
|
|
591
|
+
const itemDecimalValue = roundValueToPrecision(itemValue - 1 + (indexDecimal + 1) * precision, precision);
|
|
592
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingItem, {
|
|
593
|
+
...ratingItemProps,
|
|
594
|
+
// The icon is already displayed as active
|
|
595
|
+
isActive: false,
|
|
596
|
+
itemValue: itemDecimalValue,
|
|
597
|
+
labelProps: {
|
|
598
|
+
style: items.length - 1 === indexDecimal ? {} : {
|
|
599
|
+
width: itemDecimalValue === value ? `${(indexDecimal + 1) * precision * 100}%` : '0%',
|
|
600
|
+
overflow: 'hidden',
|
|
601
|
+
position: 'absolute'
|
|
536
602
|
}
|
|
537
|
-
}
|
|
538
|
-
})
|
|
539
|
-
}
|
|
603
|
+
}
|
|
604
|
+
}, itemDecimalValue);
|
|
605
|
+
}));
|
|
540
606
|
}
|
|
541
607
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingItem, {
|
|
542
608
|
...ratingItemProps,
|
|
543
609
|
isActive: isActive,
|
|
544
610
|
itemValue: itemValue
|
|
545
611
|
}, itemValue);
|
|
546
|
-
}), !readOnly && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
547
|
-
|
|
548
|
-
ownerState: ownerState,
|
|
612
|
+
}), !readOnly && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(LabelSlot, {
|
|
613
|
+
...labelSlotProps,
|
|
549
614
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
550
615
|
className: classes.visuallyHidden,
|
|
551
616
|
value: "",
|
|
@@ -629,6 +694,7 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
|
|
|
629
694
|
icon: _propTypes.default.node,
|
|
630
695
|
/**
|
|
631
696
|
* The component containing the icon.
|
|
697
|
+
* @deprecated Use `slotProps.icon.component` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
632
698
|
* @default function IconContainer(props) {
|
|
633
699
|
* const { value, ...other } = props;
|
|
634
700
|
* return <span {...other} />;
|
|
@@ -686,6 +752,26 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
|
|
|
686
752
|
* @default 'medium'
|
|
687
753
|
*/
|
|
688
754
|
size: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['small', 'medium', 'large']), _propTypes.default.string]),
|
|
755
|
+
/**
|
|
756
|
+
* The props used for each slot inside.
|
|
757
|
+
* @default {}
|
|
758
|
+
*/
|
|
759
|
+
slotProps: _propTypes.default.shape({
|
|
760
|
+
decimal: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
761
|
+
icon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
762
|
+
label: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
763
|
+
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
764
|
+
}),
|
|
765
|
+
/**
|
|
766
|
+
* The components used for each slot inside.
|
|
767
|
+
* @default {}
|
|
768
|
+
*/
|
|
769
|
+
slots: _propTypes.default.shape({
|
|
770
|
+
decimal: _propTypes.default.elementType,
|
|
771
|
+
icon: _propTypes.default.elementType,
|
|
772
|
+
label: _propTypes.default.elementType,
|
|
773
|
+
root: _propTypes.default.elementType
|
|
774
|
+
}),
|
|
689
775
|
/**
|
|
690
776
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
691
777
|
*/
|
|
@@ -507,16 +507,16 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
507
507
|
horizontal: 'center'
|
|
508
508
|
},
|
|
509
509
|
...MenuProps,
|
|
510
|
-
MenuListProps: {
|
|
511
|
-
'aria-labelledby': labelId,
|
|
512
|
-
role: 'listbox',
|
|
513
|
-
'aria-multiselectable': multiple ? 'true' : undefined,
|
|
514
|
-
disableListWrap: true,
|
|
515
|
-
id: listboxId,
|
|
516
|
-
...MenuProps.MenuListProps
|
|
517
|
-
},
|
|
518
510
|
slotProps: {
|
|
519
511
|
...MenuProps.slotProps,
|
|
512
|
+
list: {
|
|
513
|
+
'aria-labelledby': labelId,
|
|
514
|
+
role: 'listbox',
|
|
515
|
+
'aria-multiselectable': multiple ? 'true' : undefined,
|
|
516
|
+
disableListWrap: true,
|
|
517
|
+
id: listboxId,
|
|
518
|
+
...MenuProps.MenuListProps
|
|
519
|
+
},
|
|
520
520
|
paper: {
|
|
521
521
|
...paperProps,
|
|
522
522
|
style: {
|
|
@@ -10,7 +10,6 @@ exports.default = void 0;
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
13
|
-
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
14
13
|
var _useSnackbar = _interopRequireDefault(require("./useSnackbar"));
|
|
15
14
|
var _ClickAwayListener = _interopRequireDefault(require("../ClickAwayListener"));
|
|
16
15
|
var _zeroStyled = require("../zero-styled");
|
|
@@ -20,6 +19,7 @@ var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
|
20
19
|
var _Grow = _interopRequireDefault(require("../Grow"));
|
|
21
20
|
var _SnackbarContent = _interopRequireDefault(require("../SnackbarContent"));
|
|
22
21
|
var _snackbarClasses = require("./snackbarClasses");
|
|
22
|
+
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
24
|
const useUtilityClasses = ownerState => {
|
|
25
25
|
const {
|
|
@@ -127,8 +127,8 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
127
127
|
autoHideDuration = null,
|
|
128
128
|
children,
|
|
129
129
|
className,
|
|
130
|
-
ClickAwayListenerProps,
|
|
131
|
-
ContentProps,
|
|
130
|
+
ClickAwayListenerProps: ClickAwayListenerPropsProp,
|
|
131
|
+
ContentProps: ContentPropsProp,
|
|
132
132
|
disableWindowBlurListener = false,
|
|
133
133
|
message,
|
|
134
134
|
onBlur,
|
|
@@ -138,12 +138,14 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
138
138
|
onMouseLeave,
|
|
139
139
|
open,
|
|
140
140
|
resumeHideDuration,
|
|
141
|
-
|
|
141
|
+
slots = {},
|
|
142
|
+
slotProps = {},
|
|
143
|
+
TransitionComponent: TransitionComponentProp,
|
|
142
144
|
transitionDuration = defaultTransitionDuration,
|
|
143
145
|
TransitionProps: {
|
|
144
146
|
onEnter,
|
|
145
147
|
onExited,
|
|
146
|
-
...
|
|
148
|
+
...TransitionPropsProp
|
|
147
149
|
} = {},
|
|
148
150
|
...other
|
|
149
151
|
} = props;
|
|
@@ -155,7 +157,7 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
155
157
|
},
|
|
156
158
|
autoHideDuration,
|
|
157
159
|
disableWindowBlurListener,
|
|
158
|
-
TransitionComponent,
|
|
160
|
+
TransitionComponent: TransitionComponentProp,
|
|
159
161
|
transitionDuration
|
|
160
162
|
};
|
|
161
163
|
const classes = useUtilityClasses(ownerState);
|
|
@@ -166,16 +168,6 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
166
168
|
...ownerState
|
|
167
169
|
});
|
|
168
170
|
const [exited, setExited] = React.useState(true);
|
|
169
|
-
const rootProps = (0, _useSlotProps.default)({
|
|
170
|
-
elementType: SnackbarRoot,
|
|
171
|
-
getSlotProps: getRootProps,
|
|
172
|
-
externalForwardedProps: other,
|
|
173
|
-
ownerState,
|
|
174
|
-
additionalProps: {
|
|
175
|
-
ref
|
|
176
|
-
},
|
|
177
|
-
className: [classes.root, className]
|
|
178
|
-
});
|
|
179
171
|
const handleExited = node => {
|
|
180
172
|
setExited(true);
|
|
181
173
|
if (onExited) {
|
|
@@ -188,28 +180,84 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
188
180
|
onEnter(node, isAppearing);
|
|
189
181
|
}
|
|
190
182
|
};
|
|
183
|
+
const externalForwardedProps = {
|
|
184
|
+
slots: {
|
|
185
|
+
transition: TransitionComponentProp,
|
|
186
|
+
...slots
|
|
187
|
+
},
|
|
188
|
+
slotProps: {
|
|
189
|
+
content: ContentPropsProp,
|
|
190
|
+
clickAwayListener: ClickAwayListenerPropsProp,
|
|
191
|
+
transition: TransitionPropsProp,
|
|
192
|
+
...slotProps
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const [Root, rootProps] = (0, _useSlot.default)('root', {
|
|
196
|
+
ref,
|
|
197
|
+
className: [classes.root, className],
|
|
198
|
+
elementType: SnackbarRoot,
|
|
199
|
+
getSlotProps: getRootProps,
|
|
200
|
+
externalForwardedProps: {
|
|
201
|
+
...externalForwardedProps,
|
|
202
|
+
...other
|
|
203
|
+
},
|
|
204
|
+
ownerState
|
|
205
|
+
});
|
|
206
|
+
const [ClickAwaySlot, clickAwayListenerProps] = (0, _useSlot.default)('clickAwayListener', {
|
|
207
|
+
elementType: _ClickAwayListener.default,
|
|
208
|
+
externalForwardedProps,
|
|
209
|
+
getSlotProps: handlers => ({
|
|
210
|
+
onClickAway: (...params) => {
|
|
211
|
+
handlers.onClickAway?.(...params);
|
|
212
|
+
onClickAway(...params);
|
|
213
|
+
}
|
|
214
|
+
}),
|
|
215
|
+
ownerState
|
|
216
|
+
});
|
|
217
|
+
const [ContentSlot, contentSlotProps] = (0, _useSlot.default)('content', {
|
|
218
|
+
elementType: _SnackbarContent.default,
|
|
219
|
+
shouldForwardComponentProp: true,
|
|
220
|
+
externalForwardedProps,
|
|
221
|
+
additionalProps: {
|
|
222
|
+
message,
|
|
223
|
+
action
|
|
224
|
+
},
|
|
225
|
+
ownerState
|
|
226
|
+
});
|
|
227
|
+
const [TransitionSlot, transitionProps] = (0, _useSlot.default)('transition', {
|
|
228
|
+
elementType: _Grow.default,
|
|
229
|
+
externalForwardedProps,
|
|
230
|
+
getSlotProps: handlers => ({
|
|
231
|
+
onEnter: (...params) => {
|
|
232
|
+
handlers.onEnter?.(...params);
|
|
233
|
+
handleEnter(...params);
|
|
234
|
+
},
|
|
235
|
+
onExited: (...params) => {
|
|
236
|
+
handlers.onExited?.(...params);
|
|
237
|
+
handleExited(...params);
|
|
238
|
+
}
|
|
239
|
+
}),
|
|
240
|
+
additionalProps: {
|
|
241
|
+
appear: true,
|
|
242
|
+
in: open,
|
|
243
|
+
timeout: transitionDuration,
|
|
244
|
+
direction: vertical === 'top' ? 'down' : 'up'
|
|
245
|
+
},
|
|
246
|
+
ownerState
|
|
247
|
+
});
|
|
191
248
|
|
|
192
249
|
// So we only render active snackbars.
|
|
193
250
|
if (!open && exited) {
|
|
194
251
|
return null;
|
|
195
252
|
}
|
|
196
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SnackbarRoot, {
|
|
253
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ClickAwaySlot, {
|
|
254
|
+
...clickAwayListenerProps,
|
|
255
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, {
|
|
200
256
|
...rootProps,
|
|
201
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
direction: vertical === 'top' ? 'down' : 'up',
|
|
206
|
-
onEnter: handleEnter,
|
|
207
|
-
onExited: handleExited,
|
|
208
|
-
...TransitionProps,
|
|
209
|
-
children: children || /*#__PURE__*/(0, _jsxRuntime.jsx)(_SnackbarContent.default, {
|
|
210
|
-
message: message,
|
|
211
|
-
action: action,
|
|
212
|
-
...ContentProps
|
|
257
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionSlot, {
|
|
258
|
+
...transitionProps,
|
|
259
|
+
children: children || /*#__PURE__*/(0, _jsxRuntime.jsx)(ContentSlot, {
|
|
260
|
+
...contentSlotProps
|
|
213
261
|
})
|
|
214
262
|
})
|
|
215
263
|
})
|
|
@@ -256,10 +304,12 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes *
|
|
|
256
304
|
className: _propTypes.default.string,
|
|
257
305
|
/**
|
|
258
306
|
* Props applied to the `ClickAwayListener` element.
|
|
307
|
+
* @deprecated Use `slotProps.clickAwayListener` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
259
308
|
*/
|
|
260
309
|
ClickAwayListenerProps: _propTypes.default.object,
|
|
261
310
|
/**
|
|
262
311
|
* Props applied to the [`SnackbarContent`](https://mui.com/material-ui/api/snackbar-content/) element.
|
|
312
|
+
* @deprecated Use `slotProps.content` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
263
313
|
*/
|
|
264
314
|
ContentProps: _propTypes.default.object,
|
|
265
315
|
/**
|
|
@@ -316,6 +366,32 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes *
|
|
|
316
366
|
* we default to `autoHideDuration / 2` ms.
|
|
317
367
|
*/
|
|
318
368
|
resumeHideDuration: _propTypes.default.number,
|
|
369
|
+
/**
|
|
370
|
+
* The props used for each slot inside.
|
|
371
|
+
* @default {}
|
|
372
|
+
*/
|
|
373
|
+
slotProps: _propTypes.default.shape({
|
|
374
|
+
clickAwayListener: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
375
|
+
children: _propTypes.default.element.isRequired,
|
|
376
|
+
disableReactTree: _propTypes.default.bool,
|
|
377
|
+
mouseEvent: _propTypes.default.oneOf(['onClick', 'onMouseDown', 'onMouseUp', 'onPointerDown', 'onPointerUp', false]),
|
|
378
|
+
onClickAway: _propTypes.default.func,
|
|
379
|
+
touchEvent: _propTypes.default.oneOf(['onTouchEnd', 'onTouchStart', false])
|
|
380
|
+
})]),
|
|
381
|
+
content: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
382
|
+
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
383
|
+
transition: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
384
|
+
}),
|
|
385
|
+
/**
|
|
386
|
+
* The components used for each slot inside.
|
|
387
|
+
* @default {}
|
|
388
|
+
*/
|
|
389
|
+
slots: _propTypes.default.shape({
|
|
390
|
+
clickAwayListener: _propTypes.default.elementType,
|
|
391
|
+
content: _propTypes.default.elementType,
|
|
392
|
+
root: _propTypes.default.elementType,
|
|
393
|
+
transition: _propTypes.default.elementType
|
|
394
|
+
}),
|
|
319
395
|
/**
|
|
320
396
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
321
397
|
*/
|
|
@@ -323,6 +399,7 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes *
|
|
|
323
399
|
/**
|
|
324
400
|
* The component used for the transition.
|
|
325
401
|
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
402
|
+
* @deprecated Use `slots.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
326
403
|
* @default Grow
|
|
327
404
|
*/
|
|
328
405
|
TransitionComponent: _propTypes.default.elementType,
|
|
@@ -342,6 +419,7 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes *
|
|
|
342
419
|
/**
|
|
343
420
|
* Props applied to the transition element.
|
|
344
421
|
* By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
|
|
422
|
+
* @deprecated Use `slotProps.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
345
423
|
* @default {}
|
|
346
424
|
*/
|
|
347
425
|
TransitionProps: _propTypes.default.object
|