@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.
Files changed (101) hide show
  1. package/Autocomplete/Autocomplete.js +1 -1
  2. package/Breadcrumbs/Breadcrumbs.js +1 -1
  3. package/CHANGELOG.md +69 -0
  4. package/CardHeader/CardHeader.js +9 -5
  5. package/DialogContentText/DialogContentText.js +1 -1
  6. package/Divider/Divider.js +3 -2
  7. package/FormControlLabel/FormControlLabel.js +1 -3
  8. package/IconButton/IconButton.js +3 -0
  9. package/InputAdornment/InputAdornment.js +1 -1
  10. package/Link/Link.js +39 -4
  11. package/Link/getTextDecoration.d.ts +1 -2
  12. package/Link/getTextDecoration.js +1 -19
  13. package/ListItemText/ListItemText.js +8 -4
  14. package/Slider/useSlider.js +3 -3
  15. package/Typography/Typography.d.ts +21 -2
  16. package/Typography/Typography.js +28 -16
  17. package/index.js +1 -1
  18. package/modern/Autocomplete/Autocomplete.js +1 -1
  19. package/modern/Breadcrumbs/Breadcrumbs.js +1 -1
  20. package/modern/CardHeader/CardHeader.js +9 -5
  21. package/modern/DialogContentText/DialogContentText.js +1 -1
  22. package/modern/Divider/Divider.js +3 -2
  23. package/modern/FormControlLabel/FormControlLabel.js +1 -3
  24. package/modern/IconButton/IconButton.js +3 -0
  25. package/modern/InputAdornment/InputAdornment.js +1 -1
  26. package/modern/Link/Link.js +39 -4
  27. package/modern/Link/getTextDecoration.js +1 -19
  28. package/modern/ListItemText/ListItemText.js +8 -4
  29. package/modern/Slider/useSlider.js +3 -3
  30. package/modern/Typography/Typography.js +28 -16
  31. package/modern/index.js +1 -1
  32. package/modern/styles/createGetSelector.js +8 -2
  33. package/modern/useAutocomplete/useAutocomplete.js +0 -8
  34. package/modern/version/index.js +2 -2
  35. package/node/AppBar/AppBar.js +10 -13
  36. package/node/Autocomplete/Autocomplete.js +4 -7
  37. package/node/AvatarGroup/AvatarGroup.js +1 -2
  38. package/node/Badge/Badge.js +6 -7
  39. package/node/Breadcrumbs/Breadcrumbs.js +1 -1
  40. package/node/Button/Button.js +1 -2
  41. package/node/ButtonBase/TouchRipple.js +4 -4
  42. package/node/CardHeader/CardHeader.js +9 -5
  43. package/node/Checkbox/Checkbox.js +2 -3
  44. package/node/CssBaseline/CssBaseline.js +5 -10
  45. package/node/DialogContentText/DialogContentText.js +1 -1
  46. package/node/DialogTitle/DialogTitle.js +1 -1
  47. package/node/Divider/Divider.js +3 -2
  48. package/node/Fab/Fab.js +87 -90
  49. package/node/FilledInput/FilledInput.js +13 -17
  50. package/node/FormControlLabel/FormControlLabel.js +4 -7
  51. package/node/Grid/Grid.js +2 -4
  52. package/node/IconButton/IconButton.js +3 -0
  53. package/node/Input/Input.js +3 -4
  54. package/node/InputAdornment/InputAdornment.js +1 -1
  55. package/node/InputBase/InputBase.js +1 -2
  56. package/node/Link/Link.js +39 -4
  57. package/node/Link/getTextDecoration.js +2 -20
  58. package/node/ListItemText/ListItemText.js +9 -5
  59. package/node/Menu/Menu.js +2 -3
  60. package/node/Modal/Modal.js +4 -4
  61. package/node/Modal/ModalManager.js +1 -1
  62. package/node/Modal/useModal.js +4 -6
  63. package/node/OutlinedInput/OutlinedInput.js +3 -3
  64. package/node/PaginationItem/PaginationItem.js +4 -5
  65. package/node/Paper/Paper.js +1 -2
  66. package/node/Popover/Popover.js +2 -3
  67. package/node/Popper/BasePopper.js +1 -2
  68. package/node/Popper/Popper.js +2 -3
  69. package/node/Radio/Radio.js +2 -3
  70. package/node/ScopedCssBaseline/ScopedCssBaseline.js +2 -4
  71. package/node/Select/SelectInput.js +2 -3
  72. package/node/Slider/Slider.js +20 -21
  73. package/node/Slider/useSlider.js +17 -29
  74. package/node/Snackbar/useSnackbar.js +7 -7
  75. package/node/StepLabel/StepLabel.js +1 -1
  76. package/node/SvgIcon/SvgIcon.js +75 -81
  77. package/node/SwipeableDrawer/SwipeableDrawer.js +1 -2
  78. package/node/TabScrollButton/TabScrollButton.js +2 -3
  79. package/node/TablePagination/TablePagination.js +1 -2
  80. package/node/TablePagination/TablePaginationActions.js +10 -11
  81. package/node/Tabs/Tabs.js +5 -8
  82. package/node/Tooltip/Tooltip.js +13 -15
  83. package/node/Typography/Typography.js +28 -16
  84. package/node/Unstable_TrapFocus/FocusTrap.js +1 -2
  85. package/node/index.js +1 -1
  86. package/node/styles/createGetSelector.js +9 -3
  87. package/node/styles/createTheme.js +2 -2
  88. package/node/styles/createThemeNoVars.js +1 -1
  89. package/node/styles/createThemeWithVars.js +5 -7
  90. package/node/styles/shouldSkipGeneratingVar.js +1 -2
  91. package/node/transitions/utils.js +2 -3
  92. package/node/useAutocomplete/useAutocomplete.js +3 -18
  93. package/node/useLazyRipple/useLazyRipple.js +3 -12
  94. package/node/utils/useSlot.js +1 -1
  95. package/node/version/index.js +2 -2
  96. package/package.json +11 -11
  97. package/styles/createGetSelector.d.ts +5 -3
  98. package/styles/createGetSelector.js +8 -2
  99. package/useAutocomplete/useAutocomplete.d.ts +2 -2
  100. package/useAutocomplete/useAutocomplete.js +0 -8
  101. package/version/index.js +2 -2
