@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
|
@@ -6,7 +6,6 @@ import { ThemeContext as StyledEngineThemeContext } from '@mui/styled-engine';
|
|
|
6
6
|
import useTheme from '../useTheme';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
const EMPTY_THEME = {};
|
|
9
|
-
|
|
10
9
|
function InnerThemeProvider(props) {
|
|
11
10
|
const theme = useTheme();
|
|
12
11
|
return /*#__PURE__*/_jsx(StyledEngineThemeContext.Provider, {
|
|
@@ -14,18 +13,17 @@ function InnerThemeProvider(props) {
|
|
|
14
13
|
children: props.children
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
process.env.NODE_ENV !== "production" ? InnerThemeProvider.propTypes = {
|
|
19
17
|
/**
|
|
20
18
|
* Your component tree.
|
|
21
19
|
*/
|
|
22
20
|
children: PropTypes.node
|
|
23
21
|
} : void 0;
|
|
22
|
+
|
|
24
23
|
/**
|
|
25
24
|
* This component makes the `theme` available down the React tree.
|
|
26
25
|
* It should preferably be used at **the root of your component tree**.
|
|
27
26
|
*/
|
|
28
|
-
|
|
29
27
|
function ThemeProvider(props) {
|
|
30
28
|
const {
|
|
31
29
|
children,
|
|
@@ -38,28 +36,21 @@ function ThemeProvider(props) {
|
|
|
38
36
|
})
|
|
39
37
|
});
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
|
|
43
|
-
/* remove-proptypes */
|
|
44
|
-
= {
|
|
39
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes /* remove-proptypes */ = {
|
|
45
40
|
// ----------------------------- Warning --------------------------------
|
|
46
41
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
47
42
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
48
43
|
// ----------------------------------------------------------------------
|
|
49
|
-
|
|
50
44
|
/**
|
|
51
45
|
* Your component tree.
|
|
52
46
|
*/
|
|
53
47
|
children: PropTypes.node,
|
|
54
|
-
|
|
55
48
|
/**
|
|
56
49
|
* A theme object. You can provide a function to extend the outer theme.
|
|
57
50
|
*/
|
|
58
51
|
theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired
|
|
59
52
|
} : void 0;
|
|
60
|
-
|
|
61
53
|
if (process.env.NODE_ENV !== 'production') {
|
|
62
54
|
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) : void 0;
|
|
63
55
|
}
|
|
64
|
-
|
|
65
56
|
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
|
const 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.
|
|
@@ -12,14 +12,14 @@ import { extendSxProp } from '../styleFunctionSx';
|
|
|
12
12
|
import createTheme from '../createTheme';
|
|
13
13
|
import { generateGridStyles, generateGridSizeStyles, generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridDirectionStyles, generateGridOffsetStyles, generateSizeClassNames, generateSpacingClassNames, generateDirectionClasses } from './gridGenerator';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
const defaultTheme = createTheme();
|
|
15
|
+
const defaultTheme = createTheme();
|
|
16
16
|
|
|
17
|
+
// widening Theme to any so that the consumer can own the theme structure.
|
|
17
18
|
const defaultCreateStyledComponent = systemStyled('div', {
|
|
18
19
|
name: 'MuiGrid',
|
|
19
20
|
slot: 'Root',
|
|
20
21
|
overridesResolver: (props, styles) => styles.root
|
|
21
22
|
});
|
|
22
|
-
|
|
23
23
|
function useThemePropsDefault(props) {
|
|
24
24
|
return useThemePropsSystem({
|
|
25
25
|
props,
|
|
@@ -27,7 +27,6 @@ function useThemePropsDefault(props) {
|
|
|
27
27
|
defaultTheme
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
|
|
31
30
|
export default function createGrid(options = {}) {
|
|
32
31
|
const {
|
|
33
32
|
// This will allow adding custom styled fn (for example for custom sx style function)
|
|
@@ -37,7 +36,6 @@ export default function createGrid(options = {}) {
|
|
|
37
36
|
} = options;
|
|
38
37
|
const NestedContext = /*#__PURE__*/React.createContext(false);
|
|
39
38
|
const OverflowContext = /*#__PURE__*/React.createContext(undefined);
|
|
40
|
-
|
|
41
39
|
const useUtilityClasses = (ownerState, theme) => {
|
|
42
40
|
const {
|
|
43
41
|
container,
|
|
@@ -51,40 +49,33 @@ export default function createGrid(options = {}) {
|
|
|
51
49
|
};
|
|
52
50
|
return composeClasses(slots, slot => generateUtilityClass(componentName, slot), {});
|
|
53
51
|
};
|
|
54
|
-
|
|
55
52
|
const GridRoot = createStyledComponent(generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridSizeStyles, generateGridDirectionStyles, generateGridStyles, generateGridOffsetStyles);
|
|
56
53
|
const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
|
|
57
54
|
var _inProps$columns, _inProps$spacing, _ref, _inProps$rowSpacing, _ref2, _inProps$columnSpacin, _ref3, _disableEqualOverflow;
|
|
58
|
-
|
|
59
55
|
const theme = useTheme();
|
|
60
56
|
const themeProps = useThemeProps(inProps);
|
|
61
57
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
62
|
-
|
|
63
58
|
const nested = React.useContext(NestedContext);
|
|
64
59
|
const overflow = React.useContext(OverflowContext);
|
|
65
|
-
|
|
66
60
|
const {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
61
|
+
className,
|
|
62
|
+
columns: columnsProp = 12,
|
|
63
|
+
container = false,
|
|
64
|
+
component = 'div',
|
|
65
|
+
direction = 'row',
|
|
66
|
+
wrap = 'wrap',
|
|
67
|
+
spacing: spacingProp = 0,
|
|
68
|
+
rowSpacing: rowSpacingProp = spacingProp,
|
|
69
|
+
columnSpacing: columnSpacingProp = spacingProp,
|
|
70
|
+
disableEqualOverflow: themeDisableEqualOverflow
|
|
71
|
+
} = props,
|
|
72
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
73
|
+
// Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
|
|
81
74
|
let disableEqualOverflow = themeDisableEqualOverflow;
|
|
82
|
-
|
|
83
75
|
if (nested && themeDisableEqualOverflow !== undefined) {
|
|
84
76
|
disableEqualOverflow = inProps.disableEqualOverflow;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
}
|
|
78
|
+
// collect breakpoints related props because they can be customized from the theme.
|
|
88
79
|
const gridSize = {};
|
|
89
80
|
const gridOffset = {};
|
|
90
81
|
const other = {};
|
|
@@ -101,7 +92,6 @@ export default function createGrid(options = {}) {
|
|
|
101
92
|
const spacing = (_inProps$spacing = inProps.spacing) != null ? _inProps$spacing : nested ? undefined : spacingProp;
|
|
102
93
|
const rowSpacing = (_ref = (_inProps$rowSpacing = inProps.rowSpacing) != null ? _inProps$rowSpacing : inProps.spacing) != null ? _ref : nested ? undefined : rowSpacingProp;
|
|
103
94
|
const columnSpacing = (_ref2 = (_inProps$columnSpacin = inProps.columnSpacing) != null ? _inProps$columnSpacin : inProps.spacing) != null ? _ref2 : nested ? undefined : columnSpacingProp;
|
|
104
|
-
|
|
105
95
|
const ownerState = _extends({}, props, {
|
|
106
96
|
nested,
|
|
107
97
|
columns,
|
|
@@ -116,25 +106,21 @@ export default function createGrid(options = {}) {
|
|
|
116
106
|
disableEqualOverflow: (_ref3 = (_disableEqualOverflow = disableEqualOverflow) != null ? _disableEqualOverflow : overflow) != null ? _ref3 : false,
|
|
117
107
|
// use context value if exists.
|
|
118
108
|
parentDisableEqualOverflow: overflow // for nested grid
|
|
119
|
-
|
|
120
109
|
});
|
|
121
110
|
|
|
122
111
|
const classes = useUtilityClasses(ownerState, theme);
|
|
123
|
-
|
|
124
112
|
let result = /*#__PURE__*/_jsx(GridRoot, _extends({
|
|
125
113
|
ref: ref,
|
|
126
114
|
as: component,
|
|
127
115
|
ownerState: ownerState,
|
|
128
116
|
className: clsx(classes.root, className)
|
|
129
117
|
}, other));
|
|
130
|
-
|
|
131
118
|
if (!nested) {
|
|
132
119
|
result = /*#__PURE__*/_jsx(NestedContext.Provider, {
|
|
133
120
|
value: true,
|
|
134
121
|
children: result
|
|
135
122
|
});
|
|
136
123
|
}
|
|
137
|
-
|
|
138
124
|
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
|
|
139
125
|
// There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
|
|
140
126
|
// 1. It is the root grid with `disableEqualOverflow`.
|
|
@@ -144,12 +130,9 @@ export default function createGrid(options = {}) {
|
|
|
144
130
|
children: result
|
|
145
131
|
});
|
|
146
132
|
}
|
|
147
|
-
|
|
148
133
|
return result;
|
|
149
134
|
});
|
|
150
|
-
process.env.NODE_ENV !== "production" ? Grid.propTypes
|
|
151
|
-
/* remove-proptypes */
|
|
152
|
-
= {
|
|
135
|
+
process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
|
|
153
136
|
children: PropTypes.node,
|
|
154
137
|
className: PropTypes.string,
|
|
155
138
|
columns: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
|
@@ -6,9 +6,13 @@ const SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
|
6
6
|
const DIRECTIONS = ['column-reverse', 'column', 'row-reverse', 'row'];
|
|
7
7
|
const WRAPS = ['nowrap', 'wrap-reverse', 'wrap'];
|
|
8
8
|
const GRID_SIZES = ['auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
9
|
-
const gridClasses = generateUtilityClasses('MuiGrid', ['root', 'container', 'item',
|
|
10
|
-
|
|
11
|
-
...
|
|
12
|
-
|
|
9
|
+
const gridClasses = generateUtilityClasses('MuiGrid', ['root', 'container', 'item',
|
|
10
|
+
// spacings
|
|
11
|
+
...SPACINGS.map(spacing => `spacing-xs-${spacing}`),
|
|
12
|
+
// direction values
|
|
13
|
+
...DIRECTIONS.map(direction => `direction-xs-${direction}`),
|
|
14
|
+
// wrap values
|
|
15
|
+
...WRAPS.map(wrap => `wrap-xs-${wrap}`),
|
|
16
|
+
// grid sizes for all breakpoints
|
|
13
17
|
...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}`)]);
|
|
14
18
|
export default gridClasses;
|
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
export const
|
|
2
|
+
export const filterBreakpointKeys = (breakpointsKeys, responsiveKeys) => breakpointsKeys.filter(key => responsiveKeys.includes(key));
|
|
3
|
+
export const traverseBreakpoints = (breakpoints, responsive, iterator) => {
|
|
3
4
|
const smallestBreakpoint = breakpoints.keys[0]; // the keys is sorted from smallest to largest by `createBreakpoints`.
|
|
4
5
|
|
|
5
|
-
if (Array.isArray(
|
|
6
|
-
|
|
7
|
-
iterator((
|
|
6
|
+
if (Array.isArray(responsive)) {
|
|
7
|
+
responsive.forEach((breakpointValue, index) => {
|
|
8
|
+
iterator((responsiveStyles, style) => {
|
|
8
9
|
if (index <= breakpoints.keys.length - 1) {
|
|
9
10
|
if (index === 0) {
|
|
10
|
-
Object.assign(
|
|
11
|
+
Object.assign(responsiveStyles, style);
|
|
11
12
|
} else {
|
|
12
|
-
|
|
13
|
+
responsiveStyles[breakpoints.up(breakpoints.keys[index])] = style;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
}, breakpointValue);
|
|
16
17
|
});
|
|
17
|
-
} else if (
|
|
18
|
+
} else if (responsive && typeof responsive === 'object') {
|
|
18
19
|
// prevent null
|
|
19
|
-
//
|
|
20
|
-
|
|
20
|
+
// responsive could be a very big object, pick the smallest responsive values
|
|
21
|
+
|
|
22
|
+
const keys = Object.keys(responsive).length > breakpoints.keys.length ? breakpoints.keys : filterBreakpointKeys(breakpoints.keys, Object.keys(responsive));
|
|
21
23
|
keys.forEach(key => {
|
|
22
24
|
if (breakpoints.keys.indexOf(key) !== -1) {
|
|
23
|
-
// @ts-ignore already checked that
|
|
24
|
-
const breakpointValue =
|
|
25
|
-
|
|
25
|
+
// @ts-ignore already checked that responsive is an object
|
|
26
|
+
const breakpointValue = responsive[key];
|
|
26
27
|
if (breakpointValue !== undefined) {
|
|
27
|
-
iterator((
|
|
28
|
+
iterator((responsiveStyles, style) => {
|
|
28
29
|
if (smallestBreakpoint === key) {
|
|
29
|
-
Object.assign(
|
|
30
|
+
Object.assign(responsiveStyles, style);
|
|
30
31
|
} else {
|
|
31
|
-
|
|
32
|
+
responsiveStyles[breakpoints.up(key)] = style;
|
|
32
33
|
}
|
|
33
34
|
}, breakpointValue);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
|
-
} else if (typeof
|
|
38
|
-
iterator((
|
|
39
|
-
Object.assign(
|
|
40
|
-
},
|
|
38
|
+
} else if (typeof responsive === 'number' || typeof responsive === 'string') {
|
|
39
|
+
iterator((responsiveStyles, style) => {
|
|
40
|
+
Object.assign(responsiveStyles, style);
|
|
41
|
+
}, responsive);
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
44
|
export const generateGridSizeStyles = ({
|
|
@@ -47,7 +48,6 @@ export const generateGridSizeStyles = ({
|
|
|
47
48
|
const styles = {};
|
|
48
49
|
traverseBreakpoints(theme.breakpoints, ownerState.gridSize, (appendStyle, value) => {
|
|
49
50
|
let style = {};
|
|
50
|
-
|
|
51
51
|
if (value === true) {
|
|
52
52
|
style = {
|
|
53
53
|
flexBasis: 0,
|
|
@@ -55,7 +55,6 @@ export const generateGridSizeStyles = ({
|
|
|
55
55
|
maxWidth: '100%'
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
|
|
59
58
|
if (value === 'auto') {
|
|
60
59
|
style = {
|
|
61
60
|
flexBasis: 'auto',
|
|
@@ -65,7 +64,6 @@ export const generateGridSizeStyles = ({
|
|
|
65
64
|
width: 'auto'
|
|
66
65
|
};
|
|
67
66
|
}
|
|
68
|
-
|
|
69
67
|
if (typeof value === 'number') {
|
|
70
68
|
style = {
|
|
71
69
|
flexGrow: 0,
|
|
@@ -73,7 +71,6 @@ export const generateGridSizeStyles = ({
|
|
|
73
71
|
width: `calc(100% * ${value} / var(--Grid-columns)${ownerState.nested && ownerState.container ? ` + var(--Grid-columnSpacing)` : ''})`
|
|
74
72
|
};
|
|
75
73
|
}
|
|
76
|
-
|
|
77
74
|
appendStyle(styles, style);
|
|
78
75
|
});
|
|
79
76
|
return styles;
|
|
@@ -85,19 +82,16 @@ export const generateGridOffsetStyles = ({
|
|
|
85
82
|
const styles = {};
|
|
86
83
|
traverseBreakpoints(theme.breakpoints, ownerState.gridOffset, (appendStyle, value) => {
|
|
87
84
|
let style = {};
|
|
88
|
-
|
|
89
85
|
if (value === 'auto') {
|
|
90
86
|
style = {
|
|
91
87
|
marginLeft: 'auto'
|
|
92
88
|
};
|
|
93
89
|
}
|
|
94
|
-
|
|
95
90
|
if (typeof value === 'number') {
|
|
96
91
|
style = {
|
|
97
92
|
marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / var(--Grid-columns))`
|
|
98
93
|
};
|
|
99
94
|
}
|
|
100
|
-
|
|
101
95
|
appendStyle(styles, style);
|
|
102
96
|
});
|
|
103
97
|
return styles;
|
|
@@ -109,7 +103,6 @@ export const generateGridColumnsStyles = ({
|
|
|
109
103
|
if (!ownerState.container) {
|
|
110
104
|
return {};
|
|
111
105
|
}
|
|
112
|
-
|
|
113
106
|
const styles = {
|
|
114
107
|
'--Grid-columns': 12
|
|
115
108
|
};
|
|
@@ -127,11 +120,9 @@ export const generateGridRowSpacingStyles = ({
|
|
|
127
120
|
if (!ownerState.container) {
|
|
128
121
|
return {};
|
|
129
122
|
}
|
|
130
|
-
|
|
131
123
|
const styles = {};
|
|
132
124
|
traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, (appendStyle, value) => {
|
|
133
125
|
var _theme$spacing;
|
|
134
|
-
|
|
135
126
|
appendStyle(styles, {
|
|
136
127
|
'--Grid-rowSpacing': typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)
|
|
137
128
|
});
|
|
@@ -145,11 +136,9 @@ export const generateGridColumnSpacingStyles = ({
|
|
|
145
136
|
if (!ownerState.container) {
|
|
146
137
|
return {};
|
|
147
138
|
}
|
|
148
|
-
|
|
149
139
|
const styles = {};
|
|
150
140
|
traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, (appendStyle, value) => {
|
|
151
141
|
var _theme$spacing2;
|
|
152
|
-
|
|
153
142
|
appendStyle(styles, {
|
|
154
143
|
'--Grid-columnSpacing': typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)
|
|
155
144
|
});
|
|
@@ -163,7 +152,6 @@ export const generateGridDirectionStyles = ({
|
|
|
163
152
|
if (!ownerState.container) {
|
|
164
153
|
return {};
|
|
165
154
|
}
|
|
166
|
-
|
|
167
155
|
const styles = {};
|
|
168
156
|
traverseBreakpoints(theme.breakpoints, ownerState.direction, (appendStyle, value) => {
|
|
169
157
|
appendStyle(styles, {
|
|
@@ -214,14 +202,11 @@ export const generateSpacingClassNames = (spacing, smallestBreakpoint = 'xs') =>
|
|
|
214
202
|
if (val === undefined) {
|
|
215
203
|
return false;
|
|
216
204
|
}
|
|
217
|
-
|
|
218
205
|
return typeof val === 'string' && !Number.isNaN(Number(val)) || typeof val === 'number' && val > 0;
|
|
219
206
|
}
|
|
220
|
-
|
|
221
207
|
if (isValidSpacing(spacing)) {
|
|
222
208
|
return [`spacing-${smallestBreakpoint}-${String(spacing)}`];
|
|
223
209
|
}
|
|
224
|
-
|
|
225
210
|
if (typeof spacing === 'object' && !Array.isArray(spacing)) {
|
|
226
211
|
const classNames = [];
|
|
227
212
|
Object.entries(spacing).forEach(([key, value]) => {
|
|
@@ -231,17 +216,14 @@ export const generateSpacingClassNames = (spacing, smallestBreakpoint = 'xs') =>
|
|
|
231
216
|
});
|
|
232
217
|
return classNames;
|
|
233
218
|
}
|
|
234
|
-
|
|
235
219
|
return [];
|
|
236
220
|
};
|
|
237
221
|
export const generateDirectionClasses = direction => {
|
|
238
222
|
if (direction === undefined) {
|
|
239
223
|
return [];
|
|
240
224
|
}
|
|
241
|
-
|
|
242
225
|
if (typeof direction === 'object') {
|
|
243
226
|
return Object.entries(direction).map(([key, value]) => `direction-${key}-${value}`);
|
|
244
227
|
}
|
|
245
|
-
|
|
246
228
|
return [`direction-xs-${String(direction)}`];
|
|
247
229
|
};
|
package/esm/borders.js
CHANGED
|
@@ -3,15 +3,12 @@ import style from './style';
|
|
|
3
3
|
import compose from './compose';
|
|
4
4
|
import { createUnaryUnit, getValue } from './spacing';
|
|
5
5
|
import { handleBreakpoints } from './breakpoints';
|
|
6
|
-
|
|
7
6
|
function getBorder(value) {
|
|
8
7
|
if (typeof value !== 'number') {
|
|
9
8
|
return value;
|
|
10
9
|
}
|
|
11
|
-
|
|
12
10
|
return `${value}px solid`;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
export const border = style({
|
|
16
13
|
prop: 'border',
|
|
17
14
|
themeKey: 'borders',
|
|
@@ -60,14 +57,11 @@ export const borderLeftColor = style({
|
|
|
60
57
|
export const borderRadius = props => {
|
|
61
58
|
if (props.borderRadius !== undefined && props.borderRadius !== null) {
|
|
62
59
|
const transformer = createUnaryUnit(props.theme, 'shape.borderRadius', 4, 'borderRadius');
|
|
63
|
-
|
|
64
60
|
const styleFromPropValue = propValue => ({
|
|
65
61
|
borderRadius: getValue(transformer, propValue)
|
|
66
62
|
});
|
|
67
|
-
|
|
68
63
|
return handleBreakpoints(props, props.borderRadius, styleFromPropValue);
|
|
69
64
|
}
|
|
70
|
-
|
|
71
65
|
return null;
|
|
72
66
|
};
|
|
73
67
|
borderRadius.propTypes = process.env.NODE_ENV !== 'production' ? {
|