@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
@@ -3,7 +3,6 @@
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import composeClasses from '@mui/utils/composeClasses';
6
- import useSlotProps from '@mui/utils/useSlotProps';
7
6
  import useSnackbar from "./useSnackbar.js";
8
7
  import ClickAwayListener from "../ClickAwayListener/index.js";
9
8
  import { styled, useTheme } from "../zero-styled/index.js";
@@ -13,6 +12,7 @@ import capitalize from "../utils/capitalize.js";
13
12
  import Grow from "../Grow/index.js";
14
13
  import SnackbarContent from "../SnackbarContent/index.js";
15
14
  import { getSnackbarUtilityClass } from "./snackbarClasses.js";
15
+ import useSlot from "../utils/useSlot.js";
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
17
  const useUtilityClasses = ownerState => {
18
18
  const {
@@ -120,8 +120,8 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
120
120
  autoHideDuration = null,
121
121
  children,
122
122
  className,
123
- ClickAwayListenerProps,
124
- ContentProps,
123
+ ClickAwayListenerProps: ClickAwayListenerPropsProp,
124
+ ContentProps: ContentPropsProp,
125
125
  disableWindowBlurListener = false,
126
126
  message,
127
127
  onBlur,
@@ -131,12 +131,14 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
131
131
  onMouseLeave,
132
132
  open,
133
133
  resumeHideDuration,
134
- TransitionComponent = Grow,
134
+ slots = {},
135
+ slotProps = {},
136
+ TransitionComponent: TransitionComponentProp,
135
137
  transitionDuration = defaultTransitionDuration,
136
138
  TransitionProps: {
137
139
  onEnter,
138
140
  onExited,
139
- ...TransitionProps
141
+ ...TransitionPropsProp
140
142
  } = {},
141
143
  ...other
142
144
  } = props;
@@ -148,7 +150,7 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
148
150
  },
149
151
  autoHideDuration,
150
152
  disableWindowBlurListener,
151
- TransitionComponent,
153
+ TransitionComponent: TransitionComponentProp,
152
154
  transitionDuration
153
155
  };
154
156
  const classes = useUtilityClasses(ownerState);
@@ -159,16 +161,6 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
159
161
  ...ownerState
160
162
  });
161
163
  const [exited, setExited] = React.useState(true);
162
- const rootProps = useSlotProps({
163
- elementType: SnackbarRoot,
164
- getSlotProps: getRootProps,
165
- externalForwardedProps: other,
166
- ownerState,
167
- additionalProps: {
168
- ref
169
- },
170
- className: [classes.root, className]
171
- });
172
164
  const handleExited = node => {
173
165
  setExited(true);
174
166
  if (onExited) {
@@ -181,28 +173,84 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
181
173
  onEnter(node, isAppearing);
182
174
  }
183
175
  };
