@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
@@ -12,8 +12,7 @@ var React = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _clsx = _interopRequireDefault(require("clsx"));
14
14
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
15
- var _styled = _interopRequireDefault(require("../styles/styled"));
16
- var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
15
+ var _zeroStyled = require("../zero-styled");
17
16
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
18
17
  var _Paper = _interopRequireDefault(require("../Paper"));
19
18
  var _appBarClasses = require("./appBarClasses");
@@ -21,6 +20,7 @@ var _jsxRuntime = require("react/jsx-runtime");
21
20
  const _excluded = ["className", "color", "enableColorOnDark", "position"];
22
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
23
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
+ const useThemeProps = (0, _zeroStyled.createUseThemeProps)('MuiAppBar');
24
24
  const useUtilityClasses = ownerState => {
25
25
  const {
26
26
  color,
@@ -36,7 +36,7 @@ const useUtilityClasses = ownerState => {
36
36
  // var2 is the fallback.
37
37
  // Ex. var1: 'var(--a)', var2: 'var(--b)'; return: 'var(--a, var(--b))'
38
38
  const joinVars = (var1, var2) => var1 ? `${var1 == null ? void 0 : var1.replace(')', '')}, ${var2})` : var2;
39
- const AppBarRoot = (0, _styled.default)(_Paper.default, {
39
+ const AppBarRoot = (0, _zeroStyled.styled)(_Paper.default, {
40
40
  name: 'MuiAppBar',
41
41
  slot: 'Root',
42
42
  overridesResolver: (props, styles) => {
@@ -46,77 +46,136 @@ const AppBarRoot = (0, _styled.default)(_Paper.default, {
46
46
  return [styles.root, styles[`position${(0, _capitalize.default)(ownerState.position)}`], styles[`color${(0, _capitalize.default)(ownerState.color)}`]];
47
47
  }
48
48
  })(({
49
- theme,
50
- ownerState
49
+ theme
51
50
  }) => {
52
- const backgroundColorDefault = theme.palette.mode === 'light' ? theme.palette.grey[100] : theme.palette.grey[900];
53
- return (0, _extends2.default)({
51
+ var _theme$vars;
52
+ return {
54
53
  display: 'flex',
55
54
  flexDirection: 'column',
56
55
  width: '100%',
57
56
  boxSizing: 'border-box',
58
57
  // Prevent padding issue with the Modal and fixed positioned AppBar.
59
- flexShrink: 0
60
- }, ownerState.position === 'fixed' && {
61
- position: 'fixed',
62
- zIndex: (theme.vars || theme).zIndex.appBar,
63
- top: 0,
64
- left: 'auto',
65
- right: 0,
66
- '@media print': {
67
- // Prevent the app bar to be visible on each printed page.
68
- position: 'absolute'
69
- }
70
- }, ownerState.position === 'absolute' && {
71
- position: 'absolute',
72
- zIndex: (theme.vars || theme).zIndex.appBar,
73
- top: 0,
74
- left: 'auto',
75
- right: 0
76
- }, ownerState.position === 'sticky' && {
77
- // ⚠️ sticky is not supported by IE11.
78
- position: 'sticky',
79
- zIndex: (theme.vars || theme).zIndex.appBar,
80
- top: 0,
81
- left: 'auto',
82
- right: 0
83
- }, ownerState.position === 'static' && {
84
- position: 'static'
85
- }, ownerState.position === 'relative' && {
86
- position: 'relative'
87
- }, !theme.vars && (0, _extends2.default)({}, ownerState.color === 'default' && {
88
- backgroundColor: backgroundColorDefault,
89
- color: theme.palette.getContrastText(backgroundColorDefault)
90
- }, ownerState.color && ownerState.color !== 'default' && ownerState.color !== 'inherit' && ownerState.color !== 'transparent' && {
91
- backgroundColor: theme.palette[ownerState.color].main,
92
- color: theme.palette[ownerState.color].contrastText
93
- }, ownerState.color === 'inherit' && {
94
- color: 'inherit'
95
- }, theme.palette.mode === 'dark' && !ownerState.enableColorOnDark && {
96
- backgroundColor: null,
97
- color: null
98
- }, ownerState.color === 'transparent' && (0, _extends2.default)({
99
- backgroundColor: 'transparent',
100
- color: 'inherit'
101
- }, theme.palette.mode === 'dark' && {
102
- backgroundImage: 'none'
103
- })), theme.vars && (0, _extends2.default)({}, ownerState.color === 'default' && {
104
- '--AppBar-background': ownerState.enableColorOnDark ? theme.vars.palette.AppBar.defaultBg : joinVars(theme.vars.palette.AppBar.darkBg, theme.vars.palette.AppBar.defaultBg),
105
- '--AppBar-color': ownerState.enableColorOnDark ? theme.vars.palette.text.primary : joinVars(theme.vars.palette.AppBar.darkColor, theme.vars.palette.text.primary)
106
- }, ownerState.color && !ownerState.color.match(/^(default|inherit|transparent)$/) && {
107
- '--AppBar-background': ownerState.enableColorOnDark ? theme.vars.palette[ownerState.color].main : joinVars(theme.vars.palette.AppBar.darkBg, theme.vars.palette[ownerState.color].main),
108
- '--AppBar-color': ownerState.enableColorOnDark ? theme.vars.palette[ownerState.color].contrastText : joinVars(theme.vars.palette.AppBar.darkColor, theme.vars.palette[ownerState.color].contrastText)
109
- }, {
110
- backgroundColor: 'var(--AppBar-background)',
111
- color: ownerState.color === 'inherit' ? 'inherit' : 'var(--AppBar-color)'
112
- }, ownerState.color === 'transparent' && {
113
- backgroundImage: 'none',
114
- backgroundColor: 'transparent',
115
- color: 'inherit'
116
- }));
58
+ flexShrink: 0,
59
+ variants: [{
60
+ props: {
61
+ position: 'fixed'
62
+ },
63
+ style: {
64
+ position: 'fixed',
65
+ zIndex: (theme.vars || theme).zIndex.appBar,
66
+ top: 0,
67
+ left: 'auto',
68
+ right: 0,
69
+ '@media print': {
70
+ // Prevent the app bar to be visible on each printed page.
71
+ position: 'absolute'
72
+ }
73
+ }
74
+ }, {
75
+ props: {
76
+ position: 'absolute'
77
+ },
78
+ style: {
79
+ position: 'absolute',
80
+ zIndex: (theme.vars || theme).zIndex.appBar,
81
+ top: 0,
82
+ left: 'auto',
83
+ right: 0
84
+ }
85
+ }, {
86
+ props: {
87
+ position: 'sticky'
88
+ },
89
+ style: {
90
+ // ⚠️ sticky is not supported by IE11.
91
+ position: 'sticky',
92
+ zIndex: (theme.vars || theme).zIndex.appBar,
93
+ top: 0,
94
+ left: 'auto',
95
+ right: 0
96
+ }
97
+ }, {
98
+ props: {
99
+ position: 'static'
100
+ },
101
+ style: {
102
+ position: 'static'
103
+ }
104
+ }, {
105
+ props: {
106
+ position: 'relative'
107
+ },
108
+ style: {
109
+ position: 'relative'
110
+ }
111
+ }, {
112
+ props: {
113
+ color: 'inherit'
114
+ },
115
+ style: {
116
+ '--AppBar-color': 'inherit'
117
+ }
118
+ }, {
119
+ props: {
120
+ color: 'default'
121
+ },
122
+ style: (0, _extends2.default)({
123
+ '--AppBar-background': theme.vars ? theme.vars.palette.AppBar.defaultBg : theme.palette.grey[100],
124
+ '--AppBar-color': theme.vars ? theme.vars.palette.text.primary : theme.palette.getContrastText(theme.palette.grey[100])
125
+ }, theme.applyStyles('dark', {
126
+ '--AppBar-background': theme.vars ? theme.vars.palette.AppBar.defaultBg : theme.palette.grey[900],
127
+ '--AppBar-color': theme.vars ? theme.vars.palette.text.primary : theme.palette.getContrastText(theme.palette.grey[900])
128
+ }))
129
+ }, ...Object.keys(((_theme$vars = theme.vars) != null ? _theme$vars : theme).palette).filter(key => {
130
+ var _theme$vars2, _theme$vars3;
131
+ return ((_theme$vars2 = theme.vars) != null ? _theme$vars2 : theme).palette[key].main && ((_theme$vars3 = theme.vars) != null ? _theme$vars3 : theme).palette[key].contrastText;
132
+ }).map(color => {
133
+ var _theme$vars4, _theme$vars5;
134
+ return {
135
+ props: {
136
+ color
137
+ },
138
+ style: {
139
+ '--AppBar-background': ((_theme$vars4 = theme.vars) != null ? _theme$vars4 : theme).palette[color].main,
140
+ '--AppBar-color': ((_theme$vars5 = theme.vars) != null ? _theme$vars5 : theme).palette[color].contrastText
141
+ }
142
+ };
143
+ }), {
144
+ props: {
145
+ enableColorOnDark: true
146
+ },
147
+ style: {
148
+ backgroundColor: 'var(--AppBar-background)',
149
+ color: 'var(--AppBar-color)'
150
+ }
151
+ }, {
152
+ props: {
153
+ enableColorOnDark: false
154
+ },
155
+ style: (0, _extends2.default)({
156
+ backgroundColor: 'var(--AppBar-background)',
157
+ color: 'var(--AppBar-color)'
158
+ }, theme.applyStyles('dark', {
159
+ backgroundColor: theme.vars ? joinVars(theme.vars.palette.AppBar.darkBg, 'var(--AppBar-background)') : null,
160
+ color: theme.vars ? joinVars(theme.vars.palette.AppBar.darkColor, 'var(--AppBar-color)') : null
161
+ }))
162
+ }, {
163
+ props: {
164
+ color: 'transparent'
165
+ },
166
+ style: (0, _extends2.default)({
167
+ '--AppBar-background': 'transparent',
168
+ '--AppBar-color': 'inherit',
169
+ backgroundColor: 'var(--AppBar-background)',
170
+ color: 'var(--AppBar-color)'
171
+ }, theme.applyStyles('dark', {
172
+ backgroundImage: 'none'
173
+ }))
174
+ }]
175
+ };
117
176
  });
118
177
  const AppBar = /*#__PURE__*/React.forwardRef(function AppBar(inProps, ref) {
119
- const props = (0, _useThemeProps.default)({
178
+ const props = useThemeProps({
120
179
  props: inProps,
121
180
  name: 'MuiAppBar'
122
181
  });
@@ -366,8 +366,7 @@ process.env.NODE_ENV !== "production" ? Badge.propTypes /* remove-proptypes */ =
366
366
  /**
367
367
  * The components used for each slot inside.
368
368
  *
369
- * This prop is an alias for the `slots` prop.
370
- * It's recommended to use the `slots` prop instead.
369
+ * @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
371
370
  *
372
371
  * @default {}
373
372
  */
@@ -379,8 +378,7 @@ process.env.NODE_ENV !== "production" ? Badge.propTypes /* remove-proptypes */ =
379
378
  * The extra props for the slot components.
380
379
  * You can override the existing props or add new ones.
381
380
  *
382
- * This prop is an alias for the `slotProps` prop.
383
- * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
381
+ * @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
384
382
  *
385
383
  * @default {}
386
384
  */