@mui/system 5.11.13 → 5.11.15

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 (53) hide show
  1. package/Box/Box.spec.d.ts +1 -1
  2. package/CHANGELOG.md +123 -3
  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/Stack/Stack.d.ts +13 -13
  8. package/Stack/Stack.js +11 -1
  9. package/Stack/StackProps.d.ts +53 -42
  10. package/Stack/createStack.d.ts +21 -21
  11. package/Stack/createStack.js +10 -3
  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 +173 -173
  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 +38 -33
  19. package/Unstable_Grid/gridGenerator.js +24 -10
  20. package/Unstable_Grid/index.d.ts +5 -5
  21. package/createBox.spec.d.ts +1 -1
  22. package/createTheme/createSpacing.d.ts +10 -10
  23. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  24. package/cssVars/createCssVarsTheme.d.ts +13 -13
  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 +14 -14
  30. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  31. package/esm/Stack/Stack.js +11 -1
  32. package/esm/Stack/createStack.js +10 -3
  33. package/esm/Unstable_Grid/gridGenerator.js +24 -10
  34. package/esm/styleFunctionSx/defaultSxConfig.js +3 -30
  35. package/esm/styleFunctionSx/styleFunctionSx.js +5 -0
  36. package/index.js +1 -1
  37. package/index.spec.d.ts +1 -1
  38. package/legacy/Stack/Stack.js +11 -1
  39. package/legacy/Stack/createStack.js +10 -2
  40. package/legacy/Unstable_Grid/gridGenerator.js +45 -35
  41. package/legacy/index.js +1 -1
  42. package/legacy/styleFunctionSx/defaultSxConfig.js +3 -29
  43. package/legacy/styleFunctionSx/styleFunctionSx.js +7 -4
  44. package/modern/Stack/Stack.js +11 -1
  45. package/modern/Stack/createStack.js +10 -3
  46. package/modern/Unstable_Grid/gridGenerator.js +24 -10
  47. package/modern/index.js +1 -1
  48. package/modern/styleFunctionSx/defaultSxConfig.js +3 -28
  49. package/modern/styleFunctionSx/styleFunctionSx.js +5 -0
  50. package/package.json +1 -1
  51. package/styleFunctionSx/defaultSxConfig.js +3 -30
  52. package/styleFunctionSx/styleFunctionSx.js +5 -0
  53. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
@@ -44,6 +44,16 @@ process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ =
44
44
  /**
45
45
  * The system prop, which allows defining system overrides as well as additional CSS styles.
46
46
  */
47
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
47
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
48
+ /**
49
+ * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
50
+ *
51
+ * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
52
+ * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
53
+ *
54
+ * To enable this flag globally, follow the theme's default props configuration.
55
+ * @default false
56
+ */
57
+ useFlexGap: PropTypes.bool
48
58
  } : void 0;
49
59
  export default Stack;
@@ -99,6 +99,11 @@ export var style = function style(_ref) {
99
99
  });
100
100
  }
