@mui/system 5.9.0 → 5.9.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 (46) hide show
  1. package/Box/Box.spec.d.ts +1 -1
  2. package/CHANGELOG.md +196 -6
  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/Unstable_Grid/Grid.d.ts +12 -12
  8. package/Unstable_Grid/Grid.js +5 -0
  9. package/Unstable_Grid/GridProps.d.ts +162 -158
  10. package/Unstable_Grid/createGrid.d.ts +11 -11
  11. package/Unstable_Grid/createGrid.js +30 -5
  12. package/Unstable_Grid/gridClasses.d.ts +20 -20
  13. package/Unstable_Grid/gridGenerator.d.ts +26 -26
  14. package/Unstable_Grid/gridGenerator.js +10 -4
  15. package/Unstable_Grid/index.d.ts +5 -5
  16. package/breakpoints.js +1 -1
  17. package/createBox.spec.d.ts +1 -1
  18. package/createTheme/createSpacing.d.ts +10 -10
  19. package/cssVars/createCssVarsProvider.js +1 -1
  20. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  21. package/cssVars/createGetCssVar.d.ts +5 -5
  22. package/cssVars/cssVarsParser.d.ts +65 -65
  23. package/cssVars/getInitColorSchemeScript.d.ts +45 -45
  24. package/cssVars/index.d.ts +3 -3
  25. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  26. package/esm/Unstable_Grid/Grid.js +5 -0
  27. package/esm/Unstable_Grid/createGrid.js +30 -5
  28. package/esm/Unstable_Grid/gridGenerator.js +10 -4
  29. package/esm/breakpoints.js +1 -1
  30. package/esm/cssVars/createCssVarsProvider.js +1 -1
  31. package/index.js +1 -1
  32. package/index.spec.d.ts +1 -1
  33. package/legacy/Unstable_Grid/Grid.js +5 -0
  34. package/legacy/Unstable_Grid/createGrid.js +28 -3
  35. package/legacy/Unstable_Grid/gridGenerator.js +10 -4
  36. package/legacy/breakpoints.js +1 -1
  37. package/legacy/cssVars/createCssVarsProvider.js +1 -1
  38. package/legacy/index.js +1 -1
  39. package/modern/Unstable_Grid/Grid.js +5 -0
  40. package/modern/Unstable_Grid/createGrid.js +29 -4
  41. package/modern/Unstable_Grid/gridGenerator.js +10 -4
  42. package/modern/breakpoints.js +1 -1
  43. package/modern/cssVars/createCssVarsProvider.js +1 -1
  44. package/modern/index.js +1 -1
  45. package/package.json +4 -4
  46. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
@@ -57,6 +57,11 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes
57
57
  /* @typescript-to-proptypes-ignore */
58
58
  .oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
59
59
 
60
+ /**
61
+ * If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
62
+ */
63
+ disableEqualOverflow: PropTypes.bool,
64
+
60
65
  /**
61
66
  * If a number, it sets the number of columns the grid item uses.
62
67
  * It can't be greater than the total number of columns of the container (12 by default).
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["className", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing"];
3
+ const _excluded = ["className", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -36,6 +36,7 @@ export default function createGrid(options = {}) {
36
36
  componentName = 'MuiGrid'
37
37
  } = options;
38
38
  const NestedContext = /*#__PURE__*/React.createContext(false);
39
+ const OverflowContext = /*#__PURE__*/React.createContext(undefined);
39
40
 
40
41
  const useUtilityClasses = (ownerState, theme) => {
41
42
  const {
@@ -58,6 +59,7 @@ export default function createGrid(options = {}) {
58
59
  const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
59
60
 
60
61
  const nested = React.useContext(NestedContext);
62
+ const overflow = React.useContext(OverflowContext);
61
63
 
62
64
  const {
63
65
  className,
@@ -68,9 +70,17 @@ export default function createGrid(options = {}) {
68
70
  wrap = 'wrap',
69
71
  spacing: spacingProp = 0,
70
72
  rowSpacing: rowSpacingProp = spacingProp,
71
- columnSpacing: columnSpacingProp = spacingProp
73
+ columnSpacing: columnSpacingProp = spacingProp,
74
+ disableEqualOverflow: themeDisableEqualOverflow
72
75
  } = props,
73
- rest = _objectWithoutPropertiesLoose(props, _excluded); // collect breakpoints related props because they can be custom from the theme.
76
+ rest = _objectWithoutPropertiesLoose(props, _excluded); // Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
77
+
78
+
79
+ let disableEqualOverflow = themeDisableEqualOverflow;
80
+
81
+ if (nested && themeDisableEqualOverflow !== undefined) {
82
+ disableEqualOverflow = inProps.disableEqualOverflow;
83
+ } // collect breakpoints related props because they can be customized from the theme.
74
84
 
75
85
 
76
86
  const gridSize = {};
@@ -100,7 +110,11 @@ export default function createGrid(options = {}) {
100
110
  rowSpacing,
101
111
  columnSpacing,
102
112
  gridSize,
103
- gridOffset
113
+ gridOffset,
114
+ disableEqualOverflow: disableEqualOverflow ?? overflow ?? false,
115
+ // use context value if exists.
116
+ parentDisableEqualOverflow: overflow // for nested grid
117
+
104
118
  });
105
119
 
106
120
  const classes = useUtilityClasses(ownerState, theme);
@@ -119,6 +133,16 @@ export default function createGrid(options = {}) {
119
133
  });
120
134
  }
121
135
 
136
+ if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow ?? false)) {
137
+ // There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
138
+ // 1. It is the root grid with `disableEqualOverflow`.
139
+ // 2. It is a nested grid with different `disableEqualOverflow` from the context.
140
+ result = /*#__PURE__*/_jsx(OverflowContext.Provider, {
141
+ value: disableEqualOverflow,
142
+ children: result
143
+ });
144
+ }
145
+
122
146
  return result;
