@mui/system 5.10.9 → 5.10.12

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 (56) hide show
  1. package/Box/Box.spec.d.ts +1 -1
  2. package/CHANGELOG.md +447 -213
  3. package/Container/Container.d.ts +13 -13
  4. package/Container/ContainerProps.d.ts +40 -40
  5. package/Container/containerClasses.d.ts +22 -22
  6. package/Container/createContainer.d.ts +18 -18
  7. package/Stack/Stack.d.ts +13 -13
  8. package/Stack/StackProps.d.ts +42 -42
  9. package/Stack/createStack.d.ts +21 -21
  10. package/Stack/index.d.ts +5 -5
  11. package/Stack/stackClasses.d.ts +8 -8
  12. package/ThemeProvider/ThemeProvider.js +3 -1
  13. package/Unstable_Grid/Grid.d.ts +12 -12
  14. package/Unstable_Grid/GridProps.d.ts +162 -162
  15. package/Unstable_Grid/createGrid.d.ts +11 -11
  16. package/Unstable_Grid/gridClasses.d.ts +20 -20
  17. package/Unstable_Grid/gridGenerator.d.ts +28 -28
  18. package/Unstable_Grid/index.d.ts +5 -5
  19. package/createBox.spec.d.ts +1 -1
  20. package/createTheme/createSpacing.d.ts +10 -10
  21. package/createTheme/createSpacing.js +1 -1
  22. package/cssVars/createCssVarsProvider.js +11 -10
  23. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  24. package/cssVars/createGetCssVar.d.ts +5 -5
  25. package/cssVars/cssVarsParser.d.ts +65 -65
  26. package/cssVars/cssVarsParser.js +1 -1
  27. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  28. package/cssVars/index.d.ts +3 -3
  29. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  30. package/esm/ThemeProvider/ThemeProvider.js +2 -1
  31. package/esm/createTheme/createSpacing.js +1 -1
  32. package/esm/cssVars/createCssVarsProvider.js +11 -10
  33. package/esm/cssVars/cssVarsParser.js +1 -1
  34. package/esm/palette.js +15 -3
  35. package/esm/style.js +1 -1
  36. package/index.js +1 -1
  37. package/index.spec.d.ts +1 -1
  38. package/legacy/ThemeProvider/ThemeProvider.js +2 -1
  39. package/legacy/createTheme/createSpacing.js +1 -1
  40. package/legacy/cssVars/createCssVarsProvider.js +6 -3
  41. package/legacy/cssVars/cssVarsParser.js +1 -1
  42. package/legacy/index.js +1 -1
  43. package/legacy/palette.js +15 -3
  44. package/legacy/style.js +1 -1
  45. package/modern/ThemeProvider/ThemeProvider.js +2 -1
  46. package/modern/createTheme/createSpacing.js +1 -1
  47. package/modern/cssVars/createCssVarsProvider.js +11 -10
  48. package/modern/cssVars/cssVarsParser.js +1 -1
  49. package/modern/index.js +1 -1
  50. package/modern/palette.js +15 -3
  51. package/modern/style.js +1 -1
  52. package/package.json +1 -1
  53. package/palette.js +14 -3
  54. package/style.d.ts +4 -1
  55. package/style.js +1 -1
  56. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
