@mui/system 5.12.0 → 5.12.1

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 (50) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/Container/Container.d.ts +13 -13
  3. package/Container/ContainerProps.d.ts +40 -40
  4. package/Container/containerClasses.d.ts +22 -22
  5. package/Container/createContainer.d.ts +18 -18
  6. package/GlobalStyles/GlobalStyles.d.ts +13 -13
  7. package/GlobalStyles/index.d.ts +2 -2
  8. package/Stack/Stack.d.ts +14 -13
  9. package/Stack/Stack.js +2 -1
  10. package/Stack/StackProps.d.ts +53 -53
  11. package/Stack/createStack.d.ts +21 -21
  12. package/Stack/index.d.ts +5 -5
  13. package/Stack/stackClasses.d.ts +8 -8
  14. package/Unstable_Grid/Grid.d.ts +12 -12
  15. package/Unstable_Grid/GridProps.d.ts +185 -173
  16. package/Unstable_Grid/createGrid.d.ts +11 -11
  17. package/Unstable_Grid/createGrid.js +18 -11
  18. package/Unstable_Grid/gridClasses.d.ts +20 -20
  19. package/Unstable_Grid/gridGenerator.d.ts +38 -38
  20. package/Unstable_Grid/gridGenerator.js +12 -12
  21. package/Unstable_Grid/index.d.ts +5 -5
  22. package/createStyled.js +3 -0
  23. package/createTheme/createSpacing.d.ts +10 -10
  24. package/cssVars/createCssVarsTheme.d.ts +15 -13
  25. package/cssVars/createGetCssVar.d.ts +5 -5
  26. package/cssVars/cssVarsParser.d.ts +64 -64
  27. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  28. package/cssVars/index.d.ts +5 -5
  29. package/cssVars/prepareCssVars.d.ts +16 -14
  30. package/cssVars/prepareCssVars.js +6 -2
  31. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  32. package/esm/Stack/Stack.js +2 -1
  33. package/esm/Unstable_Grid/createGrid.js +19 -12
  34. package/esm/Unstable_Grid/gridGenerator.js +12 -12
  35. package/esm/createStyled.js +3 -0
  36. package/esm/cssVars/prepareCssVars.js +6 -2
  37. package/index.js +1 -1
  38. package/legacy/Stack/Stack.js +2 -1
  39. package/legacy/Unstable_Grid/createGrid.js +19 -11
  40. package/legacy/Unstable_Grid/gridGenerator.js +12 -12
  41. package/legacy/createStyled.js +3 -0
  42. package/legacy/cssVars/prepareCssVars.js +6 -2
  43. package/legacy/index.js +1 -1
  44. package/modern/Stack/Stack.js +2 -1
  45. package/modern/Unstable_Grid/createGrid.js +18 -12
  46. package/modern/Unstable_Grid/gridGenerator.js +12 -12
  47. package/modern/createStyled.js +3 -0
  48. package/modern/cssVars/prepareCssVars.js +6 -2
  49. package/modern/index.js +1 -1
  50. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["className", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow"];
3
+ const _excluded = ["className", "children", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow", "unstable_level"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
- import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass } from '@mui/utils';
7
+ import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_isMuiElement as isMuiElement } from '@mui/utils';
8
8
  import systemStyled from '../styled';
9
9
  import useThemePropsSystem from '../useThemeProps';
10
10
  import useTheme from '../useTheme';
@@ -34,7 +34,6 @@ export default function createGrid(options = {}) {
34
34
  useThemeProps = useThemePropsDefault,
35
35
  componentName = 'MuiGrid'
36
36
  } = options;
37
- const NestedContext = /*#__PURE__*/React.createContext(0);
38
37
  const OverflowContext = /*#__PURE__*/React.createContext(undefined);
