@mui/system 5.12.0 → 5.12.3

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 (58) hide show
  1. package/CHANGELOG.md +262 -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/colorManipulator.js +2 -0
  23. package/createStyled.js +4 -0
  24. package/createTheme/createSpacing.d.ts +10 -10
  25. package/createTheme/createSpacing.js +3 -1
  26. package/cssVars/createCssVarsTheme.d.ts +15 -13
  27. package/cssVars/createGetCssVar.d.ts +5 -5
  28. package/cssVars/cssVarsParser.d.ts +64 -64
  29. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  30. package/cssVars/index.d.ts +5 -5
  31. package/cssVars/prepareCssVars.d.ts +16 -14
  32. package/cssVars/prepareCssVars.js +6 -2
  33. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  34. package/esm/Stack/Stack.js +2 -1
  35. package/esm/Unstable_Grid/createGrid.js +19 -12
  36. package/esm/Unstable_Grid/gridGenerator.js +12 -12
  37. package/esm/colorManipulator.js +1 -0
  38. package/esm/createStyled.js +3 -0
  39. package/esm/createTheme/createSpacing.js +4 -0
  40. package/esm/cssVars/prepareCssVars.js +6 -2
  41. package/index.js +5 -2
  42. package/legacy/Stack/Stack.js +2 -1
  43. package/legacy/Unstable_Grid/createGrid.js +19 -11
  44. package/legacy/Unstable_Grid/gridGenerator.js +12 -12
  45. package/legacy/colorManipulator.js +1 -0
  46. package/legacy/createStyled.js +3 -0
  47. package/legacy/createTheme/createSpacing.js +4 -0
  48. package/legacy/cssVars/prepareCssVars.js +6 -2
  49. package/legacy/index.js +1 -1
  50. package/modern/Stack/Stack.js +2 -1
  51. package/modern/Unstable_Grid/createGrid.js +18 -12
  52. package/modern/Unstable_Grid/gridGenerator.js +12 -12
  53. package/modern/colorManipulator.js +1 -0
  54. package/modern/createStyled.js +3 -0
  55. package/modern/createTheme/createSpacing.js +4 -0
  56. package/modern/cssVars/prepareCssVars.js +6 -2
  57. package/modern/index.js +1 -1
  58. package/package.json +4 -4
