@mui/material 7.0.0-alpha.2 → 7.0.0-beta.1

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 (146) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/Dialog/Dialog.d.ts +0 -5
  3. package/Dialog/Dialog.js +0 -9
  4. package/Grid/Grid.d.ts +51 -100
  5. package/Grid/Grid.js +68 -515
  6. package/Grid/gridClasses.d.ts +0 -38
  7. package/Grid/gridClasses.js +1 -1
  8. package/Grid/index.js +12 -2
  9. package/GridLegacy/GridLegacy.d.ts +160 -0
  10. package/GridLegacy/GridLegacy.js +601 -0
  11. package/{Grid/GridContext.js → GridLegacy/GridLegacyContext.js} +3 -3
  12. package/GridLegacy/gridLegacyClasses.d.ts +48 -0
  13. package/{Grid2/grid2Classes.js → GridLegacy/gridLegacyClasses.js} +5 -5
  14. package/GridLegacy/index.d.ts +4 -0
  15. package/GridLegacy/index.js +35 -0
  16. package/Menu/Menu.d.ts +68 -1
  17. package/Menu/Menu.js +52 -17
  18. package/Modal/Modal.d.ts +0 -5
  19. package/Modal/Modal.js +0 -9
  20. package/PigmentGrid/PigmentGrid.d.ts +1 -1
  21. package/PigmentGrid/PigmentGrid.js +2 -2
  22. package/PigmentGrid/index.d.ts +1 -1
  23. package/PigmentGrid/index.js +4 -4
  24. package/Rating/Rating.d.ts +52 -1
  25. package/Rating/Rating.js +132 -46
  26. package/Select/SelectInput.js +8 -8
  27. package/StepButton/StepButton.d.ts +0 -5
  28. package/esm/Dialog/Dialog.d.ts +0 -5
  29. package/esm/Dialog/Dialog.js +0 -9
  30. package/esm/Grid/Grid.d.ts +51 -100
  31. package/esm/Grid/Grid.js +68 -508
  32. package/esm/Grid/gridClasses.d.ts +0 -38
  33. package/esm/Grid/gridClasses.js +1 -1
  34. package/esm/Grid/index.js +1 -0
  35. package/esm/GridLegacy/GridLegacy.d.ts +160 -0
  36. package/esm/GridLegacy/GridLegacy.js +588 -0
  37. package/esm/GridLegacy/GridLegacyContext.js +12 -0
  38. package/esm/GridLegacy/gridLegacyClasses.d.ts +48 -0
  39. package/esm/{Grid2/grid2Classes.js → GridLegacy/gridLegacyClasses.js} +4 -4
  40. package/esm/GridLegacy/index.d.ts +4 -0
  41. package/esm/GridLegacy/index.js +3 -0
  42. package/esm/Menu/Menu.d.ts +68 -1
  43. package/esm/Menu/Menu.js +52 -17
  44. package/esm/Modal/Modal.d.ts +0 -5
  45. package/esm/Modal/Modal.js +0 -9
  46. package/esm/PigmentGrid/PigmentGrid.d.ts +1 -1
  47. package/esm/PigmentGrid/PigmentGrid.js +2 -2
  48. package/esm/PigmentGrid/index.d.ts +1 -1
  49. package/esm/PigmentGrid/index.js +1 -1
  50. package/esm/Rating/Rating.d.ts +52 -1
  51. package/esm/Rating/Rating.js +131 -45
  52. package/esm/Select/SelectInput.js +8 -8
  53. package/esm/StepButton/StepButton.d.ts +0 -5
  54. package/esm/index.d.ts +3 -8
  55. package/esm/index.js +3 -3
  56. package/esm/styles/components.d.ts +5 -5
  57. package/esm/styles/createTheme.d.ts +0 -1
  58. package/esm/styles/createTheme.js +0 -1
  59. package/esm/styles/createThemeNoVars.d.ts +0 -6
  60. package/esm/styles/createThemeNoVars.js +7 -12
  61. package/esm/styles/index.d.ts +1 -5
  62. package/esm/styles/index.js +1 -2
  63. package/esm/styles/overrides.d.ts +2 -2
  64. package/esm/styles/props.d.ts +2 -2
  65. package/esm/utils/createSvgIcon.d.ts +1 -1
  66. package/esm/utils/createSvgIcon.js +1 -1
  67. package/esm/version/index.js +2 -2
  68. package/index.d.ts +3 -8
  69. package/index.js +9 -9
  70. package/modern/Dialog/Dialog.d.ts +0 -5
  71. package/modern/Dialog/Dialog.js +0 -9
  72. package/modern/Grid/Grid.d.ts +51 -100
  73. package/modern/Grid/Grid.js +68 -508
  74. package/modern/Grid/gridClasses.d.ts +0 -38
  75. package/modern/Grid/gridClasses.js +1 -1
  76. package/modern/Grid/index.js +1 -0
  77. package/modern/GridLegacy/GridLegacy.d.ts +160 -0
  78. package/modern/GridLegacy/GridLegacy.js +588 -0
  79. package/modern/GridLegacy/GridLegacyContext.js +12 -0
  80. package/modern/GridLegacy/gridLegacyClasses.d.ts +48 -0
  81. package/modern/{Grid2/grid2Classes.js → GridLegacy/gridLegacyClasses.js} +4 -4
  82. package/modern/GridLegacy/index.d.ts +4 -0
  83. package/modern/GridLegacy/index.js +3 -0
  84. package/modern/Menu/Menu.d.ts +68 -1
  85. package/modern/Menu/Menu.js +52 -17
  86. package/modern/Modal/Modal.d.ts +0 -5
  87. package/modern/Modal/Modal.js +0 -9
  88. package/modern/PigmentGrid/PigmentGrid.d.ts +1 -1
  89. package/modern/PigmentGrid/PigmentGrid.js +2 -2
  90. package/modern/PigmentGrid/index.d.ts +1 -1
  91. package/modern/PigmentGrid/index.js +1 -1
  92. package/modern/Rating/Rating.d.ts +52 -1
  93. package/modern/Rating/Rating.js +131 -45
  94. package/modern/Select/SelectInput.js +8 -8
  95. package/modern/StepButton/StepButton.d.ts +0 -5
  96. package/modern/index.d.ts +3 -8
  97. package/modern/index.js +3 -3
  98. package/modern/styles/components.d.ts +5 -5
  99. package/modern/styles/createTheme.d.ts +0 -1
  100. package/modern/styles/createTheme.js +0 -1
  101. package/modern/styles/createThemeNoVars.d.ts +0 -6
  102. package/modern/styles/createThemeNoVars.js +7 -12
  103. package/modern/styles/index.d.ts +1 -5
  104. package/modern/styles/index.js +1 -2
  105. package/modern/styles/overrides.d.ts +2 -2
  106. package/modern/styles/props.d.ts +2 -2
  107. package/modern/utils/createSvgIcon.d.ts +1 -1
  108. package/modern/utils/createSvgIcon.js +1 -1
  109. package/modern/version/index.js +2 -2
  110. package/package.json +4 -4
  111. package/styles/components.d.ts +5 -5
  112. package/styles/createTheme.d.ts +0 -1
  113. package/styles/createTheme.js +1 -8
  114. package/styles/createThemeNoVars.d.ts +0 -6
  115. package/styles/createThemeNoVars.js +7 -13
  116. package/styles/index.d.ts +1 -5
  117. package/styles/index.js +1 -15
  118. package/styles/overrides.d.ts +2 -2
  119. package/styles/props.d.ts +2 -2
  120. package/tsconfig.build.tsbuildinfo +1 -1
  121. package/utils/createSvgIcon.d.ts +1 -1
  122. package/utils/createSvgIcon.js +1 -1
  123. package/version/index.js +2 -2
  124. package/Grid2/Grid2.d.ts +0 -111
  125. package/Grid2/Grid2.js +0 -144
  126. package/Grid2/grid2Classes.d.ts +0 -10
  127. package/Grid2/index.d.ts +0 -4
  128. package/Grid2/index.js +0 -45
  129. package/StyledEngineProvider/index.d.ts +0 -4
  130. package/StyledEngineProvider/index.js +0 -12
  131. package/esm/Grid/GridContext.js +0 -12
  132. package/esm/Grid2/Grid2.d.ts +0 -111
  133. package/esm/Grid2/Grid2.js +0 -138
  134. package/esm/Grid2/grid2Classes.d.ts +0 -10
  135. package/esm/Grid2/index.d.ts +0 -4
  136. package/esm/Grid2/index.js +0 -4
  137. package/esm/StyledEngineProvider/index.d.ts +0 -4
  138. package/esm/StyledEngineProvider/index.js +0 -1
  139. package/modern/Grid/GridContext.js +0 -12
  140. package/modern/Grid2/Grid2.d.ts +0 -111
  141. package/modern/Grid2/Grid2.js +0 -138
  142. package/modern/Grid2/grid2Classes.d.ts +0 -10
  143. package/modern/Grid2/index.d.ts +0 -4
  144. package/modern/Grid2/index.js +0 -4
  145. package/modern/StyledEngineProvider/index.d.ts +0 -4
  146. package/modern/StyledEngineProvider/index.js +0 -1
