@mui/material 6.4.4 → 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 (82) 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/Button/Button.js +3 -3
  5. package/CHANGELOG.md +63 -0
  6. package/CardHeader/CardHeader.d.ts +4 -20
  7. package/Checkbox/Checkbox.d.ts +45 -9
  8. package/Checkbox/Checkbox.js +51 -21
  9. package/Dialog/Dialog.d.ts +4 -4
  10. package/Drawer/Drawer.d.ts +92 -1
  11. package/Drawer/Drawer.js +108 -36
  12. package/IconButton/IconButton.js +3 -3
  13. package/InputBase/inputBaseClasses.d.ts +15 -6
  14. package/Menu/Menu.d.ts +88 -1
  15. package/Menu/Menu.js +58 -19
  16. package/Modal/Modal.js +9 -10
  17. package/Popover/Popover.d.ts +60 -6
  18. package/Popover/Popover.js +78 -51
  19. package/Radio/Radio.d.ts +45 -1
  20. package/Radio/Radio.js +59 -16
  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/Button/Button.js +3 -3
  40. package/modern/Checkbox/Checkbox.js +51 -21
  41. package/modern/Drawer/Drawer.js +108 -36
  42. package/modern/IconButton/IconButton.js +3 -3
  43. package/modern/Menu/Menu.js +58 -19
  44. package/modern/Modal/Modal.js +9 -10
  45. package/modern/Popover/Popover.js +78 -51
  46. package/modern/Radio/Radio.js +59 -16
  47. package/modern/Select/SelectInput.js +8 -8
  48. package/modern/Snackbar/Snackbar.js +110 -32
  49. package/modern/SpeedDialAction/SpeedDialAction.js +108 -30
  50. package/modern/SwipeableDrawer/SwipeableDrawer.js +60 -13
  51. package/modern/Switch/Switch.js +2 -0
  52. package/modern/Tabs/Tabs.js +120 -52
  53. package/modern/Tabs/tabsClasses.js +1 -1
  54. package/modern/index.js +1 -1
  55. package/modern/internal/SwitchBase.js +84 -30
  56. package/modern/styles/createThemeNoVars.js +7 -2
  57. package/modern/useAutocomplete/useAutocomplete.js +0 -1
  58. package/modern/version/index.js +2 -2
  59. package/node/Button/Button.js +3 -3
  60. package/node/Checkbox/Checkbox.js +51 -21
  61. package/node/Drawer/Drawer.js +108 -36
  62. package/node/IconButton/IconButton.js +3 -3
  63. package/node/Menu/Menu.js +58 -19
  64. package/node/Modal/Modal.js +9 -10
  65. package/node/Popover/Popover.js +78 -51
  66. package/node/Radio/Radio.js +59 -16
  67. package/node/Select/SelectInput.js +8 -8
  68. package/node/Snackbar/Snackbar.js +110 -32
  69. package/node/SpeedDialAction/SpeedDialAction.js +108 -30
  70. package/node/SwipeableDrawer/SwipeableDrawer.js +60 -13
  71. package/node/Switch/Switch.js +2 -0
  72. package/node/Tabs/Tabs.js +120 -52
  73. package/node/Tabs/tabsClasses.js +1 -1
  74. package/node/index.js +1 -1
  75. package/node/internal/SwitchBase.js +84 -30
  76. package/node/styles/createThemeNoVars.js +7 -2
  77. package/node/useAutocomplete/useAutocomplete.js +0 -1
  78. package/node/version/index.js +2 -2
  79. package/package.json +5 -5
  80. package/styles/createThemeNoVars.js +7 -2
  81. package/useAutocomplete/useAutocomplete.js +0 -1
  82. package/version/index.js +2 -2
