@mui/system 5.10.13 → 5.10.15

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 (185) hide show
  1. package/Box/Box.js +1 -10
  2. package/Box/index.js +0 -2
  3. package/CHANGELOG.md +132 -2
  4. package/Container/Container.js +2 -17
  5. package/Container/containerClasses.js +0 -3
  6. package/Container/createContainer.js +15 -37
  7. package/Container/index.js +0 -6
  8. package/Stack/Stack.js +1 -12
  9. package/Stack/createStack.js +10 -48
  10. package/Stack/index.js +0 -9
  11. package/Stack/stackClasses.js +0 -3
  12. package/ThemeProvider/ThemeProvider.js +2 -22
  13. package/ThemeProvider/index.js +0 -2
  14. package/Unstable_Grid/Grid.js +6 -42
  15. package/Unstable_Grid/createGrid.js +19 -49
  16. package/Unstable_Grid/gridClasses.js +8 -7
  17. package/Unstable_Grid/gridGenerator.d.ts +4 -3
  18. package/Unstable_Grid/gridGenerator.js +22 -63
  19. package/Unstable_Grid/index.js +0 -9
  20. package/borders.js +0 -14
  21. package/breakpoints.js +3 -32
  22. package/colorManipulator.js +13 -55
  23. package/compose.js +0 -7
  24. package/createBox.js +5 -20
  25. package/createStyled.js +27 -71
  26. package/createTheme/createBreakpoints.js +22 -37
  27. package/createTheme/createSpacing.js +4 -8
  28. package/createTheme/createTheme.js +6 -16
  29. package/createTheme/index.js +0 -2
  30. package/cssGrid.js +0 -21
  31. package/cssVars/createCssVarsProvider.js +33 -74
  32. package/cssVars/createGetCssVar.js +2 -7
  33. package/cssVars/cssVarsParser.js +3 -15
  34. package/cssVars/getInitColorSchemeScript.js +0 -6
  35. package/cssVars/index.js +0 -3
  36. package/cssVars/useCurrentColorScheme.js +20 -49
  37. package/display.js +0 -6
  38. package/esm/Box/Box.js +1 -6
  39. package/esm/Container/Container.js +3 -14
  40. package/esm/Container/createContainer.js +15 -25
  41. package/esm/Stack/Stack.js +1 -9
  42. package/esm/Stack/createStack.js +10 -29
  43. package/esm/ThemeProvider/ThemeProvider.js +2 -11
  44. package/esm/Unstable_Grid/Grid.js +6 -39
  45. package/esm/Unstable_Grid/createGrid.js +18 -35
  46. package/esm/Unstable_Grid/gridClasses.js +8 -4
  47. package/esm/Unstable_Grid/gridGenerator.js +20 -38
  48. package/esm/borders.js +0 -6
  49. package/esm/breakpoints.js +7 -22
  50. package/esm/colorManipulator.js +13 -43
  51. package/esm/compose.js +0 -5
  52. package/esm/createBox.js +5 -7
  53. package/esm/createStyled.js +27 -64
  54. package/esm/createTheme/createBreakpoints.js +22 -34
  55. package/esm/createTheme/createSpacing.js +4 -7
  56. package/esm/createTheme/createTheme.js +6 -9
  57. package/esm/cssGrid.js +0 -9
  58. package/esm/cssVars/createCssVarsProvider.js +33 -60
  59. package/esm/cssVars/createGetCssVar.js +2 -6
  60. package/esm/cssVars/cssVarsParser.js +3 -11
  61. package/esm/cssVars/useCurrentColorScheme.js +20 -44
  62. package/esm/getThemeValue.js +0 -2
  63. package/esm/index.js +3 -3
  64. package/esm/memoize.js +0 -1
  65. package/esm/merge.js +0 -3
  66. package/esm/palette.js +0 -3
  67. package/esm/propsToClassKey.js +4 -7
  68. package/esm/sizing.js +0 -5
  69. package/esm/spacing.js +3 -23
  70. package/esm/style.js +5 -22
  71. package/esm/styleFunctionSx/extendSxProp.js +3 -10
  72. package/esm/styleFunctionSx/styleFunctionSx.js +3 -16
  73. package/esm/sx/sx.js +0 -2
  74. package/esm/useTheme.js +0 -2
  75. package/esm/useThemeProps/getThemeProps.js +0 -2
  76. package/esm/useThemeWithoutDefault.js +0 -3
  77. package/flexbox.js +0 -4
  78. package/getThemeValue.js +0 -14
  79. package/index.d.ts +2 -0
  80. package/index.js +16 -55
  81. package/legacy/Box/Box.js +1 -6
  82. package/legacy/Container/Container.js +3 -14
  83. package/legacy/Container/createContainer.js +29 -39
  84. package/legacy/Stack/Stack.js +1 -9
  85. package/legacy/Stack/createStack.js +17 -37
  86. package/legacy/ThemeProvider/ThemeProvider.js +3 -12
  87. package/legacy/Unstable_Grid/Grid.js +6 -39
  88. package/legacy/Unstable_Grid/createGrid.js +34 -53
  89. package/legacy/Unstable_Grid/gridGenerator.js +36 -58
  90. package/legacy/borders.js +0 -6
  91. package/legacy/breakpoints.js +9 -28
  92. package/legacy/colorManipulator.js +16 -48
  93. package/legacy/compose.js +0 -6
  94. package/legacy/createBox.js +9 -11
  95. package/legacy/createStyled.js +27 -68
  96. package/legacy/createTheme/createBreakpoints.js +20 -33
  97. package/legacy/createTheme/createSpacing.js +4 -9
  98. package/legacy/createTheme/createTheme.js +7 -13
  99. package/legacy/cssGrid.js +0 -9
  100. package/legacy/cssVars/createCssVarsProvider.js +98 -130
  101. package/legacy/cssVars/createGetCssVar.js +2 -10
  102. package/legacy/cssVars/cssVarsParser.js +7 -20
  103. package/legacy/cssVars/getInitColorSchemeScript.js +14 -15
  104. package/legacy/cssVars/useCurrentColorScheme.js +43 -69
  105. package/legacy/getThemeValue.js +0 -3
  106. package/legacy/index.js +4 -4
  107. package/legacy/memoize.js +0 -1
  108. package/legacy/merge.js +0 -3
  109. package/legacy/palette.js +0 -3
  110. package/legacy/propsToClassKey.js +2 -5
  111. package/legacy/sizing.js +0 -5
  112. package/legacy/spacing.js +6 -27
  113. package/legacy/style.js +9 -27
  114. package/legacy/styleFunctionSx/extendSxProp.js +3 -11
  115. package/legacy/styleFunctionSx/styleFunctionSx.js +6 -21
  116. package/legacy/sx/sx.js +0 -2
  117. package/legacy/useTheme.js +0 -2
  118. package/legacy/useThemeProps/getThemeProps.js +2 -4
  119. package/legacy/useThemeProps/useThemeProps.js +2 -2
  120. package/legacy/useThemeWithoutDefault.js +0 -3
  121. package/memoize.js +0 -2
  122. package/merge.js +0 -5
  123. package/modern/Box/Box.js +1 -6
  124. package/modern/Container/Container.js +3 -14
  125. package/modern/Container/createContainer.js +15 -25
  126. package/modern/Stack/Stack.js +1 -9
  127. package/modern/Stack/createStack.js +10 -29
  128. package/modern/ThemeProvider/ThemeProvider.js +2 -11
  129. package/modern/Unstable_Grid/Grid.js +6 -39
  130. package/modern/Unstable_Grid/createGrid.js +18 -34
  131. package/modern/Unstable_Grid/gridClasses.js +8 -4
  132. package/modern/Unstable_Grid/gridGenerator.js +20 -36
  133. package/modern/borders.js +0 -6
  134. package/modern/breakpoints.js +7 -21
  135. package/modern/colorManipulator.js +13 -43
  136. package/modern/compose.js +0 -5
  137. package/modern/createBox.js +5 -7
  138. package/modern/createStyled.js +27 -63
  139. package/modern/createTheme/createBreakpoints.js +22 -34
  140. package/modern/createTheme/createSpacing.js +4 -7
  141. package/modern/createTheme/createTheme.js +6 -9
  142. package/modern/cssGrid.js +0 -9
  143. package/modern/cssVars/createCssVarsProvider.js +33 -60
  144. package/modern/cssVars/createGetCssVar.js +2 -6
  145. package/modern/cssVars/cssVarsParser.js +3 -11
  146. package/modern/cssVars/useCurrentColorScheme.js +20 -44
  147. package/modern/getThemeValue.js +0 -2
  148. package/modern/index.js +4 -4
  149. package/modern/memoize.js +0 -1
  150. package/modern/merge.js +0 -3
  151. package/modern/palette.js +0 -3
  152. package/modern/propsToClassKey.js +4 -7
  153. package/modern/sizing.js +0 -4
  154. package/modern/spacing.js +3 -22
  155. package/modern/style.js +5 -22
  156. package/modern/styleFunctionSx/extendSxProp.js +3 -10
  157. package/modern/styleFunctionSx/styleFunctionSx.js +3 -16
  158. package/modern/sx/sx.js +0 -2
  159. package/modern/useTheme.js +0 -2
  160. package/modern/useThemeProps/getThemeProps.js +0 -2
  161. package/modern/useThemeWithoutDefault.js +0 -3
  162. package/package.json +6 -6
  163. package/palette.js +0 -6
  164. package/positions.js +0 -6
  165. package/propsToClassKey.js +4 -10
  166. package/responsivePropType.d.ts +3 -0
  167. package/responsivePropType.js +0 -3
  168. package/shadows.js +0 -3
  169. package/sizing.js +0 -11
  170. package/spacing.d.ts +14 -0
  171. package/spacing.js +3 -37
  172. package/style.d.ts +6 -0
  173. package/style.js +6 -27
  174. package/styleFunctionSx/extendSxProp.js +3 -15
  175. package/styleFunctionSx/index.js +0 -5
  176. package/styleFunctionSx/styleFunctionSx.js +3 -21
  177. package/styled.js +0 -3
  178. package/sx/index.js +0 -2
  179. package/sx/sx.js +0 -4
  180. package/typography.js +0 -4
  181. package/useTheme.js +0 -6
  182. package/useThemeProps/getThemeProps.js +0 -4
  183. package/useThemeProps/index.js +0 -3
  184. package/useThemeProps/useThemeProps.js +0 -4
  185. package/useThemeWithoutDefault.js +0 -4
