@mui/system 5.10.13 → 5.10.14

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