39
38
  const useUtilityClasses = (ownerState, theme) => {
40
39
  const {
@@ -55,10 +54,10 @@ export default function createGrid(options = {}) {
55
54
  const theme = useTheme();
56
55
  const themeProps = useThemeProps(inProps);
57
56
  const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
58
- const level = React.useContext(NestedContext);
59
57
  const overflow = React.useContext(OverflowContext);
60
58
  const {
61
59
  className,
60
+ children,
62
61
  columns: columnsProp = 12,
63
62
  container = false,
64
63
  component = 'div',
@@ -67,7 +66,8 @@ export default function createGrid(options = {}) {
67
66
  spacing: spacingProp = 0,
68
67
  rowSpacing: rowSpacingProp = spacingProp,
69
68
  columnSpacing: columnSpacingProp = spacingProp,
70
- disableEqualOverflow: themeDisableEqualOverflow
69
+ disableEqualOverflow: themeDisableEqualOverflow,
70
+ unstable_level: level = 0
71
71
  } = props,
72
72
  rest = _objectWithoutPropertiesLoose(props, _excluded);
73
73
  // Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
@@ -114,13 +114,17 @@ export default function createGrid(options = {}) {
114
114
  as: component,
115
115
  ownerState: ownerState,
116
116
  className: clsx(classes.root, className)
117
- }, other));
118
- if (container) {
119
- result = /*#__PURE__*/_jsx(NestedContext.Provider, {
120
- value: level + 1,
121
- children: result
122
- });
123
- }
117
+ }, other, {
118
+ children: React.Children.map(children, child => {
119
+ if ( /*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
120
+ var _child$props$unstable;
121
+ return /*#__PURE__*/React.cloneElement(child, {
122
+ unstable_level: (_child$props$unstable = child.props.unstable_level) != null ? _child$props$unstable : level + 1
123
+ });
124
+ }
125
+ return child;
126
+ })
127
+ }));
124
128
  if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
125
129
  // There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
126
130
  // 1. It is the root grid with `disableEqualOverflow`.
@@ -156,5 +160,8 @@ export default function createGrid(options = {}) {
156
160
  xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
157
161
  xsOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
158
162
  } : void 0;
163
+
164
+ // @ts-ignore internal logic for nested grid
165
+ Grid.muiName = 'Grid';
159
166
  return Grid;
160
167
  }
@@ -6,26 +6,26 @@ function appendLevel(level) {
6
6
  return `Level${level}`;
7
7
  }
8
8
  function isNestedContainer(ownerState) {
9
- return ownerState.level > 0 && ownerState.container;
9
+ return ownerState.unstable_level > 0 && ownerState.container;
10
10
  }
11
11
  function createGetSelfSpacing(ownerState) {
12
12
  return function getSelfSpacing(axis) {
13
- return `var(--Grid-${axis}Spacing${appendLevel(ownerState.level)})`;
13
+ return `var(--Grid-${axis}Spacing${appendLevel(ownerState.unstable_level)})`;
14
14
  };
15
15
  }
