@mui/material 6.4.4 → 6.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/Accordion.d.ts +14 -12
- package/Alert/Alert.d.ts +3 -15
- package/Backdrop/Backdrop.d.ts +14 -12
- package/Button/Button.js +3 -3
- package/CHANGELOG.md +63 -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/IconButton/IconButton.js +3 -3
- 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 +59 -16
- 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/Button/Button.js +3 -3
- package/modern/Checkbox/Checkbox.js +51 -21
- package/modern/Drawer/Drawer.js +108 -36
- package/modern/IconButton/IconButton.js +3 -3
- 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 +59 -16
- 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/useAutocomplete/useAutocomplete.js +0 -1
- package/modern/version/index.js +2 -2
- package/node/Button/Button.js +3 -3
- package/node/Checkbox/Checkbox.js +51 -21
- package/node/Drawer/Drawer.js +108 -36
- package/node/IconButton/IconButton.js +3 -3
- 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 +59 -16
- 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/useAutocomplete/useAutocomplete.js +0 -1
- package/node/version/index.js +2 -2
- package/package.json +5 -5
- package/styles/createThemeNoVars.js +7 -2
- package/useAutocomplete/useAutocomplete.js +0 -1
- package/version/index.js +2 -2
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
5
|
import refType from '@mui/utils/refType';
|
|
7
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
7
|
import capitalize from "../utils/capitalize.js";
|
|
@@ -12,6 +11,7 @@ import useControlled from "../utils/useControlled.js";
|
|
|
12
11
|
import useFormControl from "../FormControl/useFormControl.js";
|
|
13
12
|
import ButtonBase from "../ButtonBase/index.js";
|
|
14
13
|
import { getSwitchBaseUtilityClass } from "./switchBaseClasses.js";
|
|
14
|
+
import useSlot from "../utils/useSlot.js";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const useUtilityClasses = ownerState => {
|
|
17
17
|
const {
|
|
@@ -86,7 +86,6 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
|
|
|
86
86
|
autoFocus,
|
|
87
87
|
checked: checkedProp,
|
|
88
88
|
checkedIcon,
|
|
89
|
-
className,
|
|
90
89
|
defaultChecked,
|
|
91
90
|
disabled: disabledProp,
|
|
92
91
|
disableFocusRipple = false,
|
|
@@ -104,6 +103,8 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
|
|
|
104
103
|
tabIndex,
|
|
105
104
|
type,
|
|
106
105
|
value,
|
|
106
|
+
slots = {},
|
|
107
|
+
slotProps = {},
|
|
107
108
|
...other
|
|
108
109
|
} = props;
|
|
109
110
|
const [checked, setCheckedState] = useControlled({
|
|
@@ -156,38 +157,75 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
|
|
|
156
157
|
edge
|
|
157
158
|
};
|
|
158
159
|
const classes = useUtilityClasses(ownerState);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
160
|
+
const externalForwardedProps = {
|
|
161
|
+
slots,
|
|
162
|
+
slotProps: {
|
|
163
|
+
input: inputProps,
|
|
164
|
+
...slotProps
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
168
|
+
ref,
|
|
169
|
+
elementType: SwitchBaseRoot,
|
|
170
|
+
className: classes.root,
|
|
171
|
+
shouldForwardComponentProp: true,
|
|
172
|
+
externalForwardedProps: {
|
|
173
|
+
...externalForwardedProps,
|
|
174
|
+
component: 'span',
|
|
175
|
+
...other
|
|
176
|
+
},
|
|
177
|
+
getSlotProps: handlers => ({
|
|
178
|
+
...handlers,
|
|
179
|
+
onFocus: event => {
|
|
180
|
+
handlers.onFocus?.(event);
|
|
181
|
+
handleFocus(event);
|
|
182
|
+
},
|
|
183
|
+
onBlur: event => {
|
|
184
|
+
handlers.onBlur?.(event);
|
|
185
|
+
handleBlur(event);
|
|
186
|
+
}
|
|
187
|
+
}),
|
|
188
|
+
ownerState,
|
|
189
|
+
additionalProps: {
|
|
190
|
+
centerRipple: true,
|
|
191
|
+
focusRipple: !disableFocusRipple,
|
|
192
|
+
disabled,
|
|
193
|
+
role: undefined,
|
|
194
|
+
tabIndex: null
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
const [InputSlot, inputSlotProps] = useSlot('input', {
|
|
198
|
+
ref: inputRef,
|
|
199
|
+
elementType: SwitchBaseInput,
|
|
200
|
+
className: classes.input,
|
|
201
|
+
externalForwardedProps,
|
|
202
|
+
getSlotProps: handlers => ({
|
|
203
|
+
onChange: event => {
|
|
204
|
+
handlers.onChange?.(event);
|
|
205
|
+
handleInputChange(event);
|
|
206
|
+
}
|
|
207
|
+
}),
|
|
208
|
+
ownerState,
|
|
209
|
+
additionalProps: {
|
|
210
|
+
autoFocus,
|
|
174
211
|
checked: checkedProp,
|
|
175
|
-
defaultChecked
|
|
176
|
-
|
|
177
|
-
disabled: disabled,
|
|
212
|
+
defaultChecked,
|
|
213
|
+
disabled,
|
|
178
214
|
id: hasLabelFor ? id : undefined,
|
|
179
|
-
name
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
ownerState: ownerState,
|
|
185
|
-
tabIndex: tabIndex,
|
|
186
|
-
type: type,
|
|
215
|
+
name,
|
|
216
|
+
readOnly,
|
|
217
|
+
required,
|
|
218
|
+
tabIndex,
|
|
219
|
+
type,
|
|
187
220
|
...(type === 'checkbox' && value === undefined ? {} : {
|
|
188
221
|
value
|
|
189
|
-
})
|
|
190
|
-
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
226
|
+
...rootSlotProps,
|
|
227
|
+
children: [/*#__PURE__*/_jsx(InputSlot, {
|
|
228
|
+
...inputSlotProps
|
|
191
229
|
}), checked ? checkedIcon : icon]
|
|
192
230
|
});
|
|
193
231
|
});
|
|
@@ -280,6 +318,22 @@ process.env.NODE_ENV !== "production" ? SwitchBase.propTypes = {
|
|
|
280
318
|
* If `true`, the `input` element is required.
|
|
281
319
|
*/
|
|
282
320
|
required: PropTypes.bool,
|
|
321
|
+
/**
|
|
322
|
+
* The props used for each slot inside.
|
|
323
|
+
* @default {}
|
|
324
|
+
*/
|
|
325
|
+
slotProps: PropTypes.shape({
|
|
326
|
+
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
327
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
328
|
+
}),
|
|
329
|
+
/**
|
|
330
|
+
* The components used for each slot inside.
|
|
331
|
+
* @default {}
|
|
332
|
+
*/
|
|
333
|
+
slots: PropTypes.shape({
|
|
334
|
+
input: PropTypes.elementType,
|
|
335
|
+
root: PropTypes.elementType
|
|
336
|
+
}),
|
|
283
337
|
/**
|
|
284
338
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
285
339
|
*/
|
|
@@ -21,8 +21,13 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
21
21
|
shape: shapeInput,
|
|
22
22
|
...other
|
|
23
23
|
} = options;
|
|
24
|
-
if (options.vars
|
|
25
|
-
|
|
24
|
+
if (options.vars &&
|
|
25
|
+
// The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
|
|
26
|
+
// `generateThemeVars` is the closest identifier for checking that the `options` is a result of `createTheme` with CSS variables so that user can create new theme for nested ThemeProvider.
|
|
27
|
+
options.generateThemeVars === undefined) {
|
|
28
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' +
|
|
29
|
+
// #host-reference
|
|
30
|
+
'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : _formatMuiErrorMessage(20));
|
|
26
31
|
}
|
|
27
32
|
const palette = createPalette(paletteInput);
|
|
28
33
|
const systemTheme = systemCreateTheme(options);
|
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.4.
|
|
1
|
+
export const version = "6.4.6";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("4");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("6");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
package/node/Button/Button.js
CHANGED
|
@@ -508,9 +508,9 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
|
|
|
508
508
|
variant = 'text',
|
|
509
509
|
...other
|
|
510
510
|
} = props;
|
|
511
|
-
const
|
|
511
|
+
const loadingId = (0, _utils.unstable_useId)(idProp);
|
|
512
512
|
const loadingIndicator = loadingIndicatorProp ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
513
|
-
"aria-labelledby":
|
|
513
|
+
"aria-labelledby": loadingId,
|
|
514
514
|
color: "inherit",
|
|
515
515
|
size: 16
|
|
516
516
|
});
|
|
@@ -570,7 +570,7 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
|
|
|
570
570
|
focusVisibleClassName: (0, _clsx.default)(classes.focusVisible, focusVisibleClassName),
|
|
571
571
|
ref: ref,
|
|
572
572
|
type: type,
|
|
573
|
-
id:
|
|
573
|
+
id: loading ? loadingId : idProp,
|
|
574
574
|
...other,
|
|
575
575
|
classes: classes,
|
|
576
576
|
children: [startIcon, loadingPosition !== 'end' && loader, children, loadingPosition === 'end' && loader, endIcon]
|
|
@@ -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 _clsx = _interopRequireDefault(require("clsx"));
|
|
13
|
-
var _refType = _interopRequireDefault(require("@mui/utils/refType"));
|
|
14
13
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
14
|
var _colorManipulator = require("@mui/system/colorManipulator");
|
|
16
15
|
var _SwitchBase = _interopRequireDefault(require("../internal/SwitchBase"));
|
|
@@ -24,6 +23,8 @@ var _zeroStyled = require("../zero-styled");
|
|
|
24
23
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
25
24
|
var _createSimplePaletteValueFilter = _interopRequireDefault(require("../utils/createSimplePaletteValueFilter"));
|
|
26
25
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
26
|
+
var _utils = require("../utils");
|
|
27
|
+
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
27
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
29
|
const useUtilityClasses = ownerState => {
|
|
29
30
|
const {
|
|
@@ -121,6 +122,8 @@ const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(inProps, ref) {
|
|
|
121
122
|
size = 'medium',
|
|
122
123
|
disableRipple = false,
|
|
123
124
|
className,
|
|
125
|
+
slots = {},
|
|
126
|
+
slotProps = {},
|
|
124
127
|
...other
|
|
125
128
|
} = props;
|
|
126
129
|
const icon = indeterminate ? indeterminateIconProp : iconProp;
|
|
@@ -133,23 +136,37 @@ const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(inProps, ref) {
|
|
|
133
136
|
size
|
|
134
137
|
};
|
|
135
138
|
const classes = useUtilityClasses(ownerState);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
...inputProps
|
|
141
|
-
},
|
|
142
|
-
icon: /*#__PURE__*/React.cloneElement(icon, {
|
|
143
|
-
fontSize: icon.props.fontSize ?? size
|
|
144
|
-
}),
|
|
145
|
-
checkedIcon: /*#__PURE__*/React.cloneElement(indeterminateIcon, {
|
|
146
|
-
fontSize: indeterminateIcon.props.fontSize ?? size
|
|
147
|
-
}),
|
|
148
|
-
ownerState: ownerState,
|
|
149
|
-
ref: ref,
|
|
139
|
+
const externalInputProps = slotProps.input ?? inputProps;
|
|
140
|
+
const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
|
|
141
|
+
ref,
|
|
142
|
+
elementType: CheckboxRoot,
|
|
150
143
|
className: (0, _clsx.default)(classes.root, className),
|
|
151
|
-
|
|
152
|
-
|
|
144
|
+
shouldForwardComponentProp: true,
|
|
145
|
+
externalForwardedProps: {
|
|
146
|
+
slots,
|
|
147
|
+
slotProps,
|
|
148
|
+
...other
|
|
149
|
+
},
|
|
150
|
+
ownerState,
|
|
151
|
+
additionalProps: {
|
|
152
|
+
type: 'checkbox',
|
|
153
|
+
icon: /*#__PURE__*/React.cloneElement(icon, {
|
|
154
|
+
fontSize: icon.props.fontSize ?? size
|
|
155
|
+
}),
|
|
156
|
+
checkedIcon: /*#__PURE__*/React.cloneElement(indeterminateIcon, {
|
|
157
|
+
fontSize: indeterminateIcon.props.fontSize ?? size
|
|
158
|
+
}),
|
|
159
|
+
disableRipple,
|
|
160
|
+
slots,
|
|
161
|
+
slotProps: {
|
|
162
|
+
input: (0, _utils.mergeSlotProps)(typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps, {
|
|
163
|
+
'data-indeterminate': indeterminate
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RootSlot, {
|
|
169
|
+
...rootSlotProps,
|
|
153
170
|
classes: classes
|
|
154
171
|
});
|
|
155
172
|
});
|
|
@@ -220,12 +237,9 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
|
|
|
220
237
|
indeterminateIcon: _propTypes.default.node,
|
|
221
238
|
/**
|
|
222
239
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
240
|
+
* @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.
|
|
223
241
|
*/
|
|
224
242
|
inputProps: _propTypes.default.object,
|
|
225
|
-
/**
|
|
226
|
-
* Pass a ref to the `input` element.
|
|
227
|
-
*/
|
|
228
|
-
inputRef: _refType.default,
|
|
229
243
|
/**
|
|
230
244
|
* Callback fired when the state is changed.
|
|
231
245
|
*
|
|
@@ -244,6 +258,22 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
|
|
|
244
258
|
* @default 'medium'
|
|
245
259
|
*/
|
|
246
260
|
size: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['medium', 'small']), _propTypes.default.string]),
|
|
261
|
+
/**
|
|
262
|
+
* The props used for each slot inside.
|
|
263
|
+
* @default {}
|
|
264
|
+
*/
|
|
265
|
+
slotProps: _propTypes.default.shape({
|
|
266
|
+
input: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
267
|
+
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
268
|
+
}),
|
|
269
|
+
/**
|
|
270
|
+
* The components used for each slot inside.
|
|
271
|
+
* @default {}
|
|
272
|
+
*/
|
|
273
|
+
slots: _propTypes.default.shape({
|
|
274
|
+
input: _propTypes.default.elementType,
|
|
275
|
+
root: _propTypes.default.elementType
|
|
276
|
+
}),
|
|
247
277
|
/**
|
|
248
278
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
249
279
|
*/
|
package/node/Drawer/Drawer.js
CHANGED
|
@@ -24,6 +24,8 @@ var _zeroStyled = require("../zero-styled");
|
|
|
24
24
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
25
25
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
26
26
|
var _drawerClasses = require("./drawerClasses");
|
|
27
|
+
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
28
|
+
var _utils = require("../utils");
|
|
27
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
30
|
const overridesResolver = (props, styles) => {
|
|
29
31
|
const {
|
|
@@ -203,9 +205,11 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
|
|
|
203
205
|
PaperProps = {},
|
|
204
206
|
SlideProps,
|
|
205
207
|
// eslint-disable-next-line react/prop-types
|
|
206
|
-
TransitionComponent
|
|
208
|
+
TransitionComponent,
|
|
207
209
|
transitionDuration = defaultTransitionDuration,
|
|
208
210
|
variant = 'temporary',
|
|
211
|
+
slots = {},
|
|
212
|
+
slotProps = {},
|
|
209
213
|
...other
|
|
210
214
|
} = props;
|
|
211
215
|
|
|
@@ -229,56 +233,100 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
|
|
|
229
233
|
...other
|
|
230
234
|
};
|
|
231
235
|
const classes = useUtilityClasses(ownerState);
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
+
const externalForwardedProps = {
|
|
237
|
+
slots: {
|
|
238
|
+
transition: TransitionComponent,
|
|
239
|
+
...slots
|
|
240
|
+
},
|
|
241
|
+
slotProps: {
|
|
242
|
+
paper: PaperProps,
|
|
243
|
+
transition: SlideProps,
|
|
244
|
+
...slotProps,
|
|
245
|
+
backdrop: (0, _utils.mergeSlotProps)(slotProps.backdrop || {
|
|
246
|
+
...BackdropProps,
|
|
247
|
+
...BackdropPropsProp
|
|
248
|
+
}, {
|
|
249
|
+
transitionDuration
|
|
250
|
+
})
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
|
|
254
|
+
ref,
|
|
255
|
+
elementType: DrawerRoot,
|
|
256
|
+
className: (0, _clsx.default)(classes.root, classes.modal, className),
|
|
257
|
+
shouldForwardComponentProp: true,
|
|
258
|
+
ownerState,
|
|
259
|
+
externalForwardedProps: {
|
|
260
|
+
...externalForwardedProps,
|
|
261
|
+
...other,
|
|
262
|
+
...ModalProps
|
|
263
|
+
},
|
|
264
|
+
additionalProps: {
|
|
265
|
+
open,
|
|
266
|
+
onClose,
|
|
267
|
+
hideBackdrop,
|
|
268
|
+
slots: {
|
|
269
|
+
backdrop: externalForwardedProps.slots.backdrop
|
|
270
|
+
},
|
|
271
|
+
slotProps: {
|
|
272
|
+
backdrop: externalForwardedProps.slotProps.backdrop
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
const [PaperSlot, paperSlotProps] = (0, _useSlot.default)('paper', {
|
|
277
|
+
elementType: DrawerPaper,
|
|
278
|
+
shouldForwardComponentProp: true,
|
|
236
279
|
className: (0, _clsx.default)(classes.paper, PaperProps.className),
|
|
237
|
-
ownerState
|
|
280
|
+
ownerState,
|
|
281
|
+
externalForwardedProps,
|
|
282
|
+
additionalProps: {
|
|
283
|
+
elevation: variant === 'temporary' ? elevation : 0,
|
|
284
|
+
square: true
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
const [DockedSlot, dockedSlotProps] = (0, _useSlot.default)('docked', {
|
|
288
|
+
elementType: DrawerDockedRoot,
|
|
289
|
+
ref,
|
|
290
|
+
className: (0, _clsx.default)(classes.root, classes.docked, className),
|
|
291
|
+
ownerState,
|
|
292
|
+
externalForwardedProps,
|
|
293
|
+
additionalProps: other // pass `other` here because `DockedSlot` is also a root slot for some variants
|
|
294
|
+
});
|
|
295
|
+
const [TransitionSlot, transitionSlotProps] = (0, _useSlot.default)('transition', {
|
|
296
|
+
elementType: _Slide.default,
|
|
297
|
+
ownerState,
|
|
298
|
+
externalForwardedProps,
|
|
299
|
+
additionalProps: {
|
|
300
|
+
in: open,
|
|
301
|
+
direction: oppositeDirection[anchorInvariant],
|
|
302
|
+
timeout: transitionDuration,
|
|
303
|
+
appear: mounted.current
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
const drawer = /*#__PURE__*/(0, _jsxRuntime.jsx)(PaperSlot, {
|
|
307
|
+
...paperSlotProps,
|
|
238
308
|
children: children
|
|
239
309
|
});
|
|
240
310
|
if (variant === 'permanent') {
|
|
241
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
242
|
-
|
|
243
|
-
ownerState: ownerState,
|
|
244
|
-
ref: ref,
|
|
245
|
-
...other,
|
|
311
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(DockedSlot, {
|
|
312
|
+
...dockedSlotProps,
|
|
246
313
|
children: drawer
|
|
247
314
|
});
|
|
248
315
|
}
|
|
249
|
-
const slidingDrawer = /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
250
|
-
|
|
251
|
-
direction: oppositeDirection[anchorInvariant],
|
|
252
|
-
timeout: transitionDuration,
|
|
253
|
-
appear: mounted.current,
|
|
254
|
-
...SlideProps,
|
|
316
|
+
const slidingDrawer = /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionSlot, {
|
|
317
|
+
...transitionSlotProps,
|
|
255
318
|
children: drawer
|
|
256
319
|
});
|
|
257
320
|
if (variant === 'persistent') {
|
|
258
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
259
|
-
|
|
260
|
-
ownerState: ownerState,
|
|
261
|
-
ref: ref,
|
|
262
|
-
...other,
|
|
321
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(DockedSlot, {
|
|
322
|
+
...dockedSlotProps,
|
|
263
323
|
children: slidingDrawer
|
|
264
324
|
});
|
|
265
325
|
}
|
|
266
326
|
|
|
267
327
|
// variant === temporary
|
|
268
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
269
|
-
|
|
270
|
-
...BackdropProps,
|
|
271
|
-
...BackdropPropsProp,
|
|
272
|
-
transitionDuration
|
|
273
|
-
},
|
|
274
|
-
className: (0, _clsx.default)(classes.root, classes.modal, className),
|
|
275
|
-
open: open,
|
|
276
|
-
ownerState: ownerState,
|
|
277
|
-
onClose: onClose,
|
|
278
|
-
hideBackdrop: hideBackdrop,
|
|
279
|
-
ref: ref,
|
|
280
|
-
...other,
|
|
281
|
-
...ModalProps,
|
|
328
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RootSlot, {
|
|
329
|
+
...rootSlotProps,
|
|
282
330
|
children: slidingDrawer
|
|
283
331
|
});
|
|
284
332
|
});
|
|
@@ -338,13 +386,37 @@ process.env.NODE_ENV !== "production" ? Drawer.propTypes /* remove-proptypes */
|
|
|
338
386
|
open: _propTypes.default.bool,
|
|
339
387
|
/**
|
|
340
388
|
* Props applied to the [`Paper`](https://mui.com/material-ui/api/paper/) element.
|
|
389
|
+
* @deprecated use the `slotProps.paper` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
341
390
|
* @default {}
|
|
342
391
|
*/
|
|
343
392
|
PaperProps: _propTypes.default.object,
|
|
344
393
|
/**
|
|
345
394
|
* Props applied to the [`Slide`](https://mui.com/material-ui/api/slide/) element.
|
|
395
|
+
* @deprecated use the `slotProps.transition` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
346
396
|
*/
|
|
347
397
|
SlideProps: _propTypes.default.object,
|
|
398
|
+
/**
|
|
399
|
+
* The props used for each slot inside.
|
|
400
|
+
* @default {}
|
|
401
|
+
*/
|
|
402
|
+
slotProps: _propTypes.default.shape({
|
|
403
|
+
backdrop: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
404
|
+
docked: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
405
|
+
paper: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
406
|
+
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
407
|
+
transition: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
408
|
+
}),
|
|
409
|
+
/**
|
|
410
|
+
* The components used for each slot inside.
|
|
411
|
+
* @default {}
|
|
412
|
+
*/
|
|
413
|
+
slots: _propTypes.default.shape({
|
|
414
|
+
backdrop: _propTypes.default.elementType,
|
|
415
|
+
docked: _propTypes.default.elementType,
|
|
416
|
+
paper: _propTypes.default.elementType,
|
|
417
|
+
root: _propTypes.default.elementType,
|
|
418
|
+
transition: _propTypes.default.elementType
|
|
419
|
+
}),
|
|
348
420
|
/**
|
|
349
421
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
350
422
|
*/
|
|
@@ -200,9 +200,9 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(inProps, re
|
|
|
200
200
|
loadingIndicator: loadingIndicatorProp,
|
|
201
201
|
...other
|
|
202
202
|
} = props;
|
|
203
|
-
const
|
|
203
|
+
const loadingId = (0, _utils.unstable_useId)(idProp);
|
|
204
204
|
const loadingIndicator = loadingIndicatorProp ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
205
|
-
"aria-labelledby":
|
|
205
|
+
"aria-labelledby": loadingId,
|
|
206
206
|
color: "inherit",
|
|
207
207
|
size: 16
|
|
208
208
|
});
|
|
@@ -218,7 +218,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(inProps, re
|
|
|
218
218
|
};
|
|
219
219
|
const classes = useUtilityClasses(ownerState);
|
|
220
220
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(IconButtonRoot, {
|
|
221
|
-
id:
|
|
221
|
+
id: loading ? loadingId : idProp,
|
|
222
222
|
className: (0, _clsx.default)(classes.root, className),
|
|
223
223
|
centerRipple: true,
|
|
224
224
|
focusRipple: !disableFocusRipple,
|