@mui/system 5.13.1 → 5.13.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.
- package/CHANGELOG.md +41 -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/Container/createContainer.js +35 -41
- package/GlobalStyles/GlobalStyles.d.ts +13 -13
- package/GlobalStyles/index.d.ts +2 -2
- package/Stack/Stack.d.ts +14 -14
- package/Stack/StackProps.d.ts +53 -53
- package/Stack/createStack.d.ts +21 -21
- package/Stack/createStack.js +26 -24
- package/Stack/index.d.ts +5 -5
- package/Stack/stackClasses.d.ts +8 -8
- package/ThemeProvider/ThemeProvider.js +5 -9
- package/Unstable_Grid/Grid.d.ts +12 -12
- package/Unstable_Grid/GridProps.d.ts +185 -185
- package/Unstable_Grid/createGrid.d.ts +11 -11
- package/Unstable_Grid/createGrid.js +23 -21
- package/Unstable_Grid/gridClasses.d.ts +20 -20
- package/Unstable_Grid/gridGenerator.d.ts +38 -38
- package/Unstable_Grid/gridGenerator.js +18 -20
- package/Unstable_Grid/index.d.ts +5 -5
- package/breakpoints.js +6 -7
- package/createBox.js +12 -9
- package/createStyled.js +32 -40
- package/createTheme/createBreakpoints.js +26 -24
- package/createTheme/createSpacing.d.ts +10 -10
- package/createTheme/createTheme.js +14 -18
- package/cssVars/createCssVarsProvider.js +20 -21
- package/cssVars/createCssVarsTheme.d.ts +15 -15
- package/cssVars/createCssVarsTheme.js +10 -10
- 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 -16
- package/cssVars/prepareCssVars.js +12 -13
- package/cssVars/useCurrentColorScheme.d.ts +53 -53
- package/cssVars/useCurrentColorScheme.js +11 -17
- package/esm/Container/createContainer.js +35 -41
- package/esm/Stack/createStack.js +26 -24
- package/esm/ThemeProvider/ThemeProvider.js +5 -9
- package/esm/Unstable_Grid/createGrid.js +23 -21
- package/esm/Unstable_Grid/gridGenerator.js +17 -20
- package/esm/breakpoints.js +6 -7
- package/esm/createBox.js +12 -9
- package/esm/createStyled.js +31 -38
- package/esm/createTheme/createBreakpoints.js +25 -24
- package/esm/createTheme/createTheme.js +14 -18
- package/esm/cssVars/createCssVarsProvider.js +20 -21
- package/esm/cssVars/createCssVarsTheme.js +10 -10
- package/esm/cssVars/prepareCssVars.js +12 -13
- package/esm/cssVars/useCurrentColorScheme.js +10 -17
- package/esm/propsToClassKey.js +5 -3
- package/esm/styleFunctionSx/extendSxProp.js +10 -14
- package/index.js +1 -1
- package/legacy/Container/createContainer.js +6 -7
- package/legacy/Stack/createStack.js +5 -6
- package/legacy/ThemeProvider/ThemeProvider.js +3 -4
- package/legacy/Unstable_Grid/createGrid.js +4 -6
- package/legacy/Unstable_Grid/gridGenerator.js +4 -6
- package/legacy/breakpoints.js +3 -5
- package/legacy/createBox.js +2 -4
- package/legacy/createStyled.js +11 -13
- package/legacy/createTheme/createBreakpoints.js +3 -4
- package/legacy/createTheme/createTheme.js +4 -6
- package/legacy/cssVars/createCssVarsProvider.js +5 -6
- package/legacy/cssVars/createCssVarsTheme.js +2 -4
- package/legacy/cssVars/prepareCssVars.js +3 -5
- package/legacy/cssVars/useCurrentColorScheme.js +7 -9
- package/legacy/index.js +1 -1
- package/legacy/styleFunctionSx/extendSxProp.js +4 -6
- package/modern/Container/createContainer.js +35 -41
- package/modern/Stack/createStack.js +26 -24
- package/modern/ThemeProvider/ThemeProvider.js +5 -9
- package/modern/Unstable_Grid/createGrid.js +23 -21
- package/modern/Unstable_Grid/gridGenerator.js +17 -20
- package/modern/breakpoints.js +6 -7
- package/modern/createBox.js +12 -9
- package/modern/createStyled.js +31 -38
- package/modern/createTheme/createBreakpoints.js +25 -24
- package/modern/createTheme/createTheme.js +14 -18
- package/modern/cssVars/createCssVarsProvider.js +20 -21
- package/modern/cssVars/createCssVarsTheme.js +10 -10
- package/modern/cssVars/prepareCssVars.js +12 -13
- package/modern/cssVars/useCurrentColorScheme.js +10 -17
- package/modern/index.js +1 -1
- package/modern/propsToClassKey.js +5 -3
- package/modern/styleFunctionSx/extendSxProp.js +10 -14
- package/package.json +2 -2
- package/propsToClassKey.js +6 -3
- package/styleFunctionSx/extendSxProp.js +10 -14
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { DEFAULT_MODE_STORAGE_KEY, DEFAULT_COLOR_SCHEME_STORAGE_KEY } from './getInitColorSchemeScript';
|
|
3
4
|
export function getSystemMode(mode) {
|
|
@@ -81,11 +82,10 @@ export default function useCurrentColorScheme(options) {
|
|
|
81
82
|
} catch (e) {
|
|
82
83
|
// Unsupported
|
|
83
84
|
}
|
|
84
|
-
return {
|
|
85
|
-
...currentState,
|
|
85
|
+
return _extends({}, currentState, {
|
|
86
86
|
mode: newMode,
|
|
87
87
|
systemMode: getSystemMode(newMode)
|
|
88
|
-
};
|
|
88
|
+
});
|
|
89
89
|
});
|
|
90
90
|
}, [modeStorageKey, defaultMode]);
|
|
91
91
|
const setColorScheme = React.useCallback(value => {
|
|
@@ -97,20 +97,17 @@ export default function useCurrentColorScheme(options) {
|
|
|
97
97
|
} catch (e) {
|
|
98
98
|
// Unsupported
|
|
99
99
|
}
|
|
100
|
-
return {
|
|
101
|
-
...currentState,
|
|
100
|
+
return _extends({}, currentState, {
|
|
102
101
|
lightColorScheme: defaultLightColorScheme,
|
|
103
102
|
darkColorScheme: defaultDarkColorScheme
|
|
104
|
-
};
|
|
103
|
+
});
|
|
105
104
|
});
|
|
106
105
|
} else if (typeof value === 'string') {
|
|
107
106
|
if (value && !joinedColorSchemes.includes(value)) {
|
|
108
107
|
console.error(`\`${value}\` does not exist in \`theme.colorSchemes\`.`);
|
|
109
108
|
} else {
|
|
110
109
|
setState(currentState => {
|
|
111
|
-
const newState = {
|
|
112
|
-
...currentState
|
|
113
|
-
};
|
|
110
|
+
const newState = _extends({}, currentState);
|
|
114
111
|
processState(currentState, mode => {
|
|
115
112
|
try {
|
|
116
113
|
localStorage.setItem(`${colorSchemeStorageKey}-${mode}`, value);
|
|
@@ -129,9 +126,7 @@ export default function useCurrentColorScheme(options) {
|
|
|
129
126
|
}
|
|
130
127
|
} else {
|
|
131
128
|
setState(currentState => {
|
|
132
|
-
const newState = {
|
|
133
|
-
...currentState
|
|
134
|
-
};
|
|
129
|
+
const newState = _extends({}, currentState);
|
|
135
130
|
const newLightColorScheme = value.light === null ? defaultLightColorScheme : value.light;
|
|
136
131
|
const newDarkColorScheme = value.dark === null ? defaultDarkColorScheme : value.dark;
|
|
137
132
|
if (newLightColorScheme) {
|
|
@@ -164,8 +159,7 @@ export default function useCurrentColorScheme(options) {
|
|
|
164
159
|
}, [joinedColorSchemes, colorSchemeStorageKey, defaultLightColorScheme, defaultDarkColorScheme]);
|
|
165
160
|
const handleMediaQuery = React.useCallback(e => {
|
|
166
161
|
if (state.mode === 'system') {
|
|
167
|
-
setState(currentState => ({
|
|
168
|
-
...currentState,
|
|
162
|
+
setState(currentState => _extends({}, currentState, {
|
|
169
163
|
systemMode: e?.matches ? 'dark' : 'light'
|
|
170
164
|
}));
|
|
171
165
|
}
|
|
@@ -214,10 +208,9 @@ export default function useCurrentColorScheme(options) {
|
|
|
214
208
|
}
|
|
215
209
|
return undefined;
|
|
216
210
|
}, [setColorScheme, setMode, modeStorageKey, colorSchemeStorageKey, joinedColorSchemes, defaultMode, storageWindow]);
|
|
217
|
-
return {
|
|
218
|
-
...state,
|
|
211
|
+
return _extends({}, state, {
|
|
219
212
|
colorScheme,
|
|
220
213
|
setMode,
|
|
221
214
|
setColorScheme
|
|
222
|
-
};
|
|
215
|
+
});
|
|
223
216
|
}
|
package/modern/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
const _excluded = ["variant"];
|
|
1
3
|
import { unstable_capitalize as capitalize } from '@mui/utils';
|
|
2
4
|
function isEmpty(string) {
|
|
3
5
|
return string.length === 0;
|
|
@@ -10,9 +12,9 @@ function isEmpty(string) {
|
|
|
10
12
|
*/
|
|
11
13
|
export default function propsToClassKey(props) {
|
|
12
14
|
const {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
variant
|
|
16
|
+
} = props,
|
|
17
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
16
18
|
let classKey = variant || '';
|
|
17
19
|
Object.keys(other).sort().forEach(key => {
|
|
18
20
|
if (key === 'color') {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["sx"];
|
|
1
4
|
import { isPlainObject } from '@mui/utils';
|
|
2
5
|
import defaultSxConfig from './defaultSxConfig';
|
|
3
6
|
const splitProps = props => {
|
|
@@ -17,9 +20,9 @@ const splitProps = props => {
|
|
|
17
20
|
};
|
|
18
21
|
export default function extendSxProp(props) {
|
|
19
22
|
const {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
sx: inSx
|
|
24
|
+
} = props,
|
|
25
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
23
26
|
const {
|
|
24
27
|
systemProps,
|
|
25
28
|
otherProps
|
|
@@ -33,19 +36,12 @@ export default function extendSxProp(props) {
|
|
|
33
36
|
if (!isPlainObject(result)) {
|
|
34
37
|
return systemProps;
|
|
35
38
|
}
|
|
36
|
-
return {
|
|
37
|
-
...systemProps,
|
|
38
|
-
...result
|
|
39
|
-
};
|
|
39
|
+
return _extends({}, systemProps, result);
|
|
40
40
|
};
|
|
41
41
|
} else {
|
|
42
|
-
finalSx = {
|
|
43
|
-
...systemProps,
|
|
44
|
-
...inSx
|
|
45
|
-
};
|
|
42
|
+
finalSx = _extends({}, systemProps, inSx);
|
|
46
43
|
}
|
|
47
|
-
return {
|
|
48
|
-
...otherProps,
|
|
44
|
+
return _extends({}, otherProps, {
|
|
49
45
|
sx: finalSx
|
|
50
|
-
};
|
|
46
|
+
});
|
|
51
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.13.
|
|
3
|
+
"version": "5.13.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "CSS utilities for rapidly laying out custom designs.",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.21.0",
|
|
47
47
|
"@mui/private-theming": "^5.13.1",
|
|
48
|
-
"@mui/styled-engine": "^5.
|
|
48
|
+
"@mui/styled-engine": "^5.13.2",
|
|
49
49
|
"@mui/types": "^7.2.4",
|
|
50
50
|
"@mui/utils": "^5.13.1",
|
|
51
51
|
"clsx": "^1.2.1",
|
package/propsToClassKey.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = propsToClassKey;
|
|
8
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
7
9
|
var _utils = require("@mui/utils");
|
|
10
|
+
const _excluded = ["variant"];
|
|
8
11
|
function isEmpty(string) {
|
|
9
12
|
return string.length === 0;
|
|
10
13
|
}
|
|
@@ -16,9 +19,9 @@ function isEmpty(string) {
|
|
|
16
19
|
*/
|
|
17
20
|
function propsToClassKey(props) {
|
|
18
21
|
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
variant
|
|
23
|
+
} = props,
|
|
24
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
22
25
|
let classKey = variant || '';
|
|
23
26
|
Object.keys(other).sort().forEach(key => {
|
|
24
27
|
if (key === 'color') {
|
|
@@ -5,8 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = extendSxProp;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
10
|
var _utils = require("@mui/utils");
|
|
9
11
|
var _defaultSxConfig = _interopRequireDefault(require("./defaultSxConfig"));
|
|
12
|
+
const _excluded = ["sx"];
|
|
10
13
|
const splitProps = props => {
|
|
11
14
|
var _props$theme$unstable, _props$theme;
|
|
12
15
|
const result = {
|
|
@@ -25,9 +28,9 @@ const splitProps = props => {
|
|
|
25
28
|
};
|
|
26
29
|
function extendSxProp(props) {
|
|
27
30
|
const {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
sx: inSx
|
|
32
|
+
} = props,
|
|
33
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
31
34
|
const {
|
|
32
35
|
systemProps,
|
|
33
36
|
otherProps
|
|
@@ -41,19 +44,12 @@ function extendSxProp(props) {
|
|
|
41
44
|
if (!(0, _utils.isPlainObject)(result)) {
|
|
42
45
|
return systemProps;
|
|
43
46
|
}
|
|
44
|
-
return {
|
|
45
|
-
...systemProps,
|
|
46
|
-
...result
|
|
47
|
-
};
|
|
47
|
+
return (0, _extends2.default)({}, systemProps, result);
|
|
48
48
|
};
|
|
49
49
|
} else {
|
|
50
|
-
finalSx = {
|
|
51
|
-
...systemProps,
|
|
52
|
-
...inSx
|
|
53
|
-
};
|
|
50
|
+
finalSx = (0, _extends2.default)({}, systemProps, inSx);
|
|
54
51
|
}
|
|
55
|
-
return {
|
|
56
|
-
...otherProps,
|
|
52
|
+
return (0, _extends2.default)({}, otherProps, {
|
|
57
53
|
sx: finalSx
|
|
58
|
-
};
|
|
54
|
+
});
|
|
59
55
|
}
|