@mui/material 6.4.5 → 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.
Files changed (73) hide show
  1. package/Accordion/Accordion.d.ts +14 -12
  2. package/Alert/Alert.d.ts +3 -15
  3. package/Backdrop/Backdrop.d.ts +14 -12
  4. package/CHANGELOG.md +38 -0
  5. package/CardHeader/CardHeader.d.ts +4 -20
  6. package/Checkbox/Checkbox.d.ts +45 -9
  7. package/Checkbox/Checkbox.js +51 -21
  8. package/Dialog/Dialog.d.ts +4 -4
  9. package/Drawer/Drawer.d.ts +92 -1
  10. package/Drawer/Drawer.js +108 -36
  11. package/InputBase/inputBaseClasses.d.ts +15 -6
  12. package/Menu/Menu.d.ts +88 -1
  13. package/Menu/Menu.js +58 -19
  14. package/Modal/Modal.js +9 -10
  15. package/Popover/Popover.d.ts +60 -6
  16. package/Popover/Popover.js +78 -51
  17. package/Radio/Radio.d.ts +45 -1
  18. package/Radio/Radio.js +59 -16
  19. package/Select/SelectInput.js +8 -8
  20. package/Snackbar/Snackbar.d.ts +79 -2
  21. package/Snackbar/Snackbar.js +110 -32
  22. package/SpeedDial/SpeedDial.d.ts +8 -6
  23. package/SpeedDialAction/SpeedDialAction.d.ts +82 -1
  24. package/SpeedDialAction/SpeedDialAction.js +108 -30
  25. package/StepContent/StepContent.d.ts +2 -2
  26. package/SwipeableDrawer/SwipeableDrawer.d.ts +28 -2
  27. package/SwipeableDrawer/SwipeableDrawer.js +60 -13
  28. package/Switch/Switch.js +2 -0
  29. package/Tabs/Tabs.d.ts +129 -29
  30. package/Tabs/Tabs.js +120 -52
  31. package/Tabs/tabsClasses.d.ts +4 -0
  32. package/Tabs/tabsClasses.js +1 -1
  33. package/Tooltip/Tooltip.d.ts +20 -12
  34. package/index.js +1 -1
  35. package/internal/SwitchBase.d.ts +35 -1
  36. package/internal/SwitchBase.js +84 -30
  37. package/modern/Checkbox/Checkbox.js +51 -21
  38. package/modern/Drawer/Drawer.js +108 -36
  39. package/modern/Menu/Menu.js +58 -19
  40. package/modern/Modal/Modal.js +9 -10
  41. package/modern/Popover/Popover.js +78 -51
  42. package/modern/Radio/Radio.js +59 -16
  43. package/modern/Select/SelectInput.js +8 -8
  44. package/modern/Snackbar/Snackbar.js +110 -32
  45. package/modern/SpeedDialAction/SpeedDialAction.js +108 -30
  46. package/modern/SwipeableDrawer/SwipeableDrawer.js +60 -13
  47. package/modern/Switch/Switch.js +2 -0
  48. package/modern/Tabs/Tabs.js +120 -52
  49. package/modern/Tabs/tabsClasses.js +1 -1
  50. package/modern/index.js +1 -1
  51. package/modern/internal/SwitchBase.js +84 -30
  52. package/modern/styles/createThemeNoVars.js +7 -2
  53. package/modern/version/index.js +2 -2
  54. package/node/Checkbox/Checkbox.js +51 -21
  55. package/node/Drawer/Drawer.js +108 -36
  56. package/node/Menu/Menu.js +58 -19
  57. package/node/Modal/Modal.js +9 -10
  58. package/node/Popover/Popover.js +78 -51
  59. package/node/Radio/Radio.js +59 -16
  60. package/node/Select/SelectInput.js +8 -8
  61. package/node/Snackbar/Snackbar.js +110 -32
  62. package/node/SpeedDialAction/SpeedDialAction.js +108 -30
  63. package/node/SwipeableDrawer/SwipeableDrawer.js +60 -13
  64. package/node/Switch/Switch.js +2 -0
  65. package/node/Tabs/Tabs.js +120 -52
  66. package/node/Tabs/tabsClasses.js +1 -1
  67. package/node/index.js +1 -1
  68. package/node/internal/SwitchBase.js +84 -30
  69. package/node/styles/createThemeNoVars.js +7 -2
  70. package/node/version/index.js +2 -2
  71. package/package.json +6 -6
  72. package/styles/createThemeNoVars.js +7 -2
  73. package/version/index.js +2 -2
