@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
@@ -5,7 +5,7 @@ import { TransitionProps } from '../transitions/transition';
5
5
  import { AccordionClasses } from './accordionClasses';
6
6
  import { OverridableComponent, OverrideProps } from '../OverridableComponent';
7
7
  import { ExtendPaperTypeMap } from '../Paper/Paper';
8
- import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
8
+ import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from '../utils/types';
9
9
 
10
10
  export interface AccordionSlots {
11
11
  /**
@@ -18,9 +18,7 @@ export interface AccordionSlots {
18
18
  * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
19
19
  * @default Collapse
20
20
  */
21
- transition: React.JSXElementConstructor<
22
- TransitionProps & { children?: React.ReactElement<unknown, any> }
23
- >;
21
+ transition: React.ElementType;
24
22
  }
25
23
 
26
24
  export interface AccordionTransitionSlotPropsOverrides {}
@@ -29,14 +27,18 @@ export interface AccordionHeadingSlotPropsOverrides {}
29
27
  export type AccordionSlotsAndSlotProps = CreateSlotsAndSlotProps<
30
28
  AccordionSlots,
31
29
  {
32
- heading: SlotProps<
33
- React.ElementType<React.HTMLProps<HTMLHeadingElement>>,
34
- AccordionHeadingSlotPropsOverrides,
35
- AccordionOwnerState
36
- >;
37
- transition: SlotProps<
38
- React.ElementType<TransitionProps>,
39
- AccordionTransitionSlotPropsOverrides,
30
+ /**
31
+ * Props forwarded to the heading slot.
32
+ * By default, the avaible props are based on the h3 element.
33
+ */
34
+ heading: SlotProps<'h3', AccordionHeadingSlotPropsOverrides, AccordionOwnerState>;
35
+ /**
36
+ * Props forwarded to the transition slot.
37
+ * By default, the avaible props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component.
38
+ */
39
+ transition: SlotComponentProps<
40
+ React.ElementType,
41
+ TransitionProps & AccordionTransitionSlotPropsOverrides,
40
42
  AccordionOwnerState
41
43
  >;
42
44
  }
package/Alert/Alert.d.ts CHANGED
@@ -67,29 +67,17 @@ export type AlertSlotsAndSlotProps = CreateSlotsAndSlotProps<
67
67
  * Props forwarded to the icon slot.
68
68
  * By default, the avaible props are based on a div element.
69
69
  */
70
- icon: SlotProps<
71
- React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
72
- AlertIconSlotPropsOverrides,
73
- AlertOwnerState
74
- >;
70
+ icon: SlotProps<'div', AlertIconSlotPropsOverrides, AlertOwnerState>;
75
71
  /**
76
72
  * Props forwarded to the message slot.
77
73
  * By default, the avaible props are based on a div element.
78
74
  */
79
- message: SlotProps<
80
- React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
81
- AlertMessageSlotPropsOverrides,
82
- AlertOwnerState
83
- >;
75
+ message: SlotProps<'div', AlertMessageSlotPropsOverrides, AlertOwnerState>;
84
76
  /**
85
77
  * Props forwarded to the action slot.
86
78
  * By default, the avaible props are based on a div element.
87
79
  */
88
- action: SlotProps<
89
- React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
90
- AlertActionSlotPropsOverrides,
91
- AlertOwnerState
92
- >;
80
+ action: SlotProps<'div', AlertActionSlotPropsOverrides, AlertOwnerState>;
93
81
  /**
94
82
  * Props forwarded to the closeButton slot.
95
83
  * By default, the avaible props are based on the [IconButton](https://mui.com/material-ui/api/icon-button/#props) component.
@@ -5,7 +5,7 @@ import { TransitionProps } from '../transitions/transition';
5
5
  import { Theme } from '../styles';
6
6
  import { BackdropClasses } from './backdropClasses';
7
7
  import { OverridableComponent, OverrideProps } from '../OverridableComponent';
8
- import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
8
+ import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from '../utils/types';
9
9
 
10
10
  export interface BackdropSlots {
11
11
  /**
@@ -18,9 +18,7 @@ export interface BackdropSlots {
18
18
  * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
19
19
  * @default Fade
20
20
  */
