@mui/material 6.0.0-alpha.3 → 6.0.0-alpha.5

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 (86) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/Checkbox/Checkbox.js +51 -20
  3. package/FormControlLabel/FormControlLabel.d.ts +21 -14
  4. package/FormControlLabel/FormControlLabel.js +22 -4
  5. package/FormHelperText/FormHelperText.js +18 -8
  6. package/IconButton/IconButton.js +97 -40
  7. package/ImageList/ImageList.js +16 -14
  8. package/ImageListItem/ImageListItem.js +37 -22
  9. package/ImageListItemBar/ImageListItemBar.js +65 -32
  10. package/ListItem/ListItem.js +94 -50
  11. package/ListItemAvatar/ListItemAvatar.js +12 -8
  12. package/ListItemButton/ListItemButton.js +35 -15
  13. package/ListItemSecondaryAction/ListItemSecondaryAction.js +12 -8
  14. package/ListItemText/ListItemText.js +20 -11
  15. package/ListSubheader/ListSubheader.js +44 -19
  16. package/PaginationItem/PaginationItem.d.ts +26 -14
  17. package/PaginationItem/PaginationItem.js +64 -20
  18. package/Radio/Radio.js +50 -20
  19. package/Radio/RadioButtonIcon.js +18 -12
  20. package/Rating/Rating.js +71 -37
  21. package/SvgIcon/SvgIcon.js +73 -21
  22. package/Table/Table.js +11 -6
  23. package/TableCell/TableCell.js +96 -41
  24. package/TableSortLabel/TableSortLabel.js +19 -9
  25. package/Toolbar/Toolbar.js +33 -17
  26. package/Typography/Typography.js +3 -2
  27. package/index.js +1 -1
  28. package/modern/Checkbox/Checkbox.js +51 -20
  29. package/modern/FormControlLabel/FormControlLabel.js +22 -4
  30. package/modern/FormHelperText/FormHelperText.js +18 -8
  31. package/modern/IconButton/IconButton.js +97 -40
  32. package/modern/ImageList/ImageList.js +16 -14
  33. package/modern/ImageListItem/ImageListItem.js +37 -22
  34. package/modern/ImageListItemBar/ImageListItemBar.js +65 -32
  35. package/modern/ListItem/ListItem.js +94 -50
  36. package/modern/ListItemAvatar/ListItemAvatar.js +12 -8
  37. package/modern/ListItemButton/ListItemButton.js +35 -15
  38. package/modern/ListItemSecondaryAction/ListItemSecondaryAction.js +12 -8
  39. package/modern/ListItemText/ListItemText.js +20 -11
  40. package/modern/ListSubheader/ListSubheader.js +44 -19
  41. package/modern/PaginationItem/PaginationItem.js +64 -20
  42. package/modern/Radio/Radio.js +50 -20
  43. package/modern/Radio/RadioButtonIcon.js +18 -12
  44. package/modern/Rating/Rating.js +71 -37
  45. package/modern/SvgIcon/SvgIcon.js +73 -21
  46. package/modern/Table/Table.js +11 -6
  47. package/modern/TableCell/TableCell.js +96 -41
  48. package/modern/TableSortLabel/TableSortLabel.js +19 -9
  49. package/modern/Toolbar/Toolbar.js +33 -17
  50. package/modern/Typography/Typography.js +3 -2
  51. package/modern/index.js +1 -1
  52. package/modern/styles/experimental_extendTheme.js +2 -1
  53. package/modern/styles/getOverlayAlpha.js +3 -4
  54. package/node/Checkbox/Checkbox.js +54 -23
  55. package/node/FormControlLabel/FormControlLabel.js +23 -5
  56. package/node/FormHelperText/FormHelperText.js +18 -8
  57. package/node/IconButton/IconButton.js +99 -43
  58. package/node/ImageList/ImageList.js +16 -14
  59. package/node/ImageListItem/ImageListItem.js +37 -22
  60. package/node/ImageListItemBar/ImageListItemBar.js +65 -32
  61. package/node/ListItem/ListItem.js +94 -50
  62. package/node/ListItemAvatar/ListItemAvatar.js +12 -8
  63. package/node/ListItemButton/ListItemButton.js +35 -15
  64. package/node/ListItemSecondaryAction/ListItemSecondaryAction.js +12 -8
  65. package/node/ListItemText/ListItemText.js +20 -11
  66. package/node/ListSubheader/ListSubheader.js +44 -19
  67. package/node/PaginationItem/PaginationItem.js +65 -20
  68. package/node/Radio/Radio.js +52 -22
  69. package/node/Radio/RadioButtonIcon.js +21 -15
  70. package/node/Rating/Rating.js +71 -37
  71. package/node/SvgIcon/SvgIcon.js +79 -24
  72. package/node/Table/Table.js +11 -6
  73. package/node/TableCell/TableCell.js +96 -41
  74. package/node/TableSortLabel/TableSortLabel.js +19 -9
  75. package/node/Toolbar/Toolbar.js +33 -17
  76. package/node/Typography/Typography.js +3 -2
  77. package/node/index.js +1 -1
  78. package/node/styles/experimental_extendTheme.js +1 -0
  79. package/node/styles/getOverlayAlpha.js +4 -5
  80. package/package.json +6 -6
  81. package/styles/experimental_extendTheme.d.ts +2 -0
  82. package/styles/experimental_extendTheme.js +2 -1
  83. package/styles/getOverlayAlpha.d.ts +1 -2
  84. package/styles/getOverlayAlpha.js +3 -4
  85. package/umd/material-ui.development.js +1223 -583
  86. package/umd/material-ui.production.min.js +4 -4
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
4
  import _extends from "@babel/runtime/helpers/esm/extends";