@@ -1,43 +1,37 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"],
4
- _excluded2 = ["theme"],
5
- _excluded3 = ["theme"];
6
-
4
+ _excluded2 = ["theme"],
5
+ _excluded3 = ["theme"];
7
6
  /* eslint-disable no-underscore-dangle */
8
7
  import styledEngineStyled, { internal_processStyles as processStyles } from '@mui/styled-engine';
9
8
  import { getDisplayName } from '@mui/utils';
10
9
  import createTheme from './createTheme';
11
10
  import propsToClassKey from './propsToClassKey';
12
11
  import defaultStyleFunctionSx from './styleFunctionSx';
13
-
14
12
  function isEmpty(obj) {
15
13
  return Object.keys(obj).length === 0;
16
- } // https://github.com/emotion-js/emotion/blob/26ded6109fcd8ca9875cc2ce4564fee678a3f3c5/packages/styled/src/utils.js#L40
17
-
14
+ }
18
15
 
16
+ // https://github.com/emotion-js/emotion/blob/26ded6109fcd8ca9875cc2ce4564fee678a3f3c5/packages/styled/src/utils.js#L40
19
17
  function isStringTag(tag) {
20
- return typeof tag === 'string' && // 96 is one less than the char code
18
+ return typeof tag === 'string' &&
19
+ // 96 is one less than the char code
21
20
  // for "a" so this is checking that
22
21
  // it's a lowercase character
23
22
  tag.charCodeAt(0) > 96;
24
23
  }
