@mui/system 5.10.13 → 5.10.14

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 (206) hide show
  1. package/Box/Box.js +1 -10
  2. package/Box/Box.spec.d.ts +1 -1
  3. package/Box/index.js +0 -2
  4. package/CHANGELOG.md +70 -2
  5. package/Container/Container.d.ts +13 -13
  6. package/Container/Container.js +2 -17
  7. package/Container/ContainerProps.d.ts +40 -40
  8. package/Container/containerClasses.d.ts +22 -22
  9. package/Container/containerClasses.js +0 -3
  10. package/Container/createContainer.d.ts +18 -18
  11. package/Container/createContainer.js +15 -37
  12. package/Container/index.js +0 -6
  13. package/Stack/Stack.d.ts +13 -13
  14. package/Stack/Stack.js +1 -12
  15. package/Stack/StackProps.d.ts +42 -42
  16. package/Stack/createStack.d.ts +21 -21
  17. package/Stack/createStack.js +10 -48
  18. package/Stack/index.d.ts +5 -5
  19. package/Stack/index.js +0 -9
  20. package/Stack/stackClasses.d.ts +8 -8
  21. package/Stack/stackClasses.js +0 -3
  22. package/ThemeProvider/ThemeProvider.js +2 -22
  23. package/ThemeProvider/index.js +0 -2
  24. package/Unstable_Grid/Grid.d.ts +12 -12
  25. package/Unstable_Grid/Grid.js +6 -42
  26. package/Unstable_Grid/GridProps.d.ts +162 -162
  27. package/Unstable_Grid/createGrid.d.ts +11 -11
  28. package/Unstable_Grid/createGrid.js +19 -49
  29. package/Unstable_Grid/gridClasses.d.ts +20 -20
  30. package/Unstable_Grid/gridClasses.js +8 -7
  31. package/Unstable_Grid/gridGenerator.d.ts +29 -28
  32. package/Unstable_Grid/gridGenerator.js +22 -63
  33. package/Unstable_Grid/index.d.ts +5 -5
  34. package/Unstable_Grid/index.js +0 -9
  35. package/borders.js +0 -14
  36. package/breakpoints.js +3 -32
  37. package/colorManipulator.js +13 -55
  38. package/compose.js +0 -7
  39. package/createBox.js +5 -20
  40. package/createBox.spec.d.ts +1 -1
  41. package/createStyled.js +27 -71
  42. package/createTheme/createBreakpoints.js +22 -37
  43. package/createTheme/createSpacing.d.ts +10 -10
  44. package/createTheme/createSpacing.js +4 -8
  45. package/createTheme/createTheme.js +6 -16
  46. package/createTheme/index.js +0 -2
  47. package/cssGrid.js +0 -21
  48. package/cssVars/createCssVarsProvider.js +24 -72
  49. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  50. package/cssVars/createGetCssVar.d.ts +5 -5
  51. package/cssVars/createGetCssVar.js +2 -7
  52. package/cssVars/cssVarsParser.d.ts +65 -65
  53. package/cssVars/cssVarsParser.js +3 -15
  54. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  55. package/cssVars/getInitColorSchemeScript.js +0 -6
  56. package/cssVars/index.d.ts +3 -3
  57. package/cssVars/index.js +0 -3
  58. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  59. package/cssVars/useCurrentColorScheme.js +20 -49
  60. package/display.js +0 -6
  61. package/esm/Box/Box.js +1 -6
  62. package/esm/Container/Container.js +3 -14
  63. package/esm/Container/createContainer.js +15 -25
  64. package/esm/Stack/Stack.js +1 -9
  65. package/esm/Stack/createStack.js +10 -29
  66. package/esm/ThemeProvider/ThemeProvider.js +2 -11
  67. package/esm/Unstable_Grid/Grid.js +6 -39
  68. package/esm/Unstable_Grid/createGrid.js +18 -35
  69. package/esm/Unstable_Grid/gridClasses.js +8 -4
  70. package/esm/Unstable_Grid/gridGenerator.js +20 -38
  71. package/esm/borders.js +0 -6
  72. package/esm/breakpoints.js +7 -22
  73. package/esm/colorManipulator.js +13 -43
  74. package/esm/compose.js +0 -5
  75. package/esm/createBox.js +5 -7
  76. package/esm/createStyled.js +27 -64
  77. package/esm/createTheme/createBreakpoints.js +22 -34
  78. package/esm/createTheme/createSpacing.js +4 -7
  79. package/esm/createTheme/createTheme.js +6 -9
  80. package/esm/cssGrid.js +0 -9
  81. package/esm/cssVars/createCssVarsProvider.js +24 -58
  82. package/esm/cssVars/createGetCssVar.js +2 -6
  83. package/esm/cssVars/cssVarsParser.js +3 -11
  84. package/esm/cssVars/useCurrentColorScheme.js +20 -44
  85. package/esm/getThemeValue.js +0 -2
  86. package/esm/index.js +1 -2
  87. package/esm/memoize.js +0 -1
  88. package/esm/merge.js +0 -3
  89. package/esm/palette.js +0 -3
  90. package/esm/propsToClassKey.js +4 -7
  91. package/esm/sizing.js +0 -5
  92. package/esm/spacing.js +3 -23
  93. package/esm/style.js +2 -19
  94. package/esm/styleFunctionSx/extendSxProp.js +3 -10
  95. package/esm/styleFunctionSx/styleFunctionSx.js +3 -16
  96. package/esm/sx/sx.js +0 -2
  97. package/esm/useTheme.js +0 -2
  98. package/esm/useThemeProps/getThemeProps.js +0 -2
  99. package/esm/useThemeWithoutDefault.js +0 -3
  100. package/flexbox.js +0 -4
  101. package/getThemeValue.js +0 -14
  102. package/index.js +1 -55
  103. package/index.spec.d.ts +1 -1
  104. package/legacy/Box/Box.js +1 -6
  105. package/legacy/Container/Container.js +3 -14
  106. package/legacy/Container/createContainer.js +29 -39
  107. package/legacy/Stack/Stack.js +1 -9
  108. package/legacy/Stack/createStack.js +17 -37
  109. package/legacy/ThemeProvider/ThemeProvider.js +3 -12
  110. package/legacy/Unstable_Grid/Grid.js +6 -39
  111. package/legacy/Unstable_Grid/createGrid.js +34 -53
  112. package/legacy/Unstable_Grid/gridGenerator.js +36 -58
  113. package/legacy/borders.js +0 -6
  114. package/legacy/breakpoints.js +9 -28
  115. package/legacy/colorManipulator.js +16 -48
  116. package/legacy/compose.js +0 -6
  117. package/legacy/createBox.js +9 -11
  118. package/legacy/createStyled.js +27 -68
  119. package/legacy/createTheme/createBreakpoints.js +20 -33
  120. package/legacy/createTheme/createSpacing.js +4 -9
  121. package/legacy/createTheme/createTheme.js +7 -13
  122. package/legacy/cssGrid.js +0 -9
  123. package/legacy/cssVars/createCssVarsProvider.js +90 -129
  124. package/legacy/cssVars/createGetCssVar.js +2 -10
  125. package/legacy/cssVars/cssVarsParser.js +7 -20
  126. package/legacy/cssVars/getInitColorSchemeScript.js +14 -15
  127. package/legacy/cssVars/useCurrentColorScheme.js +43 -69
  128. package/legacy/getThemeValue.js +0 -3
  129. package/legacy/index.js +2 -3
  130. package/legacy/memoize.js +0 -1
  131. package/legacy/merge.js +0 -3
  132. package/legacy/palette.js +0 -3
  133. package/legacy/propsToClassKey.js +2 -5
  134. package/legacy/sizing.js +0 -5
  135. package/legacy/spacing.js +6 -27
  136. package/legacy/style.js +6 -24
  137. package/legacy/styleFunctionSx/extendSxProp.js +3 -11
  138. package/legacy/styleFunctionSx/styleFunctionSx.js +6 -21
  139. package/legacy/sx/sx.js +0 -2
  140. package/legacy/useTheme.js +0 -2
  141. package/legacy/useThemeProps/getThemeProps.js +2 -4
  142. package/legacy/useThemeProps/useThemeProps.js +2 -2
  143. package/legacy/useThemeWithoutDefault.js +0 -3
  144. package/memoize.js +0 -2
  145. package/merge.js +0 -5
  146. package/modern/Box/Box.js +1 -6
  147. package/modern/Container/Container.js +3 -14
  148. package/modern/Container/createContainer.js +15 -25
  149. package/modern/Stack/Stack.js +1 -9
  150. package/modern/Stack/createStack.js +10 -29
  151. package/modern/ThemeProvider/ThemeProvider.js +2 -11
  152. package/modern/Unstable_Grid/Grid.js +6 -39
  153. package/modern/Unstable_Grid/createGrid.js +18 -34
  154. package/modern/Unstable_Grid/gridClasses.js +8 -4
  155. package/modern/Unstable_Grid/gridGenerator.js +20 -36
  156. package/modern/borders.js +0 -6
  157. package/modern/breakpoints.js +7 -21
  158. package/modern/colorManipulator.js +13 -43
  159. package/modern/compose.js +0 -5
  160. package/modern/createBox.js +5 -7
  161. package/modern/createStyled.js +27 -63
  162. package/modern/createTheme/createBreakpoints.js +22 -34
  163. package/modern/createTheme/createSpacing.js +4 -7
  164. package/modern/createTheme/createTheme.js +6 -9
  165. package/modern/cssGrid.js +0 -9
  166. package/modern/cssVars/createCssVarsProvider.js +24 -58
  167. package/modern/cssVars/createGetCssVar.js +2 -6
  168. package/modern/cssVars/cssVarsParser.js +3 -11
  169. package/modern/cssVars/useCurrentColorScheme.js +20 -44
  170. package/modern/getThemeValue.js +0 -2
  171. package/modern/index.js +2 -3
  172. package/modern/memoize.js +0 -1
  173. package/modern/merge.js +0 -3
  174. package/modern/palette.js +0 -3
  175. package/modern/propsToClassKey.js +4 -7
  176. package/modern/sizing.js +0 -4
  177. package/modern/spacing.js +3 -22
  178. package/modern/style.js +2 -19
  179. package/modern/styleFunctionSx/extendSxProp.js +3 -10
  180. package/modern/styleFunctionSx/styleFunctionSx.js +3 -16
  181. package/modern/sx/sx.js +0 -2
  182. package/modern/useTheme.js +0 -2
  183. package/modern/useThemeProps/getThemeProps.js +0 -2
  184. package/modern/useThemeWithoutDefault.js +0 -3
  185. package/package.json +6 -6
  186. package/palette.js +0 -6
  187. package/positions.js +0 -6
  188. package/propsToClassKey.js +4 -10
  189. package/responsivePropType.js +0 -3
  190. package/shadows.js +0 -3
  191. package/sizing.js +0 -11
  192. package/spacing.js +3 -37
  193. package/style.js +2 -24
  194. package/styleFunctionSx/extendSxProp.js +3 -15
  195. package/styleFunctionSx/index.js +0 -5
  196. package/styleFunctionSx/styleFunctionSx.js +3 -21
  197. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
  198. package/styled.js +0 -3
  199. package/sx/index.js +0 -2
  200. package/sx/sx.js +0 -4
  201. package/typography.js +0 -4
  202. package/useTheme.js +0 -6
  203. package/useThemeProps/getThemeProps.js +0 -4
  204. package/useThemeProps/index.js +0 -3
  205. package/useThemeProps/useThemeProps.js +0 -4
  206. package/useThemeWithoutDefault.js +0 -4