@@ -41,26 +41,34 @@ export interface TooltipSlots {
41
41
  export type TooltipSlotsAndSlotProps = CreateSlotsAndSlotProps<
42
42
  TooltipSlots,
43
43
  {
44
+ /**
45
+ * Props forwarded to the popper slot.
46
+ * By default, the avaible props are based on the [Popper](https://mui.com/material-ui/api/popper/#props) component.
47
+ */
44
48
  popper: SlotProps<
45
49
  React.ElementType<PopperProps>,
46
50
  TooltipPopperSlotPropsOverrides,
47
51
  TooltipOwnerState
48
52
  >;
53
+ /**
54
+ * Props forwarded to the transition slot.
55
+ * By default, the avaible props are based on the [Grow](https://mui.com/material-ui/api/grow/#props) component.
56
+ */
49
57
  transition: SlotProps<
50
- React.ElementType<TransitionProps>,
51
- TooltipTransitionSlotPropsOverrides,
52
- TooltipOwnerState
53
- >;
54
- tooltip: SlotProps<
55
- React.ElementType<React.HTMLProps<HTMLDivElement>>,
56
- TooltipTooltipSlotPropsOverrides,
57
- TooltipOwnerState
58
- >;
59
- arrow: SlotProps<
60
- React.ElementType<React.HTMLProps<HTMLSpanElement>>,
61
- TooltipArrowSlotPropsOverrides,
58
+ React.ElementType,
59
+ TransitionProps & TooltipTransitionSlotPropsOverrides,
62
60
  TooltipOwnerState
63
61
  >;
62
+ /**
63
+ * Props forwarded to the tooltip slot.
64
+ * By default, the avaible props are based on the div element.
65
+ */
66
+ tooltip: SlotProps<'div', TooltipTooltipSlotPropsOverrides, TooltipOwnerState>;
67
+ /**
68
+ * Props forwarded to the tooltip slot.
69
+ * By default, the avaible props are based on the span element.
70
+ */
71
+ arrow: SlotProps<'span', TooltipArrowSlotPropsOverrides, TooltipOwnerState>;
64
72
  }
65
73
  >;
66
74
 
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.4.5
2
+ * @mui/material v6.4.6
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -2,9 +2,39 @@ import * as React from 'react';
2
2
  import { InternalStandardProps as StandardProps } from '..';
3
3
  import { ButtonBaseProps } from '../ButtonBase';
4
4
  import { SwitchBaseClasses } from './switchBaseClasses';
5
+ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
6
+
7
+ interface SwitchBaseSlots {
8
+ /**
9
+ * The component that renders the root slot.
10
+ * @default ButtonBase
11
+ */
12
+ root: React.ElementType;
13
+ /**
14
+ * The component that renders the input slot.
15
+ * @default 'input'
16
+ */
17
+ input: React.ElementType;
18
+ }
19
+
20
+ type SwitchBaseSlotsAndSlotProps = CreateSlotsAndSlotProps<
21
+ SwitchBaseSlots,
22
+ {
23
+ /**
24
+ * Props forwarded to the root slot.
25
+ * By default, the avaible props are based on the [ButtonBase](https://mui.com/material-ui/api/button-base/#props) component.
26
+ */
27
+ root: SlotProps<React.ElementType<ButtonBaseProps>, {}, SwitchBaseOwnerState>;
28
+ /**
29
+ * Props forwarded to the input slot.
30
+ */
31
+ input: SlotProps<'input', {}, SwitchBaseOwnerState>;
32
+ }
33
+ >;
5
34
 
6
35
  export interface SwitchBaseProps
7
- extends StandardProps<ButtonBaseProps, 'children' | 'onChange' | 'type' | 'value'> {
36
+ extends StandardProps<ButtonBaseProps, 'children' | 'onChange' | 'type' | 'value'>,
37
+ SwitchBaseSlotsAndSlotProps {
8
38
  autoFocus?: boolean;
9
39
  /**
10
40
  * If `true`, the component is checked.
@@ -48,10 +78,12 @@ export interface SwitchBaseProps
48
78
  id?: string;
49
79
  /**
50
80
  * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
81
+ * @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.
51
82
  */
52
83
  inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
53
84
  /**
54
85
  * Pass a ref to the `input` element.
86
+ * @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.
55
87
  */
56
88
  inputRef?: React.Ref<any>;
57
89
  /**
@@ -80,6 +112,8 @@ export interface SwitchBaseProps
80
112
  value?: unknown;
81
113
  }
82
114
 
115
+ export interface SwitchBaseOwnerState extends Omit<SwitchBaseProps, 'slots' | 'slotProps'> {}
116
+
83
117
  declare const SwitchBase: React.JSXElementConstructor<SwitchBaseProps>;
84
118
 
85
119
  export default SwitchBase;
@@ -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
- return /*#__PURE__*/_jsxs(SwitchBaseRoot, {
160
- component: "span",
161
- className: clsx(classes.root, className),
162
- centerRipple: true,
163
- focusRipple: !disableFocusRipple,
164
- disabled: disabled,
165
- tabIndex: null,
166
- role: undefined,
167
- onFocus: handleFocus,
168
- onBlur: handleBlur,
169
- ownerState: ownerState,
170
- ref: ref,
171
- ...other,
172
- children: [/*#__PURE__*/_jsx(SwitchBaseInput, {
173
- autoFocus: autoFocus,
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: defaultChecked,
176
- className: classes.input,
177
- disabled: disabled,
212
+ defaultChecked,
213
+ disabled,
178
214
  id: hasLabelFor ? id : undefined,
179
- name: name,
180
- onChange: handleInputChange,
181
- readOnly: readOnly,
182
- ref: inputRef,
183
- required: required,
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
- ...inputProps
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
  */
@@ -3,7 +3,6 @@
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import clsx from 'clsx';
6
- import refType from '@mui/utils/refType';
7
6
  import composeClasses from '@mui/utils/composeClasses';
8
7
  import { alpha } from '@mui/system/colorManipulator';
9
8
  import SwitchBase from "../internal/SwitchBase.js";
@@ -17,6 +16,8 @@ import { styled } from "../zero-styled/index.js";
17
16
  import memoTheme from "../utils/memoTheme.js";
18
17
  import createSimplePaletteValueFilter from "../utils/createSimplePaletteValueFilter.js";
19
18
  import { useDefaultProps } from "../DefaultPropsProvider/index.js";
19
+ import { mergeSlotProps } from "../utils/index.js";
20
+ import useSlot from "../utils/useSlot.js";
20
21
  import { jsx as _jsx } from "react/jsx-runtime";
21
22
  const useUtilityClasses = ownerState => {
22
23
  const {
@@ -114,6 +115,8 @@ const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(inProps, ref) {
114
115
  size = 'medium',
115
116
  disableRipple = false,
116
117
  className,
118
+ slots = {},
119
+ slotProps = {},
117
120
  ...other
118
121
  } = props;
119
122
  const icon = indeterminate ? indeterminateIconProp : iconProp;
@@ -126,23 +129,37 @@ const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(inProps, ref) {
126
129
  size
127
130
  };
128
131
  const classes = useUtilityClasses(ownerState);
129
- return /*#__PURE__*/_jsx(CheckboxRoot, {
130
- type: "checkbox",
131
- inputProps: {
132
- 'data-indeterminate': indeterminate,
133
- ...inputProps
134
- },
135
- icon: /*#__PURE__*/React.cloneElement(icon, {
136
- fontSize: icon.props.fontSize ?? size
137
- }),
138
- checkedIcon: /*#__PURE__*/React.cloneElement(indeterminateIcon, {
139
- fontSize: indeterminateIcon.props.fontSize ?? size
140
- }),
141
- ownerState: ownerState,
142
- ref: ref,
132
+ const externalInputProps = slotProps.input ?? inputProps;
133
+ const [RootSlot, rootSlotProps] = useSlot('root', {
134
+ ref,
135
+ elementType: CheckboxRoot,
143
136
  className: clsx(classes.root, className),
144
- disableRipple: disableRipple,
145
- ...other,
137
+ shouldForwardComponentProp: true,
138
+ externalForwardedProps: {
139
+ slots,
140
+ slotProps,
141
+ ...other
142
+ },
143
+ ownerState,
144
+ additionalProps: {
145
+ type: 'checkbox',
146
+ icon: /*#__PURE__*/React.cloneElement(icon, {
147
+ fontSize: icon.props.fontSize ?? size
148
+ }),
149
+ checkedIcon: /*#__PURE__*/React.cloneElement(indeterminateIcon, {
150
+ fontSize: indeterminateIcon.props.fontSize ?? size
151
+ }),
152
+ disableRipple,
153
+ slots,
154
+ slotProps: {
155
+ input: mergeSlotProps(typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps, {
156
+ 'data-indeterminate': indeterminate
157
+ })
158
+ }
159
+ }
160
+ });
161
+ return /*#__PURE__*/_jsx(RootSlot, {
162
+ ...rootSlotProps,
146
163
  classes: classes
147
164
  });
148
165
  });
@@ -213,12 +230,9 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
213
230
  indeterminateIcon: PropTypes.node,
214
231
  /**
215
232
  * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
233
+ * @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.
216
234
  */
217
235
  inputProps: PropTypes.object,
218
- /**
219
- * Pass a ref to the `input` element.
220
- */
221
- inputRef: refType,
222
236
  /**
223
237
  * Callback fired when the state is changed.
224
238
  *
@@ -237,6 +251,22 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
237
251
  * @default 'medium'
238
252
  */
239
253
  size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
254
+ /**
255
+ * The props used for each slot inside.
256
+ * @default {}
257
+ */
258
+ slotProps: PropTypes.shape({
259
+ input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
260
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
261
+ }),
262
+ /**
263
+ * The components used for each slot inside.
264
+ * @default {}
265
+ */
266
+ slots: PropTypes.shape({
267
+ input: PropTypes.elementType,
268
+ root: PropTypes.elementType
269
+ }),
240
270
  /**
241
271
  * The system prop that allows defining system overrides as well as additional CSS styles.
242
272
  */
@@ -15,6 +15,8 @@ import { styled, useTheme } from "../zero-styled/index.js";
15
15
  import memoTheme from "../utils/memoTheme.js";
16
16
  import { useDefaultProps } from "../DefaultPropsProvider/index.js";
17
17
  import { getDrawerUtilityClass } from "./drawerClasses.js";
18
+ import useSlot from "../utils/useSlot.js";
19
+ import { mergeSlotProps } from "../utils/index.js";
18
20
  import { jsx as _jsx } from "react/jsx-runtime";
19
21
  const overridesResolver = (props, styles) => {
20
22
  const {
@@ -194,9 +196,11 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
194
196
  PaperProps = {},
195
197
  SlideProps,
196
198
  // eslint-disable-next-line react/prop-types
197
- TransitionComponent = Slide,
199
+ TransitionComponent,
198
200
  transitionDuration = defaultTransitionDuration,
199
201
  variant = 'temporary',
202
+ slots = {},
203
+ slotProps = {},
200
204
  ...other
201
205
  } = props;
202
206
 
@@ -220,56 +224,100 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
220
224
  ...other
221
225
  };
222
226
  const classes = useUtilityClasses(ownerState);
223
- const drawer = /*#__PURE__*/_jsx(DrawerPaper, {
224
- elevation: variant === 'temporary' ? elevation : 0,
225
- square: true,
226
- ...PaperProps,
227
+ const externalForwardedProps = {
228
+ slots: {
229
+ transition: TransitionComponent,
230
+ ...slots
231
+ },
232
+ slotProps: {
233
+ paper: PaperProps,
234
+ transition: SlideProps,
235
+ ...slotProps,
236
+ backdrop: mergeSlotProps(slotProps.backdrop || {
237
+ ...BackdropProps,
238
+ ...BackdropPropsProp
239
+ }, {
240
+ transitionDuration
241
+ })
242
+ }
243
+ };
244
+ const [RootSlot, rootSlotProps] = useSlot('root', {
245
+ ref,
246
+ elementType: DrawerRoot,
247
+ className: clsx(classes.root, classes.modal, className),
248
+ shouldForwardComponentProp: true,
249
+ ownerState,
250
+ externalForwardedProps: {
251
+ ...externalForwardedProps,
252
+ ...other,
253
+ ...ModalProps
254
+ },
255
+ additionalProps: {
256
+ open,
257
+ onClose,
258
+ hideBackdrop,
259
+ slots: {
260
+ backdrop: externalForwardedProps.slots.backdrop
261
+ },
262
+ slotProps: {
263
+ backdrop: externalForwardedProps.slotProps.backdrop
264
+ }
265
+ }
266
+ });
267
+ const [PaperSlot, paperSlotProps] = useSlot('paper', {
268
+ elementType: DrawerPaper,
269
+ shouldForwardComponentProp: true,
227
270
  className: clsx(classes.paper, PaperProps.className),
228
- ownerState: ownerState,
271
+ ownerState,
272
+ externalForwardedProps,
273
+ additionalProps: {
274
+ elevation: variant === 'temporary' ? elevation : 0,
275
+ square: true
276
+ }
277
+ });
278
+ const [DockedSlot, dockedSlotProps] = useSlot('docked', {
279
+ elementType: DrawerDockedRoot,
280
+ ref,
281
+ className: clsx(classes.root, classes.docked, className),
282
+ ownerState,
283
+ externalForwardedProps,
284
+ additionalProps: other // pass `other` here because `DockedSlot` is also a root slot for some variants
285
+ });
286
+ const [TransitionSlot, transitionSlotProps] = useSlot('transition', {
287
+ elementType: Slide,
288
+ ownerState,
289
+ externalForwardedProps,
290
+ additionalProps: {
291
+ in: open,
292
+ direction: oppositeDirection[anchorInvariant],
293
+ timeout: transitionDuration,
294
+ appear: mounted.current
295
+ }
296
+ });
297
+ const drawer = /*#__PURE__*/_jsx(PaperSlot, {
298
+ ...paperSlotProps,
229
299
  children: children
230
300
  });
231
301
  if (variant === 'permanent') {
232
- return /*#__PURE__*/_jsx(DrawerDockedRoot, {
233
- className: clsx(classes.root, classes.docked, className),
234
- ownerState: ownerState,
235
- ref: ref,
236
- ...other,
302
+ return /*#__PURE__*/_jsx(DockedSlot, {
303
+ ...dockedSlotProps,
237
304
  children: drawer
238
305
  });
239
306
  }
240
- const slidingDrawer = /*#__PURE__*/_jsx(TransitionComponent, {
241
- in: open,
242
- direction: oppositeDirection[anchorInvariant],
243
- timeout: transitionDuration,
244
- appear: mounted.current,
245
- ...SlideProps,
307
+ const slidingDrawer = /*#__PURE__*/_jsx(TransitionSlot, {
308
+ ...transitionSlotProps,
246
309
  children: drawer
247
310
  });
248
311
  if (variant === 'persistent') {
249
- return /*#__PURE__*/_jsx(DrawerDockedRoot, {
250
- className: clsx(classes.root, classes.docked, className),
251
- ownerState: ownerState,
252
- ref: ref,
253
- ...other,
312
+ return /*#__PURE__*/_jsx(DockedSlot, {
313
+ ...dockedSlotProps,
254
314
  children: slidingDrawer
255
315
  });
256
316
  }
257
317
 
258
318
  // variant === temporary
259
- return /*#__PURE__*/_jsx(DrawerRoot, {
260
- BackdropProps: {
261
- ...BackdropProps,
262
- ...BackdropPropsProp,
263
- transitionDuration
264
- },
265
- className: clsx(classes.root, classes.modal, className),
266
- open: open,
267
- ownerState: ownerState,
268
- onClose: onClose,
269
- hideBackdrop: hideBackdrop,
270
- ref: ref,
271
- ...other,
272
- ...ModalProps,
319
+ return /*#__PURE__*/_jsx(RootSlot, {
320
+ ...rootSlotProps,
273
321
  children: slidingDrawer
274
322
  });
275
323
  });
@@ -329,13 +377,37 @@ process.env.NODE_ENV !== "production" ? Drawer.propTypes /* remove-proptypes */
329
377
  open: PropTypes.bool,
330
378
  /**
331
379
  * Props applied to the [`Paper`](https://mui.com/material-ui/api/paper/) element.
380
+ * @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.
332
381
  * @default {}
333
382
  */
334
383
  PaperProps: PropTypes.object,
335
384
  /**
336
385
  * Props applied to the [`Slide`](https://mui.com/material-ui/api/slide/) element.
386
+ * @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.
337
387
  */
338
388
  SlideProps: PropTypes.object,
389
+ /**
390
+ * The props used for each slot inside.
391
+ * @default {}
392
+ */
393
+ slotProps: PropTypes.shape({
394
+ backdrop: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
395
+ docked: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
396
+ paper: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
397
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
398
+ transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
399
+ }),
400
+ /**
401
+ * The components used for each slot inside.
402
+ * @default {}
403
+ */
404
+ slots: PropTypes.shape({
405
+ backdrop: PropTypes.elementType,
406
+ docked: PropTypes.elementType,
407
+ paper: PropTypes.elementType,
408
+ root: PropTypes.elementType,
409
+ transition: PropTypes.elementType
410
+ }),
339
411
  /**
340
412
  * The system prop that allows defining system overrides as well as additional CSS styles.
341
413
  */