@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
@@ -91,7 +91,7 @@ export interface CheckboxProps
91
91
  * `small` is equivalent to the dense checkbox styling.
92
92
  * @default 'medium'
93
93
  */
94
- size?: OverridableStringUnion<'small' | 'medium', CheckboxPropsSizeOverrides>;
94
+ size?: OverridableStringUnion<'small' | 'medium' | 'large', CheckboxPropsSizeOverrides>;
95
95
  /**
96
96
  * The system prop that allows defining system overrides as well as additional CSS styles.
97
97
  */
@@ -21,71 +21,123 @@ export interface ChipClasses {
21
21
  disabled: string;
22
22
  /** Styles applied to the root element if `onClick` is defined or `clickable={true}`. */
23
23
  clickable: string;
24
- /** Styles applied to the root element if `onClick` and `color="primary"` is defined or `clickable={true}`. */
24
+ /** Styles applied to the root element if `onClick` and `color="primary"` is defined or `clickable={true}`.
25
+ * @deprecated Combine the [.MuiChip-clickable](/material-ui/api/chip/#chip-classes-clickable) and [.MuiChip-colorPrimary](/material-ui/api/chip/#chip-classes-colorPrimary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
26
+ */
25
27
  clickableColorPrimary: string;
26
- /** Styles applied to the root element if `onClick` and `color="secondary"` is defined or `clickable={true}`. */
28
+ /** Styles applied to the root element if `onClick` and `color="secondary"` is defined or `clickable={true}`.
29
+ * @deprecated Combine the [.MuiChip-clickable](/material-ui/api/chip/#chip-classes-clickable) and [.MuiChip-colorSecondary](/material-ui/api/chip/#chip-classes-colorSecondary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
30
+ */
27
31
  clickableColorSecondary: string;
28
32
  /** Styles applied to the root element if `onDelete` is defined. */
29
33
  deletable: string;
30
- /** Styles applied to the root element if `onDelete` and `color="primary"` is defined. */
34
+ /** Styles applied to the root element if `onDelete` and `color="primary"` is defined.
35
+ * @deprecated Combine the [.MuiChip-deletable](/material-ui/api/chip/#chip-classes-deletable) and [.MuiChip-colorPrimary](/material-ui/api/chip/#chip-classes-colorPrimary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
36
+ */
31
37
  deletableColorPrimary: string;
32
- /** Styles applied to the root element if `onDelete` and `color="secondary"` is defined. */
38
+ /** Styles applied to the root element if `onDelete` and `color="secondary"` is defined.
39
+ * @deprecated Combine the [.MuiChip-deletable](/material-ui/api/chip/#chip-classes-deletable) and [.MuiChip-colorSecondary](/material-ui/api/chip/#chip-classes-colorSecondary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
40
+ */
33
41
  deletableColorSecondary: string;
34
42
  /** Styles applied to the root element if `variant="outlined"`. */
35
43
  outlined: string;
36
44
  /** Styles applied to the root element if `variant="filled"`. */
37
45
  filled: string;
38
- /** Styles applied to the root element if `variant="outlined"` and `color="primary"`. */
46
+ /** Styles applied to the root element if `variant="outlined"` and `color="primary"`.
47
+ * @deprecated Combine the [.MuiChip-outlined](/material-ui/api/chip/#chip-classes-outlined) and [.MuiChip-colorPrimary](/material-ui/api/chip/#chip-classes-colorPrimary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
48
+ */
39
49
  outlinedPrimary: string;
40
- /** Styles applied to the root element if `variant="outlined"` and `color="secondary"`. */
50
+ /** Styles applied to the root element if `variant="outlined"` and `color="secondary"`.
51
+ * @deprecated Combine the [.MuiChip-outlined](/material-ui/api/chip/#chip-classes-outlined) and [.MuiChip-colorSecondary](/material-ui/api/chip/#chip-classes-colorSecondary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
52
+ */
41
53
  outlinedSecondary: string;
42
- /** Styles applied to the root element if `variant="filled"` and `color="primary"`. */
54
+ /** Styles applied to the root element if `variant="filled"` and `color="primary"`.
55
+ * @deprecated Combine the [.MuiChip-filled](/material-ui/api/chip/#chip-classes-filled) and [.MuiChip-colorPrimary](/material-ui/api/chip/#chip-classes-colorPrimary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
56
+ */
43
57
  filledPrimary: string;
44
- /** Styles applied to the root element if `variant="filled"` and `color="secondary"`. */
58
+ /** Styles applied to the root element if `variant="filled"` and `color="secondary"`.
59
+ * @deprecated Combine the [.MuiChip-filled](/material-ui/api/chip/#chip-classes-filled) and [.MuiChip-colorSecondary](/material-ui/api/chip/#chip-classes-colorSecondary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
60
+ */
45
61
  filledSecondary: string;
46
62
  /** Styles applied to the avatar element. */
47
63
  avatar: string;
48
- /** Styles applied to the avatar element if `size="small"`. */
64
+ /** Styles applied to the avatar element if `size="small"`.
65
+ * @deprecated Combine the [.MuiChip-avatar](/material-ui/api/chip/#chip-classes-avatar) and [.MuiChip-sizeSmall](/material-ui/api/chip/#chip-classes-sizeSmall) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
66
+ */
49
67
  avatarSmall: string;
50
- /** Styles applied to the avatar element if `size="medium"`. */
68
+ /** Styles applied to the avatar element if `size="medium"`.
69
+ * @deprecated Combine the [.MuiChip-avatar](/material-ui/api/chip/#chip-classes-avatar) and [.MuiChip-sizeMedium](/material-ui/api/chip/#chip-classes-sizeMedium) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
70
+ */
51
71
  avatarMedium: string;
52
- /** Styles applied to the avatar element if `color="primary"`. */
72
+ /** Styles applied to the avatar element if `color="primary"`.
73
+ * @deprecated Combine the [.MuiChip-avatar](/material-ui/api/chip/#chip-classes-avatar) and [.MuiChip-colorPrimary](/material-ui/api/chip/#chip-classes-colorPrimary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
74
+ */
53
75
  avatarColorPrimary: string;
54
- /** Styles applied to the avatar element if `color="secondary"`. */
76
+ /** Styles applied to the avatar element if `color="secondary"`.
77
+ * @deprecated Combine the [.MuiChip-avatar](/material-ui/api/chip/#chip-classes-avatar) and [.MuiChip-colorSecondary](/material-ui/api/chip/#chip-classes-colorSecondary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
78
+ */
55
79
  avatarColorSecondary: string;
56
80
  /** Styles applied to the icon element. */
57
81
  icon: string;
58
- /** Styles applied to the icon element if `size="small"`. */
82
+ /** Styles applied to the icon element if `size="small"`.
83
+ * @deprecated Combine the [.MuiChip-icon](/material-ui/api/chip/#chip-classes-icon) and [.MuiChip-sizeSmall](/material-ui/api/chip/#chip-classes-sizeSmall) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
84
+ */
59
85
  iconSmall: string;
60
- /** Styles applied to the icon element if `size="medium"`. */
86
+ /** Styles applied to the icon element if `size="medium"`.
87
+ * @deprecated Combine the [.MuiChip-icon](/material-ui/api/chip/#chip-classes-icon) and [.MuiChip-sizeMedium](/material-ui/api/chip/#chip-classes-sizeMedium) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
88
+ */
61
89
  iconMedium: string;
62
- /** Styles applied to the icon element if `color="primary"`. */
90
+ /** Styles applied to the icon element if `color="primary"`.
91
+ * @deprecated Combine the [.MuiChip-icon](/material-ui/api/chip/#chip-classes-icon) and [.MuiChip-colorPrimary](/material-ui/api/chip/#chip-classes-colorPrimary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
92
+ */
63
93
  iconColorPrimary: string;
64
- /** Styles applied to the icon element if `color="secondary"`. */
94
+ /** Styles applied to the icon element if `color="secondary"`.
95
+ * @deprecated Combine the [.MuiChip-icon](/material-ui/api/chip/#chip-classes-icon) and [.MuiChip-colorSecondary](/material-ui/api/chip/#chip-classes-colorSecondary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
96
+ */
65
97
  iconColorSecondary: string;
66
98
  /** Styles applied to the label `span` element. */
67
99
  label: string;
68
- /** Styles applied to the label `span` element if `size="small"`. */
100
+ /** Styles applied to the label `span` element if `size="small"`.
101
+ * @deprecated Combine the [.MuiChip-label](/material-ui/api/chip/#chip-classes-label) and [.MuiChip-sizeSmall](/material-ui/api/chip/#chip-classes-sizeSmall) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
102
+ */
69
103
  labelSmall: string;
70
- /** Styles applied to the label `span` element if `size="medium"`. */
104
+ /** Styles applied to the label `span` element if `size="medium"`.
105
+ * @deprecated Combine the [.MuiChip-label](/material-ui/api/chip/#chip-classes-label) and [.MuiChip-sizeMedium](/material-ui/api/chip/#chip-classes-sizeMedium) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
106
+ */
71
107
  labelMedium: string;
72
108
  /** Styles applied to the deleteIcon element. */
73
109
  deleteIcon: string;
74
- /** Styles applied to the deleteIcon element if `size="small"`. */
110
+ /** Styles applied to the deleteIcon element if `size="small"`.
111
+ * @deprecated Combine the [.MuiChip-deleteIcon](/material-ui/api/chip/#chip-classes-deleteIcon) and [.MuiChip-sizeSmall](/material-ui/api/chip/#chip-classes-sizeSmall) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
112
+ */
75
113
  deleteIconSmall: string;
76
- /** Styles applied to the deleteIcon element if `size="medium"`. */
114
+ /** Styles applied to the deleteIcon element if `size="medium"`.
115
+ * @deprecated Combine the [.MuiChip-deleteIcon](/material-ui/api/chip/#chip-classes-deleteIcon) and [.MuiChip-sizeMedium](/material-ui/api/chip/#chip-classes-sizeMedium) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
116
+ */
77
117
  deleteIconMedium: string;
78
- /** Styles applied to the deleteIcon element if `color="primary"` and `variant="filled"`. */
118
+ /** Styles applied to the deleteIcon element if `color="primary"`.
119
+ * @deprecated Combine the [.MuiChip-deleteIcon](/material-ui/api/chip/#chip-classes-deleteIcon) and [.MuiChip-colorPrimary](/material-ui/api/chip/#chip-classes-colorPrimary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
120
+ */
79
121
  deleteIconColorPrimary: string;
80
- /** Styles applied to the deleteIcon element if `color="secondary"` and `variant="filled"`. */
122
+ /** Styles applied to the deleteIcon element if `color="secondary"`.
123
+ * @deprecated Combine the [.MuiChip-deleteIcon](/material-ui/api/chip/#chip-classes-deleteIcon) and [.MuiChip-colorSecondary](/material-ui/api/chip/#chip-classes-colorSecondary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
124
+ */
81
125
  deleteIconColorSecondary: string;
82
- /** Styles applied to the deleteIcon element if `color="primary"` and `variant="outlined"`. */
126
+ /** Styles applied to the deleteIcon element if `color="primary"` and `variant="outlined"`.
127
+ * @deprecated Combine the [.MuiChip-deleteIcon](/material-ui/api/chip/#chip-classes-deleteIcon) , [.MuiChip-outlined](/material-ui/api/chip/#chip-classes-outlined) and [.MuiChip-colorPrimary](/material-ui/api/chip/#chip-classes-colorPrimary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
128
+ */
83
129
  deleteIconOutlinedColorPrimary: string;
84
- /** Styles applied to the deleteIcon element if `color="secondary"` and `variant="outlined"`. */
130
+ /** Styles applied to the deleteIcon element if `color="secondary"` and `variant="outlined"`.
131
+ * @deprecated Combine the [.MuiChip-deleteIcon](/material-ui/api/chip/#chip-classes-deleteIcon) , [.MuiChip-outlined](/material-ui/api/chip/#chip-classes-outlined) and [.MuiChip-colorSecondary](/material-ui/api/chip/#chip-classes-colorSecondary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
132
+ */
85
133
  deleteIconOutlinedColorSecondary: string;
86
- /** Styles applied to the deleteIcon element if `color="primary"` and `variant="filled"`. */
134
+ /** Styles applied to the deleteIcon element if `color="primary"` and `variant="filled"`.
135
+ * @deprecated Combine the [.MuiChip-deleteIcon](/material-ui/api/chip/#chip-classes-deleteIcon) , [.MuiChip-filled](/material-ui/api/chip/#chip-classes-filled) and [.MuiChip-colorPrimary](/material-ui/api/chip/#chip-classes-colorPrimary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
136
+ */
87
137
  deleteIconFilledColorPrimary: string;
88
- /** Styles applied to the deleteIcon element if `color="secondary"` and `variant="filled"`. */
138
+ /** Styles applied to the deleteIcon element if `color="secondary"` and `variant="filled"`.
139
+ * @deprecated Combine the [.MuiChip-deleteIcon](/material-ui/api/chip/#chip-classes-deleteIcon) , [.MuiChip-filled](/material-ui/api/chip/#chip-classes-filled) and [.MuiChip-colorSecondary](/material-ui/api/chip/#chip-classes-colorSecondary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
140
+ */
89
141
  deleteIconFilledColorSecondary: string;
90
142
  /** State class applied to the root element if keyboard focused. */
91
143
  focusVisible: string;
package/Drawer/Drawer.js CHANGED
@@ -9,6 +9,7 @@ import PropTypes from 'prop-types';
9
9
  import clsx from 'clsx';
10
10
  import integerPropType from '@mui/utils/integerPropType';
11
11
  import composeClasses from '@mui/utils/composeClasses';
12
+ import { useRtl } from '@mui/system/RtlProvider';
12
13
  import Modal from '../Modal';
13
14
  import Slide from '../Slide';
14
15
  import Paper from '../Paper';
@@ -119,8 +120,10 @@ const oppositeDirection = {
119
120
  export function isHorizontal(anchor) {
120
121
  return ['left', 'right'].indexOf(anchor) !== -1;
121
122
  }
122
- export function getAnchor(theme, anchor) {
123
- return theme.direction === 'rtl' && isHorizontal(anchor) ? oppositeDirection[anchor] : anchor;
123
+ export function getAnchor({
124
+ direction
125
+ }, anchor) {
126
+ return direction === 'rtl' && isHorizontal(anchor) ? oppositeDirection[anchor] : anchor;
124
127
  }
125
128
 
126
129
  /**
@@ -133,6 +136,7 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
133
136
  name: 'MuiDrawer'
134
137
  });
135
138
  const theme = useTheme();
139
+ const isRtl = useRtl();
136
140
  const defaultTransitionDuration = {
137
141
  enter: theme.transitions.duration.enteringScreen,
138
142
  exit: theme.transitions.duration.leavingScreen
@@ -166,7 +170,9 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
166
170
  React.useEffect(() => {
167
171
  mounted.current = true;
168
172
  }, []);
169
- const anchorInvariant = getAnchor(theme, anchorProp);
173
+ const anchorInvariant = getAnchor({
174
+ direction: isRtl ? 'rtl' : 'ltr'
175
+ }, anchorProp);
170
176
  const anchor = anchorProp;
171
177
  const ownerState = _extends({}, props, {
172
178
  anchor,
@@ -16,8 +16,8 @@ import clsx from 'clsx';
16
16
  import composeClasses from '@mui/utils/composeClasses';
17
17
  import { keyframes, css } from '@mui/system';
18
18
  import { darken, lighten } from '@mui/system/colorManipulator';
19
+ import { useRtl } from '@mui/system/RtlProvider';
19
20
  import capitalize from '../utils/capitalize';
20
- import useTheme from '../styles/useTheme';
21
21
  import styled from '../styles/styled';
22
22
  import useThemeProps from '../styles/useThemeProps';
23
23
  import { getLinearProgressUtilityClass } from './linearProgressClasses';
@@ -255,7 +255,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
255
255
  variant
256
256
  });
257
257
  const classes = useUtilityClasses(ownerState);
258
- const theme = useTheme();
258
+ const isRtl = useRtl();
259
259
  const rootProps = {};
260
260
  const inlineStyles = {
261
261
  bar1: {},
@@ -267,7 +267,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
267
267
  rootProps['aria-valuemin'] = 0;
268
268
  rootProps['aria-valuemax'] = 100;
269
269
  let transform = value - 100;
270
- if (theme.direction === 'rtl') {
270
+ if (isRtl) {
271
271
  transform = -transform;
272
272
  }
273
273
  inlineStyles.bar1.transform = `translateX(${transform}%)`;
@@ -278,7 +278,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
278
278
  if (variant === 'buffer') {
279
279
  if (valueBuffer !== undefined) {
280
280
  let transform = (valueBuffer || 0) - 100;
281
- if (theme.direction === 'rtl') {
281
+ if (isRtl) {
282
282
  transform = -transform;
283
283
  }
284
284
  inlineStyles.bar2.transform = `translateX(${transform}%)`;
package/Menu/Menu.js CHANGED
@@ -11,10 +11,10 @@ import clsx from 'clsx';
11
11
  import composeClasses from '@mui/utils/composeClasses';
12
12
  import { useSlotProps } from '@mui/base/utils';
13
13
  import HTMLElementType from '@mui/utils/HTMLElementType';
14
+ import { useRtl } from '@mui/system/RtlProvider';
14
15
  import MenuList from '../MenuList';
15
16
  import Popover, { PopoverPaper } from '../Popover';
16
17
  import styled, { rootShouldForwardProp } from '../styles/styled';
17
- import useTheme from '../styles/useTheme';
18
18
  import useThemeProps from '../styles/useThemeProps';
19
19
  import { getMenuUtilityClass } from './menuClasses';
20
20
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -89,8 +89,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
89
89
  } = props,
90
90
  TransitionProps = _objectWithoutPropertiesLoose(props.TransitionProps, _excluded),
91
91
  other = _objectWithoutPropertiesLoose(props, _excluded2);
92
- const theme = useTheme();
93
- const isRtl = theme.direction === 'rtl';
92
+ const isRtl = useRtl();
94
93
  const ownerState = _extends({}, props, {
95
94
  autoFocus,
96
95
  disableAutoFocusItem,
@@ -106,7 +105,9 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
106
105
  const menuListActionsRef = React.useRef(null);
107
106
  const handleEntering = (element, isAppearing) => {
108
107
  if (menuListActionsRef.current) {
109
- menuListActionsRef.current.adjustStyleForScrollbar(element, theme);
108
+ menuListActionsRef.current.adjustStyleForScrollbar(element, {
109
+ direction: isRtl ? 'rtl' : 'ltr'
110
+ });
110
111
  }
111
112
  if (onEntering) {
112
113
  onEntering(element, isAppearing);
@@ -107,13 +107,15 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
107
107
  }
108
108
  }, [autoFocus]);
109
109
  React.useImperativeHandle(actions, () => ({
110
- adjustStyleForScrollbar: (containerElement, theme) => {
110
+ adjustStyleForScrollbar: (containerElement, {
111
+ direction
112
+ }) => {
111
113
  // Let's ignore that piece of logic if users are already overriding the width
112
114
  // of the menu.
113
115
  const noExplicitWidth = !listRef.current.style.width;
114
116
  if (containerElement.clientHeight < listRef.current.clientHeight && noExplicitWidth) {
115
117
  const scrollbarSize = `${getScrollbarSize(ownerDocument(containerElement))}px`;
116
- listRef.current.style[theme.direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
118
+ listRef.current.style[direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
117
119
  listRef.current.style.width = `calc(100% + ${scrollbarSize})`;
118
120
  }
119
121
  return listRef.current;
@@ -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';
@@ -234,9 +234,9 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
234
234
  type,
235
235
  variant
236
236
  });
237
- const theme = useTheme();
237
+ const isRtl = useRtl();
238
238
  const classes = useUtilityClasses(ownerState);
239
- const normalizedIcons = theme.direction === 'rtl' ? {
239
+ const normalizedIcons = isRtl ? {
240
240
  previous: slots.next || components.next || NavigateNextIcon,
241
241
  next: slots.previous || components.previous || NavigateBeforeIcon,
242
242
  last: slots.first || components.first || FirstPageIcon,
package/README.md CHANGED
@@ -22,7 +22,7 @@ Visit [https://mui.com/material-ui/](https://mui.com/material-ui/) to view the f
22
22
  ## Questions
23
23
 
24
24
  For how-to questions that don't involve making changes to the code base, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/material-ui) instead of GitHub issues.
25
- Use the "material-ui" tag on Stack Overflow to make it easier for the community to find your question.
25
+ Use the "material-ui" tag on Stack Overflow to make it easier for the community to find your question.
26
26
 
27
27
  ## Examples
28
28
 
package/Rating/Rating.js CHANGED
@@ -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';
@@ -300,7 +300,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
300
300
  name: 'Rating'
301
301
  });
302
302
  const valueRounded = roundValueToPrecision(valueDerived, precision);
303
- const theme = useTheme();
303
+ const isRtl = useRtl();
304
304
  const [{
305
305
  hover,
306
306
  focus
@@ -335,7 +335,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
335
335
  width: containerWidth
336
336
  } = rootNode.getBoundingClientRect();
337
337
  let percent;
338
- if (theme.direction === 'rtl') {
338
+ if (isRtl) {
339
339
  percent = (right - event.clientX) / containerWidth;
340
340
  } else {
341
341
  percent = (event.clientX - left) / containerWidth;
@@ -46,8 +46,7 @@ export interface SliderOwnProps {
46
46
  /**
47
47
  * The components used for each slot inside.
48
48
  *
49
- * This prop is an alias for the `slots` prop.
50
- * It's recommended to use the `slots` prop instead.
49
+ * @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
51
50
  *
52
51
  * @default {}
53
52
  */
@@ -65,8 +64,7 @@ export interface SliderOwnProps {
65
64
  * The extra props for the slot components.
66
65
  * You can override the existing props or add new ones.
67
66
  *
68
- * This prop is an alias for the `slotProps` prop.
69
- * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
67
+ * @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
70
68
  *
71
69
  * @default {}
72
70
  */
package/Slider/Slider.js CHANGED
@@ -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';
@@ -371,8 +371,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
371
371
  props: inputProps,
372
372
  name: 'MuiSlider'
373
373
  });
374
- const theme = useTheme();
375
- const isRtl = theme.direction === 'rtl';
374
+ const isRtl = useRtl();
376
375
  const {
377
376
  'aria-label': ariaLabel,
378
377
  'aria-valuetext': ariaValuetext,
@@ -633,8 +632,7 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
633
632
  /**
634
633
  * The components used for each slot inside.
635
634
  *
636
- * This prop is an alias for the `slots` prop.
637
- * It's recommended to use the `slots` prop instead.
635
+ * @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
638
636
  *
639
637
  * @default {}
640
638
  */
@@ -652,8 +650,7 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
652
650
  * The extra props for the slot components.
653
651
  * You can override the existing props or add new ones.
654
652
  *
655
- * This prop is an alias for the `slotProps` prop.
656
- * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
653
+ * @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
657
654
  *
658
655
  * @default {}
659
656
  */
package/Switch/Switch.js CHANGED
@@ -12,11 +12,11 @@ import composeClasses from '@mui/utils/composeClasses';
12
12
  import { alpha, darken, lighten } from '@mui/system/colorManipulator';
13
13
  import capitalize from '../utils/capitalize';
14
14
  import SwitchBase from '../internal/SwitchBase';
15
- import useThemeProps from '../styles/useThemeProps';
16
- import styled from '../styles/styled';
15
+ import { styled, createUseThemeProps } from '../zero-styled';
17
16
  import switchClasses, { getSwitchUtilityClass } from './switchClasses';
18
17
  import { jsx as _jsx } from "react/jsx-runtime";
19
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ const useThemeProps = createUseThemeProps('MuiSwitch');
20
20
  const useUtilityClasses = ownerState => {
21
21
  const {
22
22
  classes,
@@ -45,9 +45,7 @@ const SwitchRoot = styled('span', {
45
45
  } = props;
46
46
  return [styles.root, ownerState.edge && styles[`edge${capitalize(ownerState.edge)}`], styles[`size${capitalize(ownerState.size)}`]];
47
47
  }
48
- })(({
49
- ownerState
50
- }) => _extends({
48
+ })({
51
49
  display: 'inline-flex',
52
50
  width: 34 + 12 * 2,
53
51
  height: 14 + 12 * 2,
@@ -62,26 +60,42 @@ const SwitchRoot = styled('span', {
62
60
  // For correct alignment with the text.
63
61
  '@media print': {
64
62
  colorAdjust: 'exact'
65
- }
66
- }, ownerState.edge === 'start' && {
67
- marginLeft: -8
68
- }, ownerState.edge === 'end' && {
69
- marginRight: -8
70
- }, ownerState.size === 'small' && {
71
- width: 40,
72
- height: 24,
73
- padding: 7,
74
- [`& .${switchClasses.thumb}`]: {
75
- width: 16,
76
- height: 16
77
63
  },
78
- [`& .${switchClasses.switchBase}`]: {
79
- padding: 4,
80
- [`&.${switchClasses.checked}`]: {
81
- transform: 'translateX(16px)'
64
+ variants: [{
65
+ props: {
66
+ edge: 'start'
67
+ },
68
+ style: {
69
+ marginLeft: -8
82
70
  }
83
- }
84
- }));
71
+ }, {
72
+ props: {
73
+ edge: 'end'
74
+ },
75
+ style: {
76
+ marginRight: -8
77
+ }
78
+ }, {
79
+ props: {
80
+ size: 'small'
81
+ },
82
+ style: {
83
+ width: 40,
84
+ height: 24,
85
+ padding: 7,
86
+ [`& .${switchClasses.thumb}`]: {
87
+ width: 16,
88
+ height: 16
89
+ },
90
+ [`& .${switchClasses.switchBase}`]: {
91
+ padding: 4,
92
+ [`&.${switchClasses.checked}`]: {
93
+ transform: 'translateX(16px)'
94
+ }
95
+ }
96
+ }
97
+ }]
98
+ });
85
99
  const SwitchSwitchBase = styled(SwitchBase, {
86
100
  name: 'MuiSwitch',
87
101
  slot: 'SwitchBase',
@@ -122,32 +136,38 @@ const SwitchSwitchBase = styled(SwitchBase, {
122
136
  width: '300%'
123
137
  }
124
138
  }), ({
125
- theme,
126
- ownerState
127
- }) => _extends({
139
+ theme
140
+ }) => ({
128
141
  '&:hover': {
129
142
  backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.action.active, theme.palette.action.hoverOpacity),
130
143
  // Reset on touch devices, it doesn't add specificity
131
144
  '@media (hover: none)': {
132
145
  backgroundColor: 'transparent'
133
146
  }
134
- }
135
- }, ownerState.color !== 'default' && {
136
- [`&.${switchClasses.checked}`]: {
137
- color: (theme.vars || theme).palette[ownerState.color].main,
138
- '&:hover': {
139
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
140
- '@media (hover: none)': {
141
- backgroundColor: 'transparent'
142
- }
147
+ },
148
+ variants: [...Object.entries(theme.palette).filter(([, value]) => value.main && value.light) // check all the used fields in the style below
149
+ .map(([color]) => ({
150
+ props: {
151
+ color
143
152
  },
144
- [`&.${switchClasses.disabled}`]: {
145
- color: theme.vars ? theme.vars.palette.Switch[`${ownerState.color}DisabledColor`] : `${theme.palette.mode === 'light' ? lighten(theme.palette[ownerState.color].main, 0.62) : darken(theme.palette[ownerState.color].main, 0.55)}`
153
+ style: {
154
+ [`&.${switchClasses.checked}`]: {
155
+ color: (theme.vars || theme).palette[color].main,
156
+ '&:hover': {
157
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[color].main, theme.palette.action.hoverOpacity),
158
+ '@media (hover: none)': {
159
+ backgroundColor: 'transparent'
160
+ }
161
+ },
162
+ [`&.${switchClasses.disabled}`]: {
163
+ color: theme.vars ? theme.vars.palette.Switch[`${color}DisabledColor`] : `${theme.palette.mode === 'light' ? lighten(theme.palette[color].main, 0.62) : darken(theme.palette[color].main, 0.55)}`
164
+ }
165
+ },
166
+ [`&.${switchClasses.checked} + .${switchClasses.track}`]: {
167
+ backgroundColor: (theme.vars || theme).palette[color].main
168
+ }
146
169
  }
147
- },
148
- [`&.${switchClasses.checked} + .${switchClasses.track}`]: {
149
- backgroundColor: (theme.vars || theme).palette[ownerState.color].main
150
- }
170
+ }))]
151
171
  }));
152
172
  const SwitchTrack = styled('span', {
153
173
  name: 'MuiSwitch',
@@ -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';
@@ -66,8 +66,7 @@ const TabScrollButton = /*#__PURE__*/React.forwardRef(function TabScrollButton(i
66
66
  direction
67
67
  } = props,
68
68
  other = _objectWithoutPropertiesLoose(props, _excluded);
69
- const theme = useTheme();
70
- const isRtl = theme.direction === 'rtl';
69
+ const isRtl = useRtl();
71
70
  const ownerState = _extends({
72
71
  isRtl
73
72
  }, props);