@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,6 +1,3 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["values", "unit", "step"];
|
|
4
1
|
// Sorted ASC by size. That's important.
|
|
5
2
|
// It can't be configured as it's used statically for propTypes.
|
|
6
3
|
export const breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
@@ -12,33 +9,34 @@ const sortBreakpointsValues = values => {
|
|
|
12
9
|
// Sort in ascending order
|
|
13
10
|
breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
|
|
14
11
|
return breakpointsAsArray.reduce((acc, obj) => {
|
|
15
|
-
return
|
|
12
|
+
return {
|
|
13
|
+
...acc,
|
|
16
14
|
[obj.key]: obj.val
|
|
17
|
-
}
|
|
15
|
+
};
|
|
18
16
|
}, {});
|
|
19
17
|
};
|
|
20
18
|
|
|
21
19
|
// Keep in mind that @media is inclusive by the CSS specification.
|
|
22
20
|
export default function createBreakpoints(breakpoints) {
|
|
23
21
|
const {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
// The breakpoint **start** at this value.
|
|
23
|
+
// For instance with the first breakpoint xs: [xs, sm).
|
|
24
|
+
values = {
|
|
25
|
+
xs: 0,
|
|
26
|
+
// phone
|
|
27
|
+
sm: 600,
|
|
28
|
+
// tablet
|
|
29
|
+
md: 900,
|
|
30
|
+
// small laptop
|
|
31
|
+
lg: 1200,
|
|
32
|
+
// desktop
|
|
33
|
+
xl: 1536 // large screen
|
|
34
|
+
},
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
unit = 'px',
|
|
37
|
+
step = 5,
|
|
38
|
+
...other
|
|
39
|
+
} = breakpoints;
|
|
42
40
|
const sortedValues = sortBreakpointsValues(values);
|
|
43
41
|
const keys = Object.keys(sortedValues);
|
|
44
42
|
function up(key) {
|
|
@@ -70,7 +68,7 @@ export default function createBreakpoints(breakpoints) {
|
|
|
70
68
|
}
|
|
71
69
|
return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
|
|
72
70
|
}
|
|
73
|
-
return
|
|
71
|
+
return {
|
|
74
72
|
keys,
|
|
75
73
|
values: sortedValues,
|
|
76
74
|
up,
|
|
@@ -78,6 +76,7 @@ export default function createBreakpoints(breakpoints) {
|
|
|
78
76
|
between,
|
|
79
77
|
only,
|
|
80
78
|
not,
|
|
81
|
-
unit
|
|
82
|
-
|
|
79
|
+
unit,
|
|
80
|
+
...other
|
|
81
|
+
};
|
|
83
82
|
}
|
|
@@ -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 = ["breakpoints", "palette", "spacing", "shape"];
|
|
4
1
|
import { deepmerge } from '@mui/utils';
|
|
5
2
|
import createBreakpoints from './createBreakpoints';
|
|
6
3
|
import shape from './shape';
|
|
@@ -9,12 +6,12 @@ import styleFunctionSx from '../styleFunctionSx/styleFunctionSx';
|
|
|
9
6
|
import defaultSxConfig from '../styleFunctionSx/defaultSxConfig';
|
|
10
7
|
function createTheme(options = {}, ...args) {
|
|
11
8
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
breakpoints: breakpointsInput = {},
|
|
10
|
+
palette: paletteInput = {},
|
|
11
|
+
spacing: spacingInput,
|
|
12
|
+
shape: shapeInput = {},
|
|
13
|
+
...other
|
|
14
|
+
} = options;
|
|
18
15
|
const breakpoints = createBreakpoints(breakpointsInput);
|
|
19
16
|
const spacing = createSpacing(spacingInput);
|
|
20
17
|
let muiTheme = deepmerge({
|
|
@@ -22,14 +19,21 @@ function createTheme(options = {}, ...args) {
|
|
|
22
19
|
direction: 'ltr',
|
|
23
20
|
components: {},
|
|
24
21
|
// Inject component definitions.
|
|
25
|
-
palette:
|
|
26
|
-
mode: 'light'
|
|
27
|
-
|
|
22
|
+
palette: {
|
|
23
|
+
mode: 'light',
|
|
24
|
+
...paletteInput
|
|
25
|
+
},
|
|
28
26
|
spacing,
|
|
29
|
-
shape:
|
|
27
|
+
shape: {
|
|
28
|
+
...shape,
|
|
29
|
+
...shapeInput
|
|
30
|
+
}
|
|
30
31
|
}, other);
|
|
31
32
|
muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
|
|
32
|
-
muiTheme.unstable_sxConfig =
|
|
33
|
+
muiTheme.unstable_sxConfig = {
|
|
34
|
+
...defaultSxConfig,
|
|
35
|
+
...(other == null ? void 0 : other.unstable_sxConfig)
|
|
36
|
+
};
|
|
33
37
|
muiTheme.unstable_sx = function sx(props) {
|
|
34
38
|
return styleFunctionSx({
|
|
35
39
|
sx: props,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
1
|
import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
|
|
4
|
-
const _excluded = ["colorSchemes", "components", "generateCssVars", "cssVarPrefix"];
|
|
5
2
|
import * as React from 'react';
|
|
6
3
|
import PropTypes from 'prop-types';
|
|
7
4
|
import { deepmerge } from '@mui/utils';
|
|
@@ -58,17 +55,16 @@ export default function createCssVarsProvider(options) {
|
|
|
58
55
|
const ctx = React.useContext(ColorSchemeContext);
|
|
59
56
|
const nested = !!ctx && !disableNestedContext;
|
|
60
57
|
const scopedTheme = themeProp[themeId];
|
|
61
|
-
const
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
restThemeProp = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
58
|
+
const {
|
|
59
|
+
colorSchemes = {},
|
|
60
|
+
components = {},
|
|
61
|
+
generateCssVars = () => ({
|
|
62
|
+
vars: {},
|
|
63
|
+
css: {}
|
|
64
|
+
}),
|
|
65
|
+
cssVarPrefix,
|
|
66
|
+
...restThemeProp
|
|
67
|
+
} = scopedTheme || themeProp;
|
|
72
68
|
const allColorSchemes = Object.keys(colorSchemes);
|
|
73
69
|
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
74
70
|
const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
|
|
@@ -126,13 +122,14 @@ export default function createCssVarsProvider(options) {
|
|
|
126
122
|
} = generateCssVars();
|
|
127
123
|
|
|
128
124
|
// 3. Start composing the theme object
|
|
129
|
-
const theme =
|
|
125
|
+
const theme = {
|
|
126
|
+
...restThemeProp,
|
|
130
127
|
components,
|
|
131
128
|
colorSchemes,
|
|
132
129
|
cssVarPrefix,
|
|
133
130
|
vars: rootVars,
|
|
134
131
|
getColorSchemeSelector: targetColorScheme => `[${attribute}="${targetColorScheme}"] &`
|
|
135
|
-
}
|
|
132
|
+
};
|
|
136
133
|
|
|
137
134
|
// 4. Create color CSS variables and store them in objects (to be generated in stylesheets in the final step)
|
|
138
135
|
// The default color scheme stylesheet is constructed to have the least CSS specificity.
|
|
@@ -150,7 +147,10 @@ export default function createCssVarsProvider(options) {
|
|
|
150
147
|
Object.keys(scheme).forEach(schemeKey => {
|
|
151
148
|
if (scheme[schemeKey] && typeof scheme[schemeKey] === 'object') {
|
|
152
149
|
// shallow merge the 1st level structure of the theme.
|
|
153
|
-
theme[schemeKey] =
|
|
150
|
+
theme[schemeKey] = {
|
|
151
|
+
...theme[schemeKey],
|
|
152
|
+
...scheme[schemeKey]
|
|
153
|
+
};
|
|
154
154
|
} else {
|
|
155
155
|
theme[schemeKey] = scheme[schemeKey];
|
|
156
156
|
}
|
|
@@ -320,14 +320,15 @@ export default function createCssVarsProvider(options) {
|
|
|
320
320
|
} : void 0;
|
|
321
321
|
const defaultLightColorScheme = typeof designSystemColorScheme === 'string' ? designSystemColorScheme : designSystemColorScheme.light;
|
|
322
322
|
const defaultDarkColorScheme = typeof designSystemColorScheme === 'string' ? designSystemColorScheme : designSystemColorScheme.dark;
|
|
323
|
-
const getInitColorSchemeScript = params => systemGetInitColorSchemeScript(
|
|
323
|
+
const getInitColorSchemeScript = params => systemGetInitColorSchemeScript({
|
|
324
324
|
attribute: defaultAttribute,
|
|
325
325
|
colorSchemeStorageKey: defaultColorSchemeStorageKey,
|
|
326
326
|
defaultMode: designSystemMode,
|
|
327
327
|
defaultLightColorScheme,
|
|
328
328
|
defaultDarkColorScheme,
|
|
329
|
-
modeStorageKey: defaultModeStorageKey
|
|
330
|
-
|
|
329
|
+
modeStorageKey: defaultModeStorageKey,
|
|
330
|
+
...params
|
|
331
|
+
});
|
|
331
332
|
return {
|
|
332
333
|
CssVarsProvider,
|
|
333
334
|
useColorScheme,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["cssVarPrefix", "shouldSkipGeneratingVar"];
|
|
4
1
|
import prepareCssVars from './prepareCssVars';
|
|
5
2
|
function createCssVarsTheme(theme) {
|
|
6
3
|
const {
|
|
7
|
-
|
|
4
|
+
cssVarPrefix,
|
|
5
|
+
shouldSkipGeneratingVar,
|
|
6
|
+
...otherTheme
|
|
7
|
+
} = theme;
|
|
8
|
+
return {
|
|
9
|
+
...theme,
|
|
10
|
+
...prepareCssVars(otherTheme, {
|
|
11
|
+
prefix: cssVarPrefix,
|
|
8
12
|
shouldSkipGeneratingVar
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return _extends({}, theme, prepareCssVars(otherTheme, {
|
|
12
|
-
prefix: cssVarPrefix,
|
|
13
|
-
shouldSkipGeneratingVar
|
|
14
|
-
}));
|
|
13
|
+
})
|
|
14
|
+
};
|
|
15
15
|
}
|
|
16
16
|
export default createCssVarsTheme;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["colorSchemes", "components"],
|
|
4
|
-
_excluded2 = ["light"];
|
|
5
1
|
import { deepmerge } from '@mui/utils';
|
|
6
2
|
import cssVarsParser from './cssVarsParser';
|
|
7
3
|
function prepareCssVars(theme, parserConfig) {
|
|
8
4
|
// @ts-ignore - ignore components do not exist
|
|
9
5
|
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
otherTheme
|
|
6
|
+
colorSchemes = {},
|
|
7
|
+
components,
|
|
8
|
+
...otherTheme
|
|
9
|
+
} = theme;
|
|
13
10
|
const {
|
|
14
11
|
vars: rootVars,
|
|
15
12
|
css: rootCss,
|
|
@@ -18,9 +15,9 @@ function prepareCssVars(theme, parserConfig) {
|
|
|
18
15
|
let themeVars = rootVarsWithDefaults;
|
|
19
16
|
const colorSchemesMap = {};
|
|
20
17
|
const {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
light,
|
|
19
|
+
...otherColorSchemes
|
|
20
|
+
} = colorSchemes;
|
|
24
21
|
Object.entries(otherColorSchemes || {}).forEach(([key, scheme]) => {
|
|
25
22
|
const {
|
|
26
23
|
vars,
|
|
@@ -49,12 +46,16 @@ function prepareCssVars(theme, parserConfig) {
|
|
|
49
46
|
const generateCssVars = colorScheme => {
|
|
50
47
|
if (!colorScheme) {
|
|
51
48
|
return {
|
|
52
|
-
css:
|
|
49
|
+
css: {
|
|
50
|
+
...rootCss
|
|
51
|
+
},
|
|
53
52
|
vars: rootVars
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
55
|
return {
|
|
57
|
-
css:
|
|
56
|
+
css: {
|
|
57
|
+
...colorSchemesMap[colorScheme].css
|
|
58
|
+
},
|
|
58
59
|
vars: colorSchemesMap[colorScheme].vars
|
|
59
60
|
};
|
|
60
61
|
};
|
|
@@ -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 != null && 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/esm/propsToClassKey.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 => {
|
|
@@ -21,9 +18,9 @@ const splitProps = props => {
|
|
|
21
18
|
};
|
|
22
19
|
export default function extendSxProp(props) {
|
|
23
20
|
const {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
sx: inSx,
|
|
22
|
+
...other
|
|
23
|
+
} = props;
|
|
27
24
|
const {
|
|
28
25
|
systemProps,
|
|
29
26
|
otherProps
|
|
@@ -37,12 +34,19 @@ export default function extendSxProp(props) {
|
|
|
37
34
|
if (!isPlainObject(result)) {
|
|
38
35
|
return systemProps;
|
|
39
36
|
}
|
|
40
|
-
return
|
|
37
|
+
return {
|
|
38
|
+
...systemProps,
|
|
39
|
+
...result
|
|
40
|
+
};
|
|
41
41
|
};
|
|
42
42
|
} else {
|
|
43
|
-
finalSx =
|
|
43
|
+
finalSx = {
|
|
44
|
+
...systemProps,
|
|
45
|
+
...inSx
|
|
46
|
+
};
|
|
44
47
|
}
|
|
45
|
-
return
|
|
48
|
+
return {
|
|
49
|
+
...otherProps,
|
|
46
50
|
sx: finalSx
|
|
47
|
-
}
|
|
51
|
+
};
|
|
48
52
|
}
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import clsx from 'clsx';
|
|
@@ -49,7 +50,7 @@ export default function createContainer() {
|
|
|
49
50
|
var ContainerRoot = createStyledComponent(function (_ref) {
|
|
50
51
|
var theme = _ref.theme,
|
|
51
52
|
ownerState = _ref.ownerState;
|
|
52
|
-
return
|
|
53
|
+
return _objectSpread({
|
|
53
54
|
width: '100%',
|
|
54
55
|
marginLeft: 'auto',
|
|
55
56
|
boxSizing: 'border-box',
|
|
@@ -79,10 +80,10 @@ export default function createContainer() {
|
|
|
79
80
|
}, function (_ref4) {
|
|
80
81
|
var theme = _ref4.theme,
|
|
81
82
|
ownerState = _ref4.ownerState;
|
|
82
|
-
return
|
|
83
|
+
return _objectSpread(_objectSpread({}, ownerState.maxWidth === 'xs' && _defineProperty({}, theme.breakpoints.up('xs'), {
|
|
83
84
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
84
85
|
maxWidth: Math.max(theme.breakpoints.values.xs, 444)
|
|
85
|
-
}), ownerState.maxWidth &&
|
|
86
|
+
})), ownerState.maxWidth &&
|
|
86
87
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
87
88
|
ownerState.maxWidth !== 'xs' && _defineProperty({}, theme.breakpoints.up(ownerState.maxWidth), {
|
|
88
89
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
@@ -102,7 +103,7 @@ export default function createContainer() {
|
|
|
102
103
|
maxWidth = _props$maxWidth === void 0 ? 'lg' : _props$maxWidth,
|
|
103
104
|
classesProp = props.classes,
|
|
104
105
|
other = _objectWithoutProperties(props, ["className", "component", "disableGutters", "fixed", "maxWidth", "classes"]);
|
|
105
|
-
var ownerState =
|
|
106
|
+
var ownerState = _objectSpread(_objectSpread({}, props), {}, {
|
|
106
107
|
component: component,
|
|
107
108
|
disableGutters: disableGutters,
|
|
108
109
|
fixed: fixed,
|
|
@@ -114,7 +115,7 @@ export default function createContainer() {
|
|
|
114
115
|
return (
|
|
115
116
|
/*#__PURE__*/
|
|
116
117
|
// @ts-ignore theme is injected by the styled util
|
|
117
|
-
_jsx(ContainerRoot,
|
|
118
|
+
_jsx(ContainerRoot, _objectSpread({
|
|
118
119
|
as: component
|
|
119
120
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
120
121
|
,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
|
-
import
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
8
|
import clsx from 'clsx';
|
|
@@ -60,7 +61,7 @@ var getSideFromDirection = function getSideFromDirection(direction) {
|
|
|
60
61
|
export var style = function style(_ref) {
|
|
61
62
|
var ownerState = _ref.ownerState,
|
|
62
63
|
theme = _ref.theme;
|
|
63
|
-
var styles =
|
|
64
|
+
var styles = _objectSpread({
|
|
64
65
|
display: 'flex',
|
|
65
66
|
flexDirection: 'column'
|
|
66
67
|
}, handleBreakpoints({
|
|
@@ -155,12 +156,12 @@ export default function createStack() {
|
|
|
155
156
|
useFlexGap: useFlexGap
|
|
156
157
|
};
|
|
157
158
|
var classes = useUtilityClasses();
|
|
158
|
-
return /*#__PURE__*/_jsx(StackRoot,
|
|
159
|
+
return /*#__PURE__*/_jsx(StackRoot, _objectSpread(_objectSpread({
|
|
159
160
|
as: component,
|
|
160
161
|
ownerState: ownerState,
|
|
161
162
|
ref: ref,
|
|
162
163
|
className: clsx(classes.root, className)
|
|
163
|
-
}, other, {
|
|
164
|
+
}, other), {}, {
|
|
164
165
|
children: divider ? joinChildren(children, divider) : children
|
|
165
166
|
}));
|
|
166
167
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
6
|
import { ThemeProvider as MuiThemeProvider, useTheme as usePrivateTheme } from '@mui/private-theming';
|
|
@@ -14,7 +15,7 @@ function useThemeScoping(themeId, upperTheme, localTheme) {
|
|
|
14
15
|
var resolvedTheme = themeId ? upperTheme[themeId] || upperTheme : upperTheme;
|
|
15
16
|
if (typeof localTheme === 'function') {
|
|
16
17
|
var mergedTheme = localTheme(resolvedTheme);
|
|
17
|
-
var result = themeId ?
|
|
18
|
+
var result = themeId ? _objectSpread(_objectSpread({}, upperTheme), {}, _defineProperty({}, themeId, mergedTheme)) : mergedTheme;
|
|
18
19
|
// must return a function for the private theme to NOT merge with the upper theme.
|
|
19
20
|
// see the test case "use provided theme from a callback" in ThemeProvider.test.js
|
|
20
21
|
if (isPrivate) {
|
|
@@ -24,7 +25,7 @@ function useThemeScoping(themeId, upperTheme, localTheme) {
|
|
|
24
25
|
}
|
|
25
26
|
return result;
|
|
26
27
|
}
|
|
27
|
-
return themeId ?
|
|
28
|
+
return themeId ? _objectSpread(_objectSpread({}, upperTheme), {}, _defineProperty({}, themeId, localTheme)) : _objectSpread(_objectSpread({}, upperTheme), localTheme);
|
|
28
29
|
}, [themeId, upperTheme, localTheme, isPrivate]);
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
7
|
import * as React from 'react';
|
|
6
8
|
import PropTypes from 'prop-types';
|
|
7
9
|
import clsx from 'clsx';
|
|
@@ -105,7 +107,7 @@ export default function createGrid() {
|
|
|
105
107
|
var spacing = (_inProps$spacing = inProps.spacing) != null ? _inProps$spacing : level ? undefined : spacingProp;
|
|
106
108
|
var rowSpacing = (_ref3 = (_inProps$rowSpacing = inProps.rowSpacing) != null ? _inProps$rowSpacing : inProps.spacing) != null ? _ref3 : level ? undefined : rowSpacingProp;
|
|
107
109
|
var columnSpacing = (_ref4 = (_inProps$columnSpacin = inProps.columnSpacing) != null ? _inProps$columnSpacin : inProps.spacing) != null ? _ref4 : level ? undefined : columnSpacingProp;
|
|
108
|
-
var ownerState =
|
|
110
|
+
var ownerState = _objectSpread(_objectSpread({}, props), {}, {
|
|
109
111
|
level: level,
|
|
110
112
|
columns: columns,
|
|
111
113
|
container: container,
|
|
@@ -122,12 +124,12 @@ export default function createGrid() {
|
|
|
122
124
|
});
|
|
123
125
|
|
|
124
126
|
var classes = useUtilityClasses(ownerState, theme);
|
|
125
|
-
var result = /*#__PURE__*/_jsx(GridRoot,
|
|
127
|
+
var result = /*#__PURE__*/_jsx(GridRoot, _objectSpread(_objectSpread({
|
|
126
128
|
ref: ref,
|
|
127
129
|
as: component,
|
|
128
130
|
ownerState: ownerState,
|
|
129
131
|
className: clsx(classes.root, className)
|
|
130
|
-
}, other, {
|
|
132
|
+
}, other), {}, {
|
|
131
133
|
children: React.Children.map(children, function (child) {
|
|
132
134
|
if ( /*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
|
|
133
135
|
var _child$props$unstable;
|
|
@@ -2,6 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
7
|
function appendLevel(level) {
|
|
6
8
|
if (!level) {
|
|
7
9
|
return '';
|
|
@@ -190,19 +192,19 @@ export var generateGridStyles = function generateGridStyles(_ref10) {
|
|
|
190
192
|
var ownerState = _ref10.ownerState;
|
|
191
193
|
var getSelfSpacing = createGetSelfSpacing(ownerState);
|
|
192
194
|
var getParentSpacing = createGetParentSpacing(ownerState);
|
|
193
|
-
return
|
|
195
|
+
return _objectSpread(_objectSpread({
|
|
194
196
|
minWidth: 0,
|
|
195
197
|
boxSizing: 'border-box'
|
|
196
|
-
}, ownerState.container &&
|
|
198
|
+
}, ownerState.container && _objectSpread(_objectSpread({
|
|
197
199
|
display: 'flex',
|
|
198
200
|
flexWrap: 'wrap'
|
|
199
201
|
}, ownerState.wrap && ownerState.wrap !== 'wrap' && {
|
|
200
202
|
flexWrap: ownerState.wrap
|
|
201
|
-
}, {
|
|
203
|
+
}), {}, {
|
|
202
204
|
margin: "calc(".concat(getSelfSpacing('row'), " / -2) calc(").concat(getSelfSpacing('column'), " / -2)")
|
|
203
205
|
}, ownerState.disableEqualOverflow && {
|
|
204
206
|
margin: "calc(".concat(getSelfSpacing('row'), " * -1) 0px 0px calc(").concat(getSelfSpacing('column'), " * -1)")
|
|
205
|
-
}), (!ownerState.container || isNestedContainer(ownerState)) &&
|
|
207
|
+
})), (!ownerState.container || isNestedContainer(ownerState)) && _objectSpread({
|
|
206
208
|
padding: "calc(".concat(getParentSpacing('row'), " / 2) calc(").concat(getParentSpacing('column'), " / 2)")
|
|
207
209
|
}, (ownerState.disableEqualOverflow || ownerState.parentDisableEqualOverflow) && {
|
|
208
210
|
padding: "".concat(getParentSpacing('row'), " 0px 0px ").concat(getParentSpacing('column'))
|
package/legacy/breakpoints.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
6
|
import PropTypes from 'prop-types';
|
|
5
7
|
import { deepmerge } from '@mui/utils';
|
|
6
8
|
import merge from './merge';
|
|
@@ -63,7 +65,7 @@ function breakpoints(styleFunction) {
|
|
|
63
65
|
var extended = themeBreakpoints.keys.reduce(function (acc, key) {
|
|
64
66
|
if (props[key]) {
|
|
65
67
|
acc = acc || {};
|
|
66
|
-
acc[themeBreakpoints.up(key)] = styleFunction(
|
|
68
|
+
acc[themeBreakpoints.up(key)] = styleFunction(_objectSpread({
|
|
67
69
|
theme: theme
|
|
68
70
|
}, props[key]));
|
|
69
71
|
}
|
|
@@ -71,7 +73,7 @@ function breakpoints(styleFunction) {
|
|
|
71
73
|
}, null);
|
|
72
74
|
return merge(base, extended);
|
|
73
75
|
};
|
|
74
|
-
newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ?
|
|
76
|
+
newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? _objectSpread(_objectSpread({}, styleFunction.propTypes), {}, {
|
|
75
77
|
xs: PropTypes.object,
|
|
76
78
|
sm: PropTypes.object,
|
|
77
79
|
md: PropTypes.object,
|