@@ -1,53 +1,53 @@
1
- export type Mode = 'light' | 'dark' | 'system';
2
- export type SystemMode = Exclude<Mode, 'system'>;
3
- export interface State<SupportedColorScheme extends string> {
4
- /**
5
- * User selected mode.
6
- * Note: on the server, mode is always undefined
7
- */
8
- mode: Mode | undefined;
9
- /**
10
- * Only valid if `mode: 'system'`, either 'light' | 'dark'.
11
- */
12
- systemMode: SystemMode | undefined;
13
- /**
14
- * The color scheme for the light mode.
15
- */
16
- lightColorScheme: SupportedColorScheme;
17
- /**
18
- * The color scheme for the dark mode.
19
- */
20
- darkColorScheme: SupportedColorScheme;
21
- }
22
- export type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
23
- /**
24
- * The current application color scheme. It is always `undefined` on the server.
25
- */
26
- colorScheme: SupportedColorScheme | undefined;
27
- /**
28
- * `mode` is saved to internal state and localStorage
29
- * If `mode` is null, it will be reset to the defaultMode
30
- */
31
- setMode: (mode: Mode | null) => void;
32
- /**
33
- * `colorScheme` is saved to internal state and localStorage
34
- * If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
35
- */
36
- setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
37
- light: SupportedColorScheme | null;
38
- dark: SupportedColorScheme | null;
39
- }> | null) => void;
40
- };
41
- export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
42
- export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
43
- interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
44
- defaultLightColorScheme: SupportedColorScheme;
45
- defaultDarkColorScheme: SupportedColorScheme;
46
- supportedColorSchemes: Array<SupportedColorScheme>;
47
- defaultMode?: Mode;
48
- modeStorageKey?: string;
49
- colorSchemeStorageKey?: string;
50
- storageWindow?: Window | null;
51
- }
52
- export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
53
- export {};
1
+ export type Mode = 'light' | 'dark' | 'system';
2
+ export type SystemMode = Exclude<Mode, 'system'>;
3
+ export interface State<SupportedColorScheme extends string> {
4
+ /**
5
+ * User selected mode.
6
+ * Note: on the server, mode is always undefined
7
+ */
8
+ mode: Mode | undefined;
9
+ /**
10
+ * Only valid if `mode: 'system'`, either 'light' | 'dark'.
11
+ */
12
+ systemMode: SystemMode | undefined;
13
+ /**
14
+ * The color scheme for the light mode.
15
+ */
16
+ lightColorScheme: SupportedColorScheme;
17
+ /**
18
+ * The color scheme for the dark mode.
19
+ */
20
+ darkColorScheme: SupportedColorScheme;
21
+ }
22
+ export type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
23
+ /**
24
+ * The current application color scheme. It is always `undefined` on the server.
25
+ */
26
+ colorScheme: SupportedColorScheme | undefined;
27
+ /**
28
+ * `mode` is saved to internal state and localStorage
29
+ * If `mode` is null, it will be reset to the defaultMode
30
+ */
31
+ setMode: (mode: Mode | null) => void;
32
+ /**
33
+ * `colorScheme` is saved to internal state and localStorage
34
+ * If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
35
+ */
36
+ setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
37
+ light: SupportedColorScheme | null;
38
+ dark: SupportedColorScheme | null;
39
+ }> | null) => void;
40
+ };
41
+ export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
42
+ export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
43
+ interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
44
+ defaultLightColorScheme: SupportedColorScheme;
45
+ defaultDarkColorScheme: SupportedColorScheme;
46
+ supportedColorSchemes: Array<SupportedColorScheme>;
47
+ defaultMode?: Mode;
48
+ modeStorageKey?: string;
49
+ colorSchemeStorageKey?: string;
50
+ storageWindow?: Window | null;
51
+ }
52
+ export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
53
+ export {};
@@ -4,6 +4,7 @@ import createStack from './createStack';
4
4
  *
5
5
  * Demos:
6
6
  *
7
+ * - [Stack (Joy UI)](https://mui.com/joy-ui/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 {
@@ -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;
@@ -1,4 +1,5 @@
1
1
  import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
2
+ /* eslint-disable @typescript-eslint/naming-convention */
2
3
  /**
3
4
  * Returns a number whose value is limited to the given range.
4
5
  * @param {number} value The value to be clamped
@@ -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,4 +1,8 @@
1
1
  import { createUnarySpacing } from '../spacing';
2
+
3
+ // The different signatures imply different meaning for their arguments that can't be expressed structurally.
4
+ // We express the difference with variable names.
5
+ /* tslint:disable:unified-signatures */
2
6
  /* tslint:enable:unified-signatures */
3
7
 
4
8
  export default function createSpacing(spacingInput = 8) {
@@ -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.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -557,4 +557,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
557
557
  // eslint-disable-next-line @typescript-eslint/naming-convention
558
558
  function experimental_sx() {
559
559
  throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`experimental_sx\` has been moved to \`theme.unstable_sx\`.For more details, see https://github.com/mui/material-ui/pull/35150.` : (0, _utils.formatMuiErrorMessage)(20));
560
- }
560
+ }
561
+
562
+ /** ----------------- */
563
+ /** Layout components */
@@ -4,6 +4,7 @@ import createStack from './createStack';
4
4
  *
5
5
  * Demos:
6
6
  *
7
+ * - [Stack (Joy UI)](https://mui.com/joy-ui/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
  };
@@ -1,4 +1,5 @@
1
1
  import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
2
+ /* eslint-disable @typescript-eslint/naming-convention */
2
3
  /**
3
4
  * Returns a number whose value is limited to the given range.
4
5
  * @param {number} value The value to be clamped
@@ -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,4 +1,8 @@
1
1
  import { createUnarySpacing } from '../spacing';
2
+
3
+ // The different signatures imply different meaning for their arguments that can't be expressed structurally.
4
+ // We express the difference with variable names.
5
+ /* tslint:disable:unified-signatures */
2
6
  /* tslint:enable:unified-signatures */
3
7
 
4
8
  export default function createSpacing() {
@@ -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.3
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-ui/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.