@@ -39,88 +39,82 @@ const SvgIconRoot = (0, _zeroStyled.styled)('svg', {
39
39
  }
40
40
  })(({
41
41
  theme
42
- }) => {
43
- var _theme$transitions, _theme$transitions$cr, _transitions, _theme$vars, _theme$typography, _theme$typography$pxT, _theme$typography2, _theme$typography2$px, _theme$typography3, _theme$typography3$px, _theme$vars2, _palette2, _theme$vars4, _palette3, _theme$vars5;
44
- return {
45
- userSelect: 'none',
46
- width: '1em',
47
- height: '1em',
48
- display: 'inline-block',
49
- flexShrink: 0,
50
- transition: (_theme$transitions = theme.transitions) == null || (_theme$transitions$cr = _theme$transitions.create) == null ? void 0 : _theme$transitions$cr.call(_theme$transitions, 'fill', {
51
- duration: (_transitions = ((_theme$vars = theme.vars) != null ? _theme$vars : theme).transitions) == null || (_transitions = _transitions.duration) == null ? void 0 : _transitions.shorter
52
- }),
53
- variants: [{
54
- props: props => !props.hasSvgAsChild,
55
- style: {
56
- // the <svg> will define the property that has `currentColor`
57
- // for example heroicons uses fill="none" and stroke="currentColor"
58
- fill: 'currentColor'
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
- // TODO v5 deprecate color prop, v6 remove for sx
90
- ...Object.entries(((_theme$vars2 = theme.vars) != null ? _theme$vars2 : theme).palette).filter(([, value]) => value && value.main).map(([color]) => {
91
- var _palette, _theme$vars3;
92
- return {
93
- props: {
94
- color
95
- },
96
- style: {
97
- color: (_palette = ((_theme$vars3 = theme.vars) != null ? _theme$vars3 : theme).palette) == null || (_palette = _palette[color]) == null ? void 0 : _palette.main
98
- }
99
- };
100
- }), {
101
- props: {
102
- color: 'action'
103
- },
104
- style: {
105
- color: (_palette2 = ((_theme$vars4 = theme.vars) != null ? _theme$vars4 : theme).palette) == null || (_palette2 = _palette2.action) == null ? void 0 : _palette2.active
106
- }
107
- }, {
108
- props: {
109
- color: 'disabled'
110
- },
111
- style: {
112
- color: (_palette3 = ((_theme$vars5 = theme.vars) != null ? _theme$vars5 : theme).palette) == null || (_palette3 = _palette3.action) == null ? void 0 : _palette3.disabled
113
- }
114
- }, {
115
- props: {
116
- color: 'inherit'
117
- },
118
- style: {
119
- color: undefined
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 || (_paperRef$current = paperRef.current) != null && _paperRef$current.contains(nativeEvent.target) && (typeof allowSwipeInChildren === 'function' ? allowSwipeInChildren(nativeEvent, swipeAreaRef.current, paperRef.current) : allowSwipeInChildren))) {
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 = (_slots$StartScrollBut = slots.StartScrollButtonIcon) != null ? _slots$StartScrollBut : _KeyboardArrowLeft.default;
87
- const EndButtonIcon = (_slots$EndScrollButto = slots.EndScrollButtonIcon) != null ? _slots$EndScrollButto : _KeyboardArrowRight.default;
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 = (_slotProps$select = slotProps == null ? void 0 : slotProps.select) != null ? _slotProps$select : 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 = (_slots$firstButton = slots.firstButton) != null ? _slots$firstButton : _IconButton.default;
53
- const LastButton = (_slots$lastButton = slots.lastButton) != null ? _slots$lastButton : _IconButton.default;
54
- const NextButton = (_slots$nextButton = slots.nextButton) != null ? _slots$nextButton : _IconButton.default;
55
- const PreviousButton = (_slots$previousButton = slots.previousButton) != null ? _slots$previousButton : _IconButton.default;
56
- const FirstButtonIcon = (_slots$firstButtonIco = slots.firstButtonIcon) != null ? _slots$firstButtonIco : _FirstPage.default;
57
- const LastButtonIcon = (_slots$lastButtonIcon = slots.lastButtonIcon) != null ? _slots$lastButtonIcon : _LastPage.default;
58
- const NextButtonIcon = (_slots$nextButtonIcon = slots.nextButtonIcon) != null ? _slots$nextButtonIcon : _KeyboardArrowRight.default;
59
- const PreviousButtonIcon = (_slots$previousButton2 = slots.previousButtonIcon) != null ? _slots$previousButton2 : _KeyboardArrowLeft.default;
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 != null ? previousButtonSlotProps : backIconButtonProps),
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 != null ? nextButtonSlotProps : nextIconButtonProps),
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
- var _resizeObserver;
563
- (_resizeObserver = resizeObserver) == null || _resizeObserver.unobserve(item);
562
+ resizeObserver?.unobserve(item);
564
563
  });
565
564
  record.addedNodes.forEach(item => {
566
- var _resizeObserver2;
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
- (_mutationObserver = mutationObserver) == null || _mutationObserver.disconnect();
593
- (_resizeObserver3 = resizeObserver) == null || _resizeObserver3.disconnect();
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 == null ? void 0 : childrenProp.length]);
624
+ }, [scrollable, scrollButtons, updateScrollObserver, childrenProp?.length]);
628
625
  React.useEffect(() => {
629
626
  setMounted(true);
630
627
  }, []);
@@ -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 ((_PopperProps$popperOp = PopperProps.popperOptions) != null && _PopperProps$popperOp.modifiers) {
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 = (_ref = (_slots$popper = slots.popper) != null ? _slots$popper : components.Popper) != null ? _ref : TooltipPopper;
630
- const TransitionComponent = (_ref2 = (_ref3 = (_slots$transition = slots.transition) != null ? _slots$transition : components.Transition) != null ? _ref3 : TransitionComponentProp) != null ? _ref2 : _Grow.default;
631
- const TooltipComponent = (_ref4 = (_slots$tooltip = slots.tooltip) != null ? _slots$tooltip : components.Tooltip) != null ? _ref4 : TooltipTooltip;
632
- const ArrowComponent = (_ref5 = (_slots$arrow = slots.arrow) != null ? _slots$arrow : components.Arrow) != null ? _ref5 : TooltipArrow;
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
- ...((_slotProps$popper = slotProps.popper) != null ? _slotProps$popper : componentsProps.popper),
636
- className: (0, _clsx.default)(classes.popper, PopperProps == null ? void 0 : PopperProps.className, (_ref6 = (_slotProps$popper2 = slotProps.popper) != null ? _slotProps$popper2 : componentsProps.popper) == null ? void 0 : _ref6.className)
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
- ...((_slotProps$transition = slotProps.transition) != null ? _slotProps$transition : componentsProps.transition)
638
+ ...(slotProps.transition ?? componentsProps.transition)
641
639
  }, ownerState);