101
101
  var styleFromPropValue = function styleFromPropValue(propValue, breakpoint) {
102
+ if (ownerState.useFlexGap) {
103
+ return {
104
+ gap: getValue(transformer, propValue)
105
+ };
106
+ }
102
107
  return {
103
108
  '& > :not(style) + :not(style)': _defineProperty({
104
109
  margin: 0
@@ -141,10 +146,13 @@ export default function createStack() {
141
146
  divider = props.divider,
142
147
  children = props.children,
143
148
  className = props.className,
144
- other = _objectWithoutProperties(props, ["component", "direction", "spacing", "divider", "children", "className"]);
149
+ _props$useFlexGap = props.useFlexGap,
150
+ useFlexGap = _props$useFlexGap === void 0 ? false : _props$useFlexGap,
151
+ other = _objectWithoutProperties(props, ["component", "direction", "spacing", "divider", "children", "className", "useFlexGap"]);
145
152
  var ownerState = {
146
153
  direction: direction,
147
- spacing: spacing
154
+ spacing: spacing,
155
+ useFlexGap: useFlexGap
148
156
  };
149
157
  var classes = useUtilityClasses();
150
158
  return /*#__PURE__*/_jsx(StackRoot, _extends({
@@ -2,12 +2,18 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import _typeof from "@babel/runtime/helpers/esm/typeof";
4
4
  import _extends from "@babel/runtime/helpers/esm/extends";
5
+ function appendLevel(level) {
6
+ if (!level) {
7
+ return '';
8
+ }
9
+ return "Level".concat(level);
10
+ }
5
11
  function isNestedContainer(ownerState) {
6
12
  return ownerState.level > 0 && ownerState.container;
7
13
  }
8
14
  function createGetSelfSpacing(ownerState) {
9
15
  return function getSelfSpacing(axis) {
10
- return "var(--Grid-".concat(axis, "Spacing").concat(ownerState.level || '', ")");
16
+ return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.level), ")");
11
17
  };
12
18
  }
13
19
  function createGetParentSpacing(ownerState) {
@@ -15,9 +21,15 @@ function createGetParentSpacing(ownerState) {
15
21
  if (ownerState.level === 0) {
16
22
  return "var(--Grid-".concat(axis, "Spacing)");
17
23
  }
18
- return "var(--Grid-".concat(axis, "Spacing").concat(ownerState.level - 1 || '', ")");
24
+ return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.level - 1), ")");
19
25
  };
20
26
  }
27
+ function getParentColumns(ownerState) {
28
+ if (ownerState.level === 0) {
29
+ return "var(--Grid-columns)";
30
+ }
31
+ return "var(--Grid-columns".concat(appendLevel(ownerState.level - 1), ")");
32
+ }
21
33
  export var filterBreakpointKeys = function filterBreakpointKeys(breakpointsKeys, responsiveKeys) {
22
34
  return breakpointsKeys.filter(function (key) {
23
35
  return responsiveKeys.includes(key);
@@ -91,7 +103,7 @@ export var generateGridSizeStyles = function generateGridSizeStyles(_ref) {
91
103
  style = {
92
104
  flexGrow: 0,
93
105
  flexBasis: 'auto',
94
- width: "calc(100% * ".concat(value, " / var(--Grid-columns)").concat(isNestedContainer(ownerState) ? " + ".concat(getSelfSpacing('column')) : '', ")")
106
+ width: "calc(100% * ".concat(value, " / ").concat(getParentColumns(ownerState)).concat(isNestedContainer(ownerState) ? " + ".concat(getSelfSpacing('column')) : '', ")")
95
107
  };
96
108
  }
97
109
  appendStyle(styles, style);
@@ -111,7 +123,7 @@ export var generateGridOffsetStyles = function generateGridOffsetStyles(_ref2) {
111
123
  }
112
124
  if (typeof value === 'number') {
113
125
  style = {
114
- marginLeft: value === 0 ? '0px' : "calc(100% * ".concat(value, " / var(--Grid-columns))")
126
+ marginLeft: value === 0 ? '0px' : "calc(100% * ".concat(value, " / ").concat(getParentColumns(ownerState), ")")
115
127
  };
116
128
  }
117
129
  appendStyle(styles, style);
@@ -124,47 +136,45 @@ export var generateGridColumnsStyles = function generateGridColumnsStyles(_ref3)
124
136
  if (!ownerState.container) {
125
137
  return {};
126
138
  }
127
- var styles = {
139
+ var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.level)), getParentColumns(ownerState)) : {
128
140
  '--Grid-columns': 12
129
141
  };
130
142
  traverseBreakpoints(theme.breakpoints, ownerState.columns, function (appendStyle, value) {
131
- appendStyle(styles, {
132
- '--Grid-columns': value
133
- });
143
+ appendStyle(styles, _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.level)), value));
134
144
  });
135
145
  return styles;
136
146
  };
137
- export var generateGridRowSpacingStyles = function generateGridRowSpacingStyles(_ref4) {
138
- var theme = _ref4.theme,
139
- ownerState = _ref4.ownerState;
147
+ export var generateGridRowSpacingStyles = function generateGridRowSpacingStyles(_ref5) {
148
+ var theme = _ref5.theme,
149
+ ownerState = _ref5.ownerState;
140
150
  if (!ownerState.container) {
141
151
  return {};
142
152
  }
143
153
  var getParentSpacing = createGetParentSpacing(ownerState);
144
- var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-rowSpacing".concat(ownerState.level || ''), getParentSpacing('row')) : {};
154
+ var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.level)), getParentSpacing('row')) : {};
145
155
  traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, function (appendStyle, value) {
146
156
  var _theme$spacing;
147
- appendStyle(styles, _defineProperty({}, "--Grid-rowSpacing".concat(ownerState.level || ''), typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)));
157
+ appendStyle(styles, _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.level)), typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)));
148
158
  });