@@ -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
  /**
package/Tabs/Tabs.d.ts CHANGED
@@ -1,19 +1,141 @@
1
1
  import * as React from 'react';
2
2
  import { SxProps } from '@mui/system';
3
3
  import { OverridableStringUnion } from '@mui/types';
4
- import { SlotComponentProps } from '../utils/types';
4
+ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
5
5
  import { Theme } from '../styles';
6
- import { TabScrollButtonProps } from '../TabScrollButton';
6
+ import TabScrollButton, { TabScrollButtonProps } from '../TabScrollButton';
7
7
  import { OverridableComponent, OverrideProps } from '../OverridableComponent';
8
8
  import { TabsClasses } from './tabsClasses';
9
9
  import SvgIcon from '../SvgIcon';
10
10
 
11
11
  export interface TabsPropsIndicatorColorOverrides {}
12
12
 
13
+ export interface TabsRootSlotPropsOverrides {}
14
+ export interface TabsScrollerSlotPropsOverrides {}
15
+ export interface TabsListSlotPropsOverrides {}
16
+ export interface TabsScrollbarSlotPropsOverrides {}
17
+ export interface TabsIndicatorSlotPropsOverrides {}
18
+ export interface TabsScrollButtonsSlotPropsOverrides {}
13
19
  export interface TabsStartScrollButtonIconSlotPropsOverrides {}
14
20
  export interface TabsEndScrollButtonIconSlotPropsOverrides {}
15
21
 
16
- export interface TabsOwnerState extends TabsProps {
22
+ export interface TabsSlots {
23
+ /**
24
+ * The component used for the popper.
25
+ * @default div
26
+ */
27
+ root: React.ElementType;
28
+ /**
29
+ * The component used for the scroller.
30
+ * @default div
31
+ */
32
+ scroller: React.ElementType;
33
+ /**
34
+ * The component used for the flex container.
35
+ * @default div
36
+ */
37
+ list: React.ElementType;
38
+ /**
39
+ * The component used for the scroller.
40
+ * @default ScrollbarSize
41
+ */
42
+ scrollbar: React.ElementType;
43
+ /**
44
+ * The component used for the tab indicator.
45
+ * @default span
46
+ */
47
+ indicator: React.ElementType;
48
+ /**
49
+ * The component used for the scroll button.
50
+ * @default TabScrollButton
51
+ */
52
+ scrollButtons: React.ElementType;
53
+ /**
54
+ * The component used for the start scroll button icon.
55
+ * @default KeyboardArrowLeft
56
+ */
57
+ startScrollButtonIcon: React.ElementType;
58
+ /**
59
+ * The component used for the end scroll button icon.
60
+ * @default KeyboardArrowRight
61
+ */
62
+ endScrollButtonIcon: React.ElementType;
63
+ }
64
+
65
+ export type TabsSlotsAndSlotProps = CreateSlotsAndSlotProps<
66
+ TabsSlots,
67
+ {
68
+ /**
69
+ * Props forwarded to the root slot.
70
+ * By default, the avaible props are based on the div element.
71
+ */
72
+ root: SlotProps<'div', TabsRootSlotPropsOverrides, TabsOwnerState>;
73
+ /**
74
+ * Props forwarded to the scroller slot.
75
+ * By default, the avaible props are based on the div element.
76
+ */
77
+ scroller: SlotProps<'div', TabsScrollerSlotPropsOverrides, TabsOwnerState>;
78
+ /**
79
+ * Props forwarded to the list slot.
80
+ * By default, the avaible props are based on the div element.
81
+ */
82
+ list: SlotProps<'div', TabsListSlotPropsOverrides, TabsOwnerState>;
83
+ /**
84
+ * Props forwarded to the scrollbar slot.
85
+ * By default, the avaible props are based on the div element.
86
+ */
87
+ scrollbar: SlotProps<
88
+ 'div',
89
+ { onChange?: (scrollbarWidth: undefined | number) => void } & TabsScrollbarSlotPropsOverrides,
90
+ TabsOwnerState
91
+ >;
92
+ /**
93
+ * Props forwarded to the indicator slot.
94
+ * By default, the avaible props are based on the span element.
95
+ */
96
+ indicator: SlotProps<'span', TabsIndicatorSlotPropsOverrides, TabsOwnerState>;
97
+ /**
98
+ * Props forwarded to the scrollButton slot.
99
+ * By default, the avaible props are based on the [TabScrollButton](https://mui.com/material-ui/api/tab-scroll-button/#props) component.
100
+ */
101
+ scrollButtons: SlotProps<
102
+ typeof TabScrollButton,
103
+ TabsScrollButtonsSlotPropsOverrides,
104
+ TabsOwnerState
105
+ >;
106
+ /**
107
+ * Props forwarded to the startScrollButtonIcon slot.
108
+ * By default, the avaible props are based on the [SvgIcon](https://mui.com/material-ui/api/svg-icon/#props) component.
109
+ */
110
+ startScrollButtonIcon: SlotProps<
111
+ typeof SvgIcon,
112
+ TabsStartScrollButtonIconSlotPropsOverrides,
113
+ TabsOwnerState
114
+ >;
115
+ /**
116
+ * Props forwarded to the endScrollButtonIcon slot.
117
+ * By default, the avaible props are based on the [SvgIcon](https://mui.com/material-ui/api/svg-icon/#props) component.
118
+ */
119
+ endScrollButtonIcon: SlotProps<
120
+ typeof SvgIcon,
121
+ TabsEndScrollButtonIconSlotPropsOverrides,
122
+ TabsOwnerState
123
+ >;
124
+ }
125
+ > & {
126
+ slots?: {
127
+ /**
128
+ * @deprecated Use `slots.startScrollButtonIcon` instead.
129
+ */
130
+ StartScrollButtonIcon?: React.ElementType;
131
+ /**
132
+ * @deprecated Use `slots.endScrollButtonIcon` instead.
133
+ */
134
+ EndScrollButtonIcon?: React.ElementType;
135
+ };
136
+ };
137
+
138
+ export interface TabsOwnerState extends Omit<TabsProps, 'slots' | 'slotProps'> {
17
139
  vertical: boolean;
18
140
  fixed: boolean;
19
141
  hideScrollbar: boolean;
@@ -23,7 +145,7 @@ export interface TabsOwnerState extends TabsProps {
23
145
  scrollButtonsHideMobile: boolean;
24
146
  }
25
147
 
26
- export interface TabsOwnProps {
148
+ export interface TabsOwnProps extends TabsSlotsAndSlotProps {
27
149
  /**
28
150
  * Callback fired when the component mounts.
29
151
  * This is useful when you want to trigger an action programmatically.
@@ -61,31 +183,6 @@ export interface TabsOwnProps {
61
183
  * Override or extend the styles applied to the component.
62
184
  */
63
185
  classes?: Partial<TabsClasses>;
64
- /**
65
- * The components used for each slot inside.
66
- * @default {}
67
- */
68
- slots?: {
69
- StartScrollButtonIcon?: React.ElementType;
70
- EndScrollButtonIcon?: React.ElementType;
71
- };
72
- /**
73
- * The extra props for the slot components.
74
- * You can override the existing props or add new ones.
75
- * @default {}
76
- */
77
- slotProps?: {
78
- startScrollButtonIcon?: SlotComponentProps<
79
- typeof SvgIcon,
80
- TabsStartScrollButtonIconSlotPropsOverrides,
81
- TabsOwnerState
82
- >;
83
- endScrollButtonIcon?: SlotComponentProps<
84
- typeof SvgIcon,
85
- TabsEndScrollButtonIconSlotPropsOverrides,
86
- TabsOwnerState
87
- >;
88
- };
89
186
  /**
90
187
  * Determines the color of the indicator.
91
188
  * @default 'primary'
@@ -108,6 +205,7 @@ export interface TabsOwnProps {
108
205
  orientation?: 'horizontal' | 'vertical';
109
206
  /**
110
207
  * The component used to render the scroll buttons.
208
+ * @deprecated use the `slots.scrollButtons` 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.
111
209
  * @default TabScrollButton
112
210
  */
113
211
  ScrollButtonComponent?: React.ElementType;
@@ -130,6 +228,7 @@ export interface TabsOwnProps {
130
228
  selectionFollowsFocus?: boolean;
131
229
  /**
132
230
  * Props applied to the tab indicator element.
231
+ * @deprecated use the `slotProps.indicator` 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.
133
232
  * @default {}
134
233
  */
135
234
  TabIndicatorProps?: React.HTMLAttributes<HTMLDivElement> & {
@@ -137,6 +236,7 @@ export interface TabsOwnProps {
137
236
  };
138
237
  /**
139
238
  * Props applied to the [`TabScrollButton`](https://mui.com/material-ui/api/tab-scroll-button/) element.
239
+ * @deprecated use the `slotProps.scrollButtons` 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.
140
240
  * @default {}
141
241
  */
142
242
  TabScrollButtonProps?: Partial<TabScrollButtonProps>;