@mui/system 6.0.0-alpha.1 → 6.0.0-alpha.11

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 (197) hide show
  1. package/CHANGELOG.md +538 -4
  2. package/Container/Container.d.ts +1 -1
  3. package/Container/createContainer.js +39 -35
  4. package/RtlProvider/index.js +8 -11
  5. package/Stack/Stack.d.ts +1 -1
  6. package/Stack/createStack.d.ts +1 -1
  7. package/Stack/createStack.js +24 -26
  8. package/ThemeProvider/ThemeProvider.js +9 -5
  9. package/Unstable_Grid/Grid.d.ts +1 -1
  10. package/Unstable_Grid/Grid.js +0 -4
  11. package/Unstable_Grid/GridProps.d.ts +0 -4
  12. package/Unstable_Grid/createGrid.d.ts +1 -1
  13. package/Unstable_Grid/createGrid.js +21 -48
  14. package/Unstable_Grid/gridGenerator.d.ts +1 -3
  15. package/Unstable_Grid/gridGenerator.js +15 -21
  16. package/breakpoints/breakpoints.js +26 -7
  17. package/createBox/createBox.js +9 -12
  18. package/createStyled/createStyled.js +56 -51
  19. package/createTheme/applyStyles.d.ts +1 -1
  20. package/createTheme/applyStyles.js +1 -1
  21. package/createTheme/createBreakpoints.js +24 -25
  22. package/createTheme/createTheme.d.ts +2 -1
  23. package/createTheme/createTheme.js +20 -14
  24. package/cssContainerQueries/cssContainerQueries.d.ts +24 -0
  25. package/cssContainerQueries/cssContainerQueries.js +70 -0
  26. package/cssContainerQueries/index.d.ts +3 -0
  27. package/cssContainerQueries/index.js +2 -0
  28. package/cssContainerQueries/package.json +6 -0
  29. package/cssVars/createCssVarsProvider.d.ts +1 -1
  30. package/cssVars/createCssVarsProvider.js +17 -16
  31. package/cssVars/createCssVarsTheme.js +3 -3
  32. package/cssVars/cssVarsParser.d.ts +1 -1
  33. package/cssVars/index.d.ts +2 -0
  34. package/cssVars/index.js +1 -0
  35. package/cssVars/prepareCssVars.js +30 -25
  36. package/cssVars/prepareTypographyVars.d.ts +8 -0
  37. package/cssVars/prepareTypographyVars.js +11 -0
  38. package/cssVars/useCurrentColorScheme.js +18 -11
  39. package/index.d.ts +2 -0
  40. package/index.js +2 -1
  41. package/modern/Container/createContainer.js +39 -35
  42. package/modern/RtlProvider/index.js +8 -11
  43. package/modern/Stack/createStack.js +24 -26
  44. package/modern/ThemeProvider/ThemeProvider.js +9 -5
  45. package/modern/Unstable_Grid/Grid.js +0 -4
  46. package/modern/Unstable_Grid/createGrid.js +21 -48
  47. package/modern/Unstable_Grid/gridGenerator.js +15 -21
  48. package/modern/breakpoints/breakpoints.js +26 -7
  49. package/modern/createBox/createBox.js +9 -12
  50. package/modern/createStyled/createStyled.js +56 -51
  51. package/modern/createTheme/applyStyles.js +1 -1
  52. package/modern/createTheme/createBreakpoints.js +24 -25
  53. package/modern/createTheme/createTheme.js +20 -14
  54. package/modern/cssContainerQueries/cssContainerQueries.js +70 -0
  55. package/modern/cssContainerQueries/index.js +2 -0
  56. package/modern/cssVars/createCssVarsProvider.js +17 -16
  57. package/modern/cssVars/createCssVarsTheme.js +3 -3
  58. package/modern/cssVars/index.js +1 -0
  59. package/modern/cssVars/prepareCssVars.js +30 -25
  60. package/modern/cssVars/prepareTypographyVars.js +11 -0
  61. package/modern/cssVars/useCurrentColorScheme.js +18 -11
  62. package/modern/index.js +2 -1
  63. package/modern/propsToClassKey/propsToClassKey.js +3 -5
  64. package/modern/styleFunctionSx/defaultSxConfig.js +3 -0
  65. package/modern/styleFunctionSx/extendSxProp.js +14 -10
  66. package/modern/styleFunctionSx/styleFunctionSx.js +2 -1
  67. package/modern/useMediaQuery/useMediaQuery.js +5 -14
  68. package/node/Container/createContainer.js +39 -35
  69. package/node/RtlProvider/index.js +8 -11
  70. package/node/Stack/createStack.js +24 -26
  71. package/node/ThemeProvider/ThemeProvider.js +9 -5
  72. package/node/Unstable_Grid/Grid.js +0 -4
  73. package/node/Unstable_Grid/createGrid.js +24 -51
  74. package/node/Unstable_Grid/gridGenerator.js +15 -22
  75. package/node/breakpoints/breakpoints.js +26 -7
  76. package/node/createBox/createBox.js +9 -12
  77. package/node/createStyled/createStyled.js +58 -52
  78. package/node/createTheme/applyStyles.js +1 -1
  79. package/node/createTheme/createBreakpoints.js +24 -26
  80. package/node/createTheme/createTheme.js +20 -14
  81. package/node/cssContainerQueries/cssContainerQueries.js +81 -0
  82. package/node/cssContainerQueries/index.js +32 -0
  83. package/node/cssVars/createCssVarsProvider.js +17 -16
  84. package/node/cssVars/createCssVarsTheme.js +3 -3
  85. package/node/cssVars/index.js +7 -0
  86. package/node/cssVars/prepareCssVars.js +30 -25
  87. package/node/cssVars/prepareTypographyVars.js +17 -0
  88. package/node/cssVars/useCurrentColorScheme.js +18 -12
  89. package/node/index.js +9 -1
  90. package/node/propsToClassKey/propsToClassKey.js +3 -5
  91. package/node/styleFunctionSx/defaultSxConfig.js +3 -0
  92. package/node/styleFunctionSx/extendSxProp.js +14 -10
  93. package/node/styleFunctionSx/styleFunctionSx.js +2 -1
  94. package/node/useMediaQuery/useMediaQuery.js +5 -14
  95. package/package.json +6 -6
  96. package/propsToClassKey/propsToClassKey.js +3 -5
  97. package/styleFunctionSx/defaultSxConfig.js +3 -0
  98. package/styleFunctionSx/extendSxProp.js +14 -10
  99. package/styleFunctionSx/styleFunctionSx.js +2 -1
  100. package/useMediaQuery/useMediaQuery.js +5 -14
  101. package/legacy/Box/Box.js +0 -30
  102. package/legacy/Box/boxClasses.js +0 -3
  103. package/legacy/Box/index.js +0 -5
  104. package/legacy/Container/Container.js +0 -61
  105. package/legacy/Container/ContainerProps.js +0 -1
  106. package/legacy/Container/containerClasses.js +0 -7
  107. package/legacy/Container/createContainer.js +0 -140
  108. package/legacy/Container/index.js +0 -5
  109. package/legacy/GlobalStyles/GlobalStyles.js +0 -37
  110. package/legacy/GlobalStyles/index.js +0 -4
  111. package/legacy/RtlProvider/index.js +0 -22
  112. package/legacy/Stack/Stack.js +0 -62
  113. package/legacy/Stack/StackProps.js +0 -1
  114. package/legacy/Stack/createStack.js +0 -180
  115. package/legacy/Stack/index.js +0 -7
  116. package/legacy/Stack/stackClasses.js +0 -7
  117. package/legacy/ThemeProvider/ThemeProvider.js +0 -87
  118. package/legacy/ThemeProvider/index.js +0 -3
  119. package/legacy/Unstable_Grid/Grid.js +0 -177
  120. package/legacy/Unstable_Grid/GridProps.js +0 -1
  121. package/legacy/Unstable_Grid/createGrid.js +0 -184
  122. package/legacy/Unstable_Grid/gridClasses.js +0 -28
  123. package/legacy/Unstable_Grid/gridGenerator.js +0 -216
  124. package/legacy/Unstable_Grid/index.js +0 -8
  125. package/legacy/Unstable_Grid/traverseBreakpoints.js +0 -48
  126. package/legacy/borders/borders.js +0 -51
  127. package/legacy/borders/index.js +0 -4
  128. package/legacy/breakpoints/breakpoints.js +0 -162
  129. package/legacy/breakpoints/index.js +0 -4
  130. package/legacy/colorManipulator/colorManipulator.js +0 -356
  131. package/legacy/colorManipulator/index.js +0 -3
  132. package/legacy/compose/compose.js +0 -32
  133. package/legacy/compose/index.js +0 -3
  134. package/legacy/createBox/createBox.js +0 -38
  135. package/legacy/createBox/index.js +0 -3
  136. package/legacy/createStyled/createStyled.js +0 -250
  137. package/legacy/createStyled/index.js +0 -4
  138. package/legacy/createTheme/applyStyles.js +0 -73
  139. package/legacy/createTheme/createBreakpoints.js +0 -83
  140. package/legacy/createTheme/createSpacing.js +0 -32
  141. package/legacy/createTheme/createTheme.js +0 -49
  142. package/legacy/createTheme/index.js +0 -3
  143. package/legacy/createTheme/shape.js +0 -4
  144. package/legacy/cssGrid/cssGrid.js +0 -91
  145. package/legacy/cssGrid/index.js +0 -4
  146. package/legacy/cssVars/createCssVarsProvider.js +0 -338
  147. package/legacy/cssVars/createCssVarsTheme.js +0 -13
  148. package/legacy/cssVars/createGetCssVar.js +0 -30
  149. package/legacy/cssVars/cssVarsParser.js +0 -141
  150. package/legacy/cssVars/getInitColorSchemeScript.js +0 -28
  151. package/legacy/cssVars/index.js +0 -6
  152. package/legacy/cssVars/prepareCssVars.js +0 -92
  153. package/legacy/cssVars/useCurrentColorScheme.js +0 -237
  154. package/legacy/display/display.js +0 -29
  155. package/legacy/display/index.js +0 -4
  156. package/legacy/flexbox/flexbox.js +0 -43
  157. package/legacy/flexbox/index.js +0 -4
  158. package/legacy/getThemeValue/getThemeValue.js +0 -47
  159. package/legacy/getThemeValue/index.js +0 -4
  160. package/legacy/index.js +0 -72
  161. package/legacy/memoize/index.js +0 -3
  162. package/legacy/memoize/memoize.js +0 -9
  163. package/legacy/merge/index.js +0 -3
  164. package/legacy/merge/merge.js +0 -10
  165. package/legacy/palette/index.js +0 -4
  166. package/legacy/palette/palette.js +0 -26
  167. package/legacy/positions/index.js +0 -4
  168. package/legacy/positions/positions.js +0 -22
  169. package/legacy/propsToClassKey/index.js +0 -3
  170. package/legacy/propsToClassKey/propsToClassKey.js +0 -24
  171. package/legacy/responsivePropType/index.js +0 -3
  172. package/legacy/responsivePropType/responsivePropType.js +0 -3
  173. package/legacy/shadows/index.js +0 -3
  174. package/legacy/shadows/shadows.js +0 -6
  175. package/legacy/sizing/index.js +0 -4
  176. package/legacy/sizing/sizing.js +0 -65
  177. package/legacy/spacing/index.js +0 -4
  178. package/legacy/spacing/spacing.js +0 -161
  179. package/legacy/style/index.js +0 -4
  180. package/legacy/style/style.js +0 -73
  181. package/legacy/styleFunctionSx/defaultSxConfig.js +0 -293
  182. package/legacy/styleFunctionSx/extendSxProp.js +0 -45
  183. package/legacy/styleFunctionSx/index.js +0 -4
  184. package/legacy/styleFunctionSx/styleFunctionSx.js +0 -126
  185. package/legacy/styled/index.js +0 -3
  186. package/legacy/styled/styled.js +0 -3
  187. package/legacy/typography/index.js +0 -4
  188. package/legacy/typography/typography.js +0 -37
  189. package/legacy/useMediaQuery/index.js +0 -2
  190. package/legacy/useMediaQuery/useMediaQuery.js +0 -145
  191. package/legacy/useTheme/index.js +0 -4
  192. package/legacy/useTheme/useTheme.js +0 -10
  193. package/legacy/useThemeProps/getThemeProps.js +0 -10
  194. package/legacy/useThemeProps/index.js +0 -4
  195. package/legacy/useThemeProps/useThemeProps.js +0 -20
  196. package/legacy/useThemeWithoutDefault/index.js +0 -3
  197. package/legacy/useThemeWithoutDefault/useThemeWithoutDefault.js +0 -13