16
16
  function createGetParentSpacing(ownerState) {
17
17
  return function getParentSpacing(axis) {
18
- if (ownerState.level === 0) {
18
+ if (ownerState.unstable_level === 0) {
19
19
  return `var(--Grid-${axis}Spacing)`;
20
20
  }
21
- return `var(--Grid-${axis}Spacing${appendLevel(ownerState.level - 1)})`;
21
+ return `var(--Grid-${axis}Spacing${appendLevel(ownerState.unstable_level - 1)})`;
22
22
  };
23
23
  }
24
24
  function getParentColumns(ownerState) {
25
- if (ownerState.level === 0) {
25
+ if (ownerState.unstable_level === 0) {
26
26
  return `var(--Grid-columns)`;
27
27
  }
28
- return `var(--Grid-columns${appendLevel(ownerState.level - 1)})`;
28
+ return `var(--Grid-columns${appendLevel(ownerState.unstable_level - 1)})`;
29
29
  }
30
30
  export const filterBreakpointKeys = (breakpointsKeys, responsiveKeys) => breakpointsKeys.filter(key => responsiveKeys.includes(key));
31
31
  export const traverseBreakpoints = (breakpoints, responsive, iterator) => {
@@ -133,13 +133,13 @@ export const generateGridColumnsStyles = ({
133
133
  return {};
134
134
  }
135
135
  const styles = isNestedContainer(ownerState) ? {
136
- [`--Grid-columns${appendLevel(ownerState.level)}`]: getParentColumns(ownerState)
136
+ [`--Grid-columns${appendLevel(ownerState.unstable_level)}`]: getParentColumns(ownerState)
137
137
  } : {
138
138
  '--Grid-columns': 12
139
139
  };
140
140
  traverseBreakpoints(theme.breakpoints, ownerState.columns, (appendStyle, value) => {
141
141
  appendStyle(styles, {
142
- [`--Grid-columns${appendLevel(ownerState.level)}`]: value
142
+ [`--Grid-columns${appendLevel(ownerState.unstable_level)}`]: value
143
143
  });
144
144
  });
145
145
  return styles;
@@ -155,12 +155,12 @@ export const generateGridRowSpacingStyles = ({
155
155
  const styles = isNestedContainer(ownerState) ? {
156
156
  // Set the default spacing as its parent spacing.
157
157
  // It will be overridden if spacing props are provided
158
- [`--Grid-rowSpacing${appendLevel(ownerState.level)}`]: getParentSpacing('row')
158
+ [`--Grid-rowSpacing${appendLevel(ownerState.unstable_level)}`]: getParentSpacing('row')
159
159
  } : {};
160
160
  traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, (appendStyle, value) => {
161
161
  var _theme$spacing;
162
162
  appendStyle(styles, {
163
- [`--Grid-rowSpacing${appendLevel(ownerState.level)}`]: typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)
163
+ [`--Grid-rowSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)
164
164
  });
165
165
  });
166
166
  return styles;
@@ -176,12 +176,12 @@ export const generateGridColumnSpacingStyles = ({
176
176
  const styles = isNestedContainer(ownerState) ? {
177
177
  // Set the default spacing as its parent spacing.
178
178
  // It will be overridden if spacing props are provided
179
- [`--Grid-columnSpacing${appendLevel(ownerState.level)}`]: getParentSpacing('column')
179
+ [`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: getParentSpacing('column')
180
180
  } : {};
181
181
  traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, (appendStyle, value) => {
182
182
  var _theme$spacing2;
183
183
  appendStyle(styles, {
184
- [`--Grid-columnSpacing${appendLevel(ownerState.level)}`]: typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)
184
+ [`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)
185
185
  });
186
186
  });
187
187
  return styles;
@@ -202,6 +202,9 @@ export default function createStyled(input = {}) {
202
202
  }
203
203
  Component.displayName = displayName;
204
204
  }
205
+ if (tag.muiName) {
206
+ Component.muiName = tag.muiName;
207
+ }
205
208
  return Component;
206
209
  };
207
210
  if (defaultStyledResolver.withConfig) {
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
3
  const _excluded = ["colorSchemes", "components"],
3
4
  _excluded2 = ["light"];
@@ -48,11 +49,14 @@ function prepareCssVars(theme, parserConfig) {
48
49
  const generateCssVars = colorScheme => {
49
50
  if (!colorScheme) {
50
51
  return {
51
- css: rootCss,
52
+ css: _extends({}, rootCss),
52
53
  vars: rootVars
53
54
  };
54
55
  }
55
- return colorSchemesMap[colorScheme];
56
+ return {
57
+ css: _extends({}, colorSchemesMap[colorScheme].css),
58
+ vars: colorSchemesMap[colorScheme].vars
59
+ };
56
60
  };
57
61
  return {
58
62
  vars: themeVars,
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.12.0
2
+ * @mui/system v5.12.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -4,6 +4,7 @@ import createStack from './createStack';
4
4
  *
5
5
  * Demos:
6
6
  *
7
+ * - [Stack (Joy UI)](https://mui.com/joy/react-stack/)
7
8
  * - [Stack (Material UI)](https://mui.com/material-ui/react-stack/)
8
9
  * - [Stack (MUI System)](https://mui.com/system/react-stack/)
9
10
  *
@@ -48,7 +49,7 @@ process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ =
48
49
  /**
49
50
  * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
50
51
  *
51
- * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
52
+ * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
52
53
  * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
53
54
  *
54
55
  * To enable this flag globally, follow the theme's default props configuration.
@@ -5,7 +5,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import clsx from 'clsx';
8
- import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass } from '@mui/utils';
8
+ import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_isMuiElement as isMuiElement } from '@mui/utils';
9
9
  import systemStyled from '../styled';
10
10
  import useThemePropsSystem from '../useThemeProps';
11
11
  import useTheme from '../useTheme';
@@ -38,7 +38,6 @@ export default function createGrid() {
38
38
  useThemeProps = _options$useThemeProp === void 0 ? useThemePropsDefault : _options$useThemeProp,
39
39
  _options$componentNam = options.componentName,
40
40
  componentName = _options$componentNam === void 0 ? 'MuiGrid' : _options$componentNam;
41
- var NestedContext = /*#__PURE__*/React.createContext(0);
42
41
  var OverflowContext = /*#__PURE__*/React.createContext(undefined);
43
42
  var useUtilityClasses = function useUtilityClasses(ownerState, theme) {
44
43
  var container = ownerState.container,
@@ -59,9 +58,9 @@ export default function createGrid() {
59
58
  var theme = useTheme();
60
59
  var themeProps = useThemeProps(inProps);
61
60
  var props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
62
- var level = React.useContext(NestedContext);
63
61
  var overflow = React.useContext(OverflowContext);
64
62
  var className = props.className,
63
+ children = props.children,
65
64
  _props$columns = props.columns,
66
65
  columnsProp = _props$columns === void 0 ? 12 : _props$columns,
67
66
  _props$container = props.container,
@@ -79,7 +78,9 @@ export default function createGrid() {
79
78
  _props$columnSpacing = props.columnSpacing,
80
79
  columnSpacingProp = _props$columnSpacing === void 0 ? spacingProp : _props$columnSpacing,
81
80
  themeDisableEqualOverflow = props.disableEqualOverflow,
82
- rest = _objectWithoutProperties(props, ["className", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow"]); // Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
81
+ _props$unstable_level = props.unstable_level,
82
+ level = _props$unstable_level === void 0 ? 0 : _props$unstable_level,
83
+ rest = _objectWithoutProperties(props, ["className", "children", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow", "unstable_level"]); // Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
83
84
  var disableEqualOverflow = themeDisableEqualOverflow;
84
85
  if (level && themeDisableEqualOverflow !== undefined) {
85
86
  disableEqualOverflow = inProps.disableEqualOverflow;
@@ -126,13 +127,17 @@ export default function createGrid() {
126
127
  as: component,
127
128
  ownerState: ownerState,
128
129
  className: clsx(classes.root, className)
129
- }, other));
130
- if (container) {
131
- result = /*#__PURE__*/_jsx(NestedContext.Provider, {
132
- value: level + 1,
133
- children: result
134
- });
135
- }
130
+ }, other, {
131
+ children: React.Children.map(children, function (child) {
132
+ if ( /*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
133
+ var _child$props$unstable;
134
+ return /*#__PURE__*/React.cloneElement(child, {
135
+ unstable_level: (_child$props$unstable = child.props.unstable_level) != null ? _child$props$unstable : level + 1
136
+ });
137
+ }
138
+ return child;
139
+ })
140
+ }));
136
141
  if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
137
142
  // There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
138
143
  // 1. It is the root grid with `disableEqualOverflow`.
@@ -168,5 +173,8 @@ export default function createGrid() {
168
173
  xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
169
174
  xsOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
170
175
  } : void 0;
176
+
177
+ // @ts-ignore internal logic for nested grid
178
+ Grid.muiName = 'Grid';
171
179
  return Grid;
172
180
  }
@@ -9,26 +9,26 @@ function appendLevel(level) {
9
9
  return "Level".concat(level);
10
10
  }
11
11
  function isNestedContainer(ownerState) {
12
- return ownerState.level > 0 && ownerState.container;
12
+ return ownerState.unstable_level > 0 && ownerState.container;
13
13
  }
14
14
  function createGetSelfSpacing(ownerState) {
15
15
  return function getSelfSpacing(axis) {
16
- return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.level), ")");
16
+ return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.unstable_level), ")");
17
17
  };
18
18
  }
19
19
  function createGetParentSpacing(ownerState) {
20
20
  return function getParentSpacing(axis) {
21
- if (ownerState.level === 0) {
21
+ if (ownerState.unstable_level === 0) {
22
22
  return "var(--Grid-".concat(axis, "Spacing)");
23
23
  }
24
- return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.level - 1), ")");
24
+ return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.unstable_level - 1), ")");
25
25
  };
26
26
  }
27
27
  function getParentColumns(ownerState) {
28
- if (ownerState.level === 0) {
28
+ if (ownerState.unstable_level === 0) {
29
29
  return "var(--Grid-columns)";
30
30
  }
31
- return "var(--Grid-columns".concat(appendLevel(ownerState.level - 1), ")");
31
+ return "var(--Grid-columns".concat(appendLevel(ownerState.unstable_level - 1), ")");
32
32
  }
33
33
  export var filterBreakpointKeys = function filterBreakpointKeys(breakpointsKeys, responsiveKeys) {
34
34
  return breakpointsKeys.filter(function (key) {
@@ -136,11 +136,11 @@ export var generateGridColumnsStyles = function generateGridColumnsStyles(_ref3)
136
136
  if (!ownerState.container) {
137
137
  return {};
138
138
  }
139
- var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.level)), getParentColumns(ownerState)) : {
139
+ var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.unstable_level)), getParentColumns(ownerState)) : {
140
140
  '--Grid-columns': 12
141
141
  };
142
142
  traverseBreakpoints(theme.breakpoints, ownerState.columns, function (appendStyle, value) {
143
- appendStyle(styles, _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.level)), value));
143
+ appendStyle(styles, _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.unstable_level)), value));
144
144
  });
145
145
  return styles;
146
146
  };
@@ -151,10 +151,10 @@ export var generateGridRowSpacingStyles = function generateGridRowSpacingStyles(
151
151
  return {};
152
152
  }
153
153
  var getParentSpacing = createGetParentSpacing(ownerState);
154
- var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.level)), getParentSpacing('row')) : {};
154
+ var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.unstable_level)), getParentSpacing('row')) : {};
155
155
  traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, function (appendStyle, value) {
156
156
  var _theme$spacing;
157
- appendStyle(styles, _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.level)), typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)));
157
+ appendStyle(styles, _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.unstable_level)), typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)));
158
158
  });
159
159
  return styles;
160
160
  };
@@ -165,10 +165,10 @@ export var generateGridColumnSpacingStyles = function generateGridColumnSpacingS
165
165
  return {};
166
166
  }
167
167
  var getParentSpacing = createGetParentSpacing(ownerState);
168
- var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.level)), getParentSpacing('column')) : {};
168
+ var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.unstable_level)), getParentSpacing('column')) : {};
169
169
  traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, function (appendStyle, value) {
170
170
  var _theme$spacing2;
171
- appendStyle(styles, _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.level)), typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)));
171
+ appendStyle(styles, _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.unstable_level)), typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)));
172
172
  });
173
173
  return styles;
174
174
  };
@@ -212,6 +212,9 @@ export default function createStyled() {
212
212
  }
213
213
  Component.displayName = displayName;
214
214
  }
215
+ if (tag.muiName) {
216
+ Component.muiName = tag.muiName;
217
+ }
215
218
  return Component;
216
219
  };
217
220
  if (defaultStyledResolver.withConfig) {
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
4
  import { deepmerge } from '@mui/utils';
@@ -45,11 +46,14 @@ function prepareCssVars(theme, parserConfig) {
45
46
  var generateCssVars = function generateCssVars(colorScheme) {
46
47
  if (!colorScheme) {
47
48
  return {
48
- css: rootCss,
49
+ css: _extends({}, rootCss),
49
50
  vars: rootVars
50
51
  };
51
52
  }
52
- return colorSchemesMap[colorScheme];
53
+ return {
54
+ css: _extends({}, colorSchemesMap[colorScheme].css),
55
+ vars: colorSchemesMap[colorScheme].vars
56
+ };
53
57
  };
54
58
  return {
55
59
  vars: themeVars,
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.12.0
2
+ * @mui/system v5.12.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -4,6 +4,7 @@ import createStack from './createStack';
4
4
  *
5
5
  * Demos:
6
6
  *
7
+ * - [Stack (Joy UI)](https://mui.com/joy/react-stack/)
7
8
  * - [Stack (Material UI)](https://mui.com/material-ui/react-stack/)
8
9
  * - [Stack (MUI System)](https://mui.com/system/react-stack/)
9
10
  *
@@ -48,7 +49,7 @@ process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ =
48
49
  /**
49
50
  * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
50
51
  *
51
- * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
52
+ * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
52
53
  * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
53
54
  *
54
55
  * To enable this flag globally, follow the theme's default props configuration.
@@ -1,10 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["className", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow"];
3
+ const _excluded = ["className", "children", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow", "unstable_level"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
- import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass } from '@mui/utils';
7
+ import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_isMuiElement as isMuiElement } from '@mui/utils';
8
8
  import systemStyled from '../styled';
9
9
  import useThemePropsSystem from '../useThemeProps';
10
10
  import useTheme from '../useTheme';
@@ -34,7 +34,6 @@ export default function createGrid(options = {}) {
34
34
  useThemeProps = useThemePropsDefault,
35
35
  componentName = 'MuiGrid'
36
36
  } = options;
37
- const NestedContext = /*#__PURE__*/React.createContext(0);
38
37
  const OverflowContext = /*#__PURE__*/React.createContext(undefined);
39
38
  const useUtilityClasses = (ownerState, theme) => {
40
39
  const {
@@ -54,10 +53,10 @@ export default function createGrid(options = {}) {
54
53
  const theme = useTheme();
55
54
  const themeProps = useThemeProps(inProps);
56
55
  const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
57
- const level = React.useContext(NestedContext);
58
56
  const overflow = React.useContext(OverflowContext);
59
57
  const {
60
58
  className,
59
+ children,
61
60
  columns: columnsProp = 12,
62
61
  container = false,
63
62
  component = 'div',
@@ -66,7 +65,8 @@ export default function createGrid(options = {}) {
66
65
  spacing: spacingProp = 0,
67
66
  rowSpacing: rowSpacingProp = spacingProp,
68
67
  columnSpacing: columnSpacingProp = spacingProp,
69
- disableEqualOverflow: themeDisableEqualOverflow
68
+ disableEqualOverflow: themeDisableEqualOverflow,
69
+ unstable_level: level = 0
70
70
  } = props,
71
71
  rest = _objectWithoutPropertiesLoose(props, _excluded);
72
72
  // Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
@@ -113,13 +113,16 @@ export default function createGrid(options = {}) {
113
113
  as: component,
114
114
  ownerState: ownerState,
115
115
  className: clsx(classes.root, className)
116
- }, other));
117
- if (container) {
118
- result = /*#__PURE__*/_jsx(NestedContext.Provider, {
119
- value: level + 1,
120
- children: result
121
- });
122
- }
116
+ }, other, {
117
+ children: React.Children.map(children, child => {
118
+ if ( /*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
119
+ return /*#__PURE__*/React.cloneElement(child, {
120
+ unstable_level: child.props.unstable_level ?? level + 1
121
+ });
122
+ }
123
+ return child;
124
+ })
125
+ }));
123
126
  if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow ?? false)) {
124
127
  // There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
125
128
  // 1. It is the root grid with `disableEqualOverflow`.
@@ -155,5 +158,8 @@ export default function createGrid(options = {}) {
155
158
  xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
156
159
  xsOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
157
160
  } : void 0;
161
+
162
+ // @ts-ignore internal logic for nested grid
163
+ Grid.muiName = 'Grid';
158
164
  return Grid;
159
165
  }
@@ -6,26 +6,26 @@ function appendLevel(level) {
6
6
  return `Level${level}`;
7
7
  }
8
8
  function isNestedContainer(ownerState) {
9
- return ownerState.level > 0 && ownerState.container;
9
+ return ownerState.unstable_level > 0 && ownerState.container;
10
10
  }
11
11
  function createGetSelfSpacing(ownerState) {
12
12
  return function getSelfSpacing(axis) {
13
- return `var(--Grid-${axis}Spacing${appendLevel(ownerState.level)})`;
13
+ return `var(--Grid-${axis}Spacing${appendLevel(ownerState.unstable_level)})`;
14
14
  };
15
15
  }
16
16
  function createGetParentSpacing(ownerState) {
17
17
  return function getParentSpacing(axis) {
18
- if (ownerState.level === 0) {
18
+ if (ownerState.unstable_level === 0) {
19
19
  return `var(--Grid-${axis}Spacing)`;
20
20
  }
21
- return `var(--Grid-${axis}Spacing${appendLevel(ownerState.level - 1)})`;
21
+ return `var(--Grid-${axis}Spacing${appendLevel(ownerState.unstable_level - 1)})`;
22
22
  };
23
23
  }
24
24
  function getParentColumns(ownerState) {
25
- if (ownerState.level === 0) {
25
+ if (ownerState.unstable_level === 0) {
26
26
  return `var(--Grid-columns)`;
27
27
  }
28
- return `var(--Grid-columns${appendLevel(ownerState.level - 1)})`;
28
+ return `var(--Grid-columns${appendLevel(ownerState.unstable_level - 1)})`;
29
29
  }
30
30
  export const filterBreakpointKeys = (breakpointsKeys, responsiveKeys) => breakpointsKeys.filter(key => responsiveKeys.includes(key));
31
31
  export const traverseBreakpoints = (breakpoints, responsive, iterator) => {
@@ -133,13 +133,13 @@ export const generateGridColumnsStyles = ({
133
133
  return {};
134
134
  }
135
135
  const styles = isNestedContainer(ownerState) ? {
136
- [`--Grid-columns${appendLevel(ownerState.level)}`]: getParentColumns(ownerState)
136
+ [`--Grid-columns${appendLevel(ownerState.unstable_level)}`]: getParentColumns(ownerState)
137
137
  } : {
138
138
  '--Grid-columns': 12
139
139
  };
140
140
  traverseBreakpoints(theme.breakpoints, ownerState.columns, (appendStyle, value) => {
141
141
  appendStyle(styles, {
142
- [`--Grid-columns${appendLevel(ownerState.level)}`]: value
142
+ [`--Grid-columns${appendLevel(ownerState.unstable_level)}`]: value
143
143
  });
144
144
  });
145
145
  return styles;
@@ -155,11 +155,11 @@ export const generateGridRowSpacingStyles = ({
155
155
  const styles = isNestedContainer(ownerState) ? {
156
156
  // Set the default spacing as its parent spacing.
157
157
  // It will be overridden if spacing props are provided
158
- [`--Grid-rowSpacing${appendLevel(ownerState.level)}`]: getParentSpacing('row')
158
+ [`--Grid-rowSpacing${appendLevel(ownerState.unstable_level)}`]: getParentSpacing('row')
159
159
  } : {};
160
160
  traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, (appendStyle, value) => {
161
161
  appendStyle(styles, {
162
- [`--Grid-rowSpacing${appendLevel(ownerState.level)}`]: typeof value === 'string' ? value : theme.spacing?.(value)
162
+ [`--Grid-rowSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value : theme.spacing?.(value)
163
163
  });
164
164
  });
165
165
  return styles;
@@ -175,11 +175,11 @@ export const generateGridColumnSpacingStyles = ({
175
175
  const styles = isNestedContainer(ownerState) ? {
176
176
  // Set the default spacing as its parent spacing.
177
177
  // It will be overridden if spacing props are provided
178
- [`--Grid-columnSpacing${appendLevel(ownerState.level)}`]: getParentSpacing('column')
178
+ [`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: getParentSpacing('column')
179
179
  } : {};
180
180
  traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, (appendStyle, value) => {
181
181
  appendStyle(styles, {
182
- [`--Grid-columnSpacing${appendLevel(ownerState.level)}`]: typeof value === 'string' ? value : theme.spacing?.(value)
182
+ [`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value : theme.spacing?.(value)
183
183
  });
184
184
  });
185
185
  return styles;
@@ -201,6 +201,9 @@ export default function createStyled(input = {}) {
201
201
  }
202
202
  Component.displayName = displayName;
203
203
  }
204
+ if (tag.muiName) {
205
+ Component.muiName = tag.muiName;
206
+ }
204
207
  return Component;
205
208
  };
206
209
  if (defaultStyledResolver.withConfig) {
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
3
  const _excluded = ["colorSchemes", "components"],
3
4
  _excluded2 = ["light"];
@@ -48,11 +49,14 @@ function prepareCssVars(theme, parserConfig) {
48
49
  const generateCssVars = colorScheme => {
49
50
  if (!colorScheme) {
50
51
  return {
51
- css: rootCss,
52
+ css: _extends({}, rootCss),
52
53
  vars: rootVars
53
54
  };
54
55
  }
55
- return colorSchemesMap[colorScheme];
56
+ return {
57
+ css: _extends({}, colorSchemesMap[colorScheme].css),
58
+ vars: colorSchemesMap[colorScheme].vars
59
+ };
56
60
  };
57
61
  return {
58
62
  vars: themeVars,
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.12.0
2
+ * @mui/system v5.12.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/system",
3
- "version": "5.12.0",
3
+ "version": "5.12.1",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "CSS utilities for rapidly laying out custom designs.",