@mui/material 5.15.11 → 5.15.13

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 (97) hide show
  1. package/Alert/Alert.d.ts +2 -2
  2. package/Alert/Alert.js +53 -35
  3. package/Alert/alertClasses.d.ts +68 -12
  4. package/Alert/alertClasses.js +1 -1
  5. package/AlertTitle/AlertTitle.js +2 -2
  6. package/Autocomplete/Autocomplete.js +58 -49
  7. package/Avatar/Avatar.js +2 -2
  8. package/Button/Button.js +3 -3
  9. package/Button/buttonClasses.d.ts +113 -33
  10. package/Button/buttonClasses.js +1 -1
  11. package/CHANGELOG.md +290 -116
  12. package/Checkbox/Checkbox.d.ts +1 -1
  13. package/Chip/chipClasses.d.ts +78 -26
  14. package/Drawer/Drawer.js +9 -3
  15. package/LinearProgress/LinearProgress.js +4 -4
  16. package/Menu/Menu.js +5 -4
  17. package/MenuList/MenuList.js +4 -2
  18. package/PaginationItem/PaginationItem.js +3 -3
  19. package/README.md +1 -1
  20. package/Rating/Rating.js +3 -3
  21. package/Slider/Slider.d.ts +2 -4
  22. package/Slider/Slider.js +4 -7
  23. package/Switch/Switch.js +61 -41
  24. package/TabScrollButton/TabScrollButton.js +2 -3
  25. package/TablePagination/TablePaginationActions.js +14 -14
  26. package/Tabs/Tabs.js +3 -2
  27. package/Tooltip/Tooltip.js +5 -4
  28. package/index.js +1 -1
  29. package/legacy/Alert/Alert.js +77 -34
  30. package/legacy/Alert/alertClasses.js +1 -1
  31. package/legacy/AlertTitle/AlertTitle.js +2 -2
  32. package/legacy/Autocomplete/Autocomplete.js +62 -51
  33. package/legacy/Avatar/Avatar.js +2 -2
  34. package/legacy/Button/Button.js +3 -3
  35. package/legacy/Button/buttonClasses.js +1 -1
  36. package/legacy/Drawer/Drawer.js +8 -3
  37. package/legacy/LinearProgress/LinearProgress.js +4 -4
  38. package/legacy/Menu/Menu.js +5 -4
  39. package/legacy/MenuList/MenuList.js +3 -2
  40. package/legacy/PaginationItem/PaginationItem.js +3 -3
  41. package/legacy/Rating/Rating.js +3 -3
  42. package/legacy/Slider/Slider.js +4 -7
  43. package/legacy/Switch/Switch.js +88 -59
  44. package/legacy/TabScrollButton/TabScrollButton.js +2 -3
  45. package/legacy/TablePagination/TablePaginationActions.js +14 -14
  46. package/legacy/Tabs/Tabs.js +3 -2
  47. package/legacy/Tooltip/Tooltip.js +7 -3
  48. package/legacy/index.js +1 -1
  49. package/legacy/styles/experimental_extendTheme.js +3 -0
  50. package/modern/Alert/Alert.js +53 -35
  51. package/modern/Alert/alertClasses.js +1 -1
  52. package/modern/AlertTitle/AlertTitle.js +2 -2
  53. package/modern/Autocomplete/Autocomplete.js +58 -49
  54. package/modern/Avatar/Avatar.js +2 -2
  55. package/modern/Button/Button.js +3 -3
  56. package/modern/Button/buttonClasses.js +1 -1
  57. package/modern/Drawer/Drawer.js +9 -3
  58. package/modern/LinearProgress/LinearProgress.js +4 -4
  59. package/modern/Menu/Menu.js +5 -4
  60. package/modern/MenuList/MenuList.js +4 -2
  61. package/modern/PaginationItem/PaginationItem.js +3 -3
  62. package/modern/Rating/Rating.js +3 -3
  63. package/modern/Slider/Slider.js +4 -7
  64. package/modern/Switch/Switch.js +61 -41
  65. package/modern/TabScrollButton/TabScrollButton.js +2 -3
  66. package/modern/TablePagination/TablePaginationActions.js +14 -14
  67. package/modern/Tabs/Tabs.js +3 -2
  68. package/modern/Tooltip/Tooltip.js +5 -4
  69. package/modern/index.js +1 -1
  70. package/modern/styles/experimental_extendTheme.js +3 -0
  71. package/node/Alert/Alert.js +61 -43
  72. package/node/Alert/alertClasses.js +1 -1
  73. package/node/AlertTitle/AlertTitle.js +4 -4
  74. package/node/Autocomplete/Autocomplete.js +58 -49
  75. package/node/Avatar/Avatar.js +6 -6
  76. package/node/Button/Button.js +3 -3
  77. package/node/Button/buttonClasses.js +1 -1
  78. package/node/Drawer/Drawer.js +9 -3
  79. package/node/LinearProgress/LinearProgress.js +4 -4
  80. package/node/Menu/Menu.js +5 -4
  81. package/node/MenuList/MenuList.js +4 -2
  82. package/node/PaginationItem/PaginationItem.js +3 -3
  83. package/node/Rating/Rating.js +3 -3
  84. package/node/Slider/Slider.js +4 -7
  85. package/node/Switch/Switch.js +66 -46
  86. package/node/TabScrollButton/TabScrollButton.js +2 -3
  87. package/node/TablePagination/TablePaginationActions.js +14 -14
  88. package/node/Tabs/Tabs.js +3 -2
  89. package/node/Tooltip/Tooltip.js +5 -4
  90. package/node/index.js +1 -1
  91. package/node/styles/experimental_extendTheme.js +3 -0
  92. package/package.json +5 -5
  93. package/styles/experimental_extendTheme.d.ts +1 -0
  94. package/styles/experimental_extendTheme.js +3 -0
  95. package/styles/variants.d.ts +7 -1
  96. package/umd/material-ui.development.js +6197 -6084
  97. package/umd/material-ui.production.min.js +2 -2
