@mui/system 5.14.3 → 5.14.4

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 +20 -9
  2. package/CHANGELOG.md +102 -4
  3. package/Container/Container.d.ts +13 -13
  4. package/Container/ContainerProps.d.ts +40 -40
  5. package/Container/containerClasses.d.ts +22 -22
  6. package/Container/createContainer.d.ts +18 -18
  7. package/GlobalStyles/GlobalStyles.d.ts +13 -13
  8. package/GlobalStyles/index.d.ts +2 -2
  9. package/Stack/Stack.d.ts +14 -14
  10. package/Stack/StackProps.d.ts +53 -53
  11. package/Stack/createStack.d.ts +21 -21
  12. package/Stack/index.d.ts +5 -5
  13. package/Stack/stackClasses.d.ts +8 -8
  14. package/Unstable_Grid/Grid.d.ts +12 -12
  15. package/Unstable_Grid/GridProps.d.ts +185 -185
  16. package/Unstable_Grid/createGrid.d.ts +11 -11
  17. package/Unstable_Grid/gridClasses.d.ts +20 -20
  18. package/Unstable_Grid/gridGenerator.d.ts +33 -33
  19. package/Unstable_Grid/index.d.ts +6 -6
  20. package/Unstable_Grid/traverseBreakpoints.d.ts +7 -7
  21. package/createStyled.d.ts +6 -6
  22. package/createStyled.js +23 -4
  23. package/createTheme/createSpacing.d.ts +10 -10
  24. package/cssVars/createCssVarsTheme.d.ts +15 -15
  25. package/cssVars/createGetCssVar.d.ts +5 -5
  26. package/cssVars/cssVarsParser.d.ts +64 -64
  27. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  28. package/cssVars/index.d.ts +5 -5
  29. package/cssVars/prepareCssVars.d.ts +16 -16
  30. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  31. package/esm/createStyled.js +24 -5
  32. package/esm/styleFunctionSx/styleFunctionSx.js +2 -0
  33. package/index.js +1 -1
  34. package/legacy/createStyled.js +25 -5
  35. package/legacy/index.js +1 -1
  36. package/legacy/styleFunctionSx/styleFunctionSx.js +2 -0
  37. package/modern/createStyled.js +24 -5
  38. package/modern/index.js +1 -1
  39. package/modern/styleFunctionSx/styleFunctionSx.js +2 -0
  40. package/package.json +3 -3
  41. package/styleFunctionSx/styleFunctionSx.js +2 -0
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
4
4
  /* eslint-disable no-underscore-dangle */
5
5
  import styledEngineStyled, { internal_processStyles as processStyles } from '@mui/styled-engine';
6
- import { getDisplayName } from '@mui/utils';
6
+ import { getDisplayName, unstable_capitalize as capitalize } from '@mui/utils';
7
7
  import createTheme from './createTheme';
8
8
  import propsToClassKey from './propsToClassKey';
9
9
  import styleFunctionSx from './styleFunctionSx';
@@ -65,6 +65,9 @@ export function shouldForwardProp(prop) {
65
65
  }
66
66
  export const systemDefaultTheme = createTheme();
67
67
  const lowercaseFirstLetter = string => {
68
+ if (!string) {
69
+ return string;
70
+ }
68
71
  return string.charAt(0).toLowerCase() + string.slice(1);
69
72
  };
70
73
  function resolveTheme({
@@ -74,6 +77,12 @@ function resolveTheme({
74
77
  }) {
75
78
  return isEmpty(theme) ? defaultTheme : theme[themeId] || theme;
76
79
  }
80
+ function defaultOverridesResolver(slot) {
81
+ if (!slot) {
82
+ return null;
83
+ }
84
+ return (props, styles) => styles[slot];
85
+ }
77
86
  export default function createStyled(input = {}) {
78
87
  const {
79
88
  themeId,
@@ -98,21 +107,31 @@ export default function createStyled(input = {}) {
98
107
  slot: componentSlot,
99
108
  skipVariantsResolver: inputSkipVariantsResolver,
100
109
  skipSx: inputSkipSx,
101
- overridesResolver
110
+ // TODO v6: remove `lowercaseFirstLetter()` in the next major release
111
+ // For more details: https://github.com/mui/material-ui/pull/37908
112
+ overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot))
102
113
  } = inputOptions,
103
114
  options = _objectWithoutPropertiesLoose(inputOptions, _excluded);
104
115
 
105
116
  // if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
106
- const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver : componentSlot && componentSlot !== 'Root' || false;
117
+ const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver :
118
+ // TODO v6: remove `Root` in the next major release
119
+ // For more details: https://github.com/mui/material-ui/pull/37908
120
+ componentSlot && componentSlot !== 'Root' && componentSlot !== 'root' || false;
107
121
  const skipSx = inputSkipSx || false;
108
122
  let label;
109
123
  if (process.env.NODE_ENV !== 'production') {
110
124
  if (componentName) {
125
+ // TODO v6: remove `lowercaseFirstLetter()` in the next major release
126
+ // For more details: https://github.com/mui/material-ui/pull/37908
111
127
  label = `${componentName}-${lowercaseFirstLetter(componentSlot || 'Root')}`;
112
128
  }
113
129
  }
114
130
  let shouldForwardPropOption = shouldForwardProp;
115
- if (componentSlot === 'Root') {
131
+
132
+ // TODO v6: remove `Root` in the next major release
133
+ // For more details: https://github.com/mui/material-ui/pull/37908
134
+ if (componentSlot === 'Root' || componentSlot === 'root') {
116
135
  shouldForwardPropOption = rootShouldForwardProp;
117
136
  } else if (componentSlot) {
118
137
  // any other slot specified
@@ -194,7 +213,7 @@ export default function createStyled(input = {}) {
194
213
  if (process.env.NODE_ENV !== 'production') {
195
214
  let displayName;
196
215
  if (componentName) {
197
- displayName = `${componentName}${componentSlot || ''}`;
216
+ displayName = `${componentName}${capitalize(componentSlot || '')}`;
198
217
  }
199
218
  if (displayName === undefined) {
200
219
  displayName = `Styled(${getDisplayName(tag)})`;
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.14.3
2
+ * @mui/system v5.14.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -34,6 +34,8 @@ export function unstable_createStyleFunctionSx() {
34
34
  if (val == null) {
35
35
  return null;
36
36
  }
37
+
38
+ // TODO v6: remove, see https://github.com/mui/material-ui/pull/38123
37
39
  if (themeKey === 'typography' && val === 'inherit') {
38
40
  return {
39
41
  [prop]: val
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/system",
3
- "version": "5.14.3",
3
+ "version": "5.14.4",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "CSS utilities for rapidly laying out custom designs.",
@@ -44,10 +44,10 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@babel/runtime": "^7.22.6",
47
- "@mui/private-theming": "^5.13.7",
47
+ "@mui/private-theming": "^5.14.4",
48
48
  "@mui/styled-engine": "^5.13.2",
49
49
  "@mui/types": "^7.2.4",
50
- "@mui/utils": "^5.14.3",
50
+ "@mui/utils": "^5.14.4",
51
51
  "clsx": "^2.0.0",
52
52
  "csstype": "^3.1.2",
53
53
  "prop-types": "^15.8.1"
@@ -42,6 +42,8 @@ function unstable_createStyleFunctionSx() {
42
42
  if (val == null) {
43
43
  return null;
44
44
  }
45
+
46
+ // TODO v6: remove, see https://github.com/mui/material-ui/pull/38123
45
47
  if (themeKey === 'typography' && val === 'inherit') {
46
48
  return {
47
49
  [prop]: val