5
- const _excluded = ["className", "color", "component", "components", "disabled", "page", "selected", "shape", "size", "slots", "type", "variant"];
5
+ const _excluded = ["className", "color", "component", "components", "disabled", "page", "selected", "shape", "size", "slots", "slotProps", "type", "variant"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
@@ -16,6 +16,7 @@ import FirstPageIcon from '../internal/svg-icons/FirstPage';
16
16
  import LastPageIcon from '../internal/svg-icons/LastPage';
17
17
  import NavigateBeforeIcon from '../internal/svg-icons/NavigateBefore';
18
18
  import NavigateNextIcon from '../internal/svg-icons/NavigateNext';
19
+ import useSlot from '../utils/useSlot';
19
20
  import { styled, createUseThemeProps } from '../zero-styled';
20
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
22
  const useThemeProps = createUseThemeProps('MuiPaginationItem');
@@ -281,6 +282,7 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
281
282
  shape = 'circular',
282
283
  size = 'medium',
283
284
  slots = {},
285
+ slotProps = {},
284
286
  type = 'page',
285
287
  variant = 'text'
286
288
  } = props,
@@ -296,18 +298,53 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
296
298
  });
297
299
  const isRtl = useRtl();
298
300
  const classes = useUtilityClasses(ownerState);
299
- const normalizedIcons = isRtl ? {
300
- previous: slots.next || components.next || NavigateNextIcon,
301
- next: slots.previous || components.previous || NavigateBeforeIcon,
302
- last: slots.first || components.first || FirstPageIcon,
303
- first: slots.last || components.last || LastPageIcon
304
- } : {
305
- previous: slots.previous || components.previous || NavigateBeforeIcon,
306
- next: slots.next || components.next || NavigateNextIcon,
307
- first: slots.first || components.first || FirstPageIcon,
308
- last: slots.last || components.last || LastPageIcon
301
+ const externalForwardedProps = {
302
+ slots: {
303
+ previous: slots.previous ?? components.previous,
304
+ next: slots.next ?? components.next,
305
+ first: slots.first ?? components.first,
306
+ last: slots.last ?? components.last
307
+ },
308
+ slotProps
309
309
  };
310
- const Icon = normalizedIcons[type];
310
+ const [PreviousSlot, previousSlotProps] = useSlot('previous', {
311
+ elementType: NavigateBeforeIcon,
312
+ externalForwardedProps,
313
+ ownerState
314
+ });
315
+ const [NextSlot, nextSlotProps] = useSlot('next', {
316
+ elementType: NavigateNextIcon,
317
+ externalForwardedProps,
318
+ ownerState
319
+ });
320
+ const [FirstSlot, firstSlotProps] = useSlot('first', {
321
+ elementType: FirstPageIcon,
322
+ externalForwardedProps,
323
+ ownerState
324
+ });
325
+ const [LastSlot, lastSlotProps] = useSlot('last', {
326
+ elementType: LastPageIcon,
327
+ externalForwardedProps,
328
+ ownerState
329
+ });
330
+ const rtlAwareType = isRtl ? {
331
+ previous: 'next',
332
+ next: 'previous',
333
+ first: 'last',
334
+ last: 'first'
335
+ }[type] : type;
336
+ const IconSlot = {
337
+ previous: PreviousSlot,
338
+ next: NextSlot,
339
+ first: FirstSlot,
340
+ last: LastSlot
341
+ }[rtlAwareType];
342
+ const iconSlotProps = {
343
+ previous: previousSlotProps,
344
+ next: nextSlotProps,
345
+ first: firstSlotProps,
346
+ last: lastSlotProps
347
+ }[rtlAwareType];
311
348
  return type === 'start-ellipsis' || type === 'end-ellipsis' ? /*#__PURE__*/_jsx(PaginationItemEllipsis, {
312
349
  ref: ref,
313
350
  ownerState: ownerState,
@@ -320,11 +357,10 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
320
357
  disabled: disabled,
321
358
  className: clsx(classes.root, className)
322
359
  }, other, {
323
- children: [type === 'page' && page, Icon ? /*#__PURE__*/_jsx(PaginationItemPageIcon, {
324
- as: Icon,
325
- ownerState: ownerState,
326
- className: classes.icon
327
- }) : null]
360
+ children: [type === 'page' && page, IconSlot ? /*#__PURE__*/_jsx(PaginationItemPageIcon, _extends({}, iconSlotProps, {
361
+ className: classes.icon,
362
+ as: IconSlot
363
+ })) : null]
328
364
  }));