149
159
  return styles;
150
160
  };
151
- export var generateGridColumnSpacingStyles = function generateGridColumnSpacingStyles(_ref6) {
152
- var theme = _ref6.theme,
153
- ownerState = _ref6.ownerState;
161
+ export var generateGridColumnSpacingStyles = function generateGridColumnSpacingStyles(_ref7) {
162
+ var theme = _ref7.theme,
163
+ ownerState = _ref7.ownerState;
154
164
  if (!ownerState.container) {
155
165
  return {};
156
166
  }
157
167
  var getParentSpacing = createGetParentSpacing(ownerState);
158
- var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columnSpacing".concat(ownerState.level || ''), getParentSpacing('column')) : {};
168
+ var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.level)), getParentSpacing('column')) : {};
159
169
  traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, function (appendStyle, value) {
160
170
  var _theme$spacing2;
161
- appendStyle(styles, _defineProperty({}, "--Grid-columnSpacing".concat(ownerState.level || ''), typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)));
171
+ appendStyle(styles, _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.level)), typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)));
162
172
  });
163
173
  return styles;
164
174
  };
165
- export var generateGridDirectionStyles = function generateGridDirectionStyles(_ref8) {
166
- var theme = _ref8.theme,
167
- ownerState = _ref8.ownerState;
175
+ export var generateGridDirectionStyles = function generateGridDirectionStyles(_ref9) {
176
+ var theme = _ref9.theme,
177
+ ownerState = _ref9.ownerState;
168
178
  if (!ownerState.container) {
169
179
  return {};
170
180
  }
@@ -176,8 +186,8 @@ export var generateGridDirectionStyles = function generateGridDirectionStyles(_r
176
186
  });
177
187
  return styles;
178
188
  };
