@mui/system 5.13.1 → 5.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/Container/Container.d.ts +13 -13
- package/Container/ContainerProps.d.ts +40 -40
- package/Container/containerClasses.d.ts +22 -22
- package/Container/createContainer.d.ts +18 -18
- package/Container/createContainer.js +35 -41
- package/GlobalStyles/GlobalStyles.d.ts +13 -13
- package/GlobalStyles/index.d.ts +2 -2
- package/Stack/Stack.d.ts +14 -14
- package/Stack/StackProps.d.ts +53 -53
- package/Stack/createStack.d.ts +21 -21
- package/Stack/createStack.js +26 -24
- package/Stack/index.d.ts +5 -5
- package/Stack/stackClasses.d.ts +8 -8
- package/ThemeProvider/ThemeProvider.js +5 -9
- package/Unstable_Grid/Grid.d.ts +12 -12
- package/Unstable_Grid/GridProps.d.ts +185 -185
- package/Unstable_Grid/createGrid.d.ts +11 -11
- package/Unstable_Grid/createGrid.js +23 -21
- package/Unstable_Grid/gridClasses.d.ts +20 -20
- package/Unstable_Grid/gridGenerator.d.ts +38 -38
- package/Unstable_Grid/gridGenerator.js +18 -20
- package/Unstable_Grid/index.d.ts +5 -5
- package/breakpoints.js +6 -7
- package/createBox.js +12 -9
- package/createStyled.js +32 -40
- package/createTheme/createBreakpoints.js +26 -24
- package/createTheme/createSpacing.d.ts +10 -10
- package/createTheme/createTheme.js +14 -18
- package/cssVars/createCssVarsProvider.js +20 -21
- package/cssVars/createCssVarsTheme.d.ts +15 -15
- package/cssVars/createCssVarsTheme.js +10 -10
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/cssVarsParser.d.ts +64 -64
- package/cssVars/getInitColorSchemeScript.d.ts +42 -42
- package/cssVars/index.d.ts +5 -5
- package/cssVars/prepareCssVars.d.ts +16 -16
- package/cssVars/prepareCssVars.js +12 -13
- package/cssVars/useCurrentColorScheme.d.ts +53 -53
- package/cssVars/useCurrentColorScheme.js +11 -17
- package/esm/Container/createContainer.js +35 -41
- package/esm/Stack/createStack.js +26 -24
- package/esm/ThemeProvider/ThemeProvider.js +5 -9
- package/esm/Unstable_Grid/createGrid.js +23 -21
- package/esm/Unstable_Grid/gridGenerator.js +17 -20
- package/esm/breakpoints.js +6 -7
- package/esm/createBox.js +12 -9
- package/esm/createStyled.js +31 -38
- package/esm/createTheme/createBreakpoints.js +25 -24
- package/esm/createTheme/createTheme.js +14 -18
- package/esm/cssVars/createCssVarsProvider.js +20 -21
- package/esm/cssVars/createCssVarsTheme.js +10 -10
- package/esm/cssVars/prepareCssVars.js +12 -13
- package/esm/cssVars/useCurrentColorScheme.js +10 -17
- package/esm/propsToClassKey.js +5 -3
- package/esm/styleFunctionSx/extendSxProp.js +10 -14
- package/index.js +1 -1
- package/legacy/Container/createContainer.js +6 -7
- package/legacy/Stack/createStack.js +5 -6
- package/legacy/ThemeProvider/ThemeProvider.js +3 -4
- package/legacy/Unstable_Grid/createGrid.js +4 -6
- package/legacy/Unstable_Grid/gridGenerator.js +4 -6
- package/legacy/breakpoints.js +3 -5
- package/legacy/createBox.js +2 -4
- package/legacy/createStyled.js +11 -13
- package/legacy/createTheme/createBreakpoints.js +3 -4
- package/legacy/createTheme/createTheme.js +4 -6
- package/legacy/cssVars/createCssVarsProvider.js +5 -6
- package/legacy/cssVars/createCssVarsTheme.js +2 -4
- package/legacy/cssVars/prepareCssVars.js +3 -5
- package/legacy/cssVars/useCurrentColorScheme.js +7 -9
- package/legacy/index.js +1 -1
- package/legacy/styleFunctionSx/extendSxProp.js +4 -6
- package/modern/Container/createContainer.js +35 -41
- package/modern/Stack/createStack.js +26 -24
- package/modern/ThemeProvider/ThemeProvider.js +5 -9
- package/modern/Unstable_Grid/createGrid.js +23 -21
- package/modern/Unstable_Grid/gridGenerator.js +17 -20
- package/modern/breakpoints.js +6 -7
- package/modern/createBox.js +12 -9
- package/modern/createStyled.js +31 -38
- package/modern/createTheme/createBreakpoints.js +25 -24
- package/modern/createTheme/createTheme.js +14 -18
- package/modern/cssVars/createCssVarsProvider.js +20 -21
- package/modern/cssVars/createCssVarsTheme.js +10 -10
- package/modern/cssVars/prepareCssVars.js +12 -13
- package/modern/cssVars/useCurrentColorScheme.js +10 -17
- package/modern/index.js +1 -1
- package/modern/propsToClassKey.js +5 -3
- package/modern/styleFunctionSx/extendSxProp.js +10 -14
- package/package.json +2 -2
- package/propsToClassKey.js +6 -3
- package/styleFunctionSx/extendSxProp.js +10 -14
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = useCurrentColorScheme;
|
|
7
8
|
exports.getColorScheme = getColorScheme;
|
|
8
9
|
exports.getSystemMode = getSystemMode;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
11
|
var React = _interopRequireWildcard(require("react"));
|
|
10
12
|
var _getInitColorSchemeScript = require("./getInitColorSchemeScript");
|
|
11
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -91,11 +93,10 @@ function useCurrentColorScheme(options) {
|
|
|
91
93
|
} catch (e) {
|
|
92
94
|
// Unsupported
|
|
93
95
|
}
|
|
94
|
-
return {
|
|
95
|
-
...currentState,
|
|
96
|
+
return (0, _extends2.default)({}, currentState, {
|
|
96
97
|
mode: newMode,
|
|
97
98
|
systemMode: getSystemMode(newMode)
|
|
98
|
-
};
|
|
99
|
+
});
|
|
99
100
|
});
|
|
100
101
|
}, [modeStorageKey, defaultMode]);
|
|
101
102
|
const setColorScheme = React.useCallback(value => {
|
|
@@ -107,20 +108,17 @@ function useCurrentColorScheme(options) {
|
|
|
107
108
|
} catch (e) {
|
|
108
109
|
// Unsupported
|
|
109
110
|
}
|
|
110
|
-
return {
|
|
111
|
-
...currentState,
|
|
111
|
+
return (0, _extends2.default)({}, currentState, {
|
|
112
112
|
lightColorScheme: defaultLightColorScheme,
|
|
113
113
|
darkColorScheme: defaultDarkColorScheme
|
|
114
|
-
};
|
|
114
|
+
});
|
|
115
115
|
});
|
|
116
116
|
} else if (typeof value === 'string') {
|
|
117
117
|
if (value && !joinedColorSchemes.includes(value)) {
|
|
118
118
|
console.error(`\`${value}\` does not exist in \`theme.colorSchemes\`.`);
|
|
119
119
|
} else {
|
|
120
120
|
setState(currentState => {
|
|
121
|
-
const newState = {
|
|
122
|
-
...currentState
|
|
123
|
-
};
|
|
121
|
+
const newState = (0, _extends2.default)({}, currentState);
|
|
124
122
|
processState(currentState, mode => {
|
|
125
123
|
try {
|
|
126
124
|
localStorage.setItem(`${colorSchemeStorageKey}-${mode}`, value);
|
|
@@ -139,9 +137,7 @@ function useCurrentColorScheme(options) {
|
|
|
139
137
|
}
|
|
140
138
|
} else {
|
|
141
139
|
setState(currentState => {
|
|
142
|
-
const newState = {
|
|
143
|
-
...currentState
|
|
144
|
-
};
|
|
140
|
+
const newState = (0, _extends2.default)({}, currentState);
|
|
145
141
|
const newLightColorScheme = value.light === null ? defaultLightColorScheme : value.light;
|
|
146
142
|
const newDarkColorScheme = value.dark === null ? defaultDarkColorScheme : value.dark;
|
|
147
143
|
if (newLightColorScheme) {
|
|
@@ -174,8 +170,7 @@ function useCurrentColorScheme(options) {
|
|
|
174
170
|
}, [joinedColorSchemes, colorSchemeStorageKey, defaultLightColorScheme, defaultDarkColorScheme]);
|
|
175
171
|
const handleMediaQuery = React.useCallback(e => {
|
|
176
172
|
if (state.mode === 'system') {
|
|
177
|
-
setState(currentState => ({
|
|
178
|
-
...currentState,
|
|
173
|
+
setState(currentState => (0, _extends2.default)({}, currentState, {
|
|
179
174
|
systemMode: e != null && e.matches ? 'dark' : 'light'
|
|
180
175
|
}));
|
|
181
176
|
}
|
|
@@ -224,10 +219,9 @@ function useCurrentColorScheme(options) {
|
|
|
224
219
|
}
|
|
225
220
|
return undefined;
|
|
226
221
|
}, [setColorScheme, setMode, modeStorageKey, colorSchemeStorageKey, joinedColorSchemes, defaultMode, storageWindow]);
|
|
227
|
-
return {
|
|
228
|
-
...state,
|
|
222
|
+
return (0, _extends2.default)({}, state, {
|
|
229
223
|
colorScheme,
|
|
230
224
|
setMode,
|
|
231
225
|
setColorScheme
|
|
232
|
-
};
|
|
226
|
+
});
|
|
233
227
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
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"];
|
|
1
4
|
import * as React from 'react';
|
|
2
5
|
import PropTypes from 'prop-types';
|
|
3
6
|
import clsx from 'clsx';
|
|
@@ -47,22 +50,20 @@ export default function createContainer(options = {}) {
|
|
|
47
50
|
const ContainerRoot = createStyledComponent(({
|
|
48
51
|
theme,
|
|
49
52
|
ownerState
|
|
50
|
-
}) => ({
|
|
53
|
+
}) => _extends({
|
|
51
54
|
width: '100%',
|
|
52
55
|
marginLeft: 'auto',
|
|
53
56
|
boxSizing: 'border-box',
|
|
54
57
|
marginRight: 'auto',
|
|
55
|
-
display: 'block'
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
})
|
|
58
|
+
display: 'block'
|
|
59
|
+
}, !ownerState.disableGutters && {
|
|
60
|
+
paddingLeft: theme.spacing(2),
|
|
61
|
+
paddingRight: theme.spacing(2),
|
|
62
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
63
|
+
[theme.breakpoints.up('sm')]: {
|
|
64
|
+
paddingLeft: theme.spacing(3),
|
|
65
|
+
paddingRight: theme.spacing(3)
|
|
66
|
+
}
|
|
66
67
|
}), ({
|
|
67
68
|
theme,
|
|
68
69
|
ownerState
|
|
@@ -79,58 +80,51 @@ export default function createContainer(options = {}) {
|
|
|
79
80
|
}, {}), ({
|
|
80
81
|
theme,
|
|
81
82
|
ownerState
|
|
82
|
-
}) => ({
|
|
83
|
+
}) => _extends({}, ownerState.maxWidth === 'xs' && {
|
|
83
84
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
84
|
-
|
|
85
|
+
[theme.breakpoints.up('xs')]: {
|
|
85
86
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
...(ownerState.maxWidth &&
|
|
87
|
+
maxWidth: Math.max(theme.breakpoints.values.xs, 444)
|
|
88
|
+
}
|
|
89
|
+
}, ownerState.maxWidth &&
|
|
90
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
91
|
+
ownerState.maxWidth !== 'xs' && {
|
|
92
92
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
93
|
-
ownerState.maxWidth
|
|
93
|
+
[theme.breakpoints.up(ownerState.maxWidth)]: {
|
|
94
94
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
maxWidth: `${theme.breakpoints.values[ownerState.maxWidth]}${theme.breakpoints.unit}`
|
|
98
|
-
}
|
|
99
|
-
})
|
|
95
|
+
maxWidth: `${theme.breakpoints.values[ownerState.maxWidth]}${theme.breakpoints.unit}`
|
|
96
|
+
}
|
|
100
97
|
}));
|
|
101
98
|
const Container = /*#__PURE__*/React.forwardRef(function Container(inProps, ref) {
|
|
102
99
|
const props = useThemeProps(inProps);
|
|
103
100
|
const {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const ownerState = {
|
|
113
|
-
...props,
|
|
101
|
+
className,
|
|
102
|
+
component = 'div',
|
|
103
|
+
disableGutters = false,
|
|
104
|
+
fixed = false,
|
|
105
|
+
maxWidth = 'lg'
|
|
106
|
+
} = props,
|
|
107
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
108
|
+
const ownerState = _extends({}, props, {
|
|
114
109
|
component,
|
|
115
110
|
disableGutters,
|
|
116
111
|
fixed,
|
|
117
112
|
maxWidth
|
|
118
|
-
};
|
|
113
|
+
});
|
|
119
114
|
|
|
120
115
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
121
116
|
const classes = useUtilityClasses(ownerState, componentName);
|
|
122
117
|
return (
|
|
123
118
|
/*#__PURE__*/
|
|
124
119
|
// @ts-ignore theme is injected by the styled util
|
|
125
|
-
_jsx(ContainerRoot, {
|
|
120
|
+
_jsx(ContainerRoot, _extends({
|
|
126
121
|
as: component
|
|
127
122
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
128
123
|
,
|
|
129
124
|
ownerState: ownerState,
|
|
130
125
|
className: clsx(classes.root, className),
|
|
131
|
-
ref: ref
|
|
132
|
-
|
|
133
|
-
})
|
|
126
|
+
ref: ref
|
|
127
|
+
}, other))
|
|
134
128
|
);
|
|
135
129
|
});
|
|
136
130
|
process.env.NODE_ENV !== "production" ? Container.propTypes /* remove-proptypes */ = {
|
package/esm/Stack/createStack.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
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"];
|
|
1
4
|
import * as React from 'react';
|
|
2
5
|
import PropTypes from 'prop-types';
|
|
3
6
|
import clsx from 'clsx';
|
|
@@ -55,18 +58,17 @@ export const style = ({
|
|
|
55
58
|
ownerState,
|
|
56
59
|
theme
|
|
57
60
|
}) => {
|
|
58
|
-
let styles = {
|
|
61
|
+
let styles = _extends({
|
|
59
62
|
display: 'flex',
|
|
60
|
-
flexDirection: 'column'
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
};
|
|
63
|
+
flexDirection: 'column'
|
|
64
|
+
}, handleBreakpoints({
|
|
65
|
+
theme
|
|
66
|
+
}, resolveBreakpointValues({
|
|
67
|
+
values: ownerState.direction,
|
|
68
|
+
breakpoints: theme.breakpoints.values
|
|
69
|
+
}), propValue => ({
|
|
70
|
+
flexDirection: propValue
|
|
71
|
+
})));
|
|
70
72
|
if (ownerState.spacing) {
|
|
71
73
|
const transformer = createUnarySpacing(theme);
|
|
72
74
|
const base = Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
|
|
@@ -130,29 +132,29 @@ export default function createStack(options = {}) {
|
|
|
130
132
|
const themeProps = useThemeProps(inProps);
|
|
131
133
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
132
134
|
const {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
component = 'div',
|
|
136
|
+
direction = 'column',
|
|
137
|
+
spacing = 0,
|
|
138
|
+
divider,
|
|
139
|
+
children,
|
|
140
|
+
className,
|
|
141
|
+
useFlexGap = false
|
|
142
|
+
} = props,
|
|
143
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
142
144
|
const ownerState = {
|
|
143
145
|
direction,
|
|
144
146
|
spacing,
|
|
145
147
|
useFlexGap
|
|
146
148
|
};
|
|
147
149
|
const classes = useUtilityClasses();
|
|
148
|
-
return /*#__PURE__*/_jsx(StackRoot, {
|
|
150
|
+
return /*#__PURE__*/_jsx(StackRoot, _extends({
|
|
149
151
|
as: component,
|
|
150
152
|
ownerState: ownerState,
|
|
151
153
|
ref: ref,
|
|
152
|
-
className: clsx(classes.root, className)
|
|
153
|
-
|
|
154
|
+
className: clsx(classes.root, className)
|
|
155
|
+
}, other, {
|
|
154
156
|
children: divider ? joinChildren(children, divider) : children
|
|
155
|
-
});
|
|
157
|
+
}));
|
|
156
158
|
});
|
|
157
159
|
process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ = {
|
|
158
160
|
children: PropTypes.node,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { ThemeProvider as MuiThemeProvider, useTheme as usePrivateTheme } from '@mui/private-theming';
|
|
@@ -11,10 +12,9 @@ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
|
|
|
11
12
|
const resolvedTheme = themeId ? upperTheme[themeId] || upperTheme : upperTheme;
|
|
12
13
|
if (typeof localTheme === 'function') {
|
|
13
14
|
const mergedTheme = localTheme(resolvedTheme);
|
|
14
|
-
const result = themeId ? {
|
|
15
|
-
...upperTheme,
|
|
15
|
+
const result = themeId ? _extends({}, upperTheme, {
|
|
16
16
|
[themeId]: mergedTheme
|
|
17
|
-
} : mergedTheme;
|
|
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,13 +22,9 @@ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
|
|
|
22
22
|
}
|
|
23
23
|
return result;
|
|
24
24
|
}
|
|
25
|
-
return themeId ? {
|
|
26
|
-
...upperTheme,
|
|
25
|
+
return themeId ? _extends({}, upperTheme, {
|
|
27
26
|
[themeId]: localTheme
|
|
28
|
-
} : {
|
|
29
|
-
...upperTheme,
|
|
30
|
-
...localTheme
|
|
31
|
-
};
|
|
27
|
+
}) : _extends({}, upperTheme, localTheme);
|
|
32
28
|
}, [themeId, upperTheme, localTheme, isPrivate]);
|
|
33
29
|
}
|
|
34
30
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["className", "children", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow", "unstable_level"];
|
|
1
4
|
import * as React from 'react';
|
|
2
5
|
import PropTypes from 'prop-types';
|
|
3
6
|
import clsx from 'clsx';
|
|
@@ -53,20 +56,20 @@ export default function createGrid(options = {}) {
|
|
|
53
56
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
54
57
|
const overflow = React.useContext(OverflowContext);
|
|
55
58
|
const {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
className,
|
|
60
|
+
children,
|
|
61
|
+
columns: columnsProp = 12,
|
|
62
|
+
container = false,
|
|
63
|
+
component = 'div',
|
|
64
|
+
direction = 'row',
|
|
65
|
+
wrap = 'wrap',
|
|
66
|
+
spacing: spacingProp = 0,
|
|
67
|
+
rowSpacing: rowSpacingProp = spacingProp,
|
|
68
|
+
columnSpacing: columnSpacingProp = spacingProp,
|
|
69
|
+
disableEqualOverflow: themeDisableEqualOverflow,
|
|
70
|
+
unstable_level: level = 0
|
|
71
|
+
} = props,
|
|
72
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
70
73
|
// Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
|
|
71
74
|
let disableEqualOverflow = themeDisableEqualOverflow;
|
|
72
75
|
if (level && themeDisableEqualOverflow !== undefined) {
|
|
@@ -89,8 +92,7 @@ export default function createGrid(options = {}) {
|
|
|
89
92
|
const spacing = (_inProps$spacing = inProps.spacing) != null ? _inProps$spacing : level ? undefined : spacingProp;
|
|
90
93
|
const rowSpacing = (_ref = (_inProps$rowSpacing = inProps.rowSpacing) != null ? _inProps$rowSpacing : inProps.spacing) != null ? _ref : level ? undefined : rowSpacingProp;
|
|
91
94
|
const columnSpacing = (_ref2 = (_inProps$columnSpacin = inProps.columnSpacing) != null ? _inProps$columnSpacin : inProps.spacing) != null ? _ref2 : level ? undefined : columnSpacingProp;
|
|
92
|
-
const ownerState = {
|
|
93
|
-
...props,
|
|
95
|
+
const ownerState = _extends({}, props, {
|
|
94
96
|
level,
|
|
95
97
|
columns,
|
|
96
98
|
container,
|
|
@@ -104,15 +106,15 @@ export default function createGrid(options = {}) {
|
|
|
104
106
|
disableEqualOverflow: (_ref3 = (_disableEqualOverflow = disableEqualOverflow) != null ? _disableEqualOverflow : overflow) != null ? _ref3 : false,
|
|
105
107
|
// use context value if exists.
|
|
106
108
|
parentDisableEqualOverflow: overflow // for nested grid
|
|
107
|
-
};
|
|
109
|
+
});
|
|
108
110
|
|
|
109
111
|
const classes = useUtilityClasses(ownerState, theme);
|
|
110
|
-
let result = /*#__PURE__*/_jsx(GridRoot, {
|
|
112
|
+
let result = /*#__PURE__*/_jsx(GridRoot, _extends({
|
|
111
113
|
ref: ref,
|
|
112
114
|
as: component,
|
|
113
115
|
ownerState: ownerState,
|
|
114
|
-
className: clsx(classes.root, className)
|
|
115
|
-
|
|
116
|
+
className: clsx(classes.root, className)
|
|
117
|
+
}, other, {
|
|
116
118
|
children: React.Children.map(children, child => {
|
|
117
119
|
if ( /*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
|
|
118
120
|
var _child$props$unstable;
|
|
@@ -122,7 +124,7 @@ export default function createGrid(options = {}) {
|
|
|
122
124
|
}
|
|
123
125
|
return child;
|
|
124
126
|
})
|
|
125
|
-
});
|
|
127
|
+
}));
|
|
126
128
|
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
|
|
127
129
|
// There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
|
|
128
130
|
// 1. It is the root grid with `disableEqualOverflow`.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
function appendLevel(level) {
|
|
2
3
|
if (!level) {
|
|
3
4
|
return '';
|
|
@@ -205,27 +206,23 @@ export const generateGridStyles = ({
|
|
|
205
206
|
}) => {
|
|
206
207
|
const getSelfSpacing = createGetSelfSpacing(ownerState);
|
|
207
208
|
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
208
|
-
return {
|
|
209
|
+
return _extends({
|
|
209
210
|
minWidth: 0,
|
|
210
|
-
boxSizing: 'border-box'
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
})
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
padding: `${getParentSpacing('row')} 0px 0px ${getParentSpacing('column')}`
|
|
226
|
-
})
|
|
227
|
-
})
|
|
228
|
-
};
|
|
211
|
+
boxSizing: 'border-box'
|
|
212
|
+
}, ownerState.container && _extends({
|
|
213
|
+
display: 'flex',
|
|
214
|
+
flexWrap: 'wrap'
|
|
215
|
+
}, ownerState.wrap && ownerState.wrap !== 'wrap' && {
|
|
216
|
+
flexWrap: ownerState.wrap
|
|
217
|
+
}, {
|
|
218
|
+
margin: `calc(${getSelfSpacing('row')} / -2) calc(${getSelfSpacing('column')} / -2)`
|
|
219
|
+
}, ownerState.disableEqualOverflow && {
|
|
220
|
+
margin: `calc(${getSelfSpacing('row')} * -1) 0px 0px calc(${getSelfSpacing('column')} * -1)`
|
|
221
|
+
}), (!ownerState.container || isNestedContainer(ownerState)) && _extends({
|
|
222
|
+
padding: `calc(${getParentSpacing('row')} / 2) calc(${getParentSpacing('column')} / 2)`
|
|
223
|
+
}, (ownerState.disableEqualOverflow || ownerState.parentDisableEqualOverflow) && {
|
|
224
|
+
padding: `${getParentSpacing('row')} 0px 0px ${getParentSpacing('column')}`
|
|
225
|
+
}));
|
|
229
226
|
};
|
|
230
227
|
export const generateSizeClassNames = gridSize => {
|
|
231
228
|
const classNames = [];
|
package/esm/breakpoints.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
3
|
import { deepmerge } from '@mui/utils';
|
|
3
4
|
import merge from './merge';
|
|
@@ -58,23 +59,21 @@ function breakpoints(styleFunction) {
|
|
|
58
59
|
const extended = themeBreakpoints.keys.reduce((acc, key) => {
|
|
59
60
|
if (props[key]) {
|
|
60
61
|
acc = acc || {};
|
|
61
|
-
acc[themeBreakpoints.up(key)] = styleFunction({
|
|
62
|
-
theme
|
|
63
|
-
|
|
64
|
-
});
|
|
62
|
+
acc[themeBreakpoints.up(key)] = styleFunction(_extends({
|
|
63
|
+
theme
|
|
64
|
+
}, props[key]));
|
|
65
65
|
}
|
|
66
66
|
return acc;
|
|
67
67
|
}, null);
|
|
68
68
|
return merge(base, extended);
|
|
69
69
|
};
|
|
70
|
-
newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? {
|
|
71
|
-
...styleFunction.propTypes,
|
|
70
|
+
newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? _extends({}, styleFunction.propTypes, {
|
|
72
71
|
xs: PropTypes.object,
|
|
73
72
|
sm: PropTypes.object,
|
|
74
73
|
md: PropTypes.object,
|
|
75
74
|
lg: PropTypes.object,
|
|
76
75
|
xl: PropTypes.object
|
|
77
|
-
} : {};
|
|
76
|
+
}) : {};
|
|
78
77
|
newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl', ...styleFunction.filterProps];
|
|
79
78
|
return newStyleFunction;
|
|
80
79
|
}
|
package/esm/createBox.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["className", "component"];
|
|
1
4
|
import * as React from 'react';
|
|
2
5
|
import clsx from 'clsx';
|
|
3
6
|
import styled from '@mui/styled-engine';
|
|
@@ -16,18 +19,18 @@ export default function createBox(options = {}) {
|
|
|
16
19
|
})(styleFunctionSx);
|
|
17
20
|
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
18
21
|
const theme = useTheme(defaultTheme);
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const _extendSxProp = extendSxProp(inProps),
|
|
23
|
+
{
|
|
24
|
+
className,
|
|
25
|
+
component = 'div'
|
|
26
|
+
} = _extendSxProp,
|
|
27
|
+
other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded);
|
|
28
|
+
return /*#__PURE__*/_jsx(BoxRoot, _extends({
|
|
25
29
|
as: component,
|
|
26
30
|
ref: ref,
|
|
27
31
|
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
28
|
-
theme: themeId ? theme[themeId] || theme : theme
|
|
29
|
-
|
|
30
|
-
});
|
|
32
|
+
theme: themeId ? theme[themeId] || theme : theme
|
|
33
|
+
}, other));
|
|
31
34
|
});
|
|
32
35
|
return Box;
|
|
33
36
|
}
|
package/esm/createStyled.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
|
|
1
4
|
/* eslint-disable no-underscore-dangle */
|
|
2
5
|
import styledEngineStyled, { internal_processStyles as processStyles } from '@mui/styled-engine';
|
|
3
6
|
import { getDisplayName } from '@mui/utils';
|
|
@@ -80,27 +83,25 @@ export default function createStyled(input = {}) {
|
|
|
80
83
|
slotShouldForwardProp = shouldForwardProp
|
|
81
84
|
} = input;
|
|
82
85
|
const systemSx = props => {
|
|
83
|
-
return styleFunctionSx({
|
|
84
|
-
|
|
85
|
-
theme: resolveTheme({
|
|
86
|
-
...props,
|
|
86
|
+
return styleFunctionSx(_extends({}, props, {
|
|
87
|
+
theme: resolveTheme(_extends({}, props, {
|
|
87
88
|
defaultTheme,
|
|
88
89
|
themeId
|
|
89
|
-
})
|
|
90
|
-
});
|
|
90
|
+
}))
|
|
91
|
+
}));
|
|
91
92
|
};
|
|
92
93
|
systemSx.__mui_systemSx = true;
|
|
93
94
|
return (tag, inputOptions = {}) => {
|
|
94
95
|
// Filter out the `sx` style function from the previous styled component to prevent unnecessary styles generated by the composite components.
|
|
95
96
|
processStyles(tag, styles => styles.filter(style => !(style != null && style.__mui_systemSx)));
|
|
96
97
|
const {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
name: componentName,
|
|
99
|
+
slot: componentSlot,
|
|
100
|
+
skipVariantsResolver: inputSkipVariantsResolver,
|
|
101
|
+
skipSx: inputSkipSx,
|
|
102
|
+
overridesResolver
|
|
103
|
+
} = inputOptions,
|
|
104
|
+
options = _objectWithoutPropertiesLoose(inputOptions, _excluded);
|
|
104
105
|
|
|
105
106
|
// if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
|
|
106
107
|
const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver : componentSlot && componentSlot !== 'Root' || false;
|
|
@@ -121,43 +122,38 @@ export default function createStyled(input = {}) {
|
|
|
121
122
|
// for string (html) tag, preserve the behavior in emotion & styled-components.
|
|
122
123
|
shouldForwardPropOption = undefined;
|
|
123
124
|
}
|
|
124
|
-
const defaultStyledResolver = styledEngineStyled(tag, {
|
|
125
|
+
const defaultStyledResolver = styledEngineStyled(tag, _extends({
|
|
125
126
|
shouldForwardProp: shouldForwardPropOption,
|
|
126
|
-
label
|
|
127
|
-
|
|
128
|
-
});
|
|
127
|
+
label
|
|
128
|
+
}, options));
|
|
129
129
|
const muiStyledResolver = (styleArg, ...expressions) => {
|
|
130
130
|
const expressionsWithDefaultTheme = expressions ? expressions.map(stylesArg => {
|
|
131
131
|
// On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
132
132
|
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
133
133
|
// which are basically components used as a selectors.
|
|
134
134
|
return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? props => {
|
|
135
|
-
return stylesArg({
|
|
136
|
-
|
|
137
|
-
theme: resolveTheme({
|
|
138
|
-
...props,
|
|
135
|
+
return stylesArg(_extends({}, props, {
|
|
136
|
+
theme: resolveTheme(_extends({}, props, {
|
|
139
137
|
defaultTheme,
|
|
140
138
|
themeId
|
|
141
|
-
})
|
|
142
|
-
});
|
|
139
|
+
}))
|
|
140
|
+
}));
|
|
143
141
|
} : stylesArg;
|
|
144
142
|
}) : [];
|
|
145
143
|
let transformedStyleArg = styleArg;
|
|
146
144
|
if (componentName && overridesResolver) {
|
|
147
145
|
expressionsWithDefaultTheme.push(props => {
|
|
148
|
-
const theme = resolveTheme({
|
|
149
|
-
...props,
|
|
146
|
+
const theme = resolveTheme(_extends({}, props, {
|
|
150
147
|
defaultTheme,
|
|
151
148
|
themeId
|
|
152
|
-
});
|
|
149
|
+
}));
|
|
153
150
|
const styleOverrides = getStyleOverrides(componentName, theme);
|
|
154
151
|
if (styleOverrides) {
|
|
155
152
|
const resolvedStyleOverrides = {};
|
|
156
153
|
Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => {
|
|
157
|
-
resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle({
|
|
158
|
-
...props,
|
|
154
|
+
resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle(_extends({}, props, {
|
|
159
155
|
theme
|
|
160
|
-
}) : slotStyle;
|
|
156
|
+
})) : slotStyle;
|
|
161
157
|
});
|
|
162
158
|
return overridesResolver(props, resolvedStyleOverrides);
|
|
163
159
|
}
|
|
@@ -166,11 +162,10 @@ export default function createStyled(input = {}) {
|
|
|
166
162
|
}
|
|
167
163
|
if (componentName && !skipVariantsResolver) {
|
|
168
164
|
expressionsWithDefaultTheme.push(props => {
|
|
169
|
-
const theme = resolveTheme({
|
|
170
|
-
...props,
|
|
165
|
+
const theme = resolveTheme(_extends({}, props, {
|
|
171
166
|
defaultTheme,
|
|
172
167
|
themeId
|
|
173
|
-
});
|
|
168
|
+
}));
|
|
174
169
|
return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
|
|
175
170
|
});
|
|
176
171
|
}
|
|
@@ -189,14 +184,12 @@ export default function createStyled(input = {}) {
|
|
|
189
184
|
// which are basically components used as a selectors.
|
|
190
185
|
styleArg.__emotion_real !== styleArg) {
|
|
191
186
|
// If the type is function, we need to define the default theme.
|
|
192
|
-
transformedStyleArg = props => styleArg({
|
|
193
|
-
|
|
194
|
-
theme: resolveTheme({
|
|
195
|
-
...props,
|
|
187
|
+
transformedStyleArg = props => styleArg(_extends({}, props, {
|
|
188
|
+
theme: resolveTheme(_extends({}, props, {
|
|
196
189
|
defaultTheme,
|
|
197
190
|
themeId
|
|
198
|
-
})
|
|
199
|
-
});
|
|
191
|
+
}))
|
|
192
|
+
}));
|
|
200
193
|
}
|
|
201
194
|
const Component = defaultStyledResolver(transformedStyleArg, ...expressionsWithDefaultTheme);
|
|
202
195
|
if (process.env.NODE_ENV !== 'production') {
|