@mui/system 6.0.0-alpha.0 → 6.0.0-alpha.3

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 (141) hide show
  1. package/CHANGELOG.md +243 -4
  2. package/Container/Container.d.ts +1 -1
  3. package/Stack/Stack.d.ts +1 -1
  4. package/Stack/createStack.d.ts +1 -1
  5. package/Unstable_Grid/Grid.d.ts +1 -1
  6. package/Unstable_Grid/createGrid.d.ts +1 -1
  7. package/breakpoints/breakpoints.js +19 -1
  8. package/createTheme/createSpacing.d.ts +2 -2
  9. package/createTheme/createSpacing.js +7 -8
  10. package/createTheme/createTheme.d.ts +2 -1
  11. package/createTheme/createTheme.js +2 -0
  12. package/cssContainerQueries/cssContainerQueries.d.ts +24 -0
  13. package/cssContainerQueries/cssContainerQueries.js +68 -0
  14. package/cssContainerQueries/index.d.ts +3 -0
  15. package/cssContainerQueries/index.js +2 -0
  16. package/cssContainerQueries/package.json +6 -0
  17. package/cssVars/createCssVarsProvider.js +3 -0
  18. package/cssVars/cssVarsParser.d.ts +1 -1
  19. package/cssVars/cssVarsParser.js +3 -2
  20. package/index.d.ts +2 -0
  21. package/index.js +2 -1
  22. package/modern/breakpoints/breakpoints.js +19 -1
  23. package/modern/createTheme/createSpacing.js +7 -8
  24. package/modern/createTheme/createTheme.js +2 -0
  25. package/modern/cssContainerQueries/cssContainerQueries.js +68 -0
  26. package/modern/cssContainerQueries/index.js +2 -0
  27. package/modern/cssVars/createCssVarsProvider.js +3 -0
  28. package/modern/cssVars/cssVarsParser.js +3 -2
  29. package/modern/index.js +2 -1
  30. package/modern/spacing/spacing.js +24 -21
  31. package/modern/styleFunctionSx/styleFunctionSx.js +2 -1
  32. package/node/breakpoints/breakpoints.js +19 -1
  33. package/node/createTheme/createSpacing.js +7 -8
  34. package/node/createTheme/createTheme.js +2 -0
  35. package/node/cssContainerQueries/cssContainerQueries.js +79 -0
  36. package/node/cssContainerQueries/index.js +32 -0
  37. package/node/cssVars/createCssVarsProvider.js +3 -0
  38. package/node/cssVars/cssVarsParser.js +3 -2
  39. package/node/index.js +9 -1
  40. package/node/spacing/spacing.js +24 -21
  41. package/node/styleFunctionSx/styleFunctionSx.js +2 -1
  42. package/package.json +5 -5
  43. package/spacing/spacing.js +24 -21
  44. package/styleFunctionSx/styleFunctionSx.js +2 -1
  45. package/legacy/Box/Box.js +0 -30
  46. package/legacy/Box/boxClasses.js +0 -3
  47. package/legacy/Box/index.js +0 -5
  48. package/legacy/Container/Container.js +0 -61
  49. package/legacy/Container/ContainerProps.js +0 -1
  50. package/legacy/Container/containerClasses.js +0 -7
  51. package/legacy/Container/createContainer.js +0 -140
  52. package/legacy/Container/index.js +0 -5
  53. package/legacy/GlobalStyles/GlobalStyles.js +0 -37
  54. package/legacy/GlobalStyles/index.js +0 -4
  55. package/legacy/RtlProvider/index.js +0 -22
  56. package/legacy/Stack/Stack.js +0 -62
  57. package/legacy/Stack/StackProps.js +0 -1
  58. package/legacy/Stack/createStack.js +0 -180
  59. package/legacy/Stack/index.js +0 -7
  60. package/legacy/Stack/stackClasses.js +0 -7
  61. package/legacy/ThemeProvider/ThemeProvider.js +0 -87
  62. package/legacy/ThemeProvider/index.js +0 -3
  63. package/legacy/Unstable_Grid/Grid.js +0 -177
  64. package/legacy/Unstable_Grid/GridProps.js +0 -1
  65. package/legacy/Unstable_Grid/createGrid.js +0 -184
  66. package/legacy/Unstable_Grid/gridClasses.js +0 -28
  67. package/legacy/Unstable_Grid/gridGenerator.js +0 -216
  68. package/legacy/Unstable_Grid/index.js +0 -8
  69. package/legacy/Unstable_Grid/traverseBreakpoints.js +0 -48
  70. package/legacy/borders/borders.js +0 -51
  71. package/legacy/borders/index.js +0 -4
  72. package/legacy/breakpoints/breakpoints.js +0 -162
  73. package/legacy/breakpoints/index.js +0 -4
  74. package/legacy/colorManipulator/colorManipulator.js +0 -356
  75. package/legacy/colorManipulator/index.js +0 -3
  76. package/legacy/compose/compose.js +0 -32
  77. package/legacy/compose/index.js +0 -3
  78. package/legacy/createBox/createBox.js +0 -38
  79. package/legacy/createBox/index.js +0 -3
  80. package/legacy/createStyled/createStyled.js +0 -250
  81. package/legacy/createStyled/index.js +0 -4
  82. package/legacy/createTheme/applyStyles.js +0 -73
  83. package/legacy/createTheme/createBreakpoints.js +0 -83
  84. package/legacy/createTheme/createSpacing.js +0 -36
  85. package/legacy/createTheme/createTheme.js +0 -49
  86. package/legacy/createTheme/index.js +0 -3
  87. package/legacy/createTheme/shape.js +0 -4
  88. package/legacy/cssGrid/cssGrid.js +0 -91
  89. package/legacy/cssGrid/index.js +0 -4
  90. package/legacy/cssVars/createCssVarsProvider.js +0 -335
  91. package/legacy/cssVars/createCssVarsTheme.js +0 -13
  92. package/legacy/cssVars/createGetCssVar.js +0 -30
  93. package/legacy/cssVars/cssVarsParser.js +0 -140
  94. package/legacy/cssVars/getInitColorSchemeScript.js +0 -28
  95. package/legacy/cssVars/index.js +0 -6
  96. package/legacy/cssVars/prepareCssVars.js +0 -92
  97. package/legacy/cssVars/useCurrentColorScheme.js +0 -237
  98. package/legacy/display/display.js +0 -29
  99. package/legacy/display/index.js +0 -4
  100. package/legacy/flexbox/flexbox.js +0 -43
  101. package/legacy/flexbox/index.js +0 -4
  102. package/legacy/getThemeValue/getThemeValue.js +0 -47
  103. package/legacy/getThemeValue/index.js +0 -4
  104. package/legacy/index.js +0 -72
  105. package/legacy/memoize/index.js +0 -3
  106. package/legacy/memoize/memoize.js +0 -9
  107. package/legacy/merge/index.js +0 -3
  108. package/legacy/merge/merge.js +0 -10
  109. package/legacy/palette/index.js +0 -4
  110. package/legacy/palette/palette.js +0 -26
  111. package/legacy/positions/index.js +0 -4
  112. package/legacy/positions/positions.js +0 -22
  113. package/legacy/propsToClassKey/index.js +0 -3
  114. package/legacy/propsToClassKey/propsToClassKey.js +0 -24
  115. package/legacy/responsivePropType/index.js +0 -3
  116. package/legacy/responsivePropType/responsivePropType.js +0 -3
  117. package/legacy/shadows/index.js +0 -3
  118. package/legacy/shadows/shadows.js +0 -6
  119. package/legacy/sizing/index.js +0 -4
  120. package/legacy/sizing/sizing.js +0 -65
  121. package/legacy/spacing/index.js +0 -4
  122. package/legacy/spacing/spacing.js +0 -158
  123. package/legacy/style/index.js +0 -4
  124. package/legacy/style/style.js +0 -73
  125. package/legacy/styleFunctionSx/defaultSxConfig.js +0 -293
  126. package/legacy/styleFunctionSx/extendSxProp.js +0 -45
  127. package/legacy/styleFunctionSx/index.js +0 -4
  128. package/legacy/styleFunctionSx/styleFunctionSx.js +0 -126
  129. package/legacy/styled/index.js +0 -3
  130. package/legacy/styled/styled.js +0 -3
  131. package/legacy/typography/index.js +0 -4
  132. package/legacy/typography/typography.js +0 -37
  133. package/legacy/useMediaQuery/index.js +0 -2
  134. package/legacy/useMediaQuery/useMediaQuery.js +0 -145
  135. package/legacy/useTheme/index.js +0 -4
  136. package/legacy/useTheme/useTheme.js +0 -10
  137. package/legacy/useThemeProps/getThemeProps.js +0 -10
  138. package/legacy/useThemeProps/index.js +0 -4
  139. package/legacy/useThemeProps/useThemeProps.js +0 -20
  140. package/legacy/useThemeWithoutDefault/index.js +0 -3
  141. package/legacy/useThemeWithoutDefault/useThemeWithoutDefault.js +0 -13
