@mui/system 5.8.2 โ†’ 5.8.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.
package/Box/Box.spec.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/CHANGELOG.md CHANGED
@@ -1,5 +1,77 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 5.8.3
4
+
5
+ <!-- generated comparing v5.8.2..master -->
6
+
7
+ _Jun 7, 2022_
8
+
9
+ A big thanks to the 15 contributors who made this release possible.
10
+ This release is mostly about ๐Ÿ› bug fixes and ๐Ÿ“š documentation improvements.
11
+
12
+ ## `@mui/material@5.8.3`
13
+
14
+ - [Alert] Constrain message width and allow overflow (#32747) @Janpot
15
+ - [Checkbox] Add support for CSS variables (#32579) @haneenmahd
16
+ - [Slider] Fix positioning of tooltips on vertical slider (#32919) @abhinav-22-tech
17
+
18
+ ## `@mui/system@5.8.3`
19
+
20
+ - [system] Configurable attributes for libraries (#32971) @siriwatknp
21
+
22
+ ## `@mui/codemod@5.8.3
23
+
24
+ - [codemod] Fix infinite loop in jss-to-tss-react and add TODO (#33048) @ryancogswell
25
+
26
+ ## `@mui/lab@5.0.0-alpha.85`
27
+
28
+ - [pickers] Add deprecations when importing pickers from the lab (#32950) @flaviendelangle
29
+
30
+ ## `@mui/joy@5.0.0-alpha.31`
31
+
32
+ - [Joy] Add `Slider` component and demos (#32694) @hbjORbj
33
+ - [Joy] Add articles about customization approaches (#32887) @siriwatknp
34
+ - [Joy] Add automatic adjustment page to core features (#32980) @siriwatknp
35
+ - [Joy] Add docs about dark mode (#33002) @siriwatknp
36
+ - [Joy] Add template UIs & first look blog post (#32791) @danilo-leal
37
+
38
+ ## `@mui/base@5.0.0-alpha.84`
39
+
40
+ - [base] Remove @mui/system in tests (#32945) @kevinji
41
+ - [ButtonUnstyled] Accept callbacks in componentsProps (#32991) @michaldudak
42
+ - [SwitchUnstyled] Accept callbacks in componentsProps (#32993) @michaldudak
43
+ - [TablePaginationUnstyled] Define ownerState and slot props' types (#32905) @michaldudak
44
+ - [TabPanelUnstyled] Define ownerState and slot props' types (#32928) @michaldudak
45
+ - [TabsListUnstyled] Define ownerState and slot props' types (#32925) @michaldudak
46
+
47
+ ## Docs
48
+
49
+ - [blog] Fix anchor link scroll (#32994) @oliviertassinari
50
+ - [docs] Add "Migration" section to sidebar and revise v4-v5 content (#32740) @samuelsycamore
51
+ - [docs] Add What doesn't count as a breaking change? (#32850) @oliviertassinari
52
+ - [docs] Fix 301 link @oliviertassinari
53
+ - [docs] Fix icon color in `BadgeUnstyled` docs (#32976) @ZeeshanTamboli
54
+ - [docs] Improve product identifier (#32707) @danilo-leal
55
+ - [docs] Improve UX with back to top (#32896) @oliviertassinari
56
+ - [docs] Polish overview page to Material UI (#32954) @oliviertassinari
57
+ - [docs] Redirect older URLs (#33037) @oliviertassinari
58
+ - [docs] Remove pickers page from the Lab section (#32961) @DanailH
59
+ - [docs] Show product identifier on updated MUI X Introduction pages (#32966) @samuelsycamore
60
+ - [docs] Throw on 301 links (#32939) @oliviertassinari
61
+ - [website] Add Gerda to the about page (#33038) @danilo-leal
62
+ - [website] Polish the pricing page (#32811) @oliviertassinari
63
+ - [website] Remove unnecessary `address` dependency (#32957) @michaldudak
64
+
65
+ ## Core
66
+
67
+ - [core] Improve icon synonyms (#32742) @oliviertassinari
68
+ - [core] Prepare Next.js config for React 18 (#32963) @michaldudak
69
+ - [core] Remove dead logic (#32940) @oliviertassinari
70
+ - [core] Update dependencies to fix security vulnerabilities (#32947) @michaldudak
71
+ - Add security link to README for Tidelift @mbrookes
72
+
73
+ All contributors of this release in alphabetical order: @abhinav-22-tech, @DanailH, @danilo-leal, @flaviendelangle, @haneenmahd, @hbjORbj, @Janpot, @kevinji, @mbrookes, @michaldudak, @oliviertassinari, @ryancogswell, @samuelsycamore, @siriwatknp, @ZeeshanTamboli
74
+
3
75
  ## 5.8.2
4
76
 
5
77
  <!-- generated comparing v5.8.1..master -->
@@ -2598,7 +2670,7 @@ _Sep 1, 2021_
2598
2670
  A big thanks to the 18 contributors who made this release possible. Here are some highlights โœจ:
2599
2671
 
2600
2672
  - ๐ŸŽ‰ Renamed packages to `@mui/*` as part of rebranding the company, following the strategy of expanding the library scope beyond Material Design. For more details about it, check the [GitHub discussion](https://github.com/mui/material-ui/discussions/27803).
2601
- - ๐Ÿ›  Added `mui-replace` codemod for migrating `@material-ui/*` to new packages `@mui/*`. Check out this [codemod detail](https://github.com/mui/material-ui/blob/next/packages/mui-codemod/README.md#mui-replace) or head to [migration guide](https://mui.com/material-ui/guides/migration-v4/#preset-safe)
2673
+ - ๐Ÿ›  Added `mui-replace` codemod for migrating `@material-ui/*` to new packages `@mui/*`. Check out this [codemod detail](https://github.com/mui/material-ui/blob/next/packages/mui-codemod/README.md#mui-replace) or head to [migration guide](https://mui.com/material-ui/migration/migration-v4/#preset-safe)
2602
2674
  - ๐Ÿงช Added new `<Mansory>` component to the lab, [check it out](https://mui.com/components/masonry/). It has been crafted by our first intern, @hbjORbj ๐Ÿ‘!
2603
2675
 
2604
2676
  ### `@mui/material@5.0.0-rc.0`
@@ -4003,7 +4075,7 @@ A big thanks to the 16 contributors who made this release possible. Here are som
4003
4075
  />
4004
4076
  ```
4005
4077
 
4006
- > Follow [this link](https://mui.com/material-ui/guides/migration-v4/#main-content) for full migration from v4 => v5
4078
+ > Follow [this link](https://mui.com/material-ui/migration/migration-v4/) for full migration from v4 => v5
4007
4079
 
4008
4080
  #### Changes
4009
4081
 
@@ -1,13 +1,13 @@
1
- /**
2
- *
3
- * Demos:
4
- *
5
- * - [Container (Material UI)](https://mui.com/material-ui/react-container/)
6
- * - [Container (MUI System)](https://mui.com/system/react-container/)
7
- *
8
- * API:
9
- *
10
- * - [Container API](https://mui.com/system/api/container/)
11
- */
12
- declare const Container: import("@mui/types").OverridableComponent<import("./ContainerProps").ContainerTypeMap<{}, "div">>;
13
- export default Container;
1
+ /**
2
+ *
3
+ * Demos:
4
+ *
5
+ * - [Container (Material UI)](https://mui.com/material-ui/react-container/)
6
+ * - [Container (MUI System)](https://mui.com/system/react-container/)
7
+ *
8
+ * API:
9
+ *
10
+ * - [Container API](https://mui.com/system/api/container/)
11
+ */
12
+ declare const Container: import("@mui/types").OverridableComponent<import("./ContainerProps").ContainerTypeMap<{}, "div">>;
13
+ export default Container;
@@ -1,40 +1,40 @@
1
- import * as React from 'react';
2
- import { OverrideProps } from '@mui/types';
3
- import { SxProps } from '../styleFunctionSx';
4
- import { Theme, Breakpoint } from '../createTheme';
5
- import { ContainerClasses } from './containerClasses';
6
- export interface ContainerTypeMap<P = {}, D extends React.ElementType = 'div'> {
7
- props: P & {
8
- children?: React.ReactNode;
9
- /**
10
- * Override or extend the styles applied to the component.
11
- */
12
- classes?: Partial<ContainerClasses>;
13
- /**
14
- * If `true`, the left and right padding is removed.
15
- * @default false
16
- */
17
- disableGutters?: boolean;
18
- /**
19
- * Set the max-width to match the min-width of the current breakpoint.
20
- * This is useful if you'd prefer to design for a fixed set of sizes
21
- * instead of trying to accommodate a fully fluid viewport.
22
- * It's fluid by default.
23
- * @default false
24
- */
25
- fixed?: boolean;
26
- /**
27
- * Determine the max-width of the container.
28
- * The container width grows with the size of the screen.
29
- * Set to `false` to disable `maxWidth`.
30
- * @default 'lg'
31
- */
32
- maxWidth?: Breakpoint | false;
33
- /**
34
- * The system prop that allows defining system overrides as well as additional CSS styles.
35
- */
36
- sx?: SxProps<Theme>;
37
- };
38
- defaultComponent: D;
39
- }
40
- export declare type ContainerProps<D extends React.ElementType = ContainerTypeMap['defaultComponent'], P = {}> = OverrideProps<ContainerTypeMap<P, D>, D>;
1
+ import * as React from 'react';
2
+ import { OverrideProps } from '@mui/types';
3
+ import { SxProps } from '../styleFunctionSx';
4
+ import { Theme, Breakpoint } from '../createTheme';
5
+ import { ContainerClasses } from './containerClasses';
6
+ export interface ContainerTypeMap<P = {}, D extends React.ElementType = 'div'> {
7
+ props: P & {
8
+ children?: React.ReactNode;
9
+ /**
10
+ * Override or extend the styles applied to the component.
11
+ */
12
+ classes?: Partial<ContainerClasses>;
13
+ /**
14
+ * If `true`, the left and right padding is removed.
15
+ * @default false
16
+ */
17
+ disableGutters?: boolean;
18
+ /**
19
+ * Set the max-width to match the min-width of the current breakpoint.
20
+ * This is useful if you'd prefer to design for a fixed set of sizes
21
+ * instead of trying to accommodate a fully fluid viewport.
22
+ * It's fluid by default.
23
+ * @default false
24
+ */
25
+ fixed?: boolean;
26
+ /**
27
+ * Determine the max-width of the container.
28
+ * The container width grows with the size of the screen.
29
+ * Set to `false` to disable `maxWidth`.
30
+ * @default 'lg'
31
+ */
32
+ maxWidth?: Breakpoint | false;
33
+ /**
34
+ * The system prop that allows defining system overrides as well as additional CSS styles.
35
+ */
36
+ sx?: SxProps<Theme>;
37
+ };
38
+ defaultComponent: D;
39
+ }
40
+ export declare type ContainerProps<D extends React.ElementType = ContainerTypeMap['defaultComponent'], P = {}> = OverrideProps<ContainerTypeMap<P, D>, D>;
@@ -1,22 +1,22 @@
1
- export interface ContainerClasses {
2
- /** Styles applied to the root element. */
3
- root: string;
4
- /** Styles applied to the root element if `disableGutters={true}`. */
5
- disableGutters: string;
6
- /** Styles applied to the root element if `fixed={true}`. */
7
- fixed: string;
8
- /** Styles applied to the root element if `maxWidth="xs"`. */
9
- maxWidthXs: string;
10
- /** Styles applied to the root element if `maxWidth="sm"`. */
11
- maxWidthSm: string;
12
- /** Styles applied to the root element if `maxWidth="md"`. */
13
- maxWidthMd: string;
14
- /** Styles applied to the root element if `maxWidth="lg"`. */
15
- maxWidthLg: string;
16
- /** Styles applied to the root element if `maxWidth="xl"`. */
17
- maxWidthXl: string;
18
- }
19
- export declare type ContainerClassKey = keyof ContainerClasses;
20
- export declare function getContainerUtilityClass(slot: string): string;
21
- declare const containerClasses: ContainerClasses;
22
- export default containerClasses;
1
+ export interface ContainerClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ /** Styles applied to the root element if `disableGutters={true}`. */
5
+ disableGutters: string;
6
+ /** Styles applied to the root element if `fixed={true}`. */
7
+ fixed: string;
8
+ /** Styles applied to the root element if `maxWidth="xs"`. */
9
+ maxWidthXs: string;
10
+ /** Styles applied to the root element if `maxWidth="sm"`. */
11
+ maxWidthSm: string;
12
+ /** Styles applied to the root element if `maxWidth="md"`. */
13
+ maxWidthMd: string;
14
+ /** Styles applied to the root element if `maxWidth="lg"`. */
15
+ maxWidthLg: string;
16
+ /** Styles applied to the root element if `maxWidth="xl"`. */
17
+ maxWidthXl: string;
18
+ }
19
+ export declare type ContainerClassKey = keyof ContainerClasses;
20
+ export declare function getContainerUtilityClass(slot: string): string;
21
+ declare const containerClasses: ContainerClasses;
22
+ export default containerClasses;
@@ -1,18 +1,18 @@
1
- import * as React from 'react';
2
- import { Interpolation, StyledComponent } from '@mui/styled-engine';
3
- import { OverridableComponent } from '@mui/types';
4
- import { ContainerProps, ContainerTypeMap } from './ContainerProps';
5
- import { Theme as DefaultTheme } from '../createTheme';
6
- interface StyleFnProps<Theme> extends ContainerProps {
7
- theme: Theme;
8
- ownerState: ContainerProps;
9
- }
10
- declare type RequiredThemeStructure = Pick<DefaultTheme, 'breakpoints' | 'spacing'>;
11
- export default function createContainer<Theme extends RequiredThemeStructure = DefaultTheme>(options?: {
12
- createStyledComponent?: (...styles: Array<Interpolation<StyleFnProps<Theme>>>) => StyledComponent<ContainerProps>;
13
- useThemeProps?: (inProps: ContainerProps) => ContainerProps & {
14
- component?: React.ElementType;
15
- };
16
- componentName?: string;
17
- }): OverridableComponent<ContainerTypeMap<{}, "div">>;
18
- export {};
1
+ import * as React from 'react';
2
+ import { Interpolation, StyledComponent } from '@mui/styled-engine';
3
+ import { OverridableComponent } from '@mui/types';
4
+ import { ContainerProps, ContainerTypeMap } from './ContainerProps';
5
+ import { Theme as DefaultTheme } from '../createTheme';
6
+ interface StyleFnProps<Theme> extends ContainerProps {
7
+ theme: Theme;
8
+ ownerState: ContainerProps;
9
+ }
10
+ declare type RequiredThemeStructure = Pick<DefaultTheme, 'breakpoints' | 'spacing'>;
11
+ export default function createContainer<Theme extends RequiredThemeStructure = DefaultTheme>(options?: {
12
+ createStyledComponent?: (...styles: Array<Interpolation<StyleFnProps<Theme>>>) => StyledComponent<ContainerProps>;
13
+ useThemeProps?: (inProps: ContainerProps) => ContainerProps & {
14
+ component?: React.ElementType;
15
+ };
16
+ componentName?: string;
17
+ }): OverridableComponent<ContainerTypeMap<{}, "div">>;
18
+ export {};
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,10 +1,10 @@
1
- export declare type SpacingOptions = number | Spacing | ((abs: number) => number | string) | ((abs: number | string) => number | string) | ReadonlyArray<string | number>;
2
- export declare type SpacingArgument = number | string;
3
- export interface Spacing {
4
- (): string;
5
- (value: number): string;
6
- (topBottom: SpacingArgument, rightLeft: SpacingArgument): string;
7
- (top: SpacingArgument, rightLeft: SpacingArgument, bottom: SpacingArgument): string;
8
- (top: SpacingArgument, right: SpacingArgument, bottom: SpacingArgument, left: SpacingArgument): string;
9
- }
10
- export default function createSpacing(spacingInput?: SpacingOptions): Spacing;
1
+ export declare type SpacingOptions = number | Spacing | ((abs: number) => number | string) | ((abs: number | string) => number | string) | ReadonlyArray<string | number>;
2
+ export declare type SpacingArgument = number | string;
3
+ export interface Spacing {
4
+ (): string;
5
+ (value: number): string;
6
+ (topBottom: SpacingArgument, rightLeft: SpacingArgument): string;
7
+ (top: SpacingArgument, rightLeft: SpacingArgument, bottom: SpacingArgument): string;
8
+ (top: SpacingArgument, right: SpacingArgument, bottom: SpacingArgument, left: SpacingArgument): string;
9
+ }
10
+ export default function createSpacing(spacingInput?: SpacingOptions): Spacing;
@@ -8,6 +8,21 @@ export interface ColorSchemeContextValue<SupportedColorScheme extends string>
8
8
  }
9
9
 
10
10
  export interface CssVarsProviderConfig<ColorScheme extends string> {
11
+ /**
12
+ * DOM attribute for applying color scheme
13
+ * @default 'data-color-scheme'
14
+ */
15
+ attribute?: string;
16
+ /**
17
+ * localStorage key used to store application `mode`
18
+ * @default 'mode'
19
+ */
20
+ modeStorageKey?: string;
21
+ /**
22
+ * localStorage key used to store `colorScheme`
23
+ * @default 'color-scheme'
24
+ */
25
+ colorSchemeStorageKey?: string;
11
26
  /**
12
27
  * Design system default color scheme.
13
28
  * - provides string if the design system has one default color scheme (either light or dark)
@@ -41,16 +56,6 @@ export interface CreateCssVarsProviderResult<ColorScheme extends string, ThemeIn
41
56
  props: React.PropsWithChildren<
42
57
  Partial<CssVarsProviderConfig<ColorScheme>> & {
43
58
  theme?: ThemeInput;
44
- /**
45
- * localStorage key used to store application `mode`
46
- * @default 'mui-mode'
47
- */
48
- modeStorageKey?: string;
49
- /**
50
- * DOM attribute for applying color scheme
51
- * @default 'data-mui-color-scheme'
52
- */
53
- attribute?: string;
54
59
  /**
55
60
  * The document used to perform `disableTransitionOnChange` feature
56
61
  * @default document
@@ -66,11 +71,6 @@ export interface CreateCssVarsProviderResult<ColorScheme extends string, ThemeIn
66
71
  * @default ':root'
67
72
  */
68
73
  colorSchemeSelector?: string;
69
- /**
70
- * localStorage key used to store `colorScheme`
71
- * @default 'mui-color-scheme'
72
- */
73
- colorSchemeStorageKey?: string;
74
74
  /**
75
75
  * The window that attaches the 'storage' event listener
76
76
  * @default window
@@ -44,6 +44,9 @@ exports.DISABLE_CSS_TRANSITION = DISABLE_CSS_TRANSITION;
44
44
  function createCssVarsProvider(options) {
45
45
  const {
46
46
  theme: defaultTheme = {},
47
+ attribute: defaultAttribute = _getInitColorSchemeScript.DEFAULT_ATTRIBUTE,
48
+ modeStorageKey: defaultModeStorageKey = _getInitColorSchemeScript.DEFAULT_MODE_STORAGE_KEY,
49
+ colorSchemeStorageKey: defaultColorSchemeStorageKey = _getInitColorSchemeScript.DEFAULT_COLOR_SCHEME_STORAGE_KEY,
47
50
  defaultMode: desisgnSystemMode = 'light',
48
51
  defaultColorScheme: designSystemColorScheme,
49
52
  disableTransitionOnChange: designSystemTransitionOnChange = false,
@@ -73,9 +76,9 @@ function createCssVarsProvider(options) {
73
76
  children,
74
77
  theme: themeProp = defaultTheme,
75
78
  prefix = designSystemPrefix,
76
- modeStorageKey = _getInitColorSchemeScript.DEFAULT_MODE_STORAGE_KEY,
77
- colorSchemeStorageKey = _getInitColorSchemeScript.DEFAULT_COLOR_SCHEME_STORAGE_KEY,
78
- attribute = _getInitColorSchemeScript.DEFAULT_ATTRIBUTE,
79
+ modeStorageKey = defaultModeStorageKey,
80
+ colorSchemeStorageKey = defaultColorSchemeStorageKey,
81
+ attribute = defaultAttribute,
79
82
  defaultMode = desisgnSystemMode,
80
83
  defaultColorScheme = designSystemColorScheme,
81
84
  disableTransitionOnChange = designSystemTransitionOnChange,
@@ -332,9 +335,16 @@ function createCssVarsProvider(options) {
332
335
  */
333
336
  theme: _propTypes.default.object
334
337
  } : void 0;
338
+
339
+ const getInitColorSchemeScript = params => (0, _getInitColorSchemeScript.default)((0, _extends2.default)({
340
+ attribute: defaultAttribute,
341
+ colorSchemeStorageKey: defaultColorSchemeStorageKey,
342
+ modeStorageKey: defaultModeStorageKey
343
+ }, params));
344
+
335
345
  return {
336
346
  CssVarsProvider,
337
347
  useColorScheme,
338
- getInitColorSchemeScript: _getInitColorSchemeScript.default
348
+ getInitColorSchemeScript
339
349
  };
340
350
  }
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -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, ...vars: (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, ...vars: (T | AdditionalVars)[]) => string;
@@ -1,70 +1,70 @@
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: <Object_1 = NestedRecord<any>, Value = any>(obj: Object_1, 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
- * basePrefix?: string,
41
- * shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
42
- * }} options.
43
- * `basePrefix`: defined by design system.
44
- * `prefix`: defined by application
45
- *
46
- * the CSS variable value will be adjusted based on the provided `basePrefix` & `prefix` which can be found in `parsedTheme`.
47
- *
48
- * @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.
49
- *
50
- * @example
51
- * const { css, vars, parsedTheme } = parser({
52
- * fontSize: 12,
53
- * lineHeight: 1.2,
54
- * palette: { primary: { 500: 'var(--color)' } }
55
- * }, { prefix: 'foo' })
56
- *
57
- * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--foo-color)' }
58
- * console.log(vars) // { fontSize: '--foo-fontSize', lineHeight: '--foo-lineHeight', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
59
- * console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--foo-color)' } } }
60
- */
61
- export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
62
- prefix?: string;
63
- basePrefix?: string;
64
- shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
65
- }): {
66
- css: NestedRecord<string>;
67
- vars: NestedRecord<string>;
68
- parsedTheme: T;
69
- };
70
- 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: <Object_1 = NestedRecord<any>, Value = any>(obj: Object_1, 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
+ * basePrefix?: string,
41
+ * shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
42
+ * }} options.
43
+ * `basePrefix`: defined by design system.
44
+ * `prefix`: defined by application
45
+ *
46
+ * the CSS variable value will be adjusted based on the provided `basePrefix` & `prefix` which can be found in `parsedTheme`.
47
+ *
48
+ * @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.
49
+ *
50
+ * @example
51
+ * const { css, vars, parsedTheme } = parser({
52
+ * fontSize: 12,
53
+ * lineHeight: 1.2,
54
+ * palette: { primary: { 500: 'var(--color)' } }
55
+ * }, { prefix: 'foo' })
56
+ *
57
+ * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--foo-color)' }
58
+ * console.log(vars) // { fontSize: '--foo-fontSize', lineHeight: '--foo-lineHeight', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
59
+ * console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--foo-color)' } } }
60
+ */
61
+ export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
62
+ prefix?: string;
63
+ basePrefix?: string;
64
+ shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
65
+ }): {
66
+ css: NestedRecord<string>;
67
+ vars: NestedRecord<string>;
68
+ parsedTheme: T;
69
+ };
70
+ export {};
@@ -1,40 +1,40 @@
1
- /// <reference types="react" />
2
- export declare const DEFAULT_MODE_STORAGE_KEY = "mui-mode";
3
- export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "mui-color-scheme";
4
- export declare const DEFAULT_ATTRIBUTE = "data-mui-color-scheme";
5
- export interface GetInitColorSchemeScriptOptions {
6
- /**
7
- * If `true`, the initial color scheme is set to the user's prefers-color-scheme mode
8
- * @default false
9
- */
10
- enableSystem?: boolean;
11
- /**
12
- * The default color scheme to be used on the light mode
13
- */
14
- defaultLightColorScheme?: string;
15
- /**
16
- * The default color scheme to be used on the dark mode
17
- */
18
- defaultDarkColorScheme?: string;
19
- /**
20
- * The node (provided as string) used to attach the color-scheme attribute
21
- * @default 'document.documentElement'
22
- */
23
- colorSchemeNode?: string;
24
- /**
25
- * localStorage key used to store `mode`
26
- * @default 'mui-mode'
27
- */
28
- modeStorageKey?: string;
29
- /**
30
- * localStorage key used to store `colorScheme`
31
- * @default 'mui-color-scheme'
32
- */
33
- colorSchemeStorageKey?: string;
34
- /**
35
- * DOM attribute for applying color scheme
36
- * @default 'data-mui-color-scheme'
37
- */
38
- attribute?: string;
39
- }
40
- 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
+ * If `true`, the initial color scheme is set to the user's prefers-color-scheme mode
8
+ * @default false
9
+ */
10
+ enableSystem?: boolean;
11
+ /**
12
+ * The default color scheme to be used on the light mode
13
+ */
14
+ defaultLightColorScheme?: string;
15
+ /**
16
+ * The default color scheme to be used on the dark mode
17
+ */
18
+ defaultDarkColorScheme?: string;
19
+ /**
20
+ * The node (provided as string) used to attach the color-scheme attribute
21
+ * @default 'document.documentElement'
22
+ */
23
+ colorSchemeNode?: string;
24
+ /**
25
+ * localStorage key used to store `mode`
26
+ * @default 'mode'
27
+ */
28
+ modeStorageKey?: string;
29
+ /**
30
+ * localStorage key used to store `colorScheme`
31
+ * @default 'color-scheme'
32
+ */
33
+ colorSchemeStorageKey?: string;
34
+ /**
35
+ * DOM attribute for applying color scheme
36
+ * @default 'data-color-scheme'
37
+ */
38
+ attribute?: string;
39
+ }
40
+ export default function getInitColorSchemeScript(options?: GetInitColorSchemeScriptOptions): JSX.Element;
@@ -14,11 +14,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
14
14
 
15
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
16
 
17
- const DEFAULT_MODE_STORAGE_KEY = 'mui-mode';
17
+ const DEFAULT_MODE_STORAGE_KEY = 'mode';
18
18
  exports.DEFAULT_MODE_STORAGE_KEY = DEFAULT_MODE_STORAGE_KEY;
19
- const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'mui-color-scheme';
19
+ const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'color-scheme';
20
20
  exports.DEFAULT_COLOR_SCHEME_STORAGE_KEY = DEFAULT_COLOR_SCHEME_STORAGE_KEY;
21
- const DEFAULT_ATTRIBUTE = 'data-mui-color-scheme';
21
+ const DEFAULT_ATTRIBUTE = 'data-color-scheme';
22
22
  exports.DEFAULT_ATTRIBUTE = DEFAULT_ATTRIBUTE;
23
23
 
24
24
  function getInitColorSchemeScript(options) {
@@ -1,2 +1,2 @@
1
- export { default } from './createCssVarsProvider';
2
- export type { CreateCssVarsProviderResult } from './createCssVarsProvider';
1
+ export { default } from './createCssVarsProvider';
2
+ export type { CreateCssVarsProviderResult } from './createCssVarsProvider';
@@ -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 {};
@@ -8,7 +8,7 @@ import { deepmerge, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui
8
8
  import { GlobalStyles } from '@mui/styled-engine';
9
9
  import cssVarsParser from './cssVarsParser';
10
10
  import ThemeProvider from '../ThemeProvider';
11
- import getInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
11
+ import systemGetInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
12
12
  import useCurrentColorScheme from './useCurrentColorScheme';
13
13
  import createGetCssVar from './createGetCssVar';
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -17,6 +17,9 @@ export const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-
17
17
  export default function createCssVarsProvider(options) {
18
18
  const {
19
19
  theme: defaultTheme = {},
20
+ attribute: defaultAttribute = DEFAULT_ATTRIBUTE,
21
+ modeStorageKey: defaultModeStorageKey = DEFAULT_MODE_STORAGE_KEY,
22
+ colorSchemeStorageKey: defaultColorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
20
23
  defaultMode: desisgnSystemMode = 'light',
21
24
  defaultColorScheme: designSystemColorScheme,
22
25
  disableTransitionOnChange: designSystemTransitionOnChange = false,
@@ -46,9 +49,9 @@ export default function createCssVarsProvider(options) {
46
49
  children,
47
50
  theme: themeProp = defaultTheme,
48
51
  prefix = designSystemPrefix,
49
- modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
50
- colorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
51
- attribute = DEFAULT_ATTRIBUTE,
52
+ modeStorageKey = defaultModeStorageKey,
53
+ colorSchemeStorageKey = defaultColorSchemeStorageKey,
54
+ attribute = defaultAttribute,
52
55
  defaultMode = desisgnSystemMode,
53
56
  defaultColorScheme = designSystemColorScheme,
54
57
  disableTransitionOnChange = designSystemTransitionOnChange,
@@ -307,6 +310,13 @@ export default function createCssVarsProvider(options) {
307
310
  */
308
311
  theme: PropTypes.object
309
312
  } : void 0;
313
+
314
+ const getInitColorSchemeScript = params => systemGetInitColorSchemeScript(_extends({
315
+ attribute: defaultAttribute,
316
+ colorSchemeStorageKey: defaultColorSchemeStorageKey,
317
+ modeStorageKey: defaultModeStorageKey
318
+ }, params));
319
+
310
320
  return {
311
321
  CssVarsProvider,
312
322
  useColorScheme,
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export const DEFAULT_MODE_STORAGE_KEY = 'mui-mode';
4
- export const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'mui-color-scheme';
5
- export const DEFAULT_ATTRIBUTE = 'data-mui-color-scheme';
3
+ export const DEFAULT_MODE_STORAGE_KEY = 'mode';
4
+ export const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'color-scheme';
5
+ export const DEFAULT_ATTRIBUTE = 'data-color-scheme';
6
6
  export default function getInitColorSchemeScript(options) {
7
7
  const {
8
8
  enableSystem = false,
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.8.2
1
+ /** @license MUI v5.8.3
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 {};
@@ -10,7 +10,7 @@ import { deepmerge, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui
10
10
  import { GlobalStyles } from '@mui/styled-engine';
11
11
  import cssVarsParser from './cssVarsParser';
12
12
  import ThemeProvider from '../ThemeProvider';
13
- import getInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
13
+ import systemGetInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
14
14
  import useCurrentColorScheme from './useCurrentColorScheme';
15
15
  import createGetCssVar from './createGetCssVar';
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -19,6 +19,12 @@ export var DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-tr
19
19
  export default function createCssVarsProvider(options) {
20
20
  var _options$theme = options.theme,
21
21
  defaultTheme = _options$theme === void 0 ? {} : _options$theme,
22
+ _options$attribute = options.attribute,
23
+ defaultAttribute = _options$attribute === void 0 ? DEFAULT_ATTRIBUTE : _options$attribute,
24
+ _options$modeStorageK = options.modeStorageKey,
25
+ defaultModeStorageKey = _options$modeStorageK === void 0 ? DEFAULT_MODE_STORAGE_KEY : _options$modeStorageK,
26
+ _options$colorSchemeS = options.colorSchemeStorageKey,
27
+ defaultColorSchemeStorageKey = _options$colorSchemeS === void 0 ? DEFAULT_COLOR_SCHEME_STORAGE_KEY : _options$colorSchemeS,
22
28
  _options$defaultMode = options.defaultMode,
23
29
  desisgnSystemMode = _options$defaultMode === void 0 ? 'light' : _options$defaultMode,
24
30
  designSystemColorScheme = options.defaultColorScheme,
@@ -54,11 +60,11 @@ export default function createCssVarsProvider(options) {
54
60
  _ref$prefix = _ref.prefix,
55
61
  prefix = _ref$prefix === void 0 ? designSystemPrefix : _ref$prefix,
56
62
  _ref$modeStorageKey = _ref.modeStorageKey,
57
- modeStorageKey = _ref$modeStorageKey === void 0 ? DEFAULT_MODE_STORAGE_KEY : _ref$modeStorageKey,
63
+ modeStorageKey = _ref$modeStorageKey === void 0 ? defaultModeStorageKey : _ref$modeStorageKey,
58
64
  _ref$colorSchemeStora = _ref.colorSchemeStorageKey,
59
- colorSchemeStorageKey = _ref$colorSchemeStora === void 0 ? DEFAULT_COLOR_SCHEME_STORAGE_KEY : _ref$colorSchemeStora,
65
+ colorSchemeStorageKey = _ref$colorSchemeStora === void 0 ? defaultColorSchemeStorageKey : _ref$colorSchemeStora,
60
66
  _ref$attribute = _ref.attribute,
61
- attribute = _ref$attribute === void 0 ? DEFAULT_ATTRIBUTE : _ref$attribute,
67
+ attribute = _ref$attribute === void 0 ? defaultAttribute : _ref$attribute,
62
68
  _ref$defaultMode = _ref.defaultMode,
63
69
  defaultMode = _ref$defaultMode === void 0 ? desisgnSystemMode : _ref$defaultMode,
64
70
  _ref$defaultColorSche = _ref.defaultColorScheme,
@@ -331,6 +337,15 @@ export default function createCssVarsProvider(options) {
331
337
  */
332
338
  theme: PropTypes.object
333
339
  } : void 0;
340
+
341
+ var getInitColorSchemeScript = function getInitColorSchemeScript(params) {
342
+ return systemGetInitColorSchemeScript(_extends({
343
+ attribute: defaultAttribute,
344
+ colorSchemeStorageKey: defaultColorSchemeStorageKey,
345
+ modeStorageKey: defaultModeStorageKey
346
+ }, params));
347
+ };
348
+
334
349
  return {
335
350
  CssVarsProvider: CssVarsProvider,
336
351
  useColorScheme: useColorScheme,
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export var DEFAULT_MODE_STORAGE_KEY = 'mui-mode';
4
- export var DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'mui-color-scheme';
5
- export var DEFAULT_ATTRIBUTE = 'data-mui-color-scheme';
3
+ export var DEFAULT_MODE_STORAGE_KEY = 'mode';
4
+ export var DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'color-scheme';
5
+ export var DEFAULT_ATTRIBUTE = 'data-color-scheme';
6
6
  export default function getInitColorSchemeScript(options) {
7
7
  var _ref = options || {},
8
8
  _ref$enableSystem = _ref.enableSystem,
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.8.2
1
+ /** @license MUI v5.8.3
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.
@@ -8,7 +8,7 @@ import { deepmerge, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui
8
8
  import { GlobalStyles } from '@mui/styled-engine';
9
9
  import cssVarsParser from './cssVarsParser';
10
10
  import ThemeProvider from '../ThemeProvider';
11
- import getInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
11
+ import systemGetInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
12
12
  import useCurrentColorScheme from './useCurrentColorScheme';
13
13
  import createGetCssVar from './createGetCssVar';
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -17,6 +17,9 @@ export const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-
17
17
  export default function createCssVarsProvider(options) {
18
18
  const {
19
19
  theme: defaultTheme = {},
20
+ attribute: defaultAttribute = DEFAULT_ATTRIBUTE,
21
+ modeStorageKey: defaultModeStorageKey = DEFAULT_MODE_STORAGE_KEY,
22
+ colorSchemeStorageKey: defaultColorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
20
23
  defaultMode: desisgnSystemMode = 'light',
21
24
  defaultColorScheme: designSystemColorScheme,
22
25
  disableTransitionOnChange: designSystemTransitionOnChange = false,
@@ -46,9 +49,9 @@ export default function createCssVarsProvider(options) {
46
49
  children,
47
50
  theme: themeProp = defaultTheme,
48
51
  prefix = designSystemPrefix,
49
- modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
50
- colorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
51
- attribute = DEFAULT_ATTRIBUTE,
52
+ modeStorageKey = defaultModeStorageKey,
53
+ colorSchemeStorageKey = defaultColorSchemeStorageKey,
54
+ attribute = defaultAttribute,
52
55
  defaultMode = desisgnSystemMode,
53
56
  defaultColorScheme = designSystemColorScheme,
54
57
  disableTransitionOnChange = designSystemTransitionOnChange,
@@ -307,6 +310,13 @@ export default function createCssVarsProvider(options) {
307
310
  */
308
311
  theme: PropTypes.object
309
312
  } : void 0;
313
+
314
+ const getInitColorSchemeScript = params => systemGetInitColorSchemeScript(_extends({
315
+ attribute: defaultAttribute,
316
+ colorSchemeStorageKey: defaultColorSchemeStorageKey,
317
+ modeStorageKey: defaultModeStorageKey
318
+ }, params));
319
+
310
320
  return {
311
321
  CssVarsProvider,
312
322
  useColorScheme,
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export const DEFAULT_MODE_STORAGE_KEY = 'mui-mode';
4
- export const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'mui-color-scheme';
5
- export const DEFAULT_ATTRIBUTE = 'data-mui-color-scheme';
3
+ export const DEFAULT_MODE_STORAGE_KEY = 'mode';
4
+ export const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'color-scheme';
5
+ export const DEFAULT_ATTRIBUTE = 'data-color-scheme';
6
6
  export default function getInitColorSchemeScript(options) {
7
7
  const {
8
8
  enableSystem = false,
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.8.2
1
+ /** @license MUI v5.8.3
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/system",
3
- "version": "5.8.2",
3
+ "version": "5.8.3",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "CSS utilities for rapidly laying out custom designs.",
@@ -1 +1 @@
1
- export {};
1
+ export {};