@mui/system 5.8.6 → 5.8.7
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 +1 -1
- package/CHANGELOG.md +51 -0
- package/Container/Container.d.ts +13 -13
- package/Container/ContainerProps.d.ts +40 -40
- package/Container/containerClasses.d.ts +22 -22
- package/Container/createContainer.d.ts +18 -18
- package/createBox.spec.d.ts +1 -1
- package/createTheme/createSpacing.d.ts +10 -10
- package/cssVars/createCssVarsProvider.d.ts +13 -18
- package/cssVars/createCssVarsProvider.js +11 -16
- package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/createGetCssVar.js +2 -2
- package/cssVars/cssVarsParser.d.ts +65 -70
- package/cssVars/cssVarsParser.js +4 -19
- package/cssVars/getInitColorSchemeScript.d.ts +45 -45
- package/cssVars/index.d.ts +3 -2
- package/cssVars/index.js +9 -1
- package/cssVars/useCurrentColorScheme.d.ts +53 -53
- package/esm/cssVars/createCssVarsProvider.js +11 -15
- package/esm/cssVars/createGetCssVar.js +2 -2
- package/esm/cssVars/cssVarsParser.js +4 -19
- package/esm/cssVars/index.js +2 -1
- package/index.js +1 -1
- package/index.spec.d.ts +1 -1
- package/legacy/cssVars/createCssVarsProvider.js +11 -16
- package/legacy/cssVars/createGetCssVar.js +3 -3
- package/legacy/cssVars/cssVarsParser.js +4 -20
- package/legacy/cssVars/index.js +2 -1
- package/legacy/index.js +1 -1
- package/modern/cssVars/createCssVarsProvider.js +11 -15
- package/modern/cssVars/createGetCssVar.js +2 -2
- package/modern/cssVars/cssVarsParser.js +4 -19
- package/modern/cssVars/index.js +2 -1
- package/modern/index.js +1 -1
- package/package.json +3 -3
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
package/Box/Box.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 5.8.7
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.8.6..master -->
|
|
6
|
+
|
|
7
|
+
_Jul 4, 2022_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- 🐛 Fixed an issue causing Typescript errors when building a project with Material UI v5.8.6 (@michaldudak)
|
|
12
|
+
- 🐛 Fixed a few bugs in Material UI components. Thanks @henriqueholtz, @jake-collibra, @MattiasMartens and @TimoWilhelm!
|
|
13
|
+
- many other 🐛 bug fixes and 📚 documentation improvements
|
|
14
|
+
|
|
15
|
+
### `@mui/material@5.8.7`
|
|
16
|
+
|
|
17
|
+
- [Autocomplete] Add some missing props in `useAutocomplete` (#33269) @henriqueholtz
|
|
18
|
+
- [Autocomplete] Extend `componentsProps` to include `popper` and `popupIndicator` slots (#33283) @jake-collibra
|
|
19
|
+
- [Select] Annotate empty string as valid value prop (#33088) @MattiasMartens
|
|
20
|
+
- [SnackbarContent] Fix message text color with css var provider (#33285) @TimoWilhelm
|
|
21
|
+
|
|
22
|
+
### `@mui/styled-engine@5.8.7`
|
|
23
|
+
|
|
24
|
+
- [styled-engine] Add missing type dependency on csstype (#33310) @Methuselah96
|
|
25
|
+
|
|
26
|
+
### `@mui/system@5.8.7`
|
|
27
|
+
|
|
28
|
+
- [system] Simplify theme input types for `CssVarsProvider` (#33381) @siriwatknp
|
|
29
|
+
- [system] Export required types (#33324) @michaldudak
|
|
30
|
+
|
|
31
|
+
### `@mui/joy@5.0.0-alpha.35`
|
|
32
|
+
|
|
33
|
+
- [Joy] Add radio button documentation (#33254) @siriwatknp
|
|
34
|
+
- [Joy] Add switch documentation (#33302) @siriwatknp
|
|
35
|
+
- [Joy] Batch a couple of documentation refinements (#33158)
|
|
36
|
+
- [Joy] Enable Joy and Material UI compatibility (#33379) @siriwatknp
|
|
37
|
+
|
|
38
|
+
### `@mui/base@5.0.0-alpha.88`
|
|
39
|
+
|
|
40
|
+
- [base] Remove a type incompatible with Typescript 3.5 (#33361) @michaldudak
|
|
41
|
+
- [BadgeUnstyled] Export BadgeUnstyledOwnProps interface to fix typescript compiler error (#33314) @aaronlademann-wf
|
|
42
|
+
- [TablePaginationUnstyled] Accept callbacks in componentsProps (#33309) @michaldudak
|
|
43
|
+
|
|
44
|
+
### Docs
|
|
45
|
+
|
|
46
|
+
- [docs] Fix Link typings in the react-router example (#32308) @aaarichter
|
|
47
|
+
- [docs] Add caveat about class components with Tooltip (#33325) @joshkel
|
|
48
|
+
- [docs] Fix SEO issues (#33288) @oliviertassinari
|
|
49
|
+
- [docs] Fix Slider's "player" demo (#33267) @xlianghang
|
|
50
|
+
- [website] Link MUI Toolpad in mui.com (#33287) @oliviertassinari
|
|
51
|
+
|
|
52
|
+
All contributors of this release in alphabetical order: @aaarichter, @aaronlademann-wf, @danilo-leal, @henriqueholtz, @jake-collibra, @joshkel, @MattiasMartens, @Methuselah96, @michaldudak, @oliviertassinari, @siriwatknp, @TimoWilhelm, @xlianghang
|
|
53
|
+
|
|
3
54
|
## 5.8.6
|
|
4
55
|
|
|
5
56
|
<!-- generated comparing v5.8.5..master -->
|
package/Container/Container.d.ts
CHANGED
|
@@ -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 {};
|
package/createBox.spec.d.ts
CHANGED
|
@@ -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;
|
|
@@ -45,17 +45,23 @@ export interface CssVarsProviderConfig<ColorScheme extends string> {
|
|
|
45
45
|
*/
|
|
46
46
|
enableColorScheme?: boolean;
|
|
47
47
|
/**
|
|
48
|
-
* CSS
|
|
49
|
-
*
|
|
48
|
+
* A function to determine if the key, value should be attached as CSS Variable
|
|
49
|
+
* `keys` is an array that represents the object path keys.
|
|
50
|
+
* Ex, if the theme is { foo: { bar: 'var(--test)' } }
|
|
51
|
+
* then, keys = ['foo', 'bar']
|
|
52
|
+
* value = 'var(--test)'
|
|
50
53
|
*/
|
|
51
|
-
|
|
54
|
+
shouldSkipGeneratingVar?: (keys: string[], value: string | number) => boolean;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
export interface CreateCssVarsProviderResult<ColorScheme extends string
|
|
57
|
+
export interface CreateCssVarsProviderResult<ColorScheme extends string> {
|
|
55
58
|
CssVarsProvider: (
|
|
56
59
|
props: React.PropsWithChildren<
|
|
57
60
|
Partial<CssVarsProviderConfig<ColorScheme>> & {
|
|
58
|
-
theme?:
|
|
61
|
+
theme?: {
|
|
62
|
+
cssVarPrefix?: string;
|
|
63
|
+
colorSchemes: Record<ColorScheme, Record<string, any>>;
|
|
64
|
+
};
|
|
59
65
|
/**
|
|
60
66
|
* The document used to perform `disableTransitionOnChange` feature
|
|
61
67
|
* @default document
|
|
@@ -83,10 +89,7 @@ export interface CreateCssVarsProviderResult<ColorScheme extends string, ThemeIn
|
|
|
83
89
|
getInitColorSchemeScript: typeof getInitColorSchemeScript;
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
export default function createCssVarsProvider<
|
|
87
|
-
ColorScheme extends string,
|
|
88
|
-
ThemeInput extends { colorSchemes?: Partial<Record<ColorScheme, any>> },
|
|
89
|
-
>(
|
|
92
|
+
export default function createCssVarsProvider<ColorScheme extends string>(
|
|
90
93
|
options: CssVarsProviderConfig<ColorScheme> & {
|
|
91
94
|
/**
|
|
92
95
|
* Design system default theme
|
|
@@ -114,14 +117,6 @@ export default function createCssVarsProvider<
|
|
|
114
117
|
* }
|
|
115
118
|
*/
|
|
116
119
|
theme: any;
|
|
117
|
-
/**
|
|
118
|
-
* A function to determine if the key, value should be attached as CSS Variable
|
|
119
|
-
* `keys` is an array that represents the object path keys.
|
|
120
|
-
* Ex, if the theme is { foo: { bar: 'var(--test)' } }
|
|
121
|
-
* then, keys = ['foo', 'bar']
|
|
122
|
-
* value = 'var(--test)'
|
|
123
|
-
*/
|
|
124
|
-
shouldSkipGeneratingVar?: (keys: string[], value: string | number) => boolean;
|
|
125
120
|
/**
|
|
126
121
|
* A function to be called after the CSS variables are attached. The result of this function will be the final theme pass to ThemeProvider.
|
|
127
122
|
*
|
|
@@ -130,7 +125,7 @@ export default function createCssVarsProvider<
|
|
|
130
125
|
*/
|
|
131
126
|
resolveTheme?: (theme: any) => any; // the type is any because it depends on the design system.
|
|
132
127
|
},
|
|
133
|
-
): CreateCssVarsProviderResult<ColorScheme
|
|
128
|
+
): CreateCssVarsProviderResult<ColorScheme>;
|
|
134
129
|
|
|
135
130
|
// disable automatic export
|
|
136
131
|
export {};
|
|
@@ -28,11 +28,9 @@ var _getInitColorSchemeScript = _interopRequireWildcard(require("./getInitColorS
|
|
|
28
28
|
|
|
29
29
|
var _useCurrentColorScheme = _interopRequireDefault(require("./useCurrentColorScheme"));
|
|
30
30
|
|
|
31
|
-
var _createGetCssVar = _interopRequireDefault(require("./createGetCssVar"));
|
|
32
|
-
|
|
33
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
34
32
|
|
|
35
|
-
const _excluded = ["colorSchemes", "components"];
|
|
33
|
+
const _excluded = ["colorSchemes", "components", "cssVarPrefix"];
|
|
36
34
|
|
|
37
35
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
38
36
|
|
|
@@ -51,8 +49,7 @@ function createCssVarsProvider(options) {
|
|
|
51
49
|
defaultColorScheme: designSystemColorScheme,
|
|
52
50
|
disableTransitionOnChange: designSystemTransitionOnChange = false,
|
|
53
51
|
enableColorScheme: designSystemEnableColorScheme = true,
|
|
54
|
-
|
|
55
|
-
shouldSkipGeneratingVar,
|
|
52
|
+
shouldSkipGeneratingVar: designSystemShouldSkipGeneratingVar,
|
|
56
53
|
resolveTheme
|
|
57
54
|
} = options;
|
|
58
55
|
|
|
@@ -75,7 +72,6 @@ function createCssVarsProvider(options) {
|
|
|
75
72
|
function CssVarsProvider({
|
|
76
73
|
children,
|
|
77
74
|
theme: themeProp = defaultTheme,
|
|
78
|
-
prefix = designSystemPrefix,
|
|
79
75
|
modeStorageKey = defaultModeStorageKey,
|
|
80
76
|
colorSchemeStorageKey = defaultColorSchemeStorageKey,
|
|
81
77
|
attribute = defaultAttribute,
|
|
@@ -86,12 +82,14 @@ function createCssVarsProvider(options) {
|
|
|
86
82
|
storageWindow = typeof window === 'undefined' ? undefined : window,
|
|
87
83
|
documentNode = typeof document === 'undefined' ? undefined : document,
|
|
88
84
|
colorSchemeNode = typeof document === 'undefined' ? undefined : document.documentElement,
|
|
89
|
-
colorSchemeSelector = ':root'
|
|
85
|
+
colorSchemeSelector = ':root',
|
|
86
|
+
shouldSkipGeneratingVar = designSystemShouldSkipGeneratingVar
|
|
90
87
|
}) {
|
|
91
88
|
const hasMounted = React.useRef(false);
|
|
92
89
|
const {
|
|
93
90
|
colorSchemes = {},
|
|
94
|
-
components = {}
|
|
91
|
+
components = {},
|
|
92
|
+
cssVarPrefix
|
|
95
93
|
} = themeProp,
|
|
96
94
|
restThemeProp = (0, _objectWithoutPropertiesLoose2.default)(themeProp, _excluded);
|
|
97
95
|
const allColorSchemes = Object.keys(colorSchemes);
|
|
@@ -135,16 +133,14 @@ function createCssVarsProvider(options) {
|
|
|
135
133
|
vars: rootVars,
|
|
136
134
|
parsedTheme
|
|
137
135
|
} = (0, _cssVarsParser.default)(theme, {
|
|
138
|
-
prefix,
|
|
139
|
-
basePrefix: designSystemPrefix,
|
|
136
|
+
prefix: cssVarPrefix,
|
|
140
137
|
shouldSkipGeneratingVar
|
|
141
138
|
});
|
|
142
139
|
theme = (0, _extends2.default)({}, parsedTheme, {
|
|
143
140
|
components,
|
|
144
141
|
colorSchemes,
|
|
145
|
-
|
|
142
|
+
cssVarPrefix,
|
|
146
143
|
vars: rootVars,
|
|
147
|
-
getCssVar: (0, _createGetCssVar.default)(prefix),
|
|
148
144
|
getColorSchemeSelector: targetColorScheme => `[${attribute}="${targetColorScheme}"] &`
|
|
149
145
|
});
|
|
150
146
|
const defaultColorSchemeStyleSheet = {};
|
|
@@ -155,8 +151,7 @@ function createCssVarsProvider(options) {
|
|
|
155
151
|
vars,
|
|
156
152
|
parsedTheme: parsedScheme
|
|
157
153
|
} = (0, _cssVarsParser.default)(scheme, {
|
|
158
|
-
prefix,
|
|
159
|
-
basePrefix: designSystemPrefix,
|
|
154
|
+
prefix: cssVarPrefix,
|
|
160
155
|
shouldSkipGeneratingVar
|
|
161
156
|
});
|
|
162
157
|
theme.vars = (0, _utils.deepmerge)(theme.vars, vars);
|
|
@@ -320,9 +315,9 @@ function createCssVarsProvider(options) {
|
|
|
320
315
|
modeStorageKey: _propTypes.default.string,
|
|
321
316
|
|
|
322
317
|
/**
|
|
323
|
-
* CSS
|
|
318
|
+
* A function to determine if the key, value should be attached as CSS Variable
|
|
324
319
|
*/
|
|
325
|
-
|
|
320
|
+
shouldSkipGeneratingVar: _propTypes.default.func,
|
|
326
321
|
|
|
327
322
|
/**
|
|
328
323
|
* The window that attaches the 'storage' event listener
|
|
@@ -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, ...
|
|
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;
|
|
@@ -25,8 +25,8 @@ function createGetCssVar(prefix = '') {
|
|
|
25
25
|
} // AdditionalVars makes `getCssVar` less strict, so it can be use like this `getCssVar('non-mui-variable')` without type error.
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
const getCssVar = (field, ...
|
|
29
|
-
return `var(--${prefix ? `${prefix}-` : ''}${field}${appendVar(...
|
|
28
|
+
const getCssVar = (field, ...fallbacks) => {
|
|
29
|
+
return `var(--${prefix ? `${prefix}-` : ''}${field}${appendVar(...fallbacks)})`;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
return getCssVar;
|
|
@@ -1,70 +1,65 @@
|
|
|
1
|
-
declare type NestedRecord<V = any> = {
|
|
2
|
-
[k: string | number]: NestedRecord<V> | V;
|
|
3
|
-
};
|
|
4
|
-
/**
|
|
5
|
-
* This function create an object from keys, value and then assign to target
|
|
6
|
-
*
|
|
7
|
-
* @param {Object} obj : the target object to be assigned
|
|
8
|
-
* @param {string[]} keys
|
|
9
|
-
* @param {string | number} value
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const source = {}
|
|
13
|
-
* assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
|
|
14
|
-
* console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* const source = { palette: { primary: 'var(--palette-primary)' } }
|
|
18
|
-
* assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
|
|
19
|
-
* console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
|
|
20
|
-
*/
|
|
21
|
-
export declare const assignNestedKeys: <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
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
+
* shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
|
|
41
|
+
* }} options.
|
|
42
|
+
* `prefix`: The prefix of the generated CSS variables. This function does not change the value.
|
|
43
|
+
*
|
|
44
|
+
* @returns {{ css: Object, vars: Object, parsedTheme: typeof theme }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme), and `parsedTheme` is the cloned version of theme.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* const { css, vars, parsedTheme } = parser({
|
|
48
|
+
* fontSize: 12,
|
|
49
|
+
* lineHeight: 1.2,
|
|
50
|
+
* palette: { primary: { 500: 'var(--color)' } }
|
|
51
|
+
* }, { prefix: 'foo' })
|
|
52
|
+
*
|
|
53
|
+
* console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
|
|
54
|
+
* console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
|
|
55
|
+
* console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--color)' } } }
|
|
56
|
+
*/
|
|
57
|
+
export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
|
|
58
|
+
prefix?: string;
|
|
59
|
+
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
60
|
+
}): {
|
|
61
|
+
css: NestedRecord<string>;
|
|
62
|
+
vars: NestedRecord<string>;
|
|
63
|
+
parsedTheme: T;
|
|
64
|
+
};
|
|
65
|
+
export {};
|