@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,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = useCurrentColorScheme;
|
|
8
7
|
exports.getColorScheme = getColorScheme;
|
|
9
8
|
exports.getSystemMode = getSystemMode;
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
9
|
var React = _interopRequireWildcard(require("react"));
|
|
12
10
|
var _getInitColorSchemeScript = require("./getInitColorSchemeScript");
|
|
13
11
|
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); }
|
|
@@ -93,10 +91,11 @@ function useCurrentColorScheme(options) {
|
|
|
93
91
|
} catch (e) {
|
|
94
92
|
// Unsupported
|
|
95
93
|
}
|
|
96
|
-
return
|
|
94
|
+
return {
|
|
95
|
+
...currentState,
|
|
97
96
|
mode: newMode,
|
|
98
97
|
systemMode: getSystemMode(newMode)
|
|
99
|
-
}
|
|
98
|
+
};
|
|
100
99
|
});
|
|
101
100
|
}, [modeStorageKey, defaultMode]);
|
|
102
101
|
const setColorScheme = React.useCallback(value => {
|
|
@@ -108,17 +107,20 @@ function useCurrentColorScheme(options) {
|
|
|
108
107
|
} catch (e) {
|
|
109
108
|
// Unsupported
|
|
110
109
|
}
|
|
111
|
-
return
|
|
110
|
+
return {
|
|
111
|
+
...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 =
|
|
121
|
+
const newState = {
|
|
122
|
+
...currentState
|
|
123
|
+
};
|
|
122
124
|
processState(currentState, mode => {
|
|
123
125
|
try {
|
|
124
126
|
localStorage.setItem(`${colorSchemeStorageKey}-${mode}`, value);
|
|
@@ -137,7 +139,9 @@ function useCurrentColorScheme(options) {
|
|
|
137
139
|
}
|
|
138
140
|
} else {
|
|
139
141
|
setState(currentState => {
|
|
140
|
-
const newState =
|
|
142
|
+
const newState = {
|
|
143
|
+
...currentState
|
|
144
|
+
};
|
|
141
145
|
const newLightColorScheme = value.light === null ? defaultLightColorScheme : value.light;
|
|
142
146
|
const newDarkColorScheme = value.dark === null ? defaultDarkColorScheme : value.dark;
|
|
143
147
|
if (newLightColorScheme) {
|
|
@@ -170,7 +174,8 @@ function useCurrentColorScheme(options) {
|
|
|
170
174
|
}, [joinedColorSchemes, colorSchemeStorageKey, defaultLightColorScheme, defaultDarkColorScheme]);
|
|
171
175
|
const handleMediaQuery = React.useCallback(e => {
|
|
172
176
|
if (state.mode === 'system') {
|
|
173
|
-
setState(currentState => (
|
|
177
|
+
setState(currentState => ({
|
|
178
|
+
...currentState,
|
|
174
179
|
systemMode: e != null && e.matches ? 'dark' : 'light'
|
|
175
180
|
}));
|
|
176
181
|
}
|
|
@@ -219,9 +224,10 @@ function useCurrentColorScheme(options) {
|
|
|
219
224
|
}
|
|
220
225
|
return undefined;
|
|
221
226
|
}, [setColorScheme, setMode, modeStorageKey, colorSchemeStorageKey, joinedColorSchemes, defaultMode, storageWindow]);
|
|
222
|
-
return
|
|
227
|
+
return {
|
|
228
|
+
...state,
|
|
223
229
|
colorScheme,
|
|
224
230
|
setMode,
|
|
225
231
|
setColorScheme
|
|
226
|
-
}
|
|
232
|
+
};
|
|
227
233
|
}
|
|
@@ -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/esm/Stack/createStack.js
CHANGED
|
@@ -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';
|
|
@@ -56,20 +53,20 @@ export default function createGrid(options = {}) {
|
|
|
56
53
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
57
54
|
const overflow = React.useContext(OverflowContext);
|
|
58
55
|
const {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
56
|
+
className,
|
|
57
|
+
children,
|
|
58
|
+
columns: columnsProp = 12,
|
|
59
|
+
container = false,
|
|
60
|
+
component = 'div',
|
|
61
|
+
direction = 'row',
|
|
62
|
+
wrap = 'wrap',
|
|
63
|
+
spacing: spacingProp = 0,
|
|
64
|
+
rowSpacing: rowSpacingProp = spacingProp,
|
|
65
|
+
columnSpacing: columnSpacingProp = spacingProp,
|
|
66
|
+
disableEqualOverflow: themeDisableEqualOverflow,
|
|
67
|
+
unstable_level: level = 0,
|
|
68
|
+
...rest
|
|
69
|
+
} = props;
|
|
73
70
|
// Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
|
|
74
71
|
let disableEqualOverflow = themeDisableEqualOverflow;
|
|
75
72
|
if (level && themeDisableEqualOverflow !== undefined) {
|
|
@@ -92,7 +89,8 @@ export default function createGrid(options = {}) {
|
|
|
92
89
|
const spacing = (_inProps$spacing = inProps.spacing) != null ? _inProps$spacing : level ? undefined : spacingProp;
|
|
93
90
|
const rowSpacing = (_ref = (_inProps$rowSpacing = inProps.rowSpacing) != null ? _inProps$rowSpacing : inProps.spacing) != null ? _ref : level ? undefined : rowSpacingProp;
|
|
94
91
|
const columnSpacing = (_ref2 = (_inProps$columnSpacin = inProps.columnSpacing) != null ? _inProps$columnSpacin : inProps.spacing) != null ? _ref2 : level ? undefined : columnSpacingProp;
|
|
95
|
-
const ownerState =
|
|
92
|
+
const ownerState = {
|
|
93
|
+
...props,
|
|
96
94
|
level,
|
|
97
95
|
columns,
|
|
98
96
|
container,
|
|
@@ -106,15 +104,15 @@ export default function createGrid(options = {}) {
|
|
|
106
104
|
disableEqualOverflow: (_ref3 = (_disableEqualOverflow = disableEqualOverflow) != null ? _disableEqualOverflow : overflow) != null ? _ref3 : false,
|
|
107
105
|
// use context value if exists.
|
|
108
106
|
parentDisableEqualOverflow: overflow // for nested grid
|
|
109
|
-
}
|
|
107
|
+
};
|
|
110
108
|
|
|
111
109
|
const classes = useUtilityClasses(ownerState, theme);
|
|
112
|
-
let result = /*#__PURE__*/_jsx(GridRoot,
|
|
110
|
+
let result = /*#__PURE__*/_jsx(GridRoot, {
|
|
113
111
|
ref: ref,
|
|
114
112
|
as: component,
|
|
115
113
|
ownerState: ownerState,
|
|
116
|
-
className: clsx(classes.root, className)
|
|
117
|
-
|
|
114
|
+
className: clsx(classes.root, className),
|
|
115
|
+
...other,
|
|
118
116
|
children: React.Children.map(children, child => {
|
|
119
117
|
if ( /*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
|
|
120
118
|
var _child$props$unstable;
|
|
@@ -124,7 +122,7 @@ export default function createGrid(options = {}) {
|
|
|
124
122
|
}
|
|
125
123
|
return child;
|
|
126
124
|
})
|
|
127
|
-
})
|
|
125
|
+
});
|
|
128
126
|
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
|
|
129
127
|
// There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
|
|
130
128
|
// 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 '';
|
|
@@ -206,23 +205,27 @@ export const generateGridStyles = ({
|
|
|
206
205
|
}) => {
|
|
207
206
|
const getSelfSpacing = createGetSelfSpacing(ownerState);
|
|
208
207
|
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
209
|
-
return
|
|
208
|
+
return {
|
|
210
209
|
minWidth: 0,
|
|
211
|
-
boxSizing: 'border-box'
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
210
|
+
boxSizing: 'border-box',
|
|
211
|
+
...(ownerState.container && {
|
|
212
|
+
display: 'flex',
|
|
213
|
+
flexWrap: 'wrap',
|
|
214
|
+
...(ownerState.wrap && ownerState.wrap !== 'wrap' && {
|
|
215
|
+
flexWrap: ownerState.wrap
|
|
216
|
+
}),
|
|
217
|
+
margin: `calc(${getSelfSpacing('row')} / -2) calc(${getSelfSpacing('column')} / -2)`,
|
|
218
|
+
...(ownerState.disableEqualOverflow && {
|
|
219
|
+
margin: `calc(${getSelfSpacing('row')} * -1) 0px 0px calc(${getSelfSpacing('column')} * -1)`
|
|
220
|
+
})
|
|
221
|
+
}),
|
|
222
|
+
...((!ownerState.container || isNestedContainer(ownerState)) && {
|
|
223
|
+
padding: `calc(${getParentSpacing('row')} / 2) calc(${getParentSpacing('column')} / 2)`,
|
|
224
|
+
...((ownerState.disableEqualOverflow || ownerState.parentDisableEqualOverflow) && {
|
|
225
|
+
padding: `${getParentSpacing('row')} 0px 0px ${getParentSpacing('column')}`
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
};
|
|
226
229
|
};
|
|
227
230
|
export const generateSizeClassNames = gridSize => {
|
|
228
231
|
const classNames = [];
|
package/esm/breakpoints.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
2
|
import { deepmerge } from '@mui/utils';
|
|
4
3
|
import merge from './merge';
|
|
@@ -59,21 +58,23 @@ function breakpoints(styleFunction) {
|
|
|
59
58
|
const extended = themeBreakpoints.keys.reduce((acc, key) => {
|
|
60
59
|
if (props[key]) {
|
|
61
60
|
acc = acc || {};
|
|
62
|
-
acc[themeBreakpoints.up(key)] = styleFunction(
|
|
63
|
-
theme
|
|
64
|
-
|
|
61
|
+
acc[themeBreakpoints.up(key)] = styleFunction({
|
|
62
|
+
theme,
|
|
63
|
+
...props[key]
|
|
64
|
+
});
|
|
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' ?
|
|
70
|
+
newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? {
|
|
71
|
+
...styleFunction.propTypes,
|
|
71
72
|
xs: PropTypes.object,
|
|
72
73
|
sm: PropTypes.object,
|
|
73
74
|
md: PropTypes.object,
|
|
74
75
|
lg: PropTypes.object,
|
|
75
76
|
xl: PropTypes.object
|
|
76
|
-
}
|
|
77
|
+
} : {};
|
|
77
78
|
newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl', ...styleFunction.filterProps];
|
|
78
79
|
return newStyleFunction;
|
|
79
80
|
}
|
package/esm/createBox.js
CHANGED
|
@@ -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", "component"];
|
|
4
1
|
import * as React from 'react';
|
|
5
2
|
import clsx from 'clsx';
|
|
6
3
|
import styled from '@mui/styled-engine';
|
|
@@ -19,18 +16,18 @@ export default function createBox(options = {}) {
|
|
|
19
16
|
})(styleFunctionSx);
|
|
20
17
|
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
21
18
|
const theme = useTheme(defaultTheme);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return /*#__PURE__*/_jsx(BoxRoot, _extends({
|
|
19
|
+
const {
|
|
20
|
+
className,
|
|
21
|
+
component = 'div',
|
|
22
|
+
...other
|
|
23
|
+
} = extendSxProp(inProps);
|
|
24
|
+
return /*#__PURE__*/_jsx(BoxRoot, {
|
|
29
25
|
as: component,
|
|
30
26
|
ref: ref,
|
|
31
27
|
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
32
|
-
theme: themeId ? theme[themeId] || theme : theme
|
|
33
|
-
|
|
28
|
+
theme: themeId ? theme[themeId] || theme : theme,
|
|
29
|
+
...other
|
|
30
|
+
});
|
|
34
31
|
});
|
|
35
32
|
return Box;
|
|
36
33
|
}
|
package/esm/createStyled.js
CHANGED
|
@@ -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 = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
|
|
4
1
|
/* eslint-disable no-underscore-dangle */
|
|
5
2
|
import styledEngineStyled, { internal_processStyles as processStyles } from '@mui/styled-engine';
|
|
6
3
|
import { getDisplayName } from '@mui/utils';
|
|
@@ -83,25 +80,27 @@ export default function createStyled(input = {}) {
|
|
|
83
80
|
slotShouldForwardProp = shouldForwardProp
|
|
84
81
|
} = input;
|
|
85
82
|
const systemSx = props => {
|
|
86
|
-
return styleFunctionSx(
|
|
87
|
-
|
|
83
|
+
return styleFunctionSx({
|
|
84
|
+
...props,
|
|
85
|
+
theme: resolveTheme({
|
|
86
|
+
...props,
|
|
88
87
|
defaultTheme,
|
|
89
88
|
themeId
|
|
90
|
-
})
|
|
91
|
-
})
|
|
89
|
+
})
|
|
90
|
+
});
|
|
92
91
|
};
|
|
93
92
|
systemSx.__mui_systemSx = true;
|
|
94
93
|
return (tag, inputOptions = {}) => {
|
|
95
94
|
// Filter out the `sx` style function from the previous styled component to prevent unnecessary styles generated by the composite components.
|
|
96
95
|
processStyles(tag, styles => styles.filter(style => !(style != null && style.__mui_systemSx)));
|
|
97
96
|
const {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
name: componentName,
|
|
98
|
+
slot: componentSlot,
|
|
99
|
+
skipVariantsResolver: inputSkipVariantsResolver,
|
|
100
|
+
skipSx: inputSkipSx,
|
|
101
|
+
overridesResolver,
|
|
102
|
+
...options
|
|
103
|
+
} = inputOptions;
|
|
105
104
|
|
|
106
105
|
// if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
|
|
107
106
|
const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver : componentSlot && componentSlot !== 'Root' || false;
|
|
@@ -122,38 +121,43 @@ export default function createStyled(input = {}) {
|
|
|
122
121
|
// for string (html) tag, preserve the behavior in emotion & styled-components.
|
|
123
122
|
shouldForwardPropOption = undefined;
|
|
124
123
|
}
|
|
125
|
-
const defaultStyledResolver = styledEngineStyled(tag,
|
|
124
|
+
const defaultStyledResolver = styledEngineStyled(tag, {
|
|
126
125
|
shouldForwardProp: shouldForwardPropOption,
|
|
127
|
-
label
|
|
128
|
-
|
|
126
|
+
label,
|
|
127
|
+
...options
|
|
128
|
+
});
|
|
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
|
-
|
|
135
|
+
return stylesArg({
|
|
136
|
+
...props,
|
|
137
|
+
theme: resolveTheme({
|
|
138
|
+
...props,
|
|
137
139
|
defaultTheme,
|
|
138
140
|
themeId
|
|
139
|
-
})
|
|
140
|
-
})
|
|
141
|
+
})
|
|
142
|
+
});
|
|
141
143
|
} : stylesArg;
|
|
142
144
|
}) : [];
|
|
143
145
|
let transformedStyleArg = styleArg;
|
|
144
146
|
if (componentName && overridesResolver) {
|
|
145
147
|
expressionsWithDefaultTheme.push(props => {
|
|
146
|
-
const theme = resolveTheme(
|
|
148
|
+
const theme = resolveTheme({
|
|
149
|
+
...props,
|
|
147
150
|
defaultTheme,
|
|
148
151
|
themeId
|
|
149
|
-
})
|
|
152
|
+
});
|
|
150
153
|
const styleOverrides = getStyleOverrides(componentName, theme);
|
|
151
154
|
if (styleOverrides) {
|
|
152
155
|
const resolvedStyleOverrides = {};
|
|
153
156
|
Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => {
|
|
154
|
-
resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle(
|
|
157
|
+
resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle({
|
|
158
|
+
...props,
|
|
155
159
|
theme
|
|
156
|
-
})
|
|
160
|
+
}) : slotStyle;
|
|
157
161
|
});
|
|
158
162
|
return overridesResolver(props, resolvedStyleOverrides);
|
|
159
163
|
}
|
|
@@ -162,10 +166,11 @@ export default function createStyled(input = {}) {
|
|
|
162
166
|
}
|
|
163
167
|
if (componentName && !skipVariantsResolver) {
|
|
164
168
|
expressionsWithDefaultTheme.push(props => {
|
|
165
|
-
const theme = resolveTheme(
|
|
169
|
+
const theme = resolveTheme({
|
|
170
|
+
...props,
|
|
166
171
|
defaultTheme,
|
|
167
172
|
themeId
|
|
168
|
-
})
|
|
173
|
+
});
|
|
169
174
|
return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
|
|
170
175
|
});
|
|
171
176
|
}
|
|
@@ -184,12 +189,14 @@ export default function createStyled(input = {}) {
|
|
|
184
189
|
// which are basically components used as a selectors.
|
|
185
190
|
styleArg.__emotion_real !== styleArg) {
|
|
186
191
|
// If the type is function, we need to define the default theme.
|
|
187
|
-
transformedStyleArg = props => styleArg(
|
|
188
|
-
|
|
192
|
+
transformedStyleArg = props => styleArg({
|
|
193
|
+
...props,
|
|
194
|
+
theme: resolveTheme({
|
|
195
|
+
...props,
|
|
189
196
|
defaultTheme,
|
|
190
197
|
themeId
|
|
191
|
-
})
|
|
192
|
-
})
|
|
198
|
+
})
|
|
199
|
+
});
|
|
193
200
|
}
|
|
194
201
|
const Component = defaultStyledResolver(transformedStyleArg, ...expressionsWithDefaultTheme);
|
|
195
202
|
if (process.env.NODE_ENV !== 'production') {
|