package/Grid/Grid.js CHANGED
@@ -1,481 +1,64 @@
1
1
  "use strict";
2
2
  'use client';
3
3
 
4
- // A grid component using the following libs as inspiration.
5
- //
6
- // For the implementation:
7
- // - https://getbootstrap.com/docs/4.3/layout/grid/
8
- // - https://github.com/kristoferjoseph/flexboxgrid/blob/master/src/css/flexboxgrid.css
9
- // - https://github.com/roylee0704/react-flexbox-grid
10
- // - https://material.angularjs.org/latest/layout/introduction
11
- //
12
- // Follow this flexbox Guide to better understand the underlying model:
13
- // - https://css-tricks.com/snippets/css/a-guide-to-flexbox/
14
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
15
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
16
5
  Object.defineProperty(exports, "__esModule", {
17
6
  value: true
18
7
  });
19
8
  exports.default = void 0;
20
- exports.generateColumnGap = generateColumnGap;
21
- exports.generateDirection = generateDirection;
22
- exports.generateGrid = generateGrid;
23
- exports.generateRowGap = generateRowGap;
24
- exports.resolveSpacingClasses = resolveSpacingClasses;
25
- exports.resolveSpacingStyles = resolveSpacingStyles;
26
- var React = _interopRequireWildcard(require("react"));
27
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
28
- var _clsx = _interopRequireDefault(require("clsx"));
29
- var _system = require("@mui/system");
30
- var _styleFunctionSx = require("@mui/system/styleFunctionSx");
31
- var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
10
+ var _Grid = require("@mui/system/Grid");
32
11
  var _requirePropFactory = _interopRequireDefault(require("../utils/requirePropFactory"));