@@ -1,6 +1,3 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["className", "component", "disableGutters", "fixed", "maxWidth", "classes"];
4
1
  import * as React from 'react';
5
2
  import PropTypes from 'prop-types';
6
3
  import clsx from 'clsx';
@@ -52,20 +49,20 @@ export default function createContainer(options = {}) {
52
49
  const ContainerRoot = createStyledComponent(({
53
50
  theme,
54
51
  ownerState
55
- }) => _extends({
52
+ }) => ({
56
53
  width: '100%',
57
54
  marginLeft: 'auto',
58
55
  boxSizing: 'border-box',
59
56
  marginRight: 'auto',
60
- display: 'block'
61
- }, !ownerState.disableGutters && {
62
- paddingLeft: theme.spacing(2),
63
- paddingRight: theme.spacing(2),
64
- // @ts-ignore module augmentation fails if custom breakpoints are used
65
- [theme.breakpoints.up('sm')]: {
66
- paddingLeft: theme.spacing(3),
67
- paddingRight: theme.spacing(3)
68
- }
57
+ ...(!ownerState.disableGutters && {
58
+ paddingLeft: theme.spacing(2),
59
+ paddingRight: theme.spacing(2),
60
+ // @ts-ignore module augmentation fails if custom breakpoints are used
61
+ [theme.breakpoints.up('sm')]: {
62
+ paddingLeft: theme.spacing(3),
63
+ paddingRight: theme.spacing(3)
64
+ }
65
+ })
69
66
  }), ({
70
67
  theme,
71
68
  ownerState
@@ -82,51 +79,58 @@ export default function createContainer(options = {}) {
82
79
  }, {}), ({
83
80
  theme,
84
81
  ownerState
85
- }) => _extends({}, ownerState.maxWidth === 'xs' && {
82
+ }) => ({
86
83
  // @ts-ignore module augmentation fails if custom breakpoints are used
87
- [theme.breakpoints.up('xs')]: {
84
+ ...(ownerState.maxWidth === 'xs' && {
88
85
  // @ts-ignore module augmentation fails if custom breakpoints are used
89
- maxWidth: Math.max(theme.breakpoints.values.xs, 444)
90
- }
91
- }, ownerState.maxWidth &&
92
- // @ts-ignore module augmentation fails if custom breakpoints are used
93
- ownerState.maxWidth !== 'xs' && {
86
+ [theme.breakpoints.up('xs')]: {
87
+ // @ts-ignore module augmentation fails if custom breakpoints are used
88
+ maxWidth: Math.max(theme.breakpoints.values.xs, 444)
89
+ }
90
+ }),
91
+ ...(ownerState.maxWidth &&
94
92
  // @ts-ignore module augmentation fails if custom breakpoints are used
95
- [theme.breakpoints.up(ownerState.maxWidth)]: {
93
+ ownerState.maxWidth !== 'xs' && {
96
94
  // @ts-ignore module augmentation fails if custom breakpoints are used
97
- maxWidth: `${theme.breakpoints.values[ownerState.maxWidth]}${theme.breakpoints.unit}`
98
- }
95
+ [theme.breakpoints.up(ownerState.maxWidth)]: {
96
+ // @ts-ignore module augmentation fails if custom breakpoints are used
97
+ maxWidth: `${theme.breakpoints.values[ownerState.maxWidth]}${theme.breakpoints.unit}`
98
+ }
99
+ })
99
100
  }));
100
101
  const Container = /*#__PURE__*/React.forwardRef(function Container(inProps, ref) {
101
102
  const props = useThemeProps(inProps);
102
103
  const {
103
- className,
104
- component = 'div',
105
- disableGutters = false,
106
- fixed = false,
107
- maxWidth = 'lg'
108
- } = props,
109
- other = _objectWithoutPropertiesLoose(props, _excluded);
110
- const ownerState = _extends({}, props, {
104
+ className,
105
+ component = 'div',
106
+ disableGutters = false,
107
+ fixed = false,
108
+ maxWidth = 'lg',
109
+ classes: classesProp,
110
+ ...other
111
+ } = props;
112
+ const ownerState = {
113
+ ...props,
111
114
  component,
112
115
  disableGutters,
113
116
  fixed,
114
117
  maxWidth
115
- });
118
+ };
116
119
 
117
120
  // @ts-ignore module augmentation fails if custom breakpoints are used
118
121
  const classes = useUtilityClasses(ownerState, componentName);
119
122
  return (
120
123
  /*#__PURE__*/
121
124
  // @ts-ignore theme is injected by the styled util
122
- _jsx(ContainerRoot, _extends({
125
+ _jsx(ContainerRoot, {
123
126
  as: component
124
127
  // @ts-ignore module augmentation fails if custom breakpoints are used
125
128
  ,
126
129
  ownerState: ownerState,
127
130
  className: clsx(classes.root, className),
128
- ref: ref
129
- }, other))
131
+ ref: ref,
132
+ ...other
133
+ })
130
134
  );
131
135
  });
132
136
  process.env.NODE_ENV !== "production" ? Container.propTypes /* remove-proptypes */ = {
@@ -1,18 +1,15 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["value"];
4
1
  import * as React from 'react';
5
2
  import PropTypes from 'prop-types';
6
3
  import { jsx as _jsx } from "react/jsx-runtime";
7
4
  const RtlContext = /*#__PURE__*/React.createContext();
8
- function RtlProvider(_ref) {
9
- let {
10
- value
11
- } = _ref,
12
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
13
- return /*#__PURE__*/_jsx(RtlContext.Provider, _extends({
14
- value: value ?? true
15
- }, props));
5
+ function RtlProvider({
6
+ value,
7
+ ...props
8
+ }) {
9
+ return /*#__PURE__*/_jsx(RtlContext.Provider, {
10
+ value: value ?? true,
11
+ ...props
12
+ });
16
13
  }
17
14
  process.env.NODE_ENV !== "production" ? RtlProvider.propTypes = {
18
15
  children: PropTypes.node,
package/Stack/Stack.d.ts CHANGED
@@ -10,5 +10,5 @@
10
10
  *
11
11
  * - [Stack API](https://mui.com/system/api/stack/)
12
12
  */
13
- declare const Stack: import("@mui/types").OverridableComponent<import("@mui/system").StackTypeMap<{}, "div">>;
13
+ declare const Stack: import("@mui/types").OverridableComponent<import("./StackProps").StackTypeMap<{}, "div">>;
14
14
  export default Stack;
@@ -10,7 +10,7 @@ interface StyleFunctionProps {
10
10
  };
11
11
  ownerState: StackOwnerState;
12
12
  }
13
- declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("@mui/system/createStyled/createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
13
+ declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
14
14
  declare function useThemePropsDefault<T extends {}>(props: T): T;
15
15
  export declare const style: ({ ownerState, theme }: StyleFunctionProps) => any;
16
16
  export default function createStack(options?: {
@@ -1,6 +1,3 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["component", "direction", "spacing", "divider", "children", "className", "useFlexGap"];
4
1
  import * as React from 'react';
5
2
  import PropTypes from 'prop-types';
6
3
  import clsx from 'clsx';
@@ -60,17 +57,18 @@ export const style = ({
60
57
  ownerState,
61
58
  theme
62
59
  }) => {
63
- let styles = _extends({
60
+ let styles = {
64
61
  display: 'flex',
65
- flexDirection: 'column'
66
- }, handleBreakpoints({
67
- theme
68
- }, resolveBreakpointValues({
69
- values: ownerState.direction,
70
- breakpoints: theme.breakpoints.values
71
- }), propValue => ({
72
- flexDirection: propValue
73
- })));
62
+ flexDirection: 'column',
63
+ ...handleBreakpoints({
64
+ theme
65
+ }, resolveBreakpointValues({
66
+ values: ownerState.direction,
67
+ breakpoints: theme.breakpoints.values
68
+ }), propValue => ({
69
+ flexDirection: propValue
70
+ }))
71
+ };
74
72
  if (ownerState.spacing) {
75
73
  const transformer = createUnarySpacing(theme);
76
74
  const base = Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
@@ -138,29 +136,29 @@ export default function createStack(options = {}) {
138
136
  const themeProps = useThemeProps(inProps);
139
137
  const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
140
138
  const {
141
- component = 'div',
142
- direction = 'column',
143
- spacing = 0,
144
- divider,
145
- children,
146
- className,
147
- useFlexGap = false
148
- } = props,
149
- other = _objectWithoutPropertiesLoose(props, _excluded);
139
+ component = 'div',
140
+ direction = 'column',
141
+ spacing = 0,
142
+ divider,
143
+ children,
144
+ className,
145
+ useFlexGap = false,
146
+ ...other
147
+ } = props;
150
148
  const ownerState = {
151
149
  direction,
152
150
  spacing,
153
151
  useFlexGap
154
152
  };
155
153
  const classes = useUtilityClasses();
156
- return /*#__PURE__*/_jsx(StackRoot, _extends({
154
+ return /*#__PURE__*/_jsx(StackRoot, {
157
155
  as: component,
158
156
  ownerState: ownerState,
159
157
  ref: ref,
160
- className: clsx(classes.root, className)
161
- }, other, {
158
+ className: clsx(classes.root, className),
159
+ ...other,
162
160
  children: divider ? joinChildren(children, divider) : children
163
- }));
161
+ });
164
162
  });
165
163
  process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ = {
166
164
  children: PropTypes.node,
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- import _extends from "@babel/runtime/helpers/esm/extends";
4
3
  import * as React from 'react';
5
4
  import PropTypes from 'prop-types';
6
5
  import { ThemeProvider as MuiThemeProvider, useTheme as usePrivateTheme } from '@mui/private-theming';
@@ -15,9 +14,10 @@ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
15
14
  const resolvedTheme = themeId ? upperTheme[themeId] || upperTheme : upperTheme;
16
15
  if (typeof localTheme === 'function') {
17
16
  const mergedTheme = localTheme(resolvedTheme);
18
- const result = themeId ? _extends({}, upperTheme, {
17
+ const result = themeId ? {
18
+ ...upperTheme,
19
19
  [themeId]: mergedTheme
20
- }) : mergedTheme;
20
+ } : mergedTheme;
21
21
  // must return a function for the private theme to NOT merge with the upper theme.
22
22
  // see the test case "use provided theme from a callback" in ThemeProvider.test.js
23
23
  if (isPrivate) {
@@ -25,9 +25,13 @@ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
25
25
  }
26
26
  return result;
27
27
  }
28
- return themeId ? _extends({}, upperTheme, {
28
+ return themeId ? {
29
+ ...upperTheme,
29
30
  [themeId]: localTheme
30
- }) : _extends({}, upperTheme, localTheme);
31
+ } : {
32
+ ...upperTheme,
33
+ ...localTheme
34
+ };
31
35
  }, [themeId, upperTheme, localTheme, isPrivate]);
32
36
  }
33
37
 
@@ -9,5 +9,5 @@
9
9
  *
10
10
  * - [Grid API](https://mui.com/system/api/grid/)
11
11
  */
12
- declare const Grid: import("@mui/types").OverridableComponent<import("@mui/system").GridTypeMap<{}, "div">>;
12
+ declare const Grid: import("@mui/types").OverridableComponent<import("./GridProps").GridTypeMap<{}, "div">>;
13
13
  export default Grid;
@@ -45,10 +45,6 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ =
45
45
  * @default 'row'
46
46
  */
47
47
  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]),
48
- /**
49
- * If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
50
- */
51
- disableEqualOverflow: PropTypes.bool,
52
48
  /**
53
49
  * If a number, it sets the number of columns the grid item uses.
54
50
  * It can't be greater than the total number of columns of the container (12 by default).
@@ -123,10 +123,6 @@ export interface GridBaseProps extends Breakpoints {
123
123
  * @default 'row'
124
124
  */
125
125
  direction?: ResponsiveStyleValue<GridDirection>;
126
- /**
127
- * If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
128
- */
129
- disableEqualOverflow?: boolean;
130
126
  /**
131
127
  * @internal
132
128
  * The level of the grid starts from `0`
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { OverridableComponent } from '@mui/types';
3
3
  import { GridTypeMap } from './GridProps';
4
- declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("@mui/system/createStyled/createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
4
+ declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
5
5
  declare function useThemePropsDefault<T extends {}>(props: T): T;
6
6
  export default function createGrid(options?: {
7
7
  createStyledComponent?: typeof defaultCreateStyledComponent;
@@ -1,6 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["className", "children", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow", "unstable_level"];
4
1
  import * as React from 'react';
5
2
  import PropTypes from 'prop-types';
6
3
  import clsx from 'clsx';
@@ -36,10 +33,6 @@ export default function createGrid(options = {}) {
36
33
  useThemeProps = useThemePropsDefault,
37
34
  componentName = 'MuiGrid'
38
35
  } = options;
39
- const GridOverflowContext = /*#__PURE__*/React.createContext(undefined);
40
- if (process.env.NODE_ENV !== 'production') {
41
- GridOverflowContext.displayName = 'GridOverflowContext';
42
- }
43
36
  const useUtilityClasses = (ownerState, theme) => {
44
37
  const {
45
38
  container,
@@ -58,27 +51,20 @@ export default function createGrid(options = {}) {
58
51
  const theme = useTheme();
59
52
  const themeProps = useThemeProps(inProps);
60
53
  const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
61
- const overflow = React.useContext(GridOverflowContext);
62
54
  const {
63
- className,
64
- children,
65
- columns: columnsProp = 12,
66
- container = false,
67
- component = 'div',
68
- direction = 'row',
69
- wrap = 'wrap',
70
- spacing: spacingProp = 0,
71
- rowSpacing: rowSpacingProp = spacingProp,
72
- columnSpacing: columnSpacingProp = spacingProp,
73
- disableEqualOverflow: themeDisableEqualOverflow,
74
- unstable_level: level = 0
75
- } = props,
76
- rest = _objectWithoutPropertiesLoose(props, _excluded);
77
- // Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
78
- let disableEqualOverflow = themeDisableEqualOverflow;
79
- if (level && themeDisableEqualOverflow !== undefined) {
80
- disableEqualOverflow = inProps.disableEqualOverflow;
81
- }
55
+ className,
56
+ children,
57
+ columns: columnsProp = 12,
58
+ container = false,
59
+ component = 'div',
60
+ direction = 'row',
61
+ wrap = 'wrap',
62
+ spacing: spacingProp = 0,
63
+ rowSpacing: rowSpacingProp = spacingProp,
64
+ columnSpacing: columnSpacingProp = spacingProp,
65
+ unstable_level: level = 0,
66
+ ...rest
67
+ } = props;
82
68
  // collect breakpoints related props because they can be customized from the theme.
83
69
  const gridSize = {};
84
70
  const gridOffset = {};
@@ -96,7 +82,8 @@ export default function createGrid(options = {}) {
96
82
  const spacing = inProps.spacing ?? (level ? undefined : spacingProp);
97
83
  const rowSpacing = inProps.rowSpacing ?? inProps.spacing ?? (level ? undefined : rowSpacingProp);
98
84
  const columnSpacing = inProps.columnSpacing ?? inProps.spacing ?? (level ? undefined : columnSpacingProp);
99
- const ownerState = _extends({}, props, {
85
+ const ownerState = {
86
+ ...props,
100
87
  level,
101
88
  columns,
102
89
  container,
@@ -106,18 +93,15 @@ export default function createGrid(options = {}) {
106
93
  rowSpacing,
107
94
  columnSpacing,
108
95
  gridSize,
109
- gridOffset,
110
- disableEqualOverflow: disableEqualOverflow ?? overflow ?? false,
111
- // use context value if exists.
112
- parentDisableEqualOverflow: overflow // for nested grid
113
- });
96
+ gridOffset
97
+ };
114
98
  const classes = useUtilityClasses(ownerState, theme);
115
- let result = /*#__PURE__*/_jsx(GridRoot, _extends({
99
+ return /*#__PURE__*/_jsx(GridRoot, {
116
100
  ref: ref,
117
101
  as: component,
118
102
  ownerState: ownerState,
119
- className: clsx(classes.root, className)
120
- }, other, {
103
+ className: clsx(classes.root, className),
104
+ ...other,
121
105
  children: React.Children.map(children, child => {
122
106
  if ( /*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
123
107
  return /*#__PURE__*/React.cloneElement(child, {
@@ -126,17 +110,7 @@ export default function createGrid(options = {}) {
126
110
  }
127
111
  return child;
128
112
  })
129
- }));
130
- if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow ?? false)) {
131
- // There are 2 possibilities that should wrap with the GridOverflowContext to communicate with the nested grids:
132
- // 1. It is the root grid with `disableEqualOverflow`.
133
- // 2. It is a nested grid with different `disableEqualOverflow` from the context.
134
- result = /*#__PURE__*/_jsx(GridOverflowContext.Provider, {
135
- value: disableEqualOverflow,
136
- children: result
137
- });
138
- }
139
- return result;
113
+ });
140
114
  });
141
115
  process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
142
116
  children: PropTypes.node,
@@ -146,7 +120,6 @@ export default function createGrid(options = {}) {
146
120
  component: PropTypes.elementType,
147
121
  container: PropTypes.bool,
148
122
  direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
149
- disableEqualOverflow: PropTypes.bool,
150
123
  lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
151
124
  lgOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
152
125
  md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
@@ -7,9 +7,7 @@ interface Props {
7
7
  breakpoints: Breakpoints;
8
8
  spacing?: Spacing;
9
9
  };
10
- ownerState: GridOwnerState & {
11
- parentDisableEqualOverflow?: boolean;
12
- };
10
+ ownerState: GridOwnerState;
13
11
  }
14
12
  export declare const generateGridSizeStyles: ({ theme, ownerState }: Props) => {};
15
13
  export declare const generateGridOffsetStyles: ({ theme, ownerState }: Props) => {};
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import { traverseBreakpoints } from './traverseBreakpoints';
3
2
  function appendLevel(level) {
4
3
  if (!level) {
@@ -32,7 +31,7 @@ export const generateGridSizeStyles = ({
32
31
  theme,
33
32
  ownerState
34
33
  }) => {
35
- const getSelfSpacing = createGetSelfSpacing(ownerState);
34
+ const getParentSpacing = createGetParentSpacing(ownerState);
36
35
  const styles = {};
37
36
  traverseBreakpoints(theme.breakpoints, ownerState.gridSize, (appendStyle, value) => {
38
37
  let style = {};
@@ -56,7 +55,7 @@ export const generateGridSizeStyles = ({
56
55
  style = {
57
56
  flexGrow: 0,
58
57
  flexBasis: 'auto',
59
- width: `calc(100% * ${value} / ${getParentColumns(ownerState)}${isNestedContainer(ownerState) ? ` + ${getSelfSpacing('column')}` : ''})`
58
+ width: `calc(100% * ${value} / ${getParentColumns(ownerState)} - (${getParentColumns(ownerState)} - ${value}) * (${getParentSpacing('column')} / ${getParentColumns(ownerState)}))`
60
59
  };
61
60
  }
62
61
  appendStyle(styles, style);
@@ -67,6 +66,7 @@ export const generateGridOffsetStyles = ({
67
66
  theme,
68
67
  ownerState
69
68
  }) => {
69
+ const getParentSpacing = createGetParentSpacing(ownerState);
70
70
  const styles = {};
71
71
  traverseBreakpoints(theme.breakpoints, ownerState.gridOffset, (appendStyle, value) => {
72
72
  let style = {};
@@ -77,7 +77,7 @@ export const generateGridOffsetStyles = ({
77
77
  }
78
78
  if (typeof value === 'number') {
79
79
  style = {
80
- marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)})`
80
+ marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)} + ${getParentSpacing('column')} * ${value} / ${getParentColumns(ownerState)})`
81
81
  };
82
82
  }
83
83
  appendStyle(styles, style);
@@ -162,24 +162,18 @@ export const generateGridStyles = ({
162
162
  ownerState
163
163
  }) => {
164
164
  const getSelfSpacing = createGetSelfSpacing(ownerState);
165
- const getParentSpacing = createGetParentSpacing(ownerState);
166
- return _extends({
165
+ return {
167
166
  minWidth: 0,
168
- boxSizing: 'border-box'
169
- }, ownerState.container && _extends({
170
- display: 'flex',
171
- flexWrap: 'wrap'
172
- }, ownerState.wrap && ownerState.wrap !== 'wrap' && {
173
- flexWrap: ownerState.wrap
174
- }, {
175
- margin: `calc(${getSelfSpacing('row')} / -2) calc(${getSelfSpacing('column')} / -2)`
176
- }, ownerState.disableEqualOverflow && {
177
- margin: `calc(${getSelfSpacing('row')} * -1) 0px 0px calc(${getSelfSpacing('column')} * -1)`
178
- }), (!ownerState.container || isNestedContainer(ownerState)) && _extends({
179
- padding: `calc(${getParentSpacing('row')} / 2) calc(${getParentSpacing('column')} / 2)`
180
- }, (ownerState.disableEqualOverflow || ownerState.parentDisableEqualOverflow) && {
181
- padding: `${getParentSpacing('row')} 0px 0px ${getParentSpacing('column')}`
182
- }));
167
+ boxSizing: 'border-box',
168
+ ...(ownerState.container && {
169
+ display: 'flex',
170
+ flexWrap: 'wrap',
171
+ ...(ownerState.wrap && ownerState.wrap !== 'wrap' && {
172
+ flexWrap: ownerState.wrap
173
+ }),
174
+ gap: `${getSelfSpacing('row')} ${getSelfSpacing('column')}`
175
+ })
176
+ };
183
177
  };
184
178
  export const generateSizeClassNames = gridSize => {
185
179
  const classNames = [];
@@ -1,7 +1,7 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import PropTypes from 'prop-types';
3
2
  import deepmerge from '@mui/utils/deepmerge';
4
3
  import merge from '../merge';
4
+ import { isCqShorthand, getContainerQuery } from '../cssContainerQueries';
5
5
 
6
6
  // The breakpoint **start** at this value.
7
7
  // For instance with the first breakpoint xs: [xs, sm[.
@@ -22,6 +22,17 @@ const defaultBreakpoints = {
22
22
  keys: ['xs', 'sm', 'md', 'lg', 'xl'],
23
23
  up: key => `@media (min-width:${values[key]}px)`
24
24
  };
25
+ const defaultContainerQueries = {
26
+ containerQueries: containerName => ({
27
+ up: key => {
28
+ let result = typeof key === 'number' ? key : values[key] || key;
29
+ if (typeof result === 'number') {
30
+ result = `${result}px`;
31
+ }
32
+ return containerName ? `@container ${containerName} (min-width:${result})` : `@container (min-width:${result})`;
33
+ }
34
+ })
35
+ };
25
36
  export function handleBreakpoints(props, propValue, styleFromPropValue) {
26
37
  const theme = props.theme || {};
27
38
  if (Array.isArray(propValue)) {
@@ -34,8 +45,14 @@ export function handleBreakpoints(props, propValue, styleFromPropValue) {
34
45
  if (typeof propValue === 'object') {
35
46
  const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
36
47
  return Object.keys(propValue).reduce((acc, breakpoint) => {
48
+ if (isCqShorthand(themeBreakpoints.keys, breakpoint)) {
49
+ const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, breakpoint);
50
+ if (containerKey) {
51
+ acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
52
+ }
53
+ }
37
54
  // key is breakpoint
38
- if (Object.keys(themeBreakpoints.values || values).indexOf(breakpoint) !== -1) {
55
+ else if (Object.keys(themeBreakpoints.values || values).indexOf(breakpoint) !== -1) {
39
56
  const mediaKey = themeBreakpoints.up(breakpoint);
40
57
  acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
41
58
  } else {
@@ -58,21 +75,23 @@ function breakpoints(styleFunction) {
58
75
  const extended = themeBreakpoints.keys.reduce((acc, key) => {
59
76
  if (props[key]) {
60
77
  acc = acc || {};
61
- acc[themeBreakpoints.up(key)] = styleFunction(_extends({
62
- theme
63
- }, props[key]));
78
+ acc[themeBreakpoints.up(key)] = styleFunction({
79
+ theme,
80
+ ...props[key]
81
+ });
64
82
  }
65
83
  return acc;
66
84
  }, null);
67
85
  return merge(base, extended);
68
86
  };
69
- newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? _extends({}, styleFunction.propTypes, {
87
+ newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? {
88
+ ...styleFunction.propTypes,
70
89
  xs: PropTypes.object,
71
90
  sm: PropTypes.object,
72
91
  md: PropTypes.object,
73
92
  lg: PropTypes.object,
74
93
  xl: PropTypes.object
75
- }) : {};
94
+ } : {};
76
95
  newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl', ...styleFunction.filterProps];
77
96
  return newStyleFunction;
78
97
  }
@@ -1,8 +1,5 @@
1
1
  'use client';
2
2
 
3
- import _extends from "@babel/runtime/helpers/esm/extends";
4
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["className", "component"];
6
3
  import * as React from 'react';
7
4
  import clsx from 'clsx';
8
5
  import styled from '@mui/styled-engine';
@@ -21,18 +18,18 @@ export default function createBox(options = {}) {
21
18
  })(styleFunctionSx);
22
19
  const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
23
20
  const theme = useTheme(defaultTheme);
24
- const _extendSxProp = extendSxProp(inProps),
25
- {
26
- className,
27
- component = 'div'
28
- } = _extendSxProp,
29
- other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded);
30
- return /*#__PURE__*/_jsx(BoxRoot, _extends({
21
+ const {
22
+ className,
23
+ component = 'div',
24
+ ...other
25
+ } = extendSxProp(inProps);
26
+ return /*#__PURE__*/_jsx(BoxRoot, {
31
27
  as: component,
32
28
  ref: ref,
33
29
  className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
34
- theme: themeId ? theme[themeId] || theme : theme
35
- }, other));
30
+ theme: themeId ? theme[themeId] || theme : theme,
31
+ ...other
32
+ });
36
33
  });
37
34
  return Box;
38
35
  }