@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
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>;
package/Tabs/Tabs.js CHANGED
@@ -19,6 +19,7 @@ import useEventCallback from "../utils/useEventCallback.js";
19
19
  import tabsClasses, { getTabsUtilityClass } from "./tabsClasses.js";
20
20
  import ownerDocument from "../utils/ownerDocument.js";
21
21
  import ownerWindow from "../utils/ownerWindow.js";
22
+ import useSlot from "../utils/useSlot.js";
22
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
24
  const nextItem = (list, item) => {
24
25
  if (list === item) {
@@ -75,7 +76,7 @@ const useUtilityClasses = ownerState => {
75
76
  const slots = {
76
77
  root: ['root', vertical && 'vertical'],
77
78
  scroller: ['scroller', fixed && 'fixed', hideScrollbar && 'hideScrollbar', scrollableX && 'scrollableX', scrollableY && 'scrollableY'],
78
- flexContainer: ['flexContainer', vertical && 'flexContainerVertical', centered && 'centered'],
79
+ list: ['list', 'flexContainer', vertical && 'flexContainerVertical', vertical && 'vertical', centered && 'centered'],
79
80
  indicator: ['indicator'],
80
81
  scrollButtons: ['scrollButtons', scrollButtonsHideMobile && 'scrollButtonsHideMobile'],
81
82
  scrollableX: [scrollableX && 'scrollableX'],
@@ -176,14 +177,14 @@ const TabsScroller = styled('div', {
176
177
  }
177
178
  }]
178
179
  });
179
- const FlexContainer = styled('div', {
180
+ const List = styled('div', {
180
181
  name: 'MuiTabs',
181
- slot: 'FlexContainer',
182
+ slot: 'List',
182
183
  overridesResolver: (props, styles) => {
183
184
  const {
184
185
  ownerState
185
186
  } = props;
186
- return [styles.flexContainer, ownerState.vertical && styles.flexContainerVertical, ownerState.centered && styles.centered];
187
+ return [styles.list, styles.flexContainer, ownerState.vertical && styles.flexContainerVertical, ownerState.centered && styles.centered];
187
188
  }
188
189
  })({
189
190
  display: 'flex',
@@ -271,13 +272,16 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
271
272
  indicatorColor = 'primary',
272
273
  onChange,
273
274
  orientation = 'horizontal',
274
- ScrollButtonComponent = TabScrollButton,
275
+ ScrollButtonComponent,
276
+ // TODO: remove in v7 (deprecated in v6)
275
277
  scrollButtons = 'auto',
276
278
  selectionFollowsFocus,
277
279
  slots = {},
278
280
  slotProps = {},
279
281
  TabIndicatorProps = {},
282
+ // TODO: remove in v7 (deprecated in v6)
280
283
  TabScrollButtonProps = {},
284
+ // TODO: remove in v7 (deprecated in v6)
281
285
  textColor = 'primary',
282
286
  value,
283
287
  variant = 'standard',
@@ -337,6 +341,14 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
337
341
  const valueToIndex = new Map();
338
342
  const tabsRef = React.useRef(null);
339
343
  const tabListRef = React.useRef(null);
344
+ const externalForwardedProps = {
345
+ slots,
346
+ slotProps: {
347
+ indicator: TabIndicatorProps,
348
+ scrollButton: TabScrollButtonProps,
349
+ ...slotProps
350
+ }
351
+ };
340
352
  const getTabsMeta = () => {
341
353
  const tabsNode = tabsRef.current;
342
354
  let tabsMeta;
@@ -458,50 +470,62 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
458
470
  const handleEndScrollClick = () => {
459
471
  moveTabsScroll(getScrollSize());
460
472
  };
473
+ const [ScrollbarSlot, {
474
+ onChange: scrollbarOnChange,
475
+ ...scrollbarSlotProps
476
+ }] = useSlot('scrollbar', {
477
+ className: clsx(classes.scrollableX, classes.hideScrollbar),
478
+ elementType: TabsScrollbarSize,
479
+ shouldForwardComponentProp: true,
480
+ externalForwardedProps,
481
+ ownerState
482
+ });
461
483
 
462
484
  // TODO Remove <ScrollbarSize /> as browser support for hiding the scrollbar
463
485
  // with CSS improves.
464
486
  const handleScrollbarSizeChange = React.useCallback(scrollbarWidth => {
487
+ scrollbarOnChange?.(scrollbarWidth);
465
488
  setScrollerStyle({
466
489
  overflow: null,
467
490
  scrollbarWidth
468
491
  });
469
- }, []);
492
+ }, [scrollbarOnChange]);
493
+ const [ScrollButtonsSlot, scrollButtonSlotProps] = useSlot('scrollButtons', {
494
+ className: clsx(classes.scrollButtons, TabScrollButtonProps.className),
495
+ elementType: TabScrollButton,
496
+ externalForwardedProps,
497
+ ownerState,
498
+ additionalProps: {
499
+ orientation,
500
+ slots: {
501
+ StartScrollButtonIcon: slots.startScrollButtonIcon || slots.StartScrollButtonIcon,
502
+ EndScrollButtonIcon: slots.endScrollButtonIcon || slots.EndScrollButtonIcon
503
+ },
504
+ slotProps: {
505
+ startScrollButtonIcon: startScrollButtonIconProps,
506
+ endScrollButtonIcon: endScrollButtonIconProps
507
+ }
508
+ }
509
+ });
470
510
  const getConditionalElements = () => {
471
511
  const conditionalElements = {};
472
- conditionalElements.scrollbarSizeListener = scrollable ? /*#__PURE__*/_jsx(TabsScrollbarSize, {
473
- onChange: handleScrollbarSizeChange,
474
- className: clsx(classes.scrollableX, classes.hideScrollbar)
512
+ conditionalElements.scrollbarSizeListener = scrollable ? /*#__PURE__*/_jsx(ScrollbarSlot, {
513
+ ...scrollbarSlotProps,
514
+ onChange: handleScrollbarSizeChange
475
515
  }) : null;
476
516
  const scrollButtonsActive = displayStartScroll || displayEndScroll;
477
517
  const showScrollButtons = scrollable && (scrollButtons === 'auto' && scrollButtonsActive || scrollButtons === true);
478
- conditionalElements.scrollButtonStart = showScrollButtons ? /*#__PURE__*/_jsx(ScrollButtonComponent, {
479
- slots: {
480
- StartScrollButtonIcon: slots.StartScrollButtonIcon
481
- },
482
- slotProps: {
483
- startScrollButtonIcon: startScrollButtonIconProps
484
- },
485
- orientation: orientation,
518
+ conditionalElements.scrollButtonStart = showScrollButtons ? /*#__PURE__*/_jsx(ScrollButtonsSlot, {
486
519
  direction: isRtl ? 'right' : 'left',
487
520
  onClick: handleStartScrollClick,
488
521
  disabled: !displayStartScroll,
489
- ...TabScrollButtonProps,
490
- className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
522
+ ...scrollButtonSlotProps
491
523
  }) : null;
492
- conditionalElements.scrollButtonEnd = showScrollButtons ? /*#__PURE__*/_jsx(ScrollButtonComponent, {
493
- slots: {
494
- EndScrollButtonIcon: slots.EndScrollButtonIcon
495
- },
496
- slotProps: {
497
- endScrollButtonIcon: endScrollButtonIconProps
498
- },
499
- orientation: orientation,
524
+ conditionalElements.scrollButtonEnd = showScrollButtons ? /*#__PURE__*/_jsx(ScrollButtonsSlot, {
500
525
  direction: isRtl ? 'left' : 'right',
501
526
  onClick: handleEndScrollClick,
502
527
  disabled: !displayEndScroll,
503
- ...TabScrollButtonProps,
504
- className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
528
+ ...scrollButtonSlotProps
505
529
  }) : null;
506
530
  return conditionalElements;
507
531
  };
@@ -629,15 +653,18 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
629
653
  updateIndicator: updateIndicatorState,
630
654
  updateScrollButtons: updateScrollButtonState
631
655
  }), [updateIndicatorState, updateScrollButtonState]);
632
- const indicator = /*#__PURE__*/_jsx(TabsIndicator, {
633
- ...TabIndicatorProps,
656
+ const [IndicatorSlot, indicatorSlotProps] = useSlot('indicator', {
634
657
  className: clsx(classes.indicator, TabIndicatorProps.className),
635
- ownerState: ownerState,
636
- style: {
637
- ...indicatorStyle,
638
- ...TabIndicatorProps.style
658
+ elementType: TabsIndicator,
659
+ externalForwardedProps,
660
+ ownerState,
661
+ additionalProps: {
662
+ style: indicatorStyle
639
663
  }
640
664
  });
665
+ const indicator = /*#__PURE__*/_jsx(IndicatorSlot, {
666
+ ...indicatorSlotProps
667
+ });
641
668
  let childIndex = 0;
642
669
  const children = React.Children.map(childrenProp, child => {
643
670
  if (! /*#__PURE__*/React.isValidElement(child)) {
@@ -704,29 +731,54 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
704
731
  }
705
732
  };
706
733
  const conditionalElements = getConditionalElements();
707
- return /*#__PURE__*/_jsxs(TabsRoot, {
734
+ const [RootSlot, rootSlotProps] = useSlot('root', {
735
+ ref,
708
736
  className: clsx(classes.root, className),
709
- ownerState: ownerState,
710
- ref: ref,
711
- as: component,
712
- ...other,
713
- children: [conditionalElements.scrollButtonStart, conditionalElements.scrollbarSizeListener, /*#__PURE__*/_jsxs(TabsScroller, {
714
- className: classes.scroller,
715
- ownerState: ownerState,
737
+ elementType: TabsRoot,
738
+ externalForwardedProps: {
739
+ ...externalForwardedProps,
740
+ ...other,
741
+ component
742
+ },
743
+ ownerState
744
+ });
745
+ const [ScrollerSlot, scrollerSlotProps] = useSlot('scroller', {
746
+ ref: tabsRef,
747
+ className: classes.scroller,
748
+ elementType: TabsScroller,
749
+ externalForwardedProps,
750
+ ownerState,
751
+ additionalProps: {
716
752
  style: {
717
753
  overflow: scrollerStyle.overflow,
718
754
  [vertical ? `margin${isRtl ? 'Left' : 'Right'}` : 'marginBottom']: visibleScrollbar ? undefined : -scrollerStyle.scrollbarWidth
719
- },
720
- ref: tabsRef,
721
- children: [/*#__PURE__*/_jsx(FlexContainer, {
755
+ }
756
+ }
757
+ });
758
+ const [ListSlot, listSlotProps] = useSlot('list', {
759
+ ref: tabListRef,
760
+ className: clsx(classes.list, classes.flexContainer),
761
+ elementType: List,
762
+ externalForwardedProps,
763
+ ownerState,
764
+ getSlotProps: handlers => ({
765
+ ...handlers,
766
+ onKeyDown: event => {
767
+ handleKeyDown(event);
768
+ handlers.onKeyDown?.(event);
769
+ }
770
+ })
771
+ });
772
+ return /*#__PURE__*/_jsxs(RootSlot, {
773
+ ...rootSlotProps,
774
+ children: [conditionalElements.scrollButtonStart, conditionalElements.scrollbarSizeListener, /*#__PURE__*/_jsxs(ScrollerSlot, {
775
+ ...scrollerSlotProps,
776
+ children: [/*#__PURE__*/_jsx(ListSlot, {
722
777
  "aria-label": ariaLabel,
723
778
  "aria-labelledby": ariaLabelledBy,
724
779
  "aria-orientation": orientation === 'vertical' ? 'vertical' : null,
725
- className: classes.flexContainer,
726
- ownerState: ownerState,
727
- onKeyDown: handleKeyDown,
728
- ref: tabListRef,
729
780
  role: "tablist",
781
+ ...listSlotProps,
730
782
  children: children
731
783
  }), mounted && indicator]
732
784
  }), conditionalElements.scrollButtonEnd]
@@ -802,6 +854,7 @@ process.env.NODE_ENV !== "production" ? Tabs.propTypes /* remove-proptypes */ =
802
854
  orientation: PropTypes.oneOf(['horizontal', 'vertical']),
803
855
  /**
804
856
  * The component used to render the scroll buttons.
857
+ * @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.
805
858
  * @default TabScrollButton
806
859
  */
807
860
  ScrollButtonComponent: PropTypes.elementType,
@@ -823,12 +876,17 @@ process.env.NODE_ENV !== "production" ? Tabs.propTypes /* remove-proptypes */ =
823
876
  */
824
877
  selectionFollowsFocus: PropTypes.bool,
825
878
  /**
826
- * The extra props for the slot components.
827
- * You can override the existing props or add new ones.
879
+ * The props used for each slot inside.
828
880
  * @default {}
829
881
  */
830
882
  slotProps: PropTypes.shape({
831
883
  endScrollButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
884
+ indicator: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
885
+ list: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
886
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
887
+ scrollbar: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
888
+ scrollButtons: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
889
+ scroller: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
832
890
  startScrollButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
833
891
  }),
834
892
  /**
@@ -836,7 +894,15 @@ process.env.NODE_ENV !== "production" ? Tabs.propTypes /* remove-proptypes */ =
836
894
  * @default {}
837
895
  */
838
896
  slots: PropTypes.shape({
897
+ endScrollButtonIcon: PropTypes.elementType,
839
898
  EndScrollButtonIcon: PropTypes.elementType,
899
+ indicator: PropTypes.elementType,
900
+ list: PropTypes.elementType,
901
+ root: PropTypes.elementType,
902
+ scrollbar: PropTypes.elementType,
903
+ scrollButtons: PropTypes.elementType,
904
+ scroller: PropTypes.elementType,
905
+ startScrollButtonIcon: PropTypes.elementType,
840
906
  StartScrollButtonIcon: PropTypes.elementType
841
907
  }),
842
908
  /**
@@ -845,11 +911,13 @@ process.env.NODE_ENV !== "production" ? Tabs.propTypes /* remove-proptypes */ =
845
911
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
846
912
  /**
847
913
  * Props applied to the tab indicator element.
914
+ * @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.
848
915
  * @default {}
849
916
  */
850
917
  TabIndicatorProps: PropTypes.object,
851
918
  /**
852
919
  * Props applied to the [`TabScrollButton`](https://mui.com/material-ui/api/tab-scroll-button/) element.
920
+ * @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.
853
921
  * @default {}
854
922
  */
855
923
  TabScrollButtonProps: PropTypes.object,
@@ -4,9 +4,13 @@ export interface TabsClasses {
4
4
  /** Styles applied to the root element if `orientation="vertical"`. */
5
5
  vertical: string;
6
6
  /** Styles applied to the flex container element. */
7
+ /** @deprecated use `list` instead. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. */
7
8
  flexContainer: string;
8
9
  /** Styles applied to the flex container element if `orientation="vertical"`. */
10
+ /** @deprecated use a combination of `list` and `vertical` instead. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. */
9
11
  flexContainerVertical: string;
12
+ /** Styles applied to the list element. */
13
+ list: string;
10
14
  /** Styles applied to the flex container element if `centered={true}` & `!variant="scrollable"`. */
11
15
  centered: string;
12
16
  /** Styles applied to the tablist element. */
@@ -3,5 +3,5 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
3
3
  export function getTabsUtilityClass(slot) {
4
4
  return generateUtilityClass('MuiTabs', slot);
5
5
  }
6
- const tabsClasses = generateUtilityClasses('MuiTabs', ['root', 'vertical', 'flexContainer', 'flexContainerVertical', 'centered', 'scroller', 'fixed', 'scrollableX', 'scrollableY', 'hideScrollbar', 'scrollButtons', 'scrollButtonsHideMobile', 'indicator']);
6
+ const tabsClasses = generateUtilityClasses('MuiTabs', ['root', 'vertical', 'list', 'flexContainer', 'flexContainerVertical', 'centered', 'scroller', 'fixed', 'scrollableX', 'scrollableY', 'hideScrollbar', 'scrollButtons', 'scrollButtonsHideMobile', 'indicator']);
7
7
  export default tabsClasses;
@@ -41,26 +41,34 @@ export interface TooltipSlots {
41
41
  export type TooltipSlotsAndSlotProps = CreateSlotsAndSlotProps<
42
42
  TooltipSlots,
43
43
  {
44
+ /**
45
+ * Props forwarded to the popper slot.
46
+ * By default, the avaible props are based on the [Popper](https://mui.com/material-ui/api/popper/#props) component.
47
+ */
44
48
  popper: SlotProps<
45
49
  React.ElementType<PopperProps>,
46
50
  TooltipPopperSlotPropsOverrides,
47
51
  TooltipOwnerState
48
52
  >;
53
+ /**
54
+ * Props forwarded to the transition slot.
55
+ * By default, the avaible props are based on the [Grow](https://mui.com/material-ui/api/grow/#props) component.
56
+ */
49
57
  transition: SlotProps<
50
- React.ElementType<TransitionProps>,
51
- TooltipTransitionSlotPropsOverrides,
52
- TooltipOwnerState
53
- >;
54
- tooltip: SlotProps<
55
- React.ElementType<React.HTMLProps<HTMLDivElement>>,
56
- TooltipTooltipSlotPropsOverrides,
57
- TooltipOwnerState
58
- >;
59
- arrow: SlotProps<
60
- React.ElementType<React.HTMLProps<HTMLSpanElement>>,
61
- TooltipArrowSlotPropsOverrides,
58
+ React.ElementType,
59
+ TransitionProps & TooltipTransitionSlotPropsOverrides,
62
60
  TooltipOwnerState
63
61
  >;
62
+ /**
63
+ * Props forwarded to the tooltip slot.
64
+ * By default, the avaible props are based on the div element.
65
+ */
66
+ tooltip: SlotProps<'div', TooltipTooltipSlotPropsOverrides, TooltipOwnerState>;
67
+ /**
68
+ * Props forwarded to the tooltip slot.
69
+ * By default, the avaible props are based on the span element.
70
+ */
71
+ arrow: SlotProps<'span', TooltipArrowSlotPropsOverrides, TooltipOwnerState>;
64
72
  }
65
73
  >;
66
74
 
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.4.5
2
+ * @mui/material v6.4.7
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -2,9 +2,39 @@ import * as React from 'react';
2
2
  import { InternalStandardProps as StandardProps } from '..';
3
3
  import { ButtonBaseProps } from '../ButtonBase';
4
4
  import { SwitchBaseClasses } from './switchBaseClasses';
5
+ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
6
+
7
+ interface SwitchBaseSlots {
8
+ /**
9
+ * The component that renders the root slot.
10
+ * @default ButtonBase
11
+ */
12
+ root: React.ElementType;
13
+ /**
14
+ * The component that renders the input slot.
15
+ * @default 'input'
16
+ */
17
+ input: React.ElementType;
18
+ }
19
+
20
+ type SwitchBaseSlotsAndSlotProps = CreateSlotsAndSlotProps<
21
+ SwitchBaseSlots,
22
+ {
23
+ /**
24
+ * Props forwarded to the root slot.
25
+ * By default, the avaible props are based on the [ButtonBase](https://mui.com/material-ui/api/button-base/#props) component.
26
+ */
27
+ root: SlotProps<React.ElementType<ButtonBaseProps>, {}, SwitchBaseOwnerState>;
28
+ /**
29
+ * Props forwarded to the input slot.
30
+ */
31
+ input: SlotProps<'input', {}, SwitchBaseOwnerState>;
32
+ }
33
+ >;
5
34
 
6
35
  export interface SwitchBaseProps
7
- extends StandardProps<ButtonBaseProps, 'children' | 'onChange' | 'type' | 'value'> {
36
+ extends StandardProps<ButtonBaseProps, 'children' | 'onChange' | 'type' | 'value'>,
37
+ SwitchBaseSlotsAndSlotProps {
8
38
  autoFocus?: boolean;
9
39
  /**
10
40
  * If `true`, the component is checked.
@@ -48,10 +78,12 @@ export interface SwitchBaseProps
48
78
  id?: string;
49
79
  /**
50
80
  * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
81
+ * @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.
51
82
  */
52
83
  inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
53
84
  /**
54
85
  * Pass a ref to the `input` element.
86
+ * @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.
55
87
  */
56
88
  inputRef?: React.Ref<any>;
57
89
  /**
@@ -80,6 +112,8 @@ export interface SwitchBaseProps
80
112
  value?: unknown;
81
113
  }
82
114
 
115
+ export interface SwitchBaseOwnerState extends Omit<SwitchBaseProps, 'slots' | 'slotProps'> {}
116
+
83
117
  declare const SwitchBase: React.JSXElementConstructor<SwitchBaseProps>;
84
118
 
85
119
  export default SwitchBase;