@@ -8,9 +8,9 @@ import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
9
9
  import composeClasses from '@mui/utils/composeClasses';
10
10
  import { alpha } from '@mui/system/colorManipulator';
11
+ import { useRtl } from '@mui/system/RtlProvider';
11
12
  import useThemeProps from '../styles/useThemeProps';
12
13
  import paginationItemClasses, { getPaginationItemUtilityClass } from './paginationItemClasses';
13
- import useTheme from '../styles/useTheme';
14
14
  import ButtonBase from '../ButtonBase';
15
15
  import capitalize from '../utils/capitalize';
16
16
  import FirstPageIcon from '../internal/svg-icons/FirstPage';
@@ -226,9 +226,9 @@ var PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inPro
226
226
  type: type,
227
227
  variant: variant
228
228
  });
229
- var theme = useTheme();
229
+ var isRtl = useRtl();
230
230
  var classes = useUtilityClasses(ownerState);
231
- var normalizedIcons = theme.direction === 'rtl' ? {
231
+ var normalizedIcons = isRtl ? {
232
232
  previous: slots.next || components.next || NavigateNextIcon,
233
233
  next: slots.previous || components.previous || NavigateBeforeIcon,
234
234
  last: slots.first || components.first || FirstPageIcon,
@@ -11,7 +11,7 @@ import clamp from '@mui/utils/clamp';
11
11
  import visuallyHidden from '@mui/utils/visuallyHidden';
12
12
  import chainPropTypes from '@mui/utils/chainPropTypes';
13
13
  import composeClasses from '@mui/utils/composeClasses';
14
- import useTheme from '../styles/useTheme';
14
+ import { useRtl } from '@mui/system/RtlProvider';
15
15
  import { capitalize, useForkRef, useIsFocusVisible, useControlled, unstable_useId as useId } from '../utils';
16
16
  import Star from '../internal/svg-icons/Star';
17
17
  import StarBorder from '../internal/svg-icons/StarBorder';
@@ -306,7 +306,7 @@ var Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
306
306
  valueDerived = _useControlled2[0],
307
307
  setValueState = _useControlled2[1];
308
308
  var valueRounded = roundValueToPrecision(valueDerived, precision);
309
- var theme = useTheme();
309
+ var isRtl = useRtl();
310
310
  var _React$useState = React.useState({
311
311
  hover: -1,
312
312
  focus: -1
@@ -342,7 +342,7 @@ var Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
342
342
  left = _rootNode$getBounding.left,
343
343
  containerWidth = _rootNode$getBounding.width;
344
344
  var percent;
345
- if (theme.direction === 'rtl') {
345
+ if (isRtl) {
346
346
  percent = (right - event.clientX) / containerWidth;
347
347
  } else {
348
348
  percent = (event.clientX - left) / containerWidth;
@@ -11,9 +11,9 @@ import { isHostComponent, useSlotProps } from '@mui/base/utils';
11
11
  import composeClasses from '@mui/utils/composeClasses';
12
12
  import { useSlider, valueToPercent } from '@mui/base/useSlider';
13
13
  import { alpha, lighten, darken } from '@mui/system/colorManipulator';
14
+ import { useRtl } from '@mui/system/RtlProvider';
14
15
  import useThemeProps from '../styles/useThemeProps';
15
16
  import styled, { slotShouldForwardProp } from '../styles/styled';
16
- import useTheme from '../styles/useTheme';
17
17
  import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
18
18
  import capitalize from '../utils/capitalize';
19
19
  import BaseSliderValueLabel from './SliderValueLabel';
@@ -370,8 +370,7 @@ var Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
370
370
  props: inputProps,
371
371
  name: 'MuiSlider'
372
372
  });
373
- var theme = useTheme();
374
- var isRtl = theme.direction === 'rtl';
373
+ var isRtl = useRtl();
375
374
  var ariaLabel = props['aria-label'],
376
375
  ariaValuetext = props['aria-valuetext'],
377
376
  ariaLabelledby = props['aria-labelledby'],
@@ -654,8 +653,7 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
654
653
  /**
655
654
  * The components used for each slot inside.
656
655
  *
657
- * This prop is an alias for the `slots` prop.
658
- * It's recommended to use the `slots` prop instead.
656
+ * @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
659
657
  *
660
658
  * @default {}
661
659
  */
@@ -673,8 +671,7 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
673
671
  * The extra props for the slot components.
674
672
  * You can override the existing props or add new ones.
675
673
  *
676
- * This prop is an alias for the `slotProps` prop.
677
- * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
674
+ * @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
678
675
  *
679
676
  * @default {}
680
677
  */
@@ -2,6 +2,8 @@
2
2
 
3
3
  // @inheritedComponent IconButton
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
5
7
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
8
  import _extends from "@babel/runtime/helpers/esm/extends";
7
9
  import * as React from 'react';
@@ -12,11 +14,11 @@ import composeClasses from '@mui/utils/composeClasses';
12
14
  import { alpha, darken, lighten } from '@mui/system/colorManipulator';
13
15
  import capitalize from '../utils/capitalize';
14
16
  import SwitchBase from '../internal/SwitchBase';
15
- import useThemeProps from '../styles/useThemeProps';
16
- import styled from '../styles/styled';
17
+ import { styled, createUseThemeProps } from '../zero-styled';
17
18
  import switchClasses, { getSwitchUtilityClass } from './switchClasses';
18
19
  import { jsx as _jsx } from "react/jsx-runtime";
19
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ var useThemeProps = createUseThemeProps('MuiSwitch');
20
22
  var useUtilityClasses = function useUtilityClasses(ownerState) {
21
23
  var classes = ownerState.classes,
22
24
  edge = ownerState.edge,
@@ -41,40 +43,53 @@ var SwitchRoot = styled('span', {
41
43
  var ownerState = props.ownerState;
42
44
  return [styles.root, ownerState.edge && styles["edge".concat(capitalize(ownerState.edge))], styles["size".concat(capitalize(ownerState.size))]];
43
45
  }
44
- })(function (_ref) {
45
- var ownerState = _ref.ownerState;
46
- return _extends({
47
- display: 'inline-flex',
48
- width: 34 + 12 * 2,
49
- height: 14 + 12 * 2,
50
- overflow: 'hidden',
51
- padding: 12,
52
- boxSizing: 'border-box',
53
- position: 'relative',
54
- flexShrink: 0,
55
- zIndex: 0,
56
- // Reset the stacking context.
57
- verticalAlign: 'middle',
58
- // For correct alignment with the text.
59
- '@media print': {
60
- colorAdjust: 'exact'
46
+ })({
47
+ display: 'inline-flex',
48
+ width: 34 + 12 * 2,
49
+ height: 14 + 12 * 2,
50
+ overflow: 'hidden',
51
+ padding: 12,
52
+ boxSizing: 'border-box',
53
+ position: 'relative',
54
+ flexShrink: 0,
55
+ zIndex: 0,
56
+ // Reset the stacking context.
57
+ verticalAlign: 'middle',
58
+ // For correct alignment with the text.
59
+ '@media print': {
60
+ colorAdjust: 'exact'
61
+ },
62
+ variants: [{
63
+ props: {
64
+ edge: 'start'
65
+ },
66
+ style: {
67
+ marginLeft: -8
61
68
  }
62
- }, ownerState.edge === 'start' && {
63
- marginLeft: -8
64
- }, ownerState.edge === 'end' && {
65
- marginRight: -8
66
- }, ownerState.size === 'small' && _defineProperty(_defineProperty({
67
- width: 40,
68
- height: 24,
69
- padding: 7
70
- }, "& .".concat(switchClasses.thumb), {
71
- width: 16,
72
- height: 16
73
- }), "& .".concat(switchClasses.switchBase), _defineProperty({
74
- padding: 4
75
- }, "&.".concat(switchClasses.checked), {
76
- transform: 'translateX(16px)'
77
- })));
69
+ }, {
70
+ props: {
71
+ edge: 'end'
72
+ },
73
+ style: {
74
+ marginRight: -8
75
+ }
76
+ }, {
77
+ props: {
78
+ size: 'small'
79
+ },
80
+ style: _defineProperty(_defineProperty({
81
+ width: 40,
82
+ height: 24,
83
+ padding: 7
84
+ }, "& .".concat(switchClasses.thumb), {
85
+ width: 16,
86
+ height: 16
87
+ }), "& .".concat(switchClasses.switchBase), _defineProperty({
88
+ padding: 4
89
+ }, "&.".concat(switchClasses.checked), {
90
+ transform: 'translateX(16px)'
91
+ }))
92
+ }]
78
93
  });
79
94
  var SwitchSwitchBase = styled(SwitchBase, {
80
95
  name: 'MuiSwitch',
@@ -83,8 +98,8 @@ var SwitchSwitchBase = styled(SwitchBase, {
83
98
  var ownerState = props.ownerState;
84
99
  return [styles.switchBase, _defineProperty({}, "& .".concat(switchClasses.input), styles.input), ownerState.color !== 'default' && styles["color".concat(capitalize(ownerState.color))]];
85
100
  }
86
- })(function (_ref4) {
87
- var theme = _ref4.theme;
101
+ })(function (_ref2) {
102
+ var theme = _ref2.theme;
88
103
  return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
89
104
  position: 'absolute',
90
105
  top: 0,
@@ -107,30 +122,44 @@ var SwitchSwitchBase = styled(SwitchBase, {
107
122
  left: '-100%',
108
123
  width: '300%'
109
124
  });
110
- }, function (_ref6) {
111
- var theme = _ref6.theme,
112
- ownerState = _ref6.ownerState;
113
- return _extends({
125
+ }, function (_ref4) {
126
+ var theme = _ref4.theme;
127
+ return {
114
128
  '&:hover': {
115
129
  backgroundColor: theme.vars ? "rgba(".concat(theme.vars.palette.action.activeChannel, " / ").concat(theme.vars.palette.action.hoverOpacity, ")") : alpha(theme.palette.action.active, theme.palette.action.hoverOpacity),
116
130
  // Reset on touch devices, it doesn't add specificity
117
131
  '@media (hover: none)': {
118
132
  backgroundColor: 'transparent'
119
133
  }
120
- }
121
- }, ownerState.color !== 'default' && _defineProperty(_defineProperty({}, "&.".concat(switchClasses.checked), _defineProperty({
122
- color: (theme.vars || theme).palette[ownerState.color].main,
123
- '&:hover': {
124
- backgroundColor: theme.vars ? "rgba(".concat(theme.vars.palette[ownerState.color].mainChannel, " / ").concat(theme.vars.palette.action.hoverOpacity, ")") : alpha(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
125
- '@media (hover: none)': {
126
- backgroundColor: 'transparent'
127
- }
128
- }
129
- }, "&.".concat(switchClasses.disabled), {
130
- color: theme.vars ? theme.vars.palette.Switch["".concat(ownerState.color, "DisabledColor")] : "".concat(theme.palette.mode === 'light' ? lighten(theme.palette[ownerState.color].main, 0.62) : darken(theme.palette[ownerState.color].main, 0.55))
131
- })), "&.".concat(switchClasses.checked, " + .").concat(switchClasses.track), {
132
- backgroundColor: (theme.vars || theme).palette[ownerState.color].main
133
- }));
134
+ },
135
+ variants: _toConsumableArray(Object.entries(theme.palette).filter(function (_ref5) {
136
+ var _ref6 = _slicedToArray(_ref5, 2),
137
+ value = _ref6[1];
138
+ return value.main && value.light;
139
+ }) // check all the used fields in the style below
140
+ .map(function (_ref7) {
141
+ var _ref8 = _slicedToArray(_ref7, 1),
142
+ color = _ref8[0];
143
+ return {
144
+ props: {
145
+ color: color
146
+ },
147
+ style: _defineProperty(_defineProperty({}, "&.".concat(switchClasses.checked), _defineProperty({
148
+ color: (theme.vars || theme).palette[color].main,
149
+ '&:hover': {
150
+ backgroundColor: theme.vars ? "rgba(".concat(theme.vars.palette[color].mainChannel, " / ").concat(theme.vars.palette.action.hoverOpacity, ")") : alpha(theme.palette[color].main, theme.palette.action.hoverOpacity),
151
+ '@media (hover: none)': {
152
+ backgroundColor: 'transparent'
153
+ }
154
+ }
155
+ }, "&.".concat(switchClasses.disabled), {
156
+ color: theme.vars ? theme.vars.palette.Switch["".concat(color, "DisabledColor")] : "".concat(theme.palette.mode === 'light' ? lighten(theme.palette[color].main, 0.62) : darken(theme.palette[color].main, 0.55))
157
+ })), "&.".concat(switchClasses.checked, " + .").concat(switchClasses.track), {
158
+ backgroundColor: (theme.vars || theme).palette[color].main
159
+ })
160
+ };
161
+ }))
162
+ };
134
163
  });
135
164
  var SwitchTrack = styled('span', {
136
165
  name: 'MuiSwitch',
@@ -138,8 +167,8 @@ var SwitchTrack = styled('span', {
138
167
  overridesResolver: function overridesResolver(props, styles) {
139
168
  return styles.track;
140
169
  }
141
- })(function (_ref8) {
142
- var theme = _ref8.theme;
170
+ })(function (_ref9) {
171
+ var theme = _ref9.theme;
143
172
  return {
144
173
  height: '100%',
145
174
  width: '100%',
@@ -158,8 +187,8 @@ var SwitchThumb = styled('span', {
158
187
  overridesResolver: function overridesResolver(props, styles) {
159
188
  return styles.thumb;
160
189
  }
161
- })(function (_ref9) {
162
- var theme = _ref9.theme;
190
+ })(function (_ref10) {
191
+ var theme = _ref10.theme;
163
192
  return {
164
193
  boxShadow: (theme.vars || theme).shadows[1],
165
194
  backgroundColor: 'currentColor',
@@ -9,10 +9,10 @@ import PropTypes from 'prop-types';
9
9
  import clsx from 'clsx';
10
10
  import { useSlotProps } from '@mui/base/utils';
11
11
  import composeClasses from '@mui/utils/composeClasses';
12
+ import { useRtl } from '@mui/system/RtlProvider';
12
13
  import KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft';
13
14
  import KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight';
14
15
  import ButtonBase from '../ButtonBase';
15
- import useTheme from '../styles/useTheme';
16
16
  import useThemeProps from '../styles/useThemeProps';
17
17
  import styled from '../styles/styled';
18
18
  import tabScrollButtonClasses, { getTabScrollButtonUtilityClass } from './tabScrollButtonClasses';
@@ -64,8 +64,7 @@ var TabScrollButton = /*#__PURE__*/React.forwardRef(function TabScrollButton(inP
64
64
  orientation = props.orientation,
65
65
  disabled = props.disabled,
66
66
  other = _objectWithoutProperties(props, ["className", "slots", "slotProps", "direction", "orientation", "disabled"]);
67
- var theme = useTheme();
68
- var isRtl = theme.direction === 'rtl';
67
+ var isRtl = useRtl();
69
68
  var ownerState = _extends({
70
69
  isRtl: isRtl
71
70
  }, props);
@@ -4,9 +4,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
+ import { useRtl } from '@mui/system/RtlProvider';
7
8
  import KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft';
8
9
  import KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight';
9
- import useTheme from '../styles/useTheme';
10
10
  import IconButton from '../IconButton';
11
11
  import LastPageIconDefault from '../internal/svg-icons/LastPage';
12
12
  import FirstPageIconDefault from '../internal/svg-icons/FirstPage';
@@ -34,7 +34,7 @@ var TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginat
34
34
  _props$slotProps = props.slotProps,
35
35
  slotProps = _props$slotProps === void 0 ? {} : _props$slotProps,
36
36
  other = _objectWithoutProperties(props, ["backIconButtonProps", "count", "disabled", "getItemAriaLabel", "nextIconButtonProps", "onPageChange", "page", "rowsPerPage", "showFirstButton", "showLastButton", "slots", "slotProps"]);
37
- var theme = useTheme();
37
+ var isRtl = useRtl();
38
38
  var handleFirstPageButtonClick = function handleFirstPageButtonClick(event) {
39
39
  onPageChange(event, 0);
40
40
  };
@@ -55,14 +55,14 @@ var TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginat
55
55
  var LastButtonIcon = (_slots$lastButtonIcon = slots.lastButtonIcon) != null ? _slots$lastButtonIcon : LastPageIconDefault;
56
56
  var NextButtonIcon = (_slots$nextButtonIcon = slots.nextButtonIcon) != null ? _slots$nextButtonIcon : KeyboardArrowRight;
57
57
  var PreviousButtonIcon = (_slots$previousButton2 = slots.previousButtonIcon) != null ? _slots$previousButton2 : KeyboardArrowLeft;
58
- var FirstButtonSlot = theme.direction === 'rtl' ? LastButton : FirstButton;
59
- var PreviousButtonSlot = theme.direction === 'rtl' ? NextButton : PreviousButton;
60
- var NextButtonSlot = theme.direction === 'rtl' ? PreviousButton : NextButton;
61
- var LastButtonSlot = theme.direction === 'rtl' ? FirstButton : LastButton;
62
- var firstButtonSlotProps = theme.direction === 'rtl' ? slotProps.lastButton : slotProps.firstButton;
63
- var previousButtonSlotProps = theme.direction === 'rtl' ? slotProps.nextButton : slotProps.previousButton;
64
- var nextButtonSlotProps = theme.direction === 'rtl' ? slotProps.previousButton : slotProps.nextButton;
65
- var lastButtonSlotProps = theme.direction === 'rtl' ? slotProps.firstButton : slotProps.lastButton;
58
+ var FirstButtonSlot = isRtl ? LastButton : FirstButton;
59
+ var PreviousButtonSlot = isRtl ? NextButton : PreviousButton;
60
+ var NextButtonSlot = isRtl ? PreviousButton : NextButton;
61
+ var LastButtonSlot = isRtl ? FirstButton : LastButton;
62
+ var firstButtonSlotProps = isRtl ? slotProps.lastButton : slotProps.firstButton;
63
+ var previousButtonSlotProps = isRtl ? slotProps.nextButton : slotProps.previousButton;
64
+ var nextButtonSlotProps = isRtl ? slotProps.previousButton : slotProps.nextButton;
65
+ var lastButtonSlotProps = isRtl ? slotProps.firstButton : slotProps.lastButton;
66
66
  return /*#__PURE__*/_jsxs("div", _extends({
67
67
  ref: ref
68
68
  }, other, {
@@ -72,7 +72,7 @@ var TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginat
72
72
  "aria-label": getItemAriaLabel('first', page),
73
73
  title: getItemAriaLabel('first', page)
74
74
  }, firstButtonSlotProps, {
75
- children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon)) : /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon))
75
+ children: isRtl ? /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon)) : /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon))
76
76
  })), /*#__PURE__*/_jsx(PreviousButtonSlot, _extends({
77
77
  onClick: handleBackButtonClick,
78
78
  disabled: disabled || page === 0,
@@ -80,7 +80,7 @@ var TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginat
80
80
  "aria-label": getItemAriaLabel('previous', page),
81
81
  title: getItemAriaLabel('previous', page)
82
82
  }, previousButtonSlotProps != null ? previousButtonSlotProps : backIconButtonProps, {
83
- children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon)) : /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon))
83
+ children: isRtl ? /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon)) : /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon))
84
84
  })), /*#__PURE__*/_jsx(NextButtonSlot, _extends({
85
85
  onClick: handleNextButtonClick,
86
86
  disabled: disabled || (count !== -1 ? page >= Math.ceil(count / rowsPerPage) - 1 : false),
@@ -88,14 +88,14 @@ var TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginat
88
88
  "aria-label": getItemAriaLabel('next', page),
89
89
  title: getItemAriaLabel('next', page)
90
90
  }, nextButtonSlotProps != null ? nextButtonSlotProps : nextIconButtonProps, {
91
- children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon)) : /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon))
91
+ children: isRtl ? /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon)) : /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon))
92
92
  })), showLastButton && /*#__PURE__*/_jsx(LastButtonSlot, _extends({
93
93
  onClick: handleLastPageButtonClick,
94
94
  disabled: disabled || page >= Math.ceil(count / rowsPerPage) - 1,
95
95
  "aria-label": getItemAriaLabel('last', page),
96
96
  title: getItemAriaLabel('last', page)
97
97
  }, lastButtonSlotProps, {
98
- children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon)) : /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon))
98
+ children: isRtl ? /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon)) : /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon))
99
99
  }))]