@@ -19,7 +19,6 @@ const defaultCreateStyledComponent = systemStyled('div', {
19
19
  slot: 'Root',
20
20
  overridesResolver: (props, styles) => styles.root
21
21
  });
22
-
23
22
  function useThemePropsDefault(props) {
24
23
  return useThemePropsSystem({
25
24
  props,
@@ -27,6 +26,7 @@ function useThemePropsDefault(props) {
27
26
  defaultTheme
28
27
  });
29
28
  }
29
+
30
30
  /**
31
31
  * Return an array with the separator React element interspersed between
32
32
  * each React node of the input children.
@@ -34,23 +34,18 @@ function useThemePropsDefault(props) {
34
34
  * > joinChildren([1,2,3], 0)
35
35
  * [1,0,2,0,3]
36
36
  */
37
-
38
-
39
37
  function joinChildren(children, separator) {
40
38
  const childrenArray = React.Children.toArray(children).filter(Boolean);
41
39
  return childrenArray.reduce((output, child, index) => {
42
40
  output.push(child);
43
-
44
41
  if (index < childrenArray.length - 1) {
45
42
  output.push( /*#__PURE__*/React.cloneElement(separator, {
46
43
  key: `separator-${index}`
47
44
  }));
48
45
  }
49
-
50
46
  return output;
51
47
  }, []);
52
48
  }
53
-
54
49
  const getSideFromDirection = direction => {
55
50
  return {
56
51
  row: 'Left',
@@ -59,7 +54,6 @@ const getSideFromDirection = direction => {
59
54
  'column-reverse': 'Bottom'
60
55
  }[direction];
61
56
  };
62
-
63
57
  export const style = ({
64
58
  ownerState,
65
59
  theme
@@ -75,14 +69,12 @@ export const style = ({
75
69
  }), propValue => ({
76
70
  flexDirection: propValue
77
71
  })));
78
-
79
72
  if (ownerState.spacing) {
80
73
  const transformer = createUnarySpacing(theme);
81
74
  const base = Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
82
75
  if (typeof ownerState.spacing === 'object' && ownerState.spacing[breakpoint] != null || typeof ownerState.direction === 'object' && ownerState.direction[breakpoint] != null) {
83
76
  acc[breakpoint] = true;
84
77
  }
85
-
86
78
  return acc;
87
79
  }, {});
88
80
  const directionValues = resolveBreakpointValues({
@@ -93,18 +85,15 @@ export const style = ({
93
85
  values: ownerState.spacing,
94
86
  base
95
87
  });
96
-
97
88
  if (typeof directionValues === 'object') {
98
89
  Object.keys(directionValues).forEach((breakpoint, index, breakpoints) => {
99
90
  const directionValue = directionValues[breakpoint];
100
-
101
91
  if (!directionValue) {
102
92
  const previousDirectionValue = index > 0 ? directionValues[breakpoints[index - 1]] : 'column';
103
93
  directionValues[breakpoint] = previousDirectionValue;
104
94
  }
105
95
  });
106
96
  }
107
-
108
97
  const styleFromPropValue = (propValue, breakpoint) => {
109
98
  return {
110
99
  '& > :not(style) + :not(style)': {
@@ -113,12 +102,10 @@ export const style = ({
113
102
  }
114
103
  };
115
104
  };
116
-
117
105
  styles = deepmerge(styles, handleBreakpoints({
118
106
  theme
119
107
  }, spacingValues, styleFromPropValue));
120
108
  }
121
-
122
109
  styles = mergeBreakpointsInOrder(theme.breakpoints, styles);
123
110
  return styles;
124
111
  };
@@ -129,29 +116,25 @@ export default function createStack(options = {}) {
129
116
  useThemeProps = useThemePropsDefault,
130
117
  componentName = 'MuiStack'
131
118
  } = options;
132
-
133
119
  const useUtilityClasses = () => {
134
120
  const slots = {
135
121
  root: ['root']
136
122
  };
137
123
  return composeClasses(slots, slot => generateUtilityClass(componentName, slot), {});
138
124
  };
139
-
140
125
  const StackRoot = createStyledComponent(style);
141
126
  const Stack = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
142
127
  const themeProps = useThemeProps(inProps);
143
128
  const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
144
-
145
129
  const {
146
- component = 'div',
147
- direction = 'column',
148
- spacing = 0,
149
- divider,
150
- children,
151
- className
152
- } = props,
153
- other = _objectWithoutPropertiesLoose(props, _excluded);
154
-
130
+ component = 'div',
131
+ direction = 'column',
132
+ spacing = 0,
133
+ divider,
134
+ children,
135
+ className
136
+ } = props,
137
+ other = _objectWithoutPropertiesLoose(props, _excluded);
155
138
  const ownerState = {
156
139
  direction,
157
140
  spacing
@@ -166,9 +149,7 @@ export default function createStack(options = {}) {
166
149
  children: divider ? joinChildren(children, divider) : children
167
150
  }));
168
151
  });
