@mui/system 5.12.1 → 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 +312 -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/Stack.js +1 -1
- 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/colorManipulator.js +2 -0
- package/createBox.js +9 -12
- package/createStyled.js +40 -31
- package/createTheme/createBreakpoints.js +24 -26
- package/createTheme/createSpacing.d.ts +10 -10
- package/createTheme/createSpacing.js +3 -1
- 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/Stack.js +1 -1
- 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/colorManipulator.js +1 -0
- package/esm/createBox.js +9 -12
- package/esm/createStyled.js +38 -31
- package/esm/createTheme/createBreakpoints.js +24 -25
- package/esm/createTheme/createSpacing.js +4 -0
- 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 +5 -2
- package/legacy/Container/createContainer.js +7 -6
- package/legacy/Stack/Stack.js +1 -1
- 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/colorManipulator.js +1 -0
- package/legacy/createBox.js +4 -2
- package/legacy/createStyled.js +13 -11
- package/legacy/createTheme/createBreakpoints.js +4 -3
- package/legacy/createTheme/createSpacing.js +4 -0
- 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/Stack.js +1 -1
- 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/colorManipulator.js +1 -0
- package/modern/createBox.js +9 -12
- package/modern/createStyled.js +38 -31
- package/modern/createTheme/createBreakpoints.js +24 -25
- package/modern/createTheme/createSpacing.js +4 -0
- 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 +4 -4
- package/propsToClassKey.js +3 -6
- package/styleFunctionSx/extendSxProp.js +14 -10
|
@@ -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
|
// Sorted ASC by size. That's important.
|
|
5
6
|
// It can't be configured as it's used statically for propTypes.
|
|
6
7
|
export var breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
@@ -16,7 +17,7 @@ var sortBreakpointsValues = function sortBreakpointsValues(values) {
|
|
|
16
17
|
return breakpoint1.val - breakpoint2.val;
|
|
17
18
|
});
|
|
18
19
|
return breakpointsAsArray.reduce(function (acc, obj) {
|
|
19
|
-
return
|
|
20
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, obj.key, obj.val));
|
|
20
21
|
}, {});
|
|
21
22
|
};
|
|
22
23
|
|
|
@@ -70,7 +71,7 @@ export default function createBreakpoints(breakpoints) {
|
|
|
70
71
|
}
|
|
71
72
|
return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
|
|
72
73
|
}
|
|
73
|
-
return
|
|
74
|
+
return _objectSpread({
|
|
74
75
|
keys: keys,
|
|
75
76
|
values: sortedValues,
|
|
76
77
|
up: up,
|
|
@@ -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() {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
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; }
|
|
3
5
|
import { deepmerge } from '@mui/utils';
|
|
4
6
|
import createBreakpoints from './createBreakpoints';
|
|
5
7
|
import shape from './shape';
|
|
@@ -23,11 +25,11 @@ function createTheme() {
|
|
|
23
25
|
direction: 'ltr',
|
|
24
26
|
components: {},
|
|
25
27
|
// Inject component definitions.
|
|
26
|
-
palette:
|
|
28
|
+
palette: _objectSpread({
|
|
27
29
|
mode: 'light'
|
|
28
30
|
}, paletteInput),
|
|
29
31
|
spacing: spacing,
|
|
30
|
-
shape:
|
|
32
|
+
shape: _objectSpread(_objectSpread({}, shape), shapeInput)
|
|
31
33
|
}, other);
|
|
32
34
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
33
35
|
args[_key - 1] = arguments[_key];
|
|
@@ -35,7 +37,7 @@ function createTheme() {
|
|
|
35
37
|
muiTheme = args.reduce(function (acc, argument) {
|
|
36
38
|
return deepmerge(acc, argument);
|
|
37
39
|
}, muiTheme);
|
|
38
|
-
muiTheme.unstable_sxConfig =
|
|
40
|
+
muiTheme.unstable_sxConfig = _objectSpread(_objectSpread({}, defaultSxConfig), other == null ? void 0 : other.unstable_sxConfig);
|
|
39
41
|
muiTheme.unstable_sx = function sx(props) {
|
|
40
42
|
return styleFunctionSx({
|
|
41
43
|
sx: props,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
4
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
6
5
|
import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
7
8
|
import * as React from 'react';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
10
|
import { deepmerge } from '@mui/utils';
|
|
@@ -143,7 +144,7 @@ export default function createCssVarsProvider(options) {
|
|
|
143
144
|
var _generateCssVars = generateCssVars(),
|
|
144
145
|
rootCss = _generateCssVars.css,
|
|
145
146
|
rootVars = _generateCssVars.vars; // 3. Start composing the theme object
|
|
146
|
-
var theme =
|
|
147
|
+
var theme = _objectSpread(_objectSpread({}, restThemeProp), {}, {
|
|
147
148
|
components: components,
|
|
148
149
|
colorSchemes: colorSchemes,
|
|
149
150
|
cssVarPrefix: cssVarPrefix,
|
|
@@ -171,7 +172,7 @@ export default function createCssVarsProvider(options) {
|
|
|
171
172
|
Object.keys(scheme).forEach(function (schemeKey) {
|
|
172
173
|
if (scheme[schemeKey] && _typeof(scheme[schemeKey]) === 'object') {
|
|
173
174
|
// shallow merge the 1st level structure of the theme.
|
|
174
|
-
theme[schemeKey] =
|
|
175
|
+
theme[schemeKey] = _objectSpread(_objectSpread({}, theme[schemeKey]), scheme[schemeKey]);
|
|
175
176
|
} else {
|
|
176
177
|
theme[schemeKey] = scheme[schemeKey];
|
|
177
178
|
}
|
|
@@ -344,7 +345,7 @@ export default function createCssVarsProvider(options) {
|
|
|
344
345
|
var defaultLightColorScheme = typeof designSystemColorScheme === 'string' ? designSystemColorScheme : designSystemColorScheme.light;
|
|
345
346
|
var defaultDarkColorScheme = typeof designSystemColorScheme === 'string' ? designSystemColorScheme : designSystemColorScheme.dark;
|
|
346
347
|
var getInitColorSchemeScript = function getInitColorSchemeScript(params) {
|
|
347
|
-
return systemGetInitColorSchemeScript(
|
|
348
|
+
return systemGetInitColorSchemeScript(_objectSpread({
|
|
348
349
|
attribute: defaultAttribute,
|
|
349
350
|
colorSchemeStorageKey: defaultColorSchemeStorageKey,
|
|
350
351
|
defaultMode: designSystemMode,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
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; }
|
|
3
5
|
import prepareCssVars from './prepareCssVars';
|
|
4
6
|
function createCssVarsTheme(theme) {
|
|
5
7
|
var cssVarPrefix = theme.cssVarPrefix,
|
|
6
8
|
shouldSkipGeneratingVar = theme.shouldSkipGeneratingVar,
|
|
7
9
|
otherTheme = _objectWithoutProperties(theme, ["cssVarPrefix", "shouldSkipGeneratingVar"]);
|
|
8
|
-
return
|
|
10
|
+
return _objectSpread(_objectSpread({}, theme), prepareCssVars(otherTheme, {
|
|
9
11
|
prefix: cssVarPrefix,
|
|
10
12
|
shouldSkipGeneratingVar: shouldSkipGeneratingVar
|
|
11
13
|
}));
|
|
@@ -1,6 +1,8 @@
|
|
|
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
|
+
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 { deepmerge } from '@mui/utils';
|
|
5
7
|
import cssVarsParser from './cssVarsParser';
|
|
6
8
|
function prepareCssVars(theme, parserConfig) {
|
|
@@ -46,12 +48,12 @@ function prepareCssVars(theme, parserConfig) {
|
|
|
46
48
|
var generateCssVars = function generateCssVars(colorScheme) {
|
|
47
49
|
if (!colorScheme) {
|
|
48
50
|
return {
|
|
49
|
-
css:
|
|
51
|
+
css: _objectSpread({}, rootCss),
|
|
50
52
|
vars: rootVars
|
|
51
53
|
};
|
|
52
54
|
}
|
|
53
55
|
return {
|
|
54
|
-
css:
|
|
56
|
+
css: _objectSpread({}, colorSchemesMap[colorScheme].css),
|
|
55
57
|
vars: colorSchemesMap[colorScheme].vars
|
|
56
58
|
};
|
|
57
59
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
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; }
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import { DEFAULT_MODE_STORAGE_KEY, DEFAULT_COLOR_SCHEME_STORAGE_KEY } from './getInitColorSchemeScript';
|
|
4
6
|
export function getSystemMode(mode) {
|
|
@@ -87,7 +89,7 @@ export default function useCurrentColorScheme(options) {
|
|
|
87
89
|
} catch (e) {
|
|
88
90
|
// Unsupported
|
|
89
91
|
}
|
|
90
|
-
return
|
|
92
|
+
return _objectSpread(_objectSpread({}, currentState), {}, {
|
|
91
93
|
mode: newMode,
|
|
92
94
|
systemMode: getSystemMode(newMode)
|
|
93
95
|
});
|
|
@@ -102,7 +104,7 @@ export default function useCurrentColorScheme(options) {
|
|
|
102
104
|
} catch (e) {
|
|
103
105
|
// Unsupported
|
|
104
106
|
}
|
|
105
|
-
return
|
|
107
|
+
return _objectSpread(_objectSpread({}, currentState), {}, {
|
|
106
108
|
lightColorScheme: defaultLightColorScheme,
|
|
107
109
|
darkColorScheme: defaultDarkColorScheme
|
|
108
110
|
});
|
|
@@ -112,7 +114,7 @@ export default function useCurrentColorScheme(options) {
|
|
|
112
114
|
console.error("`".concat(value, "` does not exist in `theme.colorSchemes`."));
|
|
113
115
|
} else {
|
|
114
116
|
setState(function (currentState) {
|
|
115
|
-
var newState =
|
|
117
|
+
var newState = _objectSpread({}, currentState);
|
|
116
118
|
processState(currentState, function (mode) {
|
|
117
119
|
try {
|
|
118
120
|
localStorage.setItem("".concat(colorSchemeStorageKey, "-").concat(mode), value);
|
|
@@ -131,7 +133,7 @@ export default function useCurrentColorScheme(options) {
|
|
|
131
133
|
}
|
|
132
134
|
} else {
|
|
133
135
|
setState(function (currentState) {
|
|
134
|
-
var newState =
|
|
136
|
+
var newState = _objectSpread({}, currentState);
|
|
135
137
|
var newLightColorScheme = value.light === null ? defaultLightColorScheme : value.light;
|
|
136
138
|
var newDarkColorScheme = value.dark === null ? defaultDarkColorScheme : value.dark;
|
|
137
139
|
if (newLightColorScheme) {
|
|
@@ -165,7 +167,7 @@ export default function useCurrentColorScheme(options) {
|
|
|
165
167
|
var handleMediaQuery = React.useCallback(function (e) {
|
|
166
168
|
if (state.mode === 'system') {
|
|
167
169
|
setState(function (currentState) {
|
|
168
|
-
return
|
|
170
|
+
return _objectSpread(_objectSpread({}, currentState), {}, {
|
|
169
171
|
systemMode: e != null && e.matches ? 'dark' : 'light'
|
|
170
172
|
});
|
|
171
173
|
});
|
|
@@ -221,7 +223,7 @@ export default function useCurrentColorScheme(options) {
|
|
|
221
223
|
}
|
|
222
224
|
return undefined;
|
|
223
225
|
}, [setColorScheme, setMode, modeStorageKey, colorSchemeStorageKey, joinedColorSchemes, defaultMode, storageWindow]);
|
|
224
|
-
return
|
|
226
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
225
227
|
colorScheme: colorScheme,
|
|
226
228
|
setMode: setMode,
|
|
227
229
|
setColorScheme: setColorScheme
|
package/legacy/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
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 { isPlainObject } from '@mui/utils';
|
|
5
7
|
import defaultSxConfig from './defaultSxConfig';
|
|
6
8
|
var splitProps = function splitProps(props) {
|
|
@@ -34,12 +36,12 @@ export default function extendSxProp(props) {
|
|
|
34
36
|
if (!isPlainObject(result)) {
|
|
35
37
|
return systemProps;
|
|
36
38
|
}
|
|
37
|
-
return
|
|
39
|
+
return _objectSpread(_objectSpread({}, systemProps), result);
|
|
38
40
|
};
|
|
39
41
|
} else {
|
|
40
|
-
finalSx =
|
|
42
|
+
finalSx = _objectSpread(_objectSpread({}, systemProps), inSx);
|
|
41
43
|
}
|
|
42
|
-
return
|
|
44
|
+
return _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
43
45
|
sx: finalSx
|
|
44
46
|
});
|
|
45
47
|
}
|
|
@@ -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 = ["className", "component", "disableGutters", "fixed", "maxWidth", "classes"];
|
|
4
1
|
import * as React from 'react';
|
|
5
2
|
import PropTypes from 'prop-types';
|
|
6
3
|
import clsx from 'clsx';
|
|
@@ -50,20 +47,22 @@ export default function createContainer(options = {}) {
|
|
|
50
47
|
const ContainerRoot = createStyledComponent(({
|
|
51
48
|
theme,
|
|
52
49
|
ownerState
|
|
53
|
-
}) =>
|
|
50
|
+
}) => ({
|
|
54
51
|
width: '100%',
|
|
55
52
|
marginLeft: 'auto',
|
|
56
53
|
boxSizing: 'border-box',
|
|
57
54
|
marginRight: 'auto',
|
|
58
|
-
display: 'block'
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
display: 'block',
|
|
56
|
+
// Fix IE11 layout when used with main.
|
|
57
|
+
...(!ownerState.disableGutters && {
|
|
58
|
+
paddingLeft: theme.spacing(2),
|
|
59
|
+
paddingRight: theme.spacing(2),
|
|
60
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
61
|
+
[theme.breakpoints.up('sm')]: {
|
|
62
|
+
paddingLeft: theme.spacing(3),
|
|
63
|
+
paddingRight: theme.spacing(3)
|
|
64
|
+
}
|
|
65
|
+
})
|
|
67
66
|
}), ({
|
|
68
67
|
theme,
|
|
69
68
|
ownerState
|
|
@@ -80,51 +79,58 @@ export default function createContainer(options = {}) {
|
|
|
80
79
|
}, {}), ({
|
|
81
80
|
theme,
|
|
82
81
|
ownerState
|
|
83
|
-
}) =>
|
|
82
|
+
}) => ({
|
|
84
83
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
85
|
-
|
|
84
|
+
...(ownerState.maxWidth === 'xs' && {
|
|
86
85
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
[theme.breakpoints.up('xs')]: {
|
|
87
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
88
|
+
maxWidth: Math.max(theme.breakpoints.values.xs, 444)
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
...(ownerState.maxWidth &&
|
|
92
92
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
93
|
-
|
|
93
|
+
ownerState.maxWidth !== 'xs' && {
|
|
94
94
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
[theme.breakpoints.up(ownerState.maxWidth)]: {
|
|
96
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
97
|
+
maxWidth: `${theme.breakpoints.values[ownerState.maxWidth]}${theme.breakpoints.unit}`
|
|
98
|
+
}
|
|
99
|
+
})
|
|
97
100
|
}));
|
|
98
101
|
const Container = /*#__PURE__*/React.forwardRef(function Container(inProps, ref) {
|
|
99
102
|
const props = useThemeProps(inProps);
|
|
100
103
|
const {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
other
|
|
108
|
-
|
|
104
|
+
className,
|
|
105
|
+
component = 'div',
|
|
106
|
+
disableGutters = false,
|
|
107
|
+
fixed = false,
|
|
108
|
+
maxWidth = 'lg',
|
|
109
|
+
classes: classesProp,
|
|
110
|
+
...other
|
|
111
|
+
} = props;
|
|
112
|
+
const ownerState = {
|
|
113
|
+
...props,
|
|
109
114
|
component,
|
|
110
115
|
disableGutters,
|
|
111
116
|
fixed,
|
|
112
117
|
maxWidth
|
|
113
|
-
}
|
|
118
|
+
};
|
|
114
119
|
|
|
115
120
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
116
121
|
const classes = useUtilityClasses(ownerState, componentName);
|
|
117
122
|
return (
|
|
118
123
|
/*#__PURE__*/
|
|
119
124
|
// @ts-ignore theme is injected by the styled util
|
|
120
|
-
_jsx(ContainerRoot,
|
|
125
|
+
_jsx(ContainerRoot, {
|
|
121
126
|
as: component
|
|
122
127
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
123
128
|
,
|
|
124
129
|
ownerState: ownerState,
|
|
125
130
|
className: clsx(classes.root, className),
|
|
126
|
-
ref: ref
|
|
127
|
-
|
|
131
|
+
ref: ref,
|
|
132
|
+
...other
|
|
133
|
+
})
|
|
128
134
|
);
|
|
129
135
|
});
|
|
130
136
|
process.env.NODE_ENV !== "production" ? Container.propTypes /* remove-proptypes */ = {
|
package/modern/Stack/Stack.js
CHANGED
|
@@ -4,7 +4,7 @@ import createStack from './createStack';
|
|
|
4
4
|
*
|
|
5
5
|
* Demos:
|
|
6
6
|
*
|
|
7
|
-
* - [Stack (Joy UI)](https://mui.com/joy/react-stack/)
|
|
7
|
+
* - [Stack (Joy UI)](https://mui.com/joy-ui/react-stack/)
|
|
8
8
|
* - [Stack (Material UI)](https://mui.com/material-ui/react-stack/)
|
|
9
9
|
* - [Stack (MUI System)](https://mui.com/system/react-stack/)
|
|
10
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 = ["component", "direction", "spacing", "divider", "children", "className", "useFlexGap"];
|
|
4
1
|
import * as React from 'react';
|
|
5
2
|
import PropTypes from 'prop-types';
|
|
6
3
|
import clsx from 'clsx';
|
|
@@ -58,17 +55,18 @@ export const style = ({
|
|
|
58
55
|
ownerState,
|
|
59
56
|
theme
|
|
60
57
|
}) => {
|
|
61
|
-
let styles =
|
|
58
|
+
let styles = {
|
|
62
59
|
display: 'flex',
|
|
63
|
-
flexDirection: 'column'
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
flexDirection: 'column',
|
|
61
|
+
...handleBreakpoints({
|
|
62
|
+
theme
|
|
63
|
+
}, resolveBreakpointValues({
|
|
64
|
+
values: ownerState.direction,
|
|
65
|
+
breakpoints: theme.breakpoints.values
|
|
66
|
+
}), propValue => ({
|
|
67
|
+
flexDirection: propValue
|
|
68
|
+
}))
|
|
69
|
+
};
|
|
72
70
|
if (ownerState.spacing) {
|
|
73
71
|
const transformer = createUnarySpacing(theme);
|
|
74
72
|
const base = Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
|
|
@@ -132,29 +130,29 @@ export default function createStack(options = {}) {
|
|
|
132
130
|
const themeProps = useThemeProps(inProps);
|
|
133
131
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
134
132
|
const {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
133
|
+
component = 'div',
|
|
134
|
+
direction = 'column',
|
|
135
|
+
spacing = 0,
|
|
136
|
+
divider,
|
|
137
|
+
children,
|
|
138
|
+
className,
|
|
139
|
+
useFlexGap = false,
|
|
140
|
+
...other
|
|
141
|
+
} = props;
|
|
144
142
|
const ownerState = {
|
|
145
143
|
direction,
|
|
146
144
|
spacing,
|
|
147
145
|
useFlexGap
|
|
148
146
|
};
|
|
149
147
|
const classes = useUtilityClasses();
|
|
150
|
-
return /*#__PURE__*/_jsx(StackRoot,
|
|
148
|
+
return /*#__PURE__*/_jsx(StackRoot, {
|
|
151
149
|
as: component,
|
|
152
150
|
ownerState: ownerState,
|
|
153
151
|
ref: ref,
|
|
154
|
-
className: clsx(classes.root, className)
|
|
155
|
-
|
|
152
|
+
className: clsx(classes.root, className),
|
|
153
|
+
...other,
|
|
156
154
|
children: divider ? joinChildren(children, divider) : children
|
|
157
|
-
})
|
|
155
|
+
});
|
|
158
156
|
});
|
|
159
157
|
process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ = {
|
|
160
158
|
children: PropTypes.node,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import { ThemeProvider as MuiThemeProvider, useTheme as usePrivateTheme } from '@mui/private-theming';
|
|
@@ -12,9 +11,10 @@ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
|
|
|
12
11
|
const resolvedTheme = themeId ? upperTheme[themeId] || upperTheme : upperTheme;
|
|
13
12
|
if (typeof localTheme === 'function') {
|
|
14
13
|
const mergedTheme = localTheme(resolvedTheme);
|
|
15
|
-
const result = themeId ?
|
|
14
|
+
const result = themeId ? {
|
|
15
|
+
...upperTheme,
|
|
16
16
|
[themeId]: mergedTheme
|
|
17
|
-
}
|
|
17
|
+
} : mergedTheme;
|
|
18
18
|
// must return a function for the private theme to NOT merge with the upper theme.
|
|
19
19
|
// see the test case "use provided theme from a callback" in ThemeProvider.test.js
|
|
20
20
|
if (isPrivate) {
|
|
@@ -22,9 +22,13 @@ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
|
|
|
22
22
|
}
|
|
23
23
|
return result;
|
|
24
24
|
}
|
|
25
|
-
return themeId ?
|
|
25
|
+
return themeId ? {
|
|
26
|
+
...upperTheme,
|
|
26
27
|
[themeId]: localTheme
|
|
27
|
-
}
|
|
28
|
+
} : {
|
|
29
|
+
...upperTheme,
|
|
30
|
+
...localTheme
|
|
31
|
+
};
|
|
28
32
|
}, [themeId, upperTheme, localTheme, isPrivate]);
|
|
29
33
|
}
|
|
30
34
|
|
|
@@ -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 = ["className", "children", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow", "unstable_level"];
|
|
4
1
|
import * as React from 'react';
|
|
5
2
|
import PropTypes from 'prop-types';
|
|
6
3
|
import clsx from 'clsx';
|
|
@@ -55,20 +52,20 @@ export default function createGrid(options = {}) {
|
|
|
55
52
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
56
53
|
const overflow = React.useContext(OverflowContext);
|
|
57
54
|
const {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
className,
|
|
56
|
+
children,
|
|
57
|
+
columns: columnsProp = 12,
|
|
58
|
+
container = false,
|
|
59
|
+
component = 'div',
|
|
60
|
+
direction = 'row',
|
|
61
|
+
wrap = 'wrap',
|
|
62
|
+
spacing: spacingProp = 0,
|
|
63
|
+
rowSpacing: rowSpacingProp = spacingProp,
|
|
64
|
+
columnSpacing: columnSpacingProp = spacingProp,
|
|
65
|
+
disableEqualOverflow: themeDisableEqualOverflow,
|
|
66
|
+
unstable_level: level = 0,
|
|
67
|
+
...rest
|
|
68
|
+
} = props;
|
|
72
69
|
// Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
|
|
73
70
|
let disableEqualOverflow = themeDisableEqualOverflow;
|
|
74
71
|
if (level && themeDisableEqualOverflow !== undefined) {
|
|
@@ -91,7 +88,8 @@ export default function createGrid(options = {}) {
|
|
|
91
88
|
const spacing = inProps.spacing ?? (level ? undefined : spacingProp);
|
|
92
89
|
const rowSpacing = inProps.rowSpacing ?? inProps.spacing ?? (level ? undefined : rowSpacingProp);
|
|
93
90
|
const columnSpacing = inProps.columnSpacing ?? inProps.spacing ?? (level ? undefined : columnSpacingProp);
|
|
94
|
-
const ownerState =
|
|
91
|
+
const ownerState = {
|
|
92
|
+
...props,
|
|
95
93
|
level,
|
|
96
94
|
columns,
|
|
97
95
|
container,
|
|
@@ -105,15 +103,15 @@ export default function createGrid(options = {}) {
|
|
|
105
103
|
disableEqualOverflow: disableEqualOverflow ?? overflow ?? false,
|
|
106
104
|
// use context value if exists.
|
|
107
105
|
parentDisableEqualOverflow: overflow // for nested grid
|
|
108
|
-
}
|
|
106
|
+
};
|
|
109
107
|
|
|
110
108
|
const classes = useUtilityClasses(ownerState, theme);
|
|
111
|
-
let result = /*#__PURE__*/_jsx(GridRoot,
|
|
109
|
+
let result = /*#__PURE__*/_jsx(GridRoot, {
|
|
112
110
|
ref: ref,
|
|
113
111
|
as: component,
|
|
114
112
|
ownerState: ownerState,
|
|
115
|
-
className: clsx(classes.root, className)
|
|
116
|
-
|
|
113
|
+
className: clsx(classes.root, className),
|
|
114
|
+
...other,
|
|
117
115
|
children: React.Children.map(children, child => {
|
|
118
116
|
if ( /*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
|
|
119
117
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
@@ -122,7 +120,7 @@ export default function createGrid(options = {}) {
|
|
|
122
120
|
}
|
|
123
121
|
return child;
|
|
124
122
|
})
|
|
125
|
-
})
|
|
123
|
+
});
|
|
126
124
|
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow ?? false)) {
|
|
127
125
|
// There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
|
|
128
126
|
// 1. It is the root grid with `disableEqualOverflow`.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
function appendLevel(level) {
|
|
3
2
|
if (!level) {
|
|
4
3
|
return '';
|
|
@@ -204,23 +203,27 @@ export const generateGridStyles = ({
|
|
|
204
203
|
}) => {
|
|
205
204
|
const getSelfSpacing = createGetSelfSpacing(ownerState);
|
|
206
205
|
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
207
|
-
return
|
|
206
|
+
return {
|
|
208
207
|
minWidth: 0,
|
|
209
|
-
boxSizing: 'border-box'
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
208
|
+
boxSizing: 'border-box',
|
|
209
|
+
...(ownerState.container && {
|
|
210
|
+
display: 'flex',
|
|
211
|
+
flexWrap: 'wrap',
|
|
212
|
+
...(ownerState.wrap && ownerState.wrap !== 'wrap' && {
|
|
213
|
+
flexWrap: ownerState.wrap
|
|
214
|
+
}),
|
|
215
|
+
margin: `calc(${getSelfSpacing('row')} / -2) calc(${getSelfSpacing('column')} / -2)`,
|
|
216
|
+
...(ownerState.disableEqualOverflow && {
|
|
217
|
+
margin: `calc(${getSelfSpacing('row')} * -1) 0px 0px calc(${getSelfSpacing('column')} * -1)`
|
|
218
|
+
})
|
|
219
|
+
}),
|
|
220
|
+
...((!ownerState.container || isNestedContainer(ownerState)) && {
|
|
221
|
+
padding: `calc(${getParentSpacing('row')} / 2) calc(${getParentSpacing('column')} / 2)`,
|
|
222
|
+
...((ownerState.disableEqualOverflow || ownerState.parentDisableEqualOverflow) && {
|
|
223
|
+
padding: `${getParentSpacing('row')} 0px 0px ${getParentSpacing('column')}`
|
|
224
|
+
})
|
|
225
|
+
})
|
|
226
|
+
};
|
|
224
227
|
};
|
|
225
228
|
export const generateSizeClassNames = gridSize => {
|
|
226
229
|
const classNames = [];
|