@mui/system 5.2.8 → 5.3.0
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.d.ts +1 -0
- package/Box/Box.spec.d.ts +1 -1
- package/CHANGELOG.md +73 -0
- package/createBox.spec.d.ts +1 -1
- package/createStyled.js +9 -1
- package/createTheme/createSpacing.d.ts +10 -10
- package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/cssVarsParser.d.ts +68 -68
- package/cssVars/getInitColorSchemeScript.d.ts +12 -12
- package/cssVars/index.d.ts +2 -2
- package/cssVars/useCurrentColorScheme.d.ts +50 -50
- package/esm/createStyled.js +9 -1
- package/esm/typography.js +4 -1
- package/index.d.ts +1 -0
- package/index.js +1 -1
- package/index.spec.d.ts +1 -1
- package/legacy/createStyled.js +17 -4
- package/legacy/index.js +1 -1
- package/legacy/typography.js +4 -1
- package/modern/createStyled.js +9 -1
- package/modern/index.js +1 -1
- package/modern/typography.js +4 -1
- package/package.json +6 -6
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
- package/typography.js +6 -2
package/Box/Box.d.ts
CHANGED
package/Box/Box.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 5.3.0
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.2.8..master -->
|
|
6
|
+
|
|
7
|
+
_Jan 17, 2022_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- 🛠 @siriwatknp added support for callbacks in styleOverrides (#30524)
|
|
12
|
+
- 🧩 @ZeeshanTamboli and @VicHofs improved customization of components (#30515, #30212)
|
|
13
|
+
- 🛠 @hbjORbj fixed the use of ResizeObserver in Masonry component (#29896)
|
|
14
|
+
- 📄 @danilo-leal and @siriwatknp created our own blog home page (#30121)
|
|
15
|
+
|
|
16
|
+
### `@mui/material@5.3.0`
|
|
17
|
+
|
|
18
|
+
- [Autocomplete] Add ability to pass props to `Paper` component (#30515) @ZeeshanTamboli
|
|
19
|
+
- [Select] Add defaultOpen prop (#30212) @VicHofs
|
|
20
|
+
|
|
21
|
+
### `@mui/system@5.3.0`
|
|
22
|
+
|
|
23
|
+
- [system][box, grid, typography] `textTransform` prop should work directly on component (#30437) @hbjORbj
|
|
24
|
+
- [system] Support callback value in `styleOverrides` slot (#30524) @siriwatknp
|
|
25
|
+
|
|
26
|
+
### `@mui/lab@5.0.0-alpha.65`
|
|
27
|
+
|
|
28
|
+
- [Masonry] Observe every masonry child to trigger computation when needed (#29896) @hbjORbj
|
|
29
|
+
- [MobileDatePicker] Fix calling onOpen when readOnly is true (#30561) @alisasanib
|
|
30
|
+
|
|
31
|
+
### `@mui/codemod@5.3.0`
|
|
32
|
+
|
|
33
|
+
- [codemod] Bump `jscodeshift` to remove `colors` dependency (#30578) @siriwatknp
|
|
34
|
+
|
|
35
|
+
### `@mui/styled-engine-sc@5.3.0`
|
|
36
|
+
|
|
37
|
+
- [styled-engine-sc] Add the withConfig API to enable using the babel plugin for styled-comonents (#30589) @mnajdova
|
|
38
|
+
|
|
39
|
+
### `@mui/joy@5.0.0-alpha.11`
|
|
40
|
+
|
|
41
|
+
- [Joy] Add `SvgIcon` component (#30570) @hbjORbj
|
|
42
|
+
|
|
43
|
+
### `@mui/base@5.0.0-alpha.65`
|
|
44
|
+
|
|
45
|
+
- [SliderUnstyled] Add useSlider hook and polish (#30094) @mnajdova
|
|
46
|
+
|
|
47
|
+
### Docs
|
|
48
|
+
|
|
49
|
+
- [docs] End code block in test/README.md (#30531) @yaboi
|
|
50
|
+
- [docs] Remove redundant grouping in /components/radio-buttons/ (#30065) @eps1lon
|
|
51
|
+
- [docs] Update migration scripts and e2e tests (#30583) @siriwatknp
|
|
52
|
+
- [docs] Fix migration guides for versions older than v4 (#30595) @kkirsche
|
|
53
|
+
- [docs] Inform about specific files for DataGrid locales (#30411) @alexfauquette
|
|
54
|
+
- [docs] jss-to-tss migration advise to drop clsx in favor of cx (#30527) @garronej
|
|
55
|
+
- [docs] Fix integration with MUI X (#30593) @oliviertassinari
|
|
56
|
+
- [docs] Adding peer dependencies explanation on @mui/lab README.md (#30532) @glaucoheitor
|
|
57
|
+
- [docs] Add missing quote in migration docs (#30587) @Atralbus
|
|
58
|
+
- [docs] Update link to Doit sponsor (#30586) @oliviertassinari
|
|
59
|
+
- [docs] Add products identifier and drawer (#30283) @siriwatknp
|
|
60
|
+
- [website] Fix code button with installation command (#30622) @danilo-leal
|
|
61
|
+
- [website] Add a Blog index page (#30121) @danilo-leal
|
|
62
|
+
- [website] Migrate Twitter from @MaterialUI to @MUI_hq @oliviertassinari
|
|
63
|
+
- [website] Add Andrii to the About Us page (#30581) @cherniavskii
|
|
64
|
+
|
|
65
|
+
### Core
|
|
66
|
+
|
|
67
|
+
- [core] Revert changes to peer dependencies (#30662) @oliviertassinari
|
|
68
|
+
- [core] Renovate should not try to update node (#30659) @oliviertassinari
|
|
69
|
+
- [core] Remove dead files (#30663) @oliviertassinari
|
|
70
|
+
- [core] Fix outdated TypeScript template (#30596) @oliviertassinari
|
|
71
|
+
- [core] Remove extra `</p>` from header of README.md (#30530) @yaboi
|
|
72
|
+
- [core] Fix `docs:api` script for Windows OS (#30533) @ZeeshanTamboli
|
|
73
|
+
|
|
74
|
+
All contributors of this release in alphabetical order: @alexfauquette, @alisasanib, @Atralbus, @cherniavskii, @danilo-leal, @eps1lon, @garronej, @glaucoheitor, @hbjORbj, @kkirsche, @mnajdova, @oliviertassinari, @siriwatknp, @VicHofs, @yaboi, @ZeeshanTamboli
|
|
75
|
+
|
|
3
76
|
## 5.2.8
|
|
4
77
|
|
|
5
78
|
<!-- generated comparing v5.2.7..master -->
|
package/createBox.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/createStyled.js
CHANGED
|
@@ -156,7 +156,11 @@ function createStyled(input = {}) {
|
|
|
156
156
|
const styleOverrides = getStyleOverrides(componentName, theme);
|
|
157
157
|
|
|
158
158
|
if (styleOverrides) {
|
|
159
|
-
|
|
159
|
+
const resolvedStyleOverrides = {};
|
|
160
|
+
Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => {
|
|
161
|
+
resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle(props) : slotStyle;
|
|
162
|
+
});
|
|
163
|
+
return overridesResolver(props, resolvedStyleOverrides);
|
|
160
164
|
}
|
|
161
165
|
|
|
162
166
|
return null;
|
|
@@ -218,6 +222,10 @@ function createStyled(input = {}) {
|
|
|
218
222
|
return Component;
|
|
219
223
|
};
|
|
220
224
|
|
|
225
|
+
if (defaultStyledResolver.withConfig) {
|
|
226
|
+
muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
|
|
227
|
+
}
|
|
228
|
+
|
|
221
229
|
return muiStyledResolver;
|
|
222
230
|
};
|
|
223
231
|
}
|
|
@@ -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;
|
|
@@ -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,68 +1,68 @@
|
|
|
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) => 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, scope: Record<string, string | number>) => 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
|
-
* This function also mutate the string value of theme input by replacing `basePrefix` (if existed) with `prefix`
|
|
47
|
-
*
|
|
48
|
-
* @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme)
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* const { css, vars } = parser({
|
|
52
|
-
* fontSize: 12,
|
|
53
|
-
* lineHeight: 1.2,
|
|
54
|
-
* palette: { primary: { 500: '#000000' } }
|
|
55
|
-
* })
|
|
56
|
-
*
|
|
57
|
-
* console.log(css) // { '--fontSize': '12px', '--lineHeight': 1.2, '--palette-primary-500': '#000000' }
|
|
58
|
-
* console.log(vars) // { fontSize: '--fontSize', lineHeight: '--lineHeight', palette: { primary: { 500: 'var(--palette-primary-500)' } } }
|
|
59
|
-
*/
|
|
60
|
-
export default function cssVarsParser(theme: Record<string, any>, options?: {
|
|
61
|
-
prefix?: string;
|
|
62
|
-
basePrefix?: string;
|
|
63
|
-
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
64
|
-
}): {
|
|
65
|
-
css: NestedRecord<string>;
|
|
66
|
-
vars: NestedRecord<string>;
|
|
67
|
-
};
|
|
68
|
-
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) => 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, scope: Record<string, string | number>) => 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
|
+
* This function also mutate the string value of theme input by replacing `basePrefix` (if existed) with `prefix`
|
|
47
|
+
*
|
|
48
|
+
* @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme)
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* const { css, vars } = parser({
|
|
52
|
+
* fontSize: 12,
|
|
53
|
+
* lineHeight: 1.2,
|
|
54
|
+
* palette: { primary: { 500: '#000000' } }
|
|
55
|
+
* })
|
|
56
|
+
*
|
|
57
|
+
* console.log(css) // { '--fontSize': '12px', '--lineHeight': 1.2, '--palette-primary-500': '#000000' }
|
|
58
|
+
* console.log(vars) // { fontSize: '--fontSize', lineHeight: '--lineHeight', palette: { primary: { 500: 'var(--palette-primary-500)' } } }
|
|
59
|
+
*/
|
|
60
|
+
export default function cssVarsParser(theme: Record<string, any>, options?: {
|
|
61
|
+
prefix?: string;
|
|
62
|
+
basePrefix?: string;
|
|
63
|
+
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
64
|
+
}): {
|
|
65
|
+
css: NestedRecord<string>;
|
|
66
|
+
vars: NestedRecord<string>;
|
|
67
|
+
};
|
|
68
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
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 default function getInitColorSchemeScript(options?: {
|
|
6
|
-
enableSystem?: boolean;
|
|
7
|
-
defaultLightColorScheme?: string;
|
|
8
|
-
defaultDarkColorScheme?: string;
|
|
9
|
-
modeStorageKey?: string;
|
|
10
|
-
colorSchemeStorageKey?: string;
|
|
11
|
-
attribute?: string;
|
|
12
|
-
}): 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 default function getInitColorSchemeScript(options?: {
|
|
6
|
+
enableSystem?: boolean;
|
|
7
|
+
defaultLightColorScheme?: string;
|
|
8
|
+
defaultDarkColorScheme?: string;
|
|
9
|
+
modeStorageKey?: string;
|
|
10
|
+
colorSchemeStorageKey?: string;
|
|
11
|
+
attribute?: string;
|
|
12
|
+
}): JSX.Element;
|
package/cssVars/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './createCssVarsProvider';
|
|
2
|
-
export type { BuildCssVarsTheme } from './createCssVarsProvider';
|
|
1
|
+
export { default } from './createCssVarsProvider';
|
|
2
|
+
export type { BuildCssVarsTheme } from './createCssVarsProvider';
|
|
@@ -1,50 +1,50 @@
|
|
|
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
|
-
export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: {
|
|
44
|
-
defaultLightColorScheme: SupportedColorScheme;
|
|
45
|
-
defaultDarkColorScheme: SupportedColorScheme;
|
|
46
|
-
supportedColorSchemes: Array<SupportedColorScheme>;
|
|
47
|
-
defaultMode?: Mode;
|
|
48
|
-
modeStorageKey?: string;
|
|
49
|
-
colorSchemeStorageKey?: string;
|
|
50
|
-
}): Result<SupportedColorScheme>;
|
|
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
|
+
export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: {
|
|
44
|
+
defaultLightColorScheme: SupportedColorScheme;
|
|
45
|
+
defaultDarkColorScheme: SupportedColorScheme;
|
|
46
|
+
supportedColorSchemes: Array<SupportedColorScheme>;
|
|
47
|
+
defaultMode?: Mode;
|
|
48
|
+
modeStorageKey?: string;
|
|
49
|
+
colorSchemeStorageKey?: string;
|
|
50
|
+
}): Result<SupportedColorScheme>;
|
package/esm/createStyled.js
CHANGED
|
@@ -138,7 +138,11 @@ export default function createStyled(input = {}) {
|
|
|
138
138
|
const styleOverrides = getStyleOverrides(componentName, theme);
|
|
139
139
|
|
|
140
140
|
if (styleOverrides) {
|
|
141
|
-
|
|
141
|
+
const resolvedStyleOverrides = {};
|
|
142
|
+
Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => {
|
|
143
|
+
resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle(props) : slotStyle;
|
|
144
|
+
});
|
|
145
|
+
return overridesResolver(props, resolvedStyleOverrides);
|
|
142
146
|
}
|
|
143
147
|
|
|
144
148
|
return null;
|
|
@@ -201,6 +205,10 @@ export default function createStyled(input = {}) {
|
|
|
201
205
|
return Component;
|
|
202
206
|
};
|
|
203
207
|
|
|
208
|
+
if (defaultStyledResolver.withConfig) {
|
|
209
|
+
muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
|
|
210
|
+
}
|
|
211
|
+
|
|
204
212
|
return muiStyledResolver;
|
|
205
213
|
};
|
|
206
214
|
}
|
package/esm/typography.js
CHANGED
|
@@ -19,6 +19,9 @@ export const fontWeight = style({
|
|
|
19
19
|
export const letterSpacing = style({
|
|
20
20
|
prop: 'letterSpacing'
|
|
21
21
|
});
|
|
22
|
+
export const textTransform = style({
|
|
23
|
+
prop: 'textTransform'
|
|
24
|
+
});
|
|
22
25
|
export const lineHeight = style({
|
|
23
26
|
prop: 'lineHeight'
|
|
24
27
|
});
|
|
@@ -30,5 +33,5 @@ export const typographyVariant = style({
|
|
|
30
33
|
cssProperty: false,
|
|
31
34
|
themeKey: 'typography'
|
|
32
35
|
});
|
|
33
|
-
const typography = compose(typographyVariant, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign);
|
|
36
|
+
const typography = compose(typographyVariant, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign, textTransform);
|
|
34
37
|
export default typography;
|
package/index.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ export const fontWeight: SimpleStyleFunction<'fontWeight'>;
|
|
|
88
88
|
export const letterSpacing: SimpleStyleFunction<'letterSpacing'>;
|
|
89
89
|
export const lineHeight: SimpleStyleFunction<'lineHeight'>;
|
|
90
90
|
export const textAlign: SimpleStyleFunction<'textAlign'>;
|
|
91
|
+
export const textTransform: SimpleStyleFunction<'textTransform'>;
|
|
91
92
|
export type TypographyProps = PropsFor<typeof typography>;
|
|
92
93
|
|
|
93
94
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
package/index.js
CHANGED
package/index.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/legacy/createStyled.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
5
|
import styledEngineStyled from '@mui/styled-engine';
|
|
@@ -139,7 +140,15 @@ export default function createStyled() {
|
|
|
139
140
|
var styleOverrides = getStyleOverrides(componentName, theme);
|
|
140
141
|
|
|
141
142
|
if (styleOverrides) {
|
|
142
|
-
|
|
143
|
+
var resolvedStyleOverrides = {};
|
|
144
|
+
Object.entries(styleOverrides).forEach(function (_ref2) {
|
|
145
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
146
|
+
slotKey = _ref3[0],
|
|
147
|
+
slotStyle = _ref3[1];
|
|
148
|
+
|
|
149
|
+
resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle(props) : slotStyle;
|
|
150
|
+
});
|
|
151
|
+
return overridesResolver(props, resolvedStyleOverrides);
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
return null;
|
|
@@ -171,9 +180,9 @@ export default function createStyled() {
|
|
|
171
180
|
transformedStyleArg.raw = [].concat(_toConsumableArray(styleArg.raw), _toConsumableArray(placeholders));
|
|
172
181
|
} else if (typeof styleArg === 'function') {
|
|
173
182
|
// If the type is function, we need to define the default theme.
|
|
174
|
-
transformedStyleArg = function transformedStyleArg(
|
|
175
|
-
var themeInput =
|
|
176
|
-
other = _objectWithoutProperties(
|
|
183
|
+
transformedStyleArg = function transformedStyleArg(_ref4) {
|
|
184
|
+
var themeInput = _ref4.theme,
|
|
185
|
+
other = _objectWithoutProperties(_ref4, ["theme"]);
|
|
177
186
|
|
|
178
187
|
return styleArg(_extends({
|
|
179
188
|
theme: isEmpty(themeInput) ? defaultTheme : themeInput
|
|
@@ -200,6 +209,10 @@ export default function createStyled() {
|
|
|
200
209
|
return Component;
|
|
201
210
|
};
|
|
202
211
|
|
|
212
|
+
if (defaultStyledResolver.withConfig) {
|
|
213
|
+
muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
|
|
214
|
+
}
|
|
215
|
+
|
|
203
216
|
return muiStyledResolver;
|
|
204
217
|
};
|
|
205
218
|
}
|
package/legacy/index.js
CHANGED
package/legacy/typography.js
CHANGED
|
@@ -19,6 +19,9 @@ export var fontWeight = style({
|
|
|
19
19
|
export var letterSpacing = style({
|
|
20
20
|
prop: 'letterSpacing'
|
|
21
21
|
});
|
|
22
|
+
export var textTransform = style({
|
|
23
|
+
prop: 'textTransform'
|
|
24
|
+
});
|
|
22
25
|
export var lineHeight = style({
|
|
23
26
|
prop: 'lineHeight'
|
|
24
27
|
});
|
|
@@ -30,5 +33,5 @@ export var typographyVariant = style({
|
|
|
30
33
|
cssProperty: false,
|
|
31
34
|
themeKey: 'typography'
|
|
32
35
|
});
|
|
33
|
-
var typography = compose(typographyVariant, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign);
|
|
36
|
+
var typography = compose(typographyVariant, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign, textTransform);
|
|
34
37
|
export default typography;
|
package/modern/createStyled.js
CHANGED
|
@@ -136,7 +136,11 @@ export default function createStyled(input = {}) {
|
|
|
136
136
|
const styleOverrides = getStyleOverrides(componentName, theme);
|
|
137
137
|
|
|
138
138
|
if (styleOverrides) {
|
|
139
|
-
|
|
139
|
+
const resolvedStyleOverrides = {};
|
|
140
|
+
Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => {
|
|
141
|
+
resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle(props) : slotStyle;
|
|
142
|
+
});
|
|
143
|
+
return overridesResolver(props, resolvedStyleOverrides);
|
|
140
144
|
}
|
|
141
145
|
|
|
142
146
|
return null;
|
|
@@ -199,6 +203,10 @@ export default function createStyled(input = {}) {
|
|
|
199
203
|
return Component;
|
|
200
204
|
};
|
|
201
205
|
|
|
206
|
+
if (defaultStyledResolver.withConfig) {
|
|
207
|
+
muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
|
|
208
|
+
}
|
|
209
|
+
|
|
202
210
|
return muiStyledResolver;
|
|
203
211
|
};
|
|
204
212
|
}
|
package/modern/index.js
CHANGED
package/modern/typography.js
CHANGED
|
@@ -19,6 +19,9 @@ export const fontWeight = style({
|
|
|
19
19
|
export const letterSpacing = style({
|
|
20
20
|
prop: 'letterSpacing'
|
|
21
21
|
});
|
|
22
|
+
export const textTransform = style({
|
|
23
|
+
prop: 'textTransform'
|
|
24
|
+
});
|
|
22
25
|
export const lineHeight = style({
|
|
23
26
|
prop: 'lineHeight'
|
|
24
27
|
});
|
|
@@ -30,5 +33,5 @@ export const typographyVariant = style({
|
|
|
30
33
|
cssProperty: false,
|
|
31
34
|
themeKey: 'typography'
|
|
32
35
|
});
|
|
33
|
-
const typography = compose(typographyVariant, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign);
|
|
36
|
+
const typography = compose(typographyVariant, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign, textTransform);
|
|
34
37
|
export default typography;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "CSS utilities for rapidly laying out custom designs.",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@emotion/react": "^11.5.0",
|
|
30
30
|
"@emotion/styled": "^11.3.0",
|
|
31
31
|
"@types/react": "^16.8.6 || ^17.0.0",
|
|
32
|
-
"react": "^17.0.
|
|
32
|
+
"react": "^17.0.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependenciesMeta": {
|
|
35
35
|
"@types/react": {
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@babel/runtime": "^7.16.
|
|
47
|
-
"@mui/private-theming": "^5.
|
|
48
|
-
"@mui/styled-engine": "^5.
|
|
46
|
+
"@babel/runtime": "^7.16.7",
|
|
47
|
+
"@mui/private-theming": "^5.3.0",
|
|
48
|
+
"@mui/styled-engine": "^5.3.0",
|
|
49
49
|
"@mui/types": "^7.1.0",
|
|
50
|
-
"@mui/utils": "^5.
|
|
50
|
+
"@mui/utils": "^5.3.0",
|
|
51
51
|
"clsx": "^1.1.1",
|
|
52
52
|
"csstype": "^3.0.10",
|
|
53
53
|
"prop-types": "^15.7.2"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/typography.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.typographyVariant = exports.textAlign = exports.lineHeight = exports.letterSpacing = exports.fontWeight = exports.fontStyle = exports.fontSize = exports.fontFamily = exports.default = void 0;
|
|
8
|
+
exports.typographyVariant = exports.textTransform = exports.textAlign = exports.lineHeight = exports.letterSpacing = exports.fontWeight = exports.fontStyle = exports.fontSize = exports.fontFamily = exports.default = void 0;
|
|
9
9
|
|
|
10
10
|
var _style = _interopRequireDefault(require("./style"));
|
|
11
11
|
|
|
@@ -35,6 +35,10 @@ const letterSpacing = (0, _style.default)({
|
|
|
35
35
|
prop: 'letterSpacing'
|
|
36
36
|
});
|
|
37
37
|
exports.letterSpacing = letterSpacing;
|
|
38
|
+
const textTransform = (0, _style.default)({
|
|
39
|
+
prop: 'textTransform'
|
|
40
|
+
});
|
|
41
|
+
exports.textTransform = textTransform;
|
|
38
42
|
const lineHeight = (0, _style.default)({
|
|
39
43
|
prop: 'lineHeight'
|
|
40
44
|
});
|
|
@@ -49,6 +53,6 @@ const typographyVariant = (0, _style.default)({
|
|
|
49
53
|
themeKey: 'typography'
|
|
50
54
|
});
|
|
51
55
|
exports.typographyVariant = typographyVariant;
|
|
52
|
-
const typography = (0, _compose.default)(typographyVariant, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign);
|
|
56
|
+
const typography = (0, _compose.default)(typographyVariant, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign, textTransform);
|
|
53
57
|
var _default = typography;
|
|
54
58
|
exports.default = _default;
|