@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
@@ -4,92 +4,76 @@ import { DEFAULT_MODE_STORAGE_KEY, DEFAULT_COLOR_SCHEME_STORAGE_KEY } from './ge
4
4
  export function getSystemMode(mode) {
5
5
  if (typeof window !== 'undefined' && mode === 'system') {
6
6
  var mql = window.matchMedia('(prefers-color-scheme: dark)');
7
-
8
7
  if (mql.matches) {
9
8
  return 'dark';
10
9
  }
11
-
12
10
  return 'light';
13
11
  }
14
-
15
12
  return undefined;
16
13
  }
17
-
18
14
  function processState(state, callback) {
19
15
  if (state.mode === 'light' || state.mode === 'system' && state.systemMode === 'light') {
20
16
  return callback('light');
21
17
  }
22
-
23
18
  if (state.mode === 'dark' || state.mode === 'system' && state.systemMode === 'dark') {
24
19
  return callback('dark');
25
20
  }
26
-
27
21
  return undefined;
28
22
  }
29
-
30
23
  export function getColorScheme(state) {
31
24
  return processState(state, function (mode) {
32
25
  if (mode === 'light') {
33
26
  return state.lightColorScheme;
34
27
  }
35
-
36
28
  if (mode === 'dark') {
37
29
  return state.darkColorScheme;
38
30
  }
39
-
40
31
  return undefined;
41
32
  });
42
33
  }
43
-
44
34
  function initializeValue(key, defaultValue) {
45
35
  if (typeof window === 'undefined') {
46
36
  return undefined;
47
37
  }
48
-
49
38
  var value;
50
-
51
39
  try {
52
40
  value = localStorage.getItem(key) || undefined;
53
-
54
41
  if (!value) {
55
42
  // the first time that user enters the site.
56
43
  localStorage.setItem(key, defaultValue);
57
44
  }
58
- } catch (e) {// Unsupported
45
+ } catch (e) {
46
+ // Unsupported
59
47
  }
60
-
61
48
  return value || defaultValue;
62
49
  }
63
-
64
50
  export default function useCurrentColorScheme(options) {
65
51
  var _options$defaultMode = options.defaultMode,
66
- defaultMode = _options$defaultMode === void 0 ? 'light' : _options$defaultMode,
67
- defaultLightColorScheme = options.defaultLightColorScheme,
68
- defaultDarkColorScheme = options.defaultDarkColorScheme,
69
- _options$supportedCol = options.supportedColorSchemes,
70
- supportedColorSchemes = _options$supportedCol === void 0 ? [] : _options$supportedCol,
71
- _options$modeStorageK = options.modeStorageKey,
72
- modeStorageKey = _options$modeStorageK === void 0 ? DEFAULT_MODE_STORAGE_KEY : _options$modeStorageK,
73
- _options$colorSchemeS = options.colorSchemeStorageKey,
74
- colorSchemeStorageKey = _options$colorSchemeS === void 0 ? DEFAULT_COLOR_SCHEME_STORAGE_KEY : _options$colorSchemeS,
75
- _options$storageWindo = options.storageWindow,
76
- storageWindow = _options$storageWindo === void 0 ? typeof window === 'undefined' ? undefined : window : _options$storageWindo;
52
+ defaultMode = _options$defaultMode === void 0 ? 'light' : _options$defaultMode,
53
+ defaultLightColorScheme = options.defaultLightColorScheme,
54
+ defaultDarkColorScheme = options.defaultDarkColorScheme,
55
+ _options$supportedCol = options.supportedColorSchemes,
56
+ supportedColorSchemes = _options$supportedCol === void 0 ? [] : _options$supportedCol,
57
+ _options$modeStorageK = options.modeStorageKey,
58
+ modeStorageKey = _options$modeStorageK === void 0 ? DEFAULT_MODE_STORAGE_KEY : _options$modeStorageK,
59
+ _options$colorSchemeS = options.colorSchemeStorageKey,
60
+ colorSchemeStorageKey = _options$colorSchemeS === void 0 ? DEFAULT_COLOR_SCHEME_STORAGE_KEY : _options$colorSchemeS,
61
+ _options$storageWindo = options.storageWindow,
62
+ storageWindow = _options$storageWindo === void 0 ? typeof window === 'undefined' ? undefined : window : _options$storageWindo;
77
63
  var joinedColorSchemes = supportedColorSchemes.join(',');
78
-
79
64
  var _React$useState = React.useState(function () {
80
- var initialMode = initializeValue(modeStorageKey, defaultMode);
81
- var lightColorScheme = initializeValue("".concat(colorSchemeStorageKey, "-light"), defaultLightColorScheme);
82
- var darkColorScheme = initializeValue("".concat(colorSchemeStorageKey, "-dark"), defaultDarkColorScheme);
83
- return {
84
- mode: initialMode,
85
- systemMode: getSystemMode(initialMode),
86
- lightColorScheme: lightColorScheme,
87
- darkColorScheme: darkColorScheme
88
- };
89
- }),
90
- state = _React$useState[0],
91
- setState = _React$useState[1];
92
-
65
+ var initialMode = initializeValue(modeStorageKey, defaultMode);
66
+ var lightColorScheme = initializeValue("".concat(colorSchemeStorageKey, "-light"), defaultLightColorScheme);
67
+ var darkColorScheme = initializeValue("".concat(colorSchemeStorageKey, "-dark"), defaultDarkColorScheme);
68
+ return {
69
+ mode: initialMode,
70
+ systemMode: getSystemMode(initialMode),
71
+ lightColorScheme: lightColorScheme,
72
+ darkColorScheme: darkColorScheme
73
+ };
74
+ }),
75
+ state = _React$useState[0],
76
+ setState = _React$useState[1];
93
77
  var colorScheme = getColorScheme(state);
