@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.
Files changed (130) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/cssVars/cssVarsParser.d.ts +1 -1
  3. package/esm/cssVars/cssVarsParser.d.ts +1 -1
  4. package/esm/index.js +1 -1
  5. package/esm/memoTheme.d.ts +1 -1
  6. package/esm/useThemeProps/getThemeProps.d.ts +0 -5
  7. package/esm/version/index.js +2 -2
  8. package/index.js +1 -1
  9. package/memoTheme.d.ts +1 -1
  10. package/modern/cssVars/cssVarsParser.d.ts +1 -1
  11. package/modern/memoTheme.d.ts +1 -1
  12. package/modern/useThemeProps/getThemeProps.d.ts +0 -5
  13. package/package.json +6 -14
  14. package/useThemeProps/getThemeProps.d.ts +0 -5
  15. package/version/index.js +2 -2
  16. package/modern/Box/Box.js +0 -30
  17. package/modern/Box/boxClasses.js +0 -3
  18. package/modern/Box/index.js +0 -3
  19. package/modern/Container/Container.js +0 -61
  20. package/modern/Container/ContainerProps.js +0 -1
  21. package/modern/Container/containerClasses.js +0 -7
  22. package/modern/Container/createContainer.js +0 -149
  23. package/modern/Container/index.js +0 -3
  24. package/modern/DefaultPropsProvider/DefaultPropsProvider.js +0 -64
  25. package/modern/DefaultPropsProvider/index.js +0 -1
  26. package/modern/GlobalStyles/GlobalStyles.js +0 -37
  27. package/modern/GlobalStyles/index.js +0 -2
  28. package/modern/Grid/Grid.js +0 -106
  29. package/modern/Grid/GridProps.js +0 -1
  30. package/modern/Grid/createGrid.js +0 -155
  31. package/modern/Grid/deleteLegacyGridProps.js +0 -41
  32. package/modern/Grid/gridClasses.js +0 -19
  33. package/modern/Grid/gridGenerator.js +0 -193
  34. package/modern/Grid/index.js +0 -7
  35. package/modern/Grid/traverseBreakpoints.js +0 -42
  36. package/modern/InitColorSchemeScript/InitColorSchemeScript.js +0 -78
  37. package/modern/InitColorSchemeScript/index.js +0 -1
  38. package/modern/RtlProvider/index.js +0 -24
  39. package/modern/Stack/Stack.js +0 -62
  40. package/modern/Stack/StackProps.js +0 -1
  41. package/modern/Stack/createStack.js +0 -173
  42. package/modern/Stack/index.js +0 -5
  43. package/modern/Stack/stackClasses.js +0 -7
  44. package/modern/ThemeProvider/ThemeProvider.js +0 -97
  45. package/modern/ThemeProvider/index.js +0 -1
  46. package/modern/borders/borders.js +0 -49
  47. package/modern/borders/index.js +0 -2
  48. package/modern/breakpoints/breakpoints.js +0 -171
  49. package/modern/breakpoints/index.js +0 -2
  50. package/modern/colorManipulator/colorManipulator.js +0 -349
  51. package/modern/colorManipulator/index.js +0 -1
  52. package/modern/compose/compose.js +0 -24
  53. package/modern/compose/index.js +0 -1
  54. package/modern/createBox/createBox.js +0 -35
  55. package/modern/createBox/index.js +0 -1
  56. package/modern/createBreakpoints/createBreakpoints.js +0 -81
  57. package/modern/createBreakpoints/index.js +0 -3
  58. package/modern/createStyled/createStyled.js +0 -276
  59. package/modern/createStyled/index.js +0 -2
  60. package/modern/createTheme/applyStyles.js +0 -87
  61. package/modern/createTheme/createSpacing.js +0 -31
  62. package/modern/createTheme/createTheme.js +0 -49
  63. package/modern/createTheme/index.js +0 -3
  64. package/modern/createTheme/shape.js +0 -4
  65. package/modern/cssContainerQueries/cssContainerQueries.js +0 -69
  66. package/modern/cssContainerQueries/index.js +0 -2
  67. package/modern/cssGrid/cssGrid.js +0 -85
  68. package/modern/cssGrid/index.js +0 -2
  69. package/modern/cssVars/createCssVarsProvider.js +0 -338
  70. package/modern/cssVars/createCssVarsTheme.js +0 -21
  71. package/modern/cssVars/createGetCssVar.js +0 -22
  72. package/modern/cssVars/cssVarsParser.js +0 -129
  73. package/modern/cssVars/getColorSchemeSelector.js +0 -26
  74. package/modern/cssVars/index.js +0 -5
  75. package/modern/cssVars/localStorageManager.js +0 -51
  76. package/modern/cssVars/prepareCssVars.js +0 -153
  77. package/modern/cssVars/prepareTypographyVars.js +0 -11
  78. package/modern/cssVars/useCurrentColorScheme.js +0 -228
  79. package/modern/display/display.js +0 -27
  80. package/modern/display/index.js +0 -2
  81. package/modern/flexbox/flexbox.js +0 -43
  82. package/modern/flexbox/index.js +0 -2
  83. package/modern/getThemeValue/getThemeValue.js +0 -51
  84. package/modern/getThemeValue/index.js +0 -2
  85. package/modern/index.js +0 -75
  86. package/modern/memoTheme.js +0 -28
  87. package/modern/memoize/index.js +0 -1
  88. package/modern/memoize/memoize.js +0 -9
  89. package/modern/merge/index.js +0 -1
  90. package/modern/merge/merge.js +0 -10
  91. package/modern/package.json +0 -1
  92. package/modern/palette/index.js +0 -2
  93. package/modern/palette/palette.js +0 -26
  94. package/modern/positions/index.js +0 -2
  95. package/modern/positions/positions.js +0 -22
  96. package/modern/preprocessStyles.js +0 -25
  97. package/modern/propsToClassKey/index.js +0 -1
  98. package/modern/propsToClassKey/propsToClassKey.js +0 -25
  99. package/modern/responsivePropType/index.js +0 -1
  100. package/modern/responsivePropType/responsivePropType.js +0 -3
  101. package/modern/shadows/index.js +0 -1
  102. package/modern/shadows/shadows.js +0 -6
  103. package/modern/sizing/index.js +0 -2
  104. package/modern/sizing/sizing.js +0 -64
  105. package/modern/spacing/index.js +0 -2
  106. package/modern/spacing/spacing.js +0 -157
  107. package/modern/style/index.js +0 -2
  108. package/modern/style/style.js +0 -75
  109. package/modern/styleFunctionSx/AliasesCSSProperties.js +0 -1
  110. package/modern/styleFunctionSx/OverwriteCSSProperties.js +0 -1
  111. package/modern/styleFunctionSx/StandardCssProperties.js +0 -1
  112. package/modern/styleFunctionSx/defaultSxConfig.js +0 -294
  113. package/modern/styleFunctionSx/extendSxProp.js +0 -51
  114. package/modern/styleFunctionSx/index.js +0 -4
  115. package/modern/styleFunctionSx/styleFunctionSx.js +0 -127
  116. package/modern/styled/index.js +0 -1
  117. package/modern/styled/styled.js +0 -3
  118. package/modern/typography/index.js +0 -2
  119. package/modern/typography/typography.js +0 -37
  120. package/modern/useMediaQuery/index.js +0 -2
  121. package/modern/useMediaQuery/useMediaQuery.js +0 -118
  122. package/modern/useTheme/index.js +0 -2
  123. package/modern/useTheme/useTheme.js +0 -9
  124. package/modern/useThemeProps/getThemeProps.js +0 -12
  125. package/modern/useThemeProps/index.js +0 -2
  126. package/modern/useThemeProps/useThemeProps.js +0 -20
  127. package/modern/useThemeWithoutDefault/index.js +0 -1
  128. package/modern/useThemeWithoutDefault/useThemeWithoutDefault.js +0 -12
  129. package/modern/version/index.js +0 -6
  130. 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,2 +0,0 @@
1
- export { default } from "./positions.js";
2
- export * from "./positions.js";
@@ -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";
@@ -1,3 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- const responsivePropType = process.env.NODE_ENV !== 'production' ? PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object, PropTypes.array]) : {};
3
- export default responsivePropType;
@@ -1 +0,0 @@
1
- export { default } from "./shadows.js";
@@ -1,6 +0,0 @@
1
- import style from "../style/index.js";
2
- const boxShadow = style({
3
- prop: 'boxShadow',
4
- themeKey: 'shadows'
5
- });
6
- export default boxShadow;
@@ -1,2 +0,0 @@
1
- export { default } from "./sizing.js";
2
- export * from "./sizing.js";
@@ -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;
@@ -1,2 +0,0 @@
1
- export { default } from "./spacing.js";
2
- export * from "./spacing.js";
@@ -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;
@@ -1,2 +0,0 @@
1
- export { default } from "./style.js";
2
- export * from "./style.js";
@@ -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 {};