@mui/system 5.10.17 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Box/Box.spec.d.ts +1 -1
- package/CHANGELOG.md +74 -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/Stack/Stack.d.ts +13 -13
- package/Stack/StackProps.d.ts +42 -42
- package/Stack/createStack.d.ts +21 -21
- package/Stack/index.d.ts +5 -5
- package/Stack/stackClasses.d.ts +8 -8
- package/Unstable_Grid/Grid.d.ts +12 -12
- package/Unstable_Grid/GridProps.d.ts +162 -162
- package/Unstable_Grid/createGrid.d.ts +11 -11
- package/Unstable_Grid/gridClasses.d.ts +20 -20
- package/Unstable_Grid/gridGenerator.d.ts +29 -29
- package/Unstable_Grid/index.d.ts +5 -5
- package/borders.js +12 -7
- package/breakpoints.js +2 -0
- package/compose.js +3 -0
- package/createBox.d.ts +0 -2
- package/createBox.js +2 -3
- package/createBox.spec.d.ts +1 -1
- package/createStyled.js +2 -3
- package/createTheme/createSpacing.d.ts +10 -10
- package/createTheme/createTheme.d.ts +5 -0
- package/createTheme/createTheme.js +9 -0
- package/cssGrid.js +8 -0
- package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/cssVarsParser.d.ts +63 -63
- package/cssVars/getInitColorSchemeScript.d.ts +42 -42
- package/cssVars/index.d.ts +3 -3
- package/cssVars/useCurrentColorScheme.d.ts +53 -53
- package/esm/borders.js +9 -6
- package/esm/breakpoints.js +2 -0
- package/esm/compose.js +3 -0
- package/esm/createBox.js +2 -3
- package/esm/createStyled.js +2 -3
- package/esm/createTheme/createTheme.js +9 -0
- package/esm/cssGrid.js +9 -0
- package/esm/index.js +1 -2
- package/esm/palette.js +4 -4
- package/esm/sizing.js +9 -9
- package/esm/spacing.js +2 -2
- package/esm/style.js +4 -1
- package/esm/styleFunctionSx/defaultSxConfig.js +284 -0
- package/esm/styleFunctionSx/extendSxProp.js +4 -2
- package/esm/styleFunctionSx/index.js +2 -1
- package/esm/styleFunctionSx/styleFunctionSx.js +45 -17
- package/index.d.ts +1 -2
- package/index.js +8 -9
- package/index.spec.d.ts +1 -1
- package/legacy/borders.js +9 -6
- package/legacy/breakpoints.js +2 -0
- package/legacy/compose.js +3 -0
- package/legacy/createBox.js +2 -4
- package/legacy/createStyled.js +2 -4
- package/legacy/createTheme/createTheme.js +9 -0
- package/legacy/cssGrid.js +9 -0
- package/legacy/index.js +2 -3
- package/legacy/palette.js +4 -4
- package/legacy/sizing.js +9 -9
- package/legacy/spacing.js +2 -2
- package/legacy/style.js +3 -2
- package/legacy/styleFunctionSx/defaultSxConfig.js +286 -0
- package/legacy/styleFunctionSx/extendSxProp.js +4 -2
- package/legacy/styleFunctionSx/index.js +2 -1
- package/legacy/styleFunctionSx/styleFunctionSx.js +44 -20
- package/modern/borders.js +9 -6
- package/modern/breakpoints.js +2 -0
- package/modern/compose.js +3 -0
- package/modern/createBox.js +2 -3
- package/modern/createStyled.js +2 -3
- package/modern/createTheme/createTheme.js +9 -0
- package/modern/cssGrid.js +9 -0
- package/modern/index.js +2 -3
- package/modern/palette.js +4 -4
- package/modern/sizing.js +9 -9
- package/modern/spacing.js +2 -2
- package/modern/style.js +4 -1
- package/modern/styleFunctionSx/defaultSxConfig.js +284 -0
- package/modern/styleFunctionSx/extendSxProp.js +3 -2
- package/modern/styleFunctionSx/index.js +2 -1
- package/modern/styleFunctionSx/styleFunctionSx.js +44 -17
- package/package.json +6 -6
- package/palette.js +5 -4
- package/sizing.js +12 -10
- package/spacing.js +4 -0
- package/style.d.ts +10 -8
- package/style.js +4 -1
- package/styleFunctionSx/defaultSxConfig.d.ts +20 -0
- package/styleFunctionSx/defaultSxConfig.js +291 -0
- package/styleFunctionSx/extendSxProp.js +4 -2
- package/styleFunctionSx/index.d.ts +4 -0
- package/styleFunctionSx/index.js +7 -0
- package/styleFunctionSx/styleFunctionSx.d.ts +2 -1
- package/styleFunctionSx/styleFunctionSx.js +45 -17
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
- package/esm/sx/index.js +0 -1
- package/esm/sx/sx.js +0 -10
- package/legacy/sx/index.js +0 -1
- package/legacy/sx/sx.js +0 -11
- package/modern/sx/index.js +0 -1
- package/modern/sx/sx.js +0 -10
- package/sx/index.d.ts +0 -1
- package/sx/index.js +0 -13
- package/sx/package.json +0 -6
- package/sx/sx.d.ts +0 -4
- package/sx/sx.js +0 -18
|
@@ -4,6 +4,8 @@ import { deepmerge } from '@mui/utils';
|
|
|
4
4
|
import createBreakpoints from './createBreakpoints';
|
|
5
5
|
import shape from './shape';
|
|
6
6
|
import createSpacing from './createSpacing';
|
|
7
|
+
import styleFunctionSx from '../styleFunctionSx/styleFunctionSx';
|
|
8
|
+
import defaultSxConfig from '../styleFunctionSx/defaultSxConfig';
|
|
7
9
|
function createTheme() {
|
|
8
10
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
11
|
var _options$breakpoints = options.breakpoints,
|
|
@@ -33,6 +35,13 @@ function createTheme() {
|
|
|
33
35
|
muiTheme = args.reduce(function (acc, argument) {
|
|
34
36
|
return deepmerge(acc, argument);
|
|
35
37
|
}, muiTheme);
|
|
38
|
+
muiTheme.unstable_sxConfig = _extends({}, defaultSxConfig, other == null ? void 0 : other.unstable_sxConfig);
|
|
39
|
+
muiTheme.unstable_sx = function sx(props) {
|
|
40
|
+
return styleFunctionSx({
|
|
41
|
+
sx: props,
|
|
42
|
+
theme: this
|
|
43
|
+
});
|
|
44
|
+
};
|
|
36
45
|
return muiTheme;
|
|
37
46
|
}
|
|
38
47
|
export default createTheme;
|
package/legacy/cssGrid.js
CHANGED
|
@@ -3,6 +3,9 @@ import compose from './compose';
|
|
|
3
3
|
import { createUnaryUnit, getValue } from './spacing';
|
|
4
4
|
import { handleBreakpoints } from './breakpoints';
|
|
5
5
|
import responsivePropType from './responsivePropType';
|
|
6
|
+
|
|
7
|
+
// false positive
|
|
8
|
+
// eslint-disable-next-line react/function-component-definition
|
|
6
9
|
export var gap = function gap(props) {
|
|
7
10
|
if (props.gap !== undefined && props.gap !== null) {
|
|
8
11
|
var transformer = createUnaryUnit(props.theme, 'spacing', 8, 'gap');
|
|
@@ -19,6 +22,9 @@ gap.propTypes = process.env.NODE_ENV !== 'production' ? {
|
|
|
19
22
|
gap: responsivePropType
|
|
20
23
|
} : {};
|
|
21
24
|
gap.filterProps = ['gap'];
|
|
25
|
+
|
|
26
|
+
// false positive
|
|
27
|
+
// eslint-disable-next-line react/function-component-definition
|
|
22
28
|
export var columnGap = function columnGap(props) {
|
|
23
29
|
if (props.columnGap !== undefined && props.columnGap !== null) {
|
|
24
30
|
var transformer = createUnaryUnit(props.theme, 'spacing', 8, 'columnGap');
|
|
@@ -35,6 +41,9 @@ columnGap.propTypes = process.env.NODE_ENV !== 'production' ? {
|
|
|
35
41
|
columnGap: responsivePropType
|
|
36
42
|
} : {};
|
|
37
43
|
columnGap.filterProps = ['columnGap'];
|
|
44
|
+
|
|
45
|
+
// false positive
|
|
46
|
+
// eslint-disable-next-line react/function-component-definition
|
|
38
47
|
export var rowGap = function rowGap(props) {
|
|
39
48
|
if (props.rowGap !== undefined && props.rowGap !== null) {
|
|
40
49
|
var transformer = createUnaryUnit(props.theme, 'spacing', 8, 'rowGap');
|
package/legacy/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.11.0
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -26,8 +26,7 @@ export * from './spacing';
|
|
|
26
26
|
export { default as style, getPath, getStyleValue } from './style';
|
|
27
27
|
export { default as typography } from './typography';
|
|
28
28
|
export * from './typography';
|
|
29
|
-
export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp } from './styleFunctionSx';
|
|
30
|
-
export { default as experimental_sx } from './sx';
|
|
29
|
+
export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp, unstable_defaultSxConfig } from './styleFunctionSx';
|
|
31
30
|
export { default as unstable_getThemeValue } from './getThemeValue';
|
|
32
31
|
export { default as Box } from './Box';
|
|
33
32
|
export { default as createBox } from './createBox';
|
package/legacy/palette.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import style from './style';
|
|
2
2
|
import compose from './compose';
|
|
3
|
-
function
|
|
3
|
+
export function paletteTransform(value, userValue) {
|
|
4
4
|
if (userValue === 'grey') {
|
|
5
5
|
return userValue;
|
|
6
6
|
}
|
|
@@ -9,18 +9,18 @@ function transform(value, userValue) {
|
|
|
9
9
|
export var color = style({
|
|
10
10
|
prop: 'color',
|
|
11
11
|
themeKey: 'palette',
|
|
12
|
-
transform:
|
|
12
|
+
transform: paletteTransform
|
|
13
13
|
});
|
|
14
14
|
export var bgcolor = style({
|
|
15
15
|
prop: 'bgcolor',
|
|
16
16
|
cssProperty: 'backgroundColor',
|
|
17
17
|
themeKey: 'palette',
|
|
18
|
-
transform:
|
|
18
|
+
transform: paletteTransform
|
|
19
19
|
});
|
|
20
20
|
export var backgroundColor = style({
|
|
21
21
|
prop: 'backgroundColor',
|
|
22
22
|
themeKey: 'palette',
|
|
23
|
-
transform:
|
|
23
|
+
transform: paletteTransform
|
|
24
24
|
});
|
|
25
25
|
var palette = compose(color, bgcolor, backgroundColor);
|
|
26
26
|
export default palette;
|
package/legacy/sizing.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import style from './style';
|
|
2
2
|
import compose from './compose';
|
|
3
3
|
import { handleBreakpoints, values as breakpointsValues } from './breakpoints';
|
|
4
|
-
function
|
|
4
|
+
export function sizingTransform(value) {
|
|
5
5
|
return value <= 1 && value !== 0 ? "".concat(value * 100, "%") : value;
|
|
6
6
|
}
|
|
7
7
|
export var width = style({
|
|
8
8
|
prop: 'width',
|
|
9
|
-
transform:
|
|
9
|
+
transform: sizingTransform
|
|
10
10
|
});
|
|
11
11
|
export var maxWidth = function maxWidth(props) {
|
|
12
12
|
if (props.maxWidth !== undefined && props.maxWidth !== null) {
|
|
@@ -14,7 +14,7 @@ export var maxWidth = function maxWidth(props) {
|
|
|
14
14
|
var _props$theme, _props$theme$breakpoi, _props$theme$breakpoi2;
|
|
15
15
|
var breakpoint = ((_props$theme = props.theme) == null ? void 0 : (_props$theme$breakpoi = _props$theme.breakpoints) == null ? void 0 : (_props$theme$breakpoi2 = _props$theme$breakpoi.values) == null ? void 0 : _props$theme$breakpoi2[propValue]) || breakpointsValues[propValue];
|
|
16
16
|
return {
|
|
17
|
-
maxWidth: breakpoint ||
|
|
17
|
+
maxWidth: breakpoint || sizingTransform(propValue)
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
return handleBreakpoints(props, props.maxWidth, styleFromPropValue);
|
|
@@ -24,29 +24,29 @@ export var maxWidth = function maxWidth(props) {
|
|
|
24
24
|
maxWidth.filterProps = ['maxWidth'];
|
|
25
25
|
export var minWidth = style({
|
|
26
26
|
prop: 'minWidth',
|
|
27
|
-
transform:
|
|
27
|
+
transform: sizingTransform
|
|
28
28
|
});
|
|
29
29
|
export var height = style({
|
|
30
30
|
prop: 'height',
|
|
31
|
-
transform:
|
|
31
|
+
transform: sizingTransform
|
|
32
32
|
});
|
|
33
33
|
export var maxHeight = style({
|
|
34
34
|
prop: 'maxHeight',
|
|
35
|
-
transform:
|
|
35
|
+
transform: sizingTransform
|
|
36
36
|
});
|
|
37
37
|
export var minHeight = style({
|
|
38
38
|
prop: 'minHeight',
|
|
39
|
-
transform:
|
|
39
|
+
transform: sizingTransform
|
|
40
40
|
});
|
|
41
41
|
export var sizeWidth = style({
|
|
42
42
|
prop: 'size',
|
|
43
43
|
cssProperty: 'width',
|
|
44
|
-
transform:
|
|
44
|
+
transform: sizingTransform
|
|
45
45
|
});
|
|
46
46
|
export var sizeHeight = style({
|
|
47
47
|
prop: 'size',
|
|
48
48
|
cssProperty: 'height',
|
|
49
|
-
transform:
|
|
49
|
+
transform: sizingTransform
|
|
50
50
|
});
|
|
51
51
|
export var boxSizing = style({
|
|
52
52
|
prop: 'boxSizing'
|
package/legacy/spacing.js
CHANGED
|
@@ -45,8 +45,8 @@ var getCssProperties = memoize(function (prop) {
|
|
|
45
45
|
return property + dir;
|
|
46
46
|
}) : [property + direction];
|
|
47
47
|
});
|
|
48
|
-
var marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd'];
|
|
49
|
-
var paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
|
|
48
|
+
export var marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd'];
|
|
49
|
+
export var paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
|
|
50
50
|
var spacingKeys = [].concat(marginKeys, paddingKeys);
|
|
51
51
|
export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
52
52
|
var _getPath;
|
package/legacy/style.js
CHANGED
|
@@ -35,7 +35,7 @@ export function getStyleValue(themeMapping, transform, propValueFinal) {
|
|
|
35
35
|
value = getPath(themeMapping, propValueFinal) || userValue;
|
|
36
36
|
}
|
|
37
37
|
if (transform) {
|
|
38
|
-
value = transform(value, userValue);
|
|
38
|
+
value = transform(value, userValue, themeMapping);
|
|
39
39
|
}
|
|
40
40
|
return value;
|
|
41
41
|
}
|
|
@@ -44,7 +44,8 @@ function style(options) {
|
|
|
44
44
|
_options$cssProperty = options.cssProperty,
|
|
45
45
|
cssProperty = _options$cssProperty === void 0 ? options.prop : _options$cssProperty,
|
|
46
46
|
themeKey = options.themeKey,
|
|
47
|
-
transform = options.transform;
|
|
47
|
+
transform = options.transform; // false positive
|
|
48
|
+
// eslint-disable-next-line react/function-component-definition
|
|
48
49
|
var fn = function fn(props) {
|
|
49
50
|
if (props[prop] == null) {
|
|
50
51
|
return null;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { padding, margin } from '../spacing';
|
|
2
|
+
import { borderRadius, borderTransform } from '../borders';
|
|
3
|
+
import { gap, rowGap, columnGap } from '../cssGrid';
|
|
4
|
+
import { paletteTransform } from '../palette';
|
|
5
|
+
import { maxWidth, sizingTransform } from '../sizing';
|
|
6
|
+
var defaultSxConfig = {
|
|
7
|
+
// borders
|
|
8
|
+
border: {
|
|
9
|
+
themeKey: 'borders',
|
|
10
|
+
transform: borderTransform
|
|
11
|
+
},
|
|
12
|
+
borderTop: {
|
|
13
|
+
themeKey: 'borders',
|
|
14
|
+
transform: borderTransform
|
|
15
|
+
},
|
|
16
|
+
borderRight: {
|
|
17
|
+
themeKey: 'borders',
|
|
18
|
+
transform: borderTransform
|
|
19
|
+
},
|
|
20
|
+
borderBottom: {
|
|
21
|
+
themeKey: 'borders',
|
|
22
|
+
transform: borderTransform
|
|
23
|
+
},
|
|
24
|
+
borderLeft: {
|
|
25
|
+
themeKey: 'borders',
|
|
26
|
+
transform: borderTransform
|
|
27
|
+
},
|
|
28
|
+
borderColor: {
|
|
29
|
+
themeKey: 'palette'
|
|
30
|
+
},
|
|
31
|
+
borderTopColor: {
|
|
32
|
+
themeKey: 'palette'
|
|
33
|
+
},
|
|
34
|
+
borderRightColor: {
|
|
35
|
+
themeKey: 'palette'
|
|
36
|
+
},
|
|
37
|
+
borderBottomColor: {
|
|
38
|
+
themeKey: 'palette'
|
|
39
|
+
},
|
|
40
|
+
borderLeftColor: {
|
|
41
|
+
themeKey: 'palette'
|
|
42
|
+
},
|
|
43
|
+
borderRadius: {
|
|
44
|
+
themeKey: 'shape.borderRadius',
|
|
45
|
+
style: borderRadius
|
|
46
|
+
},
|
|
47
|
+
// palette
|
|
48
|
+
color: {
|
|
49
|
+
themeKey: 'palette',
|
|
50
|
+
transform: paletteTransform
|
|
51
|
+
},
|
|
52
|
+
bgcolor: {
|
|
53
|
+
themeKey: 'palette',
|
|
54
|
+
cssProperty: 'backgroundColor',
|
|
55
|
+
transform: paletteTransform
|
|
56
|
+
},
|
|
57
|
+
backgroundColor: {
|
|
58
|
+
themeKey: 'palette',
|
|
59
|
+
transform: paletteTransform
|
|
60
|
+
},
|
|
61
|
+
// spacing
|
|
62
|
+
p: {
|
|
63
|
+
style: padding
|
|
64
|
+
},
|
|
65
|
+
pt: {
|
|
66
|
+
style: padding
|
|
67
|
+
},
|
|
68
|
+
pr: {
|
|
69
|
+
style: padding
|
|
70
|
+
},
|
|
71
|
+
pb: {
|
|
72
|
+
style: padding
|
|
73
|
+
},
|
|
74
|
+
pl: {
|
|
75
|
+
style: padding
|
|
76
|
+
},
|
|
77
|
+
px: {
|
|
78
|
+
style: padding
|
|
79
|
+
},
|
|
80
|
+
py: {
|
|
81
|
+
style: padding
|
|
82
|
+
},
|
|
83
|
+
padding: {
|
|
84
|
+
style: padding
|
|
85
|
+
},
|
|
86
|
+
paddingTop: {
|
|
87
|
+
style: padding
|
|
88
|
+
},
|
|
89
|
+
paddingRight: {
|
|
90
|
+
style: padding
|
|
91
|
+
},
|
|
92
|
+
paddingBottom: {
|
|
93
|
+
style: padding
|
|
94
|
+
},
|
|
95
|
+
paddingLeft: {
|
|
96
|
+
style: padding
|
|
97
|
+
},
|
|
98
|
+
paddingX: {
|
|
99
|
+
style: padding
|
|
100
|
+
},
|
|
101
|
+
paddingY: {
|
|
102
|
+
style: padding
|
|
103
|
+
},
|
|
104
|
+
paddingInline: {
|
|
105
|
+
style: padding
|
|
106
|
+
},
|
|
107
|
+
paddingInlineStart: {
|
|
108
|
+
style: padding
|
|
109
|
+
},
|
|
110
|
+
paddingInlineEnd: {
|
|
111
|
+
style: padding
|
|
112
|
+
},
|
|
113
|
+
paddingBlock: {
|
|
114
|
+
style: padding
|
|
115
|
+
},
|
|
116
|
+
paddingBlockStart: {
|
|
117
|
+
style: padding
|
|
118
|
+
},
|
|
119
|
+
paddingBlockEnd: {
|
|
120
|
+
style: padding
|
|
121
|
+
},
|
|
122
|
+
m: {
|
|
123
|
+
style: margin
|
|
124
|
+
},
|
|
125
|
+
mt: {
|
|
126
|
+
style: margin
|
|
127
|
+
},
|
|
128
|
+
mr: {
|
|
129
|
+
style: margin
|
|
130
|
+
},
|
|
131
|
+
mb: {
|
|
132
|
+
style: margin
|
|
133
|
+
},
|
|
134
|
+
ml: {
|
|
135
|
+
style: margin
|
|
136
|
+
},
|
|
137
|
+
mx: {
|
|
138
|
+
style: margin
|
|
139
|
+
},
|
|
140
|
+
my: {
|
|
141
|
+
style: margin
|
|
142
|
+
},
|
|
143
|
+
margin: {
|
|
144
|
+
style: margin
|
|
145
|
+
},
|
|
146
|
+
marginTop: {
|
|
147
|
+
style: margin
|
|
148
|
+
},
|
|
149
|
+
marginRight: {
|
|
150
|
+
style: margin
|
|
151
|
+
},
|
|
152
|
+
marginBottom: {
|
|
153
|
+
style: margin
|
|
154
|
+
},
|
|
155
|
+
marginLeft: {
|
|
156
|
+
style: margin
|
|
157
|
+
},
|
|
158
|
+
marginX: {
|
|
159
|
+
style: margin
|
|
160
|
+
},
|
|
161
|
+
marginY: {
|
|
162
|
+
style: margin
|
|
163
|
+
},
|
|
164
|
+
marginInline: {
|
|
165
|
+
style: margin
|
|
166
|
+
},
|
|
167
|
+
marginInlineStart: {
|
|
168
|
+
style: margin
|
|
169
|
+
},
|
|
170
|
+
marginInlineEnd: {
|
|
171
|
+
style: margin
|
|
172
|
+
},
|
|
173
|
+
marginBlock: {
|
|
174
|
+
style: margin
|
|
175
|
+
},
|
|
176
|
+
marginBlockStart: {
|
|
177
|
+
style: margin
|
|
178
|
+
},
|
|
179
|
+
marginBlockEnd: {
|
|
180
|
+
style: margin
|
|
181
|
+
},
|
|
182
|
+
// display
|
|
183
|
+
displayPrint: {
|
|
184
|
+
cssProperty: false,
|
|
185
|
+
transform: function transform(value) {
|
|
186
|
+
return {
|
|
187
|
+
'@media print': {
|
|
188
|
+
display: value
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
display: {},
|
|
194
|
+
overflow: {},
|
|
195
|
+
textOverflow: {},
|
|
196
|
+
visibility: {},
|
|
197
|
+
whiteSpace: {},
|
|
198
|
+
// flexbox
|
|
199
|
+
flexBasis: {},
|
|
200
|
+
flexDirection: {},
|
|
201
|
+
flexWrap: {},
|
|
202
|
+
justifyContent: {},
|
|
203
|
+
alignItems: {},
|
|
204
|
+
alignContent: {},
|
|
205
|
+
order: {},
|
|
206
|
+
flex: {},
|
|
207
|
+
flexGrow: {},
|
|
208
|
+
flexShrink: {},
|
|
209
|
+
alignSelf: {},
|
|
210
|
+
justifyItems: {},
|
|
211
|
+
justifySelf: {},
|
|
212
|
+
// grid
|
|
213
|
+
gap: {
|
|
214
|
+
style: gap
|
|
215
|
+
},
|
|
216
|
+
rowGap: {
|
|
217
|
+
style: rowGap
|
|
218
|
+
},
|
|
219
|
+
columnGap: {
|
|
220
|
+
style: columnGap
|
|
221
|
+
},
|
|
222
|
+
gridColumn: {},
|
|
223
|
+
gridRow: {},
|
|
224
|
+
gridAutoFlow: {},
|
|
225
|
+
gridAutoColumns: {},
|
|
226
|
+
gridAutoRows: {},
|
|
227
|
+
gridTemplateColumns: {},
|
|
228
|
+
gridTemplateRows: {},
|
|
229
|
+
gridTemplateAreas: {},
|
|
230
|
+
gridArea: {},
|
|
231
|
+
// positions
|
|
232
|
+
position: {},
|
|
233
|
+
zIndex: {
|
|
234
|
+
themeKey: 'zIndex'
|
|
235
|
+
},
|
|
236
|
+
top: {},
|
|
237
|
+
right: {},
|
|
238
|
+
bottom: {},
|
|
239
|
+
left: {},
|
|
240
|
+
// shadows
|
|
241
|
+
boxShadow: {
|
|
242
|
+
themeKey: 'shadows'
|
|
243
|
+
},
|
|
244
|
+
// sizing
|
|
245
|
+
width: {
|
|
246
|
+
transform: sizingTransform
|
|
247
|
+
},
|
|
248
|
+
maxWidth: {
|
|
249
|
+
style: maxWidth
|
|
250
|
+
},
|
|
251
|
+
minWidth: {
|
|
252
|
+
transform: sizingTransform
|
|
253
|
+
},
|
|
254
|
+
height: {
|
|
255
|
+
transform: sizingTransform
|
|
256
|
+
},
|
|
257
|
+
maxHeight: {
|
|
258
|
+
transform: sizingTransform
|
|
259
|
+
},
|
|
260
|
+
minHeight: {
|
|
261
|
+
transform: sizingTransform
|
|
262
|
+
},
|
|
263
|
+
boxSizing: {},
|
|
264
|
+
// typography
|
|
265
|
+
fontFamily: {
|
|
266
|
+
themeKey: 'typography'
|
|
267
|
+
},
|
|
268
|
+
fontSize: {
|
|
269
|
+
themeKey: 'typography'
|
|
270
|
+
},
|
|
271
|
+
fontStyle: {
|
|
272
|
+
themeKey: 'typography'
|
|
273
|
+
},
|
|
274
|
+
fontWeight: {
|
|
275
|
+
themeKey: 'typography'
|
|
276
|
+
},
|
|
277
|
+
letterSpacing: {},
|
|
278
|
+
textTransform: {},
|
|
279
|
+
lineHeight: {},
|
|
280
|
+
textAlign: {},
|
|
281
|
+
typography: {
|
|
282
|
+
cssProperty: false,
|
|
283
|
+
themeKey: 'typography'
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
export default defaultSxConfig;
|
|
@@ -2,14 +2,16 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
import { isPlainObject } from '@mui/utils';
|
|
5
|
-
import
|
|
5
|
+
import defaultSxConfig from './defaultSxConfig';
|
|
6
6
|
var splitProps = function splitProps(props) {
|
|
7
|
+
var _props$theme$unstable, _props$theme;
|
|
7
8
|
var result = {
|
|
8
9
|
systemProps: {},
|
|
9
10
|
otherProps: {}
|
|
10
11
|
};
|
|
12
|
+
var config = (_props$theme$unstable = props == null ? void 0 : (_props$theme = props.theme) == null ? void 0 : _props$theme.unstable_sxConfig) != null ? _props$theme$unstable : defaultSxConfig;
|
|
11
13
|
Object.keys(props).forEach(function (prop) {
|
|
12
|
-
if (
|
|
14
|
+
if (config[prop]) {
|
|
13
15
|
result.systemProps[prop] = props[prop];
|
|
14
16
|
} else {
|
|
15
17
|
result.otherProps[prop] = props[prop];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default } from './styleFunctionSx';
|
|
2
2
|
export { unstable_createStyleFunctionSx } from './styleFunctionSx';
|
|
3
|
-
export { default as extendSxProp } from './extendSxProp';
|
|
3
|
+
export { default as extendSxProp } from './extendSxProp';
|
|
4
|
+
export { default as unstable_defaultSxConfig } from './defaultSxConfig';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import { unstable_capitalize as capitalize } from '@mui/utils';
|
|
3
4
|
import merge from '../merge';
|
|
4
|
-
import {
|
|
5
|
+
import { getPath, getStyleValue as getValue } from '../style';
|
|
5
6
|
import { handleBreakpoints, createEmptyBreakpointObject, removeUnusedBreakpoints } from '../breakpoints';
|
|
7
|
+
import defaultSxConfig from './defaultSxConfig';
|
|
6
8
|
function objectsHaveSameKeys() {
|
|
7
9
|
for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8
10
|
objects[_key] = arguments[_key];
|
|
@@ -21,28 +23,50 @@ function callIfFn(maybeFn, arg) {
|
|
|
21
23
|
|
|
22
24
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
23
25
|
export function unstable_createStyleFunctionSx() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
function getThemeValue(prop, val, theme, config) {
|
|
27
|
+
var _props;
|
|
28
|
+
var props = (_props = {}, _defineProperty(_props, prop, val), _defineProperty(_props, "theme", theme), _props);
|
|
29
|
+
var options = config[prop];
|
|
30
|
+
if (!options) {
|
|
31
|
+
return _defineProperty({}, prop, val);
|
|
32
|
+
}
|
|
33
|
+
var _options$cssProperty = options.cssProperty,
|
|
34
|
+
cssProperty = _options$cssProperty === void 0 ? prop : _options$cssProperty,
|
|
35
|
+
themeKey = options.themeKey,
|
|
36
|
+
transform = options.transform,
|
|
37
|
+
style = options.style;
|
|
38
|
+
if (val == null) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
var themeMapping = getPath(theme, themeKey) || {};
|
|
42
|
+
if (style) {
|
|
43
|
+
return style(props);
|
|
44
|
+
}
|
|
45
|
+
var styleFromPropValue = function styleFromPropValue(propValueFinal) {
|
|
46
|
+
var value = getValue(themeMapping, transform, propValueFinal);
|
|
47
|
+
if (propValueFinal === value && typeof propValueFinal === 'string') {
|
|
48
|
+
// Haven't found value
|
|
49
|
+
value = getValue(themeMapping, transform, "".concat(prop).concat(propValueFinal === 'default' ? '' : capitalize(propValueFinal)), propValueFinal);
|
|
50
|
+
}
|
|
51
|
+
if (cssProperty === false) {
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
return _defineProperty({}, cssProperty, value);
|
|
55
|
+
};
|
|
56
|
+
return handleBreakpoints(props, val, styleFromPropValue);
|
|
36
57
|
}
|
|
37
58
|
function styleFunctionSx(props) {
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
theme =
|
|
59
|
+
var _theme$unstable_sxCon;
|
|
60
|
+
var _ref3 = props || {},
|
|
61
|
+
sx = _ref3.sx,
|
|
62
|
+
_ref3$theme = _ref3.theme,
|
|
63
|
+
theme = _ref3$theme === void 0 ? {} : _ref3$theme;
|
|
42
64
|
if (!sx) {
|
|
43
65
|
return null; // Emotion & styled-components will neglect null
|
|
44
66
|
}
|
|
45
67
|
|
|
68
|
+
var config = (_theme$unstable_sxCon = theme.unstable_sxConfig) != null ? _theme$unstable_sxCon : defaultSxConfig;
|
|
69
|
+
|
|
46
70
|
/*
|
|
47
71
|
* Receive `sxInput` as object or callback
|
|
48
72
|
* and then recursively check keys & values to create media query object styles.
|
|
@@ -66,8 +90,8 @@ export function unstable_createStyleFunctionSx() {
|
|
|
66
90
|
var value = callIfFn(sxObject[styleKey], theme);
|
|
67
91
|
if (value !== null && value !== undefined) {
|
|
68
92
|
if (_typeof(value) === 'object') {
|
|
69
|
-
if (
|
|
70
|
-
css = merge(css, getThemeValue(styleKey, value, theme));
|
|
93
|
+
if (config[styleKey]) {
|
|
94
|
+
css = merge(css, getThemeValue(styleKey, value, theme, config));
|
|
71
95
|
} else {
|
|
72
96
|
var breakpointsValues = handleBreakpoints({
|
|
73
97
|
theme: theme
|
|
@@ -84,7 +108,7 @@ export function unstable_createStyleFunctionSx() {
|
|
|
84
108
|
}
|
|
85
109
|
}
|
|
86
110
|
} else {
|
|
87
|
-
css = merge(css, getThemeValue(styleKey, value, theme));
|
|
111
|
+
css = merge(css, getThemeValue(styleKey, value, theme, config));
|
|
88
112
|
}
|
|
89
113
|
}
|
|
90
114
|
});
|
package/modern/borders.js
CHANGED
|
@@ -3,7 +3,7 @@ import style from './style';
|
|
|
3
3
|
import compose from './compose';
|
|
4
4
|
import { createUnaryUnit, getValue } from './spacing';
|
|
5
5
|
import { handleBreakpoints } from './breakpoints';
|
|
6
|
-
function
|
|
6
|
+
export function borderTransform(value) {
|
|
7
7
|
if (typeof value !== 'number') {
|
|
8
8
|
return value;
|
|
9
9
|
}
|
|
@@ -12,27 +12,27 @@ function getBorder(value) {
|
|
|
12
12
|
export const border = style({
|
|
13
13
|
prop: 'border',
|
|
14
14
|
themeKey: 'borders',
|
|
15
|
-
transform:
|
|
15
|
+
transform: borderTransform
|
|
16
16
|
});
|
|
17
17
|
export const borderTop = style({
|
|
18
18
|
prop: 'borderTop',
|
|
19
19
|
themeKey: 'borders',
|
|
20
|
-
transform:
|
|
20
|
+
transform: borderTransform
|
|
21
21
|
});
|
|
22
22
|
export const borderRight = style({
|
|
23
23
|
prop: 'borderRight',
|
|
24
24
|
themeKey: 'borders',
|
|
25
|
-
transform:
|
|
25
|
+
transform: borderTransform
|
|
26
26
|
});
|
|
27
27
|
export const borderBottom = style({
|
|
28
28
|
prop: 'borderBottom',
|
|
29
29
|
themeKey: 'borders',
|
|
30
|
-
transform:
|
|
30
|
+
transform: borderTransform
|
|
31
31
|
});
|
|
32
32
|
export const borderLeft = style({
|
|
33
33
|
prop: 'borderLeft',
|
|
34
34
|
themeKey: 'borders',
|
|
35
|
-
transform:
|
|
35
|
+
transform: borderTransform
|
|
36
36
|
});
|
|
37
37
|
export const borderColor = style({
|
|
38
38
|
prop: 'borderColor',
|
|
@@ -54,6 +54,9 @@ export const borderLeftColor = style({
|
|
|
54
54
|
prop: 'borderLeftColor',
|
|
55
55
|
themeKey: 'palette'
|
|
56
56
|
});
|
|
57
|
+
|
|
58
|
+
// false positive
|
|
59
|
+
// eslint-disable-next-line react/function-component-definition
|
|
57
60
|
export const borderRadius = props => {
|
|
58
61
|
if (props.borderRadius !== undefined && props.borderRadius !== null) {
|
|
59
62
|
const transformer = createUnaryUnit(props.theme, 'shape.borderRadius', 4, 'borderRadius');
|
package/modern/breakpoints.js
CHANGED
|
@@ -50,6 +50,8 @@ export function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
|
50
50
|
return output;
|
|
51
51
|
}
|
|
52
52
|
function breakpoints(styleFunction) {
|
|
53
|
+
// false positive
|
|
54
|
+
// eslint-disable-next-line react/function-component-definition
|
|
53
55
|
const newStyleFunction = props => {
|
|
54
56
|
const theme = props.theme || {};
|
|
55
57
|
const base = styleFunction(props);
|
package/modern/compose.js
CHANGED