21
- transition: React.JSXElementConstructor<
22
- TransitionProps & { children: React.ReactElement<unknown, any> }
23
- >;
21
+ transition: React.ElementType;
24
22
  }
25
23
  export interface BackdropComponentsPropsOverrides {}
26
24
 
@@ -29,14 +27,18 @@ export interface BackdropTransitionSlotPropsOverrides {}
29
27
  export type BackdropSlotsAndSlotProps = CreateSlotsAndSlotProps<
30
28
  BackdropSlots,
31
29
  {
32
- root: SlotProps<
33
- React.ElementType<HTMLDivElement>,
34
- BackdropComponentsPropsOverrides,
35
- BackdropOwnerState
36
- >;
37
- transition: SlotProps<
38
- React.JSXElementConstructor<TransitionProps>,
39
- BackdropTransitionSlotPropsOverrides,
30
+ /**
31
+ * Props forwarded to the transition slot.
32
+ * By default, the avaible props are based on the div element.
33
+ */
34
+ root: SlotProps<'div', BackdropComponentsPropsOverrides, BackdropOwnerState>;
35
+ /**
36
+ * Props forwarded to the transition slot.
37
+ * By default, the avaible props are based on the [Fade](https://mui.com/material-ui/api/fade/#props) component.
38
+ */
39
+ transition: SlotComponentProps<
40
+ React.ElementType,
41
+ TransitionProps & BackdropTransitionSlotPropsOverrides,
40
42
  BackdropOwnerState
41
43
  >;
42
44
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 6.4.6
4
+
5
+ <!-- generated comparing v6.4.5..v6.x -->
6
+
7
+ _Feb 26, 2025_
8
+
9
+ A big thanks to the 4 contributors who made this release possible.
10
+
11
+ ### `@mui/material@6.4.6`
12
+
13
+ - [Checkbox] Add slots and slotProps (#45361) @siriwatknp
14
+ - [Drawer] Deprecate *Props and complete `slots`, `slotProps` (#45377) @siriwatknp
15
+ - [Grid] Improve Grid2 upgrade experience (#45372) @DiegoAndai
16
+ - [InputBase] Deprecate composed classes (#45366) @siriwatknp
17
+ - Fix `slotProps.transition` types (#45367) @siriwatknp
18
+ - Allow nested theme creation with `vars` (#45368) @siriwatknp
19
+ - Fix wrong slotProps of DetailsHTMLAttributes types (#45356) @siriwatknp
20
+ - [Popover] Deprecate *Props and complete `slots`, `slotProps` (#45337) @siriwatknp
21
+ - [Radio] Add slots and slotProps (#45364) @siriwatknp
22
+ - [Slider] Fix css class selector in migration guide (#45409) @sai6855
23
+ - [Slider] Fix spacings in .md files (#45393) @sai6855
24
+ - [Snackbar] Add Slots and SlotProps (#45103) (#45352) @siriwatknp
25
+ - [SpeedDialAction] Add slots and slotProps (#45365) @siriwatknp
26
+ - [SwitchBase] Deprecate `inputProps` and complete slots, slotProps (#45338) @siriwatknp
27
+ - [Tabs] Deprecate *Props and complete slots, slotProps (#45012) (#45355) @siriwatknp
28
+ - [Menu] Deprecate *Props and complete `slots`, `slotProps` (#45369) @siriwatknp
29
+
30
+ ### Docs
31
+
32
+ - [Autocomplete] Remove unnecessary renderTags prop from Sizes demo (#45403) @ZeeshanTamboli
33
+ - Fix typo in slider docs (#45392) @sai6855
34
+
35
+ ### Core
36
+
37
+ - [test] Remove unused renderTags prop and fix key warning in Autocomplete regression test (#45412) @ZeeshanTamboli
38
+
39
+ All contributors of this release in alphabetical order: @DiegoAndai, @sai6855, @siriwatknp, @ZeeshanTamboli
40
+
3
41
  ## 6.4.5
4
42
 
5
43
  <!-- generated comparing v6.4.4..v6.x -->
@@ -60,38 +60,22 @@ export type CardHeaderSlotsAndSlotProps = CreateSlotsAndSlotProps<
60
60
  * Props forwarded to the root slot.
61
61
  * By default, the avaible props are based on the div element.
62
62
  */
63
- root: SlotProps<
64
- React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
65
- CardHeaderRootSlotPropsOverrides,
66
- CardHeaderOwnerState
67
- >;
63
+ root: SlotProps<'div', CardHeaderRootSlotPropsOverrides, CardHeaderOwnerState>;
68
64
  /**
69
65
  * Props forwarded to the avatar slot.
70
66
  * By default, the avaible props are based on the div element.
71
67
  */
72
- avatar: SlotProps<
73
- React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
74
- CardHeaderAvatarSlotPropsOverrides,
75
- CardHeaderOwnerState
76
- >;
68
+ avatar: SlotProps<'div', CardHeaderAvatarSlotPropsOverrides, CardHeaderOwnerState>;
77
69
  /**
78
70
  * Props forwarded to the action slot.
79
71
  * By default, the avaible props are based on the div element.
80
72
  */
81
- action: SlotProps<
82
- React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
83
- CardHeaderActionSlotPropsOverrides,
84
- CardHeaderOwnerState
85
- >;
73
+ action: SlotProps<'div', CardHeaderActionSlotPropsOverrides, CardHeaderOwnerState>;
86
74
  /**
87
75
  * Props forwarded to the content slot.
88
76
  * By default, the avaible props are based on the div element.
89
77
  */
90
- content: SlotProps<
91
- React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
92
- CardHeaderContentSlotPropsOverrides,
93
- CardHeaderOwnerState
94
- >;
78
+ content: SlotProps<'div', CardHeaderContentSlotPropsOverrides, CardHeaderOwnerState>;
95
79
  /**
96
80
  * Props forwarded to the title slot (as long as disableTypography is not `true`).
97
81
  * By default, the avaible props are based on the [Typography](https://mui.com/material-ui/api/typography/#props) component.
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { SxProps } from '@mui/system';
3
3
  import { OverridableStringUnion } from '@mui/types';
4
4
  import { InternalStandardProps as StandardProps, Theme } from '..';
5
+ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
5
6
  import { SwitchBaseProps } from '../internal/SwitchBase';
6
7
  import { CheckboxClasses } from './checkboxClasses';
7
8
 
@@ -9,8 +10,49 @@ export interface CheckboxPropsSizeOverrides {}
9
10
 
10
11
  export interface CheckboxPropsColorOverrides {}
11
12
 
13
+ export interface CheckboxRootSlotPropsOverrides {}
14
+
15
+ export interface CheckboxInputSlotPropsOverrides {}
16
+
17
+ export interface CheckboxSlots {
18
+ /**
19
+ * The component that renders the root slot.
20
+ * @default SwitchBase
21
+ */
22
+ root: React.ElementType;
23
+ /**
24
+ * The component that renders the input slot.
25
+ * @default SwitchBase's input
26
+ */
27
+ input: React.ElementType;
28
+ }
29
+
30
+ export type CheckboxSlotsAndSlotProps = CreateSlotsAndSlotProps<
31
+ CheckboxSlots,
32
+ {
33
+ /**
34
+ * Props forwarded to the root slot.
35
+ * By default, the avaible props are based on the div element.
36
+ */
37
+ root: SlotProps<
38
+ React.ElementType<SwitchBaseProps>,
39
+ CheckboxRootSlotPropsOverrides,
40
+ CheckboxOwnerState
41
+ >;
42
+ /**
43
+ * Props forwarded to the input slot.
44
+ * By default, the avaible props are based on the input element.
45
+ */
46
+ input: SlotProps<'input', CheckboxInputSlotPropsOverrides, CheckboxOwnerState>;
47
+ }
48
+ >;
49
+
12
50
  export interface CheckboxProps
13
- extends StandardProps<SwitchBaseProps, 'checkedIcon' | 'color' | 'icon' | 'type'> {
51
+ extends StandardProps<
52
+ SwitchBaseProps,
53
+ 'checkedIcon' | 'color' | 'icon' | 'type' | 'slots' | 'slotProps'
54
+ >,
55
+ CheckboxSlotsAndSlotProps {
14
56
  /**
15
57
  * If `true`, the component is checked.
16
58
  */
@@ -66,14 +108,6 @@ export interface CheckboxProps
66
108
  * @default <IndeterminateCheckBoxIcon />
67
109
  */
68
110
  indeterminateIcon?: React.ReactNode;
69
- /**
70
- * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
71
- */
72
- inputProps?: SwitchBaseProps['inputProps'];
73
- /**
74
- * Pass a ref to the `input` element.
75
- */
76
- inputRef?: React.Ref<HTMLInputElement>;
77
111
  /**
78
112
  * Callback fired when the state is changed.
79
113
  *
@@ -103,6 +137,8 @@ export interface CheckboxProps
103
137
  value?: SwitchBaseProps['value'];
104
138
  }
105
139
 
140
+ export interface CheckboxOwnerState extends Omit<CheckboxProps, 'slots' | 'slotProps'> {}
141
+
106
142
  /**
107
143
  *
108
144
  * Demos:
@@ -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
  */
@@ -6,7 +6,7 @@ import { PaperProps } from '../Paper';
6
6
  import { ModalProps } from '../Modal';
7
7
  import { TransitionProps } from '../transitions/transition';
8
8
  import { DialogClasses } from './dialogClasses';
9
- import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
9
+ import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from '../utils/types';
10
10
 
11
11
  export interface DialogSlots {
12
12
  /**
@@ -66,9 +66,9 @@ export type DialogSlotsAndSlotProps = CreateSlotsAndSlotProps<
66
66
  * Props forwarded to the transition slot.
67
67
  * By default, the avaible props are based on the [Fade](https://mui.com/material-ui/api/fade/#props) component.
68
68
  */
69
- transition: SlotProps<
70
- React.ElementType<TransitionProps>,
71
- DialogTransitionSlotPropsOverrides,
69
+ transition: SlotComponentProps<
70
+ React.ElementType,
71
+ TransitionProps & DialogTransitionSlotPropsOverrides,
72
72
  DialogOwnerState
73
73
  >;
74
74
  /**
@@ -1,13 +1,99 @@
1
1
  import * as React from 'react';
2
2
  import { SxProps } from '@mui/system';
3
3
  import { InternalStandardProps as StandardProps, Theme } from '..';
4
+ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
4
5
  import { ModalProps } from '../Modal';
6
+ import { BackdropProps } from '../Backdrop';
5
7
  import { SlideProps } from '../Slide';
6
8
  import { PaperProps } from '../Paper';
7
9
  import { TransitionProps } from '../transitions/transition';
8
10
  import { DrawerClasses } from './drawerClasses';
9
11
 
10
- export interface DrawerProps extends StandardProps<ModalProps, 'open' | 'children'> {
12
+ export interface DrawerRootSlotPropsOverrides {}
13
+
14
+ export interface DrawerDockedSlotPropsOverrides {}
15
+
16
+ export interface DrawerPaperSlotPropsOverrides {}
17
+
18
+ export interface DrawerTransitionSlotPropsOverrides {}
19
+
20
+ export interface DrawerBackdropSlotPropsOverrides {}
21
+
22
+ export interface DrawerSlots {
23
+ /**
24
+ * The component used for the root when the variant is `temporary`.
25
+ * @default Modal
26
+ */
27
+ root: React.ElementType;
28
+ /**
29
+ * The component used for the Modal backdrop.
30
+ * @default Backdrop
31
+ */
32
+ backdrop: React.ElementType;
33
+ /**
34
+ * The component used for the root element when the variant is `permanent` or `persistent`.
35
+ * @default div
36
+ */
37
+ docked: React.ElementType;
38
+ /**
39
+ * The component used for the paper.
40
+ * @default Paper
41
+ */
42
+ paper: React.ElementType;
43
+ /**
44
+ * The component used for the transition.
45
+ * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
46
+ * @default Slide
47
+ */
48
+ transition: React.ElementType;
49
+ }
50
+
51
+ export type DrawerSlotsAndSlotProps = CreateSlotsAndSlotProps<
52
+ DrawerSlots,
53
+ {
54
+ /**
55
+ * Props forwarded to the root slot.
56
+ * By default, the avaible props are based on the [Modal](https://mui.com/material-ui/api/modal/#props) component.
57
+ */
58
+ root: SlotProps<React.ElementType<ModalProps>, DrawerRootSlotPropsOverrides, DrawerOwnerState>;
59
+ /**
60
+ * Props forwarded to the backdrop slot.
61
+ * By default, the avaible props are based on the [Backdrop](https://mui.com/material-ui/api/backdrop/#props) component.
62
+ */
63
+ backdrop: SlotProps<
64
+ React.ElementType<BackdropProps>,
65
+ DrawerBackdropSlotPropsOverrides,
66
+ DrawerOwnerState
67
+ >;
68
+ /**
69
+ * Props forwarded to the docked slot.
70
+ * By default, the avaible props are based on a div element.
71
+ */
72
+ docked: SlotProps<'div', DrawerDockedSlotPropsOverrides, DrawerOwnerState>;
73
+ /**
74
+ * Props forwarded to the paper slot.
75
+ * By default, the avaible props are based on the [Paper](https://mui.com/material-ui/api/paper/#props) component.
76
+ */
77
+ paper: SlotProps<
78
+ React.ElementType<PaperProps>,
79
+ DrawerPaperSlotPropsOverrides,
80
+ DrawerOwnerState
81
+ >;
82
+ /**
83
+ * Props forwarded to the transition slot.
84
+ * By default, the avaible props are based on the [Slide](https://mui.com/material-ui/api/slide/#props) component.
85
+ */
86
+ transition: SlotProps<
87
+ React.ElementType,
88
+ TransitionProps & DrawerTransitionSlotPropsOverrides,
89
+ DrawerOwnerState
90
+ >;
91
+ }
92
+ >;
93
+
94
+ export interface DrawerProps
95
+ extends StandardProps<ModalProps, 'open' | 'children' | 'slots' | 'slotProps'>,
96
+ DrawerSlotsAndSlotProps {
11
97
  /**
12
98
  * Side from which the drawer will appear.
13
99
  * @default 'left'
@@ -46,11 +132,13 @@ export interface DrawerProps extends StandardProps<ModalProps, 'open' | 'childre
46
132
  open?: boolean;
47
133
  /**
48
134
  * Props applied to the [`Paper`](https://mui.com/material-ui/api/paper/) element.
135
+ * @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.
49
136
  * @default {}
50
137
  */
51
138
  PaperProps?: Partial<PaperProps<React.ElementType>>;
52
139
  /**
53
140
  * Props applied to the [`Slide`](https://mui.com/material-ui/api/slide/) element.
141
+ * @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.
54
142
  */
55
143
  SlideProps?: Partial<SlideProps>;
56
144
  /**
@@ -73,6 +161,9 @@ export interface DrawerProps extends StandardProps<ModalProps, 'open' | 'childre
73
161
  variant?: 'permanent' | 'persistent' | 'temporary';
74
162
  }
75
163
 
164
+ // omit `slots` and `slotProps` to prevent recusion
165
+ export interface DrawerOwnerState extends Omit<DrawerProps, 'slots' | 'slotProps'> {}
166
+
76
167
  /**
77
168
  * The props of the [Modal](https://mui.com/material-ui/api/modal/) component are available
78
169
  * when `variant="temporary"` is set.