179
- export var generateGridStyles = function generateGridStyles(_ref9) {
180
- var ownerState = _ref9.ownerState;
189
+ export var generateGridStyles = function generateGridStyles(_ref10) {
190
+ var ownerState = _ref10.ownerState;
181
191
  var getSelfSpacing = createGetSelfSpacing(ownerState);
182
192
  var getParentSpacing = createGetParentSpacing(ownerState);
183
193
  return _extends({
@@ -200,10 +210,10 @@ export var generateGridStyles = function generateGridStyles(_ref9) {
200
210
  };
201
211
  export var generateSizeClassNames = function generateSizeClassNames(gridSize) {
202
212
  var classNames = [];
203
- Object.entries(gridSize).forEach(function (_ref10) {
204
- var _ref11 = _slicedToArray(_ref10, 2),
205
- key = _ref11[0],
206
- value = _ref11[1];
213
+ Object.entries(gridSize).forEach(function (_ref11) {
214
+ var _ref12 = _slicedToArray(_ref11, 2),
215
+ key = _ref12[0],
216
+ value = _ref12[1];
207
217
  if (value !== false && value !== undefined) {
208
218
  classNames.push("grid-".concat(key, "-").concat(String(value)));
209
219
  }
@@ -223,10 +233,10 @@ export var generateSpacingClassNames = function generateSpacingClassNames(spacin
223
233
  }
224
234
  if (_typeof(spacing) === 'object' && !Array.isArray(spacing)) {
225
235
  var classNames = [];
226
- Object.entries(spacing).forEach(function (_ref12) {
227
- var _ref13 = _slicedToArray(_ref12, 2),
228
- key = _ref13[0],
229
- value = _ref13[1];
236
+ Object.entries(spacing).forEach(function (_ref13) {
237
+ var _ref14 = _slicedToArray(_ref13, 2),
238
+ key = _ref14[0],
239
+ value = _ref14[1];
230
240
  if (isValidSpacing(value)) {
231
241
  classNames.push("spacing-".concat(key, "-").concat(String(value)));
232
242
  }
@@ -240,10 +250,10 @@ export var generateDirectionClasses = function generateDirectionClasses(directio
240
250
  return [];
241
251
  }
242
252
  if (_typeof(direction) === 'object') {
243
- return Object.entries(direction).map(function (_ref14) {
244
- var _ref15 = _slicedToArray(_ref14, 2),
245
- key = _ref15[0],
246
- value = _ref15[1];
253
+ return Object.entries(direction).map(function (_ref15) {
254
+ var _ref16 = _slicedToArray(_ref15, 2),
255
+ key = _ref16[0],
256
+ value = _ref16[1];
247
257
  return "direction-".concat(key, "-").concat(value);
248
258
  });
249
259
  }
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.11.13
2
+ * @mui/system v5.11.15
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,31 +1,8 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { unstable_capitalize as capitalize } from '@mui/utils';
3
1
  import { padding, margin } from '../spacing';
4
- import { handleBreakpoints } from '../breakpoints';
5
2
  import { borderRadius, borderTransform } from '../borders';
6
3
  import { gap, rowGap, columnGap } from '../cssGrid';
7
4
  import { paletteTransform } from '../palette';
8
5
  import { maxWidth, sizingTransform } from '../sizing';
9
- var createFontStyleFunction = function createFontStyleFunction(prop) {
10
- return function (props) {
11
- if (props[prop] !== undefined && props[prop] !== null) {
12
- var styleFromPropValue = function styleFromPropValue(propValue) {
13
- var _props$theme$typograp, _props$prop;
14
- var value = (_props$theme$typograp = props.theme.typography) == null ? void 0 : _props$theme$typograp["".concat(prop).concat(props[prop] === 'default' || props[prop] === prop ? '' : capitalize((_props$prop = props[prop]) == null ? void 0 : _props$prop.toString()))];
15
- if (!value) {
16
- var _props$theme$typograp2, _props$theme$typograp3;
17
- value = (_props$theme$typograp2 = props.theme.typography) == null ? void 0 : (_props$theme$typograp3 = _props$theme$typograp2[propValue]) == null ? void 0 : _props$theme$typograp3[prop];
18
- }
19
- if (!value) {
20
- value = propValue;
21
- }
22
- return _defineProperty({}, prop, value);
23
- };
24
- return handleBreakpoints(props, props[prop], styleFromPropValue);
25
- }
26
- return null;
27
- };
28
- };
29
6
  var defaultSxConfig = {
30
7
  // borders
31
8
  border: {
@@ -286,19 +263,16 @@ var defaultSxConfig = {
286
263
  boxSizing: {},
287
264
  // typography
288
265
  fontFamily: {
289
- themeKey: 'typography',
290
- style: createFontStyleFunction('fontFamily')
266
+ themeKey: 'typography'
291
267
  },
292
268
  fontSize: {
293
- themeKey: 'typography',
294
- style: createFontStyleFunction('fontSize')
269
+ themeKey: 'typography'
295
270
  },
296
271
  fontStyle: {
297
272
  themeKey: 'typography'
298
273
  },
299
274
  fontWeight: {
300
- themeKey: 'typography',
301
- style: createFontStyleFunction('fontWeight')
275
+ themeKey: 'typography'
302
276
  },
303
277
  letterSpacing: {},
304
278
  textTransform: {},
@@ -38,6 +38,9 @@ export function unstable_createStyleFunctionSx() {
38
38
  if (val == null) {
39
39
  return null;
40
40
  }
41
+ if (themeKey === 'typography' && val === 'inherit') {
42
+ return _defineProperty({}, prop, val);
43
+ }
41
44
  var themeMapping = getPath(theme, themeKey) || {};
42
45
  if (style) {
43
46
  return style(props);
@@ -57,10 +60,10 @@ export function unstable_createStyleFunctionSx() {
57
60
  }
58
61
  function styleFunctionSx(props) {
59
62
  var _theme$unstable_sxCon;
60
- var _ref3 = props || {},
61
- sx = _ref3.sx,
62
- _ref3$theme = _ref3.theme,
63
- theme = _ref3$theme === void 0 ? {} : _ref3$theme;
63
+ var _ref4 = props || {},
64
+ sx = _ref4.sx,
65
+ _ref4$theme = _ref4.theme,
66
+ theme = _ref4$theme === void 0 ? {} : _ref4$theme;
64
67
  if (!sx) {
65
68
  return null; // Emotion & styled-components will neglect null
66
69
  }
@@ -44,6 +44,16 @@ process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ =
44
44
  /**
45
45
  * The system prop, which allows defining system overrides as well as additional CSS styles.
46
46
  */
47
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
47
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
48
+ /**
49
+ * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
50
+ *
51
+ * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
52
+ * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
53
+ *
54
+ * To enable this flag globally, follow the theme's default props configuration.
55
+ * @default false
56
+ */
57
+ useFlexGap: PropTypes.bool
48
58
  } : void 0;
49
59
  export default Stack;
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["component", "direction", "spacing", "divider", "children", "className"];
3
+ const _excluded = ["component", "direction", "spacing", "divider", "children", "className", "useFlexGap"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -95,6 +95,11 @@ export const style = ({
95
95
  });
96
96
  }
97
97
  const styleFromPropValue = (propValue, breakpoint) => {
98
+ if (ownerState.useFlexGap) {
99
+ return {
100
+ gap: getValue(transformer, propValue)
101
+ };
102
+ }
98
103
  return {
99
104
  '& > :not(style) + :not(style)': {
100
105
  margin: 0,
@@ -132,12 +137,14 @@ export default function createStack(options = {}) {
132
137
  spacing = 0,
133
138
  divider,
134
139
  children,
135
- className
140
+ className,
141
+ useFlexGap = false
136
142
  } = props,
137
143
  other = _objectWithoutPropertiesLoose(props, _excluded);
138
144
  const ownerState = {
139
145
  direction,
140
- spacing
146
+ spacing,
147
+ useFlexGap
141
148
  };
142
149
  const classes = useUtilityClasses();
143
150
  return /*#__PURE__*/_jsx(StackRoot, _extends({
@@ -1,10 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ function appendLevel(level) {
3
+ if (!level) {
4
+ return '';
5
+ }
6
+ return `Level${level}`;
7
+ }
2
8
  function isNestedContainer(ownerState) {
3
9
  return ownerState.level > 0 && ownerState.container;
4
10
  }
5
11
  function createGetSelfSpacing(ownerState) {
6
12
  return function getSelfSpacing(axis) {
7
- return `var(--Grid-${axis}Spacing${ownerState.level || ''})`;
13
+ return `var(--Grid-${axis}Spacing${appendLevel(ownerState.level)})`;
8
14
  };
9
15
  }
10
16
  function createGetParentSpacing(ownerState) {
@@ -12,9 +18,15 @@ function createGetParentSpacing(ownerState) {
12
18
  if (ownerState.level === 0) {
13
19
  return `var(--Grid-${axis}Spacing)`;
14
20
  }
15
- return `var(--Grid-${axis}Spacing${ownerState.level - 1 || ''})`;
21
+ return `var(--Grid-${axis}Spacing${appendLevel(ownerState.level - 1)})`;
16
22
  };
17
23
  }
24
+ function getParentColumns(ownerState) {
25
+ if (ownerState.level === 0) {
26
+ return `var(--Grid-columns)`;
27
+ }
28
+ return `var(--Grid-columns${appendLevel(ownerState.level - 1)})`;
29
+ }
18
30
  export const filterBreakpointKeys = (breakpointsKeys, responsiveKeys) => breakpointsKeys.filter(key => responsiveKeys.includes(key));
19
31
  export const traverseBreakpoints = (breakpoints, responsive, iterator) => {
20
32
  const smallestBreakpoint = breakpoints.keys[0]; // the keys is sorted from smallest to largest by `createBreakpoints`.
@@ -85,7 +97,7 @@ export const generateGridSizeStyles = ({
85
97
  style = {
86
98
  flexGrow: 0,
87
99
  flexBasis: 'auto',
88
- width: `calc(100% * ${value} / var(--Grid-columns)${isNestedContainer(ownerState) ? ` + ${getSelfSpacing('column')}` : ''})`
100
+ width: `calc(100% * ${value} / ${getParentColumns(ownerState)}${isNestedContainer(ownerState) ? ` + ${getSelfSpacing('column')}` : ''})`
89
101
  };
90
102
  }
91
103
  appendStyle(styles, style);
@@ -106,7 +118,7 @@ export const generateGridOffsetStyles = ({
106
118
  }
107
119
  if (typeof value === 'number') {
108
120
  style = {
109
- marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / var(--Grid-columns))`
121
+ marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)})`
110
122
  };
111
123
  }
112
124
  appendStyle(styles, style);
@@ -120,12 +132,14 @@ export const generateGridColumnsStyles = ({
120
132
  if (!ownerState.container) {
121
133
  return {};
122
134
  }
123
- const styles = {
135
+ const styles = isNestedContainer(ownerState) ? {
136
+ [`--Grid-columns${appendLevel(ownerState.level)}`]: getParentColumns(ownerState)
137
+ } : {
124
138
  '--Grid-columns': 12
125
139
  };
126
140
  traverseBreakpoints(theme.breakpoints, ownerState.columns, (appendStyle, value) => {
127
141
  appendStyle(styles, {
128
- '--Grid-columns': value
142
+ [`--Grid-columns${appendLevel(ownerState.level)}`]: value
129
143
  });
130
144
  });
131
145
  return styles;
@@ -141,11 +155,11 @@ export const generateGridRowSpacingStyles = ({
141
155
  const styles = isNestedContainer(ownerState) ? {
142
156
  // Set the default spacing as its parent spacing.
143
157
  // It will be overridden if spacing props are provided
144
- [`--Grid-rowSpacing${ownerState.level || ''}`]: getParentSpacing('row')
158
+ [`--Grid-rowSpacing${appendLevel(ownerState.level)}`]: getParentSpacing('row')
145
159
  } : {};
146
160
  traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, (appendStyle, value) => {
147
161
  appendStyle(styles, {
148
- [`--Grid-rowSpacing${ownerState.level || ''}`]: typeof value === 'string' ? value : theme.spacing?.(value)
162
+ [`--Grid-rowSpacing${appendLevel(ownerState.level)}`]: typeof value === 'string' ? value : theme.spacing?.(value)
149
163
  });
150
164
  });
151
165
  return styles;
@@ -161,11 +175,11 @@ export const generateGridColumnSpacingStyles = ({
161
175
  const styles = isNestedContainer(ownerState) ? {
162
176
  // Set the default spacing as its parent spacing.
163
177
  // It will be overridden if spacing props are provided
164
- [`--Grid-columnSpacing${ownerState.level || ''}`]: getParentSpacing('column')
178
+ [`--Grid-columnSpacing${appendLevel(ownerState.level)}`]: getParentSpacing('column')
165
179
  } : {};
166
180
  traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, (appendStyle, value) => {
167
181
  appendStyle(styles, {
168
- [`--Grid-columnSpacing${ownerState.level || ''}`]: typeof value === 'string' ? value : theme.spacing?.(value)
182
+ [`--Grid-columnSpacing${appendLevel(ownerState.level)}`]: typeof value === 'string' ? value : theme.spacing?.(value)
169
183
  });
170
184
  });
171
185
  return styles;
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.11.13
2
+ * @mui/system v5.11.15
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,30 +1,8 @@
1
- import { unstable_capitalize as capitalize } from '@mui/utils';
2
1
  import { padding, margin } from '../spacing';
3
- import { handleBreakpoints } from '../breakpoints';
4
2
  import { borderRadius, borderTransform } from '../borders';
5
3
  import { gap, rowGap, columnGap } from '../cssGrid';
6
4
  import { paletteTransform } from '../palette';
7
5
  import { maxWidth, sizingTransform } from '../sizing';
8
- const createFontStyleFunction = prop => {
9
- return props => {
10
- if (props[prop] !== undefined && props[prop] !== null) {
11
- const styleFromPropValue = propValue => {
12
- let value = props.theme.typography?.[`${prop}${props[prop] === 'default' || props[prop] === prop ? '' : capitalize(props[prop]?.toString())}`];
13
- if (!value) {
14
- value = props.theme.typography?.[propValue]?.[prop];
15
- }
16
- if (!value) {
17
- value = propValue;
18
- }
19
- return {
20
- [prop]: value
21
- };
22
- };
23
- return handleBreakpoints(props, props[prop], styleFromPropValue);
24
- }
25
- return null;
26
- };
27
- };
28
6
  const defaultSxConfig = {
29
7
  // borders
30
8
  border: {
@@ -283,19 +261,16 @@ const defaultSxConfig = {
283
261
  boxSizing: {},
284
262
  // typography
285
263
  fontFamily: {
286
- themeKey: 'typography',
287
- style: createFontStyleFunction('fontFamily')
264
+ themeKey: 'typography'
288
265
  },
289
266
  fontSize: {
290
- themeKey: 'typography',
291
- style: createFontStyleFunction('fontSize')
267
+ themeKey: 'typography'
292
268
  },
293
269
  fontStyle: {
294
270
  themeKey: 'typography'
295
271
  },
296
272
  fontWeight: {
297
- themeKey: 'typography',
298
- style: createFontStyleFunction('fontWeight')
273
+ themeKey: 'typography'
299
274
  },
300
275
  letterSpacing: {},
301
276
  textTransform: {},
@@ -34,6 +34,11 @@ export function unstable_createStyleFunctionSx() {
34
34
  if (val == null) {
35
35
  return null;
36
36
  }
37
+ if (themeKey === 'typography' && val === 'inherit') {
38
+ return {
39
+ [prop]: val
40
+ };
41
+ }
37
42
  const themeMapping = getPath(theme, themeKey) || {};
38
43
  if (style) {
39
44
  return style(props);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/system",
3
- "version": "5.11.13",
3
+ "version": "5.11.15",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "CSS utilities for rapidly laying out custom designs.",
@@ -4,35 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _utils = require("@mui/utils");
8
7
  var _spacing = require("../spacing");
9
- var _breakpoints = require("../breakpoints");
10
8
  var _borders = require("../borders");
11
9
  var _cssGrid = require("../cssGrid");
12
10
  var _palette = require("../palette");
13
11
  var _sizing = require("../sizing");
14
- const createFontStyleFunction = prop => {
15
- return props => {
16
- if (props[prop] !== undefined && props[prop] !== null) {
17
- const styleFromPropValue = propValue => {
18
- var _props$theme$typograp, _props$prop;
19
- let value = (_props$theme$typograp = props.theme.typography) == null ? void 0 : _props$theme$typograp[`${prop}${props[prop] === 'default' || props[prop] === prop ? '' : (0, _utils.unstable_capitalize)((_props$prop = props[prop]) == null ? void 0 : _props$prop.toString())}`];
20
- if (!value) {
21
- var _props$theme$typograp2, _props$theme$typograp3;
22
- value = (_props$theme$typograp2 = props.theme.typography) == null ? void 0 : (_props$theme$typograp3 = _props$theme$typograp2[propValue]) == null ? void 0 : _props$theme$typograp3[prop];
23
- }
24
- if (!value) {
25
- value = propValue;
26
- }
27
- return {
28
- [prop]: value
29
- };
30
- };
31
- return (0, _breakpoints.handleBreakpoints)(props, props[prop], styleFromPropValue);
32
- }
33
- return null;
34
- };
35
- };
36
12
  const defaultSxConfig = {
37
13
  // borders
38
14
  border: {
@@ -291,19 +267,16 @@ const defaultSxConfig = {
291
267
  boxSizing: {},
292
268
  // typography
293
269
  fontFamily: {
294
- themeKey: 'typography',
295
- style: createFontStyleFunction('fontFamily')
270
+ themeKey: 'typography'
296
271
  },
297
272
  fontSize: {
298
- themeKey: 'typography',
299
- style: createFontStyleFunction('fontSize')
273
+ themeKey: 'typography'
300
274
  },
301
275
  fontStyle: {
302
276
  themeKey: 'typography'
303
277
  },
304
278
  fontWeight: {
305
- themeKey: 'typography',
306
- style: createFontStyleFunction('fontWeight')
279
+ themeKey: 'typography'
307
280
  },
308
281
  letterSpacing: {},
309
282
  textTransform: {},
@@ -42,6 +42,11 @@ function unstable_createStyleFunctionSx() {
42
42
  if (val == null) {
43
43
  return null;
44
44
  }
45
+ if (themeKey === 'typography' && val === 'inherit') {
46
+ return {
47
+ [prop]: val
48
+ };
49
+ }
45
50
  const themeMapping = (0, _style.getPath)(theme, themeKey) || {};
46
51
  if (style) {
47
52
  return style(props);
@@ -1 +1 @@
1
- export {};
1
+ export {};