@@ -1,65 +1,65 @@
1
- declare type NestedRecord<V = any> = {
2
- [k: string | number]: NestedRecord<V> | V;
3
- };
4
- /**
5
- * This function create an object from keys, value and then assign to target
6
- *
7
- * @param {Object} obj : the target object to be assigned
8
- * @param {string[]} keys
9
- * @param {string | number} value
10
- *
11
- * @example
12
- * const source = {}
13
- * assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
14
- * console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
15
- *
16
- * @example
17
- * const source = { palette: { primary: 'var(--palette-primary)' } }
18
- * assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
19
- * console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
20
- */
21
- export declare const assignNestedKeys: <T extends string | Record<string, any> | null | undefined = NestedRecord<any>, Value = any>(obj: T, keys: Array<string>, value: Value, arrayKeys?: Array<string>) => void;
22
- /**
23
- *
24
- * @param {Object} obj : source object
25
- * @param {Function} callback : a function that will be called when
26
- * - the deepest key in source object is reached
27
- * - the value of the deepest key is NOT `undefined` | `null`
28
- *
29
- * @example
30
- * walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
31
- * // ['palette', 'primary', 'main'] '#000000'
32
- */
33
- export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, arrayKeys: Array<string>) => void, shouldSkipPaths?: ((keys: Array<string>) => boolean) | undefined) => void;
34
- /**
35
- * a function that parse theme and return { css, vars }
36
- *
37
- * @param {Object} theme
38
- * @param {{
39
- * prefix?: string,
40
- * shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
41
- * }} options.
42
- * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
43
- *
44
- * @returns {{ css: Object, vars: Object, parsedTheme: typeof theme }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme), and `parsedTheme` is the cloned version of theme.
45
- *
46
- * @example
47
- * const { css, vars, parsedTheme } = parser({
48
- * fontSize: 12,
49
- * lineHeight: 1.2,
50
- * palette: { primary: { 500: 'var(--color)' } }
51
- * }, { prefix: 'foo' })
52
- *
53
- * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
54
- * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
55
- * console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--color)' } } }
56
- */
57
- export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
58
- prefix?: string;
59
- shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
60
- }): {
61
- css: Record<string, string | number>;
62
- vars: NestedRecord<string>;
63
- parsedTheme: T;
64
- };
65
- export {};
1
+ declare type NestedRecord<V = any> = {
2
+ [k: string | number]: NestedRecord<V> | V;
3
+ };
4
+ /**
5
+ * This function create an object from keys, value and then assign to target
6
+ *
7
+ * @param {Object} obj : the target object to be assigned
8
+ * @param {string[]} keys
9
+ * @param {string | number} value
10
+ *
11
+ * @example
12
+ * const source = {}
13
+ * assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
14
+ * console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
15
+ *
16
+ * @example
17
+ * const source = { palette: { primary: 'var(--palette-primary)' } }
18
+ * assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
19
+ * console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
20
+ */
21
+ export declare const assignNestedKeys: <T extends string | Record<string, any> | null | undefined = NestedRecord<any>, Value = any>(obj: T, keys: Array<string>, value: Value, arrayKeys?: Array<string>) => void;
22
+ /**
23
+ *
24
+ * @param {Object} obj : source object
25
+ * @param {Function} callback : a function that will be called when
26
+ * - the deepest key in source object is reached
27
+ * - the value of the deepest key is NOT `undefined` | `null`
28
+ *
29
+ * @example
30
+ * walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
31
+ * // ['palette', 'primary', 'main'] '#000000'
32
+ */
33
+ export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, arrayKeys: Array<string>) => void, shouldSkipPaths?: ((keys: Array<string>) => boolean) | undefined) => void;
34
+ /**
35
+ * a function that parse theme and return { css, vars }
36
+ *
37
+ * @param {Object} theme
38
+ * @param {{
39
+ * prefix?: string,
40
+ * shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
41
+ * }} options.
42
+ * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
43
+ *
44
+ * @returns {{ css: Object, vars: Object, parsedTheme: typeof theme }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme), and `parsedTheme` is the cloned version of theme.
45
+ *
46
+ * @example
47
+ * const { css, vars, parsedTheme } = parser({
48
+ * fontSize: 12,
49
+ * lineHeight: 1.2,
50
+ * palette: { primary: { 500: 'var(--color)' } }
51
+ * }, { prefix: 'foo' })
52
+ *
53
+ * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
54
+ * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
55
+ * console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--color)' } } }
56
+ */
57
+ export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
58
+ prefix?: string;
59
+ shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
60
+ }): {
61
+ css: Record<string, string | number>;
62
+ vars: NestedRecord<string>;
63
+ parsedTheme: T;
64
+ };
65
+ export {};
@@ -131,7 +131,7 @@ function cssVarsParser(theme, options) {
131
131
  const parsedTheme = {};
132
132
  walkObjectDeep(theme, (keys, value, arrayKeys) => {
133
133
  if (typeof value === 'string' || typeof value === 'number') {
134
- if (!shouldSkipGeneratingVar || shouldSkipGeneratingVar && !shouldSkipGeneratingVar(keys, value)) {
134
+ if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
135
135
  // only create css & var if `shouldSkipGeneratingVar` return false
136
136
  const cssVar = `--${prefix ? `${prefix}-` : ''}${keys.join('-')}`;
137
137
  Object.assign(css, {
@@ -1,42 +1,42 @@
1
- /// <reference types="react" />
2
- export declare const DEFAULT_MODE_STORAGE_KEY = "mode";
3
- export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
4
- export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
5
- export interface GetInitColorSchemeScriptOptions {
6
- /**
7
- * The mode to be used for the first visit
8
- * @default 'light'
9
- */
10
- defaultMode?: 'light' | 'dark' | 'system';
11
- /**
12
- * The default color scheme to be used on the light mode
13
- * @default 'light'
14
- */
15
- defaultLightColorScheme?: string;
16
- /**
17
- * The default color scheme to be used on the dark mode
18
- * * @default 'dark'
19
- */
20
- defaultDarkColorScheme?: string;
21
- /**
22
- * The node (provided as string) used to attach the color-scheme attribute
23
- * @default 'document.documentElement'
24
- */
25
- colorSchemeNode?: string;
26
- /**
27
- * localStorage key used to store `mode`
28
- * @default 'mode'
29
- */
30
- modeStorageKey?: string;
31
- /**
32
- * localStorage key used to store `colorScheme`
33
- * @default 'color-scheme'
34
- */
35
- colorSchemeStorageKey?: string;
36
- /**
37
- * DOM attribute for applying color scheme
38
- * @default 'data-color-scheme'
39
- */
40
- attribute?: string;
41
- }
42
- export default function getInitColorSchemeScript(options?: GetInitColorSchemeScriptOptions): JSX.Element;
1
+ /// <reference types="react" />
2
+ export declare const DEFAULT_MODE_STORAGE_KEY = "mode";
3
+ export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
4
+ export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
5
+ export interface GetInitColorSchemeScriptOptions {
6
+ /**
7
+ * The mode to be used for the first visit
8
+ * @default 'light'
9
+ */
10
+ defaultMode?: 'light' | 'dark' | 'system';
11
+ /**
12
+ * The default color scheme to be used on the light mode
13
+ * @default 'light'
14
+ */
15
+ defaultLightColorScheme?: string;
16
+ /**
17
+ * The default color scheme to be used on the dark mode
18
+ * * @default 'dark'
19
+ */
20
+ defaultDarkColorScheme?: string;
21
+ /**
22
+ * The node (provided as string) used to attach the color-scheme attribute
23
+ * @default 'document.documentElement'
24
+ */
25
+ colorSchemeNode?: string;
26
+ /**
27
+ * localStorage key used to store `mode`
28
+ * @default 'mode'
29
+ */
30
+ modeStorageKey?: string;
31
+ /**
32
+ * localStorage key used to store `colorScheme`
33
+ * @default 'color-scheme'
34
+ */
35
+ colorSchemeStorageKey?: string;
36
+ /**
37
+ * DOM attribute for applying color scheme
38
+ * @default 'data-color-scheme'
39
+ */
40
+ attribute?: string;
41
+ }
42
+ export default function getInitColorSchemeScript(options?: GetInitColorSchemeScriptOptions): JSX.Element;
@@ -1,3 +1,3 @@
1
- export { default } from './createCssVarsProvider';
2
- export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
3
- export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
1
+ export { default } from './createCssVarsProvider';
2
+ export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
3
+ export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
@@ -1,53 +1,53 @@
1
- export declare type Mode = 'light' | 'dark' | 'system';
2
- export declare type SystemMode = Exclude<Mode, 'system'>;
3
- export interface State<SupportedColorScheme extends string> {
4
- /**
5
- * User selected mode.
6
- * Note: on the server, mode is always undefined
7
- */
8
- mode: Mode | undefined;
9
- /**
10
- * Only valid if `mode: 'system'`, either 'light' | 'dark'.
11
- */
12
- systemMode: SystemMode | undefined;
13
- /**
14
- * The color scheme for the light mode.
15
- */
16
- lightColorScheme: SupportedColorScheme;
17
- /**
18
- * The color scheme for the dark mode.
19
- */
20
- darkColorScheme: SupportedColorScheme;
21
- }
22
- export declare type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
23
- /**
24
- * The current application color scheme. It is always `undefined` on the server.
25
- */
26
- colorScheme: SupportedColorScheme | undefined;
27
- /**
28
- * `mode` is saved to internal state and localStorage
29
- * If `mode` is null, it will be reset to the defaultMode
30
- */
31
- setMode: (mode: Mode | null) => void;
32
- /**
33
- * `colorScheme` is saved to internal state and localStorage
34
- * If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
35
- */
36
- setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
37
- light: SupportedColorScheme | null;
38
- dark: SupportedColorScheme | null;
39
- }> | null) => void;
40
- };
41
- export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
42
- export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
43
- interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
44
- defaultLightColorScheme: SupportedColorScheme;
45
- defaultDarkColorScheme: SupportedColorScheme;
46
- supportedColorSchemes: Array<SupportedColorScheme>;
47
- defaultMode?: Mode;
48
- modeStorageKey?: string;
49
- colorSchemeStorageKey?: string;
50
- storageWindow?: Window | null;
51
- }
52
- export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
53
- export {};
1
+ export declare type Mode = 'light' | 'dark' | 'system';
2
+ export declare type SystemMode = Exclude<Mode, 'system'>;
3
+ export interface State<SupportedColorScheme extends string> {
4
+ /**
5
+ * User selected mode.
6
+ * Note: on the server, mode is always undefined
7
+ */
8
+ mode: Mode | undefined;
9
+ /**
10
+ * Only valid if `mode: 'system'`, either 'light' | 'dark'.
11
+ */
12
+ systemMode: SystemMode | undefined;
13
+ /**
14
+ * The color scheme for the light mode.
15
+ */
16
+ lightColorScheme: SupportedColorScheme;
17
+ /**
18
+ * The color scheme for the dark mode.
19
+ */
20
+ darkColorScheme: SupportedColorScheme;
21
+ }
22
+ export declare type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
23
+ /**
24
+ * The current application color scheme. It is always `undefined` on the server.
25
+ */
26
+ colorScheme: SupportedColorScheme | undefined;
27
+ /**
28
+ * `mode` is saved to internal state and localStorage
29
+ * If `mode` is null, it will be reset to the defaultMode
30
+ */
31
+ setMode: (mode: Mode | null) => void;
32
+ /**
33
+ * `colorScheme` is saved to internal state and localStorage
34
+ * If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
35
+ */
36
+ setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
37
+ light: SupportedColorScheme | null;
38
+ dark: SupportedColorScheme | null;
39
+ }> | null) => void;
40
+ };
41
+ export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
42
+ export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
43
+ interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
44
+ defaultLightColorScheme: SupportedColorScheme;
45
+ defaultDarkColorScheme: SupportedColorScheme;
46
+ supportedColorSchemes: Array<SupportedColorScheme>;
47
+ defaultMode?: Mode;
48
+ modeStorageKey?: string;
49
+ colorSchemeStorageKey?: string;
50
+ storageWindow?: Window | null;
51
+ }
52
+ export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
53
+ export {};
@@ -5,11 +5,12 @@ import { exactProp } from '@mui/utils';
5
5
  import { ThemeContext as StyledEngineThemeContext } from '@mui/styled-engine';
