@mui/system 5.6.0 → 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 +195 -32
- package/ThemeProvider/ThemeProvider.d.ts +7 -1
- package/ThemeProvider/ThemeProvider.js +9 -2
- package/createBox.js +0 -26
- package/createBox.spec.d.ts +1 -1
- package/createTheme/createBreakpoints.d.ts +4 -4
- 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 +16 -1
- package/index.d.ts +4 -0
- 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 +16 -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 +16 -1
- package/package.json +5 -5
- package/spacing.js +3 -1
- package/style.js +16 -1
- package/styleFunctionSx/styleFunctionSx.d.ts +3 -1
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
|
@@ -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
|
@@ -4,9 +4,24 @@ import { handleBreakpoints } from './breakpoints';
|
|
|
4
4
|
export function getPath(obj, path) {
|
|
5
5
|
if (!path || typeof path !== 'string') {
|
|
6
6
|
return null;
|
|
7
|
+
} // Check if CSS variables are used
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if (obj && obj.vars) {
|
|
11
|
+
const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
|
|
12
|
+
|
|
13
|
+
if (val != null) {
|
|
14
|
+
return val;
|
|
15
|
+
}
|
|
7
16
|
}
|
|
8
17
|
|
|
9
|
-
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);
|
|
10
25
|
}
|
|
11
26
|
|
|
12
27
|
function getValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "CSS utilities for rapidly laying out custom designs.",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@emotion/react": "^11.5.0",
|
|
30
30
|
"@emotion/styled": "^11.3.0",
|
|
31
|
-
"@types/react": "^
|
|
31
|
+
"@types/react": "^17.0.0 || ^18.0.0",
|
|
32
32
|
"react": "^17.0.0 || ^18.0.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependenciesMeta": {
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.17.2",
|
|
47
|
-
"@mui/private-theming": "^5.6.
|
|
48
|
-
"@mui/styled-engine": "^5.6.
|
|
47
|
+
"@mui/private-theming": "^5.6.2",
|
|
48
|
+
"@mui/styled-engine": "^5.6.1",
|
|
49
49
|
"@mui/types": "^7.1.3",
|
|
50
|
-
"@mui/utils": "^5.6.
|
|
50
|
+
"@mui/utils": "^5.6.1",
|
|
51
51
|
"clsx": "^1.1.1",
|
|
52
52
|
"csstype": "^3.0.11",
|
|
53
53
|
"prop-types": "^15.7.2"
|
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
|
@@ -17,9 +17,24 @@ var _breakpoints = require("./breakpoints");
|
|
|
17
17
|
function getPath(obj, path) {
|
|
18
18
|
if (!path || typeof path !== 'string') {
|
|
19
19
|
return null;
|
|
20
|
+
} // Check if CSS variables are used
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if (obj && obj.vars) {
|
|
24
|
+
const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
|
|
25
|
+
|
|
26
|
+
if (val != null) {
|
|
27
|
+
return val;
|
|
28
|
+
}
|
|
20
29
|
}
|
|
21
30
|
|
|
22
|
-
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);
|
|
23
38
|
}
|
|
24
39
|
|
|
25
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 {};
|