@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.
Files changed (80) 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 +58 -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 +61 -16
  19. package/Rating/Rating.d.ts +59 -1
  20. package/Rating/Rating.js +131 -45
  21. package/Select/SelectInput.js +8 -8
  22. package/Snackbar/Snackbar.d.ts +79 -2
  23. package/Snackbar/Snackbar.js +110 -32
  24. package/SpeedDial/SpeedDial.d.ts +8 -6
  25. package/SpeedDialAction/SpeedDialAction.d.ts +82 -1
  26. package/SpeedDialAction/SpeedDialAction.js +108 -30
  27. package/StepContent/StepContent.d.ts +2 -2
  28. package/SwipeableDrawer/SwipeableDrawer.d.ts +28 -2
  29. package/SwipeableDrawer/SwipeableDrawer.js +60 -13
  30. package/Switch/Switch.js +2 -0
  31. package/Tabs/Tabs.d.ts +129 -29
  32. package/Tabs/Tabs.js +120 -52
  33. package/Tabs/tabsClasses.d.ts +4 -0
  34. package/Tabs/tabsClasses.js +1 -1
  35. package/Tooltip/Tooltip.d.ts +20 -12
  36. package/index.js +1 -1
  37. package/internal/SwitchBase.d.ts +35 -1
  38. package/internal/SwitchBase.js +84 -30
  39. package/modern/Checkbox/Checkbox.js +51 -21
  40. package/modern/Drawer/Drawer.js +108 -36
  41. package/modern/Menu/Menu.js +58 -19
  42. package/modern/Modal/Modal.js +9 -10
  43. package/modern/Popover/Popover.js +78 -51
  44. package/modern/Radio/Radio.js +61 -16
  45. package/modern/Rating/Rating.js +131 -45
  46. package/modern/Select/SelectInput.js +8 -8
  47. package/modern/Snackbar/Snackbar.js +110 -32
  48. package/modern/SpeedDialAction/SpeedDialAction.js +108 -30
  49. package/modern/SwipeableDrawer/SwipeableDrawer.js +60 -13
  50. package/modern/Switch/Switch.js +2 -0
  51. package/modern/Tabs/Tabs.js +120 -52
  52. package/modern/Tabs/tabsClasses.js +1 -1
  53. package/modern/index.js +1 -1
  54. package/modern/internal/SwitchBase.js +84 -30
  55. package/modern/styles/createThemeNoVars.js +7 -2
  56. package/modern/version/index.js +2 -2
  57. package/node/Checkbox/Checkbox.js +51 -21
  58. package/node/Drawer/Drawer.js +108 -36
  59. package/node/Menu/Menu.js +58 -19
  60. package/node/Modal/Modal.js +9 -10
  61. package/node/Popover/Popover.js +78 -51
  62. package/node/Radio/Radio.js +61 -16
  63. package/node/Rating/Rating.js +132 -46
  64. package/node/Select/SelectInput.js +8 -8
  65. package/node/Snackbar/Snackbar.js +110 -32
  66. package/node/SpeedDialAction/SpeedDialAction.js +108 -30
  67. package/node/SwipeableDrawer/SwipeableDrawer.js +60 -13
  68. package/node/Switch/Switch.js +2 -0
  69. package/node/Tabs/Tabs.js +120 -52
  70. package/node/Tabs/tabsClasses.js +1 -1
  71. package/node/index.js +1 -1
  72. package/node/internal/SwitchBase.js +84 -30
  73. package/node/styles/createThemeNoVars.js +7 -2
  74. package/node/version/index.js +2 -2
  75. package/package.json +5 -5
  76. package/styles/ThemeProvider.d.ts +6 -0
  77. package/styles/ThemeProviderWithVars.d.ts +1 -0
  78. package/styles/createThemeNoVars.js +7 -2
  79. package/styles/index.d.ts +1 -0
  80. 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
- 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
  */
@@ -14,6 +14,7 @@ import rootShouldForwardProp from "../styles/rootShouldForwardProp.js";
14
14
  import { styled } from "../zero-styled/index.js";
15
15
  import { useDefaultProps } from "../DefaultPropsProvider/index.js";
16
16
  import { getMenuUtilityClass } from "./menuClasses.js";