100
100
  }));
101
101
  });
@@ -10,6 +10,7 @@ import clsx from 'clsx';
10
10
  import refType from '@mui/utils/refType';
11
11
  import { useSlotProps } from '@mui/base/utils';
12
12
  import composeClasses from '@mui/utils/composeClasses';
13
+ import { useRtl } from '@mui/system/RtlProvider';
13
14
  import styled from '../styles/styled';
14
15
  import useThemeProps from '../styles/useThemeProps';
15
16
  import useTheme from '../styles/useTheme';
@@ -199,7 +200,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
199
200
  name: 'MuiTabs'
200
201
  });
201
202
  var theme = useTheme();
202
- var isRtl = theme.direction === 'rtl';
203
+ var isRtl = useRtl();
203
204
  var ariaLabel = props['aria-label'],
204
205
  ariaLabelledBy = props['aria-labelledby'],
205
206
  action = props.action,
@@ -311,7 +312,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
311
312
  clientWidth: tabsNode.clientWidth,
312
313
  scrollLeft: tabsNode.scrollLeft,
313
314
  scrollTop: tabsNode.scrollTop,
314
- scrollLeftNormalized: getNormalizedScrollLeft(tabsNode, theme.direction),
315
+ scrollLeftNormalized: getNormalizedScrollLeft(tabsNode, isRtl ? 'rtl' : 'ltr'),
315
316
  scrollWidth: tabsNode.scrollWidth,
