@mui/system 5.6.2 → 5.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Box/Box.d.ts +18 -1
- package/Box/Box.js +26 -0
- package/Box/Box.spec.d.ts +1 -1
- package/CHANGELOG.md +59 -0
- package/ThemeProvider/ThemeProvider.d.ts +6 -0
- package/ThemeProvider/ThemeProvider.js +9 -2
- package/createBox.js +0 -26
- package/createBox.spec.d.ts +1 -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 +70 -70
- package/cssVars/getInitColorSchemeScript.d.ts +12 -12
- package/cssVars/index.d.ts +2 -2
- package/cssVars/useCurrentColorScheme.d.ts +50 -50
- package/esm/Box/Box.js +25 -0
- package/esm/ThemeProvider/ThemeProvider.js +9 -2
- package/esm/createBox.js +0 -25
- package/esm/spacing.js +3 -1
- package/esm/style.js +7 -1
- package/index.js +1 -1
- package/index.spec.d.ts +1 -1
- package/legacy/Box/Box.js +25 -0
- package/legacy/ThemeProvider/ThemeProvider.js +9 -2
- package/legacy/createBox.js +0 -25
- package/legacy/index.js +1 -1
- package/legacy/spacing.js +3 -1
- package/legacy/style.js +5 -1
- package/modern/Box/Box.js +25 -0
- package/modern/ThemeProvider/ThemeProvider.js +9 -2
- package/modern/createBox.js +0 -25
- package/modern/index.js +1 -1
- package/modern/spacing.js +1 -1
- package/modern/style.js +7 -1
- package/package.json +1 -1
- package/spacing.js +3 -1
- package/style.js +7 -1
- package/styleFunctionSx/styleFunctionSx.d.ts +3 -1
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
package/Box/Box.d.ts
CHANGED
|
@@ -174,13 +174,30 @@ export interface BoxTypeMap<P = {}, D extends React.ElementType = 'div'> {
|
|
|
174
174
|
props: P &
|
|
175
175
|
SystemProps<Theme> & {
|
|
176
176
|
children?: React.ReactNode;
|
|
177
|
+
/**
|
|
178
|
+
* The component used for the root node.
|
|
179
|
+
* Either a string to use a HTML element or a component.
|
|
180
|
+
*/
|
|
177
181
|
component?: React.ElementType;
|
|
178
182
|
ref?: React.Ref<unknown>;
|
|
183
|
+
/**
|
|
184
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
185
|
+
*/
|
|
179
186
|
sx?: SxProps<Theme>;
|
|
180
187
|
};
|
|
181
188
|
defaultComponent: D;
|
|
182
189
|
}
|
|
183
|
-
|
|
190
|
+
/**
|
|
191
|
+
*
|
|
192
|
+
* Demos:
|
|
193
|
+
*
|
|
194
|
+
* - [Box (Material UI)](https://mui.com/material-ui/react-box/)
|
|
195
|
+
* - [Box (MUI System)](https://mui.com/system/react-box/)
|
|
196
|
+
*
|
|
197
|
+
* API:
|
|
198
|
+
*
|
|
199
|
+
* - [Box API](https://mui.com/system/api/box/)
|
|
200
|
+
*/
|
|
184
201
|
declare const Box: OverridableComponent<BoxTypeMap>;
|
|
185
202
|
|
|
186
203
|
export type BoxProps<
|
package/Box/Box.js
CHANGED
|
@@ -7,8 +7,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
10
12
|
var _createBox = _interopRequireDefault(require("../createBox"));
|
|
11
13
|
|
|
12
14
|
const Box = (0, _createBox.default)();
|
|
15
|
+
process.env.NODE_ENV !== "production" ? Box.propTypes
|
|
16
|
+
/* remove-proptypes */
|
|
17
|
+
= {
|
|
18
|
+
// ----------------------------- Warning --------------------------------
|
|
19
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
20
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
21
|
+
// ----------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
children: _propTypes.default.node,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The component used for the root node.
|
|
30
|
+
* Either a string to use a HTML element or a component.
|
|
31
|
+
*/
|
|
32
|
+
component: _propTypes.default.elementType,
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
36
|
+
*/
|
|
37
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
|
|
38
|
+
} : void 0;
|
|
13
39
|
var _default = Box;
|
|
14
40
|
exports.default = _default;
|
package/Box/Box.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,64 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 5.6.3
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.6.2..master -->
|
|
6
|
+
|
|
7
|
+
_Apr 25, 2022_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- 🛠 Fixed TypeScript issue when the `fill` CSS property is used in the system (#32355) @valerii15298
|
|
12
|
+
- And more 🐛 bug fixes and 📚 improvements.
|
|
13
|
+
|
|
14
|
+
### `@mui/material@5.6.3`
|
|
15
|
+
|
|
16
|
+
- [BottomNavigation] Action icon `padding` fix (#32030) @abhinav-22-tech
|
|
17
|
+
- [Dialog] Fix `component` prop is not available in `DialogTitleProps` (#32389) @hbjORbj
|
|
18
|
+
- [StepContent] Fix TypeScript type of `TransitionComponent` prop (#32314) @ZeeshanTamboli
|
|
19
|
+
|
|
20
|
+
### `@mui/system@5.6.3`
|
|
21
|
+
|
|
22
|
+
- [system] Fix prop types when the `fill` CSS property is used (#32355) @valerii15298
|
|
23
|
+
- [system] Fix broken behavior when theme value is `zero` (#32365) @ZeeshanTamboli
|
|
24
|
+
|
|
25
|
+
### `@mui/base@5.0.0-alpha.78`
|
|
26
|
+
|
|
27
|
+
- [InputUnstyled] `multiline` property should not log DOM warnings for `maxRows` and `minRows` props (#32401) @ZeeshanTamboli
|
|
28
|
+
|
|
29
|
+
### `@mui/joy@5.0.0-alpha.25`
|
|
30
|
+
|
|
31
|
+
- [Joy] Improve theme focus to be more flexible (#32405) @siriwatknp
|
|
32
|
+
- [Joy] Add `Radio`, `RadioGroup` components (#32279) @siriwatknp
|
|
33
|
+
- [Joy] Add `Chip` component (#31983) @hbjORbj
|
|
34
|
+
- [Joy] Improve controls (#32267) @siriwatknp
|
|
35
|
+
- [Joy] Set up docs (#32370) @siriwatknp
|
|
36
|
+
|
|
37
|
+
### Docs
|
|
38
|
+
|
|
39
|
+
- [docs] Enable row reordering on the pricing page (#31875) @DanailH
|
|
40
|
+
- [blog] A few improvements on date picker change (#32325) @oliviertassinari
|
|
41
|
+
- [docs] Emphasize how to avoid failing tests when migrating from v4 to v5 (#32159) @dwjohnston
|
|
42
|
+
- [docs] Revise the related projects page (#32180) @danilo-leal
|
|
43
|
+
- [docs] Cleanup remaining @mui/styles usages (#32313) @mnajdova
|
|
44
|
+
- [docs] Fix sidenav mobile color (#32324) @oliviertassinari
|
|
45
|
+
- [docs] Base TrapFocus style revisions and final review (#32364) @samuelsycamore
|
|
46
|
+
- [docs] Update the README.md to better cover the different products (#32360) @samuelsycamore
|
|
47
|
+
- [docs] Improve the propTypes generation and API demos' links (#32295) @mnajdova
|
|
48
|
+
- [docs] Add ability to display a plan icon next to a page link in nav bar (#32393) @flaviendelangle
|
|
49
|
+
- [docs] Change label on `FormControlLabelPlacement` (#32322) @ainatenhi
|
|
50
|
+
- [website] Update Diamond sponsors list (#32433) @oliviertassinari
|
|
51
|
+
- [website] Add privacy policy link to website's footer (#32080) @danilo-leal
|
|
52
|
+
- [website] Remove the designer role (#32384) @danilo-leal
|
|
53
|
+
|
|
54
|
+
### Core
|
|
55
|
+
|
|
56
|
+
- [core] `yarn prettier` write @oliviertassinari
|
|
57
|
+
- [core] Fix changelog warning message (#32240) @praveen001
|
|
58
|
+
- [core] Update the proptypes scripts to support components in @mui/system (#32456) @mnajdova
|
|
59
|
+
|
|
60
|
+
All contributors of this release in alphabetical order: @abhinav-22-tech, @ainatenhi, @DanailH, @danilo-leal, @dwjohnston, @flaviendelangle, @hbjORbj, @mnajdova, @oliviertassinari, @praveen001, @samuelsycamore, @siriwatknp, @valerii15298, @ZeeshanTamboli
|
|
61
|
+
|
|
3
62
|
## 5.6.2
|
|
4
63
|
|
|
5
64
|
<!-- generated comparing v5.6.1..master -->
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { DefaultTheme } from '@mui/private-theming';
|
|
2
2
|
|
|
3
3
|
export interface ThemeProviderProps<Theme = DefaultTheme> {
|
|
4
|
+
/**
|
|
5
|
+
* Your component tree.
|
|
6
|
+
*/
|
|
4
7
|
children?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* A theme object. You can provide a function to extend the outer theme.
|
|
10
|
+
*/
|
|
5
11
|
theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
|
|
6
12
|
}
|
|
7
13
|
|
|
@@ -57,7 +57,14 @@ function ThemeProvider(props) {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
|
|
60
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
|
|
61
|
+
/* remove-proptypes */
|
|
62
|
+
= {
|
|
63
|
+
// ----------------------------- Warning --------------------------------
|
|
64
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
65
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
66
|
+
// ----------------------------------------------------------------------
|
|
67
|
+
|
|
61
68
|
/**
|
|
62
69
|
* Your component tree.
|
|
63
70
|
*/
|
|
@@ -66,7 +73,7 @@ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
|
|
66
73
|
/**
|
|
67
74
|
* A theme object. You can provide a function to extend the outer theme.
|
|
68
75
|
*/
|
|
69
|
-
theme: _propTypes.default.oneOfType([_propTypes.default.
|
|
76
|
+
theme: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]).isRequired
|
|
70
77
|
} : void 0;
|
|
71
78
|
|
|
72
79
|
if (process.env.NODE_ENV !== 'production') {
|
package/createBox.js
CHANGED
|
@@ -13,8 +13,6 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
13
13
|
|
|
14
14
|
var React = _interopRequireWildcard(require("react"));
|
|
15
15
|
|
|
16
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
|
|
18
16
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
19
17
|
|
|
20
18
|
var _styledEngine = _interopRequireDefault(require("@mui/styled-engine"));
|
|
@@ -56,29 +54,5 @@ function createBox(options = {}) {
|
|
|
56
54
|
theme: theme
|
|
57
55
|
}, other));
|
|
58
56
|
});
|
|
59
|
-
process.env.NODE_ENV !== "production" ? Box.propTypes
|
|
60
|
-
/* remove-proptypes */
|
|
61
|
-
= {
|
|
62
|
-
// ----------------------------- Warning --------------------------------
|
|
63
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
64
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
65
|
-
// ----------------------------------------------------------------------
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @ignore
|
|
69
|
-
*/
|
|
70
|
-
children: _propTypes.default.node,
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* The component used for the root node.
|
|
74
|
-
* Either a string to use a HTML element or a component.
|
|
75
|
-
*/
|
|
76
|
-
component: _propTypes.default.elementType,
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @ignore
|
|
80
|
-
*/
|
|
81
|
-
sx: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.array, _propTypes.default.func])
|
|
82
|
-
} : void 0;
|
|
83
57
|
return Box;
|
|
84
58
|
}
|
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;
|
|
@@ -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) => 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
|
-
* 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) => 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
|
+
* 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,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 { CreateCssVarsProviderResult } from './createCssVarsProvider';
|
|
1
|
+
export { default } from './createCssVarsProvider';
|
|
2
|
+
export type { CreateCssVarsProviderResult } 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/Box/Box.js
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
1
2
|
import createBox from '../createBox';
|
|
2
3
|
const Box = createBox();
|
|
4
|
+
process.env.NODE_ENV !== "production" ? Box.propTypes
|
|
5
|
+
/* remove-proptypes */
|
|
6
|
+
= {
|
|
7
|
+
// ----------------------------- Warning --------------------------------
|
|
8
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
9
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
10
|
+
// ----------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @ignore
|
|
14
|
+
*/
|
|
15
|
+
children: PropTypes.node,
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The component used for the root node.
|
|
19
|
+
* Either a string to use a HTML element or a component.
|
|
20
|
+
*/
|
|
21
|
+
component: PropTypes.elementType,
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
25
|
+
*/
|
|
26
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
27
|
+
} : void 0;
|
|
3
28
|
export default Box;
|
|
@@ -38,7 +38,14 @@ function ThemeProvider(props) {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
|
|
41
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
|
|
42
|
+
/* remove-proptypes */
|
|
43
|
+
= {
|
|
44
|
+
// ----------------------------- Warning --------------------------------
|
|
45
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
46
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
47
|
+
// ----------------------------------------------------------------------
|
|
48
|
+
|
|
42
49
|
/**
|
|
43
50
|
* Your component tree.
|
|
44
51
|
*/
|
|
@@ -47,7 +54,7 @@ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
|
|
47
54
|
/**
|
|
48
55
|
* A theme object. You can provide a function to extend the outer theme.
|
|
49
56
|
*/
|
|
50
|
-
theme: PropTypes.oneOfType([PropTypes.
|
|
57
|
+
theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired
|
|
51
58
|
} : void 0;
|
|
52
59
|
|
|
53
60
|
if (process.env.NODE_ENV !== 'production') {
|
package/esm/createBox.js
CHANGED
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["className", "component"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import clsx from 'clsx';
|
|
7
6
|
import styled from '@mui/styled-engine';
|
|
8
7
|
import defaultStyleFunctionSx, { extendSxProp } from './styleFunctionSx';
|
|
@@ -33,29 +32,5 @@ export default function createBox(options = {}) {
|
|
|
33
32
|
theme: theme
|
|
34
33
|
}, other));
|
|
35
34
|
});
|
|
36
|
-
process.env.NODE_ENV !== "production" ? Box.propTypes
|
|
37
|
-
/* remove-proptypes */
|
|
38
|
-
= {
|
|
39
|
-
// ----------------------------- Warning --------------------------------
|
|
40
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
41
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
42
|
-
// ----------------------------------------------------------------------
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @ignore
|
|
46
|
-
*/
|
|
47
|
-
children: PropTypes.node,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The component used for the root node.
|
|
51
|
-
* Either a string to use a HTML element or a component.
|
|
52
|
-
*/
|
|
53
|
-
component: PropTypes.elementType,
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @ignore
|
|
57
|
-
*/
|
|
58
|
-
sx: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.func])
|
|
59
|
-
} : void 0;
|
|
60
35
|
return Box;
|
|
61
36
|
}
|
package/esm/spacing.js
CHANGED
|
@@ -43,7 +43,9 @@ 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
|
-
|
|
46
|
+
var _getPath;
|
|
47
|
+
|
|
48
|
+
const themeSpacing = (_getPath = getPath(theme, themeKey)) != null ? _getPath : defaultValue;
|
|
47
49
|
|
|
48
50
|
if (typeof themeSpacing === 'number') {
|
|
49
51
|
return abs => {
|
package/esm/style.js
CHANGED
|
@@ -15,7 +15,13 @@ export function getPath(obj, path) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
return path.split('.').reduce((acc, item) =>
|
|
18
|
+
return path.split('.').reduce((acc, item) => {
|
|
19
|
+
if (acc && acc[item] != null) {
|
|
20
|
+
return acc[item];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return null;
|
|
24
|
+
}, obj);
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
function getValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
|
package/index.js
CHANGED
package/index.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/legacy/Box/Box.js
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
1
2
|
import createBox from '../createBox';
|
|
2
3
|
var Box = createBox();
|
|
4
|
+
process.env.NODE_ENV !== "production" ? Box.propTypes
|
|
5
|
+
/* remove-proptypes */
|
|
6
|
+
= {
|
|
7
|
+
// ----------------------------- Warning --------------------------------
|
|
8
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
9
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
10
|
+
// ----------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @ignore
|
|
14
|
+
*/
|
|
15
|
+
children: PropTypes.node,
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The component used for the root node.
|
|
19
|
+
* Either a string to use a HTML element or a component.
|
|
20
|
+
*/
|
|
21
|
+
component: PropTypes.elementType,
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
25
|
+
*/
|
|
26
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
27
|
+
} : void 0;
|
|
3
28
|
export default Box;
|
|
@@ -37,7 +37,14 @@ function ThemeProvider(props) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
|
|
40
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
|
|
41
|
+
/* remove-proptypes */
|
|
42
|
+
= {
|
|
43
|
+
// ----------------------------- Warning --------------------------------
|
|
44
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
45
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
46
|
+
// ----------------------------------------------------------------------
|
|
47
|
+
|
|
41
48
|
/**
|
|
42
49
|
* Your component tree.
|
|
43
50
|
*/
|
|
@@ -46,7 +53,7 @@ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
|
|
46
53
|
/**
|
|
47
54
|
* A theme object. You can provide a function to extend the outer theme.
|
|
48
55
|
*/
|
|
49
|
-
theme: PropTypes.oneOfType([PropTypes.
|
|
56
|
+
theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired
|
|
50
57
|
} : void 0;
|
|
51
58
|
|
|
52
59
|
if (process.env.NODE_ENV !== 'production') {
|
package/legacy/createBox.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
4
|
import clsx from 'clsx';
|
|
6
5
|
import styled from '@mui/styled-engine';
|
|
7
6
|
import defaultStyleFunctionSx, { extendSxProp } from './styleFunctionSx';
|
|
@@ -32,29 +31,5 @@ export default function createBox() {
|
|
|
32
31
|
theme: theme
|
|
33
32
|
}, other));
|
|
34
33
|
});
|
|
35
|
-
process.env.NODE_ENV !== "production" ? Box.propTypes
|
|
36
|
-
/* remove-proptypes */
|
|
37
|
-
= {
|
|
38
|
-
// ----------------------------- Warning --------------------------------
|
|
39
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
40
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
41
|
-
// ----------------------------------------------------------------------
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @ignore
|
|
45
|
-
*/
|
|
46
|
-
children: PropTypes.node,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* The component used for the root node.
|
|
50
|
-
* Either a string to use a HTML element or a component.
|
|
51
|
-
*/
|
|
52
|
-
component: PropTypes.elementType,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @ignore
|
|
56
|
-
*/
|
|
57
|
-
sx: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.func])
|
|
58
|
-
} : void 0;
|
|
59
34
|
return Box;
|
|
60
35
|
}
|
package/legacy/index.js
CHANGED
package/legacy/spacing.js
CHANGED
|
@@ -50,7 +50,9 @@ var marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop'
|
|
|
50
50
|
var paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
|
|
51
51
|
var spacingKeys = [].concat(marginKeys, paddingKeys);
|
|
52
52
|
export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
53
|
-
var
|
|
53
|
+
var _getPath;
|
|
54
|
+
|
|
55
|
+
var themeSpacing = (_getPath = getPath(theme, themeKey)) != null ? _getPath : defaultValue;
|
|
54
56
|
|
|
55
57
|
if (typeof themeSpacing === 'number') {
|
|
56
58
|
return function (abs) {
|
package/legacy/style.js
CHANGED
package/modern/Box/Box.js
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
1
2
|
import createBox from '../createBox';
|
|
2
3
|
const Box = createBox();
|
|
4
|
+
process.env.NODE_ENV !== "production" ? Box.propTypes
|
|
5
|
+
/* remove-proptypes */
|
|
6
|
+
= {
|
|
7
|
+
// ----------------------------- Warning --------------------------------
|
|
8
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
9
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
10
|
+
// ----------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @ignore
|
|
14
|
+
*/
|
|
15
|
+
children: PropTypes.node,
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The component used for the root node.
|
|
19
|
+
* Either a string to use a HTML element or a component.
|
|
20
|
+
*/
|
|
21
|
+
component: PropTypes.elementType,
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
25
|
+
*/
|
|
26
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
27
|
+
} : void 0;
|
|
3
28
|
export default Box;
|
|
@@ -38,7 +38,14 @@ function ThemeProvider(props) {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
|
|
41
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
|
|
42
|
+
/* remove-proptypes */
|
|
43
|
+
= {
|
|
44
|
+
// ----------------------------- Warning --------------------------------
|
|
45
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
46
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
47
|
+
// ----------------------------------------------------------------------
|
|
48
|
+
|
|
42
49
|
/**
|
|
43
50
|
* Your component tree.
|
|
44
51
|
*/
|
|
@@ -47,7 +54,7 @@ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
|
|
47
54
|
/**
|
|
48
55
|
* A theme object. You can provide a function to extend the outer theme.
|
|
49
56
|
*/
|
|
50
|
-
theme: PropTypes.oneOfType([PropTypes.
|
|
57
|
+
theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired
|
|
51
58
|
} : void 0;
|
|
52
59
|
|
|
53
60
|
if (process.env.NODE_ENV !== 'production') {
|
package/modern/createBox.js
CHANGED
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["className", "component"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import clsx from 'clsx';
|
|
7
6
|
import styled from '@mui/styled-engine';
|
|
8
7
|
import defaultStyleFunctionSx, { extendSxProp } from './styleFunctionSx';
|
|
@@ -33,29 +32,5 @@ export default function createBox(options = {}) {
|
|
|
33
32
|
theme: theme
|
|
34
33
|
}, other));
|
|
35
34
|
});
|
|
36
|
-
process.env.NODE_ENV !== "production" ? Box.propTypes
|
|
37
|
-
/* remove-proptypes */
|
|
38
|
-
= {
|
|
39
|
-
// ----------------------------- Warning --------------------------------
|
|
40
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
41
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
42
|
-
// ----------------------------------------------------------------------
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @ignore
|
|
46
|
-
*/
|
|
47
|
-
children: PropTypes.node,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The component used for the root node.
|
|
51
|
-
* Either a string to use a HTML element or a component.
|
|
52
|
-
*/
|
|
53
|
-
component: PropTypes.elementType,
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @ignore
|
|
57
|
-
*/
|
|
58
|
-
sx: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.func])
|
|
59
|
-
} : void 0;
|
|
60
35
|
return Box;
|
|
61
36
|
}
|
package/modern/index.js
CHANGED
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)
|
|
46
|
+
const themeSpacing = getPath(theme, themeKey) ?? defaultValue;
|
|
47
47
|
|
|
48
48
|
if (typeof themeSpacing === 'number') {
|
|
49
49
|
return abs => {
|
package/modern/style.js
CHANGED
|
@@ -15,7 +15,13 @@ export function getPath(obj, path) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
return path.split('.').reduce((acc, item) =>
|
|
18
|
+
return path.split('.').reduce((acc, item) => {
|
|
19
|
+
if (acc && acc[item] != null) {
|
|
20
|
+
return acc[item];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return null;
|
|
24
|
+
}, obj);
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
function getValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
|
package/package.json
CHANGED
package/spacing.js
CHANGED
|
@@ -64,7 +64,9 @@ const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddin
|
|
|
64
64
|
const spacingKeys = [...marginKeys, ...paddingKeys];
|
|
65
65
|
|
|
66
66
|
function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
67
|
-
|
|
67
|
+
var _getPath;
|
|
68
|
+
|
|
69
|
+
const themeSpacing = (_getPath = (0, _style.getPath)(theme, themeKey)) != null ? _getPath : defaultValue;
|
|
68
70
|
|
|
69
71
|
if (typeof themeSpacing === 'number') {
|
|
70
72
|
return abs => {
|
package/style.js
CHANGED
|
@@ -28,7 +28,13 @@ function getPath(obj, path) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
return path.split('.').reduce((acc, item) =>
|
|
31
|
+
return path.split('.').reduce((acc, item) => {
|
|
32
|
+
if (acc && acc[item] != null) {
|
|
33
|
+
return acc[item];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return null;
|
|
37
|
+
}, obj);
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
function getValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
|
|
@@ -69,7 +69,9 @@ export type SystemStyleObject<Theme extends object = {}> =
|
|
|
69
69
|
export type SxProps<Theme extends object = {}> =
|
|
70
70
|
| SystemStyleObject<Theme>
|
|
71
71
|
| ((theme: Theme) => SystemStyleObject<Theme>)
|
|
72
|
-
|
|
|
72
|
+
| ReadonlyArray<
|
|
73
|
+
boolean | SystemStyleObject<Theme> | ((theme: Theme) => SystemStyleObject<Theme>)
|
|
74
|
+
>;
|
|
73
75
|
|
|
74
76
|
export interface StyleFunctionSx {
|
|
75
77
|
(props: object): object;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|