@mui/system 5.12.1 → 5.13.1
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 +312 -0
- package/Container/Container.d.ts +13 -13
- package/Container/ContainerProps.d.ts +40 -40
- package/Container/containerClasses.d.ts +22 -22
- package/Container/createContainer.d.ts +18 -18
- package/Container/createContainer.js +41 -35
- package/GlobalStyles/GlobalStyles.d.ts +13 -13
- package/GlobalStyles/index.d.ts +2 -2
- package/Stack/Stack.d.ts +14 -14
- package/Stack/Stack.js +1 -1
- package/Stack/StackProps.d.ts +53 -53
- package/Stack/createStack.d.ts +21 -21
- package/Stack/createStack.js +24 -26
- package/Stack/index.d.ts +5 -5
- package/Stack/stackClasses.d.ts +8 -8
- package/ThemeProvider/ThemeProvider.js +9 -5
- package/Unstable_Grid/Grid.d.ts +12 -12
- package/Unstable_Grid/GridProps.d.ts +185 -185
- package/Unstable_Grid/createGrid.d.ts +11 -11
- package/Unstable_Grid/createGrid.js +21 -23
- package/Unstable_Grid/gridClasses.d.ts +20 -20
- package/Unstable_Grid/gridGenerator.d.ts +38 -38
- package/Unstable_Grid/gridGenerator.js +20 -18
- package/Unstable_Grid/index.d.ts +5 -5
- package/breakpoints.js +7 -6
- package/colorManipulator.js +2 -0
- package/createBox.js +9 -12
- package/createStyled.js +40 -31
- package/createTheme/createBreakpoints.js +24 -26
- package/createTheme/createSpacing.d.ts +10 -10
- package/createTheme/createSpacing.js +3 -1
- package/createTheme/createTheme.js +18 -14
- package/cssVars/createCssVarsProvider.js +21 -20
- package/cssVars/createCssVarsTheme.d.ts +15 -15
- package/cssVars/createCssVarsTheme.js +10 -10
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/cssVarsParser.d.ts +64 -64
- package/cssVars/getInitColorSchemeScript.d.ts +42 -42
- package/cssVars/index.d.ts +5 -5
- package/cssVars/prepareCssVars.d.ts +16 -16
- package/cssVars/prepareCssVars.js +13 -12
- package/cssVars/useCurrentColorScheme.d.ts +53 -53
- package/cssVars/useCurrentColorScheme.js +17 -11
- package/esm/Container/createContainer.js +41 -35
- package/esm/Stack/Stack.js +1 -1
- package/esm/Stack/createStack.js +24 -26
- package/esm/ThemeProvider/ThemeProvider.js +9 -5
- package/esm/Unstable_Grid/createGrid.js +21 -23
- package/esm/Unstable_Grid/gridGenerator.js +20 -17
- package/esm/breakpoints.js +7 -6
- package/esm/colorManipulator.js +1 -0
- package/esm/createBox.js +9 -12
- package/esm/createStyled.js +38 -31
- package/esm/createTheme/createBreakpoints.js +24 -25
- package/esm/createTheme/createSpacing.js +4 -0
- package/esm/createTheme/createTheme.js +18 -14
- package/esm/cssVars/createCssVarsProvider.js +21 -20
- package/esm/cssVars/createCssVarsTheme.js +10 -10
- package/esm/cssVars/prepareCssVars.js +13 -12
- package/esm/cssVars/useCurrentColorScheme.js +17 -10
- package/esm/propsToClassKey.js +3 -5
- package/esm/styleFunctionSx/extendSxProp.js +14 -10
- package/index.js +5 -2
- package/legacy/Container/createContainer.js +7 -6
- package/legacy/Stack/Stack.js +1 -1
- package/legacy/Stack/createStack.js +6 -5
- package/legacy/ThemeProvider/ThemeProvider.js +4 -3
- package/legacy/Unstable_Grid/createGrid.js +6 -4
- package/legacy/Unstable_Grid/gridGenerator.js +6 -4
- package/legacy/breakpoints.js +5 -3
- package/legacy/colorManipulator.js +1 -0
- package/legacy/createBox.js +4 -2
- package/legacy/createStyled.js +13 -11
- package/legacy/createTheme/createBreakpoints.js +4 -3
- package/legacy/createTheme/createSpacing.js +4 -0
- package/legacy/createTheme/createTheme.js +6 -4
- package/legacy/cssVars/createCssVarsProvider.js +6 -5
- package/legacy/cssVars/createCssVarsTheme.js +4 -2
- package/legacy/cssVars/prepareCssVars.js +5 -3
- package/legacy/cssVars/useCurrentColorScheme.js +9 -7
- package/legacy/index.js +1 -1
- package/legacy/styleFunctionSx/extendSxProp.js +6 -4
- package/modern/Container/createContainer.js +41 -35
- package/modern/Stack/Stack.js +1 -1
- package/modern/Stack/createStack.js +24 -26
- package/modern/ThemeProvider/ThemeProvider.js +9 -5
- package/modern/Unstable_Grid/createGrid.js +21 -23
- package/modern/Unstable_Grid/gridGenerator.js +20 -17
- package/modern/breakpoints.js +7 -6
- package/modern/colorManipulator.js +1 -0
- package/modern/createBox.js +9 -12
- package/modern/createStyled.js +38 -31
- package/modern/createTheme/createBreakpoints.js +24 -25
- package/modern/createTheme/createSpacing.js +4 -0
- package/modern/createTheme/createTheme.js +18 -14
- package/modern/cssVars/createCssVarsProvider.js +21 -20
- package/modern/cssVars/createCssVarsTheme.js +10 -10
- package/modern/cssVars/prepareCssVars.js +13 -12
- package/modern/cssVars/useCurrentColorScheme.js +17 -10
- package/modern/index.js +1 -1
- package/modern/propsToClassKey.js +3 -5
- package/modern/styleFunctionSx/extendSxProp.js +14 -10
- package/package.json +4 -4
- package/propsToClassKey.js +3 -6
- package/styleFunctionSx/extendSxProp.js +14 -10
|
@@ -1,185 +1,185 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { OverrideProps, IfEquals } from '@mui/types';
|
|
3
|
-
import { SxProps } from '../styleFunctionSx';
|
|
4
|
-
import { Theme, Breakpoint, BreakpointOverrides } from '../createTheme';
|
|
5
|
-
import { SystemProps } from '../Box';
|
|
6
|
-
type ResponsiveStyleValue<T> = T | Array<T | null> | {
|
|
7
|
-
[key in Breakpoint]?: T | null;
|
|
8
|
-
};
|
|
9
|
-
export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
10
|
-
export type GridSpacing = number | string;
|
|
11
|
-
export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
12
|
-
export type GridSize = 'auto' | number;
|
|
13
|
-
export interface GridDefaultBreakpoints {
|
|
14
|
-
/**
|
|
15
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
16
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
17
|
-
* If 'auto', the grid item's width matches its content.
|
|
18
|
-
* If false, the prop is ignored.
|
|
19
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
20
|
-
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
21
|
-
* @default false
|
|
22
|
-
*/
|
|
23
|
-
lg?: boolean | GridSize;
|
|
24
|
-
/**
|
|
25
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
26
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
27
|
-
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
28
|
-
*/
|
|
29
|
-
lgOffset?: GridSize;
|
|
30
|
-
/**
|
|
31
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
32
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
33
|
-
* If 'auto', the grid item's width matches its content.
|
|
34
|
-
* If false, the prop is ignored.
|
|
35
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
36
|
-
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
md?: boolean | GridSize;
|
|
40
|
-
/**
|
|
41
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
42
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
43
|
-
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
44
|
-
*/
|
|
45
|
-
mdOffset?: GridSize;
|
|
46
|
-
/**
|
|
47
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
48
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
49
|
-
* If 'auto', the grid item's width matches its content.
|
|
50
|
-
* If false, the prop is ignored.
|
|
51
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
52
|
-
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
53
|
-
* @default false
|
|
54
|
-
*/
|
|
55
|
-
sm?: boolean | GridSize;
|
|
56
|
-
/**
|
|
57
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
58
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
59
|
-
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
60
|
-
*/
|
|
61
|
-
smOffset?: GridSize;
|
|
62
|
-
/**
|
|
63
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
64
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
65
|
-
* If 'auto', the grid item's width matches its content.
|
|
66
|
-
* If false, the prop is ignored.
|
|
67
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
68
|
-
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
69
|
-
* @default false
|
|
70
|
-
*/
|
|
71
|
-
xl?: boolean | GridSize;
|
|
72
|
-
/**
|
|
73
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
74
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
75
|
-
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
76
|
-
*/
|
|
77
|
-
xlOffset?: GridSize;
|
|
78
|
-
/**
|
|
79
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
80
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
81
|
-
* If 'auto', the grid item's width matches its content.
|
|
82
|
-
* If false, the prop is ignored.
|
|
83
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
84
|
-
* The value is applied for all the screen sizes with the lowest priority.
|
|
85
|
-
* @default false
|
|
86
|
-
*/
|
|
87
|
-
xs?: boolean | GridSize;
|
|
88
|
-
/**
|
|
89
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
90
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
91
|
-
* The value is applied for the `xs` breakpoint and wider screens if not overridden.
|
|
92
|
-
*/
|
|
93
|
-
xsOffset?: GridSize;
|
|
94
|
-
}
|
|
95
|
-
type CustomBreakpoints = Partial<Record<Breakpoint, boolean | GridSize> & Record<`${Breakpoint}Offset`, GridSize>>;
|
|
96
|
-
interface BreakpointOverridesEmpty {
|
|
97
|
-
}
|
|
98
|
-
type Breakpoints = IfEquals<BreakpointOverrides, BreakpointOverridesEmpty, GridDefaultBreakpoints, CustomBreakpoints>;
|
|
99
|
-
export interface GridBaseProps extends Breakpoints {
|
|
100
|
-
/**
|
|
101
|
-
* The content of the component.
|
|
102
|
-
*/
|
|
103
|
-
children?: React.ReactNode;
|
|
104
|
-
/**
|
|
105
|
-
* The number of columns.
|
|
106
|
-
* @default 12
|
|
107
|
-
*/
|
|
108
|
-
columns?: ResponsiveStyleValue<number>;
|
|
109
|
-
/**
|
|
110
|
-
* Defines the horizontal space between the type `item` components.
|
|
111
|
-
* It overrides the value of the `spacing` prop.
|
|
112
|
-
*/
|
|
113
|
-
columnSpacing?: ResponsiveStyleValue<GridSpacing>;
|
|
114
|
-
/**
|
|
115
|
-
* If `true`, the component will have the flex *container* behavior.
|
|
116
|
-
* You should be wrapping *items* with a *container*.
|
|
117
|
-
* @default false
|
|
118
|
-
*/
|
|
119
|
-
container?: boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Defines the `flex-direction` style property.
|
|
122
|
-
* It is applied for all screen sizes.
|
|
123
|
-
* @default 'row'
|
|
124
|
-
*/
|
|
125
|
-
direction?: ResponsiveStyleValue<GridDirection>;
|
|
126
|
-
/**
|
|
127
|
-
* If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
|
|
128
|
-
*/
|
|
129
|
-
disableEqualOverflow?: boolean;
|
|
130
|
-
/**
|
|
131
|
-
* @internal
|
|
132
|
-
* The level of the grid starts from `0`
|
|
133
|
-
* and increases when the grid nests inside another grid regardless of container or item.
|
|
134
|
-
*
|
|
135
|
-
* ```js
|
|
136
|
-
* <Grid> // level 0
|
|
137
|
-
* <Grid> // level 1
|
|
138
|
-
* <Grid> // level 2
|
|
139
|
-
* <Grid> // level 1
|
|
140
|
-
* ```
|
|
141
|
-
*
|
|
142
|
-
* Only consecutive grid is considered nesting.
|
|
143
|
-
* A grid container will start at `0` if there are non-Grid element above it.
|
|
144
|
-
*
|
|
145
|
-
* ```js
|
|
146
|
-
* <Grid> // level 0
|
|
147
|
-
* <div>
|
|
148
|
-
* <Grid> // level 0
|
|
149
|
-
* <Grid> // level 1
|
|
150
|
-
* ```
|
|
151
|
-
*/
|
|
152
|
-
unstable_level?: number;
|
|
153
|
-
/**
|
|
154
|
-
* Defines the vertical space between the type `item` components.
|
|
155
|
-
* It overrides the value of the `spacing` prop.
|
|
156
|
-
*/
|
|
157
|
-
rowSpacing?: ResponsiveStyleValue<GridSpacing>;
|
|
158
|
-
/**
|
|
159
|
-
* Defines the space between the type `item` components.
|
|
160
|
-
* It can only be used on a type `container` component.
|
|
161
|
-
* @default 0
|
|
162
|
-
*/
|
|
163
|
-
spacing?: ResponsiveStyleValue<GridSpacing> | undefined;
|
|
164
|
-
/**
|
|
165
|
-
* Defines the `flex-wrap` style property.
|
|
166
|
-
* It's applied for all screen sizes.
|
|
167
|
-
* @default 'wrap'
|
|
168
|
-
*/
|
|
169
|
-
wrap?: GridWrap;
|
|
170
|
-
}
|
|
171
|
-
export interface GridOwnerState extends GridBaseProps {
|
|
172
|
-
unstable_level: number;
|
|
173
|
-
gridSize: Partial<Record<Breakpoint, GridSize | boolean>>;
|
|
174
|
-
gridOffset: Partial<Record<Breakpoint, GridSize>>;
|
|
175
|
-
}
|
|
176
|
-
export interface GridTypeMap<P = {}, D extends React.ElementType = 'div'> {
|
|
177
|
-
props: P & GridBaseProps & {
|
|
178
|
-
sx?: SxProps<Theme>;
|
|
179
|
-
} & SystemProps<Theme>;
|
|
180
|
-
defaultComponent: D;
|
|
181
|
-
}
|
|
182
|
-
export type GridProps<D extends React.ElementType = GridTypeMap['defaultComponent'], P = {
|
|
183
|
-
component?: React.ElementType;
|
|
184
|
-
}> = OverrideProps<GridTypeMap<P, D>, D>;
|
|
185
|
-
export {};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { OverrideProps, IfEquals } from '@mui/types';
|
|
3
|
+
import { SxProps } from '../styleFunctionSx';
|
|
4
|
+
import { Theme, Breakpoint, BreakpointOverrides } from '../createTheme';
|
|
5
|
+
import { SystemProps } from '../Box';
|
|
6
|
+
type ResponsiveStyleValue<T> = T | Array<T | null> | {
|
|
7
|
+
[key in Breakpoint]?: T | null;
|
|
8
|
+
};
|
|
9
|
+
export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
10
|
+
export type GridSpacing = number | string;
|
|
11
|
+
export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
12
|
+
export type GridSize = 'auto' | number;
|
|
13
|
+
export interface GridDefaultBreakpoints {
|
|
14
|
+
/**
|
|
15
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
16
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
17
|
+
* If 'auto', the grid item's width matches its content.
|
|
18
|
+
* If false, the prop is ignored.
|
|
19
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
20
|
+
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
lg?: boolean | GridSize;
|
|
24
|
+
/**
|
|
25
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
26
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
27
|
+
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
28
|
+
*/
|
|
29
|
+
lgOffset?: GridSize;
|
|
30
|
+
/**
|
|
31
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
32
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
33
|
+
* If 'auto', the grid item's width matches its content.
|
|
34
|
+
* If false, the prop is ignored.
|
|
35
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
36
|
+
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
md?: boolean | GridSize;
|
|
40
|
+
/**
|
|
41
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
42
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
43
|
+
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
44
|
+
*/
|
|
45
|
+
mdOffset?: GridSize;
|
|
46
|
+
/**
|
|
47
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
48
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
49
|
+
* If 'auto', the grid item's width matches its content.
|
|
50
|
+
* If false, the prop is ignored.
|
|
51
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
52
|
+
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
sm?: boolean | GridSize;
|
|
56
|
+
/**
|
|
57
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
58
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
59
|
+
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
60
|
+
*/
|
|
61
|
+
smOffset?: GridSize;
|
|
62
|
+
/**
|
|
63
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
64
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
65
|
+
* If 'auto', the grid item's width matches its content.
|
|
66
|
+
* If false, the prop is ignored.
|
|
67
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
68
|
+
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
xl?: boolean | GridSize;
|
|
72
|
+
/**
|
|
73
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
74
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
75
|
+
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
76
|
+
*/
|
|
77
|
+
xlOffset?: GridSize;
|
|
78
|
+
/**
|
|
79
|
+
* If a number, it sets the number of columns the grid item uses.
|
|
80
|
+
* It can't be greater than the total number of columns of the container (12 by default).
|
|
81
|
+
* If 'auto', the grid item's width matches its content.
|
|
82
|
+
* If false, the prop is ignored.
|
|
83
|
+
* If true, the grid item's width grows to use the space available in the grid container.
|
|
84
|
+
* The value is applied for all the screen sizes with the lowest priority.
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
xs?: boolean | GridSize;
|
|
88
|
+
/**
|
|
89
|
+
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
90
|
+
* If 'auto', the grid item push itself to the right-end of the container.
|
|
91
|
+
* The value is applied for the `xs` breakpoint and wider screens if not overridden.
|
|
92
|
+
*/
|
|
93
|
+
xsOffset?: GridSize;
|
|
94
|
+
}
|
|
95
|
+
type CustomBreakpoints = Partial<Record<Breakpoint, boolean | GridSize> & Record<`${Breakpoint}Offset`, GridSize>>;
|
|
96
|
+
interface BreakpointOverridesEmpty {
|
|
97
|
+
}
|
|
98
|
+
type Breakpoints = IfEquals<BreakpointOverrides, BreakpointOverridesEmpty, GridDefaultBreakpoints, CustomBreakpoints>;
|
|
99
|
+
export interface GridBaseProps extends Breakpoints {
|
|
100
|
+
/**
|
|
101
|
+
* The content of the component.
|
|
102
|
+
*/
|
|
103
|
+
children?: React.ReactNode;
|
|
104
|
+
/**
|
|
105
|
+
* The number of columns.
|
|
106
|
+
* @default 12
|
|
107
|
+
*/
|
|
108
|
+
columns?: ResponsiveStyleValue<number>;
|
|
109
|
+
/**
|
|
110
|
+
* Defines the horizontal space between the type `item` components.
|
|
111
|
+
* It overrides the value of the `spacing` prop.
|
|
112
|
+
*/
|
|
113
|
+
columnSpacing?: ResponsiveStyleValue<GridSpacing>;
|
|
114
|
+
/**
|
|
115
|
+
* If `true`, the component will have the flex *container* behavior.
|
|
116
|
+
* You should be wrapping *items* with a *container*.
|
|
117
|
+
* @default false
|
|
118
|
+
*/
|
|
119
|
+
container?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Defines the `flex-direction` style property.
|
|
122
|
+
* It is applied for all screen sizes.
|
|
123
|
+
* @default 'row'
|
|
124
|
+
*/
|
|
125
|
+
direction?: ResponsiveStyleValue<GridDirection>;
|
|
126
|
+
/**
|
|
127
|
+
* If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
|
|
128
|
+
*/
|
|
129
|
+
disableEqualOverflow?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* @internal
|
|
132
|
+
* The level of the grid starts from `0`
|
|
133
|
+
* and increases when the grid nests inside another grid regardless of container or item.
|
|
134
|
+
*
|
|
135
|
+
* ```js
|
|
136
|
+
* <Grid> // level 0
|
|
137
|
+
* <Grid> // level 1
|
|
138
|
+
* <Grid> // level 2
|
|
139
|
+
* <Grid> // level 1
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* Only consecutive grid is considered nesting.
|
|
143
|
+
* A grid container will start at `0` if there are non-Grid element above it.
|
|
144
|
+
*
|
|
145
|
+
* ```js
|
|
146
|
+
* <Grid> // level 0
|
|
147
|
+
* <div>
|
|
148
|
+
* <Grid> // level 0
|
|
149
|
+
* <Grid> // level 1
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
unstable_level?: number;
|
|
153
|
+
/**
|
|
154
|
+
* Defines the vertical space between the type `item` components.
|
|
155
|
+
* It overrides the value of the `spacing` prop.
|
|
156
|
+
*/
|
|
157
|
+
rowSpacing?: ResponsiveStyleValue<GridSpacing>;
|
|
158
|
+
/**
|
|
159
|
+
* Defines the space between the type `item` components.
|
|
160
|
+
* It can only be used on a type `container` component.
|
|
161
|
+
* @default 0
|
|
162
|
+
*/
|
|
163
|
+
spacing?: ResponsiveStyleValue<GridSpacing> | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Defines the `flex-wrap` style property.
|
|
166
|
+
* It's applied for all screen sizes.
|
|
167
|
+
* @default 'wrap'
|
|
168
|
+
*/
|
|
169
|
+
wrap?: GridWrap;
|
|
170
|
+
}
|
|
171
|
+
export interface GridOwnerState extends GridBaseProps {
|
|
172
|
+
unstable_level: number;
|
|
173
|
+
gridSize: Partial<Record<Breakpoint, GridSize | boolean>>;
|
|
174
|
+
gridOffset: Partial<Record<Breakpoint, GridSize>>;
|
|
175
|
+
}
|
|
176
|
+
export interface GridTypeMap<P = {}, D extends React.ElementType = 'div'> {
|
|
177
|
+
props: P & GridBaseProps & {
|
|
178
|
+
sx?: SxProps<Theme>;
|
|
179
|
+
} & SystemProps<Theme>;
|
|
180
|
+
defaultComponent: D;
|
|
181
|
+
}
|
|
182
|
+
export type GridProps<D extends React.ElementType = GridTypeMap['defaultComponent'], P = {
|
|
183
|
+
component?: React.ElementType;
|
|
184
|
+
}> = OverrideProps<GridTypeMap<P, D>, D>;
|
|
185
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { OverridableComponent } from '@mui/types';
|
|
3
|
-
import { GridTypeMap } from './GridProps';
|
|
4
|
-
declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
|
|
5
|
-
declare function useThemePropsDefault<T extends {}>(props: T): T & {};
|
|
6
|
-
export default function createGrid(options?: {
|
|
7
|
-
createStyledComponent?: typeof defaultCreateStyledComponent;
|
|
8
|
-
useThemeProps?: typeof useThemePropsDefault;
|
|
9
|
-
componentName?: string;
|
|
10
|
-
}): OverridableComponent<GridTypeMap<{}, "div">>;
|
|
11
|
-
export {};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { OverridableComponent } from '@mui/types';
|
|
3
|
+
import { GridTypeMap } from './GridProps';
|
|
4
|
+
declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
|
|
5
|
+
declare function useThemePropsDefault<T extends {}>(props: T): T & {};
|
|
6
|
+
export default function createGrid(options?: {
|
|
7
|
+
createStyledComponent?: typeof defaultCreateStyledComponent;
|
|
8
|
+
useThemeProps?: typeof useThemePropsDefault;
|
|
9
|
+
componentName?: string;
|
|
10
|
+
}): OverridableComponent<GridTypeMap<{}, "div">>;
|
|
11
|
+
export {};
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = createGrid;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
10
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
@@ -18,7 +16,6 @@ var _styleFunctionSx = require("../styleFunctionSx");
|
|
|
18
16
|
var _createTheme = _interopRequireDefault(require("../createTheme"));
|
|
19
17
|
var _gridGenerator = require("./gridGenerator");
|
|
20
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
const _excluded = ["className", "children", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow", "unstable_level"];
|
|
22
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
21
|
const defaultTheme = (0, _createTheme.default)();
|
|
@@ -65,20 +62,20 @@ function createGrid(options = {}) {
|
|
|
65
62
|
const props = (0, _styleFunctionSx.extendSxProp)(themeProps); // `color` type conflicts with html color attribute.
|
|
66
63
|
const overflow = React.useContext(OverflowContext);
|
|
67
64
|
const {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
65
|
+
className,
|
|
66
|
+
children,
|
|
67
|
+
columns: columnsProp = 12,
|
|
68
|
+
container = false,
|
|
69
|
+
component = 'div',
|
|
70
|
+
direction = 'row',
|
|
71
|
+
wrap = 'wrap',
|
|
72
|
+
spacing: spacingProp = 0,
|
|
73
|
+
rowSpacing: rowSpacingProp = spacingProp,
|
|
74
|
+
columnSpacing: columnSpacingProp = spacingProp,
|
|
75
|
+
disableEqualOverflow: themeDisableEqualOverflow,
|
|
76
|
+
unstable_level: level = 0,
|
|
77
|
+
...rest
|
|
78
|
+
} = props;
|
|
82
79
|
// Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
|
|
83
80
|
let disableEqualOverflow = themeDisableEqualOverflow;
|
|
84
81
|
if (level && themeDisableEqualOverflow !== undefined) {
|
|
@@ -101,7 +98,8 @@ function createGrid(options = {}) {
|
|
|
101
98
|
const spacing = (_inProps$spacing = inProps.spacing) != null ? _inProps$spacing : level ? undefined : spacingProp;
|
|
102
99
|
const rowSpacing = (_ref = (_inProps$rowSpacing = inProps.rowSpacing) != null ? _inProps$rowSpacing : inProps.spacing) != null ? _ref : level ? undefined : rowSpacingProp;
|
|
103
100
|
const columnSpacing = (_ref2 = (_inProps$columnSpacin = inProps.columnSpacing) != null ? _inProps$columnSpacin : inProps.spacing) != null ? _ref2 : level ? undefined : columnSpacingProp;
|
|
104
|
-
const ownerState =
|
|
101
|
+
const ownerState = {
|
|
102
|
+
...props,
|
|
105
103
|
level,
|
|
106
104
|
columns,
|
|
107
105
|
container,
|
|
@@ -115,15 +113,15 @@ function createGrid(options = {}) {
|
|
|
115
113
|
disableEqualOverflow: (_ref3 = (_disableEqualOverflow = disableEqualOverflow) != null ? _disableEqualOverflow : overflow) != null ? _ref3 : false,
|
|
116
114
|
// use context value if exists.
|
|
117
115
|
parentDisableEqualOverflow: overflow // for nested grid
|
|
118
|
-
}
|
|
116
|
+
};
|
|
119
117
|
|
|
120
118
|
const classes = useUtilityClasses(ownerState, theme);
|
|
121
|
-
let result = /*#__PURE__*/(0, _jsxRuntime.jsx)(GridRoot,
|
|
119
|
+
let result = /*#__PURE__*/(0, _jsxRuntime.jsx)(GridRoot, {
|
|
122
120
|
ref: ref,
|
|
123
121
|
as: component,
|
|
124
122
|
ownerState: ownerState,
|
|
125
|
-
className: (0, _clsx.default)(classes.root, className)
|
|
126
|
-
|
|
123
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
124
|
+
...other,
|
|
127
125
|
children: React.Children.map(children, child => {
|
|
128
126
|
if ( /*#__PURE__*/React.isValidElement(child) && (0, _utils.unstable_isMuiElement)(child, ['Grid'])) {
|
|
129
127
|
var _child$props$unstable;
|
|
@@ -133,7 +131,7 @@ function createGrid(options = {}) {
|
|
|
133
131
|
}
|
|
134
132
|
return child;
|
|
135
133
|
})
|
|
136
|
-
})
|
|
134
|
+
});
|
|
137
135
|
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
|
|
138
136
|
// There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
|
|
139
137
|
// 1. It is the root grid with `disableEqualOverflow`.
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export interface GridClasses {
|
|
2
|
-
/** Styles applied to the root element. */
|
|
3
|
-
root: string;
|
|
4
|
-
/** Styles applied to the root element if `container={true}`. */
|
|
5
|
-
container: string;
|
|
6
|
-
/** Styles applied to the root element if `direction="column"`. */
|
|
7
|
-
'direction-xs-column': string;
|
|
8
|
-
/** Styles applied to the root element if `direction="column-reverse"`. */
|
|
9
|
-
'direction-xs-column-reverse': string;
|
|
10
|
-
/** Styles applied to the root element if `direction="row-reverse"`. */
|
|
11
|
-
'direction-xs-row-reverse': string;
|
|
12
|
-
/** Styles applied to the root element if `wrap="nowrap"`. */
|
|
13
|
-
'wrap-xs-nowrap': string;
|
|
14
|
-
/** Styles applied to the root element if `wrap="reverse"`. */
|
|
15
|
-
'wrap-xs-wrap-reverse': string;
|
|
16
|
-
}
|
|
17
|
-
export type GridClassKey = keyof GridClasses;
|
|
18
|
-
export declare function getGridUtilityClass(slot: string): string;
|
|
19
|
-
declare const gridClasses: GridClasses;
|
|
20
|
-
export default gridClasses;
|
|
1
|
+
export interface GridClasses {
|
|
2
|
+
/** Styles applied to the root element. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** Styles applied to the root element if `container={true}`. */
|
|
5
|
+
container: string;
|
|
6
|
+
/** Styles applied to the root element if `direction="column"`. */
|
|
7
|
+
'direction-xs-column': string;
|
|
8
|
+
/** Styles applied to the root element if `direction="column-reverse"`. */
|
|
9
|
+
'direction-xs-column-reverse': string;
|
|
10
|
+
/** Styles applied to the root element if `direction="row-reverse"`. */
|
|
11
|
+
'direction-xs-row-reverse': string;
|
|
12
|
+
/** Styles applied to the root element if `wrap="nowrap"`. */
|
|
13
|
+
'wrap-xs-nowrap': string;
|
|
14
|
+
/** Styles applied to the root element if `wrap="reverse"`. */
|
|
15
|
+
'wrap-xs-wrap-reverse': string;
|
|
16
|
+
}
|
|
17
|
+
export type GridClassKey = keyof GridClasses;
|
|
18
|
+
export declare function getGridUtilityClass(slot: string): string;
|
|
19
|
+
declare const gridClasses: GridClasses;
|
|
20
|
+
export default gridClasses;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { Breakpoints, Breakpoint } from '../createTheme/createBreakpoints';
|
|
2
|
-
import { Spacing } from '../createTheme/createSpacing';
|
|
3
|
-
import { ResponsiveStyleValue } from '../styleFunctionSx';
|
|
4
|
-
import { GridDirection, GridOwnerState } from './GridProps';
|
|
5
|
-
interface Props {
|
|
6
|
-
theme: {
|
|
7
|
-
breakpoints: Breakpoints;
|
|
8
|
-
spacing?: Spacing;
|
|
9
|
-
};
|
|
10
|
-
ownerState: GridOwnerState & {
|
|
11
|
-
parentDisableEqualOverflow?: boolean;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
interface Iterator<T> {
|
|
15
|
-
(appendStyle: (responsiveStyles: Record<string, any>, style: object) => void, value: T): void;
|
|
16
|
-
}
|
|
17
|
-
export declare const filterBreakpointKeys: (breakpointsKeys: Breakpoint[], responsiveKeys: string[]) => Breakpoint[];
|
|
18
|
-
export declare const traverseBreakpoints: <T = unknown>(breakpoints: Breakpoints, responsive: Record<string, any> | T | T[] | undefined, iterator: Iterator<T>) => void;
|
|
19
|
-
export declare const generateGridSizeStyles: ({ theme, ownerState }: Props) => {};
|
|
20
|
-
export declare const generateGridOffsetStyles: ({ theme, ownerState }: Props) => {};
|
|
21
|
-
export declare const generateGridColumnsStyles: ({ theme, ownerState }: Props) => {
|
|
22
|
-
[x: string]: string;
|
|
23
|
-
'--Grid-columns'?: undefined;
|
|
24
|
-
} | {
|
|
25
|
-
'--Grid-columns': number;
|
|
26
|
-
};
|
|
27
|
-
export declare const generateGridRowSpacingStyles: ({ theme, ownerState }: Props) => {
|
|
28
|
-
[x: string]: string;
|
|
29
|
-
};
|
|
30
|
-
export declare const generateGridColumnSpacingStyles: ({ theme, ownerState }: Props) => {
|
|
31
|
-
[x: string]: string;
|
|
32
|
-
};
|
|
33
|
-
export declare const generateGridDirectionStyles: ({ theme, ownerState }: Props) => {};
|
|
34
|
-
export declare const generateGridStyles: ({ ownerState }: Props) => {};
|
|
35
|
-
export declare const generateSizeClassNames: (gridSize: GridOwnerState['gridSize']) => string[];
|
|
36
|
-
export declare const generateSpacingClassNames: (spacing: GridOwnerState['spacing'], smallestBreakpoint?: string) => string[];
|
|
37
|
-
export declare const generateDirectionClasses: (direction: ResponsiveStyleValue<GridDirection> | undefined) => string[];
|
|
38
|
-
export {};
|
|
1
|
+
import { Breakpoints, Breakpoint } from '../createTheme/createBreakpoints';
|
|
2
|
+
import { Spacing } from '../createTheme/createSpacing';
|
|
3
|
+
import { ResponsiveStyleValue } from '../styleFunctionSx';
|
|
4
|
+
import { GridDirection, GridOwnerState } from './GridProps';
|
|
5
|
+
interface Props {
|
|
6
|
+
theme: {
|
|
7
|
+
breakpoints: Breakpoints;
|
|
8
|
+
spacing?: Spacing;
|
|
9
|
+
};
|
|
10
|
+
ownerState: GridOwnerState & {
|
|
11
|
+
parentDisableEqualOverflow?: boolean;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
interface Iterator<T> {
|
|
15
|
+
(appendStyle: (responsiveStyles: Record<string, any>, style: object) => void, value: T): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const filterBreakpointKeys: (breakpointsKeys: Breakpoint[], responsiveKeys: string[]) => Breakpoint[];
|
|
18
|
+
export declare const traverseBreakpoints: <T = unknown>(breakpoints: Breakpoints, responsive: Record<string, any> | T | T[] | undefined, iterator: Iterator<T>) => void;
|
|
19
|
+
export declare const generateGridSizeStyles: ({ theme, ownerState }: Props) => {};
|
|
20
|
+
export declare const generateGridOffsetStyles: ({ theme, ownerState }: Props) => {};
|
|
21
|
+
export declare const generateGridColumnsStyles: ({ theme, ownerState }: Props) => {
|
|
22
|
+
[x: string]: string;
|
|
23
|
+
'--Grid-columns'?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
'--Grid-columns': number;
|
|
26
|
+
};
|
|
27
|
+
export declare const generateGridRowSpacingStyles: ({ theme, ownerState }: Props) => {
|
|
28
|
+
[x: string]: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const generateGridColumnSpacingStyles: ({ theme, ownerState }: Props) => {
|
|
31
|
+
[x: string]: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const generateGridDirectionStyles: ({ theme, ownerState }: Props) => {};
|
|
34
|
+
export declare const generateGridStyles: ({ ownerState }: Props) => {};
|
|
35
|
+
export declare const generateSizeClassNames: (gridSize: GridOwnerState['gridSize']) => string[];
|
|
36
|
+
export declare const generateSpacingClassNames: (spacing: GridOwnerState['spacing'], smallestBreakpoint?: string) => string[];
|
|
37
|
+
export declare const generateDirectionClasses: (direction: ResponsiveStyleValue<GridDirection> | undefined) => string[];
|
|
38
|
+
export {};
|