@@ -1,356 +0,0 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
- /* eslint-disable @typescript-eslint/naming-convention */
3
- import clamp from '@mui/utils/clamp';
4
- /**
5
- * Returns a number whose value is limited to the given range.
6
- * @param {number} value The value to be clamped
7
- * @param {number} min The lower boundary of the output range
8
- * @param {number} max The upper boundary of the output range
9
- * @returns {number} A number in the range [min, max]
10
- */
11
- function clampWrapper(value) {
12
- var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
13
- var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
14
- if (process.env.NODE_ENV !== 'production') {
15
- if (value < min || value > max) {
16
- console.error("MUI: The value provided ".concat(value, " is out of range [").concat(min, ", ").concat(max, "]."));
17
- }
18
- }
19
- return clamp(value, min, max);
20
- }
21
-
22
- /**
23
- * Converts a color from CSS hex format to CSS rgb format.
24
- * @param {string} color - Hex color, i.e. #nnn or #nnnnnn
25
- * @returns {string} A CSS rgb color string
26
- */
27
- export function hexToRgb(color) {
28
- color = color.slice(1);
29
- var re = new RegExp(".{1,".concat(color.length >= 6 ? 2 : 1, "}"), 'g');
30
- var colors = color.match(re);
31
- if (colors && colors[0].length === 1) {
32
- colors = colors.map(function (n) {
33
- return n + n;
34
- });
35
- }
36
- return colors ? "rgb".concat(colors.length === 4 ? 'a' : '', "(").concat(colors.map(function (n, index) {
37
- return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1000) / 1000;
38
- }).join(', '), ")") : '';
39
- }
40
- function intToHex(int) {
41
- var hex = int.toString(16);
42
- return hex.length === 1 ? "0".concat(hex) : hex;
43
- }
44
-
45
- /**
46
- * Returns an object with the type and values of a color.
47
- *
48
- * Note: Does not support rgb % values.
49
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
50
- * @returns {object} - A MUI color object: {type: string, values: number[]}
51
- */
52
- export function decomposeColor(color) {
53
- // Idempotent
54
- if (color.type) {
55
- return color;
56
- }
57
- if (color.charAt(0) === '#') {
58
- return decomposeColor(hexToRgb(color));
59
- }
60
- var marker = color.indexOf('(');
61
- var type = color.substring(0, marker);
62
- if (['rgb', 'rgba', 'hsl', 'hsla', 'color'].indexOf(type) === -1) {
63
- throw new Error(process.env.NODE_ENV !== "production" ? "MUI: Unsupported `".concat(color, "` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().") : _formatMuiErrorMessage(9, color));
64
- }
65
- var values = color.substring(marker + 1, color.length - 1);
66
- var colorSpace;
67
- if (type === 'color') {
68
- values = values.split(' ');
69
- colorSpace = values.shift();
70
- if (values.length === 4 && values[3].charAt(0) === '/') {
71
- values[3] = values[3].slice(1);
72
- }
73
- if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) {
74
- throw new Error(process.env.NODE_ENV !== "production" ? "MUI: unsupported `".concat(colorSpace, "` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.") : _formatMuiErrorMessage(10, colorSpace));
75
- }
76
- } else {
77
- values = values.split(',');
78
- }
79
- values = values.map(function (value) {
80
- return parseFloat(value);
81
- });
82
- return {
83
- type: type,
84
- values: values,
85
- colorSpace: colorSpace
86
- };
87
- }
88
-
89
- /**
90
- * Returns a channel created from the input color.
91
- *
92
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
93
- * @returns {string} - The channel for the color, that can be used in rgba or hsla colors
94
- */
95
- export var colorChannel = function colorChannel(color) {
96
- var decomposedColor = decomposeColor(color);
97
- return decomposedColor.values.slice(0, 3).map(function (val, idx) {
98
- return decomposedColor.type.indexOf('hsl') !== -1 && idx !== 0 ? "".concat(val, "%") : val;
99
- }).join(' ');
100
- };
101
- export var private_safeColorChannel = function private_safeColorChannel(color, warning) {
102
- try {
103
- return colorChannel(color);
104
- } catch (error) {
105
- if (warning && process.env.NODE_ENV !== 'production') {
106
- console.warn(warning);
107
- }
108
- return color;
109
- }
110
- };
111
-
112
- /**
113
- * Converts a color object with type and values to a string.
114
- * @param {object} color - Decomposed color
115
- * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color'
116
- * @param {array} color.values - [n,n,n] or [n,n,n,n]
117
- * @returns {string} A CSS color string
118
- */
119
- export function recomposeColor(color) {
120
- var type = color.type,
121
- colorSpace = color.colorSpace;
122
- var values = color.values;
123
- if (type.indexOf('rgb') !== -1) {
124
- // Only convert the first 3 values to int (i.e. not alpha)
125
- values = values.map(function (n, i) {
126
- return i < 3 ? parseInt(n, 10) : n;
127
- });
128
- } else if (type.indexOf('hsl') !== -1) {
129
- values[1] = "".concat(values[1], "%");
130
- values[2] = "".concat(values[2], "%");
131
- }
132
- if (type.indexOf('color') !== -1) {
133
- values = "".concat(colorSpace, " ").concat(values.join(' '));
134
- } else {
135
- values = "".concat(values.join(', '));
136
- }
137
- return "".concat(type, "(").concat(values, ")");
138
- }
139
-
140
- /**
141
- * Converts a color from CSS rgb format to CSS hex format.
142
- * @param {string} color - RGB color, i.e. rgb(n, n, n)
143
- * @returns {string} A CSS rgb color string, i.e. #nnnnnn
144
- */
145
- export function rgbToHex(color) {
146
- // Idempotent
147
- if (color.indexOf('#') === 0) {
148
- return color;
149
- }
150
- var _decomposeColor = decomposeColor(color),
151
- values = _decomposeColor.values;
152
- return "#".concat(values.map(function (n, i) {
153
- return intToHex(i === 3 ? Math.round(255 * n) : n);
154
- }).join(''));
155
- }
156
-
157
- /**
158
- * Converts a color from hsl format to rgb format.
159
- * @param {string} color - HSL color values
160
- * @returns {string} rgb color values
161
- */
162
- export function hslToRgb(color) {
163
- color = decomposeColor(color);
164
- var _color = color,
165
- values = _color.values;
166
- var h = values[0];
167
- var s = values[1] / 100;
168
- var l = values[2] / 100;
169
- var a = s * Math.min(l, 1 - l);
170
- var f = function f(n) {
171
- var k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (n + h / 30) % 12;
172
- return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
173
- };
174
- var type = 'rgb';
175
- var rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];
176
- if (color.type === 'hsla') {
177
- type += 'a';
178
- rgb.push(values[3]);
179
- }
180
- return recomposeColor({
181
- type: type,
182
- values: rgb
183
- });
184
- }
185
- /**
186
- * The relative brightness of any point in a color space,
187
- * normalized to 0 for darkest black and 1 for lightest white.
188
- *
189
- * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
190
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
191
- * @returns {number} The relative brightness of the color in the range 0 - 1
192
- */
193
- export function getLuminance(color) {
194
- color = decomposeColor(color);
195
- var rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;
196
- rgb = rgb.map(function (val) {
197
- if (color.type !== 'color') {
198
- val /= 255; // normalized
199
- }
200
- return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
201
- });
202
-
203
- // Truncate at 3 digits
204
- return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));
205
- }
206
-
207
- /**
208
- * Calculates the contrast ratio between two colors.
209
- *
210
- * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
211
- * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
212
- * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
213
- * @returns {number} A contrast ratio value in the range 0 - 21.
214
- */
215
- export function getContrastRatio(foreground, background) {
216
- var lumA = getLuminance(foreground);
217
- var lumB = getLuminance(background);
218
- return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);
219
- }
220
-
221
- /**
222
- * Sets the absolute transparency of a color.
223
- * Any existing alpha values are overwritten.
224
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
225
- * @param {number} value - value to set the alpha channel to in the range 0 - 1
226
- * @returns {string} A CSS color string. Hex input values are returned as rgb
227
- */
228
- export function alpha(color, value) {
229
- color = decomposeColor(color);
230
- value = clampWrapper(value);
231
- if (color.type === 'rgb' || color.type === 'hsl') {
232
- color.type += 'a';
233
- }
234
- if (color.type === 'color') {
235
- color.values[3] = "/".concat(value);
236
- } else {
237
- color.values[3] = value;
238
- }
239
- return recomposeColor(color);
240
- }
241
- export function private_safeAlpha(color, value, warning) {
242
- try {
243
- return alpha(color, value);
244
- } catch (error) {
245
- if (warning && process.env.NODE_ENV !== 'production') {
246
- console.warn(warning);
247
- }
248
- return color;
249
- }
250
- }
251
-
252
- /**
253
- * Darkens a color.
254
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
255
- * @param {number} coefficient - multiplier in the range 0 - 1
256
- * @returns {string} A CSS color string. Hex input values are returned as rgb
257
- */
258
- export function darken(color, coefficient) {
259
- color = decomposeColor(color);
260
- coefficient = clampWrapper(coefficient);
261
- if (color.type.indexOf('hsl') !== -1) {
262
- color.values[2] *= 1 - coefficient;
263
- } else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) {
264
- for (var i = 0; i < 3; i += 1) {
265
- color.values[i] *= 1 - coefficient;
266
- }
267
- }
268
- return recomposeColor(color);
269
- }
270
- export function private_safeDarken(color, coefficient, warning) {
271
- try {
272
- return darken(color, coefficient);
273
- } catch (error) {
274
- if (warning && process.env.NODE_ENV !== 'production') {
275
- console.warn(warning);
276
- }
277
- return color;
278
- }
279
- }
280
-
281
- /**
282
- * Lightens a color.
283
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
284
- * @param {number} coefficient - multiplier in the range 0 - 1
285
- * @returns {string} A CSS color string. Hex input values are returned as rgb
286
- */
287
- export function lighten(color, coefficient) {
288
- color = decomposeColor(color);
289
- coefficient = clampWrapper(coefficient);
290
- if (color.type.indexOf('hsl') !== -1) {
291
- color.values[2] += (100 - color.values[2]) * coefficient;
292
- } else if (color.type.indexOf('rgb') !== -1) {
293
- for (var i = 0; i < 3; i += 1) {
294
- color.values[i] += (255 - color.values[i]) * coefficient;
295
- }
296
- } else if (color.type.indexOf('color') !== -1) {
297
- for (var _i = 0; _i < 3; _i += 1) {
298
- color.values[_i] += (1 - color.values[_i]) * coefficient;
299
- }
300
- }
301
- return recomposeColor(color);
302
- }
303
- export function private_safeLighten(color, coefficient, warning) {
304
- try {
305
- return lighten(color, coefficient);
306
- } catch (error) {
307
- if (warning && process.env.NODE_ENV !== 'production') {
308
- console.warn(warning);
309
- }
310
- return color;
311
- }
312
- }
313
-
314
- /**
315
- * Darken or lighten a color, depending on its luminance.
316
- * Light colors are darkened, dark colors are lightened.
317
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
318
- * @param {number} coefficient=0.15 - multiplier in the range 0 - 1
319
- * @returns {string} A CSS color string. Hex input values are returned as rgb
320
- */
321
- export function emphasize(color) {
322
- var coefficient = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.15;
323
- return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient);
324
- }
325
- export function private_safeEmphasize(color, coefficient, warning) {
326
- try {
327
- return emphasize(color, coefficient);
328
- } catch (error) {
329
- if (warning && process.env.NODE_ENV !== 'production') {
330
- console.warn(warning);
331
- }
332
- return color;
333
- }
334
- }
335
-
336
- /**
337
- * Blend a transparent overlay color with a background color, resulting in a single
338
- * RGB color.
339
- * @param {string} background - CSS color
340
- * @param {string} overlay - CSS color
341
- * @param {number} opacity - Opacity multiplier in the range 0 - 1
342
- * @param {number} [gamma=1.0] - Gamma correction factor. For gamma-correct blending, 2.2 is usual.
343
- */
344
- export function blend(background, overlay, opacity) {
345
- var gamma = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1.0;
346
- var blendChannel = function blendChannel(b, o) {
347
- return Math.round(Math.pow(Math.pow(b, 1 / gamma) * (1 - opacity) + Math.pow(o, 1 / gamma) * opacity, gamma));
348
- };
349
- var backgroundColor = decomposeColor(background);
350
- var overlayColor = decomposeColor(overlay);
351
- var rgb = [blendChannel(backgroundColor.values[0], overlayColor.values[0]), blendChannel(backgroundColor.values[1], overlayColor.values[1]), blendChannel(backgroundColor.values[2], overlayColor.values[2])];
352
- return recomposeColor({
353
- type: 'rgb',
354
- values: rgb
355
- });
356
- }
@@ -1,3 +0,0 @@
1
- 'use client';
2
-
3
- export * from './colorManipulator';
@@ -1,32 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import merge from '../merge';
3
- function compose() {
4
- for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
5
- styles[_key] = arguments[_key];
6
- }
7
- var handlers = styles.reduce(function (acc, style) {
8
- style.filterProps.forEach(function (prop) {
9
- acc[prop] = style;
10
- });
11
- return acc;
12
- }, {});
13
-
14
- // false positive
15
- // eslint-disable-next-line react/function-component-definition
16
- var fn = function fn(props) {
17
- return Object.keys(props).reduce(function (acc, prop) {
18
- if (handlers[prop]) {
19
- return merge(acc, handlers[prop](props));
20
- }
21
- return acc;
22
- }, {});
23
- };
24
- fn.propTypes = process.env.NODE_ENV !== 'production' ? styles.reduce(function (acc, style) {
25
- return _extends(acc, style.propTypes);
26
- }, {}) : {};
27
- fn.filterProps = styles.reduce(function (acc, style) {
28
- return acc.concat(style.filterProps);
29
- }, []);
30
- return fn;
31
- }
32
- export default compose;
@@ -1,3 +0,0 @@
1
- 'use client';
2
-
3
- export { default } from './compose';
@@ -1,38 +0,0 @@
1
- 'use client';
2
-
3
- import _extends from "@babel/runtime/helpers/esm/extends";
4
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- import * as React from 'react';
6
- import clsx from 'clsx';
7
- import styled from '@mui/styled-engine';
8
- import styleFunctionSx, { extendSxProp } from '../styleFunctionSx';
9
- import useTheme from '../useTheme';
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- export default function createBox() {
12
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13
- var themeId = options.themeId,
14
- defaultTheme = options.defaultTheme,
15
- _options$defaultClass = options.defaultClassName,
16
- defaultClassName = _options$defaultClass === void 0 ? 'MuiBox-root' : _options$defaultClass,
17
- generateClassName = options.generateClassName;
18
- var BoxRoot = styled('div', {
19
- shouldForwardProp: function shouldForwardProp(prop) {
20
- return prop !== 'theme' && prop !== 'sx' && prop !== 'as';
21
- }
22
- })(styleFunctionSx);
23
- var Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
24
- var theme = useTheme(defaultTheme);
25
- var _extendSxProp = extendSxProp(inProps),
26
- className = _extendSxProp.className,
27
- _extendSxProp$compone = _extendSxProp.component,
28
- component = _extendSxProp$compone === void 0 ? 'div' : _extendSxProp$compone,
29
- other = _objectWithoutProperties(_extendSxProp, ["className", "component"]);
30
- return /*#__PURE__*/_jsx(BoxRoot, _extends({
31
- as: component,
32
- ref: ref,
33
- className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
34
- theme: themeId ? theme[themeId] || theme : theme
35
- }, other));
36
- });
37
- return Box;
38
- }
@@ -1,3 +0,0 @@
1
- 'use client';
2
-
3
- export { default } from './createBox';
@@ -1,250 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- import _typeof from "@babel/runtime/helpers/esm/typeof";
4
- import _extends from "@babel/runtime/helpers/esm/extends";
5
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
6
- /* eslint-disable no-underscore-dangle */
7
- import styledEngineStyled, { internal_processStyles as processStyles } from '@mui/styled-engine';
8
- import { isPlainObject } from '@mui/utils/deepmerge';
9
- import capitalize from '@mui/utils/capitalize';
10
- import getDisplayName from '@mui/utils/getDisplayName';
11
- import createTheme from '../createTheme';
12
- import styleFunctionSx from '../styleFunctionSx';
13
- function isEmpty(obj) {
14
- return Object.keys(obj).length === 0;
15
- }
16
-
17
- // https://github.com/emotion-js/emotion/blob/26ded6109fcd8ca9875cc2ce4564fee678a3f3c5/packages/styled/src/utils.js#L40
18
- function isStringTag(tag) {
19
- return typeof tag === 'string' &&
20
- // 96 is one less than the char code
21
- // for "a" so this is checking that
22
- // it's a lowercase character
23
- tag.charCodeAt(0) > 96;
24
- }
25
-
26
- // Update /system/styled/#api in case if this changes
27
- export function shouldForwardProp(prop) {
28
- return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
29
- }
30
- export var systemDefaultTheme = createTheme();
31
- var lowercaseFirstLetter = function lowercaseFirstLetter(string) {
32
- if (!string) {
33
- return string;
34
- }
35
- return string.charAt(0).toLowerCase() + string.slice(1);
36
- };
37
- function resolveTheme(_ref) {
38
- var defaultTheme = _ref.defaultTheme,
39
- theme = _ref.theme,
40
- themeId = _ref.themeId;
41
- return isEmpty(theme) ? defaultTheme : theme[themeId] || theme;
42
- }
43
- function defaultOverridesResolver(slot) {
44
- if (!slot) {
45
- return null;
46
- }
47
- return function (props, styles) {
48
- return styles[slot];
49
- };
50
- }
51
- function processStyleArg(callableStyle, _ref2) {
52
- var ownerState = _ref2.ownerState,
53
- props = _objectWithoutProperties(_ref2, ["ownerState"]);
54
- var resolvedStylesArg = typeof callableStyle === 'function' ? callableStyle(_extends({
55
- ownerState: ownerState
56
- }, props)) : callableStyle;
57
- if (Array.isArray(resolvedStylesArg)) {
58
- return resolvedStylesArg.flatMap(function (resolvedStyle) {
59
- return processStyleArg(resolvedStyle, _extends({
60
- ownerState: ownerState
61
- }, props));
62
- });
63
- }
64
- if (!!resolvedStylesArg && _typeof(resolvedStylesArg) === 'object' && Array.isArray(resolvedStylesArg.variants)) {
65
- var _resolvedStylesArg$va = resolvedStylesArg.variants,
66
- variants = _resolvedStylesArg$va === void 0 ? [] : _resolvedStylesArg$va,
67
- otherStyles = _objectWithoutProperties(resolvedStylesArg, ["variants"]);
68
- var result = otherStyles;
69
- variants.forEach(function (variant) {
70
- var isMatch = true;
71
- if (typeof variant.props === 'function') {
72
- isMatch = variant.props(_extends({
73
- ownerState: ownerState
74
- }, props, ownerState));
75
- } else {
76
- Object.keys(variant.props).forEach(function (key) {
77
- if ((ownerState == null ? void 0 : ownerState[key]) !== variant.props[key] && props[key] !== variant.props[key]) {
78
- isMatch = false;
79
- }
80
- });
81
- }
82
- if (isMatch) {
83
- if (!Array.isArray(result)) {
84
- result = [result];
85
- }
86
- result.push(typeof variant.style === 'function' ? variant.style(_extends({
87
- ownerState: ownerState
88
- }, props, ownerState)) : variant.style);
89
- }
90
- });
91
- return result;
92
- }
93
- return resolvedStylesArg;
94
- }
95
- export default function createStyled() {
96
- var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
97
- var themeId = input.themeId,
98
- _input$defaultTheme = input.defaultTheme,
99
- defaultTheme = _input$defaultTheme === void 0 ? systemDefaultTheme : _input$defaultTheme,
100
- _input$rootShouldForw = input.rootShouldForwardProp,
101
- rootShouldForwardProp = _input$rootShouldForw === void 0 ? shouldForwardProp : _input$rootShouldForw,
102
- _input$slotShouldForw = input.slotShouldForwardProp,
103
- slotShouldForwardProp = _input$slotShouldForw === void 0 ? shouldForwardProp : _input$slotShouldForw;
104
- var systemSx = function systemSx(props) {
105
- return styleFunctionSx(_extends({}, props, {
106
- theme: resolveTheme(_extends({}, props, {
107
- defaultTheme: defaultTheme,
108
- themeId: themeId
109
- }))
110
- }));
111
- };
112
- systemSx.__mui_systemSx = true;
113
- return function (tag) {
114
- var inputOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
115
- // Filter out the `sx` style function from the previous styled component to prevent unnecessary styles generated by the composite components.
116
- processStyles(tag, function (styles) {
117
- return styles.filter(function (style) {
118
- return !(style != null && style.__mui_systemSx);
119
- });
120
- });
121
- var componentName = inputOptions.name,
122
- componentSlot = inputOptions.slot,
123
- inputSkipVariantsResolver = inputOptions.skipVariantsResolver,
124
- inputSkipSx = inputOptions.skipSx,
125
- _inputOptions$overrid = inputOptions.overridesResolver,
126
- overridesResolver = _inputOptions$overrid === void 0 ? defaultOverridesResolver(lowercaseFirstLetter(componentSlot)) : _inputOptions$overrid,
127
- options = _objectWithoutProperties(inputOptions, ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"]); // if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
128
- var skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver :
129
- // TODO v6: remove `Root` in the next major release
130
- // For more details: https://github.com/mui/material-ui/pull/37908
131
- componentSlot && componentSlot !== 'Root' && componentSlot !== 'root' || false;
132
- var skipSx = inputSkipSx || false;
133
- var label;
134
- if (process.env.NODE_ENV !== 'production') {
135
- if (componentName) {
136
- // TODO v6: remove `lowercaseFirstLetter()` in the next major release
137
- // For more details: https://github.com/mui/material-ui/pull/37908
138
- label = "".concat(componentName, "-").concat(lowercaseFirstLetter(componentSlot || 'Root'));
139
- }
140
- }
141
- var shouldForwardPropOption = shouldForwardProp;
142
-
143
- // TODO v6: remove `Root` in the next major release
144
- // For more details: https://github.com/mui/material-ui/pull/37908
145
- if (componentSlot === 'Root' || componentSlot === 'root') {
146
- shouldForwardPropOption = rootShouldForwardProp;
147
- } else if (componentSlot) {
148
- // any other slot specified
149
- shouldForwardPropOption = slotShouldForwardProp;
150
- } else if (isStringTag(tag)) {
151
- // for string (html) tag, preserve the behavior in emotion & styled-components.
152
- shouldForwardPropOption = undefined;
153
- }
154
- var defaultStyledResolver = styledEngineStyled(tag, _extends({
155
- shouldForwardProp: shouldForwardPropOption,
156
- label: label
157
- }, options));
158
- var transformStyleArg = function transformStyleArg(stylesArg) {
159
- // On the server Emotion doesn't use React.forwardRef for creating components, so the created
160
- // component stays as a function. This condition makes sure that we do not interpolate functions
161
- // which are basically components used as a selectors.
162
- if (typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg || isPlainObject(stylesArg)) {
163
- return function (props) {
164
- return processStyleArg(stylesArg, _extends({}, props, {
165
- theme: resolveTheme({
166
- theme: props.theme,
167
- defaultTheme: defaultTheme,
168
- themeId: themeId
169
- })
170
- }));
171
- };
172
- }
173
- return stylesArg;
174
- };
175
- var muiStyledResolver = function muiStyledResolver(styleArg) {
176
- var transformedStyleArg = transformStyleArg(styleArg);
177
- for (var _len = arguments.length, expressions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
178
- expressions[_key - 1] = arguments[_key];
179
- }
180
- var expressionsWithDefaultTheme = expressions ? expressions.map(transformStyleArg) : [];
181
- if (componentName && overridesResolver) {
182
- expressionsWithDefaultTheme.push(function (props) {
183
- var theme = resolveTheme(_extends({}, props, {
184
- defaultTheme: defaultTheme,
185
- themeId: themeId
186
- }));
187
- if (!theme.components || !theme.components[componentName] || !theme.components[componentName].styleOverrides) {
188
- return null;
189
- }
190
- var styleOverrides = theme.components[componentName].styleOverrides;
191
- var resolvedStyleOverrides = {};
192
- // TODO: v7 remove iteration and use `resolveStyleArg(styleOverrides[slot])` directly
193
- Object.entries(styleOverrides).forEach(function (_ref3) {
194
- var _ref4 = _slicedToArray(_ref3, 2),
195
- slotKey = _ref4[0],
196
- slotStyle = _ref4[1];
197
- resolvedStyleOverrides[slotKey] = processStyleArg(slotStyle, _extends({}, props, {
198
- theme: theme
199
- }));
200
- });
201
- return overridesResolver(props, resolvedStyleOverrides);
202
- });
203
- }
204
- if (componentName && !skipVariantsResolver) {
205
- expressionsWithDefaultTheme.push(function (props) {
206
- var _theme$components;
207
- var theme = resolveTheme(_extends({}, props, {
208
- defaultTheme: defaultTheme,
209
- themeId: themeId
210
- }));
211
- var themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[componentName]) == null ? void 0 : _theme$components.variants;
212
- return processStyleArg({
213
- variants: themeVariants
214
- }, _extends({}, props, {
215
- theme: theme
216
- }));
217
- });
218
- }
219
- if (!skipSx) {
220
- expressionsWithDefaultTheme.push(systemSx);
221
- }
222
- var numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length;
223
- if (Array.isArray(styleArg) && numOfCustomFnsApplied > 0) {
224
- var placeholders = new Array(numOfCustomFnsApplied).fill('');
225
- // If the type is array, than we need to add placeholders in the template for the overrides, variants and the sx styles.
226
- transformedStyleArg = [].concat(_toConsumableArray(styleArg), _toConsumableArray(placeholders));
227
- transformedStyleArg.raw = [].concat(_toConsumableArray(styleArg.raw), _toConsumableArray(placeholders));
228
- }
229
- var Component = defaultStyledResolver.apply(void 0, [transformedStyleArg].concat(_toConsumableArray(expressionsWithDefaultTheme)));
230
- if (process.env.NODE_ENV !== 'production') {
231
- var displayName;
232
- if (componentName) {
233
- displayName = "".concat(componentName).concat(capitalize(componentSlot || ''));
234
- }
235
- if (displayName === undefined) {
236
- displayName = "Styled(".concat(getDisplayName(tag), ")");
237
- }
238
- Component.displayName = displayName;
239
- }
240
- if (tag.muiName) {
241
- Component.muiName = tag.muiName;
242
- }
243
- return Component;
244
- };
245
- if (defaultStyledResolver.withConfig) {
246
- muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
247
- }
248
- return muiStyledResolver;
249
- };
250
- }