@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
package/palette.js
CHANGED
|
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.color = exports.bgcolor = exports.backgroundColor = void 0;
|
|
8
|
+
exports.paletteTransform = paletteTransform;
|
|
8
9
|
var _style = _interopRequireDefault(require("./style"));
|
|
9
10
|
var _compose = _interopRequireDefault(require("./compose"));
|
|
10
|
-
function
|
|
11
|
+
function paletteTransform(value, userValue) {
|
|
11
12
|
if (userValue === 'grey') {
|
|
12
13
|
return userValue;
|
|
13
14
|
}
|
|
@@ -16,20 +17,20 @@ function transform(value, userValue) {
|
|
|
16
17
|
const color = (0, _style.default)({
|
|
17
18
|
prop: 'color',
|
|
18
19
|
themeKey: 'palette',
|
|
19
|
-
transform
|
|
20
|
+
transform: paletteTransform
|
|
20
21
|
});
|
|
21
22
|
exports.color = color;
|
|
22
23
|
const bgcolor = (0, _style.default)({
|
|
23
24
|
prop: 'bgcolor',
|
|
24
25
|
cssProperty: 'backgroundColor',
|
|
25
26
|
themeKey: 'palette',
|
|
26
|
-
transform
|
|
27
|
+
transform: paletteTransform
|
|
27
28
|
});
|
|
28
29
|
exports.bgcolor = bgcolor;
|
|
29
30
|
const backgroundColor = (0, _style.default)({
|
|
30
31
|
prop: 'backgroundColor',
|
|
31
32
|
themeKey: 'palette',
|
|
32
|
-
transform
|
|
33
|
+
transform: paletteTransform
|
|
33
34
|
});
|
|
34
35
|
exports.backgroundColor = backgroundColor;
|
|
35
36
|
const palette = (0, _compose.default)(color, bgcolor, backgroundColor);
|
package/sizing.js
CHANGED
|
@@ -4,16 +4,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.sizeWidth = exports.sizeHeight = exports.minWidth = exports.minHeight = exports.maxWidth = exports.maxHeight = exports.height = exports.default = exports.boxSizing = void 0;
|
|
8
|
+
exports.sizingTransform = sizingTransform;
|
|
9
|
+
exports.width = void 0;
|
|
8
10
|
var _style = _interopRequireDefault(require("./style"));
|
|
9
11
|
var _compose = _interopRequireDefault(require("./compose"));
|
|
10
12
|
var _breakpoints = require("./breakpoints");
|
|
11
|
-
function
|
|
13
|
+
function sizingTransform(value) {
|
|
12
14
|
return value <= 1 && value !== 0 ? `${value * 100}%` : value;
|
|
13
15
|
}
|
|
14
16
|
const width = (0, _style.default)({
|
|
15
17
|
prop: 'width',
|
|
16
|
-
transform
|
|
18
|
+
transform: sizingTransform
|
|
17
19
|
});
|
|
18
20
|
exports.width = width;
|
|
19
21
|
const maxWidth = props => {
|
|
@@ -22,7 +24,7 @@ const maxWidth = props => {
|
|
|
22
24
|
var _props$theme, _props$theme$breakpoi, _props$theme$breakpoi2;
|
|
23
25
|
const 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]) || _breakpoints.values[propValue];
|
|
24
26
|
return {
|
|
25
|
-
maxWidth: breakpoint ||
|
|
27
|
+
maxWidth: breakpoint || sizingTransform(propValue)
|
|
26
28
|
};
|
|
27
29
|
};
|
|
28
30
|
return (0, _breakpoints.handleBreakpoints)(props, props.maxWidth, styleFromPropValue);
|
|
@@ -33,34 +35,34 @@ exports.maxWidth = maxWidth;
|
|
|
33
35
|
maxWidth.filterProps = ['maxWidth'];
|
|
34
36
|
const minWidth = (0, _style.default)({
|
|
35
37
|
prop: 'minWidth',
|
|
36
|
-
transform
|
|
38
|
+
transform: sizingTransform
|
|
37
39
|
});
|
|
38
40
|
exports.minWidth = minWidth;
|
|
39
41
|
const height = (0, _style.default)({
|
|
40
42
|
prop: 'height',
|
|
41
|
-
transform
|
|
43
|
+
transform: sizingTransform
|
|
42
44
|
});
|
|
43
45
|
exports.height = height;
|
|
44
46
|
const maxHeight = (0, _style.default)({
|
|
45
47
|
prop: 'maxHeight',
|
|
46
|
-
transform
|
|
48
|
+
transform: sizingTransform
|
|
47
49
|
});
|
|
48
50
|
exports.maxHeight = maxHeight;
|
|
49
51
|
const minHeight = (0, _style.default)({
|
|
50
52
|
prop: 'minHeight',
|
|
51
|
-
transform
|
|
53
|
+
transform: sizingTransform
|
|
52
54
|
});
|
|
53
55
|
exports.minHeight = minHeight;
|
|
54
56
|
const sizeWidth = (0, _style.default)({
|
|
55
57
|
prop: 'size',
|
|
56
58
|
cssProperty: 'width',
|
|
57
|
-
transform
|
|
59
|
+
transform: sizingTransform
|
|
58
60
|
});
|
|
59
61
|
exports.sizeWidth = sizeWidth;
|
|
60
62
|
const sizeHeight = (0, _style.default)({
|
|
61
63
|
prop: 'size',
|
|
62
64
|
cssProperty: 'height',
|
|
63
|
-
transform
|
|
65
|
+
transform: sizingTransform
|
|
64
66
|
});
|
|
65
67
|
exports.sizeHeight = sizeHeight;
|
|
66
68
|
const boxSizing = (0, _style.default)({
|
package/spacing.js
CHANGED
|
@@ -10,7 +10,9 @@ exports.default = void 0;
|
|
|
10
10
|
exports.getStyleFromPropValue = getStyleFromPropValue;
|
|
11
11
|
exports.getValue = getValue;
|
|
12
12
|
exports.margin = margin;
|
|
13
|
+
exports.marginKeys = void 0;
|
|
13
14
|
exports.padding = padding;
|
|
15
|
+
exports.paddingKeys = void 0;
|
|
14
16
|
var _responsivePropType = _interopRequireDefault(require("./responsivePropType"));
|
|
15
17
|
var _breakpoints = require("./breakpoints");
|
|
16
18
|
var _style = require("./style");
|
|
@@ -53,7 +55,9 @@ const getCssProperties = (0, _memoize.default)(prop => {
|
|
|
53
55
|
return Array.isArray(direction) ? direction.map(dir => property + dir) : [property + direction];
|
|
54
56
|
});
|
|
55
57
|
const marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd'];
|
|
58
|
+
exports.marginKeys = marginKeys;
|
|
56
59
|
const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
|
|
60
|
+
exports.paddingKeys = paddingKeys;
|
|
57
61
|
const spacingKeys = [...marginKeys, ...paddingKeys];
|
|
58
62
|
function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
59
63
|
var _getPath;
|
package/style.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { CSSObject } from '@mui/styled-engine';
|
|
2
2
|
import { StyleFunction } from './Box';
|
|
3
3
|
|
|
4
|
+
export type TransformFunction = (
|
|
5
|
+
cssValue: unknown,
|
|
6
|
+
userValue: unknown,
|
|
7
|
+
) => number | string | React.CSSProperties | CSSObject;
|
|
8
|
+
|
|
4
9
|
export interface StyleOptions<PropKey> {
|
|
5
10
|
cssProperty?: PropKey | keyof React.CSSProperties | false;
|
|
6
11
|
prop: PropKey;
|
|
@@ -8,18 +13,15 @@ export interface StyleOptions<PropKey> {
|
|
|
8
13
|
* dot access in `Theme`
|
|
9
14
|
*/
|
|
10
15
|
themeKey?: string;
|
|
11
|
-
transform?:
|
|
12
|
-
cssValue: unknown,
|
|
13
|
-
userValue: unknown,
|
|
14
|
-
) => number | string | React.CSSProperties | CSSObject;
|
|
16
|
+
transform?: TransformFunction;
|
|
15
17
|
}
|
|
16
18
|
export function style<PropKey extends string, Theme extends object>(
|
|
17
19
|
options: StyleOptions<PropKey>,
|
|
18
20
|
): StyleFunction<{ [K in PropKey]?: unknown } & { theme?: Theme }> & { filterProps: string[] };
|
|
19
21
|
export function getPath<T>(obj: T, path: string | undefined, checkVars?: boolean): null | unknown;
|
|
20
22
|
export function getStyleValue(
|
|
21
|
-
themeMapping: object | ((
|
|
22
|
-
transform
|
|
23
|
-
propValueFinal
|
|
24
|
-
userValue?:
|
|
23
|
+
themeMapping: object | ((arg: any) => any),
|
|
24
|
+
transform: TransformFunction | null,
|
|
25
|
+
propValueFinal: unknown,
|
|
26
|
+
userValue?: unknown,
|
|
25
27
|
): any;
|
package/style.js
CHANGED
|
@@ -39,7 +39,7 @@ function getStyleValue(themeMapping, transform, propValueFinal, userValue = prop
|
|
|
39
39
|
value = getPath(themeMapping, propValueFinal) || userValue;
|
|
40
40
|
}
|
|
41
41
|
if (transform) {
|
|
42
|
-
value = transform(value, userValue);
|
|
42
|
+
value = transform(value, userValue, themeMapping);
|
|
43
43
|
}
|
|
44
44
|
return value;
|
|
45
45
|
}
|
|
@@ -50,6 +50,9 @@ function style(options) {
|
|
|
50
50
|
themeKey,
|
|
51
51
|
transform
|
|
52
52
|
} = options;
|
|
53
|
+
|
|
54
|
+
// false positive
|
|
55
|
+
// eslint-disable-next-line react/function-component-definition
|
|
53
56
|
const fn = props => {
|
|
54
57
|
if (props[prop] == null) {
|
|
55
58
|
return null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StyleFunction } from '../Box';
|
|
2
|
+
import { TransformFunction } from '../style';
|
|
3
|
+
|
|
4
|
+
type SimpleStyleFunction<PropKey extends keyof any> = StyleFunction<Partial<Record<PropKey, any>>>;
|
|
5
|
+
|
|
6
|
+
export interface SxConfigRecord {
|
|
7
|
+
cssProperty?: keyof React.CSSProperties | false;
|
|
8
|
+
/**
|
|
9
|
+
* dot access in `Theme`
|
|
10
|
+
*/
|
|
11
|
+
themeKey?: string;
|
|
12
|
+
transform?: TransformFunction;
|
|
13
|
+
style?: SimpleStyleFunction<any>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type SxConfig = Record<string, SxConfigRecord>;
|
|
17
|
+
|
|
18
|
+
declare const defaultSxConfig: SxConfig;
|
|
19
|
+
|
|
20
|
+
export default defaultSxConfig;
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _spacing = require("../spacing");
|
|
8
|
+
var _borders = require("../borders");
|
|
9
|
+
var _cssGrid = require("../cssGrid");
|
|
10
|
+
var _palette = require("../palette");
|
|
11
|
+
var _sizing = require("../sizing");
|
|
12
|
+
const defaultSxConfig = {
|
|
13
|
+
// borders
|
|
14
|
+
border: {
|
|
15
|
+
themeKey: 'borders',
|
|
16
|
+
transform: _borders.borderTransform
|
|
17
|
+
},
|
|
18
|
+
borderTop: {
|
|
19
|
+
themeKey: 'borders',
|
|
20
|
+
transform: _borders.borderTransform
|
|
21
|
+
},
|
|
22
|
+
borderRight: {
|
|
23
|
+
themeKey: 'borders',
|
|
24
|
+
transform: _borders.borderTransform
|
|
25
|
+
},
|
|
26
|
+
borderBottom: {
|
|
27
|
+
themeKey: 'borders',
|
|
28
|
+
transform: _borders.borderTransform
|
|
29
|
+
},
|
|
30
|
+
borderLeft: {
|
|
31
|
+
themeKey: 'borders',
|
|
32
|
+
transform: _borders.borderTransform
|
|
33
|
+
},
|
|
34
|
+
borderColor: {
|
|
35
|
+
themeKey: 'palette'
|
|
36
|
+
},
|
|
37
|
+
borderTopColor: {
|
|
38
|
+
themeKey: 'palette'
|
|
39
|
+
},
|
|
40
|
+
borderRightColor: {
|
|
41
|
+
themeKey: 'palette'
|
|
42
|
+
},
|
|
43
|
+
borderBottomColor: {
|
|
44
|
+
themeKey: 'palette'
|
|
45
|
+
},
|
|
46
|
+
borderLeftColor: {
|
|
47
|
+
themeKey: 'palette'
|
|
48
|
+
},
|
|
49
|
+
borderRadius: {
|
|
50
|
+
themeKey: 'shape.borderRadius',
|
|
51
|
+
style: _borders.borderRadius
|
|
52
|
+
},
|
|
53
|
+
// palette
|
|
54
|
+
color: {
|
|
55
|
+
themeKey: 'palette',
|
|
56
|
+
transform: _palette.paletteTransform
|
|
57
|
+
},
|
|
58
|
+
bgcolor: {
|
|
59
|
+
themeKey: 'palette',
|
|
60
|
+
cssProperty: 'backgroundColor',
|
|
61
|
+
transform: _palette.paletteTransform
|
|
62
|
+
},
|
|
63
|
+
backgroundColor: {
|
|
64
|
+
themeKey: 'palette',
|
|
65
|
+
transform: _palette.paletteTransform
|
|
66
|
+
},
|
|
67
|
+
// spacing
|
|
68
|
+
p: {
|
|
69
|
+
style: _spacing.padding
|
|
70
|
+
},
|
|
71
|
+
pt: {
|
|
72
|
+
style: _spacing.padding
|
|
73
|
+
},
|
|
74
|
+
pr: {
|
|
75
|
+
style: _spacing.padding
|
|
76
|
+
},
|
|
77
|
+
pb: {
|
|
78
|
+
style: _spacing.padding
|
|
79
|
+
},
|
|
80
|
+
pl: {
|
|
81
|
+
style: _spacing.padding
|
|
82
|
+
},
|
|
83
|
+
px: {
|
|
84
|
+
style: _spacing.padding
|
|
85
|
+
},
|
|
86
|
+
py: {
|
|
87
|
+
style: _spacing.padding
|
|
88
|
+
},
|
|
89
|
+
padding: {
|
|
90
|
+
style: _spacing.padding
|
|
91
|
+
},
|
|
92
|
+
paddingTop: {
|
|
93
|
+
style: _spacing.padding
|
|
94
|
+
},
|
|
95
|
+
paddingRight: {
|
|
96
|
+
style: _spacing.padding
|
|
97
|
+
},
|
|
98
|
+
paddingBottom: {
|
|
99
|
+
style: _spacing.padding
|
|
100
|
+
},
|
|
101
|
+
paddingLeft: {
|
|
102
|
+
style: _spacing.padding
|
|
103
|
+
},
|
|
104
|
+
paddingX: {
|
|
105
|
+
style: _spacing.padding
|
|
106
|
+
},
|
|
107
|
+
paddingY: {
|
|
108
|
+
style: _spacing.padding
|
|
109
|
+
},
|
|
110
|
+
paddingInline: {
|
|
111
|
+
style: _spacing.padding
|
|
112
|
+
},
|
|
113
|
+
paddingInlineStart: {
|
|
114
|
+
style: _spacing.padding
|
|
115
|
+
},
|
|
116
|
+
paddingInlineEnd: {
|
|
117
|
+
style: _spacing.padding
|
|
118
|
+
},
|
|
119
|
+
paddingBlock: {
|
|
120
|
+
style: _spacing.padding
|
|
121
|
+
},
|
|
122
|
+
paddingBlockStart: {
|
|
123
|
+
style: _spacing.padding
|
|
124
|
+
},
|
|
125
|
+
paddingBlockEnd: {
|
|
126
|
+
style: _spacing.padding
|
|
127
|
+
},
|
|
128
|
+
m: {
|
|
129
|
+
style: _spacing.margin
|
|
130
|
+
},
|
|
131
|
+
mt: {
|
|
132
|
+
style: _spacing.margin
|
|
133
|
+
},
|
|
134
|
+
mr: {
|
|
135
|
+
style: _spacing.margin
|
|
136
|
+
},
|
|
137
|
+
mb: {
|
|
138
|
+
style: _spacing.margin
|
|
139
|
+
},
|
|
140
|
+
ml: {
|
|
141
|
+
style: _spacing.margin
|
|
142
|
+
},
|
|
143
|
+
mx: {
|
|
144
|
+
style: _spacing.margin
|
|
145
|
+
},
|
|
146
|
+
my: {
|
|
147
|
+
style: _spacing.margin
|
|
148
|
+
},
|
|
149
|
+
margin: {
|
|
150
|
+
style: _spacing.margin
|
|
151
|
+
},
|
|
152
|
+
marginTop: {
|
|
153
|
+
style: _spacing.margin
|
|
154
|
+
},
|
|
155
|
+
marginRight: {
|
|
156
|
+
style: _spacing.margin
|
|
157
|
+
},
|
|
158
|
+
marginBottom: {
|
|
159
|
+
style: _spacing.margin
|
|
160
|
+
},
|
|
161
|
+
marginLeft: {
|
|
162
|
+
style: _spacing.margin
|
|
163
|
+
},
|
|
164
|
+
marginX: {
|
|
165
|
+
style: _spacing.margin
|
|
166
|
+
},
|
|
167
|
+
marginY: {
|
|
168
|
+
style: _spacing.margin
|
|
169
|
+
},
|
|
170
|
+
marginInline: {
|
|
171
|
+
style: _spacing.margin
|
|
172
|
+
},
|
|
173
|
+
marginInlineStart: {
|
|
174
|
+
style: _spacing.margin
|
|
175
|
+
},
|
|
176
|
+
marginInlineEnd: {
|
|
177
|
+
style: _spacing.margin
|
|
178
|
+
},
|
|
179
|
+
marginBlock: {
|
|
180
|
+
style: _spacing.margin
|
|
181
|
+
},
|
|
182
|
+
marginBlockStart: {
|
|
183
|
+
style: _spacing.margin
|
|
184
|
+
},
|
|
185
|
+
marginBlockEnd: {
|
|
186
|
+
style: _spacing.margin
|
|
187
|
+
},
|
|
188
|
+
// display
|
|
189
|
+
displayPrint: {
|
|
190
|
+
cssProperty: false,
|
|
191
|
+
transform: value => ({
|
|
192
|
+
'@media print': {
|
|
193
|
+
display: value
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
},
|
|
197
|
+
display: {},
|
|
198
|
+
overflow: {},
|
|
199
|
+
textOverflow: {},
|
|
200
|
+
visibility: {},
|
|
201
|
+
whiteSpace: {},
|
|
202
|
+
// flexbox
|
|
203
|
+
flexBasis: {},
|
|
204
|
+
flexDirection: {},
|
|
205
|
+
flexWrap: {},
|
|
206
|
+
justifyContent: {},
|
|
207
|
+
alignItems: {},
|
|
208
|
+
alignContent: {},
|
|
209
|
+
order: {},
|
|
210
|
+
flex: {},
|
|
211
|
+
flexGrow: {},
|
|
212
|
+
flexShrink: {},
|
|
213
|
+
alignSelf: {},
|
|
214
|
+
justifyItems: {},
|
|
215
|
+
justifySelf: {},
|
|
216
|
+
// grid
|
|
217
|
+
gap: {
|
|
218
|
+
style: _cssGrid.gap
|
|
219
|
+
},
|
|
220
|
+
rowGap: {
|
|
221
|
+
style: _cssGrid.rowGap
|
|
222
|
+
},
|
|
223
|
+
columnGap: {
|
|
224
|
+
style: _cssGrid.columnGap
|
|
225
|
+
},
|
|
226
|
+
gridColumn: {},
|
|
227
|
+
gridRow: {},
|
|
228
|
+
gridAutoFlow: {},
|
|
229
|
+
gridAutoColumns: {},
|
|
230
|
+
gridAutoRows: {},
|
|
231
|
+
gridTemplateColumns: {},
|
|
232
|
+
gridTemplateRows: {},
|
|
233
|
+
gridTemplateAreas: {},
|
|
234
|
+
gridArea: {},
|
|
235
|
+
// positions
|
|
236
|
+
position: {},
|
|
237
|
+
zIndex: {
|
|
238
|
+
themeKey: 'zIndex'
|
|
239
|
+
},
|
|
240
|
+
top: {},
|
|
241
|
+
right: {},
|
|
242
|
+
bottom: {},
|
|
243
|
+
left: {},
|
|
244
|
+
// shadows
|
|
245
|
+
boxShadow: {
|
|
246
|
+
themeKey: 'shadows'
|
|
247
|
+
},
|
|
248
|
+
// sizing
|
|
249
|
+
width: {
|
|
250
|
+
transform: _sizing.sizingTransform
|
|
251
|
+
},
|
|
252
|
+
maxWidth: {
|
|
253
|
+
style: _sizing.maxWidth
|
|
254
|
+
},
|
|
255
|
+
minWidth: {
|
|
256
|
+
transform: _sizing.sizingTransform
|
|
257
|
+
},
|
|
258
|
+
height: {
|
|
259
|
+
transform: _sizing.sizingTransform
|
|
260
|
+
},
|
|
261
|
+
maxHeight: {
|
|
262
|
+
transform: _sizing.sizingTransform
|
|
263
|
+
},
|
|
264
|
+
minHeight: {
|
|
265
|
+
transform: _sizing.sizingTransform
|
|
266
|
+
},
|
|
267
|
+
boxSizing: {},
|
|
268
|
+
// typography
|
|
269
|
+
fontFamily: {
|
|
270
|
+
themeKey: 'typography'
|
|
271
|
+
},
|
|
272
|
+
fontSize: {
|
|
273
|
+
themeKey: 'typography'
|
|
274
|
+
},
|
|
275
|
+
fontStyle: {
|
|
276
|
+
themeKey: 'typography'
|
|
277
|
+
},
|
|
278
|
+
fontWeight: {
|
|
279
|
+
themeKey: 'typography'
|
|
280
|
+
},
|
|
281
|
+
letterSpacing: {},
|
|
282
|
+
textTransform: {},
|
|
283
|
+
lineHeight: {},
|
|
284
|
+
textAlign: {},
|
|
285
|
+
typography: {
|
|
286
|
+
cssProperty: false,
|
|
287
|
+
themeKey: 'typography'
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
var _default = defaultSxConfig;
|
|
291
|
+
exports.default = _default;
|
|
@@ -8,15 +8,17 @@ exports.default = extendSxProp;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var _utils = require("@mui/utils");
|
|
11
|
-
var
|
|
11
|
+
var _defaultSxConfig = _interopRequireDefault(require("./defaultSxConfig"));
|
|
12
12
|
const _excluded = ["sx"];
|
|
13
13
|
const splitProps = props => {
|
|
14
|
+
var _props$theme$unstable, _props$theme;
|
|
14
15
|
const result = {
|
|
15
16
|
systemProps: {},
|
|
16
17
|
otherProps: {}
|
|
17
18
|
};
|
|
19
|
+
const config = (_props$theme$unstable = props == null ? void 0 : (_props$theme = props.theme) == null ? void 0 : _props$theme.unstable_sxConfig) != null ? _props$theme$unstable : _defaultSxConfig.default;
|
|
18
20
|
Object.keys(props).forEach(prop => {
|
|
19
|
-
if (
|
|
21
|
+
if (config[prop]) {
|
|
20
22
|
result.systemProps[prop] = props[prop];
|
|
21
23
|
} else {
|
|
22
24
|
result.otherProps[prop] = props[prop];
|
|
@@ -6,4 +6,8 @@ export * from './OverwriteCSSProperties';
|
|
|
6
6
|
export * from './StandardCssProperties';
|
|
7
7
|
|
|
8
8
|
export { default as extendSxProp } from './extendSxProp';
|
|
9
|
+
|
|
10
|
+
export { default as unstable_defaultSxConfig } from './defaultSxConfig';
|
|
11
|
+
export * from './defaultSxConfig';
|
|
12
|
+
|
|
9
13
|
export * from './extendSxProp';
|
package/styleFunctionSx/index.js
CHANGED
|
@@ -22,7 +22,14 @@ Object.defineProperty(exports, "unstable_createStyleFunctionSx", {
|
|
|
22
22
|
return _styleFunctionSx.unstable_createStyleFunctionSx;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
+
Object.defineProperty(exports, "unstable_defaultSxConfig", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _defaultSxConfig.default;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
25
31
|
var _styleFunctionSx = _interopRequireWildcard(require("./styleFunctionSx"));
|
|
26
32
|
var _extendSxProp = _interopRequireDefault(require("./extendSxProp"));
|
|
33
|
+
var _defaultSxConfig = _interopRequireDefault(require("./defaultSxConfig"));
|
|
27
34
|
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); }
|
|
28
35
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as CSS from 'csstype';
|
|
2
|
+
import { CSSObject } from '@mui/styled-engine';
|
|
2
3
|
import { StandardCSSProperties } from './StandardCssProperties';
|
|
3
4
|
import { AliasesCSSProperties } from './AliasesCSSProperties';
|
|
4
5
|
import { OverwriteCSSProperties } from './OverwriteCSSProperties';
|
|
@@ -74,7 +75,7 @@ export type SxProps<Theme extends object = {}> =
|
|
|
74
75
|
>;
|
|
75
76
|
|
|
76
77
|
export interface StyleFunctionSx {
|
|
77
|
-
(props: object):
|
|
78
|
+
(props: object): CSSObject;
|
|
78
79
|
filterProps?: string[];
|
|
79
80
|
}
|
|
80
81
|
|
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
exports.unstable_createStyleFunctionSx = unstable_createStyleFunctionSx;
|
|
9
|
+
var _utils = require("@mui/utils");
|
|
9
10
|
var _merge = _interopRequireDefault(require("../merge"));
|
|
10
|
-
var
|
|
11
|
+
var _style = require("../style");
|
|
11
12
|
var _breakpoints = require("../breakpoints");
|
|
13
|
+
var _defaultSxConfig = _interopRequireDefault(require("./defaultSxConfig"));
|
|
12
14
|
function objectsHaveSameKeys(...objects) {
|
|
13
15
|
const allKeys = objects.reduce((keys, object) => keys.concat(Object.keys(object)), []);
|
|
14
16
|
const union = new Set(allKeys);
|
|
@@ -19,24 +21,48 @@ function callIfFn(maybeFn, arg) {
|
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
22
|
-
function unstable_createStyleFunctionSx(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
return acc;
|
|
28
|
-
}, {});
|
|
29
|
-
function getThemeValue(prop, value, theme) {
|
|
30
|
-
const inputProps = {
|
|
31
|
-
[prop]: value,
|
|
24
|
+
function unstable_createStyleFunctionSx() {
|
|
25
|
+
function getThemeValue(prop, val, theme, config) {
|
|
26
|
+
const props = {
|
|
27
|
+
[prop]: val,
|
|
32
28
|
theme
|
|
33
29
|
};
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
const options = config[prop];
|
|
31
|
+
if (!options) {
|
|
32
|
+
return {
|
|
33
|
+
[prop]: val
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const {
|
|
37
|
+
cssProperty = prop,
|
|
38
|
+
themeKey,
|
|
39
|
+
transform,
|
|
40
|
+
style
|
|
41
|
+
} = options;
|
|
42
|
+
if (val == null) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const themeMapping = (0, _style.getPath)(theme, themeKey) || {};
|
|
46
|
+
if (style) {
|
|
47
|
+
return style(props);
|
|
48
|
+
}
|
|
49
|
+
const styleFromPropValue = propValueFinal => {
|
|
50
|
+
let value = (0, _style.getStyleValue)(themeMapping, transform, propValueFinal);
|
|
51
|
+
if (propValueFinal === value && typeof propValueFinal === 'string') {
|
|
52
|
+
// Haven't found value
|
|
53
|
+
value = (0, _style.getStyleValue)(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : (0, _utils.unstable_capitalize)(propValueFinal)}`, propValueFinal);
|
|
54
|
+
}
|
|
55
|
+
if (cssProperty === false) {
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
[cssProperty]: value
|
|
60
|
+
};
|
|
37
61
|
};
|
|
62
|
+
return (0, _breakpoints.handleBreakpoints)(props, val, styleFromPropValue);
|
|
38
63
|
}
|
|
39
64
|
function styleFunctionSx(props) {
|
|
65
|
+
var _theme$unstable_sxCon;
|
|
40
66
|
const {
|
|
41
67
|
sx,
|
|
42
68
|
theme = {}
|
|
@@ -45,6 +71,8 @@ function unstable_createStyleFunctionSx(styleFunctionMapping = _getThemeValue.st
|
|
|
45
71
|
return null; // Emotion & styled-components will neglect null
|
|
46
72
|
}
|
|
47
73
|
|
|
74
|
+
const config = (_theme$unstable_sxCon = theme.unstable_sxConfig) != null ? _theme$unstable_sxCon : _defaultSxConfig.default;
|
|
75
|
+
|
|
48
76
|
/*
|
|
49
77
|
* Receive `sxInput` as object or callback
|
|
50
78
|
* and then recursively check keys & values to create media query object styles.
|
|
@@ -68,8 +96,8 @@ function unstable_createStyleFunctionSx(styleFunctionMapping = _getThemeValue.st
|
|
|
68
96
|
const value = callIfFn(sxObject[styleKey], theme);
|
|
69
97
|
if (value !== null && value !== undefined) {
|
|
70
98
|
if (typeof value === 'object') {
|
|
71
|
-
if (
|
|
72
|
-
css = (0, _merge.default)(css, getThemeValue(styleKey, value, theme));
|
|
99
|
+
if (config[styleKey]) {
|
|
100
|
+
css = (0, _merge.default)(css, getThemeValue(styleKey, value, theme, config));
|
|
73
101
|
} else {
|
|
74
102
|
const breakpointsValues = (0, _breakpoints.handleBreakpoints)({
|
|
75
103
|
theme
|
|
@@ -86,7 +114,7 @@ function unstable_createStyleFunctionSx(styleFunctionMapping = _getThemeValue.st
|
|
|
86
114
|
}
|
|
87
115
|
}
|
|
88
116
|
} else {
|
|
89
|
-
css = (0, _merge.default)(css, getThemeValue(styleKey, value, theme));
|
|
117
|
+
css = (0, _merge.default)(css, getThemeValue(styleKey, value, theme, config));
|
|
90
118
|
}
|
|
91
119
|
}
|
|
92
120
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/esm/sx/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './sx';
|
package/esm/sx/sx.js
DELETED
package/legacy/sx/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './sx';
|