@mui/system 5.10.13 → 5.10.15
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/Box/Box.js +1 -10
- package/Box/index.js +0 -2
- package/CHANGELOG.md +132 -2
- package/Container/Container.js +2 -17
- package/Container/containerClasses.js +0 -3
- package/Container/createContainer.js +15 -37
- package/Container/index.js +0 -6
- package/Stack/Stack.js +1 -12
- package/Stack/createStack.js +10 -48
- package/Stack/index.js +0 -9
- package/Stack/stackClasses.js +0 -3
- package/ThemeProvider/ThemeProvider.js +2 -22
- package/ThemeProvider/index.js +0 -2
- package/Unstable_Grid/Grid.js +6 -42
- package/Unstable_Grid/createGrid.js +19 -49
- package/Unstable_Grid/gridClasses.js +8 -7
- package/Unstable_Grid/gridGenerator.d.ts +4 -3
- package/Unstable_Grid/gridGenerator.js +22 -63
- package/Unstable_Grid/index.js +0 -9
- package/borders.js +0 -14
- package/breakpoints.js +3 -32
- package/colorManipulator.js +13 -55
- package/compose.js +0 -7
- package/createBox.js +5 -20
- package/createStyled.js +27 -71
- package/createTheme/createBreakpoints.js +22 -37
- package/createTheme/createSpacing.js +4 -8
- package/createTheme/createTheme.js +6 -16
- package/createTheme/index.js +0 -2
- package/cssGrid.js +0 -21
- package/cssVars/createCssVarsProvider.js +33 -74
- package/cssVars/createGetCssVar.js +2 -7
- package/cssVars/cssVarsParser.js +3 -15
- package/cssVars/getInitColorSchemeScript.js +0 -6
- package/cssVars/index.js +0 -3
- package/cssVars/useCurrentColorScheme.js +20 -49
- package/display.js +0 -6
- package/esm/Box/Box.js +1 -6
- package/esm/Container/Container.js +3 -14
- package/esm/Container/createContainer.js +15 -25
- package/esm/Stack/Stack.js +1 -9
- package/esm/Stack/createStack.js +10 -29
- package/esm/ThemeProvider/ThemeProvider.js +2 -11
- package/esm/Unstable_Grid/Grid.js +6 -39
- package/esm/Unstable_Grid/createGrid.js +18 -35
- package/esm/Unstable_Grid/gridClasses.js +8 -4
- package/esm/Unstable_Grid/gridGenerator.js +20 -38
- package/esm/borders.js +0 -6
- package/esm/breakpoints.js +7 -22
- package/esm/colorManipulator.js +13 -43
- package/esm/compose.js +0 -5
- package/esm/createBox.js +5 -7
- package/esm/createStyled.js +27 -64
- package/esm/createTheme/createBreakpoints.js +22 -34
- package/esm/createTheme/createSpacing.js +4 -7
- package/esm/createTheme/createTheme.js +6 -9
- package/esm/cssGrid.js +0 -9
- package/esm/cssVars/createCssVarsProvider.js +33 -60
- package/esm/cssVars/createGetCssVar.js +2 -6
- package/esm/cssVars/cssVarsParser.js +3 -11
- package/esm/cssVars/useCurrentColorScheme.js +20 -44
- package/esm/getThemeValue.js +0 -2
- package/esm/index.js +3 -3
- package/esm/memoize.js +0 -1
- package/esm/merge.js +0 -3
- package/esm/palette.js +0 -3
- package/esm/propsToClassKey.js +4 -7
- package/esm/sizing.js +0 -5
- package/esm/spacing.js +3 -23
- package/esm/style.js +5 -22
- package/esm/styleFunctionSx/extendSxProp.js +3 -10
- package/esm/styleFunctionSx/styleFunctionSx.js +3 -16
- package/esm/sx/sx.js +0 -2
- package/esm/useTheme.js +0 -2
- package/esm/useThemeProps/getThemeProps.js +0 -2
- package/esm/useThemeWithoutDefault.js +0 -3
- package/flexbox.js +0 -4
- package/getThemeValue.js +0 -14
- package/index.d.ts +2 -0
- package/index.js +16 -55
- package/legacy/Box/Box.js +1 -6
- package/legacy/Container/Container.js +3 -14
- package/legacy/Container/createContainer.js +29 -39
- package/legacy/Stack/Stack.js +1 -9
- package/legacy/Stack/createStack.js +17 -37
- package/legacy/ThemeProvider/ThemeProvider.js +3 -12
- package/legacy/Unstable_Grid/Grid.js +6 -39
- package/legacy/Unstable_Grid/createGrid.js +34 -53
- package/legacy/Unstable_Grid/gridGenerator.js +36 -58
- package/legacy/borders.js +0 -6
- package/legacy/breakpoints.js +9 -28
- package/legacy/colorManipulator.js +16 -48
- package/legacy/compose.js +0 -6
- package/legacy/createBox.js +9 -11
- package/legacy/createStyled.js +27 -68
- package/legacy/createTheme/createBreakpoints.js +20 -33
- package/legacy/createTheme/createSpacing.js +4 -9
- package/legacy/createTheme/createTheme.js +7 -13
- package/legacy/cssGrid.js +0 -9
- package/legacy/cssVars/createCssVarsProvider.js +98 -130
- package/legacy/cssVars/createGetCssVar.js +2 -10
- package/legacy/cssVars/cssVarsParser.js +7 -20
- package/legacy/cssVars/getInitColorSchemeScript.js +14 -15
- package/legacy/cssVars/useCurrentColorScheme.js +43 -69
- package/legacy/getThemeValue.js +0 -3
- package/legacy/index.js +4 -4
- package/legacy/memoize.js +0 -1
- package/legacy/merge.js +0 -3
- package/legacy/palette.js +0 -3
- package/legacy/propsToClassKey.js +2 -5
- package/legacy/sizing.js +0 -5
- package/legacy/spacing.js +6 -27
- package/legacy/style.js +9 -27
- package/legacy/styleFunctionSx/extendSxProp.js +3 -11
- package/legacy/styleFunctionSx/styleFunctionSx.js +6 -21
- package/legacy/sx/sx.js +0 -2
- package/legacy/useTheme.js +0 -2
- package/legacy/useThemeProps/getThemeProps.js +2 -4
- package/legacy/useThemeProps/useThemeProps.js +2 -2
- package/legacy/useThemeWithoutDefault.js +0 -3
- package/memoize.js +0 -2
- package/merge.js +0 -5
- package/modern/Box/Box.js +1 -6
- package/modern/Container/Container.js +3 -14
- package/modern/Container/createContainer.js +15 -25
- package/modern/Stack/Stack.js +1 -9
- package/modern/Stack/createStack.js +10 -29
- package/modern/ThemeProvider/ThemeProvider.js +2 -11
- package/modern/Unstable_Grid/Grid.js +6 -39
- package/modern/Unstable_Grid/createGrid.js +18 -34
- package/modern/Unstable_Grid/gridClasses.js +8 -4
- package/modern/Unstable_Grid/gridGenerator.js +20 -36
- package/modern/borders.js +0 -6
- package/modern/breakpoints.js +7 -21
- package/modern/colorManipulator.js +13 -43
- package/modern/compose.js +0 -5
- package/modern/createBox.js +5 -7
- package/modern/createStyled.js +27 -63
- package/modern/createTheme/createBreakpoints.js +22 -34
- package/modern/createTheme/createSpacing.js +4 -7
- package/modern/createTheme/createTheme.js +6 -9
- package/modern/cssGrid.js +0 -9
- package/modern/cssVars/createCssVarsProvider.js +33 -60
- package/modern/cssVars/createGetCssVar.js +2 -6
- package/modern/cssVars/cssVarsParser.js +3 -11
- package/modern/cssVars/useCurrentColorScheme.js +20 -44
- package/modern/getThemeValue.js +0 -2
- package/modern/index.js +4 -4
- package/modern/memoize.js +0 -1
- package/modern/merge.js +0 -3
- package/modern/palette.js +0 -3
- package/modern/propsToClassKey.js +4 -7
- package/modern/sizing.js +0 -4
- package/modern/spacing.js +3 -22
- package/modern/style.js +5 -22
- package/modern/styleFunctionSx/extendSxProp.js +3 -10
- package/modern/styleFunctionSx/styleFunctionSx.js +3 -16
- package/modern/sx/sx.js +0 -2
- package/modern/useTheme.js +0 -2
- package/modern/useThemeProps/getThemeProps.js +0 -2
- package/modern/useThemeWithoutDefault.js +0 -3
- package/package.json +6 -6
- package/palette.js +0 -6
- package/positions.js +0 -6
- package/propsToClassKey.js +4 -10
- package/responsivePropType.d.ts +3 -0
- package/responsivePropType.js +0 -3
- package/shadows.js +0 -3
- package/sizing.js +0 -11
- package/spacing.d.ts +14 -0
- package/spacing.js +3 -37
- package/style.d.ts +6 -0
- package/style.js +6 -27
- package/styleFunctionSx/extendSxProp.js +3 -15
- package/styleFunctionSx/index.js +0 -5
- package/styleFunctionSx/styleFunctionSx.js +3 -21
- package/styled.js +0 -3
- package/sx/index.js +0 -2
- package/sx/sx.js +0 -4
- package/typography.js +0 -4
- package/useTheme.js +0 -6
- package/useThemeProps/getThemeProps.js +0 -4
- package/useThemeProps/index.js +0 -3
- package/useThemeProps/useThemeProps.js +0 -4
- package/useThemeWithoutDefault.js +0 -4
|
@@ -7,7 +7,6 @@ import { ThemeContext as StyledEngineThemeContext } from '@mui/styled-engine';
|
|
|
7
7
|
import useTheme from '../useTheme';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
var EMPTY_THEME = {};
|
|
10
|
-
|
|
11
10
|
function InnerThemeProvider(props) {
|
|
12
11
|
var theme = useTheme();
|
|
13
12
|
return /*#__PURE__*/_jsx(StyledEngineThemeContext.Provider, {
|
|
@@ -15,21 +14,20 @@ function InnerThemeProvider(props) {
|
|
|
15
14
|
children: props.children
|
|
16
15
|
});
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
process.env.NODE_ENV !== "production" ? InnerThemeProvider.propTypes = {
|
|
20
18
|
/**
|
|
21
19
|
* Your component tree.
|
|
22
20
|
*/
|
|
23
21
|
children: PropTypes.node
|
|
24
22
|
} : void 0;
|
|
23
|
+
|
|
25
24
|
/**
|
|
26
25
|
* This component makes the `theme` available down the React tree.
|
|
27
26
|
* It should preferably be used at **the root of your component tree**.
|
|
28
27
|
*/
|
|
29
|
-
|
|
30
28
|
function ThemeProvider(props) {
|
|
31
29
|
var children = props.children,
|
|
32
|
-
|
|
30
|
+
localTheme = props.theme;
|
|
33
31
|
return /*#__PURE__*/_jsx(MuiThemeProvider, {
|
|
34
32
|
theme: localTheme,
|
|
35
33
|
children: /*#__PURE__*/_jsx(InnerThemeProvider, {
|
|
@@ -37,28 +35,21 @@ function ThemeProvider(props) {
|
|
|
37
35
|
})
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
|
-
|
|
41
|
-
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
|
|
42
|
-
/* remove-proptypes */
|
|
43
|
-
= {
|
|
38
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes /* remove-proptypes */ = {
|
|
44
39
|
// ----------------------------- Warning --------------------------------
|
|
45
40
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
46
41
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
47
42
|
// ----------------------------------------------------------------------
|
|
48
|
-
|
|
49
43
|
/**
|
|
50
44
|
* Your component tree.
|
|
51
45
|
*/
|
|
52
46
|
children: PropTypes.node,
|
|
53
|
-
|
|
54
47
|
/**
|
|
55
48
|
* A theme object. You can provide a function to extend the outer theme.
|
|
56
49
|
*/
|
|
57
50
|
theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired
|
|
58
51
|
} : void 0;
|
|
59
|
-
|
|
60
52
|
if (process.env.NODE_ENV !== 'production') {
|
|
61
53
|
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) : void 0;
|
|
62
54
|
}
|
|
63
|
-
|
|
64
55
|
export default ThemeProvider;
|
|
@@ -10,58 +10,42 @@ import createGrid from './createGrid';
|
|
|
10
10
|
*
|
|
11
11
|
* - [Grid API](https://mui.com/system/api/grid/)
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
13
|
var Grid = createGrid();
|
|
15
|
-
process.env.NODE_ENV !== "production" ? Grid.propTypes
|
|
16
|
-
/* remove-proptypes */
|
|
17
|
-
= {
|
|
14
|
+
process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
|
|
18
15
|
// ----------------------------- Warning --------------------------------
|
|
19
16
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
20
17
|
// | To update them edit TypeScript types and run "yarn proptypes" |
|
|
21
18
|
// ----------------------------------------------------------------------
|
|
22
|
-
|
|
23
19
|
/**
|
|
24
20
|
* The content of the component.
|
|
25
21
|
*/
|
|
26
22
|
children: PropTypes.node,
|
|
27
|
-
|
|
28
23
|
/**
|
|
29
24
|
* The number of columns.
|
|
30
25
|
* @default 12
|
|
31
26
|
*/
|
|
32
|
-
columns: PropTypes
|
|
33
|
-
/* @typescript-to-proptypes-ignore */
|
|
34
|
-
.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
|
35
|
-
|
|
27
|
+
columns: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
|
36
28
|
/**
|
|
37
29
|
* Defines the horizontal space between the type `item` components.
|
|
38
30
|
* It overrides the value of the `spacing` prop.
|
|
39
31
|
*/
|
|
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
|
-
|
|
32
|
+
columnSpacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
44
33
|
/**
|
|
45
34
|
* If `true`, the component will have the flex *container* behavior.
|
|
46
35
|
* You should be wrapping *items* with a *container*.
|
|
47
36
|
* @default false
|
|
48
37
|
*/
|
|
49
38
|
container: PropTypes.bool,
|
|
50
|
-
|
|
51
39
|
/**
|
|
52
40
|
* Defines the `flex-direction` style property.
|
|
53
41
|
* It is applied for all screen sizes.
|
|
54
42
|
* @default 'row'
|
|
55
43
|
*/
|
|
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
|
-
|
|
44
|
+
direction: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
|
60
45
|
/**
|
|
61
46
|
* If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
|
|
62
47
|
*/
|
|
63
48
|
disableEqualOverflow: PropTypes.bool,
|
|
64
|
-
|
|
65
49
|
/**
|
|
66
50
|
* If a number, it sets the number of columns the grid item uses.
|
|
67
51
|
* It can't be greater than the total number of columns of the container (12 by default).
|
|
@@ -72,14 +56,12 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes
|
|
|
72
56
|
* @default false
|
|
73
57
|
*/
|
|
74
58
|
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
75
|
-
|
|
76
59
|
/**
|
|
77
60
|
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
78
61
|
* If 'auto', the grid item push itself to the right-end of the container.
|
|
79
62
|
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
80
63
|
*/
|
|
81
64
|
lgOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
82
|
-
|
|
83
65
|
/**
|
|
84
66
|
* If a number, it sets the number of columns the grid item uses.
|
|
85
67
|
* It can't be greater than the total number of columns of the container (12 by default).
|
|
@@ -90,22 +72,17 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes
|
|
|
90
72
|
* @default false
|
|
91
73
|
*/
|
|
92
74
|
md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
93
|
-
|
|
94
75
|
/**
|
|
95
76
|
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
96
77
|
* If 'auto', the grid item push itself to the right-end of the container.
|
|
97
78
|
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
98
79
|
*/
|
|
99
80
|
mdOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
100
|
-
|
|
101
81
|
/**
|
|
102
82
|
* Defines the vertical space between the type `item` components.
|
|
103
83
|
* It overrides the value of the `spacing` prop.
|
|
104
84
|
*/
|
|
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
|
-
|
|
85
|
+
rowSpacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
109
86
|
/**
|
|
110
87
|
* If a number, it sets the number of columns the grid item uses.
|
|
111
88
|
* It can't be greater than the total number of columns of the container (12 by default).
|
|
@@ -116,35 +93,28 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes
|
|
|
116
93
|
* @default false
|
|
117
94
|
*/
|
|
118
95
|
sm: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
119
|
-
|
|
120
96
|
/**
|
|
121
97
|
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
122
98
|
* If 'auto', the grid item push itself to the right-end of the container.
|
|
123
99
|
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
124
100
|
*/
|
|
125
101
|
smOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
126
|
-
|
|
127
102
|
/**
|
|
128
103
|
* Defines the space between the type `item` components.
|
|
129
104
|
* It can only be used on a type `container` component.
|
|
130
105
|
* @default 0
|
|
131
106
|
*/
|
|
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
|
-
|
|
107
|
+
spacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
136
108
|
/**
|
|
137
109
|
* @ignore
|
|
138
110
|
*/
|
|
139
111
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
140
|
-
|
|
141
112
|
/**
|
|
142
113
|
* Defines the `flex-wrap` style property.
|
|
143
114
|
* It's applied for all screen sizes.
|
|
144
115
|
* @default 'wrap'
|
|
145
116
|
*/
|
|
146
117
|
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
|
|
147
|
-
|
|
148
118
|
/**
|
|
149
119
|
* If a number, it sets the number of columns the grid item uses.
|
|
150
120
|
* It can't be greater than the total number of columns of the container (12 by default).
|
|
@@ -155,14 +125,12 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes
|
|
|
155
125
|
* @default false
|
|
156
126
|
*/
|
|
157
127
|
xl: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
158
|
-
|
|
159
128
|
/**
|
|
160
129
|
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
161
130
|
* If 'auto', the grid item push itself to the right-end of the container.
|
|
162
131
|
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
163
132
|
*/
|
|
164
133
|
xlOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
165
|
-
|
|
166
134
|
/**
|
|
167
135
|
* If a number, it sets the number of columns the grid item uses.
|
|
168
136
|
* It can't be greater than the total number of columns of the container (12 by default).
|
|
@@ -173,7 +141,6 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes
|
|
|
173
141
|
* @default false
|
|
174
142
|
*/
|
|
175
143
|
xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
176
|
-
|
|
177
144
|
/**
|
|
178
145
|
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
179
146
|
* If 'auto', the grid item push itself to the right-end of the container.
|
|
@@ -13,8 +13,9 @@ import { extendSxProp } from '../styleFunctionSx';
|
|
|
13
13
|
import createTheme from '../createTheme';
|
|
14
14
|
import { generateGridStyles, generateGridSizeStyles, generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridDirectionStyles, generateGridOffsetStyles, generateSizeClassNames, generateSpacingClassNames, generateDirectionClasses } from './gridGenerator';
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
var defaultTheme = createTheme();
|
|
16
|
+
var defaultTheme = createTheme();
|
|
17
17
|
|
|
18
|
+
// widening Theme to any so that the consumer can own the theme structure.
|
|
18
19
|
var defaultCreateStyledComponent = systemStyled('div', {
|
|
19
20
|
name: 'MuiGrid',
|
|
20
21
|
slot: 'Root',
|
|
@@ -22,7 +23,6 @@ var defaultCreateStyledComponent = systemStyled('div', {
|
|
|
22
23
|
return styles.root;
|
|
23
24
|
}
|
|
24
25
|
});
|
|
25
|
-
|
|
26
26
|
function useThemePropsDefault(props) {
|
|
27
27
|
return useThemePropsSystem({
|
|
28
28
|
props: props,
|
|
@@ -30,24 +30,22 @@ function useThemePropsDefault(props) {
|
|
|
30
30
|
defaultTheme: defaultTheme
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
|
|
34
33
|
export default function createGrid() {
|
|
35
34
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
36
35
|
var _options$createStyled = options.createStyledComponent,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
createStyledComponent = _options$createStyled === void 0 ? defaultCreateStyledComponent : _options$createStyled,
|
|
37
|
+
_options$useThemeProp = options.useThemeProps,
|
|
38
|
+
useThemeProps = _options$useThemeProp === void 0 ? useThemePropsDefault : _options$useThemeProp,
|
|
39
|
+
_options$componentNam = options.componentName,
|
|
40
|
+
componentName = _options$componentNam === void 0 ? 'MuiGrid' : _options$componentNam;
|
|
42
41
|
var NestedContext = /*#__PURE__*/React.createContext(false);
|
|
43
42
|
var OverflowContext = /*#__PURE__*/React.createContext(undefined);
|
|
44
|
-
|
|
45
43
|
var useUtilityClasses = function useUtilityClasses(ownerState, theme) {
|
|
46
44
|
var container = ownerState.container,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
direction = ownerState.direction,
|
|
46
|
+
spacing = ownerState.spacing,
|
|
47
|
+
wrap = ownerState.wrap,
|
|
48
|
+
gridSize = ownerState.gridSize;
|
|
51
49
|
var slots = {
|
|
52
50
|
root: ['root', container && 'container', wrap !== 'wrap' && "wrap-xs-".concat(String(wrap))].concat(_toConsumableArray(generateDirectionClasses(direction)), _toConsumableArray(generateSizeClassNames(gridSize)), _toConsumableArray(container ? generateSpacingClassNames(spacing, theme.breakpoints.keys[0]) : []))
|
|
53
51
|
};
|
|
@@ -55,54 +53,45 @@ export default function createGrid() {
|
|
|
55
53
|
return generateUtilityClass(componentName, slot);
|
|
56
54
|
}, {});
|
|
57
55
|
};
|
|
58
|
-
|
|
59
56
|
var GridRoot = createStyledComponent(generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridSizeStyles, generateGridDirectionStyles, generateGridStyles, generateGridOffsetStyles);
|
|
60
57
|
var Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
|
|
61
58
|
var _inProps$columns, _inProps$spacing, _ref3, _inProps$rowSpacing, _ref4, _inProps$columnSpacin, _ref5, _disableEqualOverflow;
|
|
62
|
-
|
|
63
59
|
var theme = useTheme();
|
|
64
60
|
var themeProps = useThemeProps(inProps);
|
|
65
61
|
var props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
66
|
-
|
|
67
62
|
var nested = React.useContext(NestedContext);
|
|
68
63
|
var overflow = React.useContext(OverflowContext);
|
|
69
|
-
|
|
70
64
|
var className = props.className,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
65
|
+
_props$columns = props.columns,
|
|
66
|
+
columnsProp = _props$columns === void 0 ? 12 : _props$columns,
|
|
67
|
+
_props$container = props.container,
|
|
68
|
+
container = _props$container === void 0 ? false : _props$container,
|
|
69
|
+
_props$component = props.component,
|
|
70
|
+
component = _props$component === void 0 ? 'div' : _props$component,
|
|
71
|
+
_props$direction = props.direction,
|
|
72
|
+
direction = _props$direction === void 0 ? 'row' : _props$direction,
|
|
73
|
+
_props$wrap = props.wrap,
|
|
74
|
+
wrap = _props$wrap === void 0 ? 'wrap' : _props$wrap,
|
|
75
|
+
_props$spacing = props.spacing,
|
|
76
|
+
spacingProp = _props$spacing === void 0 ? 0 : _props$spacing,
|
|
77
|
+
_props$rowSpacing = props.rowSpacing,
|
|
78
|
+
rowSpacingProp = _props$rowSpacing === void 0 ? spacingProp : _props$rowSpacing,
|
|
79
|
+
_props$columnSpacing = props.columnSpacing,
|
|
80
|
+
columnSpacingProp = _props$columnSpacing === void 0 ? spacingProp : _props$columnSpacing,
|
|
81
|
+
themeDisableEqualOverflow = props.disableEqualOverflow,
|
|
82
|
+
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.
|
|
91
83
|
var disableEqualOverflow = themeDisableEqualOverflow;
|
|
92
|
-
|
|
93
84
|
if (nested && themeDisableEqualOverflow !== undefined) {
|
|
94
85
|
disableEqualOverflow = inProps.disableEqualOverflow;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
}
|
|
87
|
+
// collect breakpoints related props because they can be customized from the theme.
|
|
98
88
|
var gridSize = {};
|
|
99
89
|
var gridOffset = {};
|
|
100
90
|
var other = {};
|
|
101
91
|
Object.entries(rest).forEach(function (_ref) {
|
|
102
92
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
93
|
+
key = _ref2[0],
|
|
94
|
+
val = _ref2[1];
|
|
106
95
|
if (theme.breakpoints.values[key] !== undefined) {
|
|
107
96
|
gridSize[key] = val;
|
|
108
97
|
} else if (theme.breakpoints.values[key.replace('Offset', '')] !== undefined) {
|
|
@@ -115,7 +104,6 @@ export default function createGrid() {
|
|
|
115
104
|
var spacing = (_inProps$spacing = inProps.spacing) != null ? _inProps$spacing : nested ? undefined : spacingProp;
|
|
116
105
|
var rowSpacing = (_ref3 = (_inProps$rowSpacing = inProps.rowSpacing) != null ? _inProps$rowSpacing : inProps.spacing) != null ? _ref3 : nested ? undefined : rowSpacingProp;
|
|
117
106
|
var columnSpacing = (_ref4 = (_inProps$columnSpacin = inProps.columnSpacing) != null ? _inProps$columnSpacin : inProps.spacing) != null ? _ref4 : nested ? undefined : columnSpacingProp;
|
|
118
|
-
|
|
119
107
|
var ownerState = _extends({}, props, {
|
|
120
108
|
nested: nested,
|
|
121
109
|
columns: columns,
|
|
@@ -130,25 +118,21 @@ export default function createGrid() {
|
|
|
130
118
|
disableEqualOverflow: (_ref5 = (_disableEqualOverflow = disableEqualOverflow) != null ? _disableEqualOverflow : overflow) != null ? _ref5 : false,
|
|
131
119
|
// use context value if exists.
|
|
132
120
|
parentDisableEqualOverflow: overflow // for nested grid
|
|
133
|
-
|
|
134
121
|
});
|
|
135
122
|
|
|
136
123
|
var classes = useUtilityClasses(ownerState, theme);
|
|
137
|
-
|
|
138
124
|
var result = /*#__PURE__*/_jsx(GridRoot, _extends({
|
|
139
125
|
ref: ref,
|
|
140
126
|
as: component,
|
|
141
127
|
ownerState: ownerState,
|
|
142
128
|
className: clsx(classes.root, className)
|
|
143
129
|
}, other));
|
|
144
|
-
|
|
145
130
|
if (!nested) {
|
|
146
131
|
result = /*#__PURE__*/_jsx(NestedContext.Provider, {
|
|
147
132
|
value: true,
|
|
148
133
|
children: result
|
|
149
134
|
});
|
|
150
135
|
}
|
|
151
|
-
|
|
152
136
|
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
|
|
153
137
|
// There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
|
|
154
138
|
// 1. It is the root grid with `disableEqualOverflow`.
|
|
@@ -158,12 +142,9 @@ export default function createGrid() {
|
|
|
158
142
|
children: result
|
|
159
143
|
});
|
|
160
144
|
}
|
|
161
|
-
|
|
162
145
|
return result;
|
|
163
146
|
});
|
|
164
|
-
process.env.NODE_ENV !== "production" ? Grid.propTypes
|
|
165
|
-
/* remove-proptypes */
|
|
166
|
-
= {
|
|
147
|
+
process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
|
|
167
148
|
children: PropTypes.node,
|
|
168
149
|
className: PropTypes.string,
|
|
169
150
|
columns: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
|
@@ -1,54 +1,58 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
export var
|
|
4
|
+
export var filterBreakpointKeys = function filterBreakpointKeys(breakpointsKeys, responsiveKeys) {
|
|
5
|
+
return breakpointsKeys.filter(function (key) {
|
|
6
|
+
return responsiveKeys.includes(key);
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
export var traverseBreakpoints = function traverseBreakpoints(breakpoints, responsive, iterator) {
|
|
5
10
|
var smallestBreakpoint = breakpoints.keys[0]; // the keys is sorted from smallest to largest by `createBreakpoints`.
|
|
6
11
|
|
|
7
|
-
if (Array.isArray(
|
|
8
|
-
|
|
9
|
-
iterator(function (
|
|
12
|
+
if (Array.isArray(responsive)) {
|
|
13
|
+
responsive.forEach(function (breakpointValue, index) {
|
|
14
|
+
iterator(function (responsiveStyles, style) {
|
|
10
15
|
if (index <= breakpoints.keys.length - 1) {
|
|
11
16
|
if (index === 0) {
|
|
12
|
-
_extends(
|
|
17
|
+
_extends(responsiveStyles, style);
|
|
13
18
|
} else {
|
|
14
|
-
|
|
19
|
+
responsiveStyles[breakpoints.up(breakpoints.keys[index])] = style;
|
|
15
20
|
}
|
|
16
21
|
}
|
|
17
22
|
}, breakpointValue);
|
|
18
23
|
});
|
|
19
|
-
} else if (
|
|
24
|
+
} else if (responsive && _typeof(responsive) === 'object') {
|
|
20
25
|
// prevent null
|
|
21
|
-
//
|
|
22
|
-
|
|
26
|
+
// responsive could be a very big object, pick the smallest responsive values
|
|
27
|
+
|
|
28
|
+
var keys = Object.keys(responsive).length > breakpoints.keys.length ? breakpoints.keys : filterBreakpointKeys(breakpoints.keys, Object.keys(responsive));
|
|
23
29
|
keys.forEach(function (key) {
|
|
24
30
|
if (breakpoints.keys.indexOf(key) !== -1) {
|
|
25
|
-
// @ts-ignore already checked that
|
|
26
|
-
var breakpointValue =
|
|
27
|
-
|
|
31
|
+
// @ts-ignore already checked that responsive is an object
|
|
32
|
+
var breakpointValue = responsive[key];
|
|
28
33
|
if (breakpointValue !== undefined) {
|
|
29
|
-
iterator(function (
|
|
34
|
+
iterator(function (responsiveStyles, style) {
|
|
30
35
|
if (smallestBreakpoint === key) {
|
|
31
|
-
_extends(
|
|
36
|
+
_extends(responsiveStyles, style);
|
|
32
37
|
} else {
|
|
33
|
-
|
|
38
|
+
responsiveStyles[breakpoints.up(key)] = style;
|
|
34
39
|
}
|
|
35
40
|
}, breakpointValue);
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
43
|
});
|
|
39
|
-
} else if (typeof
|
|
40
|
-
iterator(function (
|
|
41
|
-
_extends(
|
|
42
|
-
},
|
|
44
|
+
} else if (typeof responsive === 'number' || typeof responsive === 'string') {
|
|
45
|
+
iterator(function (responsiveStyles, style) {
|
|
46
|
+
_extends(responsiveStyles, style);
|
|
47
|
+
}, responsive);
|
|
43
48
|
}
|
|
44
49
|
};
|
|
45
50
|
export var generateGridSizeStyles = function generateGridSizeStyles(_ref) {
|
|
46
51
|
var theme = _ref.theme,
|
|
47
|
-
|
|
52
|
+
ownerState = _ref.ownerState;
|
|
48
53
|
var styles = {};
|
|
49
54
|
traverseBreakpoints(theme.breakpoints, ownerState.gridSize, function (appendStyle, value) {
|
|
50
55
|
var style = {};
|
|
51
|
-
|
|
52
56
|
if (value === true) {
|
|
53
57
|
style = {
|
|
54
58
|
flexBasis: 0,
|
|
@@ -56,7 +60,6 @@ export var generateGridSizeStyles = function generateGridSizeStyles(_ref) {
|
|
|
56
60
|
maxWidth: '100%'
|
|
57
61
|
};
|
|
58
62
|
}
|
|
59
|
-
|
|
60
63
|
if (value === 'auto') {
|
|
61
64
|
style = {
|
|
62
65
|
flexBasis: 'auto',
|
|
@@ -66,7 +69,6 @@ export var generateGridSizeStyles = function generateGridSizeStyles(_ref) {
|
|
|
66
69
|
width: 'auto'
|
|
67
70
|
};
|
|
68
71
|
}
|
|
69
|
-
|
|
70
72
|
if (typeof value === 'number') {
|
|
71
73
|
style = {
|
|
72
74
|
flexGrow: 0,
|
|
@@ -74,42 +76,36 @@ export var generateGridSizeStyles = function generateGridSizeStyles(_ref) {
|
|
|
74
76
|
width: "calc(100% * ".concat(value, " / var(--Grid-columns)").concat(ownerState.nested && ownerState.container ? " + var(--Grid-columnSpacing)" : '', ")")
|
|
75
77
|
};
|
|
76
78
|
}
|
|
77
|
-
|
|
78
79
|
appendStyle(styles, style);
|
|
79
80
|
});
|
|
80
81
|
return styles;
|
|
81
82
|
};
|
|
82
83
|
export var generateGridOffsetStyles = function generateGridOffsetStyles(_ref2) {
|
|
83
84
|
var theme = _ref2.theme,
|
|
84
|
-
|
|
85
|
+
ownerState = _ref2.ownerState;
|
|
85
86
|
var styles = {};
|
|
86
87
|
traverseBreakpoints(theme.breakpoints, ownerState.gridOffset, function (appendStyle, value) {
|
|
87
88
|
var style = {};
|
|
88
|
-
|
|
89
89
|
if (value === 'auto') {
|
|
90
90
|
style = {
|
|
91
91
|
marginLeft: 'auto'
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
|
|
95
94
|
if (typeof value === 'number') {
|
|
96
95
|
style = {
|
|
97
96
|
marginLeft: value === 0 ? '0px' : "calc(100% * ".concat(value, " / var(--Grid-columns))")
|
|
98
97
|
};
|
|
99
98
|
}
|
|
100
|
-
|
|
101
99
|
appendStyle(styles, style);
|
|
102
100
|
});
|
|
103
101
|
return styles;
|
|
104
102
|
};
|
|
105
103
|
export var generateGridColumnsStyles = function generateGridColumnsStyles(_ref3) {
|
|
106
104
|
var theme = _ref3.theme,
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
ownerState = _ref3.ownerState;
|
|
109
106
|
if (!ownerState.container) {
|
|
110
107
|
return {};
|
|
111
108
|
}
|
|
112
|
-
|
|
113
109
|
var styles = {
|
|
114
110
|
'--Grid-columns': 12
|
|
115
111
|
};
|
|
@@ -122,16 +118,13 @@ export var generateGridColumnsStyles = function generateGridColumnsStyles(_ref3)
|
|
|
122
118
|
};
|
|
123
119
|
export var generateGridRowSpacingStyles = function generateGridRowSpacingStyles(_ref4) {
|
|
124
120
|
var theme = _ref4.theme,
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
ownerState = _ref4.ownerState;
|
|
127
122
|
if (!ownerState.container) {
|
|
128
123
|
return {};
|
|
129
124
|
}
|
|
130
|
-
|
|
131
125
|
var styles = {};
|
|
132
126
|
traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, function (appendStyle, value) {
|
|
133
127
|
var _theme$spacing;
|
|
134
|
-
|
|
135
128
|
appendStyle(styles, {
|
|
136
129
|
'--Grid-rowSpacing': typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)
|
|
137
130
|
});
|
|
@@ -140,16 +133,13 @@ export var generateGridRowSpacingStyles = function generateGridRowSpacingStyles(
|
|
|
140
133
|
};
|
|
141
134
|
export var generateGridColumnSpacingStyles = function generateGridColumnSpacingStyles(_ref5) {
|
|
142
135
|
var theme = _ref5.theme,
|
|
143
|
-
|
|
144
|
-
|
|
136
|
+
ownerState = _ref5.ownerState;
|
|
145
137
|
if (!ownerState.container) {
|
|
146
138
|
return {};
|
|
147
139
|
}
|
|
148
|
-
|
|
149
140
|
var styles = {};
|
|
150
141
|
traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, function (appendStyle, value) {
|
|
151
142
|
var _theme$spacing2;
|
|
152
|
-
|
|
153
143
|
appendStyle(styles, {
|
|
154
144
|
'--Grid-columnSpacing': typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)
|
|
155
145
|
});
|
|
@@ -158,12 +148,10 @@ export var generateGridColumnSpacingStyles = function generateGridColumnSpacingS
|
|
|
158
148
|
};
|
|
159
149
|
export var generateGridDirectionStyles = function generateGridDirectionStyles(_ref6) {
|
|
160
150
|
var theme = _ref6.theme,
|
|
161
|
-
|
|
162
|
-
|
|
151
|
+
ownerState = _ref6.ownerState;
|
|
163
152
|
if (!ownerState.container) {
|
|
164
153
|
return {};
|
|
165
154
|
}
|
|
166
|
-
|
|
167
155
|
var styles = {};
|
|
168
156
|
traverseBreakpoints(theme.breakpoints, ownerState.direction, function (appendStyle, value) {
|
|
169
157
|
appendStyle(styles, {
|
|
@@ -203,9 +191,8 @@ export var generateSizeClassNames = function generateSizeClassNames(gridSize) {
|
|
|
203
191
|
var classNames = [];
|
|
204
192
|
Object.entries(gridSize).forEach(function (_ref8) {
|
|
205
193
|
var _ref9 = _slicedToArray(_ref8, 2),
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
194
|
+
key = _ref9[0],
|
|
195
|
+
value = _ref9[1];
|
|
209
196
|
if (value !== false && value !== undefined) {
|
|
210
197
|
classNames.push("grid-".concat(key, "-").concat(String(value)));
|
|
211
198
|
}
|
|
@@ -214,49 +201,40 @@ export var generateSizeClassNames = function generateSizeClassNames(gridSize) {
|
|
|
214
201
|
};
|
|
215
202
|
export var generateSpacingClassNames = function generateSpacingClassNames(spacing) {
|
|
216
203
|
var smallestBreakpoint = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'xs';
|
|
217
|
-
|
|
218
204
|
function isValidSpacing(val) {
|
|
219
205
|
if (val === undefined) {
|
|
220
206
|
return false;
|
|
221
207
|
}
|
|
222
|
-
|
|
223
208
|
return typeof val === 'string' && !Number.isNaN(Number(val)) || typeof val === 'number' && val > 0;
|
|
224
209
|
}
|
|
225
|
-
|
|
226
210
|
if (isValidSpacing(spacing)) {
|
|
227
211
|
return ["spacing-".concat(smallestBreakpoint, "-").concat(String(spacing))];
|
|
228
212
|
}
|
|
229
|
-
|
|
230
213
|
if (_typeof(spacing) === 'object' && !Array.isArray(spacing)) {
|
|
231
214
|
var classNames = [];
|
|
232
215
|
Object.entries(spacing).forEach(function (_ref10) {
|
|
233
216
|
var _ref11 = _slicedToArray(_ref10, 2),
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
217
|
+
key = _ref11[0],
|
|
218
|
+
value = _ref11[1];
|
|
237
219
|
if (isValidSpacing(value)) {
|
|
238
220
|
classNames.push("spacing-".concat(key, "-").concat(String(value)));
|
|
239
221
|
}
|
|
240
222
|
});
|
|
241
223
|
return classNames;
|
|
242
224
|
}
|
|
243
|
-
|
|
244
225
|
return [];
|
|
245
226
|
};
|
|
246
227
|
export var generateDirectionClasses = function generateDirectionClasses(direction) {
|
|
247
228
|
if (direction === undefined) {
|
|
248
229
|
return [];
|
|
249
230
|
}
|
|
250
|
-
|
|
251
231
|
if (_typeof(direction) === 'object') {
|
|
252
232
|
return Object.entries(direction).map(function (_ref12) {
|
|
253
233
|
var _ref13 = _slicedToArray(_ref12, 2),
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
234
|
+
key = _ref13[0],
|
|
235
|
+
value = _ref13[1];
|
|
257
236
|
return "direction-".concat(key, "-").concat(value);
|
|
258
237
|
});
|
|
259
238
|
}
|
|
260
|
-
|
|
261
239
|
return ["direction-xs-".concat(String(direction))];
|
|
262
240
|
};
|