@mui/system 6.0.0-alpha.10 → 6.0.0-alpha.11
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 +76 -0
- package/Unstable_Grid/Grid.js +0 -4
- package/Unstable_Grid/GridProps.d.ts +0 -4
- package/Unstable_Grid/createGrid.js +2 -27
- package/Unstable_Grid/gridGenerator.d.ts +1 -3
- package/Unstable_Grid/gridGenerator.js +5 -14
- package/cssContainerQueries/cssContainerQueries.js +4 -4
- package/index.js +1 -1
- package/modern/Unstable_Grid/Grid.js +0 -4
- package/modern/Unstable_Grid/createGrid.js +2 -27
- package/modern/Unstable_Grid/gridGenerator.js +5 -14
- package/modern/cssContainerQueries/cssContainerQueries.js +4 -4
- package/modern/index.js +1 -1
- package/modern/useMediaQuery/useMediaQuery.js +5 -14
- package/node/Unstable_Grid/Grid.js +0 -4
- package/node/Unstable_Grid/createGrid.js +3 -28
- package/node/Unstable_Grid/gridGenerator.js +5 -14
- package/node/cssContainerQueries/cssContainerQueries.js +4 -4
- package/node/index.js +1 -1
- package/node/useMediaQuery/useMediaQuery.js +5 -14
- package/package.json +6 -6
- package/useMediaQuery/useMediaQuery.js +5 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,81 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## v6.0.0-alpha.11
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.0.0-alpha.10..next -->
|
|
6
|
+
|
|
7
|
+
_Jun 11, 2024_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 18 contributors who made this release possible.
|
|
10
|
+
|
|
11
|
+
### `@mui/material@6.0.0-alpha.11`
|
|
12
|
+
|
|
13
|
+
- ​<!-- 38 -->[Autocomplete] Shouldn't resize when hovering (#42452) @ZeeshanTamboli
|
|
14
|
+
- ​<!-- 37 -->[Chip] Fix focus issue related with the Escape event (#41578) @shrilsharma
|
|
15
|
+
- ​<!-- 12 -->[Grid] Fix support for CSS variables (#42574) @oliviertassinari
|
|
16
|
+
- ​<!-- 11 -->[InputBase] Use `globalCss` for Pigment integration (#42431) @siriwatknp
|
|
17
|
+
- ​<!-- 10 -->Change React.ReactElement type from `any` to `unknown` (#42473) @sai6855
|
|
18
|
+
- ​<!-- 09 -->Integrate `extendSxProp` adapter (#42543) @siriwatknp
|
|
19
|
+
- ​<!-- 08 -->[Tab] Fix applying `iconWrapper` styles from theme and update its description (#42549) @sai6855
|
|
20
|
+
- ​<!-- 08 -->[pigment-css] Add `stringifyTheme` for Pigment CSS integration (#42476) @siriwatknp
|
|
21
|
+
|
|
22
|
+
### `@mui/system@6.0.0-alpha.11`
|
|
23
|
+
|
|
24
|
+
- ​<!-- 11 -->[Grid] Remove `disableEqualOverflow` by using `gap` (#42526) @DiegoAndai
|
|
25
|
+
- ​<!-- 07 -->[useMediaQuery] Drop Safari < 14 support (#42464) @aarongarciah
|
|
26
|
+
|
|
27
|
+
### `@mui/utils@6.0.0-alpha.11`
|
|
28
|
+
|
|
29
|
+
- ​<!-- 04 -->Allow passing `NaN` as `defaultValue` to `useControlled` (#41559) @iammminzzy
|
|
30
|
+
|
|
31
|
+
### `@mui/codemod@6.0.0-alpha.11`
|
|
32
|
+
|
|
33
|
+
- ​<!-- 39 -->Improve styled and sx prop transformation (#42598) @siriwatknp
|
|
34
|
+
- ​<!-- 36 -->Support more cases for sx-prop transformation (#42527) @siriwatknp
|
|
35
|
+
|
|
36
|
+
### `@mui/private-theming@6.0.0-alpha.11`
|
|
37
|
+
|
|
38
|
+
- ​<!-- 09 -->Fix issues reported by react compiler in `mui-private-theming` components (#42619) @sai6855
|
|
39
|
+
|
|
40
|
+
### Docs
|
|
41
|
+
|
|
42
|
+
- ​<!-- 31 -->Add `theme.applyStyles` and migrate docs (#42498) @siriwatknp
|
|
43
|
+
- ​<!-- 29 -->Fix dashboard template console error (#42594) @oliviertassinari
|
|
44
|
+
- ​<!-- 28 -->Migrate system props to `sx` prop (#42475) @siriwatknp
|
|
45
|
+
- ​<!-- 27 -->[material-ui]Fix duplicated sentence (#42521) @alexfauquette
|
|
46
|
+
- ​<!-- 22 -->[Grid] Fix docs spacing (#42573) @oliviertassinari
|
|
47
|
+
- ​<!-- 21 -->[joy-ui] Add Next.js App Router instructions on how to prevent flickering (#42514) @devnyxie
|
|
48
|
+
- ​<!-- 20 -->[joy-ui] Fix HTML tag without preformatting (#42525) @jacobmoshipco
|
|
49
|
+
- ​<!-- 19 -->[material-ui] Add docs for complementary stepper components (#41900) @anle9650
|
|
50
|
+
- ​<!-- 18 -->[material-ui] Fix typo on Sign-in/Sign-up templates (#42605) @zanivan
|
|
51
|
+
- ​<!-- 17 -->[material-ui] Add container queries docs (#42434) @siriwatknp
|
|
52
|
+
- ​<!-- 16 -->[material-ui] Fix ESLint error in Stepper demo (#42559) @aarongarciah
|
|
53
|
+
- ​<!-- 15 -->[material-ui] Shorten useMediaQuery subheading (#42561) @aarongarciah
|
|
54
|
+
- ​<!-- 14 -->[material-ui] Add a Refine example project (#42461) @necatiozmen
|
|
55
|
+
|
|
56
|
+
### Core
|
|
57
|
+
|
|
58
|
+
- ​<!-- 39 -->[website] Move the `React Engineer - X` role to future roles (#42532) @DanailH
|
|
59
|
+
- ​<!-- 35 -->[core] Allow `for..of` loops (#42600) @michaldudak
|
|
60
|
+
- ​<!-- 34 -->[core] Add comment about Object.js @oliviertassinari
|
|
61
|
+
- ​<!-- 33 -->[core] Disable eslint-plugin-react-compiler for Base (#42563) @aarongarciah
|
|
62
|
+
- ​<!-- 33 -->[core] Group Pigment CSS dependencies (#42174) @siriwatknp
|
|
63
|
+
- ​<!-- 32 -->[core] Configure eslint-plugin-react-compiler (#42555) @aarongarciah
|
|
64
|
+
- ​<!-- 31 -->[core] Skip charts animation for visual regression test (#42530) @alexfauquette
|
|
65
|
+
- ​<!-- 26 -->[docs-infra] Simplify click header (#42593) @oliviertassinari
|
|
66
|
+
- ​<!-- 25 -->[docs-infra] Add configurable jsdoc host variable (#42472) @tonygravell
|
|
67
|
+
- ​<!-- 25 -->[docs-infra] Add the Base UI logo with copy functionality (#42446) @danilo-leal
|
|
68
|
+
- ​<!-- 24 -->[docs-infra] Prevent link anchor when selecting text (#41994) @alexfauquette
|
|
69
|
+
- ​<!-- 23 -->[docs-infra] Add the Base UI logo with copy functionality (#42446) @danilo-leal
|
|
70
|
+
- ​<!-- 13 -->[examples] Remove Pigment CSS examples (#42471) @sai6855
|
|
71
|
+
- ​<!-- 06 -->[test] Restore pnpm tc command (#42572) @oliviertassinari
|
|
72
|
+
- ​<!-- 05 -->[test] Restore testing internal packages (#42519) @michaldudak
|
|
73
|
+
- ​<!-- 03 -->[website] Close Developer Advocate / Content Engineer role @oliviertassinari
|
|
74
|
+
- ​<!-- 02 -->[website] Remove blank line @oliviertassinari
|
|
75
|
+
- ​<!-- 01 -->[website] Fix mobile layout shift @oliviertassinari
|
|
76
|
+
|
|
77
|
+
All contributors of this release in alphabetical order: @aarongarciah, @alexfauquette, @anle9650, @DanailH, @danilo-leal, @devnyxie, @DiegoAndai, @iammminzzy, @jacobmoshipco, @michaldudak, @necatiozmen, @oliviertassinari, @sai6855, @shrilsharma, @siriwatknp, @tonygravell, @zanivan, @ZeeshanTamboli
|
|
78
|
+
|
|
3
79
|
## v6.0.0-alpha.10
|
|
4
80
|
|
|
5
81
|
<!-- generated comparing v6.0.0-alpha.9..next -->
|
package/Unstable_Grid/Grid.js
CHANGED
|
@@ -45,10 +45,6 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ =
|
|
|
45
45
|
* @default 'row'
|
|
46
46
|
*/
|
|
47
47
|
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]),
|
|
48
|
-
/**
|
|
49
|
-
* If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
|
|
50
|
-
*/
|
|
51
|
-
disableEqualOverflow: PropTypes.bool,
|
|
52
48
|
/**
|
|
53
49
|
* If a number, it sets the number of columns the grid item uses.
|
|
54
50
|
* It can't be greater than the total number of columns of the container (12 by default).
|
|
@@ -123,10 +123,6 @@ export interface GridBaseProps extends Breakpoints {
|
|
|
123
123
|
* @default 'row'
|
|
124
124
|
*/
|
|
125
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
126
|
/**
|
|
131
127
|
* @internal
|
|
132
128
|
* The level of the grid starts from `0`
|
|
@@ -33,10 +33,6 @@ export default function createGrid(options = {}) {
|
|
|
33
33
|
useThemeProps = useThemePropsDefault,
|
|
34
34
|
componentName = 'MuiGrid'
|
|
35
35
|
} = options;
|
|
36
|
-
const GridOverflowContext = /*#__PURE__*/React.createContext(undefined);
|
|
37
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
38
|
-
GridOverflowContext.displayName = 'GridOverflowContext';
|
|
39
|
-
}
|
|
40
36
|
const useUtilityClasses = (ownerState, theme) => {
|
|
41
37
|
const {
|
|
42
38
|
container,
|
|
@@ -55,7 +51,6 @@ export default function createGrid(options = {}) {
|
|
|
55
51
|
const theme = useTheme();
|
|
56
52
|
const themeProps = useThemeProps(inProps);
|
|
57
53
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
58
|
-
const overflow = React.useContext(GridOverflowContext);
|
|
59
54
|
const {
|
|
60
55
|
className,
|
|
61
56
|
children,
|
|
@@ -67,15 +62,9 @@ export default function createGrid(options = {}) {
|
|
|
67
62
|
spacing: spacingProp = 0,
|
|
68
63
|
rowSpacing: rowSpacingProp = spacingProp,
|
|
69
64
|
columnSpacing: columnSpacingProp = spacingProp,
|
|
70
|
-
disableEqualOverflow: themeDisableEqualOverflow,
|
|
71
65
|
unstable_level: level = 0,
|
|
72
66
|
...rest
|
|
73
67
|
} = props;
|
|
74
|
-
// Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
|
|
75
|
-
let disableEqualOverflow = themeDisableEqualOverflow;
|
|
76
|
-
if (level && themeDisableEqualOverflow !== undefined) {
|
|
77
|
-
disableEqualOverflow = inProps.disableEqualOverflow;
|
|
78
|
-
}
|
|
79
68
|
// collect breakpoints related props because they can be customized from the theme.
|
|
80
69
|
const gridSize = {};
|
|
81
70
|
const gridOffset = {};
|
|
@@ -104,13 +93,10 @@ export default function createGrid(options = {}) {
|
|
|
104
93
|
rowSpacing,
|
|
105
94
|
columnSpacing,
|
|
106
95
|
gridSize,
|
|
107
|
-
gridOffset
|
|
108
|
-
disableEqualOverflow: disableEqualOverflow ?? overflow ?? false,
|
|
109
|
-
// use context value if exists.
|
|
110
|
-
parentDisableEqualOverflow: overflow // for nested grid
|
|
96
|
+
gridOffset
|
|
111
97
|
};
|
|
112
98
|
const classes = useUtilityClasses(ownerState, theme);
|
|
113
|
-
|
|
99
|
+
return /*#__PURE__*/_jsx(GridRoot, {
|
|
114
100
|
ref: ref,
|
|
115
101
|
as: component,
|
|
116
102
|
ownerState: ownerState,
|
|
@@ -125,16 +111,6 @@ export default function createGrid(options = {}) {
|
|
|
125
111
|
return child;
|
|
126
112
|
})
|
|
127
113
|
});
|
|
128
|
-
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow ?? false)) {
|
|
129
|
-
// There are 2 possibilities that should wrap with the GridOverflowContext to communicate with the nested grids:
|
|
130
|
-
// 1. It is the root grid with `disableEqualOverflow`.
|
|
131
|
-
// 2. It is a nested grid with different `disableEqualOverflow` from the context.
|
|
132
|
-
result = /*#__PURE__*/_jsx(GridOverflowContext.Provider, {
|
|
133
|
-
value: disableEqualOverflow,
|
|
134
|
-
children: result
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return result;
|
|
138
114
|
});
|
|
139
115
|
process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
|
|
140
116
|
children: PropTypes.node,
|
|
@@ -144,7 +120,6 @@ export default function createGrid(options = {}) {
|
|
|
144
120
|
component: PropTypes.elementType,
|
|
145
121
|
container: PropTypes.bool,
|
|
146
122
|
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
|
147
|
-
disableEqualOverflow: PropTypes.bool,
|
|
148
123
|
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
149
124
|
lgOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
150
125
|
md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
@@ -7,9 +7,7 @@ interface Props {
|
|
|
7
7
|
breakpoints: Breakpoints;
|
|
8
8
|
spacing?: Spacing;
|
|
9
9
|
};
|
|
10
|
-
ownerState: GridOwnerState
|
|
11
|
-
parentDisableEqualOverflow?: boolean;
|
|
12
|
-
};
|
|
10
|
+
ownerState: GridOwnerState;
|
|
13
11
|
}
|
|
14
12
|
export declare const generateGridSizeStyles: ({ theme, ownerState }: Props) => {};
|
|
15
13
|
export declare const generateGridOffsetStyles: ({ theme, ownerState }: Props) => {};
|
|
@@ -31,7 +31,7 @@ export const generateGridSizeStyles = ({
|
|
|
31
31
|
theme,
|
|
32
32
|
ownerState
|
|
33
33
|
}) => {
|
|
34
|
-
const
|
|
34
|
+
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
35
35
|
const styles = {};
|
|
36
36
|
traverseBreakpoints(theme.breakpoints, ownerState.gridSize, (appendStyle, value) => {
|
|
37
37
|
let style = {};
|
|
@@ -55,7 +55,7 @@ export const generateGridSizeStyles = ({
|
|
|
55
55
|
style = {
|
|
56
56
|
flexGrow: 0,
|
|
57
57
|
flexBasis: 'auto',
|
|
58
|
-
width: `calc(100% * ${value} / ${getParentColumns(ownerState)}${
|
|
58
|
+
width: `calc(100% * ${value} / ${getParentColumns(ownerState)} - (${getParentColumns(ownerState)} - ${value}) * (${getParentSpacing('column')} / ${getParentColumns(ownerState)}))`
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
appendStyle(styles, style);
|
|
@@ -66,6 +66,7 @@ export const generateGridOffsetStyles = ({
|
|
|
66
66
|
theme,
|
|
67
67
|
ownerState
|
|
68
68
|
}) => {
|
|
69
|
+
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
69
70
|
const styles = {};
|
|
70
71
|
traverseBreakpoints(theme.breakpoints, ownerState.gridOffset, (appendStyle, value) => {
|
|
71
72
|
let style = {};
|
|
@@ -76,7 +77,7 @@ export const generateGridOffsetStyles = ({
|
|
|
76
77
|
}
|
|
77
78
|
if (typeof value === 'number') {
|
|
78
79
|
style = {
|
|
79
|
-
marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)})`
|
|
80
|
+
marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)} + ${getParentSpacing('column')} * ${value} / ${getParentColumns(ownerState)})`
|
|
80
81
|
};
|
|
81
82
|
}
|
|
82
83
|
appendStyle(styles, style);
|
|
@@ -161,7 +162,6 @@ export const generateGridStyles = ({
|
|
|
161
162
|
ownerState
|
|
162
163
|
}) => {
|
|
163
164
|
const getSelfSpacing = createGetSelfSpacing(ownerState);
|
|
164
|
-
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
165
165
|
return {
|
|
166
166
|
minWidth: 0,
|
|
167
167
|
boxSizing: 'border-box',
|
|
@@ -171,16 +171,7 @@ export const generateGridStyles = ({
|
|
|
171
171
|
...(ownerState.wrap && ownerState.wrap !== 'wrap' && {
|
|
172
172
|
flexWrap: ownerState.wrap
|
|
173
173
|
}),
|
|
174
|
-
|
|
175
|
-
...(ownerState.disableEqualOverflow && {
|
|
176
|
-
margin: `calc(${getSelfSpacing('row')} * -1) 0px 0px calc(${getSelfSpacing('column')} * -1)`
|
|
177
|
-
})
|
|
178
|
-
}),
|
|
179
|
-
...((!ownerState.container || isNestedContainer(ownerState)) && {
|
|
180
|
-
padding: `calc(${getParentSpacing('row')} / 2) calc(${getParentSpacing('column')} / 2)`,
|
|
181
|
-
...((ownerState.disableEqualOverflow || ownerState.parentDisableEqualOverflow) && {
|
|
182
|
-
padding: `${getParentSpacing('row')} 0px 0px ${getParentSpacing('column')}`
|
|
183
|
-
})
|
|
174
|
+
gap: `${getSelfSpacing('row')} ${getSelfSpacing('column')}`
|
|
184
175
|
})
|
|
185
176
|
};
|
|
186
177
|
};
|
|
@@ -26,10 +26,10 @@ export function sortContainerQueries(theme, css) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
export function isCqShorthand(breakpointKeys, value) {
|
|
29
|
-
return value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
29
|
+
return value === '@' || value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
30
30
|
}
|
|
31
31
|
export function getContainerQuery(theme, shorthand) {
|
|
32
|
-
const matches = shorthand.match(/^@([^/]+)
|
|
32
|
+
const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
|
|
33
33
|
if (!matches) {
|
|
34
34
|
if (process.env.NODE_ENV !== 'production') {
|
|
35
35
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
|
@@ -38,7 +38,7 @@ For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.` : _formatMuiErrorMessag
|
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
40
|
const [, containerQuery, containerName] = matches;
|
|
41
|
-
const value = Number.isNaN(+containerQuery) ? containerQuery : +containerQuery;
|
|
41
|
+
const value = Number.isNaN(+containerQuery) ? containerQuery || 0 : +containerQuery;
|
|
42
42
|
return theme.containerQueries(containerName).up(value);
|
|
43
43
|
}
|
|
44
44
|
export default function cssContainerQueries(themeInput) {
|
|
@@ -52,7 +52,7 @@ export default function cssContainerQueries(themeInput) {
|
|
|
52
52
|
const result = toContainerQuery(themeInput.breakpoints.not(...args), name);
|
|
53
53
|
if (result.includes('not all and')) {
|
|
54
54
|
// `@container` does not work with `not all and`, so need to invert the logic
|
|
55
|
-
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>');
|
|
55
|
+
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>').replace('and', 'or');
|
|
56
56
|
}
|
|
57
57
|
return result;
|
|
58
58
|
};
|
package/index.js
CHANGED
|
@@ -45,10 +45,6 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ =
|
|
|
45
45
|
* @default 'row'
|
|
46
46
|
*/
|
|
47
47
|
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]),
|
|
48
|
-
/**
|
|
49
|
-
* If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
|
|
50
|
-
*/
|
|
51
|
-
disableEqualOverflow: PropTypes.bool,
|
|
52
48
|
/**
|
|
53
49
|
* If a number, it sets the number of columns the grid item uses.
|
|
54
50
|
* It can't be greater than the total number of columns of the container (12 by default).
|
|
@@ -33,10 +33,6 @@ export default function createGrid(options = {}) {
|
|
|
33
33
|
useThemeProps = useThemePropsDefault,
|
|
34
34
|
componentName = 'MuiGrid'
|
|
35
35
|
} = options;
|
|
36
|
-
const GridOverflowContext = /*#__PURE__*/React.createContext(undefined);
|
|
37
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
38
|
-
GridOverflowContext.displayName = 'GridOverflowContext';
|
|
39
|
-
}
|
|
40
36
|
const useUtilityClasses = (ownerState, theme) => {
|
|
41
37
|
const {
|
|
42
38
|
container,
|
|
@@ -55,7 +51,6 @@ export default function createGrid(options = {}) {
|
|
|
55
51
|
const theme = useTheme();
|
|
56
52
|
const themeProps = useThemeProps(inProps);
|
|
57
53
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
58
|
-
const overflow = React.useContext(GridOverflowContext);
|
|
59
54
|
const {
|
|
60
55
|
className,
|
|
61
56
|
children,
|
|
@@ -67,15 +62,9 @@ export default function createGrid(options = {}) {
|
|
|
67
62
|
spacing: spacingProp = 0,
|
|
68
63
|
rowSpacing: rowSpacingProp = spacingProp,
|
|
69
64
|
columnSpacing: columnSpacingProp = spacingProp,
|
|
70
|
-
disableEqualOverflow: themeDisableEqualOverflow,
|
|
71
65
|
unstable_level: level = 0,
|
|
72
66
|
...rest
|
|
73
67
|
} = props;
|
|
74
|
-
// Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
|
|
75
|
-
let disableEqualOverflow = themeDisableEqualOverflow;
|
|
76
|
-
if (level && themeDisableEqualOverflow !== undefined) {
|
|
77
|
-
disableEqualOverflow = inProps.disableEqualOverflow;
|
|
78
|
-
}
|
|
79
68
|
// collect breakpoints related props because they can be customized from the theme.
|
|
80
69
|
const gridSize = {};
|
|
81
70
|
const gridOffset = {};
|
|
@@ -104,13 +93,10 @@ export default function createGrid(options = {}) {
|
|
|
104
93
|
rowSpacing,
|
|
105
94
|
columnSpacing,
|
|
106
95
|
gridSize,
|
|
107
|
-
gridOffset
|
|
108
|
-
disableEqualOverflow: disableEqualOverflow ?? overflow ?? false,
|
|
109
|
-
// use context value if exists.
|
|
110
|
-
parentDisableEqualOverflow: overflow // for nested grid
|
|
96
|
+
gridOffset
|
|
111
97
|
};
|
|
112
98
|
const classes = useUtilityClasses(ownerState, theme);
|
|
113
|
-
|
|
99
|
+
return /*#__PURE__*/_jsx(GridRoot, {
|
|
114
100
|
ref: ref,
|
|
115
101
|
as: component,
|
|
116
102
|
ownerState: ownerState,
|
|
@@ -125,16 +111,6 @@ export default function createGrid(options = {}) {
|
|
|
125
111
|
return child;
|
|
126
112
|
})
|
|
127
113
|
});
|
|
128
|
-
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow ?? false)) {
|
|
129
|
-
// There are 2 possibilities that should wrap with the GridOverflowContext to communicate with the nested grids:
|
|
130
|
-
// 1. It is the root grid with `disableEqualOverflow`.
|
|
131
|
-
// 2. It is a nested grid with different `disableEqualOverflow` from the context.
|
|
132
|
-
result = /*#__PURE__*/_jsx(GridOverflowContext.Provider, {
|
|
133
|
-
value: disableEqualOverflow,
|
|
134
|
-
children: result
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return result;
|
|
138
114
|
});
|
|
139
115
|
process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
|
|
140
116
|
children: PropTypes.node,
|
|
@@ -144,7 +120,6 @@ export default function createGrid(options = {}) {
|
|
|
144
120
|
component: PropTypes.elementType,
|
|
145
121
|
container: PropTypes.bool,
|
|
146
122
|
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
|
147
|
-
disableEqualOverflow: PropTypes.bool,
|
|
148
123
|
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
149
124
|
lgOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
150
125
|
md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
@@ -31,7 +31,7 @@ export const generateGridSizeStyles = ({
|
|
|
31
31
|
theme,
|
|
32
32
|
ownerState
|
|
33
33
|
}) => {
|
|
34
|
-
const
|
|
34
|
+
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
35
35
|
const styles = {};
|
|
36
36
|
traverseBreakpoints(theme.breakpoints, ownerState.gridSize, (appendStyle, value) => {
|
|
37
37
|
let style = {};
|
|
@@ -55,7 +55,7 @@ export const generateGridSizeStyles = ({
|
|
|
55
55
|
style = {
|
|
56
56
|
flexGrow: 0,
|
|
57
57
|
flexBasis: 'auto',
|
|
58
|
-
width: `calc(100% * ${value} / ${getParentColumns(ownerState)}${
|
|
58
|
+
width: `calc(100% * ${value} / ${getParentColumns(ownerState)} - (${getParentColumns(ownerState)} - ${value}) * (${getParentSpacing('column')} / ${getParentColumns(ownerState)}))`
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
appendStyle(styles, style);
|
|
@@ -66,6 +66,7 @@ export const generateGridOffsetStyles = ({
|
|
|
66
66
|
theme,
|
|
67
67
|
ownerState
|
|
68
68
|
}) => {
|
|
69
|
+
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
69
70
|
const styles = {};
|
|
70
71
|
traverseBreakpoints(theme.breakpoints, ownerState.gridOffset, (appendStyle, value) => {
|
|
71
72
|
let style = {};
|
|
@@ -76,7 +77,7 @@ export const generateGridOffsetStyles = ({
|
|
|
76
77
|
}
|
|
77
78
|
if (typeof value === 'number') {
|
|
78
79
|
style = {
|
|
79
|
-
marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)})`
|
|
80
|
+
marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)} + ${getParentSpacing('column')} * ${value} / ${getParentColumns(ownerState)})`
|
|
80
81
|
};
|
|
81
82
|
}
|
|
82
83
|
appendStyle(styles, style);
|
|
@@ -161,7 +162,6 @@ export const generateGridStyles = ({
|
|
|
161
162
|
ownerState
|
|
162
163
|
}) => {
|
|
163
164
|
const getSelfSpacing = createGetSelfSpacing(ownerState);
|
|
164
|
-
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
165
165
|
return {
|
|
166
166
|
minWidth: 0,
|
|
167
167
|
boxSizing: 'border-box',
|
|
@@ -171,16 +171,7 @@ export const generateGridStyles = ({
|
|
|
171
171
|
...(ownerState.wrap && ownerState.wrap !== 'wrap' && {
|
|
172
172
|
flexWrap: ownerState.wrap
|
|
173
173
|
}),
|
|
174
|
-
|
|
175
|
-
...(ownerState.disableEqualOverflow && {
|
|
176
|
-
margin: `calc(${getSelfSpacing('row')} * -1) 0px 0px calc(${getSelfSpacing('column')} * -1)`
|
|
177
|
-
})
|
|
178
|
-
}),
|
|
179
|
-
...((!ownerState.container || isNestedContainer(ownerState)) && {
|
|
180
|
-
padding: `calc(${getParentSpacing('row')} / 2) calc(${getParentSpacing('column')} / 2)`,
|
|
181
|
-
...((ownerState.disableEqualOverflow || ownerState.parentDisableEqualOverflow) && {
|
|
182
|
-
padding: `${getParentSpacing('row')} 0px 0px ${getParentSpacing('column')}`
|
|
183
|
-
})
|
|
174
|
+
gap: `${getSelfSpacing('row')} ${getSelfSpacing('column')}`
|
|
184
175
|
})
|
|
185
176
|
};
|
|
186
177
|
};
|
|
@@ -26,10 +26,10 @@ export function sortContainerQueries(theme, css) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
export function isCqShorthand(breakpointKeys, value) {
|
|
29
|
-
return value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
29
|
+
return value === '@' || value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
30
30
|
}
|
|
31
31
|
export function getContainerQuery(theme, shorthand) {
|
|
32
|
-
const matches = shorthand.match(/^@([^/]+)
|
|
32
|
+
const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
|
|
33
33
|
if (!matches) {
|
|
34
34
|
if (process.env.NODE_ENV !== 'production') {
|
|
35
35
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
|
@@ -38,7 +38,7 @@ For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.` : _formatMuiErrorMessag
|
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
40
|
const [, containerQuery, containerName] = matches;
|
|
41
|
-
const value = Number.isNaN(+containerQuery) ? containerQuery : +containerQuery;
|
|
41
|
+
const value = Number.isNaN(+containerQuery) ? containerQuery || 0 : +containerQuery;
|
|
42
42
|
return theme.containerQueries(containerName).up(value);
|
|
43
43
|
}
|
|
44
44
|
export default function cssContainerQueries(themeInput) {
|
|
@@ -52,7 +52,7 @@ export default function cssContainerQueries(themeInput) {
|
|
|
52
52
|
const result = toContainerQuery(themeInput.breakpoints.not(...args), name);
|
|
53
53
|
if (result.includes('not all and')) {
|
|
54
54
|
// `@container` does not work with `not all and`, so need to invert the logic
|
|
55
|
-
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>');
|
|
55
|
+
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>').replace('and', 'or');
|
|
56
56
|
}
|
|
57
57
|
return result;
|
|
58
58
|
};
|
package/modern/index.js
CHANGED
|
@@ -31,25 +31,17 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
31
31
|
return defaultMatches;
|
|
32
32
|
});
|
|
33
33
|
useEnhancedEffect(() => {
|
|
34
|
-
let active = true;
|
|
35
34
|
if (!matchMedia) {
|
|
36
35
|
return undefined;
|
|
37
36
|
}
|
|
38
37
|
const queryList = matchMedia(query);
|
|
39
38
|
const updateMatch = () => {
|
|
40
|
-
|
|
41
|
-
// TODO can we remove it?
|
|
42
|
-
// https://github.com/mui/material-ui/pull/17315#issuecomment-528286677
|
|
43
|
-
if (active) {
|
|
44
|
-
setMatch(queryList.matches);
|
|
45
|
-
}
|
|
39
|
+
setMatch(queryList.matches);
|
|
46
40
|
};
|
|
47
41
|
updateMatch();
|
|
48
|
-
|
|
49
|
-
queryList.addListener(updateMatch);
|
|
42
|
+
queryList.addEventListener('change', updateMatch);
|
|
50
43
|
return () => {
|
|
51
|
-
|
|
52
|
-
queryList.removeListener(updateMatch);
|
|
44
|
+
queryList.removeEventListener('change', updateMatch);
|
|
53
45
|
};
|
|
54
46
|
}, [query, matchMedia]);
|
|
55
47
|
return match;
|
|
@@ -77,10 +69,9 @@ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
77
69
|
}
|
|
78
70
|
const mediaQueryList = matchMedia(query);
|
|
79
71
|
return [() => mediaQueryList.matches, notify => {
|
|
80
|
-
|
|
81
|
-
mediaQueryList.addListener(notify);
|
|
72
|
+
mediaQueryList.addEventListener('change', notify);
|
|
82
73
|
return () => {
|
|
83
|
-
mediaQueryList.
|
|
74
|
+
mediaQueryList.removeEventListener('change', notify);
|
|
84
75
|
};
|
|
85
76
|
}];
|
|
86
77
|
}, [getDefaultSnapshot, matchMedia, query]);
|
|
@@ -51,10 +51,6 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ =
|
|
|
51
51
|
* @default 'row'
|
|
52
52
|
*/
|
|
53
53
|
direction: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), _propTypes.default.arrayOf(_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), _propTypes.default.object]),
|
|
54
|
-
/**
|
|
55
|
-
* If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
|
|
56
|
-
*/
|
|
57
|
-
disableEqualOverflow: _propTypes.default.bool,
|
|
58
54
|
/**
|
|
59
55
|
* If a number, it sets the number of columns the grid item uses.
|
|
60
56
|
* It can't be greater than the total number of columns of the container (12 by default).
|
|
@@ -42,10 +42,6 @@ function createGrid(options = {}) {
|
|
|
42
42
|
useThemeProps = useThemePropsDefault,
|
|
43
43
|
componentName = 'MuiGrid'
|
|
44
44
|
} = options;
|
|
45
|
-
const GridOverflowContext = /*#__PURE__*/React.createContext(undefined);
|
|
46
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
47
|
-
GridOverflowContext.displayName = 'GridOverflowContext';
|
|
48
|
-
}
|
|
49
45
|
const useUtilityClasses = (ownerState, theme) => {
|
|
50
46
|
const {
|
|
51
47
|
container,
|
|
@@ -61,11 +57,10 @@ function createGrid(options = {}) {
|
|
|
61
57
|
};
|
|
62
58
|
const GridRoot = createStyledComponent(_gridGenerator.generateGridColumnsStyles, _gridGenerator.generateGridColumnSpacingStyles, _gridGenerator.generateGridRowSpacingStyles, _gridGenerator.generateGridSizeStyles, _gridGenerator.generateGridDirectionStyles, _gridGenerator.generateGridStyles, _gridGenerator.generateGridOffsetStyles);
|
|
63
59
|
const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
|
|
64
|
-
var _inProps$columns, _inProps$spacing, _ref, _inProps$rowSpacing, _ref2, _inProps$columnSpacin
|
|
60
|
+
var _inProps$columns, _inProps$spacing, _ref, _inProps$rowSpacing, _ref2, _inProps$columnSpacin;
|
|
65
61
|
const theme = (0, _useTheme.default)();
|
|
66
62
|
const themeProps = useThemeProps(inProps);
|
|
67
63
|
const props = (0, _styleFunctionSx.extendSxProp)(themeProps); // `color` type conflicts with html color attribute.
|
|
68
|
-
const overflow = React.useContext(GridOverflowContext);
|
|
69
64
|
const {
|
|
70
65
|
className,
|
|
71
66
|
children,
|
|
@@ -77,15 +72,9 @@ function createGrid(options = {}) {
|
|
|
77
72
|
spacing: spacingProp = 0,
|
|
78
73
|
rowSpacing: rowSpacingProp = spacingProp,
|
|
79
74
|
columnSpacing: columnSpacingProp = spacingProp,
|
|
80
|
-
disableEqualOverflow: themeDisableEqualOverflow,
|
|
81
75
|
unstable_level: level = 0,
|
|
82
76
|
...rest
|
|
83
77
|
} = props;
|
|
84
|
-
// Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
|
|
85
|
-
let disableEqualOverflow = themeDisableEqualOverflow;
|
|
86
|
-
if (level && themeDisableEqualOverflow !== undefined) {
|
|
87
|
-
disableEqualOverflow = inProps.disableEqualOverflow;
|
|
88
|
-
}
|
|
89
78
|
// collect breakpoints related props because they can be customized from the theme.
|
|
90
79
|
const gridSize = {};
|
|
91
80
|
const gridOffset = {};
|
|
@@ -114,13 +103,10 @@ function createGrid(options = {}) {
|
|
|
114
103
|
rowSpacing,
|
|
115
104
|
columnSpacing,
|
|
116
105
|
gridSize,
|
|
117
|
-
gridOffset
|
|
118
|
-
disableEqualOverflow: (_ref3 = (_disableEqualOverflow = disableEqualOverflow) != null ? _disableEqualOverflow : overflow) != null ? _ref3 : false,
|
|
119
|
-
// use context value if exists.
|
|
120
|
-
parentDisableEqualOverflow: overflow // for nested grid
|
|
106
|
+
gridOffset
|
|
121
107
|
};
|
|
122
108
|
const classes = useUtilityClasses(ownerState, theme);
|
|
123
|
-
|
|
109
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridRoot, {
|
|
124
110
|
ref: ref,
|
|
125
111
|
as: component,
|
|
126
112
|
ownerState: ownerState,
|
|
@@ -136,16 +122,6 @@ function createGrid(options = {}) {
|
|
|
136
122
|
return child;
|
|
137
123
|
})
|
|
138
124
|
});
|
|
139
|
-
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
|
|
140
|
-
// There are 2 possibilities that should wrap with the GridOverflowContext to communicate with the nested grids:
|
|
141
|
-
// 1. It is the root grid with `disableEqualOverflow`.
|
|
142
|
-
// 2. It is a nested grid with different `disableEqualOverflow` from the context.
|
|
143
|
-
result = /*#__PURE__*/(0, _jsxRuntime.jsx)(GridOverflowContext.Provider, {
|
|
144
|
-
value: disableEqualOverflow,
|
|
145
|
-
children: result
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
return result;
|
|
149
125
|
});
|
|
150
126
|
process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
|
|
151
127
|
children: _propTypes.default.node,
|
|
@@ -155,7 +131,6 @@ function createGrid(options = {}) {
|
|
|
155
131
|
component: _propTypes.default.elementType,
|
|
156
132
|
container: _propTypes.default.bool,
|
|
157
133
|
direction: _propTypes.default.oneOfType([_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), _propTypes.default.arrayOf(_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), _propTypes.default.object]),
|
|
158
|
-
disableEqualOverflow: _propTypes.default.bool,
|
|
159
134
|
lg: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
|
|
160
135
|
lgOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
|
|
161
136
|
md: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
|
|
@@ -37,7 +37,7 @@ const generateGridSizeStyles = ({
|
|
|
37
37
|
theme,
|
|
38
38
|
ownerState
|
|
39
39
|
}) => {
|
|
40
|
-
const
|
|
40
|
+
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
41
41
|
const styles = {};
|
|
42
42
|
(0, _traverseBreakpoints.traverseBreakpoints)(theme.breakpoints, ownerState.gridSize, (appendStyle, value) => {
|
|
43
43
|
let style = {};
|
|
@@ -61,7 +61,7 @@ const generateGridSizeStyles = ({
|
|
|
61
61
|
style = {
|
|
62
62
|
flexGrow: 0,
|
|
63
63
|
flexBasis: 'auto',
|
|
64
|
-
width: `calc(100% * ${value} / ${getParentColumns(ownerState)}${
|
|
64
|
+
width: `calc(100% * ${value} / ${getParentColumns(ownerState)} - (${getParentColumns(ownerState)} - ${value}) * (${getParentSpacing('column')} / ${getParentColumns(ownerState)}))`
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
appendStyle(styles, style);
|
|
@@ -73,6 +73,7 @@ const generateGridOffsetStyles = ({
|
|
|
73
73
|
theme,
|
|
74
74
|
ownerState
|
|
75
75
|
}) => {
|
|
76
|
+
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
76
77
|
const styles = {};
|
|
77
78
|
(0, _traverseBreakpoints.traverseBreakpoints)(theme.breakpoints, ownerState.gridOffset, (appendStyle, value) => {
|
|
78
79
|
let style = {};
|
|
@@ -83,7 +84,7 @@ const generateGridOffsetStyles = ({
|
|
|
83
84
|
}
|
|
84
85
|
if (typeof value === 'number') {
|
|
85
86
|
style = {
|
|
86
|
-
marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)})`
|
|
87
|
+
marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)} + ${getParentSpacing('column')} * ${value} / ${getParentColumns(ownerState)})`
|
|
87
88
|
};
|
|
88
89
|
}
|
|
89
90
|
appendStyle(styles, style);
|
|
@@ -175,7 +176,6 @@ const generateGridStyles = ({
|
|
|
175
176
|
ownerState
|
|
176
177
|
}) => {
|
|
177
178
|
const getSelfSpacing = createGetSelfSpacing(ownerState);
|
|
178
|
-
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
179
179
|
return {
|
|
180
180
|
minWidth: 0,
|
|
181
181
|
boxSizing: 'border-box',
|
|
@@ -185,16 +185,7 @@ const generateGridStyles = ({
|
|
|
185
185
|
...(ownerState.wrap && ownerState.wrap !== 'wrap' && {
|
|
186
186
|
flexWrap: ownerState.wrap
|
|
187
187
|
}),
|
|
188
|
-
|
|
189
|
-
...(ownerState.disableEqualOverflow && {
|
|
190
|
-
margin: `calc(${getSelfSpacing('row')} * -1) 0px 0px calc(${getSelfSpacing('column')} * -1)`
|
|
191
|
-
})
|
|
192
|
-
}),
|
|
193
|
-
...((!ownerState.container || isNestedContainer(ownerState)) && {
|
|
194
|
-
padding: `calc(${getParentSpacing('row')} / 2) calc(${getParentSpacing('column')} / 2)`,
|
|
195
|
-
...((ownerState.disableEqualOverflow || ownerState.parentDisableEqualOverflow) && {
|
|
196
|
-
padding: `${getParentSpacing('row')} 0px 0px ${getParentSpacing('column')}`
|
|
197
|
-
})
|
|
188
|
+
gap: `${getSelfSpacing('row')} ${getSelfSpacing('column')}`
|
|
198
189
|
})
|
|
199
190
|
};
|
|
200
191
|
};
|
|
@@ -37,10 +37,10 @@ function sortContainerQueries(theme, css) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
function isCqShorthand(breakpointKeys, value) {
|
|
40
|
-
return value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
40
|
+
return value === '@' || value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
41
41
|
}
|
|
42
42
|
function getContainerQuery(theme, shorthand) {
|
|
43
|
-
const matches = shorthand.match(/^@([^/]+)
|
|
43
|
+
const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
|
|
44
44
|
if (!matches) {
|
|
45
45
|
if (process.env.NODE_ENV !== 'production') {
|
|
46
46
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
|
@@ -49,7 +49,7 @@ For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.` : (0, _formatMuiErrorMe
|
|
|
49
49
|
return null;
|
|
50
50
|
}
|
|
51
51
|
const [, containerQuery, containerName] = matches;
|
|
52
|
-
const value = Number.isNaN(+containerQuery) ? containerQuery : +containerQuery;
|
|
52
|
+
const value = Number.isNaN(+containerQuery) ? containerQuery || 0 : +containerQuery;
|
|
53
53
|
return theme.containerQueries(containerName).up(value);
|
|
54
54
|
}
|
|
55
55
|
function cssContainerQueries(themeInput) {
|
|
@@ -63,7 +63,7 @@ function cssContainerQueries(themeInput) {
|
|
|
63
63
|
const result = toContainerQuery(themeInput.breakpoints.not(...args), name);
|
|
64
64
|
if (result.includes('not all and')) {
|
|
65
65
|
// `@container` does not work with `not all and`, so need to invert the logic
|
|
66
|
-
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>');
|
|
66
|
+
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>').replace('and', 'or');
|
|
67
67
|
}
|
|
68
68
|
return result;
|
|
69
69
|
};
|
package/node/index.js
CHANGED
|
@@ -38,25 +38,17 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
38
38
|
return defaultMatches;
|
|
39
39
|
});
|
|
40
40
|
(0, _useEnhancedEffect.default)(() => {
|
|
41
|
-
let active = true;
|
|
42
41
|
if (!matchMedia) {
|
|
43
42
|
return undefined;
|
|
44
43
|
}
|
|
45
44
|
const queryList = matchMedia(query);
|
|
46
45
|
const updateMatch = () => {
|
|
47
|
-
|
|
48
|
-
// TODO can we remove it?
|
|
49
|
-
// https://github.com/mui/material-ui/pull/17315#issuecomment-528286677
|
|
50
|
-
if (active) {
|
|
51
|
-
setMatch(queryList.matches);
|
|
52
|
-
}
|
|
46
|
+
setMatch(queryList.matches);
|
|
53
47
|
};
|
|
54
48
|
updateMatch();
|
|
55
|
-
|
|
56
|
-
queryList.addListener(updateMatch);
|
|
49
|
+
queryList.addEventListener('change', updateMatch);
|
|
57
50
|
return () => {
|
|
58
|
-
|
|
59
|
-
queryList.removeListener(updateMatch);
|
|
51
|
+
queryList.removeEventListener('change', updateMatch);
|
|
60
52
|
};
|
|
61
53
|
}, [query, matchMedia]);
|
|
62
54
|
return match;
|
|
@@ -84,10 +76,9 @@ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
84
76
|
}
|
|
85
77
|
const mediaQueryList = matchMedia(query);
|
|
86
78
|
return [() => mediaQueryList.matches, notify => {
|
|
87
|
-
|
|
88
|
-
mediaQueryList.addListener(notify);
|
|
79
|
+
mediaQueryList.addEventListener('change', notify);
|
|
89
80
|
return () => {
|
|
90
|
-
mediaQueryList.
|
|
81
|
+
mediaQueryList.removeEventListener('change', notify);
|
|
91
82
|
};
|
|
92
83
|
}];
|
|
93
84
|
}, [getDefaultSnapshot, matchMedia, query]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "MUI System is a set of CSS utilities to help you build custom designs more efficiently. It makes it possible to rapidly lay out custom designs.",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"url": "https://opencollective.com/mui-org"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "^7.24.
|
|
29
|
+
"@babel/runtime": "^7.24.7",
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
31
|
"csstype": "^3.1.3",
|
|
32
32
|
"prop-types": "^15.8.1",
|
|
33
|
-
"@mui/
|
|
34
|
-
"@mui/
|
|
35
|
-
"@mui/
|
|
36
|
-
"@mui/
|
|
33
|
+
"@mui/private-theming": "^6.0.0-alpha.11",
|
|
34
|
+
"@mui/styled-engine": "^6.0.0-alpha.11",
|
|
35
|
+
"@mui/utils": "^6.0.0-alpha.11",
|
|
36
|
+
"@mui/types": "^7.2.14"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@emotion/react": "^11.5.0",
|
|
@@ -31,25 +31,17 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
31
31
|
return defaultMatches;
|
|
32
32
|
});
|
|
33
33
|
useEnhancedEffect(() => {
|
|
34
|
-
let active = true;
|
|
35
34
|
if (!matchMedia) {
|
|
36
35
|
return undefined;
|
|
37
36
|
}
|
|
38
37
|
const queryList = matchMedia(query);
|
|
39
38
|
const updateMatch = () => {
|
|
40
|
-
|
|
41
|
-
// TODO can we remove it?
|
|
42
|
-
// https://github.com/mui/material-ui/pull/17315#issuecomment-528286677
|
|
43
|
-
if (active) {
|
|
44
|
-
setMatch(queryList.matches);
|
|
45
|
-
}
|
|
39
|
+
setMatch(queryList.matches);
|
|
46
40
|
};
|
|
47
41
|
updateMatch();
|
|
48
|
-
|
|
49
|
-
queryList.addListener(updateMatch);
|
|
42
|
+
queryList.addEventListener('change', updateMatch);
|
|
50
43
|
return () => {
|
|
51
|
-
|
|
52
|
-
queryList.removeListener(updateMatch);
|
|
44
|
+
queryList.removeEventListener('change', updateMatch);
|
|
53
45
|
};
|
|
54
46
|
}, [query, matchMedia]);
|
|
55
47
|
return match;
|
|
@@ -77,10 +69,9 @@ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
77
69
|
}
|
|
78
70
|
const mediaQueryList = matchMedia(query);
|
|
79
71
|
return [() => mediaQueryList.matches, notify => {
|
|
80
|
-
|
|
81
|
-
mediaQueryList.addListener(notify);
|
|
72
|
+
mediaQueryList.addEventListener('change', notify);
|
|
82
73
|
return () => {
|
|
83
|
-
mediaQueryList.
|
|
74
|
+
mediaQueryList.removeEventListener('change', notify);
|
|
84
75
|
};
|
|
85
76
|
}];
|
|
86
77
|
}, [getDefaultSnapshot, matchMedia, query]);
|