@mui/system 5.12.0 → 5.12.1

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 (50) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/Container/Container.d.ts +13 -13
  3. package/Container/ContainerProps.d.ts +40 -40
  4. package/Container/containerClasses.d.ts +22 -22
  5. package/Container/createContainer.d.ts +18 -18
  6. package/GlobalStyles/GlobalStyles.d.ts +13 -13
  7. package/GlobalStyles/index.d.ts +2 -2
  8. package/Stack/Stack.d.ts +14 -13
  9. package/Stack/Stack.js +2 -1
  10. package/Stack/StackProps.d.ts +53 -53
  11. package/Stack/createStack.d.ts +21 -21
  12. package/Stack/index.d.ts +5 -5
  13. package/Stack/stackClasses.d.ts +8 -8
  14. package/Unstable_Grid/Grid.d.ts +12 -12
  15. package/Unstable_Grid/GridProps.d.ts +185 -173
  16. package/Unstable_Grid/createGrid.d.ts +11 -11
  17. package/Unstable_Grid/createGrid.js +18 -11
  18. package/Unstable_Grid/gridClasses.d.ts +20 -20
  19. package/Unstable_Grid/gridGenerator.d.ts +38 -38
  20. package/Unstable_Grid/gridGenerator.js +12 -12
  21. package/Unstable_Grid/index.d.ts +5 -5
  22. package/createStyled.js +3 -0
  23. package/createTheme/createSpacing.d.ts +10 -10
  24. package/cssVars/createCssVarsTheme.d.ts +15 -13
  25. package/cssVars/createGetCssVar.d.ts +5 -5
  26. package/cssVars/cssVarsParser.d.ts +64 -64
  27. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  28. package/cssVars/index.d.ts +5 -5
  29. package/cssVars/prepareCssVars.d.ts +16 -14
  30. package/cssVars/prepareCssVars.js +6 -2
  31. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  32. package/esm/Stack/Stack.js +2 -1
  33. package/esm/Unstable_Grid/createGrid.js +19 -12
  34. package/esm/Unstable_Grid/gridGenerator.js +12 -12
  35. package/esm/createStyled.js +3 -0
  36. package/esm/cssVars/prepareCssVars.js +6 -2
  37. package/index.js +1 -1
  38. package/legacy/Stack/Stack.js +2 -1
  39. package/legacy/Unstable_Grid/createGrid.js +19 -11
  40. package/legacy/Unstable_Grid/gridGenerator.js +12 -12
  41. package/legacy/createStyled.js +3 -0
  42. package/legacy/cssVars/prepareCssVars.js +6 -2
  43. package/legacy/index.js +1 -1
  44. package/modern/Stack/Stack.js +2 -1
  45. package/modern/Unstable_Grid/createGrid.js +18 -12
  46. package/modern/Unstable_Grid/gridGenerator.js +12 -12
  47. package/modern/createStyled.js +3 -0
  48. package/modern/cssVars/prepareCssVars.js +6 -2
  49. package/modern/index.js +1 -1
  50. package/package.json +1 -1
@@ -13,26 +13,26 @@ function appendLevel(level) {
13
13
  return `Level${level}`;
14
14
  }
15
15
  function isNestedContainer(ownerState) {
16
- return ownerState.level > 0 && ownerState.container;
16
+ return ownerState.unstable_level > 0 && ownerState.container;
17
17
  }
18
18
  function createGetSelfSpacing(ownerState) {
19
19
  return function getSelfSpacing(axis) {
20
- return `var(--Grid-${axis}Spacing${appendLevel(ownerState.level)})`;
20
+ return `var(--Grid-${axis}Spacing${appendLevel(ownerState.unstable_level)})`;
21
21
  };
22
22
  }
