@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.
Files changed (41) hide show
  1. package/Box/Box.d.ts +18 -1
  2. package/Box/Box.js +26 -0
  3. package/Box/Box.spec.d.ts +1 -1
  4. package/CHANGELOG.md +195 -32
  5. package/ThemeProvider/ThemeProvider.d.ts +7 -1
  6. package/ThemeProvider/ThemeProvider.js +9 -2
  7. package/createBox.js +0 -26
  8. package/createBox.spec.d.ts +1 -1
  9. package/createTheme/createBreakpoints.d.ts +4 -4
  10. package/createTheme/createSpacing.d.ts +10 -10
  11. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  12. package/cssVars/createGetCssVar.d.ts +5 -5
  13. package/cssVars/cssVarsParser.d.ts +70 -70
  14. package/cssVars/getInitColorSchemeScript.d.ts +12 -12
  15. package/cssVars/index.d.ts +2 -2
  16. package/cssVars/useCurrentColorScheme.d.ts +50 -50
  17. package/esm/Box/Box.js +25 -0
  18. package/esm/ThemeProvider/ThemeProvider.js +9 -2
  19. package/esm/createBox.js +0 -25
  20. package/esm/spacing.js +3 -1
  21. package/esm/style.js +16 -1
  22. package/index.d.ts +4 -0
  23. package/index.js +1 -1
  24. package/index.spec.d.ts +1 -1
  25. package/legacy/Box/Box.js +25 -0
  26. package/legacy/ThemeProvider/ThemeProvider.js +9 -2
  27. package/legacy/createBox.js +0 -25
  28. package/legacy/index.js +1 -1
  29. package/legacy/spacing.js +3 -1
  30. package/legacy/style.js +16 -1
  31. package/modern/Box/Box.js +25 -0
  32. package/modern/ThemeProvider/ThemeProvider.js +9 -2
  33. package/modern/createBox.js +0 -25
  34. package/modern/index.js +1 -1
  35. package/modern/spacing.js +1 -1
  36. package/modern/style.js +16 -1
  37. package/package.json +5 -5
  38. package/spacing.js +3 -1
  39. package/style.js +16 -1
  40. package/styleFunctionSx/styleFunctionSx.d.ts +3 -1
  41. 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.object, PropTypes.func]).isRequired
57
+ theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired
51
58
  } : void 0;
52
59
 
53
60
  if (process.env.NODE_ENV !== 'production') {
@@ -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
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.6.0
1
+ /** @license MUI v5.6.3
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/modern/spacing.js CHANGED
@@ -43,7 +43,7 @@ const marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTo
43
43
  const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
44
44
  const spacingKeys = [...marginKeys, ...paddingKeys];
45
45
  export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
46
- const themeSpacing = getPath(theme, themeKey) || defaultValue;
46
+ const themeSpacing = getPath(theme, themeKey) ?? 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) => acc && acc[item] ? acc[item] : null, obj);
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.0",
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": "^16.8.6 || ^17.0.0 || ^18.0.0",
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.0",
48
- "@mui/styled-engine": "^5.6.0",
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.0",
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
- const themeSpacing = (0, _style.getPath)(theme, themeKey) || defaultValue;
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) => acc && acc[item] ? acc[item] : null, obj);
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
- | Array<boolean | SystemStyleObject<Theme> | ((theme: Theme) => SystemStyleObject<Theme>)>;
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 {};