@mui/system 5.8.0 → 5.8.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.
package/Box/Box.spec.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/CHANGELOG.md CHANGED
@@ -1,5 +1,73 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 5.8.1
4
+
5
+ <!-- generated comparing v5.8.0..master -->
6
+
7
+ _May 23, 2022_
8
+
9
+ A big thanks to the 21 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 💅 Added CSS variables support for two more Material UI components by @diggis00 and @alisasanib
12
+ - And more 🐛 bug fixes and 📚 documentation improvements.
13
+
14
+ ### `@mui/material@5.8.1`
15
+
16
+ - &#8203;<!-- 33 -->[Alert] Fix missing `ownerState` on the `action` slot (#32801) @mnajdova
17
+ - &#8203;<!-- 20 -->[Fab] Make the `color` prop type extendable (#31830) @paales
18
+ - &#8203;<!-- 14 -->[ListItemButton] Render as link if href specified (#32403) @o-dubrovskyi
19
+ - &#8203;<!-- 13 -->[Paper] Add support for CSS variables (#32570) @diggis00
20
+ - &#8203;<!-- 11 -->[Radio] Add support for CSS variables (#32599) @alisasanib
21
+ - &#8203;<!-- 10 -->[Slider] Prevent rendering for marks that are out of the min & max bounds (#32436) @abriginets
22
+ - &#8203;<!-- 09 -->[Slider] Slider having marks should be customizable in theme (#32816) @ZeeshanTamboli
23
+ - &#8203;<!-- 03 -->[TouchRipple] Allows call imperative methods without event (#31955) @alexfauquette
24
+
25
+ ### `@mui/system@5.8.1`
26
+
27
+ - &#8203;<!-- 07 -->[system] Simplify stylesheet injection logic (#32869) @siriwatknp
28
+ - &#8203;<!-- 06 -->[system] Fix color scheme specificity (#32628) @siriwatknp
29
+ - &#8203;<!-- 05 -->[system] Fix `borderRadius` errors when used inside `CssVarsProvider` (#32817) @mnajdova
30
+ - &#8203;<!-- 04 -->[system] Fix toolbar media query mixin getting merged in wrong order (#32713) @ZeeshanTamboli
31
+
32
+ ### `@mui/lab@5.0.0-alpha.83`
33
+
34
+ - &#8203;<!-- 15 -->[lab] Add missing `peerDependencies` (#32623) @nate-summercook
35
+ - &#8203;<!-- 12 -->[pickers] Update @mui/x-date-pickers to be usable with React 18 (#32828) @flaviendelangle
36
+
37
+ ### `@mui/base@5.0.0-alpha.82`
38
+
39
+ - &#8203;<!-- 08 -->[SliderUnstyled] Fix `disabledSwap` not being respected in `onChangeCommitted` (#32647) @JeanPetrov
40
+
41
+ ### `@mui/joy@5.0.0-alpha.29`
42
+
43
+ - &#8203;<!-- 19 -->[Joy] Show Joy pages on master (#32866) @siriwatknp
44
+ - &#8203;<!-- 18 -->[Joy] Add an overview page (#32836) @danilo-leal
45
+ - &#8203;<!-- 17 -->[Joy] Add doc for the card components (#32825) @siriwatknp
46
+ - &#8203;<!-- 16 -->[Joy] Miscellaneous fixes (#32815) @siriwatknp
47
+
48
+ ### Docs
49
+
50
+ - &#8203;<!-- 31 -->[docs] Simplify header DOM structure (#32844) @oliviertassinari
51
+ - &#8203;<!-- 30 -->[docs] Fix CodeSandbox & StackBlitz generation (#32726) @siriwatknp
52
+ - &#8203;<!-- 29 -->[docs] Fix urls to columns pages in pricing table (#32842) @alexfauquette
53
+ - &#8203;<!-- 28 -->[docs] Fix Tailwind CSS integration docs (#32512) @robertwt7
54
+ - &#8203;<!-- 27 -->[docs] Fixed wrong command for the `link-underline-hover` codemod (#32793) @veronikaslc
55
+ - &#8203;<!-- 26 -->[docs] Fixed broken link on the icons page (#32780) @SamuelMaddox
56
+ - &#8203;<!-- 25 -->[docs] Add "back to top" button (#30441) @VibhorJaiswal
57
+ - &#8203;<!-- 24 -->[docs] Fix typo in notifications @mbrookes
58
+ - &#8203;<!-- 32 -->[docs] New WAI-ARIA guidelines location (#32865) @oliviertassinari
59
+ - &#8203;<!-- 23 -->[docs] Mention the ESLint plugin for detecting unused classes in tss-react (#32666) @garronej
60
+ - &#8203;<!-- 22 -->[docs] Update `useAutocomplete` demos to use `Mui-focused` class (#32757) @ZeeshanTamboli
61
+ - &#8203;<!-- 21 -->[examples] Fix `NextLinkComposedProps` gives a TypeScript error (#32655) @ZeeshanTamboli
62
+ - &#8203;<!-- 01 -->[website] Add Pedro to About Us page (#32803) @apedroferreira
63
+
64
+ ### Core
65
+
66
+ - &#8203;<!-- 32 -->[core] Upgrade MUI X dependency (#32824) @oliviertassinari
67
+ - &#8203;<!-- 02 -->[typescript] Allow module augmentation for `Mixins` (#32798) @mnajdova
68
+
69
+ All contributors of this release in alphabetical order: @abriginets, @alexfauquette, @alisasanib, @apedroferreira, @danilo-leal, @diggis00, @flaviendelangle, @garronej, @JeanPetrov, @mbrookes, @mnajdova, @nate-summercook, @o-dubrovskyi, @oliviertassinari, @paales, @robertwt7, @SamuelMaddox, @siriwatknp, @veronikaslc, @VibhorJaiswal, @ZeeshanTamboli
70
+
3
71
  ## 5.8.0