123
147
  });
124
148
  process.env.NODE_ENV !== "production" ? Grid.propTypes
@@ -131,6 +155,7 @@ export default function createGrid(options = {}) {
131
155
  component: PropTypes.elementType,
132
156
  container: PropTypes.bool,
133
157
  direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
158
+ disableEqualOverflow: PropTypes.bool,
134
159
  lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
135
160
  lgOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
136
161
  md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
@@ -181,14 +181,20 @@ export const generateGridStyles = ({
181
181
  flexWrap: ownerState.wrap
182
182
  }, {
183
183
  margin: `calc(var(--Grid-rowSpacing) / -2) calc(var(--Grid-columnSpacing) / -2)`
184
- }, ownerState.nested ? {
184
+ }, ownerState.disableEqualOverflow && {
185
+ margin: `calc(var(--Grid-rowSpacing) * -1) 0px 0px calc(var(--Grid-columnSpacing) * -1)`
186
+ }, ownerState.nested ? _extends({
185
187
  padding: `calc(var(--Grid-nested-rowSpacing) / 2) calc(var(--Grid-nested-columnSpacing) / 2)`
186
- } : {
188
+ }, (ownerState.disableEqualOverflow || ownerState.parentDisableEqualOverflow) && {
189
+ padding: `calc(var(--Grid-nested-rowSpacing)) 0px 0px calc(var(--Grid-nested-columnSpacing))`
190
+ }) : {
187
191
  '--Grid-nested-rowSpacing': 'var(--Grid-rowSpacing)',
188
192
  '--Grid-nested-columnSpacing': 'var(--Grid-columnSpacing)'
189
- }) : {
193
+ }) : _extends({
190
194
  padding: `calc(var(--Grid-rowSpacing) / 2) calc(var(--Grid-columnSpacing) / 2)`
191
- });
195
+ }, ownerState.disableEqualOverflow && {
196
+ padding: `calc(var(--Grid-rowSpacing)) 0px 0px calc(var(--Grid-columnSpacing))`
197
+ }));
192
198
  };
193
199
  export const generateSizeClassNames = gridSize => {
194
200
  const classNames = [];
@@ -83,7 +83,7 @@ function breakpoints(styleFunction) {
83
83
  }
84
84
 
85
85
  export function createEmptyBreakpointObject(breakpointsInput = {}) {
86
- const breakpointsInOrder = breakpointsInput?.keys?.reduce((acc, key) => {
86
+ const breakpointsInOrder = breakpointsInput.keys?.reduce((acc, key) => {
87
87
  const breakpointStyleKey = breakpointsInput.up(key);
88
88
  acc[breakpointStyleKey] = {};
89
89
  return acc;
@@ -155,7 +155,7 @@ export default function createCssVarsProvider(options) {
155
155
  })();
156
156
 
157
157
  if (key === resolvedDefaultColorScheme) {
158
- defaultColorSchemeStyleSheet[colorSchemeSelector] = css;
158
+ defaultColorSchemeStyleSheet[`${colorSchemeSelector}, [${attribute}="${key}"]`] = css;
159
159
  } else {
160
160
  otherColorSchemesStyleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
161
161
  }
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.9.0
1
+ /** @license MUI v5.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/system",
3
- "version": "5.9.0",
3
+ "version": "5.9.3",
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.17.2",
47
- "@mui/private-theming": "^5.9.0",
47
+ "@mui/private-theming": "^5.9.3",
48
48
  "@mui/styled-engine": "^5.8.7",
49
- "@mui/types": "^7.1.4",
50
- "@mui/utils": "^5.9.0",
49
+ "@mui/types": "^7.1.5",
50
+ "@mui/utils": "^5.9.3",
51
51
  "clsx": "^1.2.1",
52
52
  "csstype": "^3.1.0",
53
53
  "prop-types": "^15.8.1"
@@ -1 +1 @@
1
- export {};
1
+ export {};