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