169
- process.env.NODE_ENV !== "production" ? Stack.propTypes
170
- /* remove-proptypes */
171
- = {
152
+ process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ = {
172
153
  children: PropTypes.node,
173
154
  direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
174
155
  divider: PropTypes.node,
@@ -6,7 +6,6 @@ import { ThemeContext as StyledEngineThemeContext } from '@mui/styled-engine';
6
6
  import useTheme from '../useTheme';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  const EMPTY_THEME = {};
9
-
10
9
  function InnerThemeProvider(props) {
11
10
  const theme = useTheme();
12
11
  return /*#__PURE__*/_jsx(StyledEngineThemeContext.Provider, {
@@ -14,18 +13,17 @@ function InnerThemeProvider(props) {
14
13
  children: props.children
15
14
  });
16
15
  }
17
-
18
16
  process.env.NODE_ENV !== "production" ? InnerThemeProvider.propTypes = {
19
17
  /**
20
18
  * Your component tree.
21
19
  */
22
20
  children: PropTypes.node
23
21
  } : void 0;
22
+
24
23
  /**
25
24
  * This component makes the `theme` available down the React tree.
26
25
  * It should preferably be used at **the root of your component tree**.
27
26
  */
28
-
29
27
  function ThemeProvider(props) {
30
28
  const {
31
29
  children,
@@ -38,28 +36,21 @@ function ThemeProvider(props) {
38
36
  })
39
37
  });
40
38
  }
41
-
42
- process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
43
- /* remove-proptypes */
44
- = {
39
+ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes /* remove-proptypes */ = {
45
40
  // ----------------------------- Warning --------------------------------
46
41
  // | These PropTypes are generated from the TypeScript type definitions |
47
42
  // | To update them edit the d.ts file and run "yarn proptypes" |
48
43
  // ----------------------------------------------------------------------
49
-
50
44
  /**
51
45
  * Your component tree.
52
46
  */
53
47
  children: PropTypes.node,
54
-
55
48
  /**
56
49
  * A theme object. You can provide a function to extend the outer theme.
57
50
  */
58
51
  theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired
59
52
  } : void 0;
60
-
61
53
  if (process.env.NODE_ENV !== 'production') {
62
54
  process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) : void 0;
63
55
  }
64
-
65
56
  export default ThemeProvider;
@@ -10,58 +10,42 @@ import createGrid from './createGrid';
10
10
  *
11
11
  * - [Grid API](https://mui.com/system/api/grid/)
12
12
  */
13
-
14
13
  const Grid = createGrid();
15
- process.env.NODE_ENV !== "production" ? Grid.propTypes
16
- /* remove-proptypes */
17
- = {
14
+ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
18
15
  // ----------------------------- Warning --------------------------------
19
16
  // | These PropTypes are generated from the TypeScript type definitions |
20
17
  // | To update them edit TypeScript types and run "yarn proptypes" |
21
18
  // ----------------------------------------------------------------------
22
-
23
19
  /**
24
20
  * The content of the component.
25
21
  */
26
22
  children: PropTypes.node,
27
-
28
23
  /**
29
24
  * The number of columns.
30
25
  * @default 12
31
26
  */
32
- columns: PropTypes
33
- /* @typescript-to-proptypes-ignore */
34
- .oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
35
-
27
+ columns: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
36
28
  /**
37
29
  * Defines the horizontal space between the type `item` components.
38
30
  * It overrides the value of the `spacing` prop.
39
31
  */
40
- columnSpacing: PropTypes
41
- /* @typescript-to-proptypes-ignore */
42
- .oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
43
-
32
+ columnSpacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
44
33
  /**
45
34
  * If `true`, the component will have the flex *container* behavior.
46
35
  * You should be wrapping *items* with a *container*.
47
36
  * @default false
48
37
  */
49
38
  container: PropTypes.bool,
50
-
51
39
  /**
52
40
  * Defines the `flex-direction` style property.
53
41
  * It is applied for all screen sizes.
54
42
  * @default 'row'
55
43
  */
56
- direction: PropTypes
57
- /* @typescript-to-proptypes-ignore */
58
- .oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
59
-
44
+ direction: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
60
45
  /**
61
46
  * If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
62
47
  */
63
48
  disableEqualOverflow: PropTypes.bool,
64
-
65
49
  /**
66
50
  * If a number, it sets the number of columns the grid item uses.
67
51
  * It can't be greater than the total number of columns of the container (12 by default).
@@ -72,14 +56,12 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes
72
56
  * @default false
73
57
  */
74
58
  lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
75
-
76
59
  /**
77
60
  * If a number, it sets the margin-left equals to the number of columns the grid item uses.
78
61
  * If 'auto', the grid item push itself to the right-end of the container.
79
62
  * The value is applied for the `lg` breakpoint and wider screens if not overridden.
80
63
  */
81
64
  lgOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
82
-
83
65
  /**
84
66
  * If a number, it sets the number of columns the grid item uses.
85
67
  * It can't be greater than the total number of columns of the container (12 by default).
@@ -90,22 +72,17 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes
90
72
  * @default false
91
73
  */
92
74
  md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
93
-
94
75
  /**
95
76
  * If a number, it sets the margin-left equals to the number of columns the grid item uses.
96
77
  * If 'auto', the grid item push itself to the right-end of the container.
97
78
  * The value is applied for the `md` breakpoint and wider screens if not overridden.
98
79
  */
99
80
  mdOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
100
-
101
81
  /**
102
82
  * Defines the vertical space between the type `item` components.
103
83
  * It overrides the value of the `spacing` prop.
104
84
  */
105
- rowSpacing: PropTypes
106
- /* @typescript-to-proptypes-ignore */
107
- .oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
108
-
85
+ rowSpacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
109
86
  /**
110
87
  * If a number, it sets the number of columns the grid item uses.
111
88
  * It can't be greater than the total number of columns of the container (12 by default).
@@ -116,35 +93,28 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes
116
93
  * @default false
117
94
  */
118
95
  sm: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
119
-
120
96
  /**
121
97
  * If a number, it sets the margin-left equals to the number of columns the grid item uses.
122
98
  * If 'auto', the grid item push itself to the right-end of the container.
123
99
  * The value is applied for the `sm` breakpoint and wider screens if not overridden.
124
100
  */
125
101
  smOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
126
-
127
102
  /**
128
103
  * Defines the space between the type `item` components.
129
104
  * It can only be used on a type `container` component.
130
105
  * @default 0
131
106
  */
132
- spacing: PropTypes
133
- /* @typescript-to-proptypes-ignore */
134
- .oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
135
-
107
+ spacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
136
108
  /**
137
109
  * @ignore
138
110
  */
139
111
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
140
-
141
112
  /**
142
113
  * Defines the `flex-wrap` style property.
143
114
  * It's applied for all screen sizes.
144
115
  * @default 'wrap'
145
116
  */
146
117
  wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
147
-
148
118
  /**
149
119
  * If a number, it sets the number of columns the grid item uses.
150
120
  * It can't be greater than the total number of columns of the container (12 by default).
@@ -155,14 +125,12 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes
155
125
  * @default false
156
126
  */
157
127
  xl: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
158
-
159
128
  /**
160
129
  * If a number, it sets the margin-left equals to the number of columns the grid item uses.
161
130
  * If 'auto', the grid item push itself to the right-end of the container.
162
131
  * The value is applied for the `xl` breakpoint and wider screens if not overridden.
163
132
  */
164
133
  xlOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
165
-
166
134
  /**
167
135
  * If a number, it sets the number of columns the grid item uses.
168
136
  * It can't be greater than the total number of columns of the container (12 by default).
@@ -173,7 +141,6 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes
173
141
  * @default false
174
142
  */
175
143
  xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
176
-
177
144
  /**
178
145
  * If a number, it sets the margin-left equals to the number of columns the grid item uses.
179
146
  * If 'auto', the grid item push itself to the right-end of the container.
@@ -12,14 +12,14 @@ import { extendSxProp } from '../styleFunctionSx';
12
12
  import createTheme from '../createTheme';
13
13
  import { generateGridStyles, generateGridSizeStyles, generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridDirectionStyles, generateGridOffsetStyles, generateSizeClassNames, generateSpacingClassNames, generateDirectionClasses } from './gridGenerator';
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
- const defaultTheme = createTheme(); // widening Theme to any so that the consumer can own the theme structure.
15
+ const defaultTheme = createTheme();
16
16
 
17
+ // widening Theme to any so that the consumer can own the theme structure.
17
18
  const defaultCreateStyledComponent = systemStyled('div', {
18
19
  name: 'MuiGrid',
19
20
  slot: 'Root',
20
21
  overridesResolver: (props, styles) => styles.root
21
22
  });
22
-
23
23
  function useThemePropsDefault(props) {
24
24
  return useThemePropsSystem({
25
25
  props,
@@ -27,7 +27,6 @@ function useThemePropsDefault(props) {
27
27
  defaultTheme
28
28
  });
29
29
  }
30
-
31
30
  export default function createGrid(options = {}) {
32
31
  const {
33
32
  // This will allow adding custom styled fn (for example for custom sx style function)
@@ -37,7 +36,6 @@ export default function createGrid(options = {}) {
37
36
  } = options;
38
37
  const NestedContext = /*#__PURE__*/React.createContext(false);
39
38
  const OverflowContext = /*#__PURE__*/React.createContext(undefined);
40
-
41
39
  const useUtilityClasses = (ownerState, theme) => {
42
40
  const {
43
41
  container,
@@ -51,40 +49,33 @@ export default function createGrid(options = {}) {
51
49
  };
52
50
  return composeClasses(slots, slot => generateUtilityClass(componentName, slot), {});
53
51
  };
54
-
55
52
  const GridRoot = createStyledComponent(generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridSizeStyles, generateGridDirectionStyles, generateGridStyles, generateGridOffsetStyles);
56
53
  const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
57
54
  var _inProps$columns, _inProps$spacing, _ref, _inProps$rowSpacing, _ref2, _inProps$columnSpacin, _ref3, _disableEqualOverflow;
58
-
59
55
  const theme = useTheme();
60
56
  const themeProps = useThemeProps(inProps);
61
57
  const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
62
-
63
58
  const nested = React.useContext(NestedContext);
64
59
  const overflow = React.useContext(OverflowContext);
65
-
66
60
  const {
67
- className,
68
- columns: columnsProp = 12,
69
- container = false,
70
- component = 'div',
71
- direction = 'row',
72
- wrap = 'wrap',
73
- spacing: spacingProp = 0,
74
- rowSpacing: rowSpacingProp = spacingProp,
75
- columnSpacing: columnSpacingProp = spacingProp,
76
- disableEqualOverflow: themeDisableEqualOverflow
77
- } = props,
78
- rest = _objectWithoutPropertiesLoose(props, _excluded); // Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
79
-
80
-
61
+ className,
62
+ columns: columnsProp = 12,
63
+ container = false,
64
+ component = 'div',
65
+ direction = 'row',
66
+ wrap = 'wrap',
67
+ spacing: spacingProp = 0,
68
+ rowSpacing: rowSpacingProp = spacingProp,
69
+ columnSpacing: columnSpacingProp = spacingProp,
70
+ disableEqualOverflow: themeDisableEqualOverflow
71
+ } = props,
72
+ rest = _objectWithoutPropertiesLoose(props, _excluded);
73
+ // Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
81
74
  let disableEqualOverflow = themeDisableEqualOverflow;
82
-
83
75
  if (nested && themeDisableEqualOverflow !== undefined) {
84
76
  disableEqualOverflow = inProps.disableEqualOverflow;
85
- } // collect breakpoints related props because they can be customized from the theme.
86
-
87
-
77
+ }
78
+ // collect breakpoints related props because they can be customized from the theme.
88
79
  const gridSize = {};
89
80
  const gridOffset = {};
90
81
  const other = {};
@@ -101,7 +92,6 @@ export default function createGrid(options = {}) {
101
92
  const spacing = (_inProps$spacing = inProps.spacing) != null ? _inProps$spacing : nested ? undefined : spacingProp;
102
93
  const rowSpacing = (_ref = (_inProps$rowSpacing = inProps.rowSpacing) != null ? _inProps$rowSpacing : inProps.spacing) != null ? _ref : nested ? undefined : rowSpacingProp;
103
94
  const columnSpacing = (_ref2 = (_inProps$columnSpacin = inProps.columnSpacing) != null ? _inProps$columnSpacin : inProps.spacing) != null ? _ref2 : nested ? undefined : columnSpacingProp;
104
-
105
95
  const ownerState = _extends({}, props, {
106
96
  nested,
107
97
  columns,
@@ -116,25 +106,21 @@ export default function createGrid(options = {}) {
116
106
  disableEqualOverflow: (_ref3 = (_disableEqualOverflow = disableEqualOverflow) != null ? _disableEqualOverflow : overflow) != null ? _ref3 : false,
117
107
  // use context value if exists.
118
108
  parentDisableEqualOverflow: overflow // for nested grid
119
-
120
109
  });
121
110
 
122
111
  const classes = useUtilityClasses(ownerState, theme);
123
-
124
112
  let result = /*#__PURE__*/_jsx(GridRoot, _extends({
125
113
  ref: ref,
126
114
  as: component,
127
115
  ownerState: ownerState,
128
116
  className: clsx(classes.root, className)
129
117
  }, other));
130
-
131
118
  if (!nested) {
132
119
  result = /*#__PURE__*/_jsx(NestedContext.Provider, {
133
120
  value: true,
134
121
  children: result
135
122
  });
136
123
  }
137
-
138
124
  if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
139
125
  // There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
140
126
  // 1. It is the root grid with `disableEqualOverflow`.
@@ -144,12 +130,9 @@ export default function createGrid(options = {}) {
144
130
  children: result
145
131
  });
146
132
  }
147
-
148
133
  return result;
149
134
  });
