1 | import * as React from 'react';
|
2 | import clsx from 'clsx';
|
3 | import PropTypes from 'prop-types';
|
4 |
|
5 | import Grid from '@mui/material-pigment-css/Grid';
|
6 | import composeClasses from '@mui/utils/composeClasses';
|
7 | import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
8 | import { generateDirectionClasses, generateSizeClassNames, generateSpacingClassNames } from '@mui/system/Grid/gridGenerator';
|
9 | import { jsx as _jsx } from "react/jsx-runtime";
|
10 | const useUtilityClasses = ownerState => {
|
11 | const {
|
12 | container,
|
13 | direction,
|
14 | size,
|
15 | spacing
|
16 | } = ownerState;
|
17 | let gridSize = {};
|
18 | if (size) {
|
19 | if (Array.isArray(size)) {
|
20 | size.forEach((value, index) => {
|
21 | gridSize = {
|
22 | ...gridSize,
|
23 | [index]: value
|
24 | };
|
25 | });
|
26 | }
|
27 | if (typeof size === 'object') {
|
28 | gridSize = size;
|
29 | }
|
30 | }
|
31 | const slots = {
|
32 | root: ['root', container && 'container', ...generateDirectionClasses(direction), ...generateSizeClassNames(gridSize), ...(container ? generateSpacingClassNames(spacing) : [])]
|
33 | };
|
34 | return composeClasses(slots, slot => generateUtilityClass('MuiGrid2', slot), {});
|
35 | };
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | const PigmentGrid = React.forwardRef(function PigmentGrid(props, ref) {
|
47 | const {
|
48 | className,
|
49 | ...other
|
50 | } = props;
|
51 | const classes = useUtilityClasses(props);
|
52 | return _jsx(Grid, {
|
53 | ref: ref,
|
54 | className: clsx(classes.root, className),
|
55 | ...other
|
56 | });
|
57 | });
|
58 | process.env.NODE_ENV !== "production" ? PigmentGrid.propTypes = {
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | |
64 |
|
65 |
|
66 | children: PropTypes.node,
|
67 | |
68 |
|
69 |
|
70 | className: PropTypes.string,
|
71 | |
72 |
|
73 |
|
74 |
|
75 | columns: PropTypes .oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
76 | |
77 |
|
78 |
|
79 |
|
80 | columnSpacing: PropTypes .oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired), PropTypes.number, PropTypes.object, PropTypes.string]),
|
81 | |
82 |
|
83 |
|
84 |
|
85 |
|
86 | container: PropTypes.bool,
|
87 | |
88 |
|
89 |
|
90 |
|
91 |
|
92 | direction: PropTypes .oneOfType([PropTypes.oneOf(['column', 'column-reverse', 'row', 'row-reverse']), PropTypes.arrayOf(PropTypes.oneOf(['column', 'column-reverse', 'row', 'row-reverse'])), PropTypes.object]),
|
93 | |
94 |
|
95 |
|
96 | offset: PropTypes .oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
97 | |
98 |
|
99 |
|
100 |
|
101 | rowSpacing: PropTypes .oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired), PropTypes.number, PropTypes.object, PropTypes.string]),
|
102 | |
103 |
|
104 |
|
105 | size: PropTypes .oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
106 | |
107 |
|
108 |
|
109 |
|
110 |
|
111 | spacing: PropTypes .oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired), PropTypes.number, PropTypes.object, PropTypes.string]),
|
112 | |
113 |
|
114 |
|
115 | sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
116 | |
117 |
|
118 |
|
119 |
|
120 |
|
121 | wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
122 | } : void 0;
|
123 |
|
124 |
|
125 | PigmentGrid.muiName = 'Grid';
|
126 | export default PigmentGrid; |
\ | No newline at end of file |