94
78
  var setMode = React.useCallback(function (mode) {
95
79
  setState(function (currentState) {
@@ -97,14 +81,12 @@ export default function useCurrentColorScheme(options) {
97
81
  // do nothing if mode does not change
98
82
  return currentState;
99
83
  }
100
-
101
84
  var newMode = !mode ? defaultMode : mode;
102
-
103
85
  try {
104
86
  localStorage.setItem(modeStorageKey, newMode);
105
- } catch (e) {// Unsupported
87
+ } catch (e) {
88
+ // Unsupported
106
89
  }
107
-
108
90
  return _extends({}, currentState, {
109
91
  mode: newMode,
110
92
  systemMode: getSystemMode(newMode)
@@ -117,9 +99,9 @@ export default function useCurrentColorScheme(options) {
117
99
  try {
118
100
  localStorage.setItem("".concat(colorSchemeStorageKey, "-light"), defaultLightColorScheme);
119
101
  localStorage.setItem("".concat(colorSchemeStorageKey, "-dark"), defaultDarkColorScheme);
120
- } catch (e) {// Unsupported
102
+ } catch (e) {
103
+ // Unsupported
121
104
  }
122
-
123
105
  return _extends({}, currentState, {
124
106
  lightColorScheme: defaultLightColorScheme,
125
107
  darkColorScheme: defaultDarkColorScheme
@@ -131,17 +113,15 @@ export default function useCurrentColorScheme(options) {
131
113
  } else {
132
114
  setState(function (currentState) {
133
115
  var newState = _extends({}, currentState);
134
-
135
116
  processState(currentState, function (mode) {
136
117
  try {
137
118
  localStorage.setItem("".concat(colorSchemeStorageKey, "-").concat(mode), value);
138
- } catch (e) {// Unsupported
119
+ } catch (e) {
120
+ // Unsupported
139
121
  }
140
-
141
122
  if (mode === 'light') {
142
123
  newState.lightColorScheme = value;
143
124
  }
144
-
145
125
  if (mode === 'dark') {
146
126
  newState.darkColorScheme = value;
147
127
  }
@@ -152,36 +132,32 @@ export default function useCurrentColorScheme(options) {
152
132
  } else {
153
133
  setState(function (currentState) {
154
134
  var newState = _extends({}, currentState);
155
-
156
135
  var newLightColorScheme = value.light === null ? defaultLightColorScheme : value.light;
157
136
  var newDarkColorScheme = value.dark === null ? defaultDarkColorScheme : value.dark;
158
-
159
137
  if (newLightColorScheme) {
160
138
  if (!joinedColorSchemes.includes(newLightColorScheme)) {
161
139
  console.error("`".concat(newLightColorScheme, "` does not exist in `theme.colorSchemes`."));
162
140
  } else {
163
141
  newState.lightColorScheme = newLightColorScheme;
164
-
165
142
  try {
166
143
  localStorage.setItem("".concat(colorSchemeStorageKey, "-light"), newLightColorScheme);
167
- } catch (error) {// Unsupported
144
+ } catch (error) {
145
+ // Unsupported
168
146
  }
169
147
  }
170
148
  }
171
-
172
149
  if (newDarkColorScheme) {
173
150
  if (!joinedColorSchemes.includes(newDarkColorScheme)) {
174
151
  console.error("`".concat(newDarkColorScheme, "` does not exist in `theme.colorSchemes`."));
175
152
  } else {
176
153
  newState.darkColorScheme = newDarkColorScheme;
177
-
178
154
  try {
179
155
  localStorage.setItem("".concat(colorSchemeStorageKey, "-dark"), newDarkColorScheme);
180
- } catch (error) {// Unsupported
156
+ } catch (error) {
157
+ // Unsupported
181
158
  }
182
159
  }
183
160
  }
184
-
185
161
  return newState;
186
162
  });
187
163
  }
@@ -194,29 +170,31 @@ export default function useCurrentColorScheme(options) {
194
170
  });
195
171
  });
196
172
  }
197
- }, [state.mode]); // Ref hack to avoid adding handleMediaQuery as a dep
173
+ }, [state.mode]);
198
174
 
175
+ // Ref hack to avoid adding handleMediaQuery as a dep
199
176
  var mediaListener = React.useRef(handleMediaQuery);
200
177
  mediaListener.current = handleMediaQuery;
201
178
  React.useEffect(function () {
202
179
  var handler = function handler() {
203
180
  return mediaListener.current.apply(mediaListener, arguments);
204
- }; // Always listen to System preference
205
-
181
+ };
206
182
 
207
- var media = window.matchMedia('(prefers-color-scheme: dark)'); // Intentionally use deprecated listener methods to support iOS & old browsers
183
+ // Always listen to System preference
184
+ var media = window.matchMedia('(prefers-color-scheme: dark)');
208
185
 
186
+ // Intentionally use deprecated listener methods to support iOS & old browsers
209
187
  media.addListener(handler);
210
188
  handler(media);
211
189
  return function () {
212
190
  return media.removeListener(handler);
213
191
  };
214
- }, []); // Handle when localStorage has changed
192
+ }, []);
215
193
 
194
+ // Handle when localStorage has changed
216
195
  React.useEffect(function () {
217
196
  var handleStorage = function handleStorage(event) {
218
197
  var value = event.newValue;
219
-
220
198
  if (typeof event.key === 'string' && event.key.startsWith(colorSchemeStorageKey) && (!value || joinedColorSchemes.match(value))) {
221
199
  // If the key is deleted, value will be null then reset color scheme to the default one.
222
200
  if (event.key.endsWith('light')) {
@@ -224,19 +202,16 @@ export default function useCurrentColorScheme(options) {
224
202
  light: value
225
203
  });
226
204
  }
227
-
228
205
  if (event.key.endsWith('dark')) {
229
206
  setColorScheme({
230
207
  dark: value
231
208
  });
232
209
  }
233
210
  }
234
-
235
211
  if (event.key === modeStorageKey && (!value || ['light', 'dark', 'system'].includes(value))) {
236
212
  setMode(value || defaultMode);
237
213
  }
238
214
  };
239
-
240
215
  if (storageWindow) {
241
216
  // For syncing color-scheme changes between iframes
242
217
  storageWindow.addEventListener('storage', handleStorage);
@@ -244,7 +219,6 @@ export default function useCurrentColorScheme(options) {
244
219
  return storageWindow.removeEventListener('storage', handleStorage);
245
220
  };
246
221
  }
247
-
248
222
  return undefined;
249
223
  }, [setColorScheme, setMode, modeStorageKey, colorSchemeStorageKey, joinedColorSchemes, defaultMode, storageWindow]);
250
224
  return _extends({}, state, {
@@ -39,13 +39,10 @@ export var propToStyleFunction = Object.keys(filterPropsMapping).reduce(function
39
39
  });
40
40
  return acc;
41
41
  }, {});
42
-
43
42
  function getThemeValue(prop, value, theme) {
44
43
  var _inputProps;
45
-
46
44
  var inputProps = (_inputProps = {}, _defineProperty(_inputProps, prop, value), _defineProperty(_inputProps, "theme", theme), _inputProps);
47
45
  var styleFunction = propToStyleFunction[prop];
48
46
  return styleFunction ? styleFunction(inputProps) : _defineProperty({}, prop, value);
49
47
  }
50
-
51
48
  export default getThemeValue;
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.10.13
1
+ /** @license MUI v5.10.14
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -45,10 +45,9 @@ export * from './colorManipulator';
45
45
  export { default as ThemeProvider } from './ThemeProvider';
46
46
  export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
47
47
  export { default as unstable_createGetCssVar } from './cssVars/createGetCssVar';
48
- /** ----------------- */
49
48
 
49
+ /** ----------------- */
50
50
  /** Layout components */
51
-
52
51
  export { default as createContainer } from './Container/createContainer';
53
52
  export { default as Container } from './Container';
54
53
  export * from './Container';
package/legacy/memoize.js CHANGED
@@ -4,7 +4,6 @@ export default function memoize(fn) {
4
4
  if (cache[arg] === undefined) {
5
5
  cache[arg] = fn(arg);
6
6
  }
7
-
8
7
  return cache[arg];
9
8
  };
10
9
  }