25
-
26
24
  const getStyleOverrides = (name, theme) => {
27
25
  if (theme.components && theme.components[name] && theme.components[name].styleOverrides) {
28
26
  return theme.components[name].styleOverrides;
29
27
  }
30
-
31
28
  return null;
32
29
  };
33
-
34
30
  const getVariantStyles = (name, theme) => {
35
31
  let variants = [];
36
-
37
32
  if (theme && theme.components && theme.components[name] && theme.components[name].variants) {
38
33
  variants = theme.components[name].variants;
39
34
  }
40
-
41
35
  const variantsStyles = {};
42
36
  variants.forEach(definition => {
43
37
  const key = propsToClassKey(definition.props);
@@ -45,14 +39,12 @@ const getVariantStyles = (name, theme) => {
45
39
  });
46
40
  return variantsStyles;
47
41
  };
48
-
49
42
  const variantsResolver = (props, styles, theme, name) => {
50
43
  const {
51
44
  ownerState = {}
52
45
  } = props;
53
46
  const variantsStyles = [];
54
47
  const themeVariants = theme?.components?.[name]?.variants;
55
-
56
48
  if (themeVariants) {
57
49
  themeVariants.forEach(themeVariant => {
58
50
  let isMatch = true;
@@ -61,26 +53,22 @@ const variantsResolver = (props, styles, theme, name) => {
61
53
  isMatch = false;
62
54
  }
63
55
  });
64
-
65
56
  if (isMatch) {
66
57
  variantsStyles.push(styles[propsToClassKey(themeVariant.props)]);
67
58
  }
68
59
  });
69
60
  }