176
+ const externalForwardedProps = {
177
+ slots: {
178
+ transition: TransitionComponentProp,
179
+ ...slots
180
+ },
181
+ slotProps: {
182
+ content: ContentPropsProp,
183
+ clickAwayListener: ClickAwayListenerPropsProp,
184
+ transition: TransitionPropsProp,
185
+ ...slotProps
186
+ }
187
+ };
188
+ const [Root, rootProps] = useSlot('root', {
189
+ ref,
190
+ className: [classes.root, className],
191
+ elementType: SnackbarRoot,
192
+ getSlotProps: getRootProps,
193
+ externalForwardedProps: {
194
+ ...externalForwardedProps,
195
+ ...other
196
+ },
197
+ ownerState
198
+ });
199
+ const [ClickAwaySlot, clickAwayListenerProps] = useSlot('clickAwayListener', {
200
+ elementType: ClickAwayListener,
201
+ externalForwardedProps,
202
+ getSlotProps: handlers => ({
203
+ onClickAway: (...params) => {
204
+ handlers.onClickAway?.(...params);
205
+ onClickAway(...params);
206
+ }
207
+ }),
208
+ ownerState
209
+ });
210
+ const [ContentSlot, contentSlotProps] = useSlot('content', {
211
+ elementType: SnackbarContent,
212
+ shouldForwardComponentProp: true,
213
+ externalForwardedProps,
214
+ additionalProps: {
215
+ message,
216
+ action
217
+ },
218
+ ownerState
219
+ });
220
+ const [TransitionSlot, transitionProps] = useSlot('transition', {
221
+ elementType: Grow,
222
+ externalForwardedProps,
223
+ getSlotProps: handlers => ({
224
+ onEnter: (...params) => {
225
+ handlers.onEnter?.(...params);
226
+ handleEnter(...params);
227
+ },
228
+ onExited: (...params) => {
229
+ handlers.onExited?.(...params);
230
+ handleExited(...params);
231
+ }
232
+ }),
233
+ additionalProps: {
234
+ appear: true,
235
+ in: open,
236
+ timeout: transitionDuration,
237
+ direction: vertical === 'top' ? 'down' : 'up'
238
+ },
239
+ ownerState
240
+ });
184
241
 
185
242
  // So we only render active snackbars.
186
243
  if (!open && exited) {
187
244
  return null;
188
245
  }
