@mui/material 6.0.0-alpha.0 → 6.0.0-alpha.2

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 (82) hide show
  1. package/AppBar/AppBar.js +118 -68
  2. package/Badge/Badge.d.ts +2 -4
  3. package/Badge/Badge.js +2 -4
  4. package/Button/Button.js +220 -131
  5. package/ButtonBase/ButtonBase.js +2 -2
  6. package/ButtonBase/Ripple.js +1 -1
  7. package/ButtonBase/TouchRipple.js +3 -4
  8. package/ButtonGroup/ButtonGroup.js +167 -70
  9. package/CHANGELOG.md +170 -4
  10. package/Grid/Grid.js +3 -0
  11. package/RadioGroup/RadioGroup.d.ts +0 -2
  12. package/RadioGroup/RadioGroup.js +23 -2
  13. package/RadioGroup/index.d.ts +3 -0
  14. package/RadioGroup/index.js +3 -1
  15. package/RadioGroup/radioGroupClasses.d.ts +6 -0
  16. package/RadioGroup/radioGroupClasses.js +7 -0
  17. package/Select/Select.d.ts +9 -6
  18. package/Slider/Slider.js +22 -22
  19. package/Table/Table.d.ts +0 -2
  20. package/Table/Table.js +0 -2
  21. package/index.js +1 -1
  22. package/legacy/AppBar/AppBar.js +124 -64
  23. package/legacy/Badge/Badge.js +2 -4
  24. package/legacy/Button/Button.js +218 -123
  25. package/legacy/ButtonBase/ButtonBase.js +2 -2
  26. package/legacy/ButtonBase/Ripple.js +1 -1
  27. package/legacy/ButtonBase/TouchRipple.js +3 -4
  28. package/legacy/ButtonGroup/ButtonGroup.js +163 -68
  29. package/legacy/Grid/Grid.js +3 -0
  30. package/legacy/RadioGroup/RadioGroup.js +21 -2
  31. package/legacy/RadioGroup/index.js +3 -1
  32. package/legacy/RadioGroup/radioGroupClasses.js +7 -0
  33. package/legacy/Slider/Slider.js +24 -24
  34. package/legacy/Table/Table.js +0 -2
  35. package/legacy/index.js +1 -1
  36. package/legacy/locale/index.js +1 -1
  37. package/legacy/styles/experimental_extendTheme.js +24 -2
  38. package/legacy/zero-styled/index.js +1 -0
  39. package/locale/index.js +1 -1
  40. package/modern/AppBar/AppBar.js +118 -68
  41. package/modern/Badge/Badge.js +2 -4
  42. package/modern/Button/Button.js +220 -131
  43. package/modern/ButtonBase/ButtonBase.js +2 -2
  44. package/modern/ButtonBase/Ripple.js +1 -1
  45. package/modern/ButtonBase/TouchRipple.js +3 -4
  46. package/modern/ButtonGroup/ButtonGroup.js +167 -70
  47. package/modern/Grid/Grid.js +3 -0
  48. package/modern/RadioGroup/RadioGroup.js +23 -2
  49. package/modern/RadioGroup/index.js +3 -1
  50. package/modern/RadioGroup/radioGroupClasses.js +7 -0
  51. package/modern/Slider/Slider.js +22 -22
  52. package/modern/Table/Table.js +0 -2
  53. package/modern/index.js +1 -1
  54. package/modern/locale/index.js +1 -1
  55. package/modern/styles/experimental_extendTheme.js +24 -2
  56. package/modern/zero-styled/index.js +1 -0
  57. package/node/AppBar/AppBar.js +125 -66
  58. package/node/Badge/Badge.js +2 -4
  59. package/node/Button/Button.js +224 -135
  60. package/node/ButtonBase/ButtonBase.js +4 -4
  61. package/node/ButtonBase/Ripple.js +1 -1
  62. package/node/ButtonBase/TouchRipple.js +9 -10
  63. package/node/ButtonGroup/ButtonGroup.js +169 -72
  64. package/node/Grid/Grid.js +3 -0
  65. package/node/RadioGroup/RadioGroup.js +23 -2
  66. package/node/RadioGroup/index.js +25 -1
  67. package/node/RadioGroup/radioGroupClasses.js +15 -0
  68. package/node/Slider/Slider.js +25 -25
  69. package/node/Table/Table.js +0 -2
  70. package/node/index.js +1 -1
  71. package/node/locale/index.js +1 -1
  72. package/node/styles/experimental_extendTheme.js +24 -2
  73. package/node/zero-styled/index.js +7 -0
  74. package/package.json +6 -6
  75. package/styles/components.d.ts +5 -0
  76. package/styles/experimental_extendTheme.d.ts +2 -0
  77. package/styles/experimental_extendTheme.js +24 -2
  78. package/styles/overrides.d.ts +2 -0
  79. package/umd/material-ui.development.js +888 -593
  80. package/umd/material-ui.production.min.js +4 -4
  81. package/zero-styled/index.d.ts +1 -0
  82. package/zero-styled/index.js +1 -0
