@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.
- package/CHANGELOG.md +262 -0
- package/Container/Container.d.ts +13 -13
- package/Container/ContainerProps.d.ts +40 -40
- package/Container/containerClasses.d.ts +22 -22
- package/Container/createContainer.d.ts +18 -18
- package/GlobalStyles/GlobalStyles.d.ts +13 -13
- package/GlobalStyles/index.d.ts +2 -2
- package/Stack/Stack.d.ts +14 -13
- package/Stack/Stack.js +2 -1
- package/Stack/StackProps.d.ts +53 -53
- package/Stack/createStack.d.ts +21 -21
- package/Stack/index.d.ts +5 -5
- package/Stack/stackClasses.d.ts +8 -8
- package/Unstable_Grid/Grid.d.ts +12 -12
- package/Unstable_Grid/GridProps.d.ts +185 -173
- package/Unstable_Grid/createGrid.d.ts +11 -11
- package/Unstable_Grid/createGrid.js +18 -11
- package/Unstable_Grid/gridClasses.d.ts +20 -20
- package/Unstable_Grid/gridGenerator.d.ts +38 -38
- package/Unstable_Grid/gridGenerator.js +12 -12
- package/Unstable_Grid/index.d.ts +5 -5
- package/colorManipulator.js +2 -0
- package/createStyled.js +4 -0
- package/createTheme/createSpacing.d.ts +10 -10
- package/createTheme/createSpacing.js +3 -1
- package/cssVars/createCssVarsTheme.d.ts +15 -13
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/cssVarsParser.d.ts +64 -64
- package/cssVars/getInitColorSchemeScript.d.ts +42 -42
- package/cssVars/index.d.ts +5 -5
- package/cssVars/prepareCssVars.d.ts +16 -14
- package/cssVars/prepareCssVars.js +6 -2
- package/cssVars/useCurrentColorScheme.d.ts +53 -53
- package/esm/Stack/Stack.js +2 -1
- package/esm/Unstable_Grid/createGrid.js +19 -12
- package/esm/Unstable_Grid/gridGenerator.js +12 -12
- package/esm/colorManipulator.js +1 -0
- package/esm/createStyled.js +3 -0
- package/esm/createTheme/createSpacing.js +4 -0
- package/esm/cssVars/prepareCssVars.js +6 -2
- package/index.js +5 -2
- package/legacy/Stack/Stack.js +2 -1
- package/legacy/Unstable_Grid/createGrid.js +19 -11
- package/legacy/Unstable_Grid/gridGenerator.js +12 -12
- package/legacy/colorManipulator.js +1 -0
- package/legacy/createStyled.js +3 -0
- package/legacy/createTheme/createSpacing.js +4 -0
- package/legacy/cssVars/prepareCssVars.js +6 -2
- package/legacy/index.js +1 -1
- package/modern/Stack/Stack.js +2 -1
- package/modern/Unstable_Grid/createGrid.js +18 -12
- package/modern/Unstable_Grid/gridGenerator.js +12 -12
- package/modern/colorManipulator.js +1 -0
- package/modern/createStyled.js +3 -0
- package/modern/createTheme/createSpacing.js +4 -0
- package/modern/cssVars/prepareCssVars.js +6 -2
- package/modern/index.js +1 -1
- package/package.json +4 -4
|
@@ -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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
18
|
+
if (ownerState.unstable_level === 0) {
|
|
19
19
|
return `var(--Grid-${axis}Spacing)`;
|
|
20
20
|
}
|
|
21
|
-
return `var(--Grid-${axis}Spacing${appendLevel(ownerState.
|
|
21
|
+
return `var(--Grid-${axis}Spacing${appendLevel(ownerState.unstable_level - 1)})`;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
function getParentColumns(ownerState) {
|
|
25
|
-
if (ownerState.
|
|
25
|
+
if (ownerState.unstable_level === 0) {
|
|
26
26
|
return `var(--Grid-columns)`;
|
|
27
27
|
}
|
|
28
|
-
return `var(--Grid-columns${appendLevel(ownerState.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
182
|
+
[`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value : theme.spacing?.(value)
|
|
183
183
|
});
|
|
184
184
|
});
|
|
185
185
|
return styles;
|
package/modern/createStyled.js
CHANGED
|
@@ -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
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "CSS utilities for rapidly laying out custom designs.",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.21.0",
|
|
47
|
-
"@mui/private-theming": "^5.12.
|
|
48
|
-
"@mui/styled-engine": "^5.12.
|
|
47
|
+
"@mui/private-theming": "^5.12.3",
|
|
48
|
+
"@mui/styled-engine": "^5.12.3",
|
|
49
49
|
"@mui/types": "^7.2.4",
|
|
50
|
-
"@mui/utils": "^5.12.
|
|
50
|
+
"@mui/utils": "^5.12.3",
|
|
51
51
|
"clsx": "^1.2.1",
|
|
52
52
|
"csstype": "^3.1.2",
|
|
53
53
|
"prop-types": "^15.8.1"
|