70
-
71
61
  return variantsStyles;
72
- }; // Update /system/styled/#api in case if this changes
73
-
62
+ };
74
63
 
64
+ // Update /system/styled/#api in case if this changes
75
65
  export function shouldForwardProp(prop) {
76
66
  return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
77
67
  }
78
68
  export const systemDefaultTheme = createTheme();
79
-
80
69
  const lowercaseFirstLetter = string => {
81
70
  return string.charAt(0).toLowerCase() + string.slice(1);
82
71
  };
83
-
84
72
  export default function createStyled(input = {}) {
85
73
  const {
86
74
  defaultTheme = systemDefaultTheme,
@@ -88,41 +76,35 @@ export default function createStyled(input = {}) {
88
76
  slotShouldForwardProp = shouldForwardProp,
89
77
  styleFunctionSx = defaultStyleFunctionSx
90
78
  } = input;
91
-
92
79
  const systemSx = props => {
93
80
  const theme = isEmpty(props.theme) ? defaultTheme : props.theme;
94
81
  return styleFunctionSx(_extends({}, props, {
95
82
  theme
96
83
  }));
97
84
  };
98
-
99
85
  systemSx.__mui_systemSx = true;
100
86
  return (tag, inputOptions = {}) => {
101
87
  // Filter out the `sx` style function from the previous styled component to prevent unnecessary styles generated by the composite components.
102
88
  processStyles(tag, styles => styles.filter(style => !style?.__mui_systemSx));
103
-
104
89
  const {
105
- name: componentName,
106
- slot: componentSlot,
107
- skipVariantsResolver: inputSkipVariantsResolver,
108
- skipSx: inputSkipSx,
109
- overridesResolver
110
- } = inputOptions,
111
- options = _objectWithoutPropertiesLoose(inputOptions, _excluded); // if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
112
-
113
-
90
+ name: componentName,
91
+ slot: componentSlot,
92
+ skipVariantsResolver: inputSkipVariantsResolver,
93
+ skipSx: inputSkipSx,
94
+ overridesResolver
95
+ } = inputOptions,
96
+ options = _objectWithoutPropertiesLoose(inputOptions, _excluded);
97
+
98
+ // if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
114
99
  const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver : componentSlot && componentSlot !== 'Root' || false;
115
100
  const skipSx = inputSkipSx || false;
116
101
  let label;
117
-
118
102
  if (process.env.NODE_ENV !== 'production') {
119
103
  if (componentName) {
120
104
  label = `${componentName}-${lowercaseFirstLetter(componentSlot || 'Root')}`;
121
105
  }
122
106
  }
123
-
124
107
  let shouldForwardPropOption = shouldForwardProp;
125
-
126
108
  if (componentSlot === 'Root') {
127
109
  shouldForwardPropOption = rootShouldForwardProp;
128
110
  } else if (componentSlot) {
@@ -132,12 +114,10 @@ export default function createStyled(input = {}) {
132
114
  // for string (html) tag, preserve the behavior in emotion & styled-components.
133
115
  shouldForwardPropOption = undefined;
134
116
  }
135
-
136
117
  const defaultStyledResolver = styledEngineStyled(tag, _extends({
137
118
  shouldForwardProp: shouldForwardPropOption,
138
119
  label
139
120
  }, options));
140
-
141
121
  const muiStyledResolver = (styleArg, ...expressions) => {
142
122
  const expressionsWithDefaultTheme = expressions ? expressions.map(stylesArg => {
143
123
  // On the server Emotion doesn't use React.forwardRef for creating components, so the created
@@ -145,22 +125,19 @@ export default function createStyled(input = {}) {
145
125
  // which are basically components used as a selectors.
146
126
  return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? _ref => {
147
127
  let {
148
- theme: themeInput
149
- } = _ref,
150
- other = _objectWithoutPropertiesLoose(_ref, _excluded2);
151
-
128
+ theme: themeInput
129
+ } = _ref,
130
+ other = _objectWithoutPropertiesLoose(_ref, _excluded2);
152
131
  return stylesArg(_extends({
153
132
  theme: isEmpty(themeInput) ? defaultTheme : themeInput
154
133
  }, other));
155
134
  } : stylesArg;
156
135
  }) : [];
157
136
  let transformedStyleArg = styleArg;
158
-
159
137
  if (componentName && overridesResolver) {
160
138
  expressionsWithDefaultTheme.push(props => {
161
139
  const theme = isEmpty(props.theme) ? defaultTheme : props.theme;
162
140
  const styleOverrides = getStyleOverrides(componentName, theme);
163
-
164
141
  if (styleOverrides) {
165
142
  const resolvedStyleOverrides = {};
166
143
  Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => {
@@ -170,69 +147,56 @@ export default function createStyled(input = {}) {
170
147
  });
171
148
  return overridesResolver(props, resolvedStyleOverrides);
172
149
  }
173
-
174
150
  return null;
175
151
  });
176
152
  }
177
-
178
153
  if (componentName && !skipVariantsResolver) {
179
154
  expressionsWithDefaultTheme.push(props => {
180
155
  const theme = isEmpty(props.theme) ? defaultTheme : props.theme;
181
156
  return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
182
157
  });
183
158
  }
184
-
185
159
  if (!skipSx) {
186
160
  expressionsWithDefaultTheme.push(systemSx);
187
161
  }
188
-
189
162
  const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length;
190
-
191
163
  if (Array.isArray(styleArg) && numOfCustomFnsApplied > 0) {
192
- const placeholders = new Array(numOfCustomFnsApplied).fill(''); // If the type is array, than we need to add placeholders in the template for the overrides, variants and the sx styles.
193
-
164
+ const placeholders = new Array(numOfCustomFnsApplied).fill('');
165
+ // If the type is array, than we need to add placeholders in the template for the overrides, variants and the sx styles.
194
166
  transformedStyleArg = [...styleArg, ...placeholders];
195
167
  transformedStyleArg.raw = [...styleArg.raw, ...placeholders];
196
- } else if (typeof styleArg === 'function' && // On the server Emotion doesn't use React.forwardRef for creating components, so the created
168
+ } else if (typeof styleArg === 'function' &&
169
+ // On the server Emotion doesn't use React.forwardRef for creating components, so the created
197
170
  // component stays as a function. This condition makes sure that we do not interpolate functions
198
171
  // which are basically components used as a selectors.
199
172
  styleArg.__emotion_real !== styleArg) {
200
173
  // If the type is function, we need to define the default theme.
201
174
  transformedStyleArg = _ref2 => {
202
175
  let {
203
- theme: themeInput
204
- } = _ref2,
205
- other = _objectWithoutPropertiesLoose(_ref2, _excluded3);
206
-
176
+ theme: themeInput
177
+ } = _ref2,
178
+ other = _objectWithoutPropertiesLoose(_ref2, _excluded3);
207
179
  return styleArg(_extends({
208
180
  theme: isEmpty(themeInput) ? defaultTheme : themeInput
209
181
  }, other));
210
182
  };
211
183
  }
212
-
213
184
  const Component = defaultStyledResolver(transformedStyleArg, ...expressionsWithDefaultTheme);
214
-
215
185
  if (process.env.NODE_ENV !== 'production') {
216
186
  let displayName;
217
-
218
187
  if (componentName) {
219
188
  displayName = `${componentName}${componentSlot || ''}`;
220
189
  }
221
-
222
190
  if (displayName === undefined) {
223
191
  displayName = `Styled(${getDisplayName(tag)})`;
224
192
  }
225
-
226
193
  Component.displayName = displayName;
227
194
  }
228
-
229
195
  return Component;
230
196
  };
231
-
232
197
  if (defaultStyledResolver.withConfig) {
233
198
  muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
234
199
  }
235
-
236
200
  return muiStyledResolver;
237
201
  };
238
202
  }