150
- process.env.NODE_ENV !== "production" ? Grid.propTypes
151
- /* remove-proptypes */
152
- = {
135
+ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
153
136
  children: PropTypes.node,
154
137
  className: PropTypes.string,
155
138
  columns: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
@@ -6,9 +6,13 @@ const SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
6
6
  const DIRECTIONS = ['column-reverse', 'column', 'row-reverse', 'row'];
7
7
  const WRAPS = ['nowrap', 'wrap-reverse', 'wrap'];
8
8
  const GRID_SIZES = ['auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
9
- const gridClasses = generateUtilityClasses('MuiGrid', ['root', 'container', 'item', // spacings
10
- ...SPACINGS.map(spacing => `spacing-xs-${spacing}`), // direction values
11
- ...DIRECTIONS.map(direction => `direction-xs-${direction}`), // wrap values
12
- ...WRAPS.map(wrap => `wrap-xs-${wrap}`), // grid sizes for all breakpoints
9
+ const gridClasses = generateUtilityClasses('MuiGrid', ['root', 'container', 'item',
10
+ // spacings
11
+ ...SPACINGS.map(spacing => `spacing-xs-${spacing}`),
12
+ // direction values
13
+ ...DIRECTIONS.map(direction => `direction-xs-${direction}`),
14
+ // wrap values
15
+ ...WRAPS.map(wrap => `wrap-xs-${wrap}`),
16
+ // grid sizes for all breakpoints
13
17
  ...GRID_SIZES.map(size => `grid-xs-${size}`), ...GRID_SIZES.map(size => `grid-sm-${size}`), ...GRID_SIZES.map(size => `grid-md-${size}`), ...GRID_SIZES.map(size => `grid-lg-${size}`), ...GRID_SIZES.map(size => `grid-xl-${size}`)]);
14
18
  export default gridClasses;