6
6
  import useTheme from '../useTheme';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
+ const EMPTY_THEME = {};
8
9
 
9
10
  function InnerThemeProvider(props) {
10
11
  const theme = useTheme();
11
12
  return /*#__PURE__*/_jsx(StyledEngineThemeContext.Provider, {
12
- value: typeof theme === 'object' ? theme : {},
13
+ value: typeof theme === 'object' ? theme : EMPTY_THEME,
13
14
  children: props.children
14
15
  });
15
16
  }
@@ -7,7 +7,7 @@ export default function createSpacing(spacingInput = 8) {
7
7
  return spacingInput;
8
8
  } // Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout.
9
9
  // Smaller components, such as icons, can align to a 4dp grid.
10
- // https://material.io/design/layout/understanding-layout.html#usage
10
+ // https://m2.material.io/design/layout/understanding-layout.html
11
11
 
12
12
 
13
13
  const transform = createUnarySpacing({
@@ -221,17 +221,18 @@ export default function createCssVarsProvider(options) {
221
221
  hasMounted.current = false;
222
222
  };
223
223
  }, []);
224
+ const contextValue = React.useMemo(() => ({
225
+ mode,
226
+ systemMode,
227
+ setMode,
228
+ lightColorScheme,
229
+ darkColorScheme,
230
+ colorScheme,
231
+ setColorScheme,
232
+ allColorSchemes
233
+ }), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
224
234
  return /*#__PURE__*/_jsxs(ColorSchemeContext.Provider, {
225
- value: {
226
- mode,
227
- systemMode,
228
- setMode,
229
- lightColorScheme,
230
- darkColorScheme,
231
- colorScheme,
232
- setColorScheme,
233
- allColorSchemes
234
- },
235
+ value: contextValue,
235
236
  children: [/*#__PURE__*/_jsx(GlobalStyles, {
236
237
  styles: {
237
238
  [colorSchemeSelector]: rootCss
@@ -117,7 +117,7 @@ export default function cssVarsParser(theme, options) {
117
117
  const parsedTheme = {};
118
118
  walkObjectDeep(theme, (keys, value, arrayKeys) => {
119
119
  if (typeof value === 'string' || typeof value === 'number') {
120
- if (!shouldSkipGeneratingVar || shouldSkipGeneratingVar && !shouldSkipGeneratingVar(keys, value)) {
120
+ if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
121
121
  // only create css & var if `shouldSkipGeneratingVar` return false
122
122
  const cssVar = `--${prefix ? `${prefix}-` : ''}${keys.join('-')}`;
123
123
  Object.assign(css, {
package/esm/palette.js CHANGED
@@ -1,17 +1,29 @@
1
1
  import style from './style';
2
2
  import compose from './compose';
3
+
4
+ function transform(value, userValue) {
5
+ if (userValue === 'grey') {
6
+ return userValue;
7
+ }
8
+
9
+ return value;
10
+ }
11
+
3
12
  export const color = style({
4
13
  prop: 'color',
5
- themeKey: 'palette'
14
+ themeKey: 'palette',
15
+ transform
6
16
  });
7
17
  export const bgcolor = style({
8
18
  prop: 'bgcolor',
9
19
  cssProperty: 'backgroundColor',
10
- themeKey: 'palette'
20
+ themeKey: 'palette',
21
+ transform
11
22
  });
12
23
  export const backgroundColor = style({
13
24
  prop: 'backgroundColor',
14
- themeKey: 'palette'
25
+ themeKey: 'palette',
26
+ transform
15
27
  });
16
28
  const palette = compose(color, bgcolor, backgroundColor);
17
29
  export default palette;
package/esm/style.js CHANGED
@@ -36,7 +36,7 @@ function getValue(themeMapping, transform, propValueFinal, userValue = propValue
36
36
  }
37
37
 
38
38
  if (transform) {
39
- value = transform(value);
39
+ value = transform(value, userValue);
40
40
  }
41
41
 
42
42
  return value;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.10.9
1
+ /** @license MUI v5.10.12
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.
package/index.spec.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -6,11 +6,12 @@ import { exactProp } from '@mui/utils';
6
6
  import { ThemeContext as StyledEngineThemeContext } from '@mui/styled-engine';
7
7
  import useTheme from '../useTheme';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
+ var EMPTY_THEME = {};
9
10
 
10
11
  function InnerThemeProvider(props) {
11
12
  var theme = useTheme();
12
13
  return /*#__PURE__*/_jsx(StyledEngineThemeContext.Provider, {
13
- value: _typeof(theme) === 'object' ? theme : {},
14
+ value: _typeof(theme) === 'object' ? theme : EMPTY_THEME,
14
15
  children: props.children
15
16
  });
16
17
  }
@@ -9,7 +9,7 @@ export default function createSpacing() {
9
9
  return spacingInput;
10
10
  } // Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout.
11
11
  // Smaller components, such as icons, can align to a 4dp grid.
12
- // https://material.io/design/layout/understanding-layout.html#usage
12
+ // https://m2.material.io/design/layout/understanding-layout.html
13
13
 
14
14
 
15
15
  var transform = createUnarySpacing({
@@ -245,8 +245,8 @@ export default function createCssVarsProvider(options) {
245
245
  hasMounted.current = false;
246
246
  };
247
247
  }, []);
248
- return /*#__PURE__*/_jsxs(ColorSchemeContext.Provider, {
249
- value: {
248
+ var contextValue = React.useMemo(function () {
249
+ return {
250
250
  mode: mode,
251
251
  systemMode: systemMode,
252
252
  setMode: setMode,
@@ -255,7 +255,10 @@ export default function createCssVarsProvider(options) {
255
255
  colorScheme: colorScheme,
256
256
  setColorScheme: setColorScheme,
257
257
  allColorSchemes: allColorSchemes
258
- },
258
+ };
259
+ }, [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
260
+ return /*#__PURE__*/_jsxs(ColorSchemeContext.Provider, {
261
+ value: contextValue,
259
262
  children: [/*#__PURE__*/_jsx(GlobalStyles, {
260
263
  styles: _defineProperty({}, colorSchemeSelector, rootCss)
261
264
  }), /*#__PURE__*/_jsx(GlobalStyles, {
@@ -132,7 +132,7 @@ export default function cssVarsParser(theme, options) {
132
132
  var parsedTheme = {};
133
133
  walkObjectDeep(theme, function (keys, value, arrayKeys) {
134
134
  if (typeof value === 'string' || typeof value === 'number') {
135
- if (!shouldSkipGeneratingVar || shouldSkipGeneratingVar && !shouldSkipGeneratingVar(keys, value)) {
135
+ if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
136
136
  // only create css & var if `shouldSkipGeneratingVar` return false
137
137
  var cssVar = "--".concat(prefix ? "".concat(prefix, "-") : '').concat(keys.join('-'));
138
138
 
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.10.9
1
+ /** @license MUI v5.10.12
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.
package/legacy/palette.js CHANGED
@@ -1,17 +1,29 @@
1
1
  import style from './style';
2
2
  import compose from './compose';
3
+
4
+ function transform(value, userValue) {
5
+ if (userValue === 'grey') {
6
+ return userValue;
7
+ }
8
+
9
+ return value;
10
+ }
11
+
3
12
  export var color = style({
4
13
  prop: 'color',
5
- themeKey: 'palette'
14
+ themeKey: 'palette',
15
+ transform: transform
6
16
  });
7
17
  export var bgcolor = style({
8
18
  prop: 'bgcolor',
9
19
  cssProperty: 'backgroundColor',
10
- themeKey: 'palette'
20
+ themeKey: 'palette',
21
+ transform: transform
11
22
  });
12
23
  export var backgroundColor = style({
13
24
  prop: 'backgroundColor',
14
- themeKey: 'palette'
25
+ themeKey: 'palette',
26
+ transform: transform
15
27
  });
16
28
  var palette = compose(color, bgcolor, backgroundColor);
17
29
  export default palette;
package/legacy/style.js CHANGED
@@ -42,7 +42,7 @@ function getValue(themeMapping, transform, propValueFinal) {
42
42
  }
43
43
 
44
44
  if (transform) {
45
- value = transform(value);
45
+ value = transform(value, userValue);
46
46
  }
47
47
 
48
48
  return value;
@@ -5,11 +5,12 @@ import { exactProp } from '@mui/utils';
5
5
  import { ThemeContext as StyledEngineThemeContext } from '@mui/styled-engine';
6
6
  import useTheme from '../useTheme';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
+ const EMPTY_THEME = {};
8
9
 
9
10
  function InnerThemeProvider(props) {
10
11
  const theme = useTheme();
11
12
  return /*#__PURE__*/_jsx(StyledEngineThemeContext.Provider, {
12
- value: typeof theme === 'object' ? theme : {},
13
+ value: typeof theme === 'object' ? theme : EMPTY_THEME,
13
14
  children: props.children
14
15
  });
15
16
  }
@@ -7,7 +7,7 @@ export default function createSpacing(spacingInput = 8) {
7
7
  return spacingInput;
8
8
  } // Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout.
9
9
  // Smaller components, such as icons, can align to a 4dp grid.
10
- // https://material.io/design/layout/understanding-layout.html#usage
10
+ // https://m2.material.io/design/layout/understanding-layout.html
11
11
 
12
12
 
13
13
  const transform = createUnarySpacing({
@@ -221,17 +221,18 @@ export default function createCssVarsProvider(options) {
221
221
  hasMounted.current = false;
222
222
  };
223
223
  }, []);
224
+ const contextValue = React.useMemo(() => ({
225
+ mode,
226
+ systemMode,
227
+ setMode,
228
+ lightColorScheme,
229
+ darkColorScheme,
230
+ colorScheme,
231
+ setColorScheme,
232
+ allColorSchemes
233
+ }), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
224
234
  return /*#__PURE__*/_jsxs(ColorSchemeContext.Provider, {
225
- value: {
226
- mode,
227
- systemMode,
228
- setMode,
229
- lightColorScheme,
230
- darkColorScheme,
231
- colorScheme,
232
- setColorScheme,
233
- allColorSchemes
234
- },
235
+ value: contextValue,
235
236
  children: [/*#__PURE__*/_jsx(GlobalStyles, {
236
237
  styles: {
237
238
  [colorSchemeSelector]: rootCss
@@ -117,7 +117,7 @@ export default function cssVarsParser(theme, options) {
117
117
  const parsedTheme = {};
118
118
  walkObjectDeep(theme, (keys, value, arrayKeys) => {
119
119
  if (typeof value === 'string' || typeof value === 'number') {
120
- if (!shouldSkipGeneratingVar || shouldSkipGeneratingVar && !shouldSkipGeneratingVar(keys, value)) {
120
+ if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
121
121
  // only create css & var if `shouldSkipGeneratingVar` return false
122
122
  const cssVar = `--${prefix ? `${prefix}-` : ''}${keys.join('-')}`;
123
123
  Object.assign(css, {
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.10.9
1
+ /** @license MUI v5.10.12
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.