@@ -4,84 +4,72 @@ const _excluded = ["values", "unit", "step"];
4
4
  // Sorted ASC by size. That's important.
5
5
  // It can't be configured as it's used statically for propTypes.
6
6
  export const breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
7
-
8
7
  const sortBreakpointsValues = values => {
9
8
  const breakpointsAsArray = Object.keys(values).map(key => ({
10
9
  key,
11
10
  val: values[key]
12
- })) || []; // Sort in ascending order
13
-
11
+ })) || [];
12
+ // Sort in ascending order
14
13
  breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
15
14
  return breakpointsAsArray.reduce((acc, obj) => {
16
15
  return _extends({}, acc, {
17
16
  [obj.key]: obj.val
18
17
  });
19
18
  }, {});
20
- }; // Keep in mind that @media is inclusive by the CSS specification.
21
-
19
+ };
22
20
 
21
+ // Keep in mind that @media is inclusive by the CSS specification.
23
22
  export default function createBreakpoints(breakpoints) {
24
23
  const {
25
- // The breakpoint **start** at this value.
26
- // For instance with the first breakpoint xs: [xs, sm).
27
- values = {
28
- xs: 0,
29
- // phone
30
- sm: 600,
31
- // tablet
32
- md: 900,
33
- // small laptop
34
- lg: 1200,
35
- // desktop
36
- xl: 1536 // large screen
37
-
38
- },
39
- unit = 'px',
40
- step = 5
41
- } = breakpoints,
42
- other = _objectWithoutPropertiesLoose(breakpoints, _excluded);
43
-
24
+ // The breakpoint **start** at this value.
25
+ // For instance with the first breakpoint xs: [xs, sm).
26
+ values = {
27
+ xs: 0,
28
+ // phone
29
+ sm: 600,
30
+ // tablet
31
+ md: 900,
32
+ // small laptop
33
+ lg: 1200,
34
+ // desktop
35
+ xl: 1536 // large screen
36
+ },
37
+
38
+ unit = 'px',
39
+ step = 5
40
+ } = breakpoints,
41
+ other = _objectWithoutPropertiesLoose(breakpoints, _excluded);
44
42
  const sortedValues = sortBreakpointsValues(values);