4
72
 
5
73
  <!-- generated comparing v5.7.0..master -->
@@ -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;
@@ -143,7 +143,8 @@ function createCssVarsProvider(options) {
143
143
  vars: rootVars,
144
144
  getCssVar: (0, _createGetCssVar.default)(prefix)
145
145
  });
146
- const styleSheet = {};
146
+ const defaultColorSchemeStyleSheet = {};
147
+ const otherColorSchemesStyleSheet = {};
147
148
  Object.entries(colorSchemes).forEach(([key, scheme]) => {
148
149
  const {
149
150
  css,
@@ -179,9 +180,9 @@ function createCssVarsProvider(options) {
179
180
  })();
180
181
 
181
182
  if (key === resolvedDefaultColorScheme) {
182
- styleSheet[colorSchemeSelector] = css;
183
+ defaultColorSchemeStyleSheet[colorSchemeSelector] = css;
183
184
  } else {
184
- styleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
185
+ otherColorSchemesStyleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
185
186
  }
186
187
  });
187
188
  React.useEffect(() => {
@@ -248,7 +249,9 @@ function createCssVarsProvider(options) {
248
249
  [colorSchemeSelector]: rootCss
249
250
  }
250
251
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledEngine.GlobalStyles, {
251
- styles: styleSheet
252
+ styles: defaultColorSchemeStyleSheet
253
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledEngine.GlobalStyles, {
254
+ styles: otherColorSchemesStyleSheet
252
255
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ThemeProvider.default, {
253
256
  theme: resolveTheme ? resolveTheme(theme) : theme,
254
257
  children: children
@@ -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 = "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,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 {};
@@ -118,7 +118,8 @@ export default function createCssVarsProvider(options) {
118
118
  vars: rootVars,
119
119
  getCssVar: createGetCssVar(prefix)
120
120
  });
121
- const styleSheet = {};
121
+ const defaultColorSchemeStyleSheet = {};
122
+ const otherColorSchemesStyleSheet = {};
122
123
  Object.entries(colorSchemes).forEach(([key, scheme]) => {
123
124
  const {
124
125
  css,
@@ -154,9 +155,9 @@ export default function createCssVarsProvider(options) {
154
155
  })();
155
156
 
156
157
  if (key === resolvedDefaultColorScheme) {
157
- styleSheet[colorSchemeSelector] = css;
158
+ defaultColorSchemeStyleSheet[colorSchemeSelector] = css;
158
159
  } else {
159
- styleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
160
+ otherColorSchemesStyleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
160
161
  }
161
162
  });
162
163
  React.useEffect(() => {
@@ -223,7 +224,9 @@ export default function createCssVarsProvider(options) {
223
224
  [colorSchemeSelector]: rootCss
224
225
  }
225
226
  }), /*#__PURE__*/_jsx(GlobalStyles, {
226
- styles: styleSheet
227
+ styles: defaultColorSchemeStyleSheet
228
+ }), /*#__PURE__*/_jsx(GlobalStyles, {
229
+ styles: otherColorSchemesStyleSheet
227
230
  }), /*#__PURE__*/_jsx(ThemeProvider, {
228
231
  theme: resolveTheme ? resolveTheme(theme) : theme,
229
232
  children: children
package/esm/spacing.js CHANGED
@@ -45,7 +45,7 @@ const spacingKeys = [...marginKeys, ...paddingKeys];
45
45
  export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
46
46
  var _getPath;
47
47
 
48
- const themeSpacing = (_getPath = getPath(theme, themeKey)) != null ? _getPath : defaultValue;
48
+ const themeSpacing = (_getPath = getPath(theme, themeKey, false)) != null ? _getPath : defaultValue;
49
49
 
50
50
  if (typeof themeSpacing === 'number') {
51
51
  return abs => {
package/esm/style.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { unstable_capitalize as capitalize } from '@mui/utils';
2
2
  import responsivePropType from './responsivePropType';
3
3
  import { handleBreakpoints } from './breakpoints';
4
- export function getPath(obj, path) {
4
+ export function getPath(obj, path, checkVars = true) {
5
5
  if (!path || typeof path !== 'string') {
6
6
  return null;
7
7
  } // Check if CSS variables are used
8
8
 
9
9
 
10
- if (obj && obj.vars) {
10
+ if (obj && obj.vars && checkVars) {
11
11
  const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
12
12
 
13
13
  if (val != null) {
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.8.0
1
+ /** @license MUI v5.8.1
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 {};
@@ -136,7 +136,8 @@ export default function createCssVarsProvider(options) {
136
136
  vars: rootVars,
137
137
  getCssVar: createGetCssVar(prefix)
138
138
  });
139
- var styleSheet = {};
139
+ var defaultColorSchemeStyleSheet = {};
140
+ var otherColorSchemesStyleSheet = {};
140
141
  Object.entries(colorSchemes).forEach(function (_ref2) {
141
142
  var _ref3 = _slicedToArray(_ref2, 2),
142
143
  key = _ref3[0],
@@ -176,9 +177,9 @@ export default function createCssVarsProvider(options) {
176
177
  }();
177
178
 
178
179
  if (key === resolvedDefaultColorScheme) {
179
- styleSheet[colorSchemeSelector] = css;
180
+ defaultColorSchemeStyleSheet[colorSchemeSelector] = css;
180
181
  } else {
181
- styleSheet["".concat(colorSchemeSelector === ':root' ? '' : colorSchemeSelector, "[").concat(attribute, "=\"").concat(key, "\"]")] = css;
182
+ otherColorSchemesStyleSheet["".concat(colorSchemeSelector === ':root' ? '' : colorSchemeSelector, "[").concat(attribute, "=\"").concat(key, "\"]")] = css;
182
183
  }
183
184
  });
184
185
  React.useEffect(function () {
@@ -245,7 +246,9 @@ export default function createCssVarsProvider(options) {
245
246
  children: [/*#__PURE__*/_jsx(GlobalStyles, {
246
247
  styles: _defineProperty({}, colorSchemeSelector, rootCss)
247
248
  }), /*#__PURE__*/_jsx(GlobalStyles, {
248
- styles: styleSheet
249
+ styles: defaultColorSchemeStyleSheet
250
+ }), /*#__PURE__*/_jsx(GlobalStyles, {
251
+ styles: otherColorSchemesStyleSheet
249
252
  }), /*#__PURE__*/_jsx(ThemeProvider, {
250
253
  theme: resolveTheme ? resolveTheme(theme) : theme,
251
254
  children: children
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.8.0
1
+ /** @license MUI v5.8.1
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/spacing.js CHANGED
@@ -52,7 +52,7 @@ var spacingKeys = [].concat(marginKeys, paddingKeys);
52
52
  export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
53
53
  var _getPath;
54
54
 
55
- var themeSpacing = (_getPath = getPath(theme, themeKey)) != null ? _getPath : defaultValue;
55
+ var themeSpacing = (_getPath = getPath(theme, themeKey, false)) != null ? _getPath : defaultValue;
56
56
 
57
57
  if (typeof themeSpacing === 'number') {
58
58
  return function (abs) {
package/legacy/style.js CHANGED
@@ -3,12 +3,14 @@ import { unstable_capitalize as capitalize } from '@mui/utils';
3
3
  import responsivePropType from './responsivePropType';
4
4
  import { handleBreakpoints } from './breakpoints';
5
5
  export function getPath(obj, path) {
6
+ var checkVars = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
7
+
6
8
  if (!path || typeof path !== 'string') {
7
9
  return null;
8
10
  } // Check if CSS variables are used
9
11
 
10
12
 
11
- if (obj && obj.vars) {
13
+ if (obj && obj.vars && checkVars) {
12
14
  var val = "vars.".concat(path).split('.').reduce(function (acc, item) {
13
15
  return acc && acc[item] ? acc[item] : null;
14
16
  }, obj);
@@ -118,7 +118,8 @@ export default function createCssVarsProvider(options) {
118
118
  vars: rootVars,
119
119
  getCssVar: createGetCssVar(prefix)
120
120
  });
121
- const styleSheet = {};
121
+ const defaultColorSchemeStyleSheet = {};
122
+ const otherColorSchemesStyleSheet = {};
122
123
  Object.entries(colorSchemes).forEach(([key, scheme]) => {
123
124
  const {
124
125
  css,
@@ -154,9 +155,9 @@ export default function createCssVarsProvider(options) {
154
155
  })();
155
156
 
156
157
  if (key === resolvedDefaultColorScheme) {
157
- styleSheet[colorSchemeSelector] = css;
158
+ defaultColorSchemeStyleSheet[colorSchemeSelector] = css;
158
159
  } else {
159
- styleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
160
+ otherColorSchemesStyleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
160
161
  }
161
162
  });
162
163
  React.useEffect(() => {
@@ -223,7 +224,9 @@ export default function createCssVarsProvider(options) {
223
224
  [colorSchemeSelector]: rootCss
224
225
  }
225
226
  }), /*#__PURE__*/_jsx(GlobalStyles, {
226
- styles: styleSheet
227
+ styles: defaultColorSchemeStyleSheet
228
+ }), /*#__PURE__*/_jsx(GlobalStyles, {
229
+ styles: otherColorSchemesStyleSheet
227
230
  }), /*#__PURE__*/_jsx(ThemeProvider, {
228
231
  theme: resolveTheme ? resolveTheme(theme) : theme,
229
232
  children: children
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.8.0
1
+ /** @license MUI v5.8.1
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/modern/spacing.js CHANGED
@@ -43,7 +43,7 @@ const marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTo
43
43
  const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
44
44
  const spacingKeys = [...marginKeys, ...paddingKeys];
45
45
  export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
46
- const themeSpacing = getPath(theme, themeKey) ?? defaultValue;
46
+ const themeSpacing = getPath(theme, themeKey, false) ?? defaultValue;
47
47
 
48
48
  if (typeof themeSpacing === 'number') {
49
49
  return abs => {
package/modern/style.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { unstable_capitalize as capitalize } from '@mui/utils';
2
2
  import responsivePropType from './responsivePropType';
3
3
  import { handleBreakpoints } from './breakpoints';
4
- export function getPath(obj, path) {
4
+ export function getPath(obj, path, checkVars = true) {
5
5
  if (!path || typeof path !== 'string') {
6
6
  return null;
7
7
  } // Check if CSS variables are used
8
8
 
9
9
 
10
- if (obj && obj.vars) {
10
+ if (obj && obj.vars && checkVars) {
11
11
  const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
12
12
 
13
13
  if (val != null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/system",
3
- "version": "5.8.0",
3
+ "version": "5.8.1",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "CSS utilities for rapidly laying out custom designs.",
package/spacing.js CHANGED
@@ -66,7 +66,7 @@ const spacingKeys = [...marginKeys, ...paddingKeys];
66
66
  function createUnaryUnit(theme, themeKey, defaultValue, propName) {
67
67
  var _getPath;
68
68
 
69
- const themeSpacing = (_getPath = (0, _style.getPath)(theme, themeKey)) != null ? _getPath : defaultValue;
69
+ const themeSpacing = (_getPath = (0, _style.getPath)(theme, themeKey, false)) != null ? _getPath : defaultValue;
70
70
 
71
71
  if (typeof themeSpacing === 'number') {
72
72
  return abs => {
package/style.js CHANGED
@@ -14,13 +14,13 @@ var _responsivePropType = _interopRequireDefault(require("./responsivePropType")
14
14
 
15
15
  var _breakpoints = require("./breakpoints");
16
16
 
17
- function getPath(obj, path) {
17
+ function getPath(obj, path, checkVars = true) {
18
18
  if (!path || typeof path !== 'string') {
19
19
  return null;
20
20
  } // Check if CSS variables are used
21
21
 
22
22
 
23
- if (obj && obj.vars) {
23
+ if (obj && obj.vars && checkVars) {
24
24
  const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
25
25
 
26
26
  if (val != null) {
@@ -1 +1 @@
1
- export {};
1
+ export {};