33
- var _styled = _interopRequireDefault(require("../styles/styled"));
12
+ var _styles = require("../styles");
34
13
  var _DefaultPropsProvider = require("../DefaultPropsProvider");
35
14
  var _useTheme = _interopRequireDefault(require("../styles/useTheme"));
36
- var _GridContext = _interopRequireDefault(require("./GridContext"));
37
- var _gridClasses = _interopRequireWildcard(require("./gridClasses"));
38
- var _jsxRuntime = require("react/jsx-runtime");
39
- function generateGrid({
40
- theme,
41
- ownerState
42
- }) {
43
- let size;
44
- return theme.breakpoints.keys.reduce((globalStyles, breakpoint) => {
45
- // Use side effect over immutability for better performance.
46
- let styles = {};
47
- if (ownerState[breakpoint]) {
48
- size = ownerState[breakpoint];
49
- }
50
- if (!size) {
51
- return globalStyles;
52
- }
53
- if (size === true) {
54
- // For the auto layouting
55
- styles = {
56
- flexBasis: 0,
57
- flexGrow: 1,
58
- maxWidth: '100%'
59
- };
60
- } else if (size === 'auto') {
61
- styles = {
62
- flexBasis: 'auto',
63
- flexGrow: 0,
64
- flexShrink: 0,
65
- maxWidth: 'none',
66
- width: 'auto'
67
- };
68
- } else {
69
- const columnsBreakpointValues = (0, _system.unstable_resolveBreakpointValues)({
70
- values: ownerState.columns,
71
- breakpoints: theme.breakpoints.values
72
- });
73
- const columnValue = typeof columnsBreakpointValues === 'object' ? columnsBreakpointValues[breakpoint] : columnsBreakpointValues;
74
- if (columnValue === undefined || columnValue === null) {
75
- return globalStyles;
76
- }
77
- // Keep 7 significant numbers.
78
- const width = `${Math.round(size / columnValue * 10e7) / 10e5}%`;
79
- let more = {};
80
- if (ownerState.container && ownerState.item && ownerState.columnSpacing !== 0) {
81
- const themeSpacing = theme.spacing(ownerState.columnSpacing);
82
- if (themeSpacing !== '0px') {
83
- const fullWidth = `calc(${width} + ${themeSpacing})`;
84
- more = {
85
- flexBasis: fullWidth,
86
- maxWidth: fullWidth
87
- };
88
- }
89
- }
90
-
91
- // Close to the bootstrap implementation:
92
- // https://github.com/twbs/bootstrap/blob/8fccaa2439e97ec72a4b7dc42ccc1f649790adb0/scss/mixins/_grid.scss#L41
93
- styles = {
94
- flexBasis: width,
95
- flexGrow: 0,
96
- maxWidth: width,
97
- ...more
98
- };
99
- }
100
-
101
- // No need for a media query for the first size.
102
- if (theme.breakpoints.values[breakpoint] === 0) {
103
- Object.assign(globalStyles, styles);
104
- } else {
105
- globalStyles[theme.breakpoints.up(breakpoint)] = styles;
106
- }
107
- return globalStyles;
108
- }, {});
109
- }
110
- function generateDirection({
111
- theme,
112
- ownerState
113
- }) {
114
- const directionValues = (0, _system.unstable_resolveBreakpointValues)({
115
- values: ownerState.direction,
116
- breakpoints: theme.breakpoints.values
117
- });
118
- return (0, _system.handleBreakpoints)({
119
- theme
120
- }, directionValues, propValue => {
121
- const output = {
122
- flexDirection: propValue
123
- };
124
- if (propValue.startsWith('column')) {
125
- output[`& > .${_gridClasses.default.item}`] = {
126
- maxWidth: 'none'
127
- };
128
- }
129
- return output;
130
- });
131
- }
132
-
133
15
  /**
134
- * Extracts zero value breakpoint keys before a non-zero value breakpoint key.
135
- * @example { xs: 0, sm: 0, md: 2, lg: 0, xl: 0 } or [0, 0, 2, 0, 0]
136
- * @returns [xs, sm]
16
+ *
17
+ * Demos:
18
+ *
19
+ * - [Grid](https://next.mui.com/material-ui/react-grid/)
20
+ *
21
+ * API:
22
+ *
23
+ * - [Grid API](https://next.mui.com/material-ui/api/grid/)
137
24
  */