17
+ import useSlot from "../utils/useSlot.js";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
18
19
  const RTL_ORIGIN = {
19
20
  vertical: 'top',
@@ -145,20 +146,43 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
145
146
  }
146
147
  }
147
148
  });
148
- const PaperSlot = slots.paper ?? MenuPaper;
149
- const paperExternalSlotProps = slotProps.paper ?? PaperProps;
149
+ const externalForwardedProps = {
150
+ slots,
151
+ slotProps: {
152
+ list: MenuListProps,
153
+ transition: TransitionProps,
154
+ paper: PaperProps,
155
+ ...slotProps
156
+ }
157
+ };
150
158
  const rootSlotProps = useSlotProps({
151
159
  elementType: slots.root,
152
160
  externalSlotProps: slotProps.root,
153
161
  ownerState,
154
162
  className: [classes.root, className]
155
163
  });
156
- const paperSlotProps = useSlotProps({
157
- elementType: PaperSlot,
158
- externalSlotProps: paperExternalSlotProps,
159
- ownerState,
160
- className: classes.paper
164
+ const [PaperSlot, paperSlotProps] = useSlot('paper', {
165
+ className: classes.paper,
166
+ elementType: MenuPaper,
167
+ externalForwardedProps,
168
+ shouldForwardComponentProp: true,
169
+ ownerState
170
+ });
171
+ const [ListSlot, listSlotProps] = useSlot('list', {
172
+ className: clsx(classes.list, MenuListProps.className),
173
+ elementType: MenuMenuList,
174
+ shouldForwardComponentProp: true,
175
+ externalForwardedProps,
176
+ getSlotProps: handlers => ({
177
+ ...handlers,
178
+ onKeyDown: event => {
179
+ handleListKeyDown(event);
180
+ handlers.onKeyDown?.(event);
181
+ }
182
+ }),
183
+ ownerState
161
184
  });
185
+ const resolvedTransitionProps = typeof externalForwardedProps.slotProps.transition === 'function' ? externalForwardedProps.slotProps.transition(ownerState) : externalForwardedProps.slotProps.transition;
162
186
  return /*#__PURE__*/_jsx(MenuRoot, {
163
187
  onClose: onClose,
164
188
  anchorOrigin: {
@@ -167,31 +191,38 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
167
191
  },
168
192
  transformOrigin: isRtl ? RTL_ORIGIN : LTR_ORIGIN,
169
193
  slots: {
194
+ root: slots.root,
170
195
  paper: PaperSlot,
171
- root: slots.root
196
+ backdrop: slots.backdrop,
197
+ ...(slots.transition && {
198
+ // TODO: pass `slots.transition` directly once `TransitionComponent` is removed from Popover
199
+ transition: slots.transition
200
+ })
172
201
  },
173
202
  slotProps: {
174
203
  root: rootSlotProps,
175
- paper: paperSlotProps
204
+ paper: paperSlotProps,
205
+ backdrop: typeof slotProps.backdrop === 'function' ? slotProps.backdrop(ownerState) : slotProps.backdrop,
206
+ transition: {
207
+ ...resolvedTransitionProps,
208
+ onEntering: (...args) => {
209
+ handleEntering(...args);
210
+ resolvedTransitionProps?.onEntering?.(...args);
211
+ }
212
+ }
176
213
  },
177
214
  open: open,
178
215
  ref: ref,
179
216
  transitionDuration: transitionDuration,
180
- TransitionProps: {
181
- onEntering: handleEntering,
182
- ...TransitionProps
183
- },
184
217
  ownerState: ownerState,
185
218
  ...other,
186
219
  classes: PopoverClasses,
187
- children: /*#__PURE__*/_jsx(MenuMenuList, {
188
- onKeyDown: handleListKeyDown,
220
+ children: /*#__PURE__*/_jsx(ListSlot, {
189
221
  actions: menuListActionsRef,
190
222
  autoFocus: autoFocus && (activeItemIndex === -1 || disableAutoFocusItem),
191
223
  autoFocusItem: autoFocusItem,
192
224
  variant: variant,
193
- ...MenuListProps,
194
- className: clsx(classes.list, MenuListProps.className),
225
+ ...listSlotProps,
195
226
  children: children
196
227
  })
197
228
  });
@@ -236,6 +267,7 @@ process.env.NODE_ENV !== "production" ? Menu.propTypes /* remove-proptypes */ =
236
267
  disableAutoFocusItem: PropTypes.bool,
237
268
  /**
238
269
  * Props applied to the [`MenuList`](https://mui.com/material-ui/api/menu-list/) element.
270
+ * @deprecated use the `slotProps.list` 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.
239
271
  * @default {}
240
272
  */
241
273
  MenuListProps: PropTypes.object,
@@ -263,16 +295,22 @@ process.env.NODE_ENV !== "production" ? Menu.propTypes /* remove-proptypes */ =
263
295
  * @default {}
264
296
  */
265
297
  slotProps: PropTypes.shape({
298
+ backdrop: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
299
+ list: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
266
300
  paper: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
267
- root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
301
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
302
+ transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
268
303
  }),
269
304
  /**
270
305
  * The components used for each slot inside.
271
306
  * @default {}
272
307
  */
273
308
  slots: PropTypes.shape({
309
+ backdrop: PropTypes.elementType,
310
+ list: PropTypes.elementType,
274
311
  paper: PropTypes.elementType,
275
- root: PropTypes.elementType
312
+ root: PropTypes.elementType,
313
+ transition: PropTypes.elementType
276
314
  }),
277
315
  /**
278
316
  * The system prop that allows defining system overrides as well as additional CSS styles.
@@ -290,6 +328,7 @@ process.env.NODE_ENV !== "production" ? Menu.propTypes /* remove-proptypes */ =
290
328
  /**
291
329
  * Props applied to the transition element.
292
330
  * By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
331
+ * @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.
293
332
  * @default {}
294
333
  */
295
334
  TransitionProps: PropTypes.object,
@@ -15,7 +15,6 @@ import Backdrop from "../Backdrop/index.js";
15
15
  import useModal from "./useModal.js";
16
16
  import { getModalUtilityClass } from "./modalClasses.js";
17
17
  import useSlot from "../utils/useSlot.js";
18
- import { useForkRef } from "../utils/index.js";
19
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
19
  const useUtilityClasses = ownerState => {
21
20
  const {
@@ -158,7 +157,6 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
158
157
  childProps.onExited = onExited;
159
158
  }
160
159
  const externalForwardedProps = {
161
- ...other,
162
160
  slots: {
163
161
  root: components.Root,
164
162
  backdrop: components.Backdrop,
@@ -170,19 +168,22 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
170
168
  }
171
169
  };
172
170
  const [RootSlot, rootProps] = useSlot('root', {
171
+ ref,
173
172
  elementType: ModalRoot,
174
- externalForwardedProps,
175
- getSlotProps: getRootProps,
176
- additionalProps: {
177
- ref,
178
- as: component
173
+ externalForwardedProps: {
174
+ ...externalForwardedProps,
175
+ ...other,
176
+ component
179
177
  },
178
+ getSlotProps: getRootProps,
180
179
  ownerState,
181
180
  className: clsx(className, classes?.root, !ownerState.open && ownerState.exited && classes?.hidden)
182
181
  });
183
182
  const [BackdropSlot, backdropProps] = useSlot('backdrop', {
183
+ ref: BackdropProps?.ref,
184
184
  elementType: BackdropComponent,
185
185
  externalForwardedProps,
186
+ shouldForwardComponentProp: true,
186
187
  additionalProps: BackdropProps,
187
188
  getSlotProps: otherHandlers => {
188
189
  return getBackdropProps({
@@ -200,7 +201,6 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
200
201
  className: clsx(BackdropProps?.className, classes?.backdrop),
201
202
  ownerState
202
203
  });
203
- const backdropRef = useForkRef(BackdropProps?.ref, backdropProps.ref);
204
204
  if (!keepMounted && !open && (!hasTransition || exited)) {
205
205
  return null;
206
206
  }
@@ -211,8 +211,7 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
211
211
  children: /*#__PURE__*/_jsxs(RootSlot, {
212
212
  ...rootProps,
213
213
  children: [!hideBackdrop && BackdropComponent ? /*#__PURE__*/_jsx(BackdropSlot, {
214
- ...backdropProps,
215
- ref: backdropRef
214
+ ...backdropProps
216
215
  }) : null, /*#__PURE__*/_jsx(FocusTrap, {
217
216
  disableEnforceFocus: disableEnforceFocus,
218
217
  disableAutoFocus: disableAutoFocus,