316
317
  top: rect.top,
317
318
  bottom: rect.bottom,
@@ -12,6 +12,7 @@ import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
12
12
  import { appendOwnerState } from '@mui/base/utils';
13
13
  import composeClasses from '@mui/utils/composeClasses';
14
14
  import { alpha } from '@mui/system/colorManipulator';
15
+ import { useRtl } from '@mui/system/RtlProvider';
15
16
  import styled from '../styles/styled';
16
17
  import useTheme from '../styles/useTheme';
17
18
  import useThemeProps from '../styles/useThemeProps';
@@ -197,10 +198,13 @@ export function testReset() {
197
198
  }
198
199
  function composeEventHandler(handler, eventHandler) {
199
200
  return function (event) {
201
+ for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
202
+ params[_key - 1] = arguments[_key];
203
+ }
200
204
  if (eventHandler) {
201
- eventHandler(event);
205
+ eventHandler.apply(void 0, [event].concat(params));
202
206
  }
203
- handler(event);
207
+ handler.apply(void 0, [event].concat(params));
204
208
  };
205
209
  }
206
210
 
@@ -263,7 +267,7 @@ var Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
263
267
  children: childrenProp
264
268
  });
265
269
  var theme = useTheme();
266
- var isRtl = theme.direction === 'rtl';
270
+ var isRtl = useRtl();
267
271
  var _React$useState = React.useState(),
