@mui/material 6.0.0-beta.5 → 6.0.0-beta.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.
- package/Autocomplete/Autocomplete.js +1 -1
- package/Breadcrumbs/Breadcrumbs.js +1 -1
- package/CHANGELOG.md +69 -0
- package/CardHeader/CardHeader.js +9 -5
- package/DialogContentText/DialogContentText.js +1 -1
- package/Divider/Divider.js +3 -2
- package/FormControlLabel/FormControlLabel.js +1 -3
- package/IconButton/IconButton.js +3 -0
- package/InputAdornment/InputAdornment.js +1 -1
- package/Link/Link.js +39 -4
- package/Link/getTextDecoration.d.ts +1 -2
- package/Link/getTextDecoration.js +1 -19
- package/ListItemText/ListItemText.js +8 -4
- package/Slider/useSlider.js +3 -3
- package/Typography/Typography.d.ts +21 -2
- package/Typography/Typography.js +28 -16
- package/index.js +1 -1
- package/modern/Autocomplete/Autocomplete.js +1 -1
- package/modern/Breadcrumbs/Breadcrumbs.js +1 -1
- package/modern/CardHeader/CardHeader.js +9 -5
- package/modern/DialogContentText/DialogContentText.js +1 -1
- package/modern/Divider/Divider.js +3 -2
- package/modern/FormControlLabel/FormControlLabel.js +1 -3
- package/modern/IconButton/IconButton.js +3 -0
- package/modern/InputAdornment/InputAdornment.js +1 -1
- package/modern/Link/Link.js +39 -4
- package/modern/Link/getTextDecoration.js +1 -19
- package/modern/ListItemText/ListItemText.js +8 -4
- package/modern/Slider/useSlider.js +3 -3
- package/modern/Typography/Typography.js +28 -16
- package/modern/index.js +1 -1
- package/modern/styles/createGetSelector.js +8 -2
- package/modern/useAutocomplete/useAutocomplete.js +0 -8
- package/modern/version/index.js +2 -2
- package/node/AppBar/AppBar.js +10 -13
- package/node/Autocomplete/Autocomplete.js +4 -7
- package/node/AvatarGroup/AvatarGroup.js +1 -2
- package/node/Badge/Badge.js +6 -7
- package/node/Breadcrumbs/Breadcrumbs.js +1 -1
- package/node/Button/Button.js +1 -2
- package/node/ButtonBase/TouchRipple.js +4 -4
- package/node/CardHeader/CardHeader.js +9 -5
- package/node/Checkbox/Checkbox.js +2 -3
- package/node/CssBaseline/CssBaseline.js +5 -10
- package/node/DialogContentText/DialogContentText.js +1 -1
- package/node/DialogTitle/DialogTitle.js +1 -1
- package/node/Divider/Divider.js +3 -2
- package/node/Fab/Fab.js +87 -90
- package/node/FilledInput/FilledInput.js +13 -17
- package/node/FormControlLabel/FormControlLabel.js +4 -7
- package/node/Grid/Grid.js +2 -4
- package/node/IconButton/IconButton.js +3 -0
- package/node/Input/Input.js +3 -4
- package/node/InputAdornment/InputAdornment.js +1 -1
- package/node/InputBase/InputBase.js +1 -2
- package/node/Link/Link.js +39 -4
- package/node/Link/getTextDecoration.js +2 -20
- package/node/ListItemText/ListItemText.js +9 -5
- package/node/Menu/Menu.js +2 -3
- package/node/Modal/Modal.js +4 -4
- package/node/Modal/ModalManager.js +1 -1
- package/node/Modal/useModal.js +4 -6
- package/node/OutlinedInput/OutlinedInput.js +3 -3
- package/node/PaginationItem/PaginationItem.js +4 -5
- package/node/Paper/Paper.js +1 -2
- package/node/Popover/Popover.js +2 -3
- package/node/Popper/BasePopper.js +1 -2
- package/node/Popper/Popper.js +2 -3
- package/node/Radio/Radio.js +2 -3
- package/node/ScopedCssBaseline/ScopedCssBaseline.js +2 -4
- package/node/Select/SelectInput.js +2 -3
- package/node/Slider/Slider.js +20 -21
- package/node/Slider/useSlider.js +17 -29
- package/node/Snackbar/useSnackbar.js +7 -7
- package/node/StepLabel/StepLabel.js +1 -1
- package/node/SvgIcon/SvgIcon.js +75 -81
- package/node/SwipeableDrawer/SwipeableDrawer.js +1 -2
- package/node/TabScrollButton/TabScrollButton.js +2 -3
- package/node/TablePagination/TablePagination.js +1 -2
- package/node/TablePagination/TablePaginationActions.js +10 -11
- package/node/Tabs/Tabs.js +5 -8
- package/node/Tooltip/Tooltip.js +13 -15
- package/node/Typography/Typography.js +28 -16
- package/node/Unstable_TrapFocus/FocusTrap.js +1 -2
- package/node/index.js +1 -1
- package/node/styles/createGetSelector.js +9 -3
- package/node/styles/createTheme.js +2 -2
- package/node/styles/createThemeNoVars.js +1 -1
- package/node/styles/createThemeWithVars.js +5 -7
- package/node/styles/shouldSkipGeneratingVar.js +1 -2
- package/node/transitions/utils.js +2 -3
- package/node/useAutocomplete/useAutocomplete.js +3 -18
- package/node/useLazyRipple/useLazyRipple.js +3 -12
- package/node/utils/useSlot.js +1 -1
- package/node/version/index.js +2 -2
- package/package.json +11 -11
- package/styles/createGetSelector.d.ts +5 -3
- package/styles/createGetSelector.js +8 -2
- package/useAutocomplete/useAutocomplete.d.ts +2 -2
- package/useAutocomplete/useAutocomplete.js +0 -8
- package/version/index.js +2 -2
package/node/SvgIcon/SvgIcon.js
CHANGED
|
@@ -39,88 +39,82 @@ const SvgIconRoot = (0, _zeroStyled.styled)('svg', {
|
|
|
39
39
|
}
|
|
40
40
|
})(({
|
|
41
41
|
theme
|
|
42
|
-
}) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
props: {
|
|
62
|
-
fontSize: 'inherit'
|
|
63
|
-
},
|
|
64
|
-
style: {
|
|
65
|
-
fontSize: 'inherit'
|
|
66
|
-
}
|
|
67
|
-
}, {
|
|
68
|
-
props: {
|
|
69
|
-
fontSize: 'small'
|
|
70
|
-
},
|
|
71
|
-
style: {
|
|
72
|
-
fontSize: ((_theme$typography = theme.typography) == null || (_theme$typography$pxT = _theme$typography.pxToRem) == null ? void 0 : _theme$typography$pxT.call(_theme$typography, 20)) || '1.25rem'
|
|
73
|
-
}
|
|
74
|
-
}, {
|
|
75
|
-
props: {
|
|
76
|
-
fontSize: 'medium'
|
|
77
|
-
},
|
|
78
|
-
style: {
|
|
79
|
-
fontSize: ((_theme$typography2 = theme.typography) == null || (_theme$typography2$px = _theme$typography2.pxToRem) == null ? void 0 : _theme$typography2$px.call(_theme$typography2, 24)) || '1.5rem'
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
props: {
|
|
83
|
-
fontSize: 'large'
|
|
84
|
-
},
|
|
85
|
-
style: {
|
|
86
|
-
fontSize: ((_theme$typography3 = theme.typography) == null || (_theme$typography3$px = _theme$typography3.pxToRem) == null ? void 0 : _theme$typography3$px.call(_theme$typography3, 35)) || '2.1875rem'
|
|
87
|
-
}
|
|
42
|
+
}) => ({
|
|
43
|
+
userSelect: 'none',
|
|
44
|
+
width: '1em',
|
|
45
|
+
height: '1em',
|
|
46
|
+
display: 'inline-block',
|
|
47
|
+
flexShrink: 0,
|
|
48
|
+
transition: theme.transitions?.create?.('fill', {
|
|
49
|
+
duration: (theme.vars ?? theme).transitions?.duration?.shorter
|
|
50
|
+
}),
|
|
51
|
+
variants: [{
|
|
52
|
+
props: props => !props.hasSvgAsChild,
|
|
53
|
+
style: {
|
|
54
|
+
// the <svg> will define the property that has `currentColor`
|
|
55
|
+
// for example heroicons uses fill="none" and stroke="currentColor"
|
|
56
|
+
fill: 'currentColor'
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
props: {
|
|
60
|
+
fontSize: 'inherit'
|
|
88
61
|
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
62
|
+
style: {
|
|
63
|
+
fontSize: 'inherit'
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
props: {
|
|
67
|
+
fontSize: 'small'
|
|
68
|
+
},
|
|
69
|
+
style: {
|
|
70
|
+
fontSize: theme.typography?.pxToRem?.(20) || '1.25rem'
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
props: {
|
|
74
|
+
fontSize: 'medium'
|
|
75
|
+
},
|
|
76
|
+
style: {
|
|
77
|
+
fontSize: theme.typography?.pxToRem?.(24) || '1.5rem'
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
props: {
|
|
81
|
+
fontSize: 'large'
|
|
82
|
+
},
|
|
83
|
+
style: {
|
|
84
|
+
fontSize: theme.typography?.pxToRem?.(35) || '2.1875rem'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
// TODO v5 deprecate color prop, v6 remove for sx
|
|
88
|
+
...Object.entries((theme.vars ?? theme).palette).filter(([, value]) => value && value.main).map(([color]) => ({
|
|
89
|
+
props: {
|
|
90
|
+
color
|
|
91
|
+
},
|
|
92
|
+
style: {
|
|
93
|
+
color: (theme.vars ?? theme).palette?.[color]?.main
|
|
94
|
+
}
|
|
95
|
+
})), {
|
|
96
|
+
props: {
|
|
97
|
+
color: 'action'
|
|
98
|
+
},
|
|
99
|
+
style: {
|
|
100
|
+
color: (theme.vars ?? theme).palette?.action?.active
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
props: {
|
|
104
|
+
color: 'disabled'
|
|
105
|
+
},
|
|
106
|
+
style: {
|
|
107
|
+
color: (theme.vars ?? theme).palette?.action?.disabled
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
props: {
|
|
111
|
+
color: 'inherit'
|
|
112
|
+
},
|
|
113
|
+
style: {
|
|
114
|
+
color: undefined
|
|
115
|
+
}
|
|
116
|
+
}]
|
|
117
|
+
}));
|
|
124
118
|
const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
|
|
125
119
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
126
120
|
props: inProps,
|
|
@@ -404,12 +404,11 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
404
404
|
const currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, (0, _ownerDocument.default)(nativeEvent.currentTarget));
|
|
405
405
|
const currentY = calculateCurrentY(anchorRtl, nativeEvent.touches, (0, _ownerWindow.default)(nativeEvent.currentTarget));
|
|
406
406
|
if (!open) {
|
|
407
|
-
var _paperRef$current;
|
|
408
407
|
// logic for if swipe should be ignored:
|
|
409
408
|
// if disableSwipeToOpen
|
|
410
409
|
// if target != swipeArea, and target is not a child of paper ref
|
|
411
410
|
// if is a child of paper ref, and `allowSwipeInChildren` does not allow it
|
|
412
|
-
if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current ||
|
|
411
|
+
if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || paperRef.current?.contains(nativeEvent.target) && (typeof allowSwipeInChildren === 'function' ? allowSwipeInChildren(nativeEvent, swipeAreaRef.current, paperRef.current) : allowSwipeInChildren))) {
|
|
413
412
|
return;
|
|
414
413
|
}
|
|
415
414
|
if (horizontalSwipe) {
|
|
@@ -63,7 +63,6 @@ const TabScrollButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
|
|
|
63
63
|
}]
|
|
64
64
|
});
|
|
65
65
|
const TabScrollButton = /*#__PURE__*/React.forwardRef(function TabScrollButton(inProps, ref) {
|
|
66
|
-
var _slots$StartScrollBut, _slots$EndScrollButto;
|
|
67
66
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
68
67
|
props: inProps,
|
|
69
68
|
name: 'MuiTabScrollButton'
|
|
@@ -83,8 +82,8 @@ const TabScrollButton = /*#__PURE__*/React.forwardRef(function TabScrollButton(i
|
|
|
83
82
|
...props
|
|
84
83
|
};
|
|
85
84
|
const classes = useUtilityClasses(ownerState);
|
|
86
|
-
const StartButtonIcon =
|
|
87
|
-
const EndButtonIcon =
|
|
85
|
+
const StartButtonIcon = slots.StartScrollButtonIcon ?? _KeyboardArrowLeft.default;
|
|
86
|
+
const EndButtonIcon = slots.EndScrollButtonIcon ?? _KeyboardArrowRight.default;
|
|
88
87
|
const startButtonIconProps = (0, _useSlotProps.default)({
|
|
89
88
|
elementType: StartButtonIcon,
|
|
90
89
|
externalSlotProps: slotProps.startScrollButtonIcon,
|
|
@@ -154,7 +154,6 @@ const useUtilityClasses = ownerState => {
|
|
|
154
154
|
* A `TableCell` based component for placing inside `TableFooter` for pagination.
|
|
155
155
|
*/
|
|
156
156
|
const TablePagination = /*#__PURE__*/React.forwardRef(function TablePagination(inProps, ref) {
|
|
157
|
-
var _slotProps$select;
|
|
158
157
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
159
158
|
props: inProps,
|
|
160
159
|
name: 'MuiTablePagination'
|
|
@@ -185,7 +184,7 @@ const TablePagination = /*#__PURE__*/React.forwardRef(function TablePagination(i
|
|
|
185
184
|
} = props;
|
|
186
185
|
const ownerState = props;
|
|
187
186
|
const classes = useUtilityClasses(ownerState);
|
|
188
|
-
const selectProps =
|
|
187
|
+
const selectProps = slotProps?.select ?? SelectProps;
|
|
189
188
|
const MenuItemComponent = selectProps.native ? 'option' : TablePaginationMenuItem;
|
|
190
189
|
let colSpan;
|
|
191
190
|
if (component === _TableCell.default || component === 'td') {
|
|
@@ -20,7 +20,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
20
20
|
/**
|
|
21
21
|
* @ignore - internal component.
|
|
22
22
|
*/const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginationActions(props, ref) {
|
|
23
|
-
var _slots$firstButton, _slots$lastButton, _slots$nextButton, _slots$previousButton, _slots$firstButtonIco, _slots$lastButtonIcon, _slots$nextButtonIcon, _slots$previousButton2;
|
|
24
23
|
const {
|
|
25
24
|
backIconButtonProps,
|
|
26
25
|
count,
|
|
@@ -49,14 +48,14 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
49
48
|
const handleLastPageButtonClick = event => {
|
|
50
49
|
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
|
|
51
50
|
};
|
|
52
|
-
const FirstButton =
|
|
53
|
-
const LastButton =
|
|
54
|
-
const NextButton =
|
|
55
|
-
const PreviousButton =
|
|
56
|
-
const FirstButtonIcon =
|
|
57
|
-
const LastButtonIcon =
|
|
58
|
-
const NextButtonIcon =
|
|
59
|
-
const PreviousButtonIcon =
|
|
51
|
+
const FirstButton = slots.firstButton ?? _IconButton.default;
|
|
52
|
+
const LastButton = slots.lastButton ?? _IconButton.default;
|
|
53
|
+
const NextButton = slots.nextButton ?? _IconButton.default;
|
|
54
|
+
const PreviousButton = slots.previousButton ?? _IconButton.default;
|
|
55
|
+
const FirstButtonIcon = slots.firstButtonIcon ?? _FirstPage.default;
|
|
56
|
+
const LastButtonIcon = slots.lastButtonIcon ?? _LastPage.default;
|
|
57
|
+
const NextButtonIcon = slots.nextButtonIcon ?? _KeyboardArrowRight.default;
|
|
58
|
+
const PreviousButtonIcon = slots.previousButtonIcon ?? _KeyboardArrowLeft.default;
|
|
60
59
|
const FirstButtonSlot = isRtl ? LastButton : FirstButton;
|
|
61
60
|
const PreviousButtonSlot = isRtl ? NextButton : PreviousButton;
|
|
62
61
|
const NextButtonSlot = isRtl ? PreviousButton : NextButton;
|
|
@@ -85,7 +84,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
85
84
|
color: "inherit",
|
|
86
85
|
"aria-label": getItemAriaLabel('previous', page),
|
|
87
86
|
title: getItemAriaLabel('previous', page),
|
|
88
|
-
...(previousButtonSlotProps
|
|
87
|
+
...(previousButtonSlotProps ?? backIconButtonProps),
|
|
89
88
|
children: isRtl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(NextButtonIcon, {
|
|
90
89
|
...slotProps.nextButtonIcon
|
|
91
90
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PreviousButtonIcon, {
|
|
@@ -97,7 +96,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
97
96
|
color: "inherit",
|
|
98
97
|
"aria-label": getItemAriaLabel('next', page),
|
|
99
98
|
title: getItemAriaLabel('next', page),
|
|
100
|
-
...(nextButtonSlotProps
|
|
99
|
+
...(nextButtonSlotProps ?? nextIconButtonProps),
|
|
101
100
|
children: isRtl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(PreviousButtonIcon, {
|
|
102
101
|
...slotProps.previousButtonIcon
|
|
103
102
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(NextButtonIcon, {
|
package/node/Tabs/Tabs.js
CHANGED
|
@@ -559,12 +559,10 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
559
559
|
const handleMutation = records => {
|
|
560
560
|
records.forEach(record => {
|
|
561
561
|
record.removedNodes.forEach(item => {
|
|
562
|
-
|
|
563
|
-
(_resizeObserver = resizeObserver) == null || _resizeObserver.unobserve(item);
|
|
562
|
+
resizeObserver?.unobserve(item);
|
|
564
563
|
});
|
|
565
564
|
record.addedNodes.forEach(item => {
|
|
566
|
-
|
|
567
|
-
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.observe(item);
|
|
565
|
+
resizeObserver?.observe(item);
|
|
568
566
|
});
|
|
569
567
|
});
|
|
570
568
|
handleResize();
|
|
@@ -586,11 +584,10 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
586
584
|
});
|
|
587
585
|
}
|
|
588
586
|
return () => {
|
|
589
|
-
var _mutationObserver, _resizeObserver3;
|
|
590
587
|
handleResize.clear();
|
|
591
588
|
win.removeEventListener('resize', handleResize);
|
|
592
|
-
|
|
593
|
-
|
|
589
|
+
mutationObserver?.disconnect();
|
|
590
|
+
resizeObserver?.disconnect();
|
|
594
591
|
};
|
|
595
592
|
}, [updateIndicatorState, updateScrollButtonState]);
|
|
596
593
|
|
|
@@ -624,7 +621,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
624
621
|
};
|
|
625
622
|
}
|
|
626
623
|
return undefined;
|
|
627
|
-
}, [scrollable, scrollButtons, updateScrollObserver, childrenProp
|
|
624
|
+
}, [scrollable, scrollButtons, updateScrollObserver, childrenProp?.length]);
|
|
628
625
|
React.useEffect(() => {
|
|
629
626
|
setMounted(true);
|
|
630
627
|
}, []);
|
package/node/Tooltip/Tooltip.js
CHANGED
|
@@ -319,7 +319,6 @@ function composeEventHandler(handler, eventHandler) {
|
|
|
319
319
|
|
|
320
320
|
// TODO v6: Remove PopperComponent, PopperProps, TransitionComponent and TransitionProps.
|
|
321
321
|
const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
322
|
-
var _ref, _slots$popper, _ref2, _ref3, _slots$transition, _ref4, _slots$tooltip, _ref5, _slots$arrow, _slotProps$popper, _ref6, _slotProps$popper2, _slotProps$transition, _slotProps$tooltip, _ref7, _slotProps$tooltip2, _slotProps$arrow, _ref8, _slotProps$arrow2;
|
|
323
322
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
324
323
|
props: inProps,
|
|
325
324
|
name: 'MuiTooltip'
|
|
@@ -599,7 +598,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
599
598
|
}
|
|
600
599
|
}
|
|
601
600
|
const popperOptions = React.useMemo(() => {
|
|
602
|
-
var _PopperProps$popperOp;
|
|
603
601
|
let tooltipModifiers = [{
|
|
604
602
|
name: 'arrow',
|
|
605
603
|
enabled: Boolean(arrowRef),
|
|
@@ -608,7 +606,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
608
606
|
padding: 4
|
|
609
607
|
}
|
|
610
608
|
}];
|
|
611
|
-
if (
|
|
609
|
+
if (PopperProps.popperOptions?.modifiers) {
|
|
612
610
|
tooltipModifiers = tooltipModifiers.concat(PopperProps.popperOptions.modifiers);
|
|
613
611
|
}
|
|
614
612
|
return {
|
|
@@ -626,30 +624,30 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
626
624
|
touch: ignoreNonTouchEvents.current
|
|
627
625
|
};
|
|
628
626
|
const classes = useUtilityClasses(ownerState);
|
|
629
|
-
const PopperComponent =
|
|
630
|
-
const TransitionComponent =
|
|
631
|
-
const TooltipComponent =
|
|
632
|
-
const ArrowComponent =
|
|
627
|
+
const PopperComponent = slots.popper ?? components.Popper ?? TooltipPopper;
|
|
628
|
+
const TransitionComponent = slots.transition ?? components.Transition ?? TransitionComponentProp ?? _Grow.default;
|
|
629
|
+
const TooltipComponent = slots.tooltip ?? components.Tooltip ?? TooltipTooltip;
|
|
630
|
+
const ArrowComponent = slots.arrow ?? components.Arrow ?? TooltipArrow;
|
|
633
631
|
const popperProps = (0, _appendOwnerState.default)(PopperComponent, {
|
|
634
632
|
...PopperProps,
|
|
635
|
-
...(
|
|
636
|
-
className: (0, _clsx.default)(classes.popper, PopperProps
|
|
633
|
+
...(slotProps.popper ?? componentsProps.popper),
|
|
634
|
+
className: (0, _clsx.default)(classes.popper, PopperProps?.className, (slotProps.popper ?? componentsProps.popper)?.className)
|
|
637
635
|
}, ownerState);
|
|
638
636
|
const transitionProps = (0, _appendOwnerState.default)(TransitionComponent, {
|
|
639
637
|
...TransitionProps,
|
|
640
|
-
...(
|
|
638
|
+
...(slotProps.transition ?? componentsProps.transition)
|
|
641
639
|
}, ownerState);
|
|
642
640
|
const tooltipProps = (0, _appendOwnerState.default)(TooltipComponent, {
|
|
643
|
-
...(
|
|
644
|
-
className: (0, _clsx.default)(classes.tooltip, (
|
|
641
|
+
...(slotProps.tooltip ?? componentsProps.tooltip),
|
|
642
|
+
className: (0, _clsx.default)(classes.tooltip, (slotProps.tooltip ?? componentsProps.tooltip)?.className)
|
|
645
643
|
}, ownerState);
|
|
646
644
|
const tooltipArrowProps = (0, _appendOwnerState.default)(ArrowComponent, {
|
|
647
|
-
...(
|
|
648
|
-
className: (0, _clsx.default)(classes.arrow, (
|
|
645
|
+
...(slotProps.arrow ?? componentsProps.arrow),
|
|
646
|
+
className: (0, _clsx.default)(classes.arrow, (slotProps.arrow ?? componentsProps.arrow)?.className)
|
|
649
647
|
}, ownerState);
|
|
650
648
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
651
649
|
children: [/*#__PURE__*/React.cloneElement(children, childrenProps), /*#__PURE__*/(0, _jsxRuntime.jsx)(PopperComponent, {
|
|
652
|
-
as: PopperComponentProp
|
|
650
|
+
as: PopperComponentProp ?? _Popper.default,
|
|
653
651
|
placement: placement,
|
|
654
652
|
anchorEl: followCursor ? {
|
|
655
653
|
getBoundingClientRect: () => ({
|
|
@@ -17,6 +17,17 @@ var _typographyClasses = require("./typographyClasses");
|
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
const v6Colors = {
|
|
21
|
+
primary: true,
|
|
22
|
+
secondary: true,
|
|
23
|
+
error: true,
|
|
24
|
+
info: true,
|
|
25
|
+
success: true,
|
|
26
|
+
warning: true,
|
|
27
|
+
textPrimary: true,
|
|
28
|
+
textSecondary: true,
|
|
29
|
+
textDisabled: true
|
|
30
|
+
};
|
|
20
31
|
const extendSxProp = (0, _zeroStyled.internal_createExtendSxProp)();
|
|
21
32
|
const useUtilityClasses = ownerState => {
|
|
22
33
|
const {
|
|
@@ -67,6 +78,13 @@ const TypographyRoot = exports.TypographyRoot = (0, _zeroStyled.styled)('span',
|
|
|
67
78
|
style: {
|
|
68
79
|
color: (theme.vars || theme).palette[color].main
|
|
69
80
|
}
|
|
81
|
+
})), ...Object.entries(theme.palette?.text || {}).filter(([, value]) => typeof value === 'string').map(([color]) => ({
|
|
82
|
+
props: {
|
|
83
|
+
color: `text${(0, _capitalize.default)(color)}`
|
|
84
|
+
},
|
|
85
|
+
style: {
|
|
86
|
+
color: (theme.vars || theme).palette.text[color]
|
|
87
|
+
}
|
|
70
88
|
})), {
|
|
71
89
|
props: ({
|
|
72
90
|
ownerState
|
|
@@ -112,19 +130,6 @@ const defaultVariantMapping = {
|
|
|
112
130
|
body2: 'p',
|
|
113
131
|
inherit: 'p'
|
|
114
132
|
};
|
|
115
|
-
|
|
116
|
-
// TODO v7: remove this transformation and `extendSxProp`
|
|
117
|
-
const colorTransformations = {
|
|
118
|
-
textPrimary: 'text.primary',
|
|
119
|
-
textSecondary: 'text.secondary',
|
|
120
|
-
// For the main palette, the color will be applied by the `...Object.entries(theme.palette)` clause in the TypographyRoot's styles
|
|
121
|
-
primary: null,
|
|
122
|
-
secondary: null,
|
|
123
|
-
error: null,
|
|
124
|
-
info: null,
|
|
125
|
-
success: null,
|
|
126
|
-
warning: null
|
|
127
|
-
};
|
|
128
133
|
const Typography = /*#__PURE__*/React.forwardRef(function Typography(inProps, ref) {
|
|
129
134
|
const {
|
|
130
135
|
color,
|
|
@@ -133,11 +138,12 @@ const Typography = /*#__PURE__*/React.forwardRef(function Typography(inProps, re
|
|
|
133
138
|
props: inProps,
|
|
134
139
|
name: 'MuiTypography'
|
|
135
140
|
});
|
|
136
|
-
const
|
|
141
|
+
const isSxColor = !v6Colors[color];
|
|
142
|
+
// TODO: Remove `extendSxProp` in v7
|
|
137
143
|
const props = extendSxProp({
|
|
138
144
|
...themeProps,
|
|
139
|
-
...(
|
|
140
|
-
color
|
|
145
|
+
...(isSxColor && {
|
|
146
|
+
color
|
|
141
147
|
})
|
|
142
148
|
});
|
|
143
149
|
const {
|
|
@@ -201,6 +207,12 @@ process.env.NODE_ENV !== "production" ? Typography.propTypes /* remove-proptypes
|
|
|
201
207
|
* @ignore
|
|
202
208
|
*/
|
|
203
209
|
className: _propTypes.default.string,
|
|
210
|
+
/**
|
|
211
|
+
* The color of the component.
|
|
212
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
213
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
214
|
+
*/
|
|
215
|
+
color: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['primary', 'secondary', 'success', 'error', 'info', 'warning', 'textPrimary', 'textSecondary', 'textDisabled']), _propTypes.default.string]),
|
|
204
216
|
/**
|
|
205
217
|
* The component used for the root node.
|
|
206
218
|
* Either a string to use a HTML element or a component.
|
|
@@ -207,8 +207,7 @@ function FocusTrap(props) {
|
|
|
207
207
|
// one of the sentinel nodes was focused, so move the focus
|
|
208
208
|
// to the first/last tabbable element inside the focus trap
|
|
209
209
|
if (tabbable.length > 0) {
|
|
210
|
-
|
|
211
|
-
const isShiftTab = Boolean(((_lastKeydown$current = lastKeydown.current) == null ? void 0 : _lastKeydown$current.shiftKey) && ((_lastKeydown$current2 = lastKeydown.current) == null ? void 0 : _lastKeydown$current2.key) === 'Tab');
|
|
210
|
+
const isShiftTab = Boolean(lastKeydown.current?.shiftKey && lastKeydown.current?.key === 'Tab');
|
|
212
211
|
const focusNext = tabbable[0];
|
|
213
212
|
const focusPrevious = tabbable[tabbable.length - 1];
|
|
214
213
|
if (typeof focusNext !== 'string' && typeof focusPrevious !== 'string') {
|
package/node/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var _default = theme => (colorScheme, css) => {
|
|
|
15
15
|
if (selector === 'data') {
|
|
16
16
|
rule = '[data-%s]';
|
|
17
17
|
}
|
|
18
|
-
if (selector
|
|
18
|
+
if (selector?.startsWith('data-') && !selector.includes('%s')) {
|
|
19
19
|
// 'data-mui-color-scheme' -> '[data-mui-color-scheme="%s"]'
|
|
20
20
|
rule = `[${selector}="%s"]`;
|
|
21
21
|
}
|
|
@@ -29,7 +29,9 @@ var _default = theme => (colorScheme, css) => {
|
|
|
29
29
|
if (rule === 'media') {
|
|
30
30
|
return {
|
|
31
31
|
':root': css,
|
|
32
|
-
|
|
32
|
+
[`@media (prefers-color-scheme: dark)`]: {
|
|
33
|
+
':root': excludedVariables
|
|
34
|
+
}
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
37
|
if (rule) {
|
|
@@ -50,7 +52,11 @@ var _default = theme => (colorScheme, css) => {
|
|
|
50
52
|
}
|
|
51
53
|
} else if (colorScheme) {
|
|
52
54
|
if (rule === 'media') {
|
|
53
|
-
return
|
|
55
|
+
return {
|
|
56
|
+
[`@media (prefers-color-scheme: ${String(colorScheme)})`]: {
|
|
57
|
+
':root': css
|
|
58
|
+
}
|
|
59
|
+
};
|
|
54
60
|
}
|
|
55
61
|
if (rule) {
|
|
56
62
|
return rule.replace('%s', String(colorScheme));
|
|
@@ -47,11 +47,11 @@ function createTheme(options = {},
|
|
|
47
47
|
colorSchemes: initialColorSchemes = !palette ? {
|
|
48
48
|
light: true
|
|
49
49
|
} : undefined,
|
|
50
|
-
defaultColorScheme: initialDefaultColorScheme = palette
|
|
50
|
+
defaultColorScheme: initialDefaultColorScheme = palette?.mode,
|
|
51
51
|
...rest
|
|
52
52
|
} = options;
|
|
53
53
|
const defaultColorSchemeInput = initialDefaultColorScheme || 'light';
|
|
54
|
-
const defaultScheme = initialColorSchemes
|
|
54
|
+
const defaultScheme = initialColorSchemes?.[defaultColorSchemeInput];
|
|
55
55
|
const colorSchemesInput = {
|
|
56
56
|
...initialColorSchemes,
|
|
57
57
|
...(palette ? {
|
|
@@ -81,7 +81,7 @@ Please use another name.` : (0, _formatMuiErrorMessage2.default)(20));
|
|
|
81
81
|
}
|
|
82
82
|
muiTheme.unstable_sxConfig = {
|
|
83
83
|
..._styleFunctionSx.unstable_defaultSxConfig,
|
|
84
|
-
...
|
|
84
|
+
...other?.unstable_sxConfig
|
|
85
85
|
};
|
|
86
86
|
muiTheme.unstable_sx = function sx(props) {
|
|
87
87
|
return (0, _styleFunctionSx.default)({
|
|
@@ -71,19 +71,17 @@ const silent = fn => {
|
|
|
71
71
|
const createGetCssVar = (cssVarPrefix = 'mui') => (0, _system.unstable_createGetCssVar)(cssVarPrefix);
|
|
72
72
|
exports.createGetCssVar = createGetCssVar;
|
|
73
73
|
function attachColorScheme(colorSchemes, scheme, restTheme, colorScheme) {
|
|
74
|
-
var _scheme2, _scheme3, _scheme4;
|
|
75
74
|
if (!scheme) {
|
|
76
75
|
return undefined;
|
|
77
76
|
}
|
|
78
77
|
scheme = scheme === true ? {} : scheme;
|
|
79
78
|
const mode = colorScheme === 'dark' ? 'dark' : 'light';
|
|
80
79
|
if (!restTheme) {
|
|
81
|
-
var _scheme;
|
|
82
80
|
colorSchemes[colorScheme] = (0, _createColorScheme.default)({
|
|
83
81
|
...scheme,
|
|
84
82
|
palette: {
|
|
85
83
|
mode,
|
|
86
|
-
...
|
|
84
|
+
...scheme?.palette
|
|
87
85
|
}
|
|
88
86
|
});
|
|
89
87
|
return undefined;
|
|
@@ -95,7 +93,7 @@ function attachColorScheme(colorSchemes, scheme, restTheme, colorScheme) {
|
|
|
95
93
|
...restTheme,
|
|
96
94
|
palette: {
|
|
97
95
|
mode,
|
|
98
|
-
...
|
|
96
|
+
...scheme?.palette
|
|
99
97
|
}
|
|
100
98
|
});
|
|
101
99
|
colorSchemes[colorScheme] = {
|
|
@@ -103,9 +101,9 @@ function attachColorScheme(colorSchemes, scheme, restTheme, colorScheme) {
|
|
|
103
101
|
palette,
|
|
104
102
|
opacity: {
|
|
105
103
|
...(0, _createColorScheme.getOpacity)(mode),
|
|
106
|
-
...
|
|
104
|
+
...scheme?.opacity
|
|
107
105
|
},
|
|
108
|
-
overlays:
|
|
106
|
+
overlays: scheme?.overlays || (0, _createColorScheme.getOverlays)(mode)
|
|
109
107
|
};
|
|
110
108
|
return muiTheme;
|
|
111
109
|
}
|
|
@@ -389,7 +387,7 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
389
387
|
theme.shouldSkipGeneratingVar = shouldSkipGeneratingVar;
|
|
390
388
|
theme.unstable_sxConfig = {
|
|
391
389
|
..._styleFunctionSx.unstable_defaultSxConfig,
|
|
392
|
-
...
|
|
390
|
+
...input?.unstable_sxConfig
|
|
393
391
|
};
|
|
394
392
|
theme.unstable_sx = function sx(props) {
|
|
395
393
|
return (0, _styleFunctionSx.default)({
|
|
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = shouldSkipGeneratingVar;
|
|
7
7
|
function shouldSkipGeneratingVar(keys) {
|
|
8
|
-
var _keys$;
|
|
9
8
|
return !!keys[0].match(/(cssVarPrefix|colorSchemeSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
|
|
10
9
|
// ends with sxConfig
|
|
11
|
-
keys[0] === 'palette' && !!
|
|
10
|
+
keys[0] === 'palette' && !!keys[1]?.match(/(mode|contrastThreshold|tonalOffset)/);
|
|
12
11
|
}
|
|
@@ -8,15 +8,14 @@ exports.reflow = void 0;
|
|
|
8
8
|
const reflow = node => node.scrollTop;
|
|
9
9
|
exports.reflow = reflow;
|
|
10
10
|
function getTransitionProps(props, options) {
|
|
11
|
-
var _style$transitionDura, _style$transitionTimi;
|
|
12
11
|
const {
|
|
13
12
|
timeout,
|
|
14
13
|
easing,
|
|
15
14
|
style = {}
|
|
16
15
|
} = props;
|
|
17
16
|
return {
|
|
18
|
-
duration:
|
|
19
|
-
easing:
|
|
17
|
+
duration: style.transitionDuration ?? (typeof timeout === 'number' ? timeout : timeout[options.mode] || 0),
|
|
18
|
+
easing: style.transitionTimingFunction ?? (typeof easing === 'object' ? easing[options.mode] : easing),
|
|
20
19
|
delay: style.transitionDelay
|
|
21
20
|
};
|
|
22
21
|
}
|