642
640
  const tooltipProps = (0, _appendOwnerState.default)(TooltipComponent, {
643
- ...((_slotProps$tooltip = slotProps.tooltip) != null ? _slotProps$tooltip : componentsProps.tooltip),
644
- className: (0, _clsx.default)(classes.tooltip, (_ref7 = (_slotProps$tooltip2 = slotProps.tooltip) != null ? _slotProps$tooltip2 : componentsProps.tooltip) == null ? void 0 : _ref7.className)
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
- ...((_slotProps$arrow = slotProps.arrow) != null ? _slotProps$arrow : componentsProps.arrow),
648
- className: (0, _clsx.default)(classes.arrow, (_ref8 = (_slotProps$arrow2 = slotProps.arrow) != null ? _slotProps$arrow2 : componentsProps.arrow) == null ? void 0 : _ref8.className)
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 != null ? PopperComponentProp : _Popper.default,
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 textColor = colorTransformations[color];
141
+ const isSxColor = !v6Colors[color];
142
+ // TODO: Remove `extendSxProp` in v7
137
143
  const props = extendSxProp({
138
144
  ...themeProps,
139
- ...(textColor !== null && {
140
- color: textColor || 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
- var _lastKeydown$current, _lastKeydown$current2;
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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.0.0-beta.5
2
+ * @mui/material v6.0.0-beta.6
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -15,7 +15,7 @@ var _default = theme => (colorScheme, css) => {
15
15
  if (selector === 'data') {
16
16
  rule = '[data-%s]';
17
17
  }
18
- if (selector != null && selector.startsWith('data-') && !selector.includes('%s')) {
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
- '@media (prefers-color-scheme: dark) { :root': excludedVariables
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 `@media (prefers-color-scheme: ${String(colorScheme)}) { :root`;
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 == null ? void 0 : palette.mode,
50
+ defaultColorScheme: initialDefaultColorScheme = palette?.mode,
51
51
  ...rest
52
52
  } = options;
53
53
  const defaultColorSchemeInput = initialDefaultColorScheme || 'light';
54
- const defaultScheme = initialColorSchemes == null ? void 0 : initialColorSchemes[defaultColorSchemeInput];
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
- ...(other == null ? void 0 : other.unstable_sxConfig)
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
- ...((_scheme = scheme) == null ? void 0 : _scheme.palette)
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
- ...((_scheme2 = scheme) == null ? void 0 : _scheme2.palette)
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
- ...((_scheme3 = scheme) == null ? void 0 : _scheme3.opacity)
104
+ ...scheme?.opacity
107
105
  },
108
- overlays: ((_scheme4 = scheme) == null ? void 0 : _scheme4.overlays) || (0, _createColorScheme.getOverlays)(mode)
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
- ...(input == null ? void 0 : input.unstable_sxConfig)
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' && !!((_keys$ = keys[1]) != null && _keys$.match(/(mode|contrastThreshold|tonalOffset)/));
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: (_style$transitionDura = style.transitionDuration) != null ? _style$transitionDura : typeof timeout === 'number' ? timeout : timeout[options.mode] || 0,
19
- easing: (_style$transitionTimi = style.transitionTimingFunction) != null ? _style$transitionTimi : typeof easing === 'object' ? easing[options.mode] : 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
  }