268
272
  childNode = _React$useState[0],
269
273
  setChildNode = _React$useState[1];
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.15.11
2
+ * @mui/material v5.15.13
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -267,6 +267,9 @@ export default function extendTheme() {
267
267
 
268
268
  // MUI X - DataGrid needs this token.
269
269
  setColorChannel(palette.background, 'default');
270
+
271
+ // added for consistency with the `background.default` token
272
+ setColorChannel(palette.background, 'paper');
270
273
  setColorChannel(palette.common, 'background');
271
274
  setColorChannel(palette.common, 'onBackground');
272
275
  setColorChannel(palette, 'divider');
@@ -6,10 +6,9 @@ const _excluded = ["action", "children", "className", "closeText", "color", "com
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
9
- import { unstable_composeClasses as composeClasses } from '@mui/base';
10
- import { darken, lighten } from '@mui/system';
11
- import styled from '../styles/styled';
12
- import useThemeProps from '../styles/useThemeProps';
9
+ import composeClasses from '@mui/utils/composeClasses';
10
+ import { darken, lighten } from '@mui/system/colorManipulator';
11
+ import { styled, createUseThemeProps } from '../zero-styled';
13
12
  import useSlot from '../utils/useSlot';
14
13
  import capitalize from '../utils/capitalize';
15
14
  import Paper from '../Paper';
@@ -22,6 +21,7 @@ import InfoOutlinedIcon from '../internal/svg-icons/InfoOutlined';
22
21
  import CloseIcon from '../internal/svg-icons/Close';
23
22
  import { jsx as _jsx } from "react/jsx-runtime";
24
23
  import { jsxs as _jsxs } from "react/jsx-runtime";
24
+ const useThemeProps = createUseThemeProps('MuiAlert');
25
25
  const useUtilityClasses = ownerState => {
26
26
  const {
27
27
  variant,
@@ -30,7 +30,7 @@ const useUtilityClasses = ownerState => {
30
30
  classes
31
31
  } = ownerState;
32
32
  const slots = {
33
- root: ['root', `${variant}${capitalize(color || severity)}`, `${variant}`],
33
+ root: ['root', `color${capitalize(color || severity)}`, `${variant}${capitalize(color || severity)}`, `${variant}`],
34
34
  icon: ['icon'],
35
35
  message: ['message'],
36
36
  action: ['action']
@@ -47,41 +47,58 @@ const AlertRoot = styled(Paper, {
47
47
  return [styles.root, styles[ownerState.variant], styles[`${ownerState.variant}${capitalize(ownerState.color || ownerState.severity)}`]];
48
48
  }
49
49
  })(({
50
- theme,
51
- ownerState
50
+ theme
52
51
  }) => {
53
52
  const getColor = theme.palette.mode === 'light' ? darken : lighten;
54
53
  const getBackgroundColor = theme.palette.mode === 'light' ? lighten : darken;
55
- const color = ownerState.color || ownerState.severity;
56
54
  return _extends({}, theme.typography.body2, {
57
55
  backgroundColor: 'transparent',
58
56
  display: 'flex',
59
- padding: '6px 16px'
60
- }, color && ownerState.variant === 'standard' && {
61
- color: theme.vars ? theme.vars.palette.Alert[`${color}Color`] : getColor(theme.palette[color].light, 0.6),
62
- backgroundColor: theme.vars ? theme.vars.palette.Alert[`${color}StandardBg`] : getBackgroundColor(theme.palette[color].light, 0.9),
63
- [`& .${alertClasses.icon}`]: theme.vars ? {
64
- color: theme.vars.palette.Alert[`${color}IconColor`]
65
- } : {
66
- color: theme.palette[color].main
67
- }
68
- }, color && ownerState.variant === 'outlined' && {
69
- color: theme.vars ? theme.vars.palette.Alert[`${color}Color`] : getColor(theme.palette[color].light, 0.6),
70
- border: `1px solid ${(theme.vars || theme).palette[color].light}`,
71
- [`& .${alertClasses.icon}`]: theme.vars ? {
72
- color: theme.vars.palette.Alert[`${color}IconColor`]
73
- } : {
74
- color: theme.palette[color].main
75
- }
76
- }, color && ownerState.variant === 'filled' && _extends({
77
- fontWeight: theme.typography.fontWeightMedium
78
- }, theme.vars ? {
79
- color: theme.vars.palette.Alert[`${color}FilledColor`],
80
- backgroundColor: theme.vars.palette.Alert[`${color}FilledBg`]
81
- } : {
82
- backgroundColor: theme.palette.mode === 'dark' ? theme.palette[color].dark : theme.palette[color].main,
83
- color: theme.palette.getContrastText(theme.palette[color].main)
84
- }));
57
+ padding: '6px 16px',
58
+ variants: [...Object.entries(theme.palette).filter(([, value]) => value.main && value.light).map(([color]) => ({
59
+ props: {
60
+ colorSeverity: color,
61
+ variant: 'standard'
62
+ },
63
+ style: {
64
+ color: theme.vars ? theme.vars.palette.Alert[`${color}Color`] : getColor(theme.palette[color].light, 0.6),
65
+ backgroundColor: theme.vars ? theme.vars.palette.Alert[`${color}StandardBg`] : getBackgroundColor(theme.palette[color].light, 0.9),
66
+ [`& .${alertClasses.icon}`]: theme.vars ? {
67
+ color: theme.vars.palette.Alert[`${color}IconColor`]
68
+ } : {
69
+ color: theme.palette[color].main
70
+ }
71
+ }
72
+ })), ...Object.entries(theme.palette).filter(([, value]) => value.main && value.light).map(([color]) => ({
73
+ props: {
74
+ colorSeverity: color,
75
+ variant: 'outlined'
76
+ },
77
+ style: {
78
+ color: theme.vars ? theme.vars.palette.Alert[`${color}Color`] : getColor(theme.palette[color].light, 0.6),
79
+ border: `1px solid ${(theme.vars || theme).palette[color].light}`,
80
+ [`& .${alertClasses.icon}`]: theme.vars ? {
81
+ color: theme.vars.palette.Alert[`${color}IconColor`]
82
+ } : {
83
+ color: theme.palette[color].main
84
+ }
85
+ }
86
+ })), ...Object.entries(theme.palette).filter(([, value]) => value.main && value.dark).map(([color]) => ({
87
+ props: {
88
+ colorSeverity: color,
89
+ variant: 'filled'
90
+ },
91
+ style: _extends({
92
+ fontWeight: theme.typography.fontWeightMedium
93
+ }, theme.vars ? {
94
+ color: theme.vars.palette.Alert[`${color}FilledColor`],
95
+ backgroundColor: theme.vars.palette.Alert[`${color}FilledBg`]
96
+ } : {
97
+ backgroundColor: theme.palette.mode === 'dark' ? theme.palette[color].dark : theme.palette[color].main,
98
+ color: theme.palette.getContrastText(theme.palette[color].main)
99
+ })
100
+ }))]
101
+ });
85
102
  });
86
103
  const AlertIcon = styled('div', {
87
104
  name: 'MuiAlert',
@@ -154,7 +171,8 @@ const Alert = /*#__PURE__*/React.forwardRef(function Alert(inProps, ref) {
154
171
  const ownerState = _extends({}, props, {
155
172
  color,
156
173
  severity,
157
- variant
174
+ variant,
175
+ colorSeverity: color || severity
158
176
  });
159
177
  const classes = useUtilityClasses(ownerState);
160
178
  const externalForwardedProps = {
@@ -3,5 +3,5 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
3
3
  export function getAlertUtilityClass(slot) {
4
4
  return generateUtilityClass('MuiAlert', slot);
5
5
  }
6
- const alertClasses = generateUtilityClasses('MuiAlert', ['root', 'action', 'icon', 'message', 'filled', 'filledSuccess', 'filledInfo', 'filledWarning', 'filledError', 'outlined', 'outlinedSuccess', 'outlinedInfo', 'outlinedWarning', 'outlinedError', 'standard', 'standardSuccess', 'standardInfo', 'standardWarning', 'standardError']);
6
+ const alertClasses = generateUtilityClasses('MuiAlert', ['root', 'action', 'icon', 'message', 'filled', 'colorSuccess', 'colorInfo', 'colorWarning', 'colorError', 'filledSuccess', 'filledInfo', 'filledWarning', 'filledError', 'outlined', 'outlinedSuccess', 'outlinedInfo', 'outlinedWarning', 'outlinedError', 'standard', 'standardSuccess', 'standardInfo', 'standardWarning', 'standardError']);
7
7
  export default alertClasses;
@@ -7,11 +7,11 @@ import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
9
9
  import composeClasses from '@mui/utils/composeClasses';
10
- import styled from '../styles/styled';
11
- import useThemeProps from '../styles/useThemeProps';
10
+ import { styled, createUseThemeProps } from '../zero-styled';
12
11
  import Typography from '../Typography';
13
12
  import { getAlertTitleUtilityClass } from './alertTitleClasses';
14
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
+ const useThemeProps = createUseThemeProps('MuiAlertTitle');
15
15
  const useUtilityClasses = ownerState => {
16
16
  const {
17
17
  classes