329
365
  });
330
366
  process.env.NODE_ENV !== "production" ? PaginationItem.propTypes /* remove-proptypes */ = {
@@ -363,6 +399,7 @@ process.env.NODE_ENV !== "production" ? PaginationItem.propTypes /* remove-propt
363
399
  * It's recommended to use the `slots` prop instead.
364
400
  *
365
401
  * @default {}
402
+ * @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
366
403
  */
367
404
  components: PropTypes.shape({
368
405
  first: PropTypes.elementType,
@@ -394,11 +431,18 @@ process.env.NODE_ENV !== "production" ? PaginationItem.propTypes /* remove-propt
394
431
  * @default 'medium'
395
432
  */
396
433
  size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['small', 'medium', 'large']), PropTypes.string]),
434
+ /**
435
+ * The props used for each slot inside.
436
+ * @default {}
437
+ */
438
+ slotProps: PropTypes.shape({
439
+ first: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
440
+ last: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
441
+ next: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
442
+ previous: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
443
+ }),
397
444
  /**
398
445
  * The components used for each slot inside.
399
- *
400
- * This prop is an alias for the `components` prop, which will be deprecated in the future.
401
- *
402
446
  * @default {}
403
447
  */
404
448
  slots: PropTypes.shape({
package/Radio/Radio.js CHANGED
@@ -10,14 +10,15 @@ import refType from '@mui/utils/refType';
10
10
  import composeClasses from '@mui/utils/composeClasses';
11
11
  import { alpha } from '@mui/system/colorManipulator';
12
12
  import SwitchBase from '../internal/SwitchBase';
13
- import useThemeProps from '../styles/useThemeProps';
14
13
  import RadioButtonIcon from './RadioButtonIcon';
15
14
  import capitalize from '../utils/capitalize';
16
15
  import createChainedFunction from '../utils/createChainedFunction';
17
16
  import useRadioGroup from '../RadioGroup/useRadioGroup';
18
17
  import radioClasses, { getRadioUtilityClass } from './radioClasses';
19
- import styled, { rootShouldForwardProp } from '../styles/styled';
18
+ import { rootShouldForwardProp } from '../styles/styled';
19
+ import { styled, createUseThemeProps } from '../zero-styled';
20
20
  import { jsx as _jsx } from "react/jsx-runtime";
21
+ const useThemeProps = createUseThemeProps('MuiRadio');
21
22
  const useUtilityClasses = ownerState => {
22
23
  const {
23
24
  classes,
@@ -40,26 +41,55 @@ const RadioRoot = styled(SwitchBase, {
40
41
  return [styles.root, ownerState.size !== 'medium' && styles[`size${capitalize(ownerState.size)}`], styles[`color${capitalize(ownerState.color)}`]];
41
42
  }
42
43
  })(({
43
- theme,
44
- ownerState
45
- }) => _extends({
46
- color: (theme.vars || theme).palette.text.secondary
47
- }, !ownerState.disableRipple && {
48
- '&:hover': {
49
- backgroundColor: theme.vars ? `rgba(${ownerState.color === 'default' ? theme.vars.palette.action.activeChannel : theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(ownerState.color === 'default' ? theme.palette.action.active : theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
50
- // Reset on touch devices, it doesn't add specificity
51
- '@media (hover: none)': {
52
- backgroundColor: 'transparent'
53
- }
54
- }
55
- }, ownerState.color !== 'default' && {
56
- [`&.${radioClasses.checked}`]: {
57
- color: (theme.vars || theme).palette[ownerState.color].main
58
- }
59
- }, {
44
+ theme
45
+ }) => ({
46
+ color: (theme.vars || theme).palette.text.secondary,
60
47
  [`&.${radioClasses.disabled}`]: {
61
48
  color: (theme.vars || theme).palette.action.disabled
62
- }
49
+ },
50
+ variants: [{
51
+ props: {
52
+ color: 'default',
53
+ disableRipple: false
54
+ },
55
+ style: {
56
+ '&:hover': {
57
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.action.active, theme.palette.action.hoverOpacity)
58
+ }
59
+ }
60
+ }, ...Object.entries(theme.palette).filter(([, palette]) => palette.main).map(([color]) => ({
61
+ props: {
62
+ color,
63
+ disableRipple: false
64
+ },
65
+ style: {
66
+ '&:hover': {
67
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[color].main, theme.palette.action.hoverOpacity)
68
+ }
69
+ }
70
+ })), ...Object.entries(theme.palette).filter(([, palette]) => palette.main).map(([color]) => ({
71
+ props: {
72
+ color
73
+ },
74
+ style: {
75
+ [`&.${radioClasses.checked}`]: {
76
+ color: (theme.vars || theme).palette[color].main
77
+ }
78
+ }
79
+ })), {
80
+ // Should be last to override other colors
81
+ props: {
82
+ disableRipple: false
83
+ },
84
+ style: {
85
+ // Reset on touch devices, it doesn't add specificity
86
+ '&:hover': {
87
+ '@media (hover: none)': {
88
+ backgroundColor: 'transparent'
89
+ }
90
+ }
91
+ }
92
+ }]
63
93
  }));
64
94
  function areEqualValues(a, b) {
65
95
  if (typeof b === 'object' && b !== null) {
@@ -5,7 +5,8 @@ import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import RadioButtonUncheckedIcon from '../internal/svg-icons/RadioButtonUnchecked';
7
7
  import RadioButtonCheckedIcon from '../internal/svg-icons/RadioButtonChecked';
8
- import styled, { rootShouldForwardProp } from '../styles/styled';
8
+ import { rootShouldForwardProp } from '../styles/styled';
9
+ import { styled } from '../zero-styled';
9
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
11
  const RadioButtonIconRoot = styled('span', {
11
12
  shouldForwardProp: rootShouldForwardProp
@@ -18,22 +19,27 @@ const RadioButtonIconBackground = styled(RadioButtonUncheckedIcon)({
18
19
  transform: 'scale(1)'
19
20
  });
20
21
  const RadioButtonIconDot = styled(RadioButtonCheckedIcon)(({
21
- theme,
22
- ownerState
23
- }) => _extends({
22
+ theme
23
+ }) => ({
24
24
  left: 0,
25
25
  position: 'absolute',
26
26
  transform: 'scale(0)',
27
27
  transition: theme.transitions.create('transform', {
28
28
  easing: theme.transitions.easing.easeIn,
29
29
  duration: theme.transitions.duration.shortest
30
- })
31
- }, ownerState.checked && {
32
- transform: 'scale(1)',
33
- transition: theme.transitions.create('transform', {
34
- easing: theme.transitions.easing.easeOut,
35
- duration: theme.transitions.duration.shortest
36
- })
30
+ }),
31
+ variants: [{
32
+ props: {
33
+ checked: true
34
+ },
35
+ style: {
36
+ transform: 'scale(1)',
37
+ transition: theme.transitions.create('transform', {
38
+ easing: theme.transitions.easing.easeOut,
39
+ duration: theme.transitions.duration.shortest
40
+ })
41
+ }
42
+ }]
37
43
  }));
38
44
 
39
45
  /**
@@ -62,7 +68,7 @@ function RadioButtonIcon(props) {
62
68
  })]
63
69
  });
64
70
  }
65
- process.env.NODE_ENV !== "production" ? RadioButtonIcon.propTypes = {
71
+ process.env.NODE_ENV !== "production" ? RadioButtonIcon.propTypes /* remove-proptypes */ = {
66
72
  /**
67
73
  * If `true`, the component is checked.
68
74
  */
package/Rating/Rating.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
5
  const _excluded = ["value"],
6
6
  _excluded2 = ["className", "defaultValue", "disabled", "emptyIcon", "emptyLabelText", "getLabelText", "highlightSelectedOnly", "icon", "IconContainerComponent", "max", "name", "onChange", "onChangeActive", "onMouseLeave", "onMouseMove", "precision", "readOnly", "size", "value"];
7
7
  import * as React from 'react';
@@ -66,9 +66,8 @@ const RatingRoot = styled('span', {
66
66
  }, styles.root, styles[`size${capitalize(ownerState.size)}`], ownerState.readOnly && styles.readOnly];
67
67
  }
68
68
  })(({
69
- theme,
70
- ownerState
71
- }) => _extends({
69
+ theme
70
+ }) => ({
72
71
  display: 'inline-flex',
73
72
  // Required to position the pristine input absolutely
74
73
  position: 'relative',
@@ -85,13 +84,30 @@ const RatingRoot = styled('span', {
85
84
  [`&.${ratingClasses.focusVisible} .${ratingClasses.iconActive}`]: {
86
85
  outline: '1px solid #999'
87
86
  },
88
- [`& .${ratingClasses.visuallyHidden}`]: visuallyHidden
89
- }, ownerState.size === 'small' && {
90
- fontSize: theme.typography.pxToRem(18)
91
- }, ownerState.size === 'large' && {
92
- fontSize: theme.typography.pxToRem(30)
93
- }, ownerState.readOnly && {
94
- pointerEvents: 'none'
87
+ [`& .${ratingClasses.visuallyHidden}`]: visuallyHidden,
88
+ variants: [{
89
+ props: {
90
+ size: 'small'
91
+ },
92
+ style: {
93
+ fontSize: theme.typography.pxToRem(18)
94
+ }
95
+ }, {
96
+ props: {
97
+ size: 'large'
98
+ },
99
+ style: {
100
+ fontSize: theme.typography.pxToRem(30)
101
+ }
102
+ }, {
103
+ // TODO v6: use the .Mui-readOnly global state class
104
+ props: ({
105
+ ownerState
106
+ }) => ownerState.readOnly,
107
+ style: {
108
+ pointerEvents: 'none'
109
+ }
110
+ }]
95
111
  }));
96
112
  const RatingLabel = styled('label', {
97
113
  name: 'MuiRating',
@@ -99,17 +115,21 @@ const RatingLabel = styled('label', {
99
115
  overridesResolver: ({
100
116
  ownerState
101
117
  }, styles) => [styles.label, ownerState.emptyValueFocused && styles.labelEmptyValueActive]
102
- })(({
103
- ownerState
104
- }) => _extends({
105
- cursor: 'inherit'
106
- }, ownerState.emptyValueFocused && {
107
- top: 0,
108
- bottom: 0,
109
- position: 'absolute',
110
- outline: '1px solid #999',
111
- width: '100%'
112
- }));
118
+ })({
119
+ cursor: 'inherit',
120
+ variants: [{
121
+ props: ({
122
+ ownerState
123
+ }) => ownerState.emptyValueFocused,
124
+ style: {
125
+ top: 0,
126
+ bottom: 0,
127
+ position: 'absolute',
128
+ outline: '1px solid #999',
129
+ width: '100%'
130
+ }
131
+ }]
132
+ });
113
133
  const RatingIcon = styled('span', {
114
134
  name: 'MuiRating',
115
135
  slot: 'Icon',
@@ -120,9 +140,8 @@ const RatingIcon = styled('span', {
120
140
  return [styles.icon, ownerState.iconEmpty && styles.iconEmpty, ownerState.iconFilled && styles.iconFilled, ownerState.iconHover && styles.iconHover, ownerState.iconFocus && styles.iconFocus, ownerState.iconActive && styles.iconActive];
121
141
  }
122
142
  })(({
123
- theme,
124
- ownerState
125
- }) => _extends({
143
+ theme
144
+ }) => ({
126
145
  // Fit wrapper to actual icon size.
127
146
  display: 'flex',
128
147
  transition: theme.transitions.create('transform', {
@@ -130,11 +149,22 @@ const RatingIcon = styled('span', {
130
149
  }),
131
150
  // Fix mouseLeave issue.
132
151
  // https://github.com/facebook/react/issues/4492
133
- pointerEvents: 'none'
134
- }, ownerState.iconActive && {
135
- transform: 'scale(1.2)'
136
- }, ownerState.iconEmpty && {
137
- color: (theme.vars || theme).palette.action.disabled
152
+ pointerEvents: 'none',
153
+ variants: [{
154
+ props: ({
155
+ ownerState
156
+ }) => ownerState.iconActive,
157
+ style: {
158
+ transform: 'scale(1.2)'
159
+ }
160
+ }, {
161
+ props: ({
162
+ ownerState
163
+ }) => ownerState.iconEmpty,
164
+ style: {
165
+ color: (theme.vars || theme).palette.action.disabled
166
+ }
167
+ }]
138
168
  }));
139
169
  const RatingDecimal = styled('span', {
140
170
  name: 'MuiRating',
@@ -146,13 +176,17 @@ const RatingDecimal = styled('span', {
146
176
  } = props;
147
177
  return [styles.decimal, iconActive && styles.iconActive];
148
178
  }
149
- })(({
150
- iconActive
151
- }) => _extends({
152
- position: 'relative'
153
- }, iconActive && {
154
- transform: 'scale(1.2)'
155
- }));
179
+ })({
180
+ position: 'relative',
181
+ variants: [{
182
+ props: ({
183
+ iconActive
184
+ }) => iconActive,
185
+ style: {
186
+ transform: 'scale(1.2)'
187
+ }
188
+ }]
189
+ });
156
190
  function IconContainer(props) {
157
191
  const other = _objectWithoutPropertiesLoose(props, _excluded);
158
192
  return /*#__PURE__*/_jsx("span", _extends({}, other));
@@ -8,10 +8,10 @@ import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
9
9
  import composeClasses from '@mui/utils/composeClasses';
10
10
  import capitalize from '../utils/capitalize';
11
- import useThemeProps from '../styles/useThemeProps';
12
- import styled from '../styles/styled';
11
+ import { styled, createUseThemeProps } from '../zero-styled';
13
12
  import { getSvgIconUtilityClass } from './svgIconClasses';
14
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ const useThemeProps = createUseThemeProps('MuiSvgIcon');
15
15
  const useUtilityClasses = ownerState => {
16
16
  const {
17
17
  color,
@@ -33,32 +33,82 @@ const SvgIconRoot = styled('svg', {
33
33
  return [styles.root, ownerState.color !== 'inherit' && styles[`color${capitalize(ownerState.color)}`], styles[`fontSize${capitalize(ownerState.fontSize)}`]];
34
34
  }
35
35
  })(({
36
- theme,
37
- ownerState
36
+ theme
38
37
  }) => ({
39
38
  userSelect: 'none',
40
39
  width: '1em',
41
40
  height: '1em',
42
41
  display: 'inline-block',
43
- // the <svg> will define the property that has `currentColor`
44
- // for example heroicons uses fill="none" and stroke="currentColor"
45
- fill: ownerState.hasSvgAsChild ? undefined : 'currentColor',
46
42
  flexShrink: 0,
47
43
  transition: theme.transitions?.create?.('fill', {
48
- duration: theme.transitions?.duration?.shorter
44
+ duration: (theme.vars ?? theme).transitions?.duration?.shorter
49
45
  }),
50
- fontSize: {
51
- inherit: 'inherit',
52
- small: theme.typography?.pxToRem?.(20) || '1.25rem',
53
- medium: theme.typography?.pxToRem?.(24) || '1.5rem',
54
- large: theme.typography?.pxToRem?.(35) || '2.1875rem'
55
- }[ownerState.fontSize],
56
- // TODO v5 deprecate, v6 remove for sx
57
- color: (theme.vars || theme).palette?.[ownerState.color]?.main ?? {
58
- action: (theme.vars || theme).palette?.action?.active,
59
- disabled: (theme.vars || theme).palette?.action?.disabled,
60
- inherit: undefined
61
- }[ownerState.color]
46
+ variants: [{
47
+ props: props => !props.hasSvgAsChild,
48
+ style: {
49
+ // the <svg> will define the property that has `currentColor`
50
+ // for example heroicons uses fill="none" and stroke="currentColor"
51
+ fill: 'currentColor'
52
+ }
53
+ }, {
54
+ props: {
55
+ fontSize: 'inherit'
56
+ },
57
+ style: {
58
+ fontSize: 'inherit'
59
+ }
60
+ }, {
61
+ props: {
62
+ fontSize: 'small'
63
+ },
64
+ style: {
65
+ fontSize: theme.typography?.pxToRem?.(20) || '1.25rem'
66
+ }
67
+ }, {
68
+ props: {
69
+ fontSize: 'medium'
70
+ },
71
+ style: {
72
+ fontSize: theme.typography?.pxToRem?.(24) || '1.5rem'
73
+ }
74
+ }, {
75
+ props: {
76
+ fontSize: 'large'
77
+ },
78
+ style: {
79
+ fontSize: theme.typography?.pxToRem?.(35) || '2.1875rem'
80
+ }
81
+ },
82
+ // TODO v5 deprecate color prop, v6 remove for sx
83
+ ...Object.entries((theme.vars ?? theme).palette).filter(([, value]) => value.main).map(([color]) => ({
84
+ props: {
85
+ color
86
+ },
87
+ style: {
88
+ color: (theme.vars ?? theme).palette?.[color]?.main
89
+ }
90
+ })), {
91
+ props: {
92
+ color: 'action'
93
+ },
94
+ style: {
95
+ color: (theme.vars ?? theme).palette?.action?.active
96
+ }
97
+ }, {
98
+ props: {
99
+ color: 'disabled'
100
+ },
101
+ style: {
102
+ color: (theme.vars ?? theme).palette?.action?.disabled
103
+ }
104
+ }, {
105
+ props: {
106
+ color: 'inherit'
107
+ },
108
+ style: {
109
+ color: undefined
110
+ }
111
+ }]
62
112
  }));
63
113
  const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
64
114
  const props = useThemeProps({
@@ -179,5 +229,7 @@ process.env.NODE_ENV !== "production" ? SvgIcon.propTypes /* remove-proptypes */
179
229
  */
180
230
  viewBox: PropTypes.string
181
231
  } : void 0;
182
- SvgIcon.muiName = 'SvgIcon';
232
+ if (SvgIcon) {
233
+ SvgIcon.muiName = 'SvgIcon';
234
+ }
183
235
  export default SvgIcon;
package/Table/Table.js CHANGED
@@ -32,9 +32,8 @@ const TableRoot = styled('table', {
32
32
  return [styles.root, ownerState.stickyHeader && styles.stickyHeader];
33
33
  }
34
34
  })(({
35
- theme,
36
- ownerState
37
- }) => _extends({
35
+ theme
36
+ }) => ({
38
37
  display: 'table',
39
38
  width: '100%',
40
39
  borderCollapse: 'collapse',
@@ -44,9 +43,15 @@ const TableRoot = styled('table', {
44
43
  color: (theme.vars || theme).palette.text.secondary,
45
44
  textAlign: 'left',
46
45
  captionSide: 'bottom'
47
- })
48
- }, ownerState.stickyHeader && {
49
- borderCollapse: 'separate'
46
+ }),
47
+ variants: [{
48
+ props: ({
49
+ ownerState
50
+ }) => ownerState.stickyHeader,
51
+ style: {
52
+ borderCollapse: 'separate'
53
+ }
54
+ }]
50
55
  }));
51
56
  const defaultComponent = 'table';
52
57
  const Table = /*#__PURE__*/React.forwardRef(function Table(inProps, ref) {