23
23
  function createGetParentSpacing(ownerState) {
24
24
  return function getParentSpacing(axis) {
25
- if (ownerState.level === 0) {
25
+ if (ownerState.unstable_level === 0) {
26
26
  return `var(--Grid-${axis}Spacing)`;
27
27
  }
28
- return `var(--Grid-${axis}Spacing${appendLevel(ownerState.level - 1)})`;
28
+ return `var(--Grid-${axis}Spacing${appendLevel(ownerState.unstable_level - 1)})`;
29
29
  };
30
30
  }
31
31
  function getParentColumns(ownerState) {
32
- if (ownerState.level === 0) {
32
+ if (ownerState.unstable_level === 0) {
33
33
  return `var(--Grid-columns)`;
34
34
  }
35
- return `var(--Grid-columns${appendLevel(ownerState.level - 1)})`;
35
+ return `var(--Grid-columns${appendLevel(ownerState.unstable_level - 1)})`;
36
36
  }
37
37
  const filterBreakpointKeys = (breakpointsKeys, responsiveKeys) => breakpointsKeys.filter(key => responsiveKeys.includes(key));
38
38
  exports.filterBreakpointKeys = filterBreakpointKeys;
@@ -144,13 +144,13 @@ const generateGridColumnsStyles = ({
144
144
  return {};
145
145
  }
146
146
  const styles = isNestedContainer(ownerState) ? {
147
- [`--Grid-columns${appendLevel(ownerState.level)}`]: getParentColumns(ownerState)
147
+ [`--Grid-columns${appendLevel(ownerState.unstable_level)}`]: getParentColumns(ownerState)
148
148
  } : {
149
149
  '--Grid-columns': 12
150
150
  };
151
151
  traverseBreakpoints(theme.breakpoints, ownerState.columns, (appendStyle, value) => {
152
152
  appendStyle(styles, {
153
- [`--Grid-columns${appendLevel(ownerState.level)}`]: value
153
+ [`--Grid-columns${appendLevel(ownerState.unstable_level)}`]: value
154
154
  });
155
155
  });
156
156
  return styles;
@@ -167,12 +167,12 @@ const generateGridRowSpacingStyles = ({
167
167
  const styles = isNestedContainer(ownerState) ? {
168
168
  // Set the default spacing as its parent spacing.
169
169
  // It will be overridden if spacing props are provided
170
- [`--Grid-rowSpacing${appendLevel(ownerState.level)}`]: getParentSpacing('row')
170
+ [`--Grid-rowSpacing${appendLevel(ownerState.unstable_level)}`]: getParentSpacing('row')
171
171
  } : {};
172
172
  traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, (appendStyle, value) => {
173
173
  var _theme$spacing;
174
174
  appendStyle(styles, {
175
- [`--Grid-rowSpacing${appendLevel(ownerState.level)}`]: typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)
175
+ [`--Grid-rowSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)
176
176
  });
177
177
  });
178
178
  return styles;
@@ -189,12 +189,12 @@ const generateGridColumnSpacingStyles = ({
189
189
  const styles = isNestedContainer(ownerState) ? {
190
190
  // Set the default spacing as its parent spacing.
191
191
  // It will be overridden if spacing props are provided
192
- [`--Grid-columnSpacing${appendLevel(ownerState.level)}`]: getParentSpacing('column')
192
+ [`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: getParentSpacing('column')
193
193
  } : {};
194
194
  traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, (appendStyle, value) => {
195
195
  var _theme$spacing2;
196
196
  appendStyle(styles, {
197
- [`--Grid-columnSpacing${appendLevel(ownerState.level)}`]: typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)
197
+ [`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)
198
198
  });
199
199
  });
200
200
  return styles;
@@ -1,5 +1,5 @@
1
- export { default } from './Grid';
2
- export { default as createGrid } from './createGrid';
3
- export * from './GridProps';
4
- export { default as gridClasses } from './gridClasses';
5
- export * from './gridClasses';
1
+ export { default } from './Grid';
2
+ export { default as createGrid } from './createGrid';
3
+ export * from './GridProps';
4
+ export { default as gridClasses } from './gridClasses';
5
+ export * from './gridClasses';
package/createStyled.js CHANGED
@@ -213,6 +213,9 @@ function createStyled(input = {}) {
213
213
  }
214
214
  Component.displayName = displayName;
215
215
  }
216
+ if (tag.muiName) {
217
+ Component.muiName = tag.muiName;
218
+ }
216
219
  return Component;
217
220
  };
218
221
  if (defaultStyledResolver.withConfig) {
@@ -1,10 +1,10 @@
1
- export type SpacingOptions = number | Spacing | ((abs: number) => number | string) | ((abs: number | string) => number | string) | ReadonlyArray<string | number>;
2
- export type SpacingArgument = number | string;
3
- export interface Spacing {
4
- (): string;
5
- (value: number): string;
6
- (topBottom: SpacingArgument, rightLeft: SpacingArgument): string;
7
- (top: SpacingArgument, rightLeft: SpacingArgument, bottom: SpacingArgument): string;
8
- (top: SpacingArgument, right: SpacingArgument, bottom: SpacingArgument, left: SpacingArgument): string;
9
- }
10
- export default function createSpacing(spacingInput?: SpacingOptions): Spacing;
1
+ export type SpacingOptions = number | Spacing | ((abs: number) => number | string) | ((abs: number | string) => number | string) | ReadonlyArray<string | number>;
2
+ export type SpacingArgument = number | string;
3
+ export interface Spacing {
4
+ (): string;
5
+ (value: number): string;
6
+ (topBottom: SpacingArgument, rightLeft: SpacingArgument): string;
7
+ (top: SpacingArgument, rightLeft: SpacingArgument, bottom: SpacingArgument): string;
8
+ (top: SpacingArgument, right: SpacingArgument, bottom: SpacingArgument, left: SpacingArgument): string;
9
+ }
10
+ export default function createSpacing(spacingInput?: SpacingOptions): Spacing;
@@ -1,13 +1,15 @@
1
- import { DefaultCssVarsTheme } from './prepareCssVars';
2
- interface Theme extends DefaultCssVarsTheme {
3
- cssVarPrefix?: string;
4
- shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
5
- }
6
- declare function createCssVarsTheme<T extends Theme, ThemeVars extends Record<string, any>>(theme: T): T & {
7
- vars: ThemeVars;
8
- generateCssVars: (colorScheme?: string | undefined) => {
9
- css: Record<string, string | number>;
10
- vars: ThemeVars;
11
- };
12
- };
13
- export default createCssVarsTheme;
1
+ import { DefaultCssVarsTheme } from './prepareCssVars';
2
+ interface Theme extends DefaultCssVarsTheme {
3
+ cssVarPrefix?: string;
4
+ shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
5
+ }
6
+ declare function createCssVarsTheme<T extends Theme, ThemeVars extends Record<string, any>>(theme: T): T & {
7
+ vars: ThemeVars;
8
+ generateCssVars: (colorScheme?: string | undefined) => {
9
+ css: {
10
+ [x: string]: string | number;
11
+ };
12
+ vars: ThemeVars;
13
+ };
14
+ };
15
+ export default createCssVarsTheme;
@@ -1,5 +1,5 @@
1
- /**
2
- * The benefit of this function is to help developers get CSS var from theme without specifying the whole variable
3
- * and they does not need to remember the prefix (defined once).
4
- */
5
- export default function createGetCssVar<T extends string = string>(prefix?: string): <AdditionalVars extends string = never>(field: T | AdditionalVars, ...fallbacks: (T | AdditionalVars)[]) => string;
1
+ /**
2
+ * The benefit of this function is to help developers get CSS var from theme without specifying the whole variable
3
+ * and they does not need to remember the prefix (defined once).
4
+ */
5
+ export default function createGetCssVar<T extends string = string>(prefix?: string): <AdditionalVars extends string = never>(field: T | AdditionalVars, ...fallbacks: (T | AdditionalVars)[]) => string;
@@ -1,64 +1,64 @@
1
- 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 }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
45
- *
46
- * @example
47
- * const { css, vars } = 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
- */
56
- export default function cssVarsParser<T extends Record<string, any>>(theme: Record<string, any>, options?: {
57
- prefix?: string;
58
- shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
59
- }): {
60
- css: Record<string, string | number>;
61
- vars: T;
62
- varsWithDefaults: {};
63
- };
64
- export {};
1
+ 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 }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
45
+ *
46
+ * @example
47
+ * const { css, vars } = 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
+ */
56
+ export default function cssVarsParser<T extends Record<string, any>>(theme: Record<string, any>, options?: {
57
+ prefix?: string;
58
+ shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
59
+ }): {
60
+ css: Record<string, string | number>;
61
+ vars: T;
62
+ varsWithDefaults: {};
63
+ };
64
+ export {};
@@ -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,5 +1,5 @@
1
- export { default } from './createCssVarsProvider';
2
- export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
3
- export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
4
- export { default as prepareCssVars } from './prepareCssVars';
5
- export { default as createCssVarsTheme } from './createCssVarsTheme';
1
+ export { default } from './createCssVarsProvider';
2
+ export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
3
+ export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
4
+ export { default as prepareCssVars } from './prepareCssVars';
5
+ export { default as createCssVarsTheme } from './createCssVarsTheme';
@@ -1,14 +1,16 @@
1
- export interface DefaultCssVarsTheme {
2
- colorSchemes: Record<string, any>;
3
- }
4
- declare function prepareCssVars<T extends DefaultCssVarsTheme, ThemeVars extends Record<string, any>>(theme: T, parserConfig?: {
5
- prefix?: string;
6
- shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
7
- }): {
8
- vars: ThemeVars;
9
- generateCssVars: (colorScheme?: string) => {
10
- css: Record<string, string | number>;
11
- vars: ThemeVars;
12
- };
13
- };
14
- export default prepareCssVars;
1
+ export interface DefaultCssVarsTheme {
2
+ colorSchemes: Record<string, any>;
3
+ }
4
+ declare function prepareCssVars<T extends DefaultCssVarsTheme, ThemeVars extends Record<string, any>>(theme: T, parserConfig?: {
5
+ prefix?: string;
6
+ shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
7
+ }): {
8
+ vars: ThemeVars;
9
+ generateCssVars: (colorScheme?: string) => {
10
+ css: {
11
+ [x: string]: string | number;
12
+ };
13
+ vars: ThemeVars;
14
+ };
15
+ };
16
+ export default prepareCssVars;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
9
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
9
10
  var _utils = require("@mui/utils");
10
11
  var _cssVarsParser = _interopRequireDefault(require("./cssVarsParser"));
@@ -55,11 +56,14 @@ function prepareCssVars(theme, parserConfig) {
55
56
  const generateCssVars = colorScheme => {
56
57
  if (!colorScheme) {
57
58
  return {
58
- css: rootCss,
59
+ css: (0, _extends2.default)({}, rootCss),
59
60
  vars: rootVars
60
61
  };
61
62
  }
62
- return colorSchemesMap[colorScheme];
63
+ return {
64
+ css: (0, _extends2.default)({}, colorSchemesMap[colorScheme].css),
65
+ vars: colorSchemesMap[colorScheme].vars
66
+ };
63
67
  };
64
68
  return {
65
69
  vars: themeVars,
@@ -1,53 +1,53 @@
1
- export type Mode = 'light' | 'dark' | 'system';
2
- export 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 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 type Mode = 'light' | 'dark' | 'system';
2
+ export 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 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 {};
@@ -4,6 +4,7 @@ import createStack from './createStack';
4
4
  *
5
5
  * Demos:
6
6
  *
7
+ * - [Stack (Joy UI)](https://mui.com/joy/react-stack/)
7
8
  * - [Stack (Material UI)](https://mui.com/material-ui/react-stack/)
8
9
  * - [Stack (MUI System)](https://mui.com/system/react-stack/)
9
10
  *
@@ -48,7 +49,7 @@ process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ =
48
49
  /**
49
50
  * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
50
51
  *
51
- * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
52
+ * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
52
53
  * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
53
54
  *
54
55
  * To enable this flag globally, follow the theme's default props configuration.