@mui/system 6.0.0-alpha.0 → 6.0.0-alpha.3
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 +243 -4
- package/Container/Container.d.ts +1 -1
- package/Stack/Stack.d.ts +1 -1
- package/Stack/createStack.d.ts +1 -1
- package/Unstable_Grid/Grid.d.ts +1 -1
- package/Unstable_Grid/createGrid.d.ts +1 -1
- package/breakpoints/breakpoints.js +19 -1
- package/createTheme/createSpacing.d.ts +2 -2
- package/createTheme/createSpacing.js +7 -8
- package/createTheme/createTheme.d.ts +2 -1
- package/createTheme/createTheme.js +2 -0
- package/cssContainerQueries/cssContainerQueries.d.ts +24 -0
- package/cssContainerQueries/cssContainerQueries.js +68 -0
- package/cssContainerQueries/index.d.ts +3 -0
- package/cssContainerQueries/index.js +2 -0
- package/cssContainerQueries/package.json +6 -0
- package/cssVars/createCssVarsProvider.js +3 -0
- package/cssVars/cssVarsParser.d.ts +1 -1
- package/cssVars/cssVarsParser.js +3 -2
- package/index.d.ts +2 -0
- package/index.js +2 -1
- package/modern/breakpoints/breakpoints.js +19 -1
- package/modern/createTheme/createSpacing.js +7 -8
- package/modern/createTheme/createTheme.js +2 -0
- package/modern/cssContainerQueries/cssContainerQueries.js +68 -0
- package/modern/cssContainerQueries/index.js +2 -0
- package/modern/cssVars/createCssVarsProvider.js +3 -0
- package/modern/cssVars/cssVarsParser.js +3 -2
- package/modern/index.js +2 -1
- package/modern/spacing/spacing.js +24 -21
- package/modern/styleFunctionSx/styleFunctionSx.js +2 -1
- package/node/breakpoints/breakpoints.js +19 -1
- package/node/createTheme/createSpacing.js +7 -8
- package/node/createTheme/createTheme.js +2 -0
- package/node/cssContainerQueries/cssContainerQueries.js +79 -0
- package/node/cssContainerQueries/index.js +32 -0
- package/node/cssVars/createCssVarsProvider.js +3 -0
- package/node/cssVars/cssVarsParser.js +3 -2
- package/node/index.js +9 -1
- package/node/spacing/spacing.js +24 -21
- package/node/styleFunctionSx/styleFunctionSx.js +2 -1
- package/package.json +5 -5
- package/spacing/spacing.js +24 -21
- package/styleFunctionSx/styleFunctionSx.js +2 -1
- package/legacy/Box/Box.js +0 -30
- package/legacy/Box/boxClasses.js +0 -3
- package/legacy/Box/index.js +0 -5
- package/legacy/Container/Container.js +0 -61
- package/legacy/Container/ContainerProps.js +0 -1
- package/legacy/Container/containerClasses.js +0 -7
- package/legacy/Container/createContainer.js +0 -140
- package/legacy/Container/index.js +0 -5
- package/legacy/GlobalStyles/GlobalStyles.js +0 -37
- package/legacy/GlobalStyles/index.js +0 -4
- package/legacy/RtlProvider/index.js +0 -22
- package/legacy/Stack/Stack.js +0 -62
- package/legacy/Stack/StackProps.js +0 -1
- package/legacy/Stack/createStack.js +0 -180
- package/legacy/Stack/index.js +0 -7
- package/legacy/Stack/stackClasses.js +0 -7
- package/legacy/ThemeProvider/ThemeProvider.js +0 -87
- package/legacy/ThemeProvider/index.js +0 -3
- package/legacy/Unstable_Grid/Grid.js +0 -177
- package/legacy/Unstable_Grid/GridProps.js +0 -1
- package/legacy/Unstable_Grid/createGrid.js +0 -184
- package/legacy/Unstable_Grid/gridClasses.js +0 -28
- package/legacy/Unstable_Grid/gridGenerator.js +0 -216
- package/legacy/Unstable_Grid/index.js +0 -8
- package/legacy/Unstable_Grid/traverseBreakpoints.js +0 -48
- package/legacy/borders/borders.js +0 -51
- package/legacy/borders/index.js +0 -4
- package/legacy/breakpoints/breakpoints.js +0 -162
- package/legacy/breakpoints/index.js +0 -4
- package/legacy/colorManipulator/colorManipulator.js +0 -356
- package/legacy/colorManipulator/index.js +0 -3
- package/legacy/compose/compose.js +0 -32
- package/legacy/compose/index.js +0 -3
- package/legacy/createBox/createBox.js +0 -38
- package/legacy/createBox/index.js +0 -3
- package/legacy/createStyled/createStyled.js +0 -250
- package/legacy/createStyled/index.js +0 -4
- package/legacy/createTheme/applyStyles.js +0 -73
- package/legacy/createTheme/createBreakpoints.js +0 -83
- package/legacy/createTheme/createSpacing.js +0 -36
- package/legacy/createTheme/createTheme.js +0 -49
- package/legacy/createTheme/index.js +0 -3
- package/legacy/createTheme/shape.js +0 -4
- package/legacy/cssGrid/cssGrid.js +0 -91
- package/legacy/cssGrid/index.js +0 -4
- package/legacy/cssVars/createCssVarsProvider.js +0 -335
- package/legacy/cssVars/createCssVarsTheme.js +0 -13
- package/legacy/cssVars/createGetCssVar.js +0 -30
- package/legacy/cssVars/cssVarsParser.js +0 -140
- package/legacy/cssVars/getInitColorSchemeScript.js +0 -28
- package/legacy/cssVars/index.js +0 -6
- package/legacy/cssVars/prepareCssVars.js +0 -92
- package/legacy/cssVars/useCurrentColorScheme.js +0 -237
- package/legacy/display/display.js +0 -29
- package/legacy/display/index.js +0 -4
- package/legacy/flexbox/flexbox.js +0 -43
- package/legacy/flexbox/index.js +0 -4
- package/legacy/getThemeValue/getThemeValue.js +0 -47
- package/legacy/getThemeValue/index.js +0 -4
- package/legacy/index.js +0 -72
- package/legacy/memoize/index.js +0 -3
- package/legacy/memoize/memoize.js +0 -9
- package/legacy/merge/index.js +0 -3
- package/legacy/merge/merge.js +0 -10
- package/legacy/palette/index.js +0 -4
- package/legacy/palette/palette.js +0 -26
- package/legacy/positions/index.js +0 -4
- package/legacy/positions/positions.js +0 -22
- package/legacy/propsToClassKey/index.js +0 -3
- package/legacy/propsToClassKey/propsToClassKey.js +0 -24
- package/legacy/responsivePropType/index.js +0 -3
- package/legacy/responsivePropType/responsivePropType.js +0 -3
- package/legacy/shadows/index.js +0 -3
- package/legacy/shadows/shadows.js +0 -6
- package/legacy/sizing/index.js +0 -4
- package/legacy/sizing/sizing.js +0 -65
- package/legacy/spacing/index.js +0 -4
- package/legacy/spacing/spacing.js +0 -158
- package/legacy/style/index.js +0 -4
- package/legacy/style/style.js +0 -73
- package/legacy/styleFunctionSx/defaultSxConfig.js +0 -293
- package/legacy/styleFunctionSx/extendSxProp.js +0 -45
- package/legacy/styleFunctionSx/index.js +0 -4
- package/legacy/styleFunctionSx/styleFunctionSx.js +0 -126
- package/legacy/styled/index.js +0 -3
- package/legacy/styled/styled.js +0 -3
- package/legacy/typography/index.js +0 -4
- package/legacy/typography/typography.js +0 -37
- package/legacy/useMediaQuery/index.js +0 -2
- package/legacy/useMediaQuery/useMediaQuery.js +0 -145
- package/legacy/useTheme/index.js +0 -4
- package/legacy/useTheme/useTheme.js +0 -10
- package/legacy/useThemeProps/getThemeProps.js +0 -10
- package/legacy/useThemeProps/index.js +0 -4
- package/legacy/useThemeProps/useThemeProps.js +0 -20
- package/legacy/useThemeWithoutDefault/index.js +0 -3
- package/legacy/useThemeWithoutDefault/useThemeWithoutDefault.js +0 -13
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
|
-
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
4
|
-
export function getGridUtilityClass(slot) {
|
|
5
|
-
return generateUtilityClass('MuiGrid', slot);
|
|
6
|
-
}
|
|
7
|
-
var SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
8
|
-
var DIRECTIONS = ['column-reverse', 'column', 'row-reverse', 'row'];
|
|
9
|
-
var WRAPS = ['nowrap', 'wrap-reverse', 'wrap'];
|
|
10
|
-
var GRID_SIZES = ['auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
11
|
-
var gridClasses = generateUtilityClasses('MuiGrid', ['root', 'container', 'item'].concat(_toConsumableArray(SPACINGS.map(function (spacing) {
|
|
12
|
-
return "spacing-xs-".concat(spacing);
|
|
13
|
-
})), _toConsumableArray(DIRECTIONS.map(function (direction) {
|
|
14
|
-
return "direction-xs-".concat(direction);
|
|
15
|
-
})), _toConsumableArray(WRAPS.map(function (wrap) {
|
|
16
|
-
return "wrap-xs-".concat(wrap);
|
|
17
|
-
})), _toConsumableArray(GRID_SIZES.map(function (size) {
|
|
18
|
-
return "grid-xs-".concat(size);
|
|
19
|
-
})), _toConsumableArray(GRID_SIZES.map(function (size) {
|
|
20
|
-
return "grid-sm-".concat(size);
|
|
21
|
-
})), _toConsumableArray(GRID_SIZES.map(function (size) {
|
|
22
|
-
return "grid-md-".concat(size);
|
|
23
|
-
})), _toConsumableArray(GRID_SIZES.map(function (size) {
|
|
24
|
-
return "grid-lg-".concat(size);
|
|
25
|
-
})), _toConsumableArray(GRID_SIZES.map(function (size) {
|
|
26
|
-
return "grid-xl-".concat(size);
|
|
27
|
-
}))));
|
|
28
|
-
export default gridClasses;
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
-
import { traverseBreakpoints } from './traverseBreakpoints';
|
|
6
|
-
function appendLevel(level) {
|
|
7
|
-
if (!level) {
|
|
8
|
-
return '';
|
|
9
|
-
}
|
|
10
|
-
return "Level".concat(level);
|
|
11
|
-
}
|
|
12
|
-
function isNestedContainer(ownerState) {
|
|
13
|
-
return ownerState.unstable_level > 0 && ownerState.container;
|
|
14
|
-
}
|
|
15
|
-
function createGetSelfSpacing(ownerState) {
|
|
16
|
-
return function getSelfSpacing(axis) {
|
|
17
|
-
return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.unstable_level), ")");
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function createGetParentSpacing(ownerState) {
|
|
21
|
-
return function getParentSpacing(axis) {
|
|
22
|
-
if (ownerState.unstable_level === 0) {
|
|
23
|
-
return "var(--Grid-".concat(axis, "Spacing)");
|
|
24
|
-
}
|
|
25
|
-
return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.unstable_level - 1), ")");
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function getParentColumns(ownerState) {
|
|
29
|
-
if (ownerState.unstable_level === 0) {
|
|
30
|
-
return "var(--Grid-columns)";
|
|
31
|
-
}
|
|
32
|
-
return "var(--Grid-columns".concat(appendLevel(ownerState.unstable_level - 1), ")");
|
|
33
|
-
}
|
|
34
|
-
export var generateGridSizeStyles = function generateGridSizeStyles(_ref) {
|
|
35
|
-
var theme = _ref.theme,
|
|
36
|
-
ownerState = _ref.ownerState;
|
|
37
|
-
var getSelfSpacing = createGetSelfSpacing(ownerState);
|
|
38
|
-
var styles = {};
|
|
39
|
-
traverseBreakpoints(theme.breakpoints, ownerState.gridSize, function (appendStyle, value) {
|
|
40
|
-
var style = {};
|
|
41
|
-
if (value === true) {
|
|
42
|
-
style = {
|
|
43
|
-
flexBasis: 0,
|
|
44
|
-
flexGrow: 1,
|
|
45
|
-
maxWidth: '100%'
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
if (value === 'auto') {
|
|
49
|
-
style = {
|
|
50
|
-
flexBasis: 'auto',
|
|
51
|
-
flexGrow: 0,
|
|
52
|
-
flexShrink: 0,
|
|
53
|
-
maxWidth: 'none',
|
|
54
|
-
width: 'auto'
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
if (typeof value === 'number') {
|
|
58
|
-
style = {
|
|
59
|
-
flexGrow: 0,
|
|
60
|
-
flexBasis: 'auto',
|
|
61
|
-
width: "calc(100% * ".concat(value, " / ").concat(getParentColumns(ownerState)).concat(isNestedContainer(ownerState) ? " + ".concat(getSelfSpacing('column')) : '', ")")
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
appendStyle(styles, style);
|
|
65
|
-
});
|
|
66
|
-
return styles;
|
|
67
|
-
};
|
|
68
|
-
export var generateGridOffsetStyles = function generateGridOffsetStyles(_ref2) {
|
|
69
|
-
var theme = _ref2.theme,
|
|
70
|
-
ownerState = _ref2.ownerState;
|
|
71
|
-
var styles = {};
|
|
72
|
-
traverseBreakpoints(theme.breakpoints, ownerState.gridOffset, function (appendStyle, value) {
|
|
73
|
-
var style = {};
|
|
74
|
-
if (value === 'auto') {
|
|
75
|
-
style = {
|
|
76
|
-
marginLeft: 'auto'
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
if (typeof value === 'number') {
|
|
80
|
-
style = {
|
|
81
|
-
marginLeft: value === 0 ? '0px' : "calc(100% * ".concat(value, " / ").concat(getParentColumns(ownerState), ")")
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
appendStyle(styles, style);
|
|
85
|
-
});
|
|
86
|
-
return styles;
|
|
87
|
-
};
|
|
88
|
-
export var generateGridColumnsStyles = function generateGridColumnsStyles(_ref3) {
|
|
89
|
-
var theme = _ref3.theme,
|
|
90
|
-
ownerState = _ref3.ownerState;
|
|
91
|
-
if (!ownerState.container) {
|
|
92
|
-
return {};
|
|
93
|
-
}
|
|
94
|
-
var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.unstable_level)), getParentColumns(ownerState)) : {
|
|
95
|
-
'--Grid-columns': 12
|
|
96
|
-
};
|
|
97
|
-
traverseBreakpoints(theme.breakpoints, ownerState.columns, function (appendStyle, value) {
|
|
98
|
-
appendStyle(styles, _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.unstable_level)), value));
|
|
99
|
-
});
|
|
100
|
-
return styles;
|
|
101
|
-
};
|
|
102
|
-
export var generateGridRowSpacingStyles = function generateGridRowSpacingStyles(_ref5) {
|
|
103
|
-
var theme = _ref5.theme,
|
|
104
|
-
ownerState = _ref5.ownerState;
|
|
105
|
-
if (!ownerState.container) {
|
|
106
|
-
return {};
|
|
107
|
-
}
|
|
108
|
-
var getParentSpacing = createGetParentSpacing(ownerState);
|
|
109
|
-
var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.unstable_level)), getParentSpacing('row')) : {};
|
|
110
|
-
traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, function (appendStyle, value) {
|
|
111
|
-
var _theme$spacing;
|
|
112
|
-
appendStyle(styles, _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.unstable_level)), typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)));
|
|
113
|
-
});
|
|
114
|
-
return styles;
|
|
115
|
-
};
|
|
116
|
-
export var generateGridColumnSpacingStyles = function generateGridColumnSpacingStyles(_ref7) {
|
|
117
|
-
var theme = _ref7.theme,
|
|
118
|
-
ownerState = _ref7.ownerState;
|
|
119
|
-
if (!ownerState.container) {
|
|
120
|
-
return {};
|
|
121
|
-
}
|
|
122
|
-
var getParentSpacing = createGetParentSpacing(ownerState);
|
|
123
|
-
var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.unstable_level)), getParentSpacing('column')) : {};
|
|
124
|
-
traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, function (appendStyle, value) {
|
|
125
|
-
var _theme$spacing2;
|
|
126
|
-
appendStyle(styles, _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.unstable_level)), typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)));
|
|
127
|
-
});
|
|
128
|
-
return styles;
|
|
129
|
-
};
|
|
130
|
-
export var generateGridDirectionStyles = function generateGridDirectionStyles(_ref9) {
|
|
131
|
-
var theme = _ref9.theme,
|
|
132
|
-
ownerState = _ref9.ownerState;
|
|
133
|
-
if (!ownerState.container) {
|
|
134
|
-
return {};
|
|
135
|
-
}
|
|
136
|
-
var styles = {};
|
|
137
|
-
traverseBreakpoints(theme.breakpoints, ownerState.direction, function (appendStyle, value) {
|
|
138
|
-
appendStyle(styles, {
|
|
139
|
-
flexDirection: value
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
return styles;
|
|
143
|
-
};
|
|
144
|
-
export var generateGridStyles = function generateGridStyles(_ref10) {
|
|
145
|
-
var ownerState = _ref10.ownerState;
|
|
146
|
-
var getSelfSpacing = createGetSelfSpacing(ownerState);
|
|
147
|
-
var getParentSpacing = createGetParentSpacing(ownerState);
|
|
148
|
-
return _extends({
|
|
149
|
-
minWidth: 0,
|
|
150
|
-
boxSizing: 'border-box'
|
|
151
|
-
}, ownerState.container && _extends({
|
|
152
|
-
display: 'flex',
|
|
153
|
-
flexWrap: 'wrap'
|
|
154
|
-
}, ownerState.wrap && ownerState.wrap !== 'wrap' && {
|
|
155
|
-
flexWrap: ownerState.wrap
|
|
156
|
-
}, {
|
|
157
|
-
margin: "calc(".concat(getSelfSpacing('row'), " / -2) calc(").concat(getSelfSpacing('column'), " / -2)")
|
|
158
|
-
}, ownerState.disableEqualOverflow && {
|
|
159
|
-
margin: "calc(".concat(getSelfSpacing('row'), " * -1) 0px 0px calc(").concat(getSelfSpacing('column'), " * -1)")
|
|
160
|
-
}), (!ownerState.container || isNestedContainer(ownerState)) && _extends({
|
|
161
|
-
padding: "calc(".concat(getParentSpacing('row'), " / 2) calc(").concat(getParentSpacing('column'), " / 2)")
|
|
162
|
-
}, (ownerState.disableEqualOverflow || ownerState.parentDisableEqualOverflow) && {
|
|
163
|
-
padding: "".concat(getParentSpacing('row'), " 0px 0px ").concat(getParentSpacing('column'))
|
|
164
|
-
}));
|
|
165
|
-
};
|
|
166
|
-
export var generateSizeClassNames = function generateSizeClassNames(gridSize) {
|
|
167
|
-
var classNames = [];
|
|
168
|
-
Object.entries(gridSize).forEach(function (_ref11) {
|
|
169
|
-
var _ref12 = _slicedToArray(_ref11, 2),
|
|
170
|
-
key = _ref12[0],
|
|
171
|
-
value = _ref12[1];
|
|
172
|
-
if (value !== false && value !== undefined) {
|
|
173
|
-
classNames.push("grid-".concat(key, "-").concat(String(value)));
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
return classNames;
|
|
177
|
-
};
|
|
178
|
-
export var generateSpacingClassNames = function generateSpacingClassNames(spacing) {
|
|
179
|
-
var smallestBreakpoint = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'xs';
|
|
180
|
-
function isValidSpacing(val) {
|
|
181
|
-
if (val === undefined) {
|
|
182
|
-
return false;
|
|
183
|
-
}
|
|
184
|
-
return typeof val === 'string' && !Number.isNaN(Number(val)) || typeof val === 'number' && val > 0;
|
|
185
|
-
}
|
|
186
|
-
if (isValidSpacing(spacing)) {
|
|
187
|
-
return ["spacing-".concat(smallestBreakpoint, "-").concat(String(spacing))];
|
|
188
|
-
}
|
|
189
|
-
if (_typeof(spacing) === 'object' && !Array.isArray(spacing)) {
|
|
190
|
-
var classNames = [];
|
|
191
|
-
Object.entries(spacing).forEach(function (_ref13) {
|
|
192
|
-
var _ref14 = _slicedToArray(_ref13, 2),
|
|
193
|
-
key = _ref14[0],
|
|
194
|
-
value = _ref14[1];
|
|
195
|
-
if (isValidSpacing(value)) {
|
|
196
|
-
classNames.push("spacing-".concat(key, "-").concat(String(value)));
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
return classNames;
|
|
200
|
-
}
|
|
201
|
-
return [];
|
|
202
|
-
};
|
|
203
|
-
export var generateDirectionClasses = function generateDirectionClasses(direction) {
|
|
204
|
-
if (direction === undefined) {
|
|
205
|
-
return [];
|
|
206
|
-
}
|
|
207
|
-
if (_typeof(direction) === 'object') {
|
|
208
|
-
return Object.entries(direction).map(function (_ref15) {
|
|
209
|
-
var _ref16 = _slicedToArray(_ref15, 2),
|
|
210
|
-
key = _ref16[0],
|
|
211
|
-
value = _ref16[1];
|
|
212
|
-
return "direction-".concat(key, "-").concat(value);
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
return ["direction-xs-".concat(String(direction))];
|
|
216
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
export { default } from './Grid';
|
|
4
|
-
export { default as createGrid } from './createGrid';
|
|
5
|
-
export * from './GridProps';
|
|
6
|
-
export { default as gridClasses } from './gridClasses';
|
|
7
|
-
export * from './gridClasses';
|
|
8
|
-
export { traverseBreakpoints as unstable_traverseBreakpoints } from './traverseBreakpoints';
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
export var filterBreakpointKeys = function filterBreakpointKeys(breakpointsKeys, responsiveKeys) {
|
|
4
|
-
return breakpointsKeys.filter(function (key) {
|
|
5
|
-
return responsiveKeys.includes(key);
|
|
6
|
-
});
|
|
7
|
-
};
|
|
8
|
-
export var traverseBreakpoints = function traverseBreakpoints(breakpoints, responsive, iterator) {
|
|
9
|
-
var smallestBreakpoint = breakpoints.keys[0]; // the keys is sorted from smallest to largest by `createBreakpoints`.
|
|
10
|
-
|
|
11
|
-
if (Array.isArray(responsive)) {
|
|
12
|
-
responsive.forEach(function (breakpointValue, index) {
|
|
13
|
-
iterator(function (responsiveStyles, style) {
|
|
14
|
-
if (index <= breakpoints.keys.length - 1) {
|
|
15
|
-
if (index === 0) {
|
|
16
|
-
_extends(responsiveStyles, style);
|
|
17
|
-
} else {
|
|
18
|
-
responsiveStyles[breakpoints.up(breakpoints.keys[index])] = style;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}, breakpointValue);
|
|
22
|
-
});
|
|
23
|
-
} else if (responsive && _typeof(responsive) === 'object') {
|
|
24
|
-
// prevent null
|
|
25
|
-
// responsive could be a very big object, pick the smallest responsive values
|
|
26
|
-
|
|
27
|
-
var keys = Object.keys(responsive).length > breakpoints.keys.length ? breakpoints.keys : filterBreakpointKeys(breakpoints.keys, Object.keys(responsive));
|
|
28
|
-
keys.forEach(function (key) {
|
|
29
|
-
if (breakpoints.keys.indexOf(key) !== -1) {
|
|
30
|
-
// @ts-ignore already checked that responsive is an object
|
|
31
|
-
var breakpointValue = responsive[key];
|
|
32
|
-
if (breakpointValue !== undefined) {
|
|
33
|
-
iterator(function (responsiveStyles, style) {
|
|
34
|
-
if (smallestBreakpoint === key) {
|
|
35
|
-
_extends(responsiveStyles, style);
|
|
36
|
-
} else {
|
|
37
|
-
responsiveStyles[breakpoints.up(key)] = style;
|
|
38
|
-
}
|
|
39
|
-
}, breakpointValue);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
} else if (typeof responsive === 'number' || typeof responsive === 'string') {
|
|
44
|
-
iterator(function (responsiveStyles, style) {
|
|
45
|
-
_extends(responsiveStyles, style);
|
|
46
|
-
}, responsive);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import responsivePropType from '../responsivePropType';
|
|
2
|
-
import style from '../style';
|
|
3
|
-
import compose from '../compose';
|
|
4
|
-
import { createUnaryUnit, getValue } from '../spacing';
|
|
5
|
-
import { handleBreakpoints } from '../breakpoints';
|
|
6
|
-
export function borderTransform(value) {
|
|
7
|
-
if (typeof value !== 'number') {
|
|
8
|
-
return value;
|
|
9
|
-
}
|
|
10
|
-
return "".concat(value, "px solid");
|
|
11
|
-
}
|
|
12
|
-
function createBorderStyle(prop, transform) {
|
|
13
|
-
return style({
|
|
14
|
-
prop: prop,
|
|
15
|
-
themeKey: 'borders',
|
|
16
|
-
transform: transform
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
export var border = createBorderStyle('border', borderTransform);
|
|
20
|
-
export var borderTop = createBorderStyle('borderTop', borderTransform);
|
|
21
|
-
export var borderRight = createBorderStyle('borderRight', borderTransform);
|
|
22
|
-
export var borderBottom = createBorderStyle('borderBottom', borderTransform);
|
|
23
|
-
export var borderLeft = createBorderStyle('borderLeft', borderTransform);
|
|
24
|
-
export var borderColor = createBorderStyle('borderColor');
|
|
25
|
-
export var borderTopColor = createBorderStyle('borderTopColor');
|
|
26
|
-
export var borderRightColor = createBorderStyle('borderRightColor');
|
|
27
|
-
export var borderBottomColor = createBorderStyle('borderBottomColor');
|
|
28
|
-
export var borderLeftColor = createBorderStyle('borderLeftColor');
|
|
29
|
-
export var outline = createBorderStyle('outline', borderTransform);
|
|
30
|
-
export var outlineColor = createBorderStyle('outlineColor');
|
|
31
|
-
|
|
32
|
-
// false positive
|
|
33
|
-
// eslint-disable-next-line react/function-component-definition
|
|
34
|
-
export var borderRadius = function borderRadius(props) {
|
|
35
|
-
if (props.borderRadius !== undefined && props.borderRadius !== null) {
|
|
36
|
-
var transformer = createUnaryUnit(props.theme, 'shape.borderRadius', 4, 'borderRadius');
|
|
37
|
-
var styleFromPropValue = function styleFromPropValue(propValue) {
|
|
38
|
-
return {
|
|
39
|
-
borderRadius: getValue(transformer, propValue)
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
return handleBreakpoints(props, props.borderRadius, styleFromPropValue);
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
45
|
-
};
|
|
46
|
-
borderRadius.propTypes = process.env.NODE_ENV !== 'production' ? {
|
|
47
|
-
borderRadius: responsivePropType
|
|
48
|
-
} : {};
|
|
49
|
-
borderRadius.filterProps = ['borderRadius'];
|
|
50
|
-
var borders = compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius, outline, outlineColor);
|
|
51
|
-
export default borders;
|
package/legacy/borders/index.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import deepmerge from '@mui/utils/deepmerge';
|
|
6
|
-
import merge from '../merge';
|
|
7
|
-
|
|
8
|
-
// The breakpoint **start** at this value.
|
|
9
|
-
// For instance with the first breakpoint xs: [xs, sm[.
|
|
10
|
-
export var values = {
|
|
11
|
-
xs: 0,
|
|
12
|
-
// phone
|
|
13
|
-
sm: 600,
|
|
14
|
-
// tablet
|
|
15
|
-
md: 900,
|
|
16
|
-
// small laptop
|
|
17
|
-
lg: 1200,
|
|
18
|
-
// desktop
|
|
19
|
-
xl: 1536 // large screen
|
|
20
|
-
};
|
|
21
|
-
var defaultBreakpoints = {
|
|
22
|
-
// Sorted ASC by size. That's important.
|
|
23
|
-
// It can't be configured as it's used statically for propTypes.
|
|
24
|
-
keys: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
25
|
-
up: function up(key) {
|
|
26
|
-
return "@media (min-width:".concat(values[key], "px)");
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
30
|
-
var theme = props.theme || {};
|
|
31
|
-
if (Array.isArray(propValue)) {
|
|
32
|
-
var themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
|
33
|
-
return propValue.reduce(function (acc, item, index) {
|
|
34
|
-
acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);
|
|
35
|
-
return acc;
|
|
36
|
-
}, {});
|
|
37
|
-
}
|
|
38
|
-
if (_typeof(propValue) === 'object') {
|
|
39
|
-
var _themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
|
40
|
-
return Object.keys(propValue).reduce(function (acc, breakpoint) {
|
|
41
|
-
// key is breakpoint
|
|
42
|
-
if (Object.keys(_themeBreakpoints.values || values).indexOf(breakpoint) !== -1) {
|
|
43
|
-
var mediaKey = _themeBreakpoints.up(breakpoint);
|
|
44
|
-
acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
|
45
|
-
} else {
|
|
46
|
-
var cssKey = breakpoint;
|
|
47
|
-
acc[cssKey] = propValue[cssKey];
|
|
48
|
-
}
|
|
49
|
-
return acc;
|
|
50
|
-
}, {});
|
|
51
|
-
}
|
|
52
|
-
var output = styleFromPropValue(propValue);
|
|
53
|
-
return output;
|
|
54
|
-
}
|
|
55
|
-
function breakpoints(styleFunction) {
|
|
56
|
-
// false positive
|
|
57
|
-
// eslint-disable-next-line react/function-component-definition
|
|
58
|
-
var newStyleFunction = function newStyleFunction(props) {
|
|
59
|
-
var theme = props.theme || {};
|
|
60
|
-
var base = styleFunction(props);
|
|
61
|
-
var themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
|
62
|
-
var extended = themeBreakpoints.keys.reduce(function (acc, key) {
|
|
63
|
-
if (props[key]) {
|
|
64
|
-
acc = acc || {};
|
|
65
|
-
acc[themeBreakpoints.up(key)] = styleFunction(_extends({
|
|
66
|
-
theme: theme
|
|
67
|
-
}, props[key]));
|
|
68
|
-
}
|
|
69
|
-
return acc;
|
|
70
|
-
}, null);
|
|
71
|
-
return merge(base, extended);
|
|
72
|
-
};
|
|
73
|
-
newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? _extends({}, styleFunction.propTypes, {
|
|
74
|
-
xs: PropTypes.object,
|
|
75
|
-
sm: PropTypes.object,
|
|
76
|
-
md: PropTypes.object,
|
|
77
|
-
lg: PropTypes.object,
|
|
78
|
-
xl: PropTypes.object
|
|
79
|
-
}) : {};
|
|
80
|
-
newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl'].concat(_toConsumableArray(styleFunction.filterProps));
|
|
81
|
-
return newStyleFunction;
|
|
82
|
-
}
|
|
83
|
-
export function createEmptyBreakpointObject() {
|
|
84
|
-
var _breakpointsInput$key;
|
|
85
|
-
var breakpointsInput = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
86
|
-
var breakpointsInOrder = (_breakpointsInput$key = breakpointsInput.keys) == null ? void 0 : _breakpointsInput$key.reduce(function (acc, key) {
|
|
87
|
-
var breakpointStyleKey = breakpointsInput.up(key);
|
|
88
|
-
acc[breakpointStyleKey] = {};
|
|
89
|
-
return acc;
|
|
90
|
-
}, {});
|
|
91
|
-
return breakpointsInOrder || {};
|
|
92
|
-
}
|
|
93
|
-
export function removeUnusedBreakpoints(breakpointKeys, style) {
|
|
94
|
-
return breakpointKeys.reduce(function (acc, key) {
|
|
95
|
-
var breakpointOutput = acc[key];
|
|
96
|
-
var isBreakpointUnused = !breakpointOutput || Object.keys(breakpointOutput).length === 0;
|
|
97
|
-
if (isBreakpointUnused) {
|
|
98
|
-
delete acc[key];
|
|
99
|
-
}
|
|
100
|
-
return acc;
|
|
101
|
-
}, style);
|
|
102
|
-
}
|
|
103
|
-
export function mergeBreakpointsInOrder(breakpointsInput) {
|
|
104
|
-
var emptyBreakpoints = createEmptyBreakpointObject(breakpointsInput);
|
|
105
|
-
for (var _len = arguments.length, styles = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
106
|
-
styles[_key - 1] = arguments[_key];
|
|
107
|
-
}
|
|
108
|
-
var mergedOutput = [emptyBreakpoints].concat(styles).reduce(function (prev, next) {
|
|
109
|
-
return deepmerge(prev, next);
|
|
110
|
-
}, {});
|
|
111
|
-
return removeUnusedBreakpoints(Object.keys(emptyBreakpoints), mergedOutput);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// compute base for responsive values; e.g.,
|
|
115
|
-
// [1,2,3] => {xs: true, sm: true, md: true}
|
|
116
|
-
// {xs: 1, sm: 2, md: 3} => {xs: true, sm: true, md: true}
|
|
117
|
-
export function computeBreakpointsBase(breakpointValues, themeBreakpoints) {
|
|
118
|
-
// fixed value
|
|
119
|
-
if (_typeof(breakpointValues) !== 'object') {
|
|
120
|
-
return {};
|
|
121
|
-
}
|
|
122
|
-
var base = {};
|
|
123
|
-
var breakpointsKeys = Object.keys(themeBreakpoints);
|
|
124
|
-
if (Array.isArray(breakpointValues)) {
|
|
125
|
-
breakpointsKeys.forEach(function (breakpoint, i) {
|
|
126
|
-
if (i < breakpointValues.length) {
|
|
127
|
-
base[breakpoint] = true;
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
} else {
|
|
131
|
-
breakpointsKeys.forEach(function (breakpoint) {
|
|
132
|
-
if (breakpointValues[breakpoint] != null) {
|
|
133
|
-
base[breakpoint] = true;
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return base;
|
|
138
|
-
}
|
|
139
|
-
export function resolveBreakpointValues(_ref) {
|
|
140
|
-
var breakpointValues = _ref.values,
|
|
141
|
-
themeBreakpoints = _ref.breakpoints,
|
|
142
|
-
customBase = _ref.base;
|
|
143
|
-
var base = customBase || computeBreakpointsBase(breakpointValues, themeBreakpoints);
|
|
144
|
-
var keys = Object.keys(base);
|
|
145
|
-
if (keys.length === 0) {
|
|
146
|
-
return breakpointValues;
|
|
147
|
-
}
|
|
148
|
-
var previous;
|
|
149
|
-
return keys.reduce(function (acc, breakpoint, i) {
|
|
150
|
-
if (Array.isArray(breakpointValues)) {
|
|
151
|
-
acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous];
|
|
152
|
-
previous = i;
|
|
153
|
-
} else if (_typeof(breakpointValues) === 'object') {
|
|
154
|
-
acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous];
|
|
155
|
-
previous = breakpoint;
|
|
156
|
-
} else {
|
|
157
|
-
acc[breakpoint] = breakpointValues;
|
|
158
|
-
}
|
|
159
|
-
return acc;
|
|
160
|
-
}, {});
|
|
161
|
-
}
|
|
162
|
-
export default breakpoints;
|