45
43
  const keys = Object.keys(sortedValues);
46
-
47
44
  function up(key) {
48
45
  const value = typeof values[key] === 'number' ? values[key] : key;
49
46
  return `@media (min-width:${value}${unit})`;
50
47
  }
51
-
52
48
  function down(key) {
53
49
  const value = typeof values[key] === 'number' ? values[key] : key;
54
50
  return `@media (max-width:${value - step / 100}${unit})`;
55
51
  }
56
-
57
52
  function between(start, end) {
58
53
  const endIndex = keys.indexOf(end);
59
54
  return `@media (min-width:${typeof values[start] === 'number' ? values[start] : start}${unit}) and ` + `(max-width:${(endIndex !== -1 && typeof values[keys[endIndex]] === 'number' ? values[keys[endIndex]] : end) - step / 100}${unit})`;
60
55
  }
61
-
62
56
  function only(key) {
63
57
  if (keys.indexOf(key) + 1 < keys.length) {
64
58
  return between(key, keys[keys.indexOf(key) + 1]);
65
59
  }
66
-
67
60
  return up(key);
68
61
  }
69
-
70
62
  function not(key) {
71
63
  // handle first and last key separately, for better readability
72
64
  const keyIndex = keys.indexOf(key);
73
-
74
65
  if (keyIndex === 0) {
75
66
  return up(keys[1]);
76
67
  }
77
-
78
68
  if (keyIndex === keys.length - 1) {
79
69
  return down(keys[keyIndex]);
80
70
  }
81
-
82
71
  return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
83
72
  }