138
- function extractZeroValueBreakpointKeys({
139
- breakpoints,
140
- values
141
- }) {
142
- let nonZeroKey = '';
143
- Object.keys(values).forEach(key => {
144
- if (nonZeroKey !== '') {
145
- return;
146
- }
147
- if (values[key] !== 0) {
148
- nonZeroKey = key;
149
- }
150
- });
151
- const sortedBreakpointKeysByValue = Object.keys(breakpoints).sort((a, b) => {
152
- return breakpoints[a] - breakpoints[b];
153
- });
154
- return sortedBreakpointKeysByValue.slice(0, sortedBreakpointKeysByValue.indexOf(nonZeroKey));
155
- }
156
- function generateRowGap({
157
- theme,
158
- ownerState
159
- }) {
160
- const {
161
- container,
162
- rowSpacing
163
- } = ownerState;
164
- let styles = {};
165
- if (container && rowSpacing !== 0) {
166
- const rowSpacingValues = (0, _system.unstable_resolveBreakpointValues)({
167
- values: rowSpacing,
168
- breakpoints: theme.breakpoints.values
169
- });
170
- let zeroValueBreakpointKeys;
171
- if (typeof rowSpacingValues === 'object') {
172
- zeroValueBreakpointKeys = extractZeroValueBreakpointKeys({
173
- breakpoints: theme.breakpoints.values,
174
- values: rowSpacingValues
175
- });
176
- }
177
- styles = (0, _system.handleBreakpoints)({
178
- theme
179
- }, rowSpacingValues, (propValue, breakpoint) => {
180
- const themeSpacing = theme.spacing(propValue);
181
- if (themeSpacing !== '0px') {
182
- return {
183
- marginTop: `calc(-1 * ${themeSpacing})`,
184
- [`& > .${_gridClasses.default.item}`]: {
185
- paddingTop: themeSpacing
186
- }
187
- };
188
- }
189
- if (zeroValueBreakpointKeys?.includes(breakpoint)) {
190
- return {};
191
- }
192
- return {
193
- marginTop: 0,
194
- [`& > .${_gridClasses.default.item}`]: {
195
- paddingTop: 0
196
- }
197
- };
198
- });
199
- }
200
- return styles;
201
- }
202
- function generateColumnGap({
203
- theme,
204
- ownerState
205
- }) {
206
- const {
207
- container,
208
- columnSpacing
209
- } = ownerState;
210
- let styles = {};
211
- if (container && columnSpacing !== 0) {
212
- const columnSpacingValues = (0, _system.unstable_resolveBreakpointValues)({
213
- values: columnSpacing,
214
- breakpoints: theme.breakpoints.values
215
- });
216
- let zeroValueBreakpointKeys;
217
- if (typeof columnSpacingValues === 'object') {
218
- zeroValueBreakpointKeys = extractZeroValueBreakpointKeys({
219
- breakpoints: theme.breakpoints.values,
220
- values: columnSpacingValues
221
- });
222
- }
223
- styles = (0, _system.handleBreakpoints)({
224
- theme
225
- }, columnSpacingValues, (propValue, breakpoint) => {
226
- const themeSpacing = theme.spacing(propValue);
227
- if (themeSpacing !== '0px') {
228
- const negativeValue = `calc(-1 * ${themeSpacing})`;
229
- return {
230
- width: `calc(100% + ${themeSpacing})`,
231
- marginLeft: negativeValue,
232
- [`& > .${_gridClasses.default.item}`]: {
233
- paddingLeft: themeSpacing
234
- }
235
- };
236
- }
237
- if (zeroValueBreakpointKeys?.includes(breakpoint)) {
238
- return {};
239
- }
240
- return {
241
- width: '100%',
242
- marginLeft: 0,
243
- [`& > .${_gridClasses.default.item}`]: {
244
- paddingLeft: 0
245
- }
246
- };
247
- });
248
- }
249
- return styles;
250
- }
251
- function resolveSpacingStyles(spacing, breakpoints, styles = {}) {
252
- // undefined/null or `spacing` <= 0
253
- if (!spacing || spacing <= 0) {
254
- return [];
255
- }
256
- // in case of string/number `spacing`
257
- if (typeof spacing === 'string' && !Number.isNaN(Number(spacing)) || typeof spacing === 'number') {
258
- return [styles[`spacing-xs-${String(spacing)}`]];
259
- }
260
- // in case of object `spacing`
261
- const spacingStyles = [];
262
- breakpoints.forEach(breakpoint => {
263
- const value = spacing[breakpoint];
264
- if (Number(value) > 0) {
265
- spacingStyles.push(styles[`spacing-${breakpoint}-${String(value)}`]);
266
- }
267
- });
268
- return spacingStyles;
269
- }
270
-
271
- // Default CSS values
272
- // flex: '0 1 auto',
273
- // flexDirection: 'row',
274
- // alignItems: 'flex-start',
275
- // flexWrap: 'nowrap',
276
- // justifyContent: 'flex-start',
277
- const GridRoot = (0, _styled.default)('div', {
278
- name: 'MuiGrid',
279
- slot: 'Root',
280
- overridesResolver: (props, styles) => {
281
- const {
282
- ownerState
283
- } = props;
284
- const {
285
- container,
286
- direction,
287
- item,
288
- spacing,
289
- wrap,
290
- zeroMinWidth,
291
- breakpoints
292
- } = ownerState;
293
- let spacingStyles = [];
294
-
295
- // in case of grid item
296
- if (container) {
297
- spacingStyles = resolveSpacingStyles(spacing, breakpoints, styles);
25
+ const Grid = (0, _Grid.createGrid)({
26
+ createStyledComponent: (0, _styles.styled)('div', {
27
+ name: 'MuiGrid',
28
+ slot: 'Root',
29
+ overridesResolver: (props, styles) => {
30
+ const {
31
+ ownerState
32
+ } = props;
33
+ return [styles.root, ownerState.container && styles.container];
298
34
  }
299
- const breakpointsStyles = [];
300
- breakpoints.forEach(breakpoint => {
301
- const value = ownerState[breakpoint];
302
- if (value) {
303
- breakpointsStyles.push(styles[`grid-${breakpoint}-${String(value)}`]);
304
- }
305
- });
306
- return [styles.root, container && styles.container, item && styles.item, zeroMinWidth && styles.zeroMinWidth, ...spacingStyles, direction !== 'row' && styles[`direction-xs-${String(direction)}`], wrap !== 'wrap' && styles[`wrap-xs-${String(wrap)}`], ...breakpointsStyles];
307
- }
308
- })(
309
- // FIXME(romgrk): Can't use memoTheme here
310
- ({
311
- ownerState
312
- }) => ({
313
- boxSizing: 'border-box',
314
- ...(ownerState.container && {
315
- display: 'flex',
316
- flexWrap: 'wrap',
317
- width: '100%'
318
- }),
319
- ...(ownerState.item && {
320
- margin: 0 // For instance, it's useful when used with a `figure` element.
321
35
  }),
322
- ...(ownerState.zeroMinWidth && {
323
- minWidth: 0
324
- }),
325
- ...(ownerState.wrap !== 'wrap' && {
326
- flexWrap: ownerState.wrap
327
- })
328
- }), generateDirection, generateRowGap, generateColumnGap, generateGrid);
329
- function resolveSpacingClasses(spacing, breakpoints) {
330
- // undefined/null or `spacing` <= 0
331
- if (!spacing || spacing <= 0) {
332
- return [];
333
- }
334
- // in case of string/number `spacing`
335
- if (typeof spacing === 'string' && !Number.isNaN(Number(spacing)) || typeof spacing === 'number') {
336
- return [`spacing-xs-${String(spacing)}`];
337
- }
338
- // in case of object `spacing`
339
- const classes = [];
340
- breakpoints.forEach(breakpoint => {
341
- const value = spacing[breakpoint];
342
- if (Number(value) > 0) {
343
- const className = `spacing-${breakpoint}-${String(value)}`;
344
- classes.push(className);
345
- }
346
- });
347
- return classes;
348
- }
349
- const useUtilityClasses = ownerState => {
350
- const {
351
- classes,
352
- container,
353
- direction,
354
- item,
355
- spacing,
356
- wrap,
357
- zeroMinWidth,
358
- breakpoints
359
- } = ownerState;
360
- let spacingClasses = [];
361
-
362
- // in case of grid item
363
- if (container) {
364
- spacingClasses = resolveSpacingClasses(spacing, breakpoints);
365
- }
366
- const breakpointsClasses = [];
367
- breakpoints.forEach(breakpoint => {
368
- const value = ownerState[breakpoint];
369
- if (value) {
370
- breakpointsClasses.push(`grid-${breakpoint}-${String(value)}`);
371
- }
372
- });
373
- const slots = {
374
- root: ['root', container && 'container', item && 'item', zeroMinWidth && 'zeroMinWidth', ...spacingClasses, direction !== 'row' && `direction-xs-${String(direction)}`, wrap !== 'wrap' && `wrap-xs-${String(wrap)}`, ...breakpointsClasses]
375
- };
376
- return (0, _composeClasses.default)(slots, _gridClasses.getGridUtilityClass, classes);
377
- };
378
-
379
- /**
380
- * @deprecated Use the [`Grid2`](https://mui.com/material-ui/react-grid2/) component instead.
381
- */
382
- const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
383
- const themeProps = (0, _DefaultPropsProvider.useDefaultProps)({
36
+ componentName: 'MuiGrid',
37
+ useThemeProps: inProps => (0, _DefaultPropsProvider.useDefaultProps)({
384
38
  props: inProps,
385
39
  name: 'MuiGrid'
386
- });
387
- const {
388
- breakpoints
389
- } = (0, _useTheme.default)();
390
- const props = (0, _styleFunctionSx.extendSxProp)(themeProps);
391
- const {
392
- className,
393
- columns: columnsProp,
394
- columnSpacing: columnSpacingProp,
395
- component = 'div',
396
- container = false,
397
- direction = 'row',
398
- item = false,
399
- rowSpacing: rowSpacingProp,
400
- spacing = 0,
401
- wrap = 'wrap',
402
- zeroMinWidth = false,
403
- ...other
404
- } = props;
405
- const rowSpacing = rowSpacingProp || spacing;
406
- const columnSpacing = columnSpacingProp || spacing;
407
- const columnsContext = React.useContext(_GridContext.default);
408
-
409
- // columns set with default breakpoint unit of 12
410
- const columns = container ? columnsProp || 12 : columnsContext;
411
- const breakpointsValues = {};
412
- const otherFiltered = {
413
- ...other
414
- };
415
- breakpoints.keys.forEach(breakpoint => {
416
- if (other[breakpoint] != null) {
417
- breakpointsValues[breakpoint] = other[breakpoint];
418
- delete otherFiltered[breakpoint];
419
- }
420
- });
421
- const ownerState = {
422
- ...props,
423
- columns,
424
- container,
425
- direction,
426
- item,
427
- rowSpacing,
428
- columnSpacing,
429
- wrap,
430
- zeroMinWidth,
431
- spacing,
432
- ...breakpointsValues,
433
- breakpoints: breakpoints.keys
434
- };
435
- const classes = useUtilityClasses(ownerState);
436
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridContext.default.Provider, {
437
- value: columns,
438
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GridRoot, {
439
- ownerState: ownerState,
440
- className: (0, _clsx.default)(classes.root, className),
441
- as: component,
442
- ref: ref,
443
- ...otherFiltered
444
- })
445
- });
40
+ }),
41
+ useTheme: _useTheme.default
446
42
  });
447
43
  process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
448
44
  // ┌────────────────────────────── Warning ──────────────────────────────┐
449
45
  // │ These PropTypes are generated from the TypeScript type definitions. │
450
- // │ To update them, edit the d.ts file and run `pnpm proptypes`.
46
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`.
451
47
  // └─────────────────────────────────────────────────────────────────────┘
452
48
  /**
453
49
  * The content of the component.
454
50
  */
455
51
  children: _propTypes.default.node,
456
- /**
457
- * Override or extend the styles applied to the component.
458
- */
459
- classes: _propTypes.default.object,
460
- /**
461
- * @ignore
462
- */
463
- className: _propTypes.default.string,
464
52
  /**
465
53
  * The number of columns.
466
54
  * @default 12
467
55
  */
468
- columns: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.number), _propTypes.default.number, _propTypes.default.object]),
56
+ columns: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.arrayOf(_propTypes.default.number), _propTypes.default.number, _propTypes.default.object]),
469
57
  /**
470
58
  * Defines the horizontal space between the type `item` components.
471
59
  * It overrides the value of the `spacing` prop.
472
60
  */
473
- columnSpacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
474
- /**
475
- * The component used for the root node.
476
- * Either a string to use a HTML element or a component.
477
- */
478
- component: _propTypes.default.elementType,
61
+ columnSpacing: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
479
62
  /**
480
63
  * If `true`, the component will have the flex *container* behavior.
481
64
  * You should be wrapping *items* with a *container*.
@@ -487,105 +70,75 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ =
487
70
  * It is applied for all screen sizes.
488
71
  * @default 'row'
489
72
  */
490
- direction: _propTypes.default.oneOfType([_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), _propTypes.default.arrayOf(_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), _propTypes.default.object]),
491
- /**
492
- * If `true`, the component will have the flex *item* behavior.
493
- * You should be wrapping *items* with a *container*.
494
- * @default false
495
- */
496
- item: _propTypes.default.bool,
73
+ direction: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), _propTypes.default.arrayOf(_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), _propTypes.default.object]),
497
74
  /**
498
- * If a number, it sets the number of columns the grid item uses.
499
- * It can't be greater than the total number of columns of the container (12 by default).
500
- * If 'auto', the grid item's width matches its content.
501
- * If false, the prop is ignored.
502
- * If true, the grid item's width grows to use the space available in the grid container.
503
- * The value is applied for the `lg` breakpoint and wider screens if not overridden.
504
- * @default false
75
+ * Defines the offset value for the type `item` components.
505
76
  */
506
- lg: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
507
- /**
508
- * If a number, it sets the number of columns the grid item uses.
509
- * It can't be greater than the total number of columns of the container (12 by default).
510
- * If 'auto', the grid item's width matches its content.
511
- * If false, the prop is ignored.
512
- * If true, the grid item's width grows to use the space available in the grid container.
513
- * The value is applied for the `md` breakpoint and wider screens if not overridden.
514
- * @default false
515
- */
516
- md: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
77
+ offset: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])), _propTypes.default.object]),
517
78
  /**
518
79
  * Defines the vertical space between the type `item` components.
519
80
  * It overrides the value of the `spacing` prop.
520
81
  */
521
- rowSpacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
82
+ rowSpacing: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
522
83
  /**
523
- * If a number, it sets the number of columns the grid item uses.
524
- * It can't be greater than the total number of columns of the container (12 by default).
525
- * If 'auto', the grid item's width matches its content.
526
- * If false, the prop is ignored.
527
- * If true, the grid item's width grows to use the space available in the grid container.
528
- * The value is applied for the `sm` breakpoint and wider screens if not overridden.
529
- * @default false
84
+ * Defines the size of the the type `item` components.
530
85
  */
531
- sm: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
86
+ size: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.string, _propTypes.default.bool, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool, _propTypes.default.number])), _propTypes.default.object]),
532
87
  /**
533
88
  * Defines the space between the type `item` components.
534
89
  * It can only be used on a type `container` component.
535
90
  * @default 0
536
91
  */
537
- spacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
92
+ spacing: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
538
93
  /**
539
- * The system prop that allows defining system overrides as well as additional CSS styles.
94
+ * @ignore
540
95
  */
541
96
  sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
97
+ /**
98
+ * @internal
99
+ * The level of the grid starts from `0` and increases when the grid nests
100
+ * inside another grid. Nesting is defined as a container Grid being a direct
101
+ * child of a container Grid.
102
+ *
103
+ * ```js
104
+ * <Grid container> // level 0
105
+ * <Grid container> // level 1
106
+ * <Grid container> // level 2
107
+ * ```
108
+ *
109
+ * Only consecutive grid is considered nesting. A grid container will start at
110
+ * `0` if there are non-Grid container element above it.
111
+ *
112
+ * ```js
113
+ * <Grid container> // level 0
114
+ * <div>
115
+ * <Grid container> // level 0
116
+ * ```
117
+ *
118
+ * ```js
119
+ * <Grid container> // level 0
120
+ * <Grid>
121
+ * <Grid container> // level 0
122
+ * ```
123
+ */
124
+ unstable_level: _propTypes.default.number,
542
125
  /**
543
126
  * Defines the `flex-wrap` style property.
544
127
  * It's applied for all screen sizes.
545
128
  * @default 'wrap'
546
129
  */
547
- wrap: _propTypes.default.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
548
- /**
549
- * If a number, it sets the number of columns the grid item uses.
550
- * It can't be greater than the total number of columns of the container (12 by default).
551
- * If 'auto', the grid item's width matches its content.
552
- * If false, the prop is ignored.
553
- * If true, the grid item's width grows to use the space available in the grid container.
554
- * The value is applied for the `xl` breakpoint and wider screens if not overridden.
555
- * @default false
556
- */
557
- xl: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
558
- /**
559
- * If a number, it sets the number of columns the grid item uses.
560
- * It can't be greater than the total number of columns of the container (12 by default).
561
- * If 'auto', the grid item's width matches its content.
562
- * If false, the prop is ignored.
563
- * If true, the grid item's width grows to use the space available in the grid container.
564
- * The value is applied for all the screen sizes with the lowest priority.
565
- * @default false
566
- */
567
- xs: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
568
- /**
569
- * If `true`, it sets `min-width: 0` on the item.
570
- * Refer to the limitations section of the documentation to better understand the use case.
571
- * @default false
572
- */
573
- zeroMinWidth: _propTypes.default.bool
130
+ wrap: _propTypes.default.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
574
131
  } : void 0;
575
132
  if (process.env.NODE_ENV !== 'production') {
576
- const requireProp = (0, _requirePropFactory.default)('Grid', Grid);
133
+ const Component = Grid;
134
+ const requireProp = (0, _requirePropFactory.default)('Grid', Component);
577
135
  // eslint-disable-next-line no-useless-concat
578
- Grid['propTypes' + ''] = {
136
+ Component['propTypes' + ''] = {
579
137
  // eslint-disable-next-line react/forbid-foreign-prop-types
580
- ...Grid.propTypes,
138
+ ...Component.propTypes,
581
139
  direction: requireProp('container'),
582
- lg: requireProp('item'),
583
- md: requireProp('item'),
584
- sm: requireProp('item'),
585
140
  spacing: requireProp('container'),
586
- wrap: requireProp('container'),
587
- xs: requireProp('item'),
588
- zeroMinWidth: requireProp('item')
141
+ wrap: requireProp('container')
589
142
  };
590
143
  }
591
144
  var _default = exports.default = Grid;