189
- return /*#__PURE__*/_jsx(ClickAwayListener, {
190
- onClickAway: onClickAway,
191
- ...ClickAwayListenerProps,
192
- children: /*#__PURE__*/_jsx(SnackbarRoot, {
246
+ return /*#__PURE__*/_jsx(ClickAwaySlot, {
247
+ ...clickAwayListenerProps,
248
+ children: /*#__PURE__*/_jsx(Root, {
193
249
  ...rootProps,
194
- children: /*#__PURE__*/_jsx(TransitionComponent, {
195
- appear: true,
196
- in: open,
197
- timeout: transitionDuration,
198
- direction: vertical === 'top' ? 'down' : 'up',
199
- onEnter: handleEnter,
200
- onExited: handleExited,
201
- ...TransitionProps,
202
- children: children || /*#__PURE__*/_jsx(SnackbarContent, {
203
- message: message,
204
- action: action,
205
- ...ContentProps
250
+ children: /*#__PURE__*/_jsx(TransitionSlot, {
251
+ ...transitionProps,
252
+ children: children || /*#__PURE__*/_jsx(ContentSlot, {
253
+ ...contentSlotProps
206
254
  })
207
255
  })
208
256
  })
@@ -249,10 +297,12 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes *
249
297
  className: PropTypes.string,
250
298
  /**
251
299
  * Props applied to the `ClickAwayListener` element.
300
+ * @deprecated Use `slotProps.clickAwayListener` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
252
301
  */
253
302
  ClickAwayListenerProps: PropTypes.object,
254
303
  /**
255
304
  * Props applied to the [`SnackbarContent`](https://mui.com/material-ui/api/snackbar-content/) element.
305
+ * @deprecated Use `slotProps.content` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
256
306
  */
257
307
  ContentProps: PropTypes.object,
258
308
  /**
@@ -309,6 +359,32 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes *
309
359
  * we default to `autoHideDuration / 2` ms.
310
360
  */
311
361
  resumeHideDuration: PropTypes.number,
362
+ /**
363
+ * The props used for each slot inside.
364
+ * @default {}
365
+ */
366
+ slotProps: PropTypes.shape({
367
+ clickAwayListener: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
368
+ children: PropTypes.element.isRequired,
369
+ disableReactTree: PropTypes.bool,
370
+ mouseEvent: PropTypes.oneOf(['onClick', 'onMouseDown', 'onMouseUp', 'onPointerDown', 'onPointerUp', false]),
371
+ onClickAway: PropTypes.func,
372
+ touchEvent: PropTypes.oneOf(['onTouchEnd', 'onTouchStart', false])
373
+ })]),
374
+ content: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
375
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
376
+ transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
377
+ }),
378
+ /**
379
+ * The components used for each slot inside.
380
+ * @default {}
381
+ */
382
+ slots: PropTypes.shape({
383
+ clickAwayListener: PropTypes.elementType,
384
+ content: PropTypes.elementType,
385
+ root: PropTypes.elementType,
386
+ transition: PropTypes.elementType
387
+ }),
312
388
  /**
313
389
  * The system prop that allows defining system overrides as well as additional CSS styles.
314
390
  */
@@ -316,6 +392,7 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes *
316
392
  /**
317
393
  * The component used for the transition.
318
394
  * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
395
+ * @deprecated Use `slots.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
319
396
  * @default Grow
320
397
  */
321
398
  TransitionComponent: PropTypes.elementType,
@@ -335,6 +412,7 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes *
335
412
  /**
336
413
  * Props applied to the transition element.
337
414
  * By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
415
+ * @deprecated Use `slotProps.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
338
416
  * @default {}
339
417
  */
340
418
  TransitionProps: PropTypes.object
@@ -13,6 +13,8 @@ import Fab from "../Fab/index.js";
13
13
  import Tooltip from "../Tooltip/index.js";
14
14
  import capitalize from "../utils/capitalize.js";
15
15
  import speedDialActionClasses, { getSpeedDialActionUtilityClass } from "./speedDialActionClasses.js";
16
+ import useSlot from "../utils/useSlot.js";
17
+ import { mergeSlotProps } from "../utils/index.js";
16
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
19
  const useUtilityClasses = ownerState => {
18
20
  const {
@@ -147,6 +149,8 @@ const SpeedDialAction = /*#__PURE__*/React.forwardRef(function SpeedDialAction(i
147
149
  tooltipOpen: tooltipOpenProp = false,
148
150
  tooltipPlacement = 'left',
149
151
  tooltipTitle,
152
+ slots = {},
153
+ slotProps = {},
150
154
  ...other
151
155
  } = props;
152
156
  const ownerState = {
@@ -154,7 +158,20 @@ const SpeedDialAction = /*#__PURE__*/React.forwardRef(function SpeedDialAction(i
154
158
  tooltipPlacement
155
159
  };
156
160
  const classes = useUtilityClasses(ownerState);
157
- const [tooltipOpen, setTooltipOpen] = React.useState(tooltipOpenProp);
161
+ const externalForwardedProps = {
162
+ slots,
163
+ slotProps: {
164
+ fab: FabProps,
165
+ ...slotProps,
166
+ tooltip: mergeSlotProps(typeof slotProps.tooltip === 'function' ? slotProps.tooltip(ownerState) : slotProps.tooltip, {
167
+ title: tooltipTitle,
168
+ open: tooltipOpenProp,
169
+ placement: tooltipPlacement,
170
+ classes: TooltipClasses
171
+ })
172
+ }
173
+ };
174
+ const [tooltipOpen, setTooltipOpen] = React.useState(externalForwardedProps.slotProps.tooltip?.open);
158
175
  const handleTooltipClose = () => {
159
176
  setTooltipOpen(false);
160
177
  };
@@ -164,32 +181,71 @@ const SpeedDialAction = /*#__PURE__*/React.forwardRef(function SpeedDialAction(i
164
181
  const transitionStyle = {
165
182
  transitionDelay: `${delay}ms`
166
183
  };
167
- const fab = /*#__PURE__*/_jsx(SpeedDialActionFab, {
168
- size: "small",
184
+ const [FabSlot, fabSlotProps] = useSlot('fab', {
185
+ elementType: SpeedDialActionFab,
186
+ externalForwardedProps,
187
+ ownerState,
188
+ shouldForwardComponentProp: true,
169
189
  className: clsx(classes.fab, className),
170
- tabIndex: -1,
171
- role: "menuitem",
172
- ownerState: ownerState,
173
- ...FabProps,
174
- style: {
175
- ...transitionStyle,
176
- ...FabProps.style
190
+ additionalProps: {
191
+ style: transitionStyle,
192
+ tabIndex: -1,
193
+ role: 'menuitem',
194
+ size: 'small'
195
+ }
196
+ });
197
+ const [TooltipSlot, tooltipSlotProps] = useSlot('tooltip', {
198
+ elementType: Tooltip,
199
+ externalForwardedProps,
200
+ shouldForwardComponentProp: true,
201
+ ref,
202
+ additionalProps: {
203
+ id
177
204
  },
205
+ ownerState,
206
+ getSlotProps: handlers => ({
207
+ ...handlers,
208
+ onClose: event => {
209
+ handlers.onClose?.(event);
210
+ handleTooltipClose();
211
+ },
212
+ onOpen: event => {
213
+ handlers.onOpen?.(event);
214
+ handleTooltipOpen();
215
+ }
216
+ })
217
+ });
218
+ const [StaticTooltipSlot, staticTooltipSlotProps] = useSlot('staticTooltip', {
219
+ elementType: SpeedDialActionStaticTooltip,
220
+ externalForwardedProps,
221
+ ownerState,
222
+ ref,
223
+ className: classes.staticTooltip,
224
+ additionalProps: {
225
+ id
226
+ }
227
+ });
228
+ const [StaticTooltipLabelSlot, staticTooltipLabelSlotProps] = useSlot('staticTooltipLabel', {
229
+ elementType: SpeedDialActionStaticTooltipLabel,
230
+ externalForwardedProps,
231
+ ownerState,
232
+ className: classes.staticTooltipLabel,
233
+ additionalProps: {
234
+ style: transitionStyle,
235
+ id: `${id}-label`
236
+ }
237
+ });
238
+ const fab = /*#__PURE__*/_jsx(FabSlot, {
239
+ ...fabSlotProps,
178
240
  children: icon
179
241
  });
180
- if (tooltipOpenProp) {
181
- return /*#__PURE__*/_jsxs(SpeedDialActionStaticTooltip, {
182
- id: id,
183
- ref: ref,
184
- className: classes.staticTooltip,
185
- ownerState: ownerState,
242
+ if (tooltipSlotProps.open) {
243
+ return /*#__PURE__*/_jsxs(StaticTooltipSlot, {
244
+ ...staticTooltipSlotProps,
186
245
  ...other,
187
- children: [/*#__PURE__*/_jsx(SpeedDialActionStaticTooltipLabel, {
188
- style: transitionStyle,
189
- id: `${id}-label`,
190
- className: classes.staticTooltipLabel,
191
- ownerState: ownerState,
192
- children: tooltipTitle
246
+ children: [/*#__PURE__*/_jsx(StaticTooltipLabelSlot, {
247
+ ...staticTooltipLabelSlotProps,
248
+ children: tooltipSlotProps.title
193
249
  }), /*#__PURE__*/React.cloneElement(fab, {
194
250
  'aria-labelledby': `${id}-label`
195
251
  })]
@@ -198,15 +254,12 @@ const SpeedDialAction = /*#__PURE__*/React.forwardRef(function SpeedDialAction(i
198
254
  if (!open && tooltipOpen) {
199
255
  setTooltipOpen(false);
200
256
  }
201
- return /*#__PURE__*/_jsx(Tooltip, {
202
- id: id,
203
- ref: ref,
204
- title: tooltipTitle,
205
- placement: tooltipPlacement,
206
- onClose: handleTooltipClose,
207
- onOpen: handleTooltipOpen,
257
+ return /*#__PURE__*/_jsx(TooltipSlot, {
258
+ ...tooltipSlotProps,
259
+ title: tooltipSlotProps.title,
208
260
  open: open && tooltipOpen,
209
- classes: TooltipClasses,
261
+ placement: tooltipSlotProps.placement,
262
+ classes: tooltipSlotProps.classes,
210
263
  ...other,
211
264
  children: fab
212
265
  });
@@ -232,6 +285,7 @@ process.env.NODE_ENV !== "production" ? SpeedDialAction.propTypes /* remove-prop
232
285
  /**
233
286
  * Props applied to the [`Fab`](https://mui.com/material-ui/api/fab/) component.
234
287
  * @default {}
288
+ * @deprecated Use `slotProps.fab` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
235
289
  */
236
290
  FabProps: PropTypes.object,
237
291
  /**
@@ -247,26 +301,50 @@ process.env.NODE_ENV !== "production" ? SpeedDialAction.propTypes /* remove-prop
247
301
  * If `true`, the component is shown.
248
302
  */
249
303
  open: PropTypes.bool,
304
+ /**
305
+ * The props used for each slot inside.
306
+ * @default {}
307
+ */
308
+ slotProps: PropTypes.shape({
309
+ fab: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
310
+ staticTooltip: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
311
+ staticTooltipLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
312
+ tooltip: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
313
+ }),
314
+ /**
315
+ * The components used for each slot inside.
316
+ * @default {}
317
+ */
318
+ slots: PropTypes.shape({
319
+ fab: PropTypes.elementType,
320
+ staticTooltip: PropTypes.elementType,
321
+ staticTooltipLabel: PropTypes.elementType,
322
+ tooltip: PropTypes.elementType
323
+ }),
250
324
  /**
251
325
  * The system prop that allows defining system overrides as well as additional CSS styles.
252
326
  */
253
327
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
254
328
  /**
255
329
  * `classes` prop applied to the [`Tooltip`](https://mui.com/material-ui/api/tooltip/) element.
330
+ * @deprecated Use `slotProps.tooltip.classes` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
256
331
  */
257
332
  TooltipClasses: PropTypes.object,
258
333
  /**
259
334
  * Make the tooltip always visible when the SpeedDial is open.
260
335
  * @default false
336
+ * @deprecated Use `slotProps.tooltip.open` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
261
337
  */
262
338
  tooltipOpen: PropTypes.bool,
263
339
  /**
264
340
  * Placement of the tooltip.
265
341
  * @default 'left'
342
+ * @deprecated Use `slotProps.tooltip.placement` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
266
343
  */
267
344
  tooltipPlacement: PropTypes.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
268
345
  /**
269
346
  * Label to display in the tooltip.
347
+ * @deprecated Use `slotProps.tooltip.title` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
270
348
  */
271
349
  tooltipTitle: PropTypes.node
272
350
  } : void 0;
@@ -14,6 +14,8 @@ import useEnhancedEffect from "../utils/useEnhancedEffect.js";
14
14
  import { useTheme } from "../zero-styled/index.js";
15
15
  import { useDefaultProps } from "../DefaultPropsProvider/index.js";
16
16
  import { getTransitionProps } from "../transitions/utils.js";
17
+ import { mergeSlotProps } from "../utils/index.js";
18
+ import useSlot from "../utils/useSlot.js";
17
19
  import SwipeArea from "./SwipeArea.js";
18
20
 
19
21
  // This value is closed to what browsers are using internally to
@@ -145,6 +147,8 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
145
147
  transitionDuration = transitionDurationDefault,
146
148
  variant = 'temporary',
147
149
  // Mobile first.
150
+ slots = {},
151
+ slotProps = {},
148
152
  ...other
149
153
  } = props;
150
154
  const [maybeSwiping, setMaybeSwiping] = React.useState(false);
@@ -450,6 +454,22 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
450
454
  setMaybeSwiping(false);
451
455
  }
452
456
  }, [open]);
457
+ const [SwipeAreaSlot, swipeAreaSlotProps] = useSlot('swipeArea', {
458
+ ref: swipeAreaRef,
459
+ elementType: SwipeArea,
460
+ ownerState: props,
461
+ externalForwardedProps: {
462
+ slots,
463
+ slotProps: {
464
+ swipeArea: SwipeAreaProps,
465
+ ...slotProps
466
+ }
467
+ },
468
+ additionalProps: {
469
+ width: swipeAreaWidth,
470
+ anchor
471
+ }
472
+ });
453
473
  return /*#__PURE__*/_jsxs(React.Fragment, {
454
474
  children: [/*#__PURE__*/_jsx(Drawer, {
455
475
  open: variant === 'temporary' && maybeSwiping ? true : open,
@@ -467,25 +487,27 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
467
487
  ...ModalPropsProp
468
488
  },
469
489
  hideBackdrop: hideBackdrop,
470
- PaperProps: {
471
- ...PaperProps,
472
- style: {
473
- pointerEvents: variant === 'temporary' && !open && !allowSwipeInChildren ? 'none' : '',
474
- ...PaperProps.style
475
- },
476
- ref: handleRef
477
- },
478
490
  anchor: anchor,
479
491
  transitionDuration: calculatedDurationRef.current || transitionDuration,
480
492
  onClose: onClose,
481
493
  ref: ref,
494
+ slots: slots,
495
+ slotProps: {
496
+ ...slotProps,
497
+ backdrop: mergeSlotProps(slotProps.backdrop ?? BackdropProps, {
498
+ ref: backdropRef
499
+ }),
500
+ paper: mergeSlotProps(slotProps.paper ?? PaperProps, {
501
+ style: {
502
+ pointerEvents: variant === 'temporary' && !open && !allowSwipeInChildren ? 'none' : ''
503
+ },
504
+ ref: handleRef
505
+ })
506
+ },
482
507
  ...other
483
508
  }), !disableSwipeToOpen && variant === 'temporary' && /*#__PURE__*/_jsx(NoSsr, {
484
- children: /*#__PURE__*/_jsx(SwipeArea, {
485
- anchor: anchor,
486
- ref: swipeAreaRef,
487
- width: swipeAreaWidth,
488
- ...SwipeAreaProps
509
+ children: /*#__PURE__*/_jsx(SwipeAreaSlot, {
510
+ ...swipeAreaSlotProps
489
511
  })
490
512
  })]
491
513
  });
@@ -583,8 +605,33 @@ process.env.NODE_ENV !== "production" ? SwipeableDrawer.propTypes /* remove-prop
583
605
  component: elementTypeAcceptingRef,
584
606
  style: PropTypes.object
585
607
  }),
608
+ /**
609
+ * The props used for each slot inside.
610
+ * @default {}
611
+ */
612
+ slotProps: PropTypes.shape({
613
+ backdrop: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
614
+ docked: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
615
+ paper: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
616
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
617
+ swipeArea: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
618
+ transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
619
+ }),
620
+ /**
621
+ * The components used for each slot inside.
622
+ * @default {}
623
+ */
624
+ slots: PropTypes.shape({
625
+ backdrop: PropTypes.elementType,
626
+ docked: PropTypes.elementType,
627
+ paper: PropTypes.elementType,
628
+ root: PropTypes.elementType,
629
+ swipeArea: PropTypes.elementType,
630
+ transition: PropTypes.elementType
631
+ }),
586
632
  /**
587
633
  * The element is used to intercept the touch events on the edge.
634
+ * @deprecated use the `slotProps.swipeArea` 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.
588
635
  */
589
636
  SwipeAreaProps: PropTypes.object,
590
637
  /**
@@ -305,10 +305,12 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
305
305
  id: PropTypes.string,
306
306
  /**
307
307
  * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
308
+ * @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.
308
309
  */
309
310
  inputProps: PropTypes.object,
310
311
  /**
311
312
  * Pass a ref to the `input` element.
313
+ * @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.
312
314
  */
313
315
  inputRef: refType,
314
316
  /**