package/legacy/merge.js CHANGED
@@ -1,13 +1,10 @@
1
1
  import { deepmerge } from '@mui/utils';
2
-
3
2
  function merge(acc, item) {
4
3
  if (!item) {
5
4
  return acc;
6
5
  }
7
-
8
6
  return deepmerge(acc, item, {
9
7
  clone: false // No need to clone deep, it's way faster.
10
-
11
8
  });
12
9
  }
13
10
 
package/legacy/palette.js CHANGED
@@ -1,14 +1,11 @@
1
1
  import style from './style';
2
2
  import compose from './compose';
3
-
4
3
  function transform(value, userValue) {
5
4
  if (userValue === 'grey') {
6
5
  return userValue;
7
6
  }
8
-
9
7
  return value;
10
8
  }
11
-
12
9
  export var color = style({
13
10
  prop: 'color',
14
11
  themeKey: 'palette',
@@ -1,20 +1,17 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  import { unstable_capitalize as capitalize } from '@mui/utils';
3
-
4
3
  function isEmpty(string) {
5
4
  return string.length === 0;
6
5
  }
6
+
7
7
  /**
8
8
  * Generates string classKey based on the properties provided. It starts with the
9
9
  * variant if defined, and then it appends all other properties in alphabetical order.
10
10
  * @param {object} props - the properties for which the classKey should be created.
11
11
  */
12
-
13
-
14
12
  export default function propsToClassKey(props) {
15
13
  var variant = props.variant,
16
- other = _objectWithoutProperties(props, ["variant"]);
17
-
14
+ other = _objectWithoutProperties(props, ["variant"]);
18
15
  var classKey = variant || '';
19
16
  Object.keys(other).sort().forEach(function (key) {
20
17
  if (key === 'color') {
package/legacy/sizing.js CHANGED
@@ -1,11 +1,9 @@
1
1
  import style from './style';
2
2
  import compose from './compose';
3
3
  import { handleBreakpoints, values as breakpointsValues } from './breakpoints';
4
-
5
4
  function transform(value) {
6
5
  return value <= 1 && value !== 0 ? "".concat(value * 100, "%") : value;
7
6
  }
8
-
9
7
  export var width = style({
10
8
  prop: 'width',
11
9
  transform: transform
@@ -14,16 +12,13 @@ export var maxWidth = function maxWidth(props) {
14
12
  if (props.maxWidth !== undefined && props.maxWidth !== null) {
15
13
  var styleFromPropValue = function styleFromPropValue(propValue) {
16
14
  var _props$theme, _props$theme$breakpoi, _props$theme$breakpoi2;
17
-
18
15
  var breakpoint = ((_props$theme = props.theme) == null ? void 0 : (_props$theme$breakpoi = _props$theme.breakpoints) == null ? void 0 : (_props$theme$breakpoi2 = _props$theme$breakpoi.values) == null ? void 0 : _props$theme$breakpoi2[propValue]) || breakpointsValues[propValue];
19
16
  return {
20
17
  maxWidth: breakpoint || transform(propValue)
21
18
  };
22
19
  };
23
-
24
20
  return handleBreakpoints(props, props.maxWidth, styleFromPropValue);
25
21
  }
26
-
27
22
  return null;
28
23
  };
29
24
  maxWidth.filterProps = ['maxWidth'];
package/legacy/spacing.js CHANGED
@@ -21,10 +21,11 @@ var aliases = {
21
21
  marginY: 'my',
22
22
  paddingX: 'px',
23
23
  paddingY: 'py'
24
- }; // memoize() impact:
24
+ };
25
+
26
+ // memoize() impact:
25
27
  // From 300,000 ops/sec
26
28
  // To 350,000 ops/sec
27
-
28
29
  var getCssProperties = memoize(function (prop) {
29
30
  // It's not a shorthand notation.
30
31
  if (prop.length > 2) {
@@ -34,12 +35,10 @@ var getCssProperties = memoize(function (prop) {
34
35
  return [prop];
35
36
  }
36
37
  }
37
-
38
38
  var _prop$split = prop.split(''),
39
- _prop$split2 = _slicedToArray(_prop$split, 2),
40
- a = _prop$split2[0],
41
- b = _prop$split2[1];
42
-
39
+ _prop$split2 = _slicedToArray(_prop$split, 2),
40
+ a = _prop$split2[0],
41
+ b = _prop$split2[1];
43
42
  var property = properties[a];
44
43
  var direction = directions[b] || '';
45
44
  return Array.isArray(direction) ? direction.map(function (dir) {
@@ -51,31 +50,25 @@ var paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingT
51
50
  var spacingKeys = [].concat(marginKeys, paddingKeys);
52
51
  export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
53
52
  var _getPath;
54
-
55
53
  var themeSpacing = (_getPath = getPath(theme, themeKey, false)) != null ? _getPath : defaultValue;
56
-
57
54
  if (typeof themeSpacing === 'number') {
58
55
  return function (abs) {
59
56
  if (typeof abs === 'string') {
60
57
  return abs;
61
58
  }
62
-
63
59
  if (process.env.NODE_ENV !== 'production') {
64
60
  if (typeof abs !== 'number') {
65
61
  console.error("MUI: Expected ".concat(propName, " argument to be a number or a string, got ").concat(abs, "."));
66
62
  }
67
63
  }
68
-
69
64
  return themeSpacing * abs;
70
65
  };
71
66
  }
72
-
73
67
  if (Array.isArray(themeSpacing)) {
74
68
  return function (abs) {
75
69
  if (typeof abs === 'string') {
76
70
  return abs;
77
71
  }
78
-
79
72
  if (process.env.NODE_ENV !== 'production') {
80
73
  if (!Number.isInteger(abs)) {
81
74
  console.error(["MUI: The `theme.".concat(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.".concat(themeKey, "` as a number.")].join('\n'));
@@ -83,19 +76,15 @@ export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
83
76
  console.error(["MUI: The value provided (".concat(abs, ") overflows."), "The supported values are: ".concat(JSON.stringify(themeSpacing), "."), "".concat(abs, " > ").concat(themeSpacing.length - 1, ", you need to add the missing values.")].join('\n'));
84
77
  }
85
78
  }
86
-
87
79
  return themeSpacing[abs];
88
80
  };
89
81
  }
90
-
91
82
  if (typeof themeSpacing === 'function') {
92
83
  return themeSpacing;
93
84
  }
94
-
95
85
  if (process.env.NODE_ENV !== 'production') {
96
86
  console.error(["MUI: The `theme.".concat(themeKey, "` value (").concat(themeSpacing, ") is invalid."), 'It should be a number, an array or a function.'].join('\n'));
97
87
  }
98
-
99
88
  return function () {
100
89
  return undefined;
101
90
  };
@@ -107,18 +96,14 @@ export function getValue(transformer, propValue) {
107
96
  if (typeof propValue === 'string' || propValue == null) {
108
97
  return propValue;
109
98
  }
110
-
111
99
  var abs = Math.abs(propValue);
112
100
  var transformed = transformer(abs);
113
-
114
101
  if (propValue >= 0) {
115
102
  return transformed;
116
103
  }
117
-
118
104
  if (typeof transformed === 'number') {
119
105
  return -transformed;
120
106
  }
121
-
122
107
  return "-".concat(transformed);
123
108
  }
124
109
  export function getStyleFromPropValue(cssProperties, transformer) {
@@ -129,27 +114,23 @@ export function getStyleFromPropValue(cssProperties, transformer) {
129
114
  }, {});
130
115
  };
131
116
  }
132
-
133
117
  function resolveCssProperty(props, keys, prop, transformer) {
134
118
  // Using a hash computation over an array iteration could be faster, but with only 28 items,
135
119
  // it's doesn't worth the bundle size.
136
120
  if (keys.indexOf(prop) === -1) {
137
121
  return null;
138
122
  }
139
-
140
123
  var cssProperties = getCssProperties(prop);
141
124
  var styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
142
125
  var propValue = props[prop];
143
126
  return handleBreakpoints(props, propValue, styleFromPropValue);
144
127
  }
145
-
146
128
  function style(props, keys) {
147
129
  var transformer = createUnarySpacing(props.theme);
148
130
  return Object.keys(props).map(function (prop) {
149
131
  return resolveCssProperty(props, keys, prop, transformer);
150
132
  }).reduce(merge, {});
151
133
  }
152
-
153
134
  export function margin(props) {
154
135
  return style(props, marginKeys);
155
136
  }
@@ -166,11 +147,9 @@ padding.propTypes = process.env.NODE_ENV !== 'production' ? paddingKeys.reduce(f
166
147
  return obj;
167
148
  }, {}) : {};
168
149
  padding.filterProps = paddingKeys;
169
-
170
150
  function spacing(props) {
171
151
  return style(props, spacingKeys);
172
152
  }
173
-
174
153
  spacing.propTypes = process.env.NODE_ENV !== 'production' ? spacingKeys.reduce(function (obj, key) {
175
154
  obj[key] = responsivePropType;
176
155
  return obj;
package/legacy/style.js CHANGED
@@ -4,35 +4,29 @@ import responsivePropType from './responsivePropType';
4
4
  import { handleBreakpoints } from './breakpoints';
5
5
  export function getPath(obj, path) {
6
6
  var checkVars = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
7
-
8
7
  if (!path || typeof path !== 'string') {
9
8
  return null;
10
- } // Check if CSS variables are used
11
-
9
+ }
12
10
 
11
+ // Check if CSS variables are used
13
12
  if (obj && obj.vars && checkVars) {
14
13
  var val = "vars.".concat(path).split('.').reduce(function (acc, item) {
15
14
  return acc && acc[item] ? acc[item] : null;
16
15
  }, obj);
17
-
18
16
  if (val != null) {
19
17
  return val;
20
18
  }
21
19
  }
22
-
23
20
  return path.split('.').reduce(function (acc, item) {
24
21
  if (acc && acc[item] != null) {
25
22
  return acc[item];
26
23
  }
27
-
28
24
  return null;
29
25
  }, obj);
30
26
  }
31
-
32
27
  function getValue(themeMapping, transform, propValueFinal) {
33
28
  var userValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : propValueFinal;
34
29
  var value;
35
-
36
30
  if (typeof themeMapping === 'function') {
37
31
  value = themeMapping(propValueFinal);
38
32
  } else if (Array.isArray(themeMapping)) {
@@ -40,51 +34,39 @@ function getValue(themeMapping, transform, propValueFinal) {
40
34
  } else {
41
35
  value = getPath(themeMapping, propValueFinal) || userValue;
42
36
  }
43
-
44
37
  if (transform) {
45
38
  value = transform(value, userValue);
46
39
  }
47
-
48
40
  return value;
49
41
  }
50
-
51
42
  function style(options) {
52
43
  var prop = options.prop,
53
- _options$cssProperty = options.cssProperty,
54
- cssProperty = _options$cssProperty === void 0 ? options.prop : _options$cssProperty,
55
- themeKey = options.themeKey,
56
- transform = options.transform;
57
-
44
+ _options$cssProperty = options.cssProperty,
45
+ cssProperty = _options$cssProperty === void 0 ? options.prop : _options$cssProperty,
46
+ themeKey = options.themeKey,
47
+ transform = options.transform;
58
48
  var fn = function fn(props) {
59
49
  if (props[prop] == null) {
60
50
  return null;
61
51
  }
62
-
63
52
  var propValue = props[prop];
64
53
  var theme = props.theme;
65
54
  var themeMapping = getPath(theme, themeKey) || {};
66
-
67
55
  var styleFromPropValue = function styleFromPropValue(propValueFinal) {
68
56
  var value = getValue(themeMapping, transform, propValueFinal);
69
-
70
57
  if (propValueFinal === value && typeof propValueFinal === 'string') {
71
58
  // Haven't found value
72
59
  value = getValue(themeMapping, transform, "".concat(prop).concat(propValueFinal === 'default' ? '' : capitalize(propValueFinal)), propValueFinal);
73
60
  }
74
-
75
61
  if (cssProperty === false) {
76
62
  return value;
77
63
  }
78
-
79
64
  return _defineProperty({}, cssProperty, value);
80
65
  };
81
-
82
66
  return handleBreakpoints(props, propValue, styleFromPropValue);
83
67
  };
84
-
85
68
  fn.propTypes = process.env.NODE_ENV !== 'production' ? _defineProperty({}, prop, responsivePropType) : {};
86
69
  fn.filterProps = [prop];
87
70
  return fn;
88
71
  }
89
-
90
72
  export default style;
@@ -3,7 +3,6 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
4
  import { isPlainObject } from '@mui/utils';
5
5
  import { propToStyleFunction } from '../getThemeValue';
6
-
7
6
  var splitProps = function splitProps(props) {
8
7
  var result = {
9
8
  systemProps: {},
@@ -18,33 +17,26 @@ var splitProps = function splitProps(props) {
18
17
  });
19
18
  return result;
20
19
  };
21
-
22
20
  export default function extendSxProp(props) {
23
21
  var inSx = props.sx,
24
- other = _objectWithoutProperties(props, ["sx"]);
25
-
22
+ other = _objectWithoutProperties(props, ["sx"]);
26
23
  var _splitProps = splitProps(other),
27
- systemProps = _splitProps.systemProps,
28
- otherProps = _splitProps.otherProps;
29
-
24
+ systemProps = _splitProps.systemProps,
25
+ otherProps = _splitProps.otherProps;
30
26
  var finalSx;
31
-
32
27
  if (Array.isArray(inSx)) {
33
28
  finalSx = [systemProps].concat(_toConsumableArray(inSx));
34
29
  } else if (typeof inSx === 'function') {
35
30
  finalSx = function finalSx() {
36
31
  var result = inSx.apply(void 0, arguments);
37
-
38
32
  if (!isPlainObject(result)) {
39
33
  return systemProps;
40
34
  }
41
-
42
35
  return _extends({}, systemProps, result);
43
36
  };
44
37
  } else {
45
38
  finalSx = _extends({}, systemProps, inSx);
46
39
  }
47
-
48
40
  return _extends({}, otherProps, {
49
41
  sx: finalSx
50
42
  });