@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
@@ -5,8 +5,81 @@ import { InternalStandardProps as StandardProps } from '..';
5
5
  import { FabProps } from '../Fab';
6
6
  import { TooltipProps } from '../Tooltip';
7
7
  import { SpeedDialActionClasses } from './speedDialActionClasses';
8
+ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
8
9
 
9
- export interface SpeedDialActionProps extends StandardProps<Partial<TooltipProps>, 'children'> {
10
+ export interface SpeedDialActionSlots {
11
+ /**
12
+ * The component that renders the fab.
13
+ * @default Fab
14
+ */
15
+ fab?: React.ElementType;
16
+ /**
17
+ * The component that renders the tooltip.
18
+ * @default Tooltip
19
+ */
20
+ tooltip?: React.ElementType;
21
+ /**
22
+ * The component that renders the static tooltip.
23
+ * @default 'span'
24
+ */
25
+ staticTooltip?: React.ElementType;
26
+ /**
27
+ * The component that renders the static tooltip label.
28
+ * @default 'span'
29
+ */
30
+ staticTooltipLabel?: React.ElementType;
31
+ }
32
+
33
+ export interface SpeedDialActionFabSlotPropsOverrides {}
34
+ export interface SpeedDialActionTooltipSlotPropsOverrides {}
35
+ export interface SpeedDialActionStaticTooltipSlotPropsOverrides {}
36
+ export interface SpeedDialActionStaticTooltipLabelSlotPropsOverrides {}
37
+
38
+ export type SpeedDialActionSlotsAndSlotProps = CreateSlotsAndSlotProps<
39
+ SpeedDialActionSlots,
40
+ {
41
+ /**
42
+ * Props forwarded to the fab slot.
43
+ * By default, the avaible props are based on the [Fab](https://mui.com/material-ui/api/fab/#props) component.
44
+ */
45
+ fab: SlotProps<
46
+ React.ElementType<FabProps>,
47
+ SpeedDialActionFabSlotPropsOverrides,
48
+ SpeedDialActionOwnerState
49
+ >;
50
+ /**
51
+ * Props forwarded to the tooltip slot.
52
+ * By default, the avaible props are based on the [Tooltip](https://mui.com/material-ui/api/tooltip/#props) component.
53
+ */
54
+ tooltip: SlotProps<
55
+ React.ElementType<TooltipProps>,
56
+ SpeedDialActionTooltipSlotPropsOverrides,
57
+ SpeedDialActionOwnerState
58
+ >;
59
+ /**
60
+ * Props forwarded to the static tooltip slot.
61
+ * By default, the avaible props are based on a span element.
62
+ */
63
+ staticTooltip: SlotProps<
64
+ 'span',
65
+ SpeedDialActionStaticTooltipSlotPropsOverrides,
66
+ SpeedDialActionOwnerState
67
+ >;
68
+ /**
69
+ * Props forwarded to the static tooltip label slot.
70
+ * By default, the avaible props are based on a span element.
71
+ */
72
+ staticTooltipLabel: SlotProps<
73
+ 'span',
74
+ SpeedDialActionStaticTooltipLabelSlotPropsOverrides,
75
+ SpeedDialActionOwnerState
76
+ >;
77
+ }
78
+ >;
79
+
80
+ export interface SpeedDialActionProps
81
+ extends Omit<StandardProps<Partial<TooltipProps>, 'children'>, 'slotProps' | 'slots'>,
82
+ SpeedDialActionSlotsAndSlotProps {
10
83
  /**
11
84
  * Override or extend the styles applied to the component.
12
85
  */
@@ -14,6 +87,7 @@ export interface SpeedDialActionProps extends StandardProps<Partial<TooltipProps
14
87
  /**
15
88
  * Props applied to the [`Fab`](https://mui.com/material-ui/api/fab/) component.
16
89
  * @default {}
90
+ * @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.
17
91
  */
18
92
  FabProps?: Partial<FabProps>;
19
93
  /**
@@ -31,20 +105,24 @@ export interface SpeedDialActionProps extends StandardProps<Partial<TooltipProps
31
105
  sx?: SxProps<Theme>;
32
106
  /**
33
107
  * `classes` prop applied to the [`Tooltip`](https://mui.com/material-ui/api/tooltip/) element.
108
+ * @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.
34
109
  */
35
110
  TooltipClasses?: TooltipProps['classes'];
36
111
  /**
37
112
  * Placement of the tooltip.
38
113
  * @default 'left'
114
+ * @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.
39
115
  */
40
116
  tooltipPlacement?: TooltipProps['placement'];
41
117
  /**
42
118
  * Label to display in the tooltip.
119
+ * @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.
43
120
  */
44
121
  tooltipTitle?: React.ReactNode;
45
122
  /**
46
123
  * Make the tooltip always visible when the SpeedDial is open.
47
124
  * @default false
125
+ * @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.
48
126
  */
49
127
  tooltipOpen?: boolean;
50
128
  }
@@ -61,3 +139,6 @@ export interface SpeedDialActionProps extends StandardProps<Partial<TooltipProps
61
139
  * - inherits [Tooltip API](https://mui.com/material-ui/api/tooltip/)
62
140
  */
63
141
  export default function SpeedDialAction(props: SpeedDialActionProps): React.JSX.Element;
142
+
143
+ export interface SpeedDialActionOwnerState
144
+ extends Omit<SpeedDialActionProps, 'slots' | 'slotProps'> {}
@@ -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;
@@ -4,7 +4,7 @@ import { CollapseProps, InternalStandardProps as StandardProps } from '..';
4
4
  import { Theme } from '../styles';
5
5
  import { TransitionProps } from '../transitions/transition';
6
6
  import { StepContentClasses } from './stepContentClasses';
7
- import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
7
+ import { CreateSlotsAndSlotProps, SlotComponentProps } from '../utils/types';
8
8
 
9
9
  export interface StepContentSlots {
10
10
  /**
@@ -24,7 +24,7 @@ export type StepContentSlotsAndSlotProps = CreateSlotsAndSlotProps<
24
24
  * Props forwared to the transition slot.
25
25
  * By default, the available props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component
26
26
  */
27
- transition: SlotProps<React.ElementType<CollapseProps>, {}, StepContentOwnerState>;
27
+ transition: SlotComponentProps<React.ElementType, CollapseProps, StepContentOwnerState>;
28
28
  }
29
29
  >;
30
30
 
@@ -1,7 +1,32 @@
1
1
  import * as React from 'react';
2
- import { DrawerProps } from '../Drawer';
2
+ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
3
+ import { DrawerProps, DrawerOwnerState, DrawerSlotsAndSlotProps } from '../Drawer';
3
4
 
4
- export interface SwipeableDrawerProps extends Omit<DrawerProps, 'onClose' | 'open'> {
5
+ export interface SwipeableDrawerSwipeAreaSlotPropsOverrides {}
6
+
7
+ export interface SwipeableDrawerSlots {
8
+ /**
9
+ * The component used for the swipeArea slot.
10
+ * @default div
11
+ */
12
+ swipeArea?: React.ElementType;
13
+ }
14
+
15
+ type SwipeableDrawerSlotsAndSlotProps = DrawerSlotsAndSlotProps &
16
+ CreateSlotsAndSlotProps<
17
+ SwipeableDrawerSlots,
18
+ {
19
+ /**
20
+ * Props forwarded to the docked slot.
21
+ * By default, the avaible props are based on a div element.
22
+ */
23
+ swipeArea: SlotProps<'div', SwipeableDrawerSwipeAreaSlotPropsOverrides, DrawerOwnerState>;
24
+ }
25
+ >;
26
+
27
+ export interface SwipeableDrawerProps
28
+ extends Omit<DrawerProps, 'onClose' | 'open' | 'slots' | 'slotProps'>,
29
+ SwipeableDrawerSlotsAndSlotProps {
5
30
  /**
6
31
  * If set to true, the swipe event will open the drawer even if the user begins the swipe on one of the drawer's children.
7
32
  * This can be useful in scenarios where the drawer is partially visible.
@@ -67,6 +92,7 @@ export interface SwipeableDrawerProps extends Omit<DrawerProps, 'onClose' | 'ope
67
92
  open?: boolean;
68
93
  /**
69
94
  * The element is used to intercept the touch events on the edge.
95
+ * @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.
70
96
  */
71
97
  SwipeAreaProps?: object;
72
98
  /**
@@ -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
  /**
package/Switch/Switch.js CHANGED
@@ -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
  /**