package/AppBar/AppBar.js CHANGED
@@ -7,12 +7,12 @@ 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 capitalize from '../utils/capitalize';
13
12
  import Paper from '../Paper';
14
13
  import { getAppBarUtilityClass } from './appBarClasses';
15
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
+ const useThemeProps = createUseThemeProps('MuiAppBar');
16
16
  const useUtilityClasses = ownerState => {
17
17
  const {
18
18
  color,
@@ -38,75 +38,125 @@ const AppBarRoot = styled(Paper, {
38
38
  return [styles.root, styles[`position${capitalize(ownerState.position)}`], styles[`color${capitalize(ownerState.color)}`]];
39
39
  }
40
40
  })(({
41
- theme,
42
- ownerState
43
- }) => {
44
- const backgroundColorDefault = theme.palette.mode === 'light' ? theme.palette.grey[100] : theme.palette.grey[900];
45
- return _extends({
46
- display: 'flex',
47
- flexDirection: 'column',
48
- width: '100%',
49
- boxSizing: 'border-box',
50
- // Prevent padding issue with the Modal and fixed positioned AppBar.
51
- flexShrink: 0
52
- }, ownerState.position === 'fixed' && {
53
- position: 'fixed',
54
- zIndex: (theme.vars || theme).zIndex.appBar,
55
- top: 0,
56
- left: 'auto',
57
- right: 0,
58
- '@media print': {
59
- // Prevent the app bar to be visible on each printed page.
41
+ theme
42
+ }) => ({
43
+ display: 'flex',
44
+ flexDirection: 'column',
45
+ width: '100%',
46
+ boxSizing: 'border-box',
47
+ // Prevent padding issue with the Modal and fixed positioned AppBar.
48
+ flexShrink: 0,
49
+ variants: [{
50
+ props: {
51
+ position: 'fixed'
52
+ },
53
+ style: {
54
+ position: 'fixed',
55
+ zIndex: (theme.vars || theme).zIndex.appBar,
56
+ top: 0,
57
+ left: 'auto',
58
+ right: 0,
59
+ '@media print': {
60
+ // Prevent the app bar to be visible on each printed page.
61
+ position: 'absolute'
62
+ }
63
+ }
64
+ }, {
65
+ props: {
60
66
  position: 'absolute'
67
+ },
68
+ style: {
69
+ position: 'absolute',
70
+ zIndex: (theme.vars || theme).zIndex.appBar,
71
+ top: 0,
72
+ left: 'auto',
73
+ right: 0
61
74
  }
62
- }, ownerState.position === 'absolute' && {
63
- position: 'absolute',
64
- zIndex: (theme.vars || theme).zIndex.appBar,
65
- top: 0,
66
- left: 'auto',
67
- right: 0
68
- }, ownerState.position === 'sticky' && {
69
- // ⚠️ sticky is not supported by IE11.
70
- position: 'sticky',
71
- zIndex: (theme.vars || theme).zIndex.appBar,
72
- top: 0,
73
- left: 'auto',
74
- right: 0
75
- }, ownerState.position === 'static' && {
76
- position: 'static'
77
- }, ownerState.position === 'relative' && {
78
- position: 'relative'
79
- }, !theme.vars && _extends({}, ownerState.color === 'default' && {
80
- backgroundColor: backgroundColorDefault,
81
- color: theme.palette.getContrastText(backgroundColorDefault)
82
- }, ownerState.color && ownerState.color !== 'default' && ownerState.color !== 'inherit' && ownerState.color !== 'transparent' && {
83
- backgroundColor: theme.palette[ownerState.color].main,
84
- color: theme.palette[ownerState.color].contrastText
85
- }, ownerState.color === 'inherit' && {
86
- color: 'inherit'
87
- }, theme.palette.mode === 'dark' && !ownerState.enableColorOnDark && {
88
- backgroundColor: null,
89
- color: null
90
- }, ownerState.color === 'transparent' && _extends({
91
- backgroundColor: 'transparent',
92
- color: 'inherit'
93
- }, theme.palette.mode === 'dark' && {
94
- backgroundImage: 'none'
95
- })), theme.vars && _extends({}, ownerState.color === 'default' && {
96
- '--AppBar-background': ownerState.enableColorOnDark ? theme.vars.palette.AppBar.defaultBg : joinVars(theme.vars.palette.AppBar.darkBg, theme.vars.palette.AppBar.defaultBg),
97
- '--AppBar-color': ownerState.enableColorOnDark ? theme.vars.palette.text.primary : joinVars(theme.vars.palette.AppBar.darkColor, theme.vars.palette.text.primary)
98
- }, ownerState.color && !ownerState.color.match(/^(default|inherit|transparent)$/) && {
99
- '--AppBar-background': ownerState.enableColorOnDark ? theme.vars.palette[ownerState.color].main : joinVars(theme.vars.palette.AppBar.darkBg, theme.vars.palette[ownerState.color].main),
100
- '--AppBar-color': ownerState.enableColorOnDark ? theme.vars.palette[ownerState.color].contrastText : joinVars(theme.vars.palette.AppBar.darkColor, theme.vars.palette[ownerState.color].contrastText)
101
75
  }, {
102
- backgroundColor: 'var(--AppBar-background)',
103
- color: ownerState.color === 'inherit' ? 'inherit' : 'var(--AppBar-color)'
104
- }, ownerState.color === 'transparent' && {
105
- backgroundImage: 'none',
106
- backgroundColor: 'transparent',
107
- color: 'inherit'
108
- }));
109
- });
76
+ props: {
77
+ position: 'sticky'
78
+ },
79
+ style: {
80
+ // ⚠️ sticky is not supported by IE11.
81
+ position: 'sticky',
82
+ zIndex: (theme.vars || theme).zIndex.appBar,
83
+ top: 0,
84
+ left: 'auto',
85
+ right: 0
86
+ }
87
+ }, {
88
+ props: {
89
+ position: 'static'
90
+ },
91
+ style: {
92
+ position: 'static'
93
+ }
94
+ }, {
95
+ props: {
96
+ position: 'relative'
97
+ },
98
+ style: {
99
+ position: 'relative'
100
+ }
101
+ }, {
102
+ props: {
103
+ color: 'inherit'
104
+ },
105
+ style: {
106
+ '--AppBar-color': 'inherit'
107
+ }
108
+ }, {
109
+ props: {
110
+ color: 'default'
111
+ },
112
+ style: _extends({
113
+ '--AppBar-background': theme.vars ? theme.vars.palette.AppBar.defaultBg : theme.palette.grey[100],
114
+ '--AppBar-color': theme.vars ? theme.vars.palette.text.primary : theme.palette.getContrastText(theme.palette.grey[100])
115
+ }, theme.applyStyles('dark', {
116
+ '--AppBar-background': theme.vars ? theme.vars.palette.AppBar.defaultBg : theme.palette.grey[900],
117
+ '--AppBar-color': theme.vars ? theme.vars.palette.text.primary : theme.palette.getContrastText(theme.palette.grey[900])
118
+ }))
119
+ }, ...Object.keys((theme.vars ?? theme).palette).filter(key => (theme.vars ?? theme).palette[key].main && (theme.vars ?? theme).palette[key].contrastText).map(color => ({
120
+ props: {
121
+ color
122
+ },
123
+ style: {
124
+ '--AppBar-background': (theme.vars ?? theme).palette[color].main,
125
+ '--AppBar-color': (theme.vars ?? theme).palette[color].contrastText
126
+ }
127
+ })), {
128
+ props: {
129
+ enableColorOnDark: true
130
+ },
131
+ style: {
132
+ backgroundColor: 'var(--AppBar-background)',
133
+ color: 'var(--AppBar-color)'
134
+ }
135
+ }, {
136
+ props: {
137
+ enableColorOnDark: false
138
+ },
139
+ style: _extends({
140
+ backgroundColor: 'var(--AppBar-background)',
141
+ color: 'var(--AppBar-color)'
142
+ }, theme.applyStyles('dark', {
143
+ backgroundColor: theme.vars ? joinVars(theme.vars.palette.AppBar.darkBg, 'var(--AppBar-background)') : null,
144
+ color: theme.vars ? joinVars(theme.vars.palette.AppBar.darkColor, 'var(--AppBar-color)') : null
145
+ }))
146
+ }, {
147
+ props: {
148
+ color: 'transparent'
149
+ },
150
+ style: _extends({
151
+ '--AppBar-background': 'transparent',
152
+ '--AppBar-color': 'inherit',
153
+ backgroundColor: 'var(--AppBar-background)',
154
+ color: 'var(--AppBar-color)'
155
+ }, theme.applyStyles('dark', {
156
+ backgroundImage: 'none'
157
+ }))
158
+ }]
159
+ }));
110
160
  const AppBar = /*#__PURE__*/React.forwardRef(function AppBar(inProps, ref) {
111
161
  const props = useThemeProps({
112
162
  props: inProps,
package/Badge/Badge.d.ts CHANGED
@@ -72,8 +72,7 @@ export interface BadgeOwnProps {
72
72
  * The extra props for the slot components.
73
73
  * You can override the existing props or add new ones.
74
74
  *
75
- * This prop is an alias for the `slotProps` prop.
76
- * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
75
+ * @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
77
76
  *
78
77
  * @default {}
79
78
  */
@@ -81,8 +80,7 @@ export interface BadgeOwnProps {
81
80
  /**
82
81
  * The components used for each slot inside.
83
82
  *
84
- * This prop is an alias for the `slots` prop.
85
- * It's recommended to use the `slots` prop instead.
83
+ * @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
86
84
  *
87
85
  * @default {}
88
86
  */
package/Badge/Badge.js CHANGED
@@ -351,8 +351,7 @@ process.env.NODE_ENV !== "production" ? Badge.propTypes /* remove-proptypes */ =
351
351
  /**
352
352
  * The components used for each slot inside.
353
353
  *
354
- * This prop is an alias for the `slots` prop.
355
- * It's recommended to use the `slots` prop instead.
354
+ * @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
356
355
  *
357
356
  * @default {}
358
357
  */
@@ -364,8 +363,7 @@ process.env.NODE_ENV !== "production" ? Badge.propTypes /* remove-proptypes */ =
364
363
  * The extra props for the slot components.
365
364
  * You can override the existing props or add new ones.
366
365
  *
367
- * This prop is an alias for the `slotProps` prop.
368
- * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
366
+ * @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
369
367
  *
370
368
  * @default {}
371
369
  */
package/Button/Button.js CHANGED
@@ -9,14 +9,15 @@ import clsx from 'clsx';
9
9
  import resolveProps from '@mui/utils/resolveProps';
10
10
  import composeClasses from '@mui/utils/composeClasses';
11
11
  import { alpha } from '@mui/system/colorManipulator';
12
- import styled, { rootShouldForwardProp } from '../styles/styled';
13
- import useThemeProps from '../styles/useThemeProps';
12
+ import { rootShouldForwardProp } from '../styles/styled';
13
+ import { styled, createUseThemeProps } from '../zero-styled';
14
14
  import ButtonBase from '../ButtonBase';
15
15
  import capitalize from '../utils/capitalize';
16
16
  import buttonClasses, { getButtonUtilityClass } from './buttonClasses';
17
17
  import ButtonGroupContext from '../ButtonGroup/ButtonGroupContext';
18
18
  import ButtonGroupButtonContext from '../ButtonGroup/ButtonGroupButtonContext';
19
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ const useThemeProps = createUseThemeProps('MuiButton');
20
21
  const useUtilityClasses = ownerState => {
21
22
  const {
22
23
  color,
@@ -35,19 +36,34 @@ const useUtilityClasses = ownerState => {
35
36
  const composedClasses = composeClasses(slots, getButtonUtilityClass, classes);
36
37
  return _extends({}, classes, composedClasses);
37
38
  };
38
- const commonIconStyles = ownerState => _extends({}, ownerState.size === 'small' && {
39
- '& > *:nth-of-type(1)': {
40
- fontSize: 18
39
+ const commonIconStyles = [{
40
+ props: {
41
+ size: 'small'
42
+ },
43
+ style: {
44
+ '& > *:nth-of-type(1)': {
45
+ fontSize: 18
46
+ }
41
47
  }
42
- }, ownerState.size === 'medium' && {
43
- '& > *:nth-of-type(1)': {
44
- fontSize: 20
48
+ }, {
49
+ props: {
50
+ size: 'medium'
51
+ },
52
+ style: {
53
+ '& > *:nth-of-type(1)': {
54
+ fontSize: 20
55
+ }
45
56
  }
46
- }, ownerState.size === 'large' && {
47
- '& > *:nth-of-type(1)': {
48
- fontSize: 22
57
+ }, {
58
+ props: {
59
+ size: 'large'
60
+ },
61
+ style: {
62
+ '& > *:nth-of-type(1)': {
63
+ fontSize: 22
64
+ }
49
65
  }
50
- });
66
+ }];
51
67
  const ButtonRoot = styled(ButtonBase, {
52
68
  shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
53
69
  name: 'MuiButton',
@@ -59,127 +75,192 @@ const ButtonRoot = styled(ButtonBase, {
59
75
  return [styles.root, styles[ownerState.variant], styles[`${ownerState.variant}${capitalize(ownerState.color)}`], styles[`size${capitalize(ownerState.size)}`], styles[`${ownerState.variant}Size${capitalize(ownerState.size)}`], ownerState.color === 'inherit' && styles.colorInherit, ownerState.disableElevation && styles.disableElevation, ownerState.fullWidth && styles.fullWidth];
60
76
  }
61
77
  })(({
62
- theme,
63
- ownerState
78
+ theme
64
79
  }) => {
65
80
  const inheritContainedBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey[300] : theme.palette.grey[800];
66
81
  const inheritContainedHoverBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey.A100 : theme.palette.grey[700];
67
82
  return _extends({}, theme.typography.button, {
68
83
  minWidth: 64,
69
84
  padding: '6px 16px',
85
+ border: 0,
70
86
  borderRadius: (theme.vars || theme).shape.borderRadius,
71
87
  transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color', 'color'], {
72
88
  duration: theme.transitions.duration.short
73
89
  }),
74
- '&:hover': _extends({
75
- textDecoration: 'none',
76
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity),
77
- // Reset on touch devices, it doesn't add specificity
78
- '@media (hover: none)': {
79
- backgroundColor: 'transparent'
90
+ '&:hover': {
91
+ textDecoration: 'none'
92
+ },
93
+ [`&.${buttonClasses.disabled}`]: {
94
+ color: (theme.vars || theme).palette.action.disabled
95
+ },
96
+ variants: [{
97
+ props: {
98
+ variant: 'contained'
99
+ },
100
+ style: {
101
+ color: `var(--variant-containedColor)`,
102
+ backgroundColor: `var(--variant-containedBg)`,
103
+ boxShadow: (theme.vars || theme).shadows[2],
104
+ '&:hover': {
105
+ boxShadow: (theme.vars || theme).shadows[4],
106
+ // Reset on touch devices, it doesn't add specificity
107
+ '@media (hover: none)': {
108
+ boxShadow: (theme.vars || theme).shadows[2]
109
+ }
110
+ },
111
+ '&:active': {
112
+ boxShadow: (theme.vars || theme).shadows[8]
113
+ },
114
+ [`&.${buttonClasses.focusVisible}`]: {
115
+ boxShadow: (theme.vars || theme).shadows[6]
116
+ },
117
+ [`&.${buttonClasses.disabled}`]: {
118
+ color: (theme.vars || theme).palette.action.disabled,
119
+ boxShadow: (theme.vars || theme).shadows[0],
120
+ backgroundColor: (theme.vars || theme).palette.action.disabledBackground
121
+ }
80
122
  }
81
- }, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
82
- 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),
83
- // Reset on touch devices, it doesn't add specificity
84
- '@media (hover: none)': {
85
- backgroundColor: 'transparent'
123
+ }, {
124
+ props: {
125
+ variant: 'outlined'
126
+ },
127
+ style: {
128
+ padding: '5px 15px',
129
+ border: '1px solid currentColor',
130
+ borderColor: `var(--variant-outlinedBorder, currentColor)`,
131
+ backgroundColor: `var(--variant-outlinedBg)`,
132
+ color: `var(--variant-outlinedColor)`,
133
+ [`&.${buttonClasses.disabled}`]: {
134
+ border: `1px solid ${(theme.vars || theme).palette.action.disabledBackground}`
135
+ }
86
136
  }
87
- }, ownerState.variant === 'outlined' && ownerState.color !== 'inherit' && {
88
- border: `1px solid ${(theme.vars || theme).palette[ownerState.color].main}`,
89
- 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),
90
- // Reset on touch devices, it doesn't add specificity
91
- '@media (hover: none)': {
92
- backgroundColor: 'transparent'
137
+ }, {
138
+ props: {
139
+ variant: 'text'
140
+ },
141
+ style: {
142
+ padding: '6px 8px',
143
+ color: `var(--variant-textColor)`,
144
+ backgroundColor: `var(--variant-textBg)`
93
145
  }
94
- }, ownerState.variant === 'contained' && {
95
- backgroundColor: theme.vars ? theme.vars.palette.Button.inheritContainedHoverBg : inheritContainedHoverBackgroundColor,
96
- boxShadow: (theme.vars || theme).shadows[4],
97
- // Reset on touch devices, it doesn't add specificity
98
- '@media (hover: none)': {
99
- boxShadow: (theme.vars || theme).shadows[2],
100
- backgroundColor: (theme.vars || theme).palette.grey[300]
146
+ }, ...Object.entries(theme.palette).filter(([, palette]) => palette.main && palette.dark && palette.contrastText).map(([color]) => ({
147
+ props: {
148
+ color
149
+ },
150
+ style: {
151
+ '--variant-textColor': (theme.vars || theme).palette[color].main,
152
+ '--variant-outlinedColor': (theme.vars || theme).palette[color].main,
153
+ '--variant-outlinedBorder': theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / 0.5)` : alpha(theme.palette[color].main, 0.5),
154
+ '--variant-containedColor': (theme.vars || theme).palette[color].contrastText,
155
+ '--variant-containedBg': (theme.vars || theme).palette[color].main,
156
+ '@media (hover: hover)': {
157
+ '&:hover': {
158
+ '--variant-containedBg': (theme.vars || theme).palette[color].dark,
159
+ '--variant-textBg': theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[color].main, theme.palette.action.hoverOpacity),
160
+ '--variant-outlinedBorder': (theme.vars || theme).palette[color].main,
161
+ '--variant-outlinedBg': theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[color].main, theme.palette.action.hoverOpacity)
162
+ }
163
+ }
101
164
  }
102
- }, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
103
- backgroundColor: (theme.vars || theme).palette[ownerState.color].dark,
104
- // Reset on touch devices, it doesn't add specificity
105
- '@media (hover: none)': {
106
- backgroundColor: (theme.vars || theme).palette[ownerState.color].main
165
+ })), {
166
+ props: {
167
+ color: 'inherit'
168
+ },
169
+ style: {
170
+ '--variant-containedColor': theme.vars ?
171
+ // this is safe because grey does not change between default light/dark mode
172
+ theme.vars.palette.text.primary : theme.palette.getContrastText?.(inheritContainedBackgroundColor),
173
+ '--variant-containedBg': theme.vars ? theme.vars.palette.Button.inheritContainedBg : inheritContainedBackgroundColor,
174
+ '@media (hover: hover)': {
175
+ '&:hover': {
176
+ '--variant-containedBg': theme.vars ? theme.vars.palette.Button.inheritContainedHoverBg : inheritContainedHoverBackgroundColor,
177
+ '--variant-textBg': theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity),
178
+ '--variant-outlinedBg': theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity)
179
+ }
180
+ }
107
181
  }
108
- }),
109
- '&:active': _extends({}, ownerState.variant === 'contained' && {
110
- boxShadow: (theme.vars || theme).shadows[8]
111
- }),
112
- [`&.${buttonClasses.focusVisible}`]: _extends({}, ownerState.variant === 'contained' && {
113
- boxShadow: (theme.vars || theme).shadows[6]
114
- }),
115
- [`&.${buttonClasses.disabled}`]: _extends({
116
- color: (theme.vars || theme).palette.action.disabled
117
- }, ownerState.variant === 'outlined' && {
118
- border: `1px solid ${(theme.vars || theme).palette.action.disabledBackground}`
119
- }, ownerState.variant === 'contained' && {
120
- color: (theme.vars || theme).palette.action.disabled,
121
- boxShadow: (theme.vars || theme).shadows[0],
122
- backgroundColor: (theme.vars || theme).palette.action.disabledBackground
123
- })
124
- }, ownerState.variant === 'text' && {
125
- padding: '6px 8px'
126
- }, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
127
- color: (theme.vars || theme).palette[ownerState.color].main
128
- }, ownerState.variant === 'outlined' && {
129
- padding: '5px 15px',
130
- border: '1px solid currentColor'
131
- }, ownerState.variant === 'outlined' && ownerState.color !== 'inherit' && {
132
- color: (theme.vars || theme).palette[ownerState.color].main,
133
- border: theme.vars ? `1px solid rgba(${theme.vars.palette[ownerState.color].mainChannel} / 0.5)` : `1px solid ${alpha(theme.palette[ownerState.color].main, 0.5)}`
134
- }, ownerState.variant === 'contained' && {
135
- color: theme.vars ?
136
- // this is safe because grey does not change between default light/dark mode
137
- theme.vars.palette.text.primary : theme.palette.getContrastText?.(theme.palette.grey[300]),
138
- backgroundColor: theme.vars ? theme.vars.palette.Button.inheritContainedBg : inheritContainedBackgroundColor,
139
- boxShadow: (theme.vars || theme).shadows[2]
140
- }, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
141
- color: (theme.vars || theme).palette[ownerState.color].contrastText,
142
- backgroundColor: (theme.vars || theme).palette[ownerState.color].main
143
- }, ownerState.color === 'inherit' && {
144
- color: 'inherit',
145
- borderColor: 'currentColor'
146
- }, ownerState.size === 'small' && ownerState.variant === 'text' && {
147
- padding: '4px 5px',
148
- fontSize: theme.typography.pxToRem(13)
149
- }, ownerState.size === 'large' && ownerState.variant === 'text' && {
150
- padding: '8px 11px',
151
- fontSize: theme.typography.pxToRem(15)
152
- }, ownerState.size === 'small' && ownerState.variant === 'outlined' && {
153
- padding: '3px 9px',
154
- fontSize: theme.typography.pxToRem(13)
155
- }, ownerState.size === 'large' && ownerState.variant === 'outlined' && {
156
- padding: '7px 21px',
157
- fontSize: theme.typography.pxToRem(15)
158
- }, ownerState.size === 'small' && ownerState.variant === 'contained' && {
159
- padding: '4px 10px',
160
- fontSize: theme.typography.pxToRem(13)
161
- }, ownerState.size === 'large' && ownerState.variant === 'contained' && {
162
- padding: '8px 22px',
163
- fontSize: theme.typography.pxToRem(15)
164
- }, ownerState.fullWidth && {
165
- width: '100%'
182
+ }, {
183
+ props: {
184
+ size: 'small',
185
+ variant: 'text'
186
+ },
187
+ style: {
188
+ padding: '4px 5px',
189
+ fontSize: theme.typography.pxToRem(13)
190
+ }
191
+ }, {
192
+ props: {
193
+ size: 'large',
194
+ variant: 'text'
195
+ },
196
+ style: {
197
+ padding: '8px 11px',
198
+ fontSize: theme.typography.pxToRem(15)
199
+ }
200
+ }, {
201
+ props: {
202
+ size: 'small',
203
+ variant: 'outlined'
204
+ },
205
+ style: {
206
+ padding: '3px 9px',
207
+ fontSize: theme.typography.pxToRem(13)
208
+ }
209
+ }, {
210
+ props: {
211
+ size: 'large',
212
+ variant: 'outlined'
213
+ },
214
+ style: {
215
+ padding: '7px 21px',
216
+ fontSize: theme.typography.pxToRem(15)
217
+ }
218
+ }, {
219
+ props: {
220
+ size: 'small',
221
+ variant: 'contained'
222
+ },
223
+ style: {
224
+ padding: '4px 10px',
225
+ fontSize: theme.typography.pxToRem(13)
226
+ }
227
+ }, {
228
+ props: {
229
+ size: 'large',
230
+ variant: 'contained'
231
+ },
232
+ style: {
233
+ padding: '8px 22px',
234
+ fontSize: theme.typography.pxToRem(15)
235
+ }
236
+ }, {
237
+ props: {
238
+ disableElevation: true
239
+ },
240
+ style: {
241
+ boxShadow: 'none',
242
+ '&:hover': {
243
+ boxShadow: 'none'
244
+ },
245
+ [`&.${buttonClasses.focusVisible}`]: {
246
+ boxShadow: 'none'
247
+ },
248
+ '&:active': {
249
+ boxShadow: 'none'
250
+ },
251
+ [`&.${buttonClasses.disabled}`]: {
252
+ boxShadow: 'none'
253
+ }
254
+ }
255
+ }, {
256
+ props: {
257
+ fullWidth: true
258
+ },
259
+ style: {
260
+ width: '100%'
261
+ }
262
+ }]
166
263
  });
167
- }, ({
168
- ownerState
169
- }) => ownerState.disableElevation && {
170
- boxShadow: 'none',
171
- '&:hover': {
172
- boxShadow: 'none'
173
- },
174
- [`&.${buttonClasses.focusVisible}`]: {
175
- boxShadow: 'none'
176
- },
177
- '&:active': {
178
- boxShadow: 'none'
179
- },
180
- [`&.${buttonClasses.disabled}`]: {
181
- boxShadow: 'none'
182
- }
183
264
  });
184
265
  const ButtonStartIcon = styled('span', {
185
266
  name: 'MuiButton',
@@ -190,15 +271,19 @@ const ButtonStartIcon = styled('span', {
190
271
  } = props;
191
272
  return [styles.startIcon, styles[`iconSize${capitalize(ownerState.size)}`]];
192
273
  }
193
- })(({
194
- ownerState
195
- }) => _extends({
274
+ })(() => ({
196
275
  display: 'inherit',
197
276
  marginRight: 8,
198
- marginLeft: -4
199
- }, ownerState.size === 'small' && {
200
- marginLeft: -2
201
- }, commonIconStyles(ownerState)));
277
+ marginLeft: -4,
278
+ variants: [{
279
+ props: {
280
+ size: 'small'
281
+ },
282
+ style: {
283
+ marginLeft: -2
284
+ }
285
+ }, ...commonIconStyles]
286
+ }));
202
287
  const ButtonEndIcon = styled('span', {
203
288
  name: 'MuiButton',
204
289
  slot: 'EndIcon',
@@ -208,15 +293,19 @@ const ButtonEndIcon = styled('span', {
208
293
  } = props;
209
294
  return [styles.endIcon, styles[`iconSize${capitalize(ownerState.size)}`]];
210
295
  }
211
- })(({
212
- ownerState
213
- }) => _extends({
296
+ })(() => ({
214
297
  display: 'inherit',
215
298
  marginRight: -4,
216
- marginLeft: 8
217
- }, ownerState.size === 'small' && {
218
- marginRight: -2
219
- }, commonIconStyles(ownerState)));
299
+ marginLeft: 8,
300
+ variants: [{
301
+ props: {
302
+ size: 'small'
303
+ },
304
+ style: {
305
+ marginRight: -2
306
+ }
307
+ }, ...commonIconStyles]
308
+ }));
220
309
  const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
221
310
  // props priority: `inProps` > `contextProps` > `themeDefaultProps`
222
311
  const contextProps = React.useContext(ButtonGroupContext);