@mui/system 5.8.7 → 5.9.0
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 +74 -0
- package/Unstable_Grid/Grid.d.ts +12 -0
- package/Unstable_Grid/Grid.js +190 -0
- package/Unstable_Grid/GridProps.d.ts +158 -0
- package/Unstable_Grid/GridProps.js +5 -0
- package/Unstable_Grid/createGrid.d.ts +11 -0
- package/Unstable_Grid/createGrid.js +174 -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 +269 -0
- package/Unstable_Grid/index.d.ts +5 -0
- package/Unstable_Grid/index.js +65 -0
- package/Unstable_Grid/package.json +6 -0
- package/{grid.js → cssGrid.js} +0 -0
- package/cssVars/useCurrentColorScheme.js +1 -1
- package/esm/Unstable_Grid/Grid.js +179 -0
- package/esm/Unstable_Grid/GridProps.js +1 -0
- package/esm/Unstable_Grid/createGrid.js +152 -0
- package/esm/Unstable_Grid/gridClasses.js +14 -0
- package/esm/Unstable_Grid/gridGenerator.js +230 -0
- package/esm/Unstable_Grid/index.js +5 -0
- 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 +179 -0
- package/legacy/Unstable_Grid/GridProps.js +1 -0
- package/legacy/Unstable_Grid/createGrid.js +166 -0
- package/legacy/Unstable_Grid/gridClasses.js +27 -0
- package/legacy/Unstable_Grid/gridGenerator.js +239 -0
- package/legacy/Unstable_Grid/index.js +5 -0
- 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 +179 -0
- package/modern/Unstable_Grid/GridProps.js +1 -0
- package/modern/Unstable_Grid/createGrid.js +150 -0
- package/modern/Unstable_Grid/gridClasses.js +14 -0
- package/modern/Unstable_Grid/gridGenerator.js +226 -0
- package/modern/Unstable_Grid/index.js +5 -0
- 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 +4 -4
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.getGridUtilityClass = getGridUtilityClass;
|
|
8
|
+
|
|
9
|
+
var _utils = require("@mui/utils");
|
|
10
|
+
|
|
11
|
+
function getGridUtilityClass(slot) {
|
|
12
|
+
return (0, _utils.unstable_generateUtilityClass)('MuiGrid', slot);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
16
|
+
const DIRECTIONS = ['column-reverse', 'column', 'row-reverse', 'row'];
|
|
17
|
+
const WRAPS = ['nowrap', 'wrap-reverse', 'wrap'];
|
|
18
|
+
const GRID_SIZES = ['auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
19
|
+
const gridClasses = (0, _utils.unstable_generateUtilityClasses)('MuiGrid', ['root', 'container', 'item', // spacings
|
|
20
|
+
...SPACINGS.map(spacing => `spacing-xs-${spacing}`), // direction values
|
|
21
|
+
...DIRECTIONS.map(direction => `direction-xs-${direction}`), // wrap values
|
|
22
|
+
...WRAPS.map(wrap => `wrap-xs-${wrap}`), // grid sizes for all breakpoints
|
|
23
|
+
...GRID_SIZES.map(size => `grid-xs-${size}`), ...GRID_SIZES.map(size => `grid-sm-${size}`), ...GRID_SIZES.map(size => `grid-md-${size}`), ...GRID_SIZES.map(size => `grid-lg-${size}`), ...GRID_SIZES.map(size => `grid-xl-${size}`)]);
|
|
24
|
+
var _default = gridClasses;
|
|
25
|
+
exports.default = _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Breakpoints } from '../createTheme/createBreakpoints';
|
|
2
|
+
import { Spacing } from '../createTheme/createSpacing';
|
|
3
|
+
import { GridOwnerState } from './GridProps';
|
|
4
|
+
interface Props {
|
|
5
|
+
theme: {
|
|
6
|
+
breakpoints: Breakpoints;
|
|
7
|
+
spacing?: Spacing;
|
|
8
|
+
};
|
|
9
|
+
ownerState: GridOwnerState & {
|
|
10
|
+
parentDisableEqualOverflow?: boolean;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface Iterator<T> {
|
|
14
|
+
(appendStyle: (responsizeStyles: Record<string, any>, style: object) => void, value: T): void;
|
|
15
|
+
}
|
|
16
|
+
export declare const traverseBreakpoints: <T = unknown>(breakpoints: Breakpoints, responsize: Record<string, any> | T | T[] | undefined, iterator: Iterator<T>) => void;
|
|
17
|
+
export declare const generateGridSizeStyles: ({ theme, ownerState }: Props) => {};
|
|
18
|
+
export declare const generateGridOffsetStyles: ({ theme, ownerState }: Props) => {};
|
|
19
|
+
export declare const generateGridColumnsStyles: ({ theme, ownerState }: Props) => {};
|
|
20
|
+
export declare const generateGridRowSpacingStyles: ({ theme, ownerState }: Props) => {};
|
|
21
|
+
export declare const generateGridColumnSpacingStyles: ({ theme, ownerState }: Props) => {};
|
|
22
|
+
export declare const generateGridDirectionStyles: ({ theme, ownerState }: Props) => {};
|
|
23
|
+
export declare const generateGridStyles: ({ ownerState }: Props) => {};
|
|
24
|
+
export declare const generateSizeClassNames: (gridSize: GridOwnerState['gridSize']) => string[];
|
|
25
|
+
export declare const generateSpacingClassNames: (spacing: GridOwnerState['spacing'], smallestBreakpoint?: string) => string[];
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.traverseBreakpoints = exports.generateSpacingClassNames = exports.generateSizeClassNames = exports.generateGridStyles = exports.generateGridSizeStyles = exports.generateGridRowSpacingStyles = exports.generateGridOffsetStyles = exports.generateGridDirectionStyles = exports.generateGridColumnsStyles = exports.generateGridColumnSpacingStyles = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
const traverseBreakpoints = (breakpoints, responsize, iterator) => {
|
|
13
|
+
const smallestBreakpoint = breakpoints.keys[0]; // the keys is sorted from smallest to largest by `createBreakpoints`.
|
|
14
|
+
|
|
15
|
+
if (Array.isArray(responsize)) {
|
|
16
|
+
responsize.forEach((breakpointValue, index) => {
|
|
17
|
+
iterator((responsizeStyles, style) => {
|
|
18
|
+
if (index <= breakpoints.keys.length - 1) {
|
|
19
|
+
if (index === 0) {
|
|
20
|
+
Object.assign(responsizeStyles, style);
|
|
21
|
+
} else {
|
|
22
|
+
responsizeStyles[breakpoints.up(breakpoints.keys[index])] = style;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}, breakpointValue);
|
|
26
|
+
});
|
|
27
|
+
} else if (responsize && typeof responsize === 'object') {
|
|
28
|
+
// prevent null
|
|
29
|
+
// responsize could be a very big object, pick the smallest responsive values
|
|
30
|
+
const keys = Object.keys(responsize).length > breakpoints.keys.length ? breakpoints.keys : Object.keys(responsize);
|
|
31
|
+
keys.forEach(key => {
|
|
32
|
+
if (breakpoints.keys.indexOf(key) !== -1) {
|
|
33
|
+
// @ts-ignore already checked that responsize is an object
|
|
34
|
+
const breakpointValue = responsize[key];
|
|
35
|
+
|
|
36
|
+
if (breakpointValue !== undefined) {
|
|
37
|
+
iterator((responsizeStyles, style) => {
|
|
38
|
+
if (smallestBreakpoint === key) {
|
|
39
|
+
Object.assign(responsizeStyles, style);
|
|
40
|
+
} else {
|
|
41
|
+
responsizeStyles[breakpoints.up(key)] = style;
|
|
42
|
+
}
|
|
43
|
+
}, breakpointValue);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
} else if (typeof responsize === 'number' || typeof responsize === 'string') {
|
|
48
|
+
iterator((responsizeStyles, style) => {
|
|
49
|
+
Object.assign(responsizeStyles, style);
|
|
50
|
+
}, responsize);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.traverseBreakpoints = traverseBreakpoints;
|
|
55
|
+
|
|
56
|
+
const generateGridSizeStyles = ({
|
|
57
|
+
theme,
|
|
58
|
+
ownerState
|
|
59
|
+
}) => {
|
|
60
|
+
const styles = {};
|
|
61
|
+
traverseBreakpoints(theme.breakpoints, ownerState.gridSize, (appendStyle, value) => {
|
|
62
|
+
let style = {};
|
|
63
|
+
|
|
64
|
+
if (value === true) {
|
|
65
|
+
style = {
|
|
66
|
+
flexBasis: 0,
|
|
67
|
+
flexGrow: 1,
|
|
68
|
+
maxWidth: '100%'
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (value === 'auto') {
|
|
73
|
+
style = {
|
|
74
|
+
flexBasis: 'auto',
|
|
75
|
+
flexGrow: 0,
|
|
76
|
+
flexShrink: 0,
|
|
77
|
+
maxWidth: 'none',
|
|
78
|
+
width: 'auto'
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (typeof value === 'number') {
|
|
83
|
+
style = {
|
|
84
|
+
flexGrow: 0,
|
|
85
|
+
flexBasis: 'auto',
|
|
86
|
+
width: `calc(100% * ${value} / var(--Grid-columns)${ownerState.nested && ownerState.container ? ` + var(--Grid-columnSpacing)` : ''})`
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
appendStyle(styles, style);
|
|
91
|
+
});
|
|
92
|
+
return styles;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.generateGridSizeStyles = generateGridSizeStyles;
|
|
96
|
+
|
|
97
|
+
const generateGridOffsetStyles = ({
|
|
98
|
+
theme,
|
|
99
|
+
ownerState
|
|
100
|
+
}) => {
|
|
101
|
+
const styles = {};
|
|
102
|
+
traverseBreakpoints(theme.breakpoints, ownerState.gridOffset, (appendStyle, value) => {
|
|
103
|
+
let style = {};
|
|
104
|
+
|
|
105
|
+
if (value === 'auto') {
|
|
106
|
+
style = {
|
|
107
|
+
marginLeft: 'auto'
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (typeof value === 'number') {
|
|
112
|
+
style = {
|
|
113
|
+
marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / var(--Grid-columns))`
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
appendStyle(styles, style);
|
|
118
|
+
});
|
|
119
|
+
return styles;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
exports.generateGridOffsetStyles = generateGridOffsetStyles;
|
|
123
|
+
|
|
124
|
+
const generateGridColumnsStyles = ({
|
|
125
|
+
theme,
|
|
126
|
+
ownerState
|
|
127
|
+
}) => {
|
|
128
|
+
if (!ownerState.container) {
|
|
129
|
+
return {};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const styles = {
|
|
133
|
+
'--Grid-columns': 12
|
|
134
|
+
};
|
|
135
|
+
traverseBreakpoints(theme.breakpoints, ownerState.columns, (appendStyle, value) => {
|
|
136
|
+
appendStyle(styles, {
|
|
137
|
+
'--Grid-columns': value
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
return styles;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
exports.generateGridColumnsStyles = generateGridColumnsStyles;
|
|
144
|
+
|
|
145
|
+
const generateGridRowSpacingStyles = ({
|
|
146
|
+
theme,
|
|
147
|
+
ownerState
|
|
148
|
+
}) => {
|
|
149
|
+
if (!ownerState.container) {
|
|
150
|
+
return {};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const styles = {};
|
|
154
|
+
traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, (appendStyle, value) => {
|
|
155
|
+
var _theme$spacing;
|
|
156
|
+
|
|
157
|
+
appendStyle(styles, {
|
|
158
|
+
'--Grid-rowSpacing': typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
return styles;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
exports.generateGridRowSpacingStyles = generateGridRowSpacingStyles;
|
|
165
|
+
|
|
166
|
+
const generateGridColumnSpacingStyles = ({
|
|
167
|
+
theme,
|
|
168
|
+
ownerState
|
|
169
|
+
}) => {
|
|
170
|
+
if (!ownerState.container) {
|
|
171
|
+
return {};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const styles = {};
|
|
175
|
+
traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, (appendStyle, value) => {
|
|
176
|
+
var _theme$spacing2;
|
|
177
|
+
|
|
178
|
+
appendStyle(styles, {
|
|
179
|
+
'--Grid-columnSpacing': typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
return styles;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
exports.generateGridColumnSpacingStyles = generateGridColumnSpacingStyles;
|
|
186
|
+
|
|
187
|
+
const generateGridDirectionStyles = ({
|
|
188
|
+
theme,
|
|
189
|
+
ownerState
|
|
190
|
+
}) => {
|
|
191
|
+
if (!ownerState.container) {
|
|
192
|
+
return {};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const styles = {};
|
|
196
|
+
traverseBreakpoints(theme.breakpoints, ownerState.direction, (appendStyle, value) => {
|
|
197
|
+
appendStyle(styles, {
|
|
198
|
+
flexDirection: value
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
return styles;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
exports.generateGridDirectionStyles = generateGridDirectionStyles;
|
|
205
|
+
|
|
206
|
+
const generateGridStyles = ({
|
|
207
|
+
ownerState
|
|
208
|
+
}) => {
|
|
209
|
+
return (0, _extends2.default)({
|
|
210
|
+
minWidth: 0,
|
|
211
|
+
boxSizing: 'border-box'
|
|
212
|
+
}, ownerState.container ? (0, _extends2.default)({
|
|
213
|
+
display: 'flex',
|
|
214
|
+
flexWrap: 'wrap'
|
|
215
|
+
}, ownerState.wrap && ownerState.wrap !== 'wrap' && {
|
|
216
|
+
flexWrap: ownerState.wrap
|
|
217
|
+
}, {
|
|
218
|
+
margin: `calc(var(--Grid-rowSpacing) / -2) calc(var(--Grid-columnSpacing) / -2)`
|
|
219
|
+
}, ownerState.nested ? {
|
|
220
|
+
padding: `calc(var(--Grid-nested-rowSpacing) / 2) calc(var(--Grid-nested-columnSpacing) / 2)`
|
|
221
|
+
} : {
|
|
222
|
+
'--Grid-nested-rowSpacing': 'var(--Grid-rowSpacing)',
|
|
223
|
+
'--Grid-nested-columnSpacing': 'var(--Grid-columnSpacing)'
|
|
224
|
+
}) : {
|
|
225
|
+
padding: `calc(var(--Grid-rowSpacing) / 2) calc(var(--Grid-columnSpacing) / 2)`
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
exports.generateGridStyles = generateGridStyles;
|
|
230
|
+
|
|
231
|
+
const generateSizeClassNames = gridSize => {
|
|
232
|
+
const classNames = [];
|
|
233
|
+
Object.entries(gridSize).forEach(([key, value]) => {
|
|
234
|
+
if (value !== false && value !== undefined) {
|
|
235
|
+
classNames.push(`grid-${key}-${String(value)}`);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
return classNames;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
exports.generateSizeClassNames = generateSizeClassNames;
|
|
242
|
+
|
|
243
|
+
const generateSpacingClassNames = (spacing, smallestBreakpoint = 'xs') => {
|
|
244
|
+
function isValidSpacing(val) {
|
|
245
|
+
if (val === undefined) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return typeof val === 'string' && !Number.isNaN(Number(val)) || typeof val === 'number' && val > 0;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (isValidSpacing(spacing)) {
|
|
253
|
+
return [`spacing-${smallestBreakpoint}-${String(spacing)}`];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (typeof spacing === 'object' && !Array.isArray(spacing)) {
|
|
257
|
+
const classNames = [];
|
|
258
|
+
Object.entries(spacing).forEach(([key, value]) => {
|
|
259
|
+
if (isValidSpacing(value)) {
|
|
260
|
+
classNames.push(`spacing-${key}-${String(value)}`);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return classNames;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return [];
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
exports.generateSpacingClassNames = generateSpacingClassNames;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
var _exportNames = {
|
|
9
|
+
createGrid: true,
|
|
10
|
+
gridClasses: true
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "createGrid", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _createGrid.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "default", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _Grid.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "gridClasses", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _gridClasses.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
var _Grid = _interopRequireDefault(require("./Grid"));
|
|
32
|
+
|
|
33
|
+
var _createGrid = _interopRequireDefault(require("./createGrid"));
|
|
34
|
+
|
|
35
|
+
var _GridProps = require("./GridProps");
|
|
36
|
+
|
|
37
|
+
Object.keys(_GridProps).forEach(function (key) {
|
|
38
|
+
if (key === "default" || key === "__esModule") return;
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
40
|
+
if (key in exports && exports[key] === _GridProps[key]) return;
|
|
41
|
+
Object.defineProperty(exports, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return _GridProps[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
var _gridClasses = _interopRequireWildcard(require("./gridClasses"));
|
|
50
|
+
|
|
51
|
+
Object.keys(_gridClasses).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
54
|
+
if (key in exports && exports[key] === _gridClasses[key]) return;
|
|
55
|
+
Object.defineProperty(exports, key, {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return _gridClasses[key];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
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); }
|
|
64
|
+
|
|
65
|
+
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; }
|
package/{grid.js → cssGrid.js}
RENAMED
|
File without changes
|
|
@@ -171,7 +171,7 @@ function useCurrentColorScheme(options) {
|
|
|
171
171
|
const handleMediaQuery = React.useCallback(e => {
|
|
172
172
|
if (state.mode === 'system') {
|
|
173
173
|
setState(currentState => (0, _extends2.default)({}, currentState, {
|
|
174
|
-
systemMode: e.matches ? 'dark' : 'light'
|
|
174
|
+
systemMode: e != null && e.matches ? 'dark' : 'light'
|
|
175
175
|
}));
|
|
176
176
|
}
|
|
177
177
|
}, [state.mode]); // Ref hack to avoid adding handleMediaQuery as a dep
|
|
@@ -0,0 +1,179 @@
|
|
|
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
|
+
const 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 a number, it sets the number of columns the grid item uses.
|
|
62
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
63
|
+
* If 'auto', the grid item's width matches its content.
|
|
64
|
+
* If false, the prop is ignored.
|
|
65
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
66
|
+
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
73
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
74
|
+
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
75
|
+
*/
|
|
76
|
+
lgOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
80
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
81
|
+
* If 'auto', the grid item's width matches its content.
|
|
82
|
+
* If false, the prop is ignored.
|
|
83
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
84
|
+
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
91
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
92
|
+
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
93
|
+
*/
|
|
94
|
+
mdOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Defines the vertical space between the type `item` components.
|
|
98
|
+
* It overrides the value of the `spacing` prop.
|
|
99
|
+
*/
|
|
100
|
+
rowSpacing: PropTypes
|
|
101
|
+
/* @typescript-to-proptypes-ignore */
|
|
102
|
+
.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
106
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
107
|
+
* If 'auto', the grid item's width matches its content.
|
|
108
|
+
* If false, the prop is ignored.
|
|
109
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
110
|
+
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
111
|
+
* @default false
|
|
112
|
+
*/
|
|
113
|
+
sm: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
117
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
118
|
+
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
119
|
+
*/
|
|
120
|
+
smOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Defines the space between the type `item` components.
|
|
124
|
+
* It can only be used on a type `container` component.
|
|
125
|
+
* @default 0
|
|
126
|
+
*/
|
|
127
|
+
spacing: PropTypes
|
|
128
|
+
/* @typescript-to-proptypes-ignore */
|
|
129
|
+
.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @ignore
|
|
133
|
+
*/
|
|
134
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Defines the `flex-wrap` style property.
|
|
138
|
+
* It's applied for all screen sizes.
|
|
139
|
+
* @default 'wrap'
|
|
140
|
+
*/
|
|
141
|
+
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
145
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
146
|
+
* If 'auto', the grid item's width matches its content.
|
|
147
|
+
* If false, the prop is ignored.
|
|
148
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
149
|
+
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
xl: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
156
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
157
|
+
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
158
|
+
*/
|
|
159
|
+
xlOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
163
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
164
|
+
* If 'auto', the grid item's width matches its content.
|
|
165
|
+
* If false, the prop is ignored.
|
|
166
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
167
|
+
* The value is applied for all the screen sizes with the lowest priority.
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
174
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
175
|
+
* The value is applied for the `xs` breakpoint and wider screens if not overridden.
|
|
176
|
+
*/
|
|
177
|
+
xsOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
|
|
178
|
+
} : void 0;
|
|
179
|
+
export default Grid;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|