@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.
- package/Accordion/Accordion.d.ts +14 -12
- package/Alert/Alert.d.ts +3 -15
- package/Backdrop/Backdrop.d.ts +14 -12
- package/CHANGELOG.md +58 -0
- package/CardHeader/CardHeader.d.ts +4 -20
- package/Checkbox/Checkbox.d.ts +45 -9
- package/Checkbox/Checkbox.js +51 -21
- package/Dialog/Dialog.d.ts +4 -4
- package/Drawer/Drawer.d.ts +92 -1
- package/Drawer/Drawer.js +108 -36
- package/InputBase/inputBaseClasses.d.ts +15 -6
- package/Menu/Menu.d.ts +88 -1
- package/Menu/Menu.js +58 -19
- package/Modal/Modal.js +9 -10
- package/Popover/Popover.d.ts +60 -6
- package/Popover/Popover.js +78 -51
- package/Radio/Radio.d.ts +45 -1
- package/Radio/Radio.js +61 -16
- package/Rating/Rating.d.ts +59 -1
- package/Rating/Rating.js +131 -45
- package/Select/SelectInput.js +8 -8
- package/Snackbar/Snackbar.d.ts +79 -2
- package/Snackbar/Snackbar.js +110 -32
- package/SpeedDial/SpeedDial.d.ts +8 -6
- package/SpeedDialAction/SpeedDialAction.d.ts +82 -1
- package/SpeedDialAction/SpeedDialAction.js +108 -30
- package/StepContent/StepContent.d.ts +2 -2
- package/SwipeableDrawer/SwipeableDrawer.d.ts +28 -2
- package/SwipeableDrawer/SwipeableDrawer.js +60 -13
- package/Switch/Switch.js +2 -0
- package/Tabs/Tabs.d.ts +129 -29
- package/Tabs/Tabs.js +120 -52
- package/Tabs/tabsClasses.d.ts +4 -0
- package/Tabs/tabsClasses.js +1 -1
- package/Tooltip/Tooltip.d.ts +20 -12
- package/index.js +1 -1
- package/internal/SwitchBase.d.ts +35 -1
- package/internal/SwitchBase.js +84 -30
- package/modern/Checkbox/Checkbox.js +51 -21
- package/modern/Drawer/Drawer.js +108 -36
- package/modern/Menu/Menu.js +58 -19
- package/modern/Modal/Modal.js +9 -10
- package/modern/Popover/Popover.js +78 -51
- package/modern/Radio/Radio.js +61 -16
- package/modern/Rating/Rating.js +131 -45
- package/modern/Select/SelectInput.js +8 -8
- package/modern/Snackbar/Snackbar.js +110 -32
- package/modern/SpeedDialAction/SpeedDialAction.js +108 -30
- package/modern/SwipeableDrawer/SwipeableDrawer.js +60 -13
- package/modern/Switch/Switch.js +2 -0
- package/modern/Tabs/Tabs.js +120 -52
- package/modern/Tabs/tabsClasses.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internal/SwitchBase.js +84 -30
- package/modern/styles/createThemeNoVars.js +7 -2
- package/modern/version/index.js +2 -2
- package/node/Checkbox/Checkbox.js +51 -21
- package/node/Drawer/Drawer.js +108 -36
- package/node/Menu/Menu.js +58 -19
- package/node/Modal/Modal.js +9 -10
- package/node/Popover/Popover.js +78 -51
- package/node/Radio/Radio.js +61 -16
- package/node/Rating/Rating.js +132 -46
- package/node/Select/SelectInput.js +8 -8
- package/node/Snackbar/Snackbar.js +110 -32
- package/node/SpeedDialAction/SpeedDialAction.js +108 -30
- package/node/SwipeableDrawer/SwipeableDrawer.js +60 -13
- package/node/Switch/Switch.js +2 -0
- package/node/Tabs/Tabs.js +120 -52
- package/node/Tabs/tabsClasses.js +1 -1
- package/node/index.js +1 -1
- package/node/internal/SwitchBase.js +84 -30
- package/node/styles/createThemeNoVars.js +7 -2
- package/node/version/index.js +2 -2
- package/package.json +5 -5
- package/styles/ThemeProvider.d.ts +6 -0
- package/styles/ThemeProviderWithVars.d.ts +1 -0
- package/styles/createThemeNoVars.js +7 -2
- package/styles/index.d.ts +1 -0
- package/version/index.js +2 -2
package/modern/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
|
-
|
|
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
|
|
180
|
+
const List = styled('div', {
|
|
180
181
|
name: 'MuiTabs',
|
|
181
|
-
slot: '
|
|
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
|
|
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(
|
|
473
|
-
|
|
474
|
-
|
|
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(
|
|
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
|
-
...
|
|
490
|
-
className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
|
|
522
|
+
...scrollButtonSlotProps
|
|
491
523
|
}) : null;
|
|
492
|
-
conditionalElements.scrollButtonEnd = showScrollButtons ? /*#__PURE__*/_jsx(
|
|
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
|
-
...
|
|
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
|
|
633
|
-
...TabIndicatorProps,
|
|
656
|
+
const [IndicatorSlot, indicatorSlotProps] = useSlot('indicator', {
|
|
634
657
|
className: clsx(classes.indicator, TabIndicatorProps.className),
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
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
|
-
|
|
734
|
+
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
735
|
+
ref,
|
|
708
736
|
className: clsx(classes.root, className),
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
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
|
-
|
|
721
|
-
|
|
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
|
|
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,
|
|
@@ -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;
|
package/modern/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
5
|
import refType from '@mui/utils/refType';
|
|
7
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
7
|
import capitalize from "../utils/capitalize.js";
|
|
@@ -12,6 +11,7 @@ import useControlled from "../utils/useControlled.js";
|
|
|
12
11
|
import useFormControl from "../FormControl/useFormControl.js";
|
|
13
12
|
import ButtonBase from "../ButtonBase/index.js";
|
|
14
13
|
import { getSwitchBaseUtilityClass } from "./switchBaseClasses.js";
|
|
14
|
+
import useSlot from "../utils/useSlot.js";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const useUtilityClasses = ownerState => {
|
|
17
17
|
const {
|
|
@@ -86,7 +86,6 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
|
|
|
86
86
|
autoFocus,
|
|
87
87
|
checked: checkedProp,
|
|
88
88
|
checkedIcon,
|
|
89
|
-
className,
|
|
90
89
|
defaultChecked,
|
|
91
90
|
disabled: disabledProp,
|
|
92
91
|
disableFocusRipple = false,
|
|
@@ -104,6 +103,8 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
|
|
|
104
103
|
tabIndex,
|
|
105
104
|
type,
|
|
106
105
|
value,
|
|
106
|
+
slots = {},
|
|
107
|
+
slotProps = {},
|
|
107
108
|
...other
|
|
108
109
|
} = props;
|
|
109
110
|
const [checked, setCheckedState] = useControlled({
|
|
@@ -156,38 +157,75 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
|
|
|
156
157
|
edge
|
|
157
158
|
};
|
|
158
159
|
const classes = useUtilityClasses(ownerState);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
160
|
+
const externalForwardedProps = {
|
|
161
|
+
slots,
|
|
162
|
+
slotProps: {
|
|
163
|
+
input: inputProps,
|
|
164
|
+
...slotProps
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
168
|
+
ref,
|
|
169
|
+
elementType: SwitchBaseRoot,
|
|
170
|
+
className: classes.root,
|
|
171
|
+
shouldForwardComponentProp: true,
|
|
172
|
+
externalForwardedProps: {
|
|
173
|
+
...externalForwardedProps,
|
|
174
|
+
component: 'span',
|
|
175
|
+
...other
|
|
176
|
+
},
|
|
177
|
+
getSlotProps: handlers => ({
|
|
178
|
+
...handlers,
|
|
179
|
+
onFocus: event => {
|
|
180
|
+
handlers.onFocus?.(event);
|
|
181
|
+
handleFocus(event);
|
|
182
|
+
},
|
|
183
|
+
onBlur: event => {
|
|
184
|
+
handlers.onBlur?.(event);
|
|
185
|
+
handleBlur(event);
|
|
186
|
+
}
|
|
187
|
+
}),
|
|
188
|
+
ownerState,
|
|
189
|
+
additionalProps: {
|
|
190
|
+
centerRipple: true,
|
|
191
|
+
focusRipple: !disableFocusRipple,
|
|
192
|
+
disabled,
|
|
193
|
+
role: undefined,
|
|
194
|
+
tabIndex: null
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
const [InputSlot, inputSlotProps] = useSlot('input', {
|
|
198
|
+
ref: inputRef,
|
|
199
|
+
elementType: SwitchBaseInput,
|
|
200
|
+
className: classes.input,
|
|
201
|
+
externalForwardedProps,
|
|
202
|
+
getSlotProps: handlers => ({
|
|
203
|
+
onChange: event => {
|
|
204
|
+
handlers.onChange?.(event);
|
|
205
|
+
handleInputChange(event);
|
|
206
|
+
}
|
|
207
|
+
}),
|
|
208
|
+
ownerState,
|
|
209
|
+
additionalProps: {
|
|
210
|
+
autoFocus,
|
|
174
211
|
checked: checkedProp,
|
|
175
|
-
defaultChecked
|
|
176
|
-
|
|
177
|
-
disabled: disabled,
|
|
212
|
+
defaultChecked,
|
|
213
|
+
disabled,
|
|
178
214
|
id: hasLabelFor ? id : undefined,
|
|
179
|
-
name
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
ownerState: ownerState,
|
|
185
|
-
tabIndex: tabIndex,
|
|
186
|
-
type: type,
|
|
215
|
+
name,
|
|
216
|
+
readOnly,
|
|
217
|
+
required,
|
|
218
|
+
tabIndex,
|
|
219
|
+
type,
|
|
187
220
|
...(type === 'checkbox' && value === undefined ? {} : {
|
|
188
221
|
value
|
|
189
|
-
})
|
|
190
|
-
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
226
|
+
...rootSlotProps,
|
|
227
|
+
children: [/*#__PURE__*/_jsx(InputSlot, {
|
|
228
|
+
...inputSlotProps
|
|
191
229
|
}), checked ? checkedIcon : icon]
|
|
192
230
|
});
|
|
193
231
|
});
|
|
@@ -280,6 +318,22 @@ process.env.NODE_ENV !== "production" ? SwitchBase.propTypes = {
|
|
|
280
318
|
* If `true`, the `input` element is required.
|
|
281
319
|
*/
|
|
282
320
|
required: PropTypes.bool,
|
|
321
|
+
/**
|
|
322
|
+
* The props used for each slot inside.
|
|
323
|
+
* @default {}
|
|
324
|
+
*/
|
|
325
|
+
slotProps: PropTypes.shape({
|
|
326
|
+
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
327
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
328
|
+
}),
|
|
329
|
+
/**
|
|
330
|
+
* The components used for each slot inside.
|
|
331
|
+
* @default {}
|
|
332
|
+
*/
|
|
333
|
+
slots: PropTypes.shape({
|
|
334
|
+
input: PropTypes.elementType,
|
|
335
|
+
root: PropTypes.elementType
|
|
336
|
+
}),
|
|
283
337
|
/**
|
|
284
338
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
285
339
|
*/
|
|
@@ -21,8 +21,13 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
21
21
|
shape: shapeInput,
|
|
22
22
|
...other
|
|
23
23
|
} = options;
|
|
24
|
-
if (options.vars
|
|
25
|
-
|
|
24
|
+
if (options.vars &&
|
|
25
|
+
// The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
|
|
26
|
+
// `generateThemeVars` is the closest identifier for checking that the `options` is a result of `createTheme` with CSS variables so that user can create new theme for nested ThemeProvider.
|
|
27
|
+
options.generateThemeVars === undefined) {
|
|
28
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' +
|
|
29
|
+
// #host-reference
|
|
30
|
+
'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : _formatMuiErrorMessage(20));
|
|
26
31
|
}
|
|
27
32
|
const palette = createPalette(paletteInput);
|
|
28
33
|
const systemTheme = systemCreateTheme(options);
|
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.4.
|
|
1
|
+
export const version = "6.4.7";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("4");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("7");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
|
@@ -10,7 +10,6 @@ exports.default = void 0;
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
|
-
var _refType = _interopRequireDefault(require("@mui/utils/refType"));
|
|
14
13
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
14
|
var _colorManipulator = require("@mui/system/colorManipulator");
|
|
16
15
|
var _SwitchBase = _interopRequireDefault(require("../internal/SwitchBase"));
|
|
@@ -24,6 +23,8 @@ var _zeroStyled = require("../zero-styled");
|
|
|
24
23
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
25
24
|
var _createSimplePaletteValueFilter = _interopRequireDefault(require("../utils/createSimplePaletteValueFilter"));
|
|
26
25
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
26
|
+
var _utils = require("../utils");
|
|
27
|
+
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
27
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
29
|
const useUtilityClasses = ownerState => {
|
|
29
30
|
const {
|
|
@@ -121,6 +122,8 @@ const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(inProps, ref) {
|
|
|
121
122
|
size = 'medium',
|
|
122
123
|
disableRipple = false,
|
|
123
124
|
className,
|
|
125
|
+
slots = {},
|
|
126
|
+
slotProps = {},
|
|
124
127
|
...other
|
|
125
128
|
} = props;
|
|
126
129
|
const icon = indeterminate ? indeterminateIconProp : iconProp;
|
|
@@ -133,23 +136,37 @@ const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(inProps, ref) {
|
|
|
133
136
|
size
|
|
134
137
|
};
|
|
135
138
|
const classes = useUtilityClasses(ownerState);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
...inputProps
|
|
141
|
-
},
|
|
142
|
-
icon: /*#__PURE__*/React.cloneElement(icon, {
|
|
143
|
-
fontSize: icon.props.fontSize ?? size
|
|
144
|
-
}),
|
|
145
|
-
checkedIcon: /*#__PURE__*/React.cloneElement(indeterminateIcon, {
|
|
146
|
-
fontSize: indeterminateIcon.props.fontSize ?? size
|
|
147
|
-
}),
|
|
148
|
-
ownerState: ownerState,
|
|
149
|
-
ref: ref,
|
|
139
|
+
const externalInputProps = slotProps.input ?? inputProps;
|
|
140
|
+
const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
|
|
141
|
+
ref,
|
|
142
|
+
elementType: CheckboxRoot,
|
|
150
143
|
className: (0, _clsx.default)(classes.root, className),
|
|
151
|
-
|
|
152
|
-
|
|
144
|
+
shouldForwardComponentProp: true,
|
|
145
|
+
externalForwardedProps: {
|
|
146
|
+
slots,
|
|
147
|
+
slotProps,
|
|
148
|
+
...other
|
|
149
|
+
},
|
|
150
|
+
ownerState,
|
|
151
|
+
additionalProps: {
|
|
152
|
+
type: 'checkbox',
|
|
153
|
+
icon: /*#__PURE__*/React.cloneElement(icon, {
|
|
154
|
+
fontSize: icon.props.fontSize ?? size
|
|
155
|
+
}),
|
|
156
|
+
checkedIcon: /*#__PURE__*/React.cloneElement(indeterminateIcon, {
|
|
157
|
+
fontSize: indeterminateIcon.props.fontSize ?? size
|
|
158
|
+
}),
|
|
159
|
+
disableRipple,
|
|
160
|
+
slots,
|
|
161
|
+
slotProps: {
|
|
162
|
+
input: (0, _utils.mergeSlotProps)(typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps, {
|
|
163
|
+
'data-indeterminate': indeterminate
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RootSlot, {
|
|
169
|
+
...rootSlotProps,
|
|
153
170
|
classes: classes
|
|
154
171
|
});
|
|
155
172
|
});
|
|
@@ -220,12 +237,9 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
|
|
|
220
237
|
indeterminateIcon: _propTypes.default.node,
|
|
221
238
|
/**
|
|
222
239
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
240
|
+
* @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.
|
|
223
241
|
*/
|
|
224
242
|
inputProps: _propTypes.default.object,
|
|
225
|
-
/**
|
|
226
|
-
* Pass a ref to the `input` element.
|
|
227
|
-
*/
|
|
228
|
-
inputRef: _refType.default,
|
|
229
243
|
/**
|
|
230
244
|
* Callback fired when the state is changed.
|
|
231
245
|
*
|
|
@@ -244,6 +258,22 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
|
|
|
244
258
|
* @default 'medium'
|
|
245
259
|
*/
|
|
246
260
|
size: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['medium', 'small']), _propTypes.default.string]),
|
|
261
|
+
/**
|
|
262
|
+
* The props used for each slot inside.
|
|
263
|
+
* @default {}
|
|
264
|
+
*/
|
|
265
|
+
slotProps: _propTypes.default.shape({
|
|
266
|
+
input: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
267
|
+
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
268
|
+
}),
|
|
269
|
+
/**
|
|
270
|
+
* The components used for each slot inside.
|
|
271
|
+
* @default {}
|
|
272
|
+
*/
|
|
273
|
+
slots: _propTypes.default.shape({
|
|
274
|
+
input: _propTypes.default.elementType,
|
|
275
|
+
root: _propTypes.default.elementType
|
|
276
|
+
}),
|
|
247
277
|
/**
|
|
248
278
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
249
279
|
*/
|