@mui/system 5.9.3 → 5.10.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/Box/Box.spec.d.ts +1 -1
- package/CHANGELOG.md +179 -4
- 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/index.d.ts +1 -1
- package/README.md +1 -1
- package/Stack/Stack.d.ts +12 -0
- package/Stack/Stack.js +62 -0
- package/Stack/StackProps.d.ts +42 -0
- package/Stack/StackProps.js +5 -0
- package/Stack/createStack.d.ts +21 -0
- package/Stack/createStack.js +209 -0
- package/Stack/index.d.ts +5 -0
- package/Stack/index.js +65 -0
- package/Stack/package.json +6 -0
- package/Stack/stackClasses.d.ts +8 -0
- package/Stack/stackClasses.js +17 -0
- package/Unstable_Grid/Grid.d.ts +12 -12
- package/Unstable_Grid/GridProps.d.ts +162 -162
- package/Unstable_Grid/createGrid.d.ts +11 -11
- package/Unstable_Grid/gridClasses.d.ts +20 -20
- package/Unstable_Grid/gridGenerator.d.ts +26 -26
- package/Unstable_Grid/index.d.ts +5 -5
- package/breakpoints.d.ts +21 -0
- package/createBox.js +3 -1
- package/createBox.spec.d.ts +1 -1
- package/createStyled.js +30 -11
- package/createTheme/createSpacing.d.ts +10 -10
- package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/cssVarsParser.d.ts +65 -65
- package/cssVars/getInitColorSchemeScript.d.ts +45 -45
- package/cssVars/index.d.ts +3 -3
- package/cssVars/useCurrentColorScheme.d.ts +53 -53
- package/cssVars/useCurrentColorScheme.js +28 -18
- package/esm/Stack/Stack.js +51 -0
- package/esm/Stack/StackProps.js +1 -0
- package/esm/Stack/createStack.js +179 -0
- package/esm/Stack/index.js +5 -0
- package/esm/Stack/stackClasses.js +6 -0
- package/esm/createBox.js +3 -1
- package/esm/createStyled.js +28 -10
- package/esm/cssVars/useCurrentColorScheme.js +28 -18
- package/esm/index.js +3 -1
- package/index.d.ts +4 -6
- package/index.js +25 -2
- package/index.spec.d.ts +1 -1
- package/legacy/Stack/Stack.js +51 -0
- package/legacy/Stack/StackProps.js +1 -0
- package/legacy/Stack/createStack.js +187 -0
- package/legacy/Stack/index.js +5 -0
- package/legacy/Stack/stackClasses.js +6 -0
- package/legacy/createBox.js +5 -1
- package/legacy/createStyled.js +31 -10
- package/legacy/cssVars/useCurrentColorScheme.js +28 -18
- package/legacy/index.js +4 -2
- package/modern/Stack/Stack.js +51 -0
- package/modern/Stack/StackProps.js +1 -0
- package/modern/Stack/createStack.js +179 -0
- package/modern/Stack/index.js +5 -0
- package/modern/Stack/stackClasses.js +6 -0
- package/modern/createBox.js +3 -1
- package/modern/createStyled.js +28 -10
- package/modern/cssVars/useCurrentColorScheme.js +28 -18
- package/modern/index.js +4 -2
- package/package.json +3 -3
- package/spacing.d.ts +6 -0
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
package/modern/createStyled.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"],
|
|
4
4
|
_excluded2 = ["theme"],
|
|
5
5
|
_excluded3 = ["theme"];
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
/* eslint-disable no-underscore-dangle */
|
|
8
|
+
import styledEngineStyled, { internal_processStyles as processStyles } from '@mui/styled-engine';
|
|
7
9
|
import { getDisplayName } from '@mui/utils';
|
|
8
10
|
import createTheme from './createTheme';
|
|
9
11
|
import propsToClassKey from './propsToClassKey';
|
|
@@ -11,6 +13,14 @@ import defaultStyleFunctionSx from './styleFunctionSx';
|
|
|
11
13
|
|
|
12
14
|
function isEmpty(obj) {
|
|
13
15
|
return Object.keys(obj).length === 0;
|
|
16
|
+
} // https://github.com/emotion-js/emotion/blob/26ded6109fcd8ca9875cc2ce4564fee678a3f3c5/packages/styled/src/utils.js#L40
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
function isStringTag(tag) {
|
|
20
|
+
return typeof tag === 'string' && // 96 is one less than the char code
|
|
21
|
+
// for "a" so this is checking that
|
|
22
|
+
// it's a lowercase character
|
|
23
|
+
tag.charCodeAt(0) > 96;
|
|
14
24
|
}
|
|
15
25
|
|
|
16
26
|
const getStyleOverrides = (name, theme) => {
|
|
@@ -78,7 +88,19 @@ export default function createStyled(input = {}) {
|
|
|
78
88
|
slotShouldForwardProp = shouldForwardProp,
|
|
79
89
|
styleFunctionSx = defaultStyleFunctionSx
|
|
80
90
|
} = input;
|
|
91
|
+
|
|
92
|
+
const systemSx = props => {
|
|
93
|
+
const theme = isEmpty(props.theme) ? defaultTheme : props.theme;
|
|
94
|
+
return styleFunctionSx(_extends({}, props, {
|
|
95
|
+
theme
|
|
96
|
+
}));
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
systemSx.__mui_systemSx = true;
|
|
81
100
|
return (tag, inputOptions = {}) => {
|
|
101
|
+
// Filter out the `sx` style function from the previous styled component to prevent unnecessary styles generated by the composite components.
|
|
102
|
+
processStyles(tag, styles => styles.filter(style => !style?.__mui_systemSx));
|
|
103
|
+
|
|
82
104
|
const {
|
|
83
105
|
name: componentName,
|
|
84
106
|
slot: componentSlot,
|
|
@@ -106,6 +128,9 @@ export default function createStyled(input = {}) {
|
|
|
106
128
|
} else if (componentSlot) {
|
|
107
129
|
// any other slot specified
|
|
108
130
|
shouldForwardPropOption = slotShouldForwardProp;
|
|
131
|
+
} else if (isStringTag(tag)) {
|
|
132
|
+
// for string (html) tag, preserve the behavior in emotion & styled-components.
|
|
133
|
+
shouldForwardPropOption = undefined;
|
|
109
134
|
}
|
|
110
135
|
|
|
111
136
|
const defaultStyledResolver = styledEngineStyled(tag, _extends({
|
|
@@ -118,7 +143,6 @@ export default function createStyled(input = {}) {
|
|
|
118
143
|
// On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
119
144
|
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
120
145
|
// which are basically components used as a selectors.
|
|
121
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
122
146
|
return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? _ref => {
|
|
123
147
|
let {
|
|
124
148
|
theme: themeInput
|
|
@@ -159,12 +183,7 @@ export default function createStyled(input = {}) {
|
|
|
159
183
|
}
|
|
160
184
|
|
|
161
185
|
if (!skipSx) {
|
|
162
|
-
expressionsWithDefaultTheme.push(
|
|
163
|
-
const theme = isEmpty(props.theme) ? defaultTheme : props.theme;
|
|
164
|
-
return styleFunctionSx(_extends({}, props, {
|
|
165
|
-
theme
|
|
166
|
-
}));
|
|
167
|
-
});
|
|
186
|
+
expressionsWithDefaultTheme.push(systemSx);
|
|
168
187
|
}
|
|
169
188
|
|
|
170
189
|
const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length;
|
|
@@ -177,7 +196,6 @@ export default function createStyled(input = {}) {
|
|
|
177
196
|
} else if (typeof styleArg === 'function' && // On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
178
197
|
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
179
198
|
// which are basically components used as a selectors.
|
|
180
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
181
199
|
styleArg.__emotion_real !== styleArg) {
|
|
182
200
|
// If the type is function, we need to define the default theme.
|
|
183
201
|
transformedStyleArg = _ref2 => {
|
|
@@ -85,8 +85,9 @@ export default function useCurrentColorScheme(options) {
|
|
|
85
85
|
return currentState;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
try {
|
|
89
89
|
localStorage.setItem(modeStorageKey, newMode);
|
|
90
|
+
} catch (e) {// Unsupported
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
return _extends({}, currentState, {
|
|
@@ -111,7 +112,10 @@ export default function useCurrentColorScheme(options) {
|
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
processState(currentState, mode => {
|
|
114
|
-
|
|
115
|
+
try {
|
|
116
|
+
localStorage.setItem(`${colorSchemeStorageKey}-${mode}`, value);
|
|
117
|
+
} catch (e) {// Unsupported
|
|
118
|
+
}
|
|
115
119
|
|
|
116
120
|
if (mode === 'light') {
|
|
117
121
|
newState.lightColorScheme = value;
|
|
@@ -141,12 +145,15 @@ export default function useCurrentColorScheme(options) {
|
|
|
141
145
|
return newState;
|
|
142
146
|
});
|
|
143
147
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
try {
|
|
149
|
+
if (value.light) {
|
|
150
|
+
localStorage.setItem(`${colorSchemeStorageKey}-light`, value.light);
|
|
151
|
+
}
|
|
147
152
|
|
|
148
|
-
|
|
149
|
-
|
|
153
|
+
if (value.dark) {
|
|
154
|
+
localStorage.setItem(`${colorSchemeStorageKey}-dark`, value.dark);
|
|
155
|
+
}
|
|
156
|
+
} catch (e) {// Unsupported
|
|
150
157
|
}
|
|
151
158
|
}
|
|
152
159
|
}, [joinedColorSchemes, colorSchemeStorageKey, defaultLightColorScheme, defaultDarkColorScheme]);
|
|
@@ -172,19 +179,22 @@ export default function useCurrentColorScheme(options) {
|
|
|
172
179
|
}, []); // Save mode, lightColorScheme & darkColorScheme to localStorage
|
|
173
180
|
|
|
174
181
|
React.useEffect(() => {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
processState(state, mode => {
|
|
180
|
-
if (mode === 'light') {
|
|
181
|
-
localStorage.setItem(`${colorSchemeStorageKey}-light`, state.lightColorScheme);
|
|
182
|
+
try {
|
|
183
|
+
if (state.mode) {
|
|
184
|
+
localStorage.setItem(modeStorageKey, state.mode);
|
|
182
185
|
}
|
|
183
186
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
processState(state, mode => {
|
|
188
|
+
if (mode === 'light') {
|
|
189
|
+
localStorage.setItem(`${colorSchemeStorageKey}-light`, state.lightColorScheme);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (mode === 'dark') {
|
|
193
|
+
localStorage.setItem(`${colorSchemeStorageKey}-dark`, state.darkColorScheme);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
} catch (e) {// Unsupported
|
|
197
|
+
}
|
|
188
198
|
}, [state, colorSchemeStorageKey, modeStorageKey]); // Handle when localStorage has changed
|
|
189
199
|
|
|
190
200
|
React.useEffect(() => {
|
package/modern/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.10.2
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -53,4 +53,6 @@ export { default as createContainer } from './Container/createContainer';
|
|
|
53
53
|
export { default as Container } from './Container';
|
|
54
54
|
export * from './Container';
|
|
55
55
|
export { default as Unstable_Grid } from './Unstable_Grid/Grid';
|
|
56
|
-
export * from './Unstable_Grid';
|
|
56
|
+
export * from './Unstable_Grid';
|
|
57
|
+
export { default as Stack } from './Stack/Stack';
|
|
58
|
+
export * from './Stack';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "CSS utilities for rapidly laying out custom designs.",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/mui/material-ui/issues"
|
|
22
22
|
},
|
|
23
|
-
"homepage": "https://mui.com/system/
|
|
23
|
+
"homepage": "https://mui.com/system/getting-started/overview/",
|
|
24
24
|
"funding": {
|
|
25
25
|
"type": "opencollective",
|
|
26
26
|
"url": "https://opencollective.com/mui"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.17.2",
|
|
47
47
|
"@mui/private-theming": "^5.9.3",
|
|
48
|
-
"@mui/styled-engine": "^5.
|
|
48
|
+
"@mui/styled-engine": "^5.10.2",
|
|
49
49
|
"@mui/types": "^7.1.5",
|
|
50
50
|
"@mui/utils": "^5.9.3",
|
|
51
51
|
"clsx": "^1.2.1",
|
package/spacing.d.ts
CHANGED
|
@@ -58,4 +58,10 @@ export const padding: SimpleStyleFunction<
|
|
|
58
58
|
| 'paddingBlockEnd'
|
|
59
59
|
>;
|
|
60
60
|
|
|
61
|
+
export type SpacingValueType = string | number | null | undefined;
|
|
62
|
+
export function getValue(
|
|
63
|
+
transformer: (prop: SpacingValueType) => SpacingValueType,
|
|
64
|
+
propValue: SpacingValueType,
|
|
65
|
+
): SpacingValueType;
|
|
66
|
+
|
|
61
67
|
export type PaddingProps = PropsFor<typeof padding>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|