@mui/system 5.8.7 → 5.9.2
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.
- package/CHANGELOG.md +200 -4
- package/Unstable_Grid/Grid.d.ts +12 -0
- package/Unstable_Grid/Grid.js +195 -0
- package/Unstable_Grid/GridProps.d.ts +162 -0
- package/Unstable_Grid/GridProps.js +5 -0
- package/Unstable_Grid/createGrid.d.ts +11 -0
- package/Unstable_Grid/createGrid.js +199 -0
- package/Unstable_Grid/gridClasses.d.ts +20 -0
- package/Unstable_Grid/gridClasses.js +25 -0
- package/Unstable_Grid/gridGenerator.d.ts +26 -0
- package/Unstable_Grid/gridGenerator.js +275 -0
- package/Unstable_Grid/index.d.ts +5 -0
- package/Unstable_Grid/index.js +65 -0
- package/Unstable_Grid/package.json +6 -0
- package/breakpoints.js +1 -1
- package/{grid.js → cssGrid.js} +0 -0
- package/cssVars/useCurrentColorScheme.js +1 -1
- package/esm/Unstable_Grid/Grid.js +184 -0
- package/esm/Unstable_Grid/GridProps.js +1 -0
- package/esm/Unstable_Grid/createGrid.js +177 -0
- package/esm/Unstable_Grid/gridClasses.js +14 -0
- package/esm/Unstable_Grid/gridGenerator.js +236 -0
- package/esm/Unstable_Grid/index.js +5 -0
- package/esm/breakpoints.js +1 -1
- package/esm/{grid.js → cssGrid.js} +0 -0
- package/esm/cssVars/useCurrentColorScheme.js +1 -1
- package/esm/getThemeValue.js +1 -1
- package/esm/index.js +9 -3
- package/getThemeValue.js +3 -3
- package/index.d.ts +3 -0
- package/index.js +30 -7
- package/legacy/Unstable_Grid/Grid.js +184 -0
- package/legacy/Unstable_Grid/GridProps.js +1 -0
- package/legacy/Unstable_Grid/createGrid.js +191 -0
- package/legacy/Unstable_Grid/gridClasses.js +27 -0
- package/legacy/Unstable_Grid/gridGenerator.js +245 -0
- package/legacy/Unstable_Grid/index.js +5 -0
- package/legacy/breakpoints.js +1 -1
- package/legacy/{grid.js → cssGrid.js} +0 -0
- package/legacy/cssVars/useCurrentColorScheme.js +1 -1
- package/legacy/getThemeValue.js +1 -1
- package/legacy/index.js +10 -4
- package/modern/Unstable_Grid/Grid.js +184 -0
- package/modern/Unstable_Grid/GridProps.js +1 -0
- package/modern/Unstable_Grid/createGrid.js +175 -0
- package/modern/Unstable_Grid/gridClasses.js +14 -0
- package/modern/Unstable_Grid/gridGenerator.js +232 -0
- package/modern/Unstable_Grid/index.js +5 -0
- package/modern/breakpoints.js +1 -1
- package/modern/{grid.js → cssGrid.js} +0 -0
- package/modern/cssVars/useCurrentColorScheme.js +1 -1
- package/modern/getThemeValue.js +1 -1
- package/modern/index.js +10 -4
- package/package.json +5 -5
package/getThemeValue.js
CHANGED
|
@@ -13,7 +13,7 @@ var _display = _interopRequireDefault(require("./display"));
|
|
|
13
13
|
|
|
14
14
|
var _flexbox = _interopRequireDefault(require("./flexbox"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _cssGrid = _interopRequireDefault(require("./cssGrid"));
|
|
17
17
|
|
|
18
18
|
var _positions = _interopRequireDefault(require("./positions"));
|
|
19
19
|
|
|
@@ -31,7 +31,7 @@ const filterPropsMapping = {
|
|
|
31
31
|
borders: _borders.default.filterProps,
|
|
32
32
|
display: _display.default.filterProps,
|
|
33
33
|
flexbox: _flexbox.default.filterProps,
|
|
34
|
-
grid:
|
|
34
|
+
grid: _cssGrid.default.filterProps,
|
|
35
35
|
positions: _positions.default.filterProps,
|
|
36
36
|
palette: _palette.default.filterProps,
|
|
37
37
|
shadows: _shadows.default.filterProps,
|
|
@@ -43,7 +43,7 @@ const styleFunctionMapping = {
|
|
|
43
43
|
borders: _borders.default,
|
|
44
44
|
display: _display.default,
|
|
45
45
|
flexbox: _flexbox.default,
|
|
46
|
-
grid:
|
|
46
|
+
grid: _cssGrid.default,
|
|
47
47
|
positions: _positions.default,
|
|
48
48
|
palette: _palette.default,
|
|
49
49
|
shadows: _shadows.default,
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.9.2
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -53,7 +53,8 @@ var _exportNames = {
|
|
|
53
53
|
unstable_createCssVarsProvider: true,
|
|
54
54
|
unstable_createGetCssVar: true,
|
|
55
55
|
createContainer: true,
|
|
56
|
-
Container: true
|
|
56
|
+
Container: true,
|
|
57
|
+
Unstable_Grid: true
|
|
57
58
|
};
|
|
58
59
|
Object.defineProperty(exports, "Box", {
|
|
59
60
|
enumerable: true,
|
|
@@ -85,6 +86,12 @@ Object.defineProperty(exports, "ThemeProvider", {
|
|
|
85
86
|
return _ThemeProvider.default;
|
|
86
87
|
}
|
|
87
88
|
});
|
|
89
|
+
Object.defineProperty(exports, "Unstable_Grid", {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function () {
|
|
92
|
+
return _Grid.default;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
88
95
|
Object.defineProperty(exports, "borders", {
|
|
89
96
|
enumerable: true,
|
|
90
97
|
get: function () {
|
|
@@ -178,7 +185,7 @@ Object.defineProperty(exports, "getThemeProps", {
|
|
|
178
185
|
Object.defineProperty(exports, "grid", {
|
|
179
186
|
enumerable: true,
|
|
180
187
|
get: function () {
|
|
181
|
-
return
|
|
188
|
+
return _cssGrid.default;
|
|
182
189
|
}
|
|
183
190
|
});
|
|
184
191
|
Object.defineProperty(exports, "handleBreakpoints", {
|
|
@@ -350,16 +357,16 @@ Object.keys(_flexbox).forEach(function (key) {
|
|
|
350
357
|
});
|
|
351
358
|
});
|
|
352
359
|
|
|
353
|
-
var
|
|
360
|
+
var _cssGrid = _interopRequireWildcard(require("./cssGrid"));
|
|
354
361
|
|
|
355
|
-
Object.keys(
|
|
362
|
+
Object.keys(_cssGrid).forEach(function (key) {
|
|
356
363
|
if (key === "default" || key === "__esModule") return;
|
|
357
364
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
358
|
-
if (key in exports && exports[key] ===
|
|
365
|
+
if (key in exports && exports[key] === _cssGrid[key]) return;
|
|
359
366
|
Object.defineProperty(exports, key, {
|
|
360
367
|
enumerable: true,
|
|
361
368
|
get: function () {
|
|
362
|
-
return
|
|
369
|
+
return _cssGrid[key];
|
|
363
370
|
}
|
|
364
371
|
});
|
|
365
372
|
});
|
|
@@ -514,6 +521,22 @@ Object.keys(_Container).forEach(function (key) {
|
|
|
514
521
|
});
|
|
515
522
|
});
|
|
516
523
|
|
|
524
|
+
var _Grid = _interopRequireDefault(require("./Unstable_Grid/Grid"));
|
|
525
|
+
|
|
526
|
+
var _Unstable_Grid = require("./Unstable_Grid");
|
|
527
|
+
|
|
528
|
+
Object.keys(_Unstable_Grid).forEach(function (key) {
|
|
529
|
+
if (key === "default" || key === "__esModule") return;
|
|
530
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
531
|
+
if (key in exports && exports[key] === _Unstable_Grid[key]) return;
|
|
532
|
+
Object.defineProperty(exports, key, {
|
|
533
|
+
enumerable: true,
|
|
534
|
+
get: function () {
|
|
535
|
+
return _Unstable_Grid[key];
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
});
|
|
539
|
+
|
|
517
540
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
518
541
|
|
|
519
542
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import createGrid from './createGrid';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Demos:
|
|
6
|
+
*
|
|
7
|
+
* - [Grid (Material UI)](https://mui.com/material-ui/react-grid/)
|
|
8
|
+
*
|
|
9
|
+
* API:
|
|
10
|
+
*
|
|
11
|
+
* - [Grid API](https://mui.com/system/api/grid/)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
var Grid = createGrid();
|
|
15
|
+
process.env.NODE_ENV !== "production" ? Grid.propTypes
|
|
16
|
+
/* remove-proptypes */
|
|
17
|
+
= {
|
|
18
|
+
// ----------------------------- Warning --------------------------------
|
|
19
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
20
|
+
// | To update them edit TypeScript types and run "yarn proptypes" |
|
|
21
|
+
// ----------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The content of the component.
|
|
25
|
+
*/
|
|
26
|
+
children: PropTypes.node,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The number of columns.
|
|
30
|
+
* @default 12
|
|
31
|
+
*/
|
|
32
|
+
columns: PropTypes
|
|
33
|
+
/* @typescript-to-proptypes-ignore */
|
|
34
|
+
.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Defines the horizontal space between the type `item` components.
|
|
38
|
+
* It overrides the value of the `spacing` prop.
|
|
39
|
+
*/
|
|
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
|
+
|
|
44
|
+
/**
|
|
45
|
+
* If `true`, the component will have the flex *container* behavior.
|
|
46
|
+
* You should be wrapping *items* with a *container*.
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
container: PropTypes.bool,
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Defines the `flex-direction` style property.
|
|
53
|
+
* It is applied for all screen sizes.
|
|
54
|
+
* @default 'row'
|
|
55
|
+
*/
|
|
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
|
+
|
|
60
|
+
/**
|
|
61
|
+
* If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
|
|
62
|
+
*/
|
|
63
|
+
disableEqualOverflow: PropTypes.bool,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
67
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
68
|
+
* If 'auto', the grid item's width matches its content.
|
|
69
|
+
* If false, the prop is ignored.
|
|
70
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
71
|
+
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
78
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
79
|
+
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
80
|
+
*/
|
|
81
|
+
lgOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
85
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
86
|
+
* If 'auto', the grid item's width matches its content.
|
|
87
|
+
* If false, the prop is ignored.
|
|
88
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
89
|
+
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
96
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
97
|
+
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
98
|
+
*/
|
|
99
|
+
mdOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Defines the vertical space between the type `item` components.
|
|
103
|
+
* It overrides the value of the `spacing` prop.
|
|
104
|
+
*/
|
|
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
|
+
|
|
109
|
+
/**
|
|
110
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
111
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
112
|
+
* If 'auto', the grid item's width matches its content.
|
|
113
|
+
* If false, the prop is ignored.
|
|
114
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
115
|
+
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
sm: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
122
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
123
|
+
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
124
|
+
*/
|
|
125
|
+
smOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Defines the space between the type `item` components.
|
|
129
|
+
* It can only be used on a type `container` component.
|
|
130
|
+
* @default 0
|
|
131
|
+
*/
|
|
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
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @ignore
|
|
138
|
+
*/
|
|
139
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Defines the `flex-wrap` style property.
|
|
143
|
+
* It's applied for all screen sizes.
|
|
144
|
+
* @default 'wrap'
|
|
145
|
+
*/
|
|
146
|
+
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
150
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
151
|
+
* If 'auto', the grid item's width matches its content.
|
|
152
|
+
* If false, the prop is ignored.
|
|
153
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
154
|
+
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
157
|
+
xl: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
161
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
162
|
+
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
163
|
+
*/
|
|
164
|
+
xlOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
168
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
169
|
+
* If 'auto', the grid item's width matches its content.
|
|
170
|
+
* If false, the prop is ignored.
|
|
171
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
172
|
+
* The value is applied for all the screen sizes with the lowest priority.
|
|
173
|
+
* @default false
|
|
174
|
+
*/
|
|
175
|
+
xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
179
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
180
|
+
* The value is applied for the `xs` breakpoint and wider screens if not overridden.
|
|
181
|
+
*/
|
|
182
|
+
xsOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
|
|
183
|
+
} : void 0;
|
|
184
|
+
export default Grid;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass } from '@mui/utils';
|
|
9
|
+
import systemStyled from '../styled';
|
|
10
|
+
import useThemePropsSystem from '../useThemeProps';
|
|
11
|
+
import useTheme from '../useTheme';
|
|
12
|
+
import { extendSxProp } from '../styleFunctionSx';
|
|
13
|
+
import createTheme from '../createTheme';
|
|
14
|
+
import { generateGridStyles, generateGridSizeStyles, generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridDirectionStyles, generateGridOffsetStyles, generateSizeClassNames, generateSpacingClassNames } from './gridGenerator';
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
var defaultTheme = createTheme(); // widening Theme to any so that the consumer can own the theme structure.
|
|
17
|
+
|
|
18
|
+
var defaultCreateStyledComponent = systemStyled('div', {
|
|
19
|
+
name: 'MuiGrid',
|
|
20
|
+
slot: 'Root',
|
|
21
|
+
overridesResolver: function overridesResolver(props, styles) {
|
|
22
|
+
return styles.root;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
function useThemePropsDefault(props) {
|
|
27
|
+
return useThemePropsSystem({
|
|
28
|
+
props: props,
|
|
29
|
+
name: 'MuiGrid',
|
|
30
|
+
defaultTheme: defaultTheme
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default function createGrid() {
|
|
35
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
36
|
+
var _options$createStyled = options.createStyledComponent,
|
|
37
|
+
createStyledComponent = _options$createStyled === void 0 ? defaultCreateStyledComponent : _options$createStyled,
|
|
38
|
+
_options$useThemeProp = options.useThemeProps,
|
|
39
|
+
useThemeProps = _options$useThemeProp === void 0 ? useThemePropsDefault : _options$useThemeProp,
|
|
40
|
+
_options$componentNam = options.componentName,
|
|
41
|
+
componentName = _options$componentNam === void 0 ? 'MuiGrid' : _options$componentNam;
|
|
42
|
+
var NestedContext = /*#__PURE__*/React.createContext(false);
|
|
43
|
+
var OverflowContext = /*#__PURE__*/React.createContext(undefined);
|
|
44
|
+
|
|
45
|
+
var useUtilityClasses = function useUtilityClasses(ownerState, theme) {
|
|
46
|
+
var container = ownerState.container,
|
|
47
|
+
direction = ownerState.direction,
|
|
48
|
+
spacing = ownerState.spacing,
|
|
49
|
+
wrap = ownerState.wrap,
|
|
50
|
+
gridSize = ownerState.gridSize;
|
|
51
|
+
var slots = {
|
|
52
|
+
root: ['root', container && 'container', direction !== 'row' && "direction-xs-".concat(String(direction)), wrap !== 'wrap' && "wrap-xs-".concat(String(wrap))].concat(_toConsumableArray(generateSizeClassNames(gridSize)), _toConsumableArray(container ? generateSpacingClassNames(spacing, theme.breakpoints.keys[0]) : []))
|
|
53
|
+
};
|
|
54
|
+
return composeClasses(slots, function (slot) {
|
|
55
|
+
return generateUtilityClass(componentName, slot);
|
|
56
|
+
}, {});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
var GridRoot = createStyledComponent(generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridSizeStyles, generateGridDirectionStyles, generateGridStyles, generateGridOffsetStyles);
|
|
60
|
+
var Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
|
|
61
|
+
var _inProps$columns, _inProps$spacing, _ref3, _inProps$rowSpacing, _ref4, _inProps$columnSpacin, _ref5, _disableEqualOverflow;
|
|
62
|
+
|
|
63
|
+
var theme = useTheme();
|
|
64
|
+
var themeProps = useThemeProps(inProps);
|
|
65
|
+
var props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
66
|
+
|
|
67
|
+
var nested = React.useContext(NestedContext);
|
|
68
|
+
var overflow = React.useContext(OverflowContext);
|
|
69
|
+
|
|
70
|
+
var className = props.className,
|
|
71
|
+
_props$columns = props.columns,
|
|
72
|
+
columnsProp = _props$columns === void 0 ? 12 : _props$columns,
|
|
73
|
+
_props$container = props.container,
|
|
74
|
+
container = _props$container === void 0 ? false : _props$container,
|
|
75
|
+
_props$component = props.component,
|
|
76
|
+
component = _props$component === void 0 ? 'div' : _props$component,
|
|
77
|
+
_props$direction = props.direction,
|
|
78
|
+
direction = _props$direction === void 0 ? 'row' : _props$direction,
|
|
79
|
+
_props$wrap = props.wrap,
|
|
80
|
+
wrap = _props$wrap === void 0 ? 'wrap' : _props$wrap,
|
|
81
|
+
_props$spacing = props.spacing,
|
|
82
|
+
spacingProp = _props$spacing === void 0 ? 0 : _props$spacing,
|
|
83
|
+
_props$rowSpacing = props.rowSpacing,
|
|
84
|
+
rowSpacingProp = _props$rowSpacing === void 0 ? spacingProp : _props$rowSpacing,
|
|
85
|
+
_props$columnSpacing = props.columnSpacing,
|
|
86
|
+
columnSpacingProp = _props$columnSpacing === void 0 ? spacingProp : _props$columnSpacing,
|
|
87
|
+
themeDisableEqualOverflow = props.disableEqualOverflow,
|
|
88
|
+
rest = _objectWithoutProperties(props, ["className", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow"]); // Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
var disableEqualOverflow = themeDisableEqualOverflow;
|
|
92
|
+
|
|
93
|
+
if (nested && themeDisableEqualOverflow !== undefined) {
|
|
94
|
+
disableEqualOverflow = inProps.disableEqualOverflow;
|
|
95
|
+
} // collect breakpoints related props because they can be customized from the theme.
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
var gridSize = {};
|
|
99
|
+
var gridOffset = {};
|
|
100
|
+
var other = {};
|
|
101
|
+
Object.entries(rest).forEach(function (_ref) {
|
|
102
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
103
|
+
key = _ref2[0],
|
|
104
|
+
val = _ref2[1];
|
|
105
|
+
|
|
106
|
+
if (theme.breakpoints.values[key] !== undefined) {
|
|
107
|
+
gridSize[key] = val;
|
|
108
|
+
} else if (theme.breakpoints.values[key.replace('Offset', '')] !== undefined) {
|
|
109
|
+
gridOffset[key.replace('Offset', '')] = val;
|
|
110
|
+
} else {
|
|
111
|
+
other[key] = val;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
var columns = (_inProps$columns = inProps.columns) != null ? _inProps$columns : nested ? undefined : columnsProp;
|
|
115
|
+
var spacing = (_inProps$spacing = inProps.spacing) != null ? _inProps$spacing : nested ? undefined : spacingProp;
|
|
116
|
+
var rowSpacing = (_ref3 = (_inProps$rowSpacing = inProps.rowSpacing) != null ? _inProps$rowSpacing : inProps.spacing) != null ? _ref3 : nested ? undefined : rowSpacingProp;
|
|
117
|
+
var columnSpacing = (_ref4 = (_inProps$columnSpacin = inProps.columnSpacing) != null ? _inProps$columnSpacin : inProps.spacing) != null ? _ref4 : nested ? undefined : columnSpacingProp;
|
|
118
|
+
|
|
119
|
+
var ownerState = _extends({}, props, {
|
|
120
|
+
nested: nested,
|
|
121
|
+
columns: columns,
|
|
122
|
+
container: container,
|
|
123
|
+
direction: direction,
|
|
124
|
+
wrap: wrap,
|
|
125
|
+
spacing: spacing,
|
|
126
|
+
rowSpacing: rowSpacing,
|
|
127
|
+
columnSpacing: columnSpacing,
|
|
128
|
+
gridSize: gridSize,
|
|
129
|
+
gridOffset: gridOffset,
|
|
130
|
+
disableEqualOverflow: (_ref5 = (_disableEqualOverflow = disableEqualOverflow) != null ? _disableEqualOverflow : overflow) != null ? _ref5 : false,
|
|
131
|
+
// use context value if exists.
|
|
132
|
+
parentDisableEqualOverflow: overflow // for nested grid
|
|
133
|
+
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
var classes = useUtilityClasses(ownerState, theme);
|
|
137
|
+
|
|
138
|
+
var result = /*#__PURE__*/_jsx(GridRoot, _extends({
|
|
139
|
+
ref: ref,
|
|
140
|
+
as: component,
|
|
141
|
+
ownerState: ownerState,
|
|
142
|
+
className: clsx(classes.root, className)
|
|
143
|
+
}, other));
|
|
144
|
+
|
|
145
|
+
if (!nested) {
|
|
146
|
+
result = /*#__PURE__*/_jsx(NestedContext.Provider, {
|
|
147
|
+
value: true,
|
|
148
|
+
children: result
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
|
|
153
|
+
// There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
|
|
154
|
+
// 1. It is the root grid with `disableEqualOverflow`.
|
|
155
|
+
// 2. It is a nested grid with different `disableEqualOverflow` from the context.
|
|
156
|
+
result = /*#__PURE__*/_jsx(OverflowContext.Provider, {
|
|
157
|
+
value: disableEqualOverflow,
|
|
158
|
+
children: result
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return result;
|
|
163
|
+
});
|
|
164
|
+
process.env.NODE_ENV !== "production" ? Grid.propTypes
|
|
165
|
+
/* remove-proptypes */
|
|
166
|
+
= {
|
|
167
|
+
children: PropTypes.node,
|
|
168
|
+
className: PropTypes.string,
|
|
169
|
+
columns: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
|
170
|
+
columnSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
171
|
+
component: PropTypes.elementType,
|
|
172
|
+
container: PropTypes.bool,
|
|
173
|
+
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
|
174
|
+
disableEqualOverflow: PropTypes.bool,
|
|
175
|
+
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
176
|
+
lgOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
177
|
+
md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
178
|
+
mdOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
179
|
+
rowSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
180
|
+
sm: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
181
|
+
smOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
182
|
+
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
183
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
184
|
+
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
|
|
185
|
+
xl: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
186
|
+
xlOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
187
|
+
xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
188
|
+
xsOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
|
|
189
|
+
} : void 0;
|
|
190
|
+
return Grid;
|
|
191
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
3
|
+
export function getGridUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiGrid', slot);
|
|
5
|
+
}
|
|
6
|
+
var SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
7
|
+
var DIRECTIONS = ['column-reverse', 'column', 'row-reverse', 'row'];
|
|
8
|
+
var WRAPS = ['nowrap', 'wrap-reverse', 'wrap'];
|
|
9
|
+
var GRID_SIZES = ['auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
10
|
+
var gridClasses = generateUtilityClasses('MuiGrid', ['root', 'container', 'item'].concat(_toConsumableArray(SPACINGS.map(function (spacing) {
|
|
11
|
+
return "spacing-xs-".concat(spacing);
|
|
12
|
+
})), _toConsumableArray(DIRECTIONS.map(function (direction) {
|
|
13
|
+
return "direction-xs-".concat(direction);
|
|
14
|
+
})), _toConsumableArray(WRAPS.map(function (wrap) {
|
|
15
|
+
return "wrap-xs-".concat(wrap);
|
|
16
|
+
})), _toConsumableArray(GRID_SIZES.map(function (size) {
|
|
17
|
+
return "grid-xs-".concat(size);
|
|
18
|
+
})), _toConsumableArray(GRID_SIZES.map(function (size) {
|
|
19
|
+
return "grid-sm-".concat(size);
|
|
20
|
+
})), _toConsumableArray(GRID_SIZES.map(function (size) {
|
|
21
|
+
return "grid-md-".concat(size);
|
|
22
|
+
})), _toConsumableArray(GRID_SIZES.map(function (size) {
|
|
23
|
+
return "grid-lg-".concat(size);
|
|
24
|
+
})), _toConsumableArray(GRID_SIZES.map(function (size) {
|
|
25
|
+
return "grid-xl-".concat(size);
|
|
26
|
+
}))));
|
|
27
|
+
export default gridClasses;
|