84
-
85
73
  return _extends({
86
74
  keys,
87
75
  values: sortedValues,
@@ -1,33 +1,30 @@
1
1
  import { createUnarySpacing } from '../spacing';
2
-
3
2
  /* tslint:enable:unified-signatures */
3
+
4
4
  export default function createSpacing(spacingInput = 8) {
5
5
  // Already transformed.
6
6
  if (spacingInput.mui) {
7
7
  return spacingInput;
8
- } // Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout.
8
+ }
9
+
10
+ // Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout.
9
11
  // Smaller components, such as icons, can align to a 4dp grid.
10
12
  // https://m2.material.io/design/layout/understanding-layout.html
11
-
12
-
13
13
  const transform = createUnarySpacing({
14
14
  spacing: spacingInput
15
15
  });
16
-
17
16
  const spacing = (...argsInput) => {
18
17
  if (process.env.NODE_ENV !== 'production') {
19
18
  if (!(argsInput.length <= 4)) {
20
19
  console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${argsInput.length}`);
21
20
  }
22
21
  }
23
-
24
22
  const args = argsInput.length === 0 ? [1] : argsInput;
25
23
  return args.map(argument => {
26
24
  const output = transform(argument);
27
25
  return typeof output === 'number' ? `${output}px` : output;
28
26
  }).join(' ');
29
27
  };
30
-
31
28
  spacing.mui = true;
32
29
  return spacing;
33
30
  }
@@ -5,16 +5,14 @@ import { deepmerge } from '@mui/utils';
5
5
  import createBreakpoints from './createBreakpoints';
6
6
  import shape from './shape';
7
7
  import createSpacing from './createSpacing';
8
-
9
8
  function createTheme(options = {}, ...args) {
10
9
  const {
11
- breakpoints: breakpointsInput = {},
12
- palette: paletteInput = {},
13
- spacing: spacingInput,
14
- shape: shapeInput = {}
15
- } = options,
16
- other = _objectWithoutPropertiesLoose(options, _excluded);
17
-
10
+ breakpoints: breakpointsInput = {},
11
+ palette: paletteInput = {},
12
+ spacing: spacingInput,
13
+ shape: shapeInput = {}
14
+ } = options,
15
+ other = _objectWithoutPropertiesLoose(options, _excluded);
18
16
  const breakpoints = createBreakpoints(breakpointsInput);
19
17
  const spacing = createSpacing(spacingInput);
20
18
  let muiTheme = deepmerge({
@@ -31,5 +29,4 @@ function createTheme(options = {}, ...args) {
31
29
  muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
32
30
  return muiTheme;
33
31
  }
34
-
35
32
  export default createTheme;
package/modern/cssGrid.js CHANGED
@@ -6,14 +6,11 @@ import responsivePropType from './responsivePropType';
6
6
  export const gap = props => {
7
7
  if (props.gap !== undefined && props.gap !== null) {
8
8
  const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'gap');
9
-
10
9
  const styleFromPropValue = propValue => ({
11
10
  gap: getValue(transformer, propValue)
12
11
  });
13
-
14
12
  return handleBreakpoints(props, props.gap, styleFromPropValue);
15
13
  }
16
-
17
14
  return null;
18
15
  };
19
16
  gap.propTypes = process.env.NODE_ENV !== 'production' ? {
@@ -23,14 +20,11 @@ gap.filterProps = ['gap'];
23
20
  export const columnGap = props => {
24
21
  if (props.columnGap !== undefined && props.columnGap !== null) {
25
22
  const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'columnGap');
26
-
27
23
  const styleFromPropValue = propValue => ({
28
24
  columnGap: getValue(transformer, propValue)
29
25
  });
30
-
31
26
  return handleBreakpoints(props, props.columnGap, styleFromPropValue);
32
27
  }
33
-
34
28
  return null;
35
29
  };
36
30
  columnGap.propTypes = process.env.NODE_ENV !== 'production' ? {
@@ -40,14 +34,11 @@ columnGap.filterProps = ['columnGap'];
40
34
  export const rowGap = props => {
41
35
  if (props.rowGap !== undefined && props.rowGap !== null) {
42
36
  const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'rowGap');
43
-
44
37
  const styleFromPropValue = propValue => ({
45
38
  rowGap: getValue(transformer, propValue)
46
39
  });
47
-
48
40
  return handleBreakpoints(props, props.rowGap, styleFromPropValue);
49
41
  }
50
-
51
42
  return null;
52
43
  };
53
44
  rowGap.propTypes = process.env.NODE_ENV !== 'production' ? {