@mui/system 7.0.1 → 7.0.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 +60 -0
- package/cssVars/cssVarsParser.d.ts +1 -1
- package/esm/cssVars/cssVarsParser.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/memoTheme.d.ts +1 -1
- package/esm/useThemeProps/getThemeProps.d.ts +0 -5
- package/esm/version/index.js +2 -2
- package/index.js +1 -1
- package/memoTheme.d.ts +1 -1
- package/modern/cssVars/cssVarsParser.d.ts +1 -1
- package/modern/memoTheme.d.ts +1 -1
- package/modern/useThemeProps/getThemeProps.d.ts +0 -5
- package/package.json +6 -14
- package/useThemeProps/getThemeProps.d.ts +0 -5
- package/version/index.js +2 -2
- package/modern/Box/Box.js +0 -30
- package/modern/Box/boxClasses.js +0 -3
- package/modern/Box/index.js +0 -3
- package/modern/Container/Container.js +0 -61
- package/modern/Container/ContainerProps.js +0 -1
- package/modern/Container/containerClasses.js +0 -7
- package/modern/Container/createContainer.js +0 -149
- package/modern/Container/index.js +0 -3
- package/modern/DefaultPropsProvider/DefaultPropsProvider.js +0 -64
- package/modern/DefaultPropsProvider/index.js +0 -1
- package/modern/GlobalStyles/GlobalStyles.js +0 -37
- package/modern/GlobalStyles/index.js +0 -2
- package/modern/Grid/Grid.js +0 -106
- package/modern/Grid/GridProps.js +0 -1
- package/modern/Grid/createGrid.js +0 -155
- package/modern/Grid/deleteLegacyGridProps.js +0 -41
- package/modern/Grid/gridClasses.js +0 -19
- package/modern/Grid/gridGenerator.js +0 -193
- package/modern/Grid/index.js +0 -7
- package/modern/Grid/traverseBreakpoints.js +0 -42
- package/modern/InitColorSchemeScript/InitColorSchemeScript.js +0 -78
- package/modern/InitColorSchemeScript/index.js +0 -1
- package/modern/RtlProvider/index.js +0 -24
- package/modern/Stack/Stack.js +0 -62
- package/modern/Stack/StackProps.js +0 -1
- package/modern/Stack/createStack.js +0 -173
- package/modern/Stack/index.js +0 -5
- package/modern/Stack/stackClasses.js +0 -7
- package/modern/ThemeProvider/ThemeProvider.js +0 -97
- package/modern/ThemeProvider/index.js +0 -1
- package/modern/borders/borders.js +0 -49
- package/modern/borders/index.js +0 -2
- package/modern/breakpoints/breakpoints.js +0 -171
- package/modern/breakpoints/index.js +0 -2
- package/modern/colorManipulator/colorManipulator.js +0 -349
- package/modern/colorManipulator/index.js +0 -1
- package/modern/compose/compose.js +0 -24
- package/modern/compose/index.js +0 -1
- package/modern/createBox/createBox.js +0 -35
- package/modern/createBox/index.js +0 -1
- package/modern/createBreakpoints/createBreakpoints.js +0 -81
- package/modern/createBreakpoints/index.js +0 -3
- package/modern/createStyled/createStyled.js +0 -276
- package/modern/createStyled/index.js +0 -2
- package/modern/createTheme/applyStyles.js +0 -87
- package/modern/createTheme/createSpacing.js +0 -31
- package/modern/createTheme/createTheme.js +0 -49
- package/modern/createTheme/index.js +0 -3
- package/modern/createTheme/shape.js +0 -4
- package/modern/cssContainerQueries/cssContainerQueries.js +0 -69
- package/modern/cssContainerQueries/index.js +0 -2
- package/modern/cssGrid/cssGrid.js +0 -85
- package/modern/cssGrid/index.js +0 -2
- package/modern/cssVars/createCssVarsProvider.js +0 -338
- package/modern/cssVars/createCssVarsTheme.js +0 -21
- package/modern/cssVars/createGetCssVar.js +0 -22
- package/modern/cssVars/cssVarsParser.js +0 -129
- package/modern/cssVars/getColorSchemeSelector.js +0 -26
- package/modern/cssVars/index.js +0 -5
- package/modern/cssVars/localStorageManager.js +0 -51
- package/modern/cssVars/prepareCssVars.js +0 -153
- package/modern/cssVars/prepareTypographyVars.js +0 -11
- package/modern/cssVars/useCurrentColorScheme.js +0 -228
- package/modern/display/display.js +0 -27
- package/modern/display/index.js +0 -2
- package/modern/flexbox/flexbox.js +0 -43
- package/modern/flexbox/index.js +0 -2
- package/modern/getThemeValue/getThemeValue.js +0 -51
- package/modern/getThemeValue/index.js +0 -2
- package/modern/index.js +0 -75
- package/modern/memoTheme.js +0 -28
- package/modern/memoize/index.js +0 -1
- package/modern/memoize/memoize.js +0 -9
- package/modern/merge/index.js +0 -1
- package/modern/merge/merge.js +0 -10
- package/modern/package.json +0 -1
- package/modern/palette/index.js +0 -2
- package/modern/palette/palette.js +0 -26
- package/modern/positions/index.js +0 -2
- package/modern/positions/positions.js +0 -22
- package/modern/preprocessStyles.js +0 -25
- package/modern/propsToClassKey/index.js +0 -1
- package/modern/propsToClassKey/propsToClassKey.js +0 -25
- package/modern/responsivePropType/index.js +0 -1
- package/modern/responsivePropType/responsivePropType.js +0 -3
- package/modern/shadows/index.js +0 -1
- package/modern/shadows/shadows.js +0 -6
- package/modern/sizing/index.js +0 -2
- package/modern/sizing/sizing.js +0 -64
- package/modern/spacing/index.js +0 -2
- package/modern/spacing/spacing.js +0 -157
- package/modern/style/index.js +0 -2
- package/modern/style/style.js +0 -75
- package/modern/styleFunctionSx/AliasesCSSProperties.js +0 -1
- package/modern/styleFunctionSx/OverwriteCSSProperties.js +0 -1
- package/modern/styleFunctionSx/StandardCssProperties.js +0 -1
- package/modern/styleFunctionSx/defaultSxConfig.js +0 -294
- package/modern/styleFunctionSx/extendSxProp.js +0 -51
- package/modern/styleFunctionSx/index.js +0 -4
- package/modern/styleFunctionSx/styleFunctionSx.js +0 -127
- package/modern/styled/index.js +0 -1
- package/modern/styled/styled.js +0 -3
- package/modern/typography/index.js +0 -2
- package/modern/typography/typography.js +0 -37
- package/modern/useMediaQuery/index.js +0 -2
- package/modern/useMediaQuery/useMediaQuery.js +0 -118
- package/modern/useTheme/index.js +0 -2
- package/modern/useTheme/useTheme.js +0 -9
- package/modern/useThemeProps/getThemeProps.js +0 -12
- package/modern/useThemeProps/index.js +0 -2
- package/modern/useThemeProps/useThemeProps.js +0 -20
- package/modern/useThemeWithoutDefault/index.js +0 -1
- package/modern/useThemeWithoutDefault/useThemeWithoutDefault.js +0 -12
- package/modern/version/index.js +0 -6
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import style from "../style/index.js";
|
|
2
|
-
import compose from "../compose/index.js";
|
|
3
|
-
export function paletteTransform(value, userValue) {
|
|
4
|
-
if (userValue === 'grey') {
|
|
5
|
-
return userValue;
|
|
6
|
-
}
|
|
7
|
-
return value;
|
|
8
|
-
}
|
|
9
|
-
export const color = style({
|
|
10
|
-
prop: 'color',
|
|
11
|
-
themeKey: 'palette',
|
|
12
|
-
transform: paletteTransform
|
|
13
|
-
});
|
|
14
|
-
export const bgcolor = style({
|
|
15
|
-
prop: 'bgcolor',
|
|
16
|
-
cssProperty: 'backgroundColor',
|
|
17
|
-
themeKey: 'palette',
|
|
18
|
-
transform: paletteTransform
|
|
19
|
-
});
|
|
20
|
-
export const backgroundColor = style({
|
|
21
|
-
prop: 'backgroundColor',
|
|
22
|
-
themeKey: 'palette',
|
|
23
|
-
transform: paletteTransform
|
|
24
|
-
});
|
|
25
|
-
const palette = compose(color, bgcolor, backgroundColor);
|
|
26
|
-
export default palette;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import style from "../style/index.js";
|
|
2
|
-
import compose from "../compose/index.js";
|
|
3
|
-
export const position = style({
|
|
4
|
-
prop: 'position'
|
|
5
|
-
});
|
|
6
|
-
export const zIndex = style({
|
|
7
|
-
prop: 'zIndex',
|
|
8
|
-
themeKey: 'zIndex'
|
|
9
|
-
});
|
|
10
|
-
export const top = style({
|
|
11
|
-
prop: 'top'
|
|
12
|
-
});
|
|
13
|
-
export const right = style({
|
|
14
|
-
prop: 'right'
|
|
15
|
-
});
|
|
16
|
-
export const bottom = style({
|
|
17
|
-
prop: 'bottom'
|
|
18
|
-
});
|
|
19
|
-
export const left = style({
|
|
20
|
-
prop: 'left'
|
|
21
|
-
});
|
|
22
|
-
export default compose(position, zIndex, top, right, bottom, left);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { internal_serializeStyles } from '@mui/styled-engine';
|
|
2
|
-
export default function preprocessStyles(input) {
|
|
3
|
-
const {
|
|
4
|
-
variants,
|
|
5
|
-
...style
|
|
6
|
-
} = input;
|
|
7
|
-
const result = {
|
|
8
|
-
variants,
|
|
9
|
-
style: internal_serializeStyles(style),
|
|
10
|
-
isProcessed: true
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// Not supported on styled-components
|
|
14
|
-
if (result.style === style) {
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
if (variants) {
|
|
18
|
-
variants.forEach(variant => {
|
|
19
|
-
if (typeof variant.style !== 'function') {
|
|
20
|
-
variant.style = internal_serializeStyles(variant.style);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./propsToClassKey.js";
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import capitalize from '@mui/utils/capitalize';
|
|
2
|
-
function isEmpty(string) {
|
|
3
|
-
return string.length === 0;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Generates string classKey based on the properties provided. It starts with the
|
|
8
|
-
* variant if defined, and then it appends all other properties in alphabetical order.
|
|
9
|
-
* @param {object} props - the properties for which the classKey should be created.
|
|
10
|
-
*/
|
|
11
|
-
export default function propsToClassKey(props) {
|
|
12
|
-
const {
|
|
13
|
-
variant,
|
|
14
|
-
...other
|
|
15
|
-
} = props;
|
|
16
|
-
let classKey = variant || '';
|
|
17
|
-
Object.keys(other).sort().forEach(key => {
|
|
18
|
-
if (key === 'color') {
|
|
19
|
-
classKey += isEmpty(classKey) ? props[key] : capitalize(props[key]);
|
|
20
|
-
} else {
|
|
21
|
-
classKey += `${isEmpty(classKey) ? key : capitalize(key)}${capitalize(props[key].toString())}`;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return classKey;
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./responsivePropType.js";
|
package/modern/shadows/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./shadows.js";
|
package/modern/sizing/index.js
DELETED
package/modern/sizing/sizing.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import style from "../style/index.js";
|
|
2
|
-
import compose from "../compose/index.js";
|
|
3
|
-
import { handleBreakpoints, values as breakpointsValues } from "../breakpoints/index.js";
|
|
4
|
-
export function sizingTransform(value) {
|
|
5
|
-
return value <= 1 && value !== 0 ? `${value * 100}%` : value;
|
|
6
|
-
}
|
|
7
|
-
export const width = style({
|
|
8
|
-
prop: 'width',
|
|
9
|
-
transform: sizingTransform
|
|
10
|
-
});
|
|
11
|
-
export const maxWidth = props => {
|
|
12
|
-
if (props.maxWidth !== undefined && props.maxWidth !== null) {
|
|
13
|
-
const styleFromPropValue = propValue => {
|
|
14
|
-
const breakpoint = props.theme?.breakpoints?.values?.[propValue] || breakpointsValues[propValue];
|
|
15
|
-
if (!breakpoint) {
|
|
16
|
-
return {
|
|
17
|
-
maxWidth: sizingTransform(propValue)
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
if (props.theme?.breakpoints?.unit !== 'px') {
|
|
21
|
-
return {
|
|
22
|
-
maxWidth: `${breakpoint}${props.theme.breakpoints.unit}`
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
maxWidth: breakpoint
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
return handleBreakpoints(props, props.maxWidth, styleFromPropValue);
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
};
|
|
33
|
-
maxWidth.filterProps = ['maxWidth'];
|
|
34
|
-
export const minWidth = style({
|
|
35
|
-
prop: 'minWidth',
|
|
36
|
-
transform: sizingTransform
|
|
37
|
-
});
|
|
38
|
-
export const height = style({
|
|
39
|
-
prop: 'height',
|
|
40
|
-
transform: sizingTransform
|
|
41
|
-
});
|
|
42
|
-
export const maxHeight = style({
|
|
43
|
-
prop: 'maxHeight',
|
|
44
|
-
transform: sizingTransform
|
|
45
|
-
});
|
|
46
|
-
export const minHeight = style({
|
|
47
|
-
prop: 'minHeight',
|
|
48
|
-
transform: sizingTransform
|
|
49
|
-
});
|
|
50
|
-
export const sizeWidth = style({
|
|
51
|
-
prop: 'size',
|
|
52
|
-
cssProperty: 'width',
|
|
53
|
-
transform: sizingTransform
|
|
54
|
-
});
|
|
55
|
-
export const sizeHeight = style({
|
|
56
|
-
prop: 'size',
|
|
57
|
-
cssProperty: 'height',
|
|
58
|
-
transform: sizingTransform
|
|
59
|
-
});
|
|
60
|
-
export const boxSizing = style({
|
|
61
|
-
prop: 'boxSizing'
|
|
62
|
-
});
|
|
63
|
-
const sizing = compose(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing);
|
|
64
|
-
export default sizing;
|
package/modern/spacing/index.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import responsivePropType from "../responsivePropType/index.js";
|
|
2
|
-
import { handleBreakpoints } from "../breakpoints/index.js";
|
|
3
|
-
import { getPath } from "../style/index.js";
|
|
4
|
-
import merge from "../merge/index.js";
|
|
5
|
-
import memoize from "../memoize/index.js";
|
|
6
|
-
const properties = {
|
|
7
|
-
m: 'margin',
|
|
8
|
-
p: 'padding'
|
|
9
|
-
};
|
|
10
|
-
const directions = {
|
|
11
|
-
t: 'Top',
|
|
12
|
-
r: 'Right',
|
|
13
|
-
b: 'Bottom',
|
|
14
|
-
l: 'Left',
|
|
15
|
-
x: ['Left', 'Right'],
|
|
16
|
-
y: ['Top', 'Bottom']
|
|
17
|
-
};
|
|
18
|
-
const aliases = {
|
|
19
|
-
marginX: 'mx',
|
|
20
|
-
marginY: 'my',
|
|
21
|
-
paddingX: 'px',
|
|
22
|
-
paddingY: 'py'
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// memoize() impact:
|
|
26
|
-
// From 300,000 ops/sec
|
|
27
|
-
// To 350,000 ops/sec
|
|
28
|
-
const getCssProperties = memoize(prop => {
|
|
29
|
-
// It's not a shorthand notation.
|
|
30
|
-
if (prop.length > 2) {
|
|
31
|
-
if (aliases[prop]) {
|
|
32
|
-
prop = aliases[prop];
|
|
33
|
-
} else {
|
|
34
|
-
return [prop];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const [a, b] = prop.split('');
|
|
38
|
-
const property = properties[a];
|
|
39
|
-
const direction = directions[b] || '';
|
|
40
|
-
return Array.isArray(direction) ? direction.map(dir => property + dir) : [property + direction];
|
|
41
|
-
});
|
|
42
|
-
export const marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd'];
|
|
43
|
-
export const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
|
|
44
|
-
const spacingKeys = [...marginKeys, ...paddingKeys];
|
|
45
|
-
export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
46
|
-
const themeSpacing = getPath(theme, themeKey, true) ?? defaultValue;
|
|
47
|
-
if (typeof themeSpacing === 'number' || typeof themeSpacing === 'string') {
|
|
48
|
-
return val => {
|
|
49
|
-
if (typeof val === 'string') {
|
|
50
|
-
return val;
|
|
51
|
-
}
|
|
52
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
53
|
-
if (typeof val !== 'number') {
|
|
54
|
-
console.error(`MUI: Expected ${propName} argument to be a number or a string, got ${val}.`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (typeof themeSpacing === 'string') {
|
|
58
|
-
if (themeSpacing.startsWith('var(') && val === 0) {
|
|
59
|
-
return 0;
|
|
60
|
-
}
|
|
61
|
-
if (themeSpacing.startsWith('var(') && val === 1) {
|
|
62
|
-
return themeSpacing;
|
|
63
|
-
}
|
|
64
|
-
return `calc(${val} * ${themeSpacing})`;
|
|
65
|
-
}
|
|
66
|
-
return themeSpacing * val;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
if (Array.isArray(themeSpacing)) {
|
|
70
|
-
return val => {
|
|
71
|
-
if (typeof val === 'string') {
|
|
72
|
-
return val;
|
|
73
|
-
}
|
|
74
|
-
const abs = Math.abs(val);
|
|
75
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
76
|
-
if (!Number.isInteger(abs)) {
|
|
77
|
-
console.error([`MUI: The \`theme.${themeKey}\` array type cannot be combined with non integer values.` + `You should either use an integer value that can be used as index, or define the \`theme.${themeKey}\` as a number.`].join('\n'));
|
|
78
|
-
} else if (abs > themeSpacing.length - 1) {
|
|
79
|
-
console.error([`MUI: The value provided (${abs}) overflows.`, `The supported values are: ${JSON.stringify(themeSpacing)}.`, `${abs} > ${themeSpacing.length - 1}, you need to add the missing values.`].join('\n'));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const transformed = themeSpacing[abs];
|
|
83
|
-
if (val >= 0) {
|
|
84
|
-
return transformed;
|
|
85
|
-
}
|
|
86
|
-
if (typeof transformed === 'number') {
|
|
87
|
-
return -transformed;
|
|
88
|
-
}
|
|
89
|
-
if (typeof transformed === 'string' && transformed.startsWith('var(')) {
|
|
90
|
-
return `calc(-1 * ${transformed})`;
|
|
91
|
-
}
|
|
92
|
-
return `-${transformed}`;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
if (typeof themeSpacing === 'function') {
|
|
96
|
-
return themeSpacing;
|
|
97
|
-
}
|
|
98
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
99
|
-
console.error([`MUI: The \`theme.${themeKey}\` value (${themeSpacing}) is invalid.`, 'It should be a number, an array or a function.'].join('\n'));
|
|
100
|
-
}
|
|
101
|
-
return () => undefined;
|
|
102
|
-
}
|
|
103
|
-
export function createUnarySpacing(theme) {
|
|
104
|
-
return createUnaryUnit(theme, 'spacing', 8, 'spacing');
|
|
105
|
-
}
|
|
106
|
-
export function getValue(transformer, propValue) {
|
|
107
|
-
if (typeof propValue === 'string' || propValue == null) {
|
|
108
|
-
return propValue;
|
|
109
|
-
}
|
|
110
|
-
return transformer(propValue);
|
|
111
|
-
}
|
|
112
|
-
export function getStyleFromPropValue(cssProperties, transformer) {
|
|
113
|
-
return propValue => cssProperties.reduce((acc, cssProperty) => {
|
|
114
|
-
acc[cssProperty] = getValue(transformer, propValue);
|
|
115
|
-
return acc;
|
|
116
|
-
}, {});
|
|
117
|
-
}
|
|
118
|
-
function resolveCssProperty(props, keys, prop, transformer) {
|
|
119
|
-
// Using a hash computation over an array iteration could be faster, but with only 28 items,
|
|
120
|
-
// it's doesn't worth the bundle size.
|
|
121
|
-
if (!keys.includes(prop)) {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
const cssProperties = getCssProperties(prop);
|
|
125
|
-
const styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
|
|
126
|
-
const propValue = props[prop];
|
|
127
|
-
return handleBreakpoints(props, propValue, styleFromPropValue);
|
|
128
|
-
}
|
|
129
|
-
function style(props, keys) {
|
|
130
|
-
const transformer = createUnarySpacing(props.theme);
|
|
131
|
-
return Object.keys(props).map(prop => resolveCssProperty(props, keys, prop, transformer)).reduce(merge, {});
|
|
132
|
-
}
|
|
133
|
-
export function margin(props) {
|
|
134
|
-
return style(props, marginKeys);
|
|
135
|
-
}
|
|
136
|
-
margin.propTypes = process.env.NODE_ENV !== 'production' ? marginKeys.reduce((obj, key) => {
|
|
137
|
-
obj[key] = responsivePropType;
|
|
138
|
-
return obj;
|
|
139
|
-
}, {}) : {};
|
|
140
|
-
margin.filterProps = marginKeys;
|
|
141
|
-
export function padding(props) {
|
|
142
|
-
return style(props, paddingKeys);
|
|
143
|
-
}
|
|
144
|
-
padding.propTypes = process.env.NODE_ENV !== 'production' ? paddingKeys.reduce((obj, key) => {
|
|
145
|
-
obj[key] = responsivePropType;
|
|
146
|
-
return obj;
|
|
147
|
-
}, {}) : {};
|
|
148
|
-
padding.filterProps = paddingKeys;
|
|
149
|
-
function spacing(props) {
|
|
150
|
-
return style(props, spacingKeys);
|
|
151
|
-
}
|
|
152
|
-
spacing.propTypes = process.env.NODE_ENV !== 'production' ? spacingKeys.reduce((obj, key) => {
|
|
153
|
-
obj[key] = responsivePropType;
|
|
154
|
-
return obj;
|
|
155
|
-
}, {}) : {};
|
|
156
|
-
spacing.filterProps = spacingKeys;
|
|
157
|
-
export default spacing;
|
package/modern/style/index.js
DELETED
package/modern/style/style.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import capitalize from '@mui/utils/capitalize';
|
|
2
|
-
import responsivePropType from "../responsivePropType/index.js";
|
|
3
|
-
import { handleBreakpoints } from "../breakpoints/index.js";
|
|
4
|
-
export function getPath(obj, path, checkVars = true) {
|
|
5
|
-
if (!path || typeof path !== 'string') {
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// Check if CSS variables are used
|
|
10
|
-
if (obj && obj.vars && checkVars) {
|
|
11
|
-
const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
|
|
12
|
-
if (val != null) {
|
|
13
|
-
return val;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return path.split('.').reduce((acc, item) => {
|
|
17
|
-
if (acc && acc[item] != null) {
|
|
18
|
-
return acc[item];
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}, obj);
|
|
22
|
-
}
|
|
23
|
-
export function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
|
|
24
|
-
let value;
|
|
25
|
-
if (typeof themeMapping === 'function') {
|
|
26
|
-
value = themeMapping(propValueFinal);
|
|
27
|
-
} else if (Array.isArray(themeMapping)) {
|
|
28
|
-
value = themeMapping[propValueFinal] || userValue;
|
|
29
|
-
} else {
|
|
30
|
-
value = getPath(themeMapping, propValueFinal) || userValue;
|
|
31
|
-
}
|
|
32
|
-
if (transform) {
|
|
33
|
-
value = transform(value, userValue, themeMapping);
|
|
34
|
-
}
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
function style(options) {
|
|
38
|
-
const {
|
|
39
|
-
prop,
|
|
40
|
-
cssProperty = options.prop,
|
|
41
|
-
themeKey,
|
|
42
|
-
transform
|
|
43
|
-
} = options;
|
|
44
|
-
|
|
45
|
-
// false positive
|
|
46
|
-
// eslint-disable-next-line react/function-component-definition
|
|
47
|
-
const fn = props => {
|
|
48
|
-
if (props[prop] == null) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
const propValue = props[prop];
|
|
52
|
-
const theme = props.theme;
|
|
53
|
-
const themeMapping = getPath(theme, themeKey) || {};
|
|
54
|
-
const styleFromPropValue = propValueFinal => {
|
|
55
|
-
let value = getStyleValue(themeMapping, transform, propValueFinal);
|
|
56
|
-
if (propValueFinal === value && typeof propValueFinal === 'string') {
|
|
57
|
-
// Haven't found value
|
|
58
|
-
value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
|
|
59
|
-
}
|
|
60
|
-
if (cssProperty === false) {
|
|
61
|
-
return value;
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
[cssProperty]: value
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
return handleBreakpoints(props, propValue, styleFromPropValue);
|
|
68
|
-
};
|
|
69
|
-
fn.propTypes = process.env.NODE_ENV !== 'production' ? {
|
|
70
|
-
[prop]: responsivePropType
|
|
71
|
-
} : {};
|
|
72
|
-
fn.filterProps = [prop];
|
|
73
|
-
return fn;
|
|
74
|
-
}
|
|
75
|
-
export default style;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|