@mui/system 6.0.0-alpha.0 → 6.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +243 -4
- package/Container/Container.d.ts +1 -1
- package/Stack/Stack.d.ts +1 -1
- package/Stack/createStack.d.ts +1 -1
- package/Unstable_Grid/Grid.d.ts +1 -1
- package/Unstable_Grid/createGrid.d.ts +1 -1
- package/breakpoints/breakpoints.js +19 -1
- package/createTheme/createSpacing.d.ts +2 -2
- package/createTheme/createSpacing.js +7 -8
- package/createTheme/createTheme.d.ts +2 -1
- package/createTheme/createTheme.js +2 -0
- package/cssContainerQueries/cssContainerQueries.d.ts +24 -0
- package/cssContainerQueries/cssContainerQueries.js +68 -0
- package/cssContainerQueries/index.d.ts +3 -0
- package/cssContainerQueries/index.js +2 -0
- package/cssContainerQueries/package.json +6 -0
- package/cssVars/createCssVarsProvider.js +3 -0
- package/cssVars/cssVarsParser.d.ts +1 -1
- package/cssVars/cssVarsParser.js +3 -2
- package/index.d.ts +2 -0
- package/index.js +2 -1
- package/modern/breakpoints/breakpoints.js +19 -1
- package/modern/createTheme/createSpacing.js +7 -8
- package/modern/createTheme/createTheme.js +2 -0
- package/modern/cssContainerQueries/cssContainerQueries.js +68 -0
- package/modern/cssContainerQueries/index.js +2 -0
- package/modern/cssVars/createCssVarsProvider.js +3 -0
- package/modern/cssVars/cssVarsParser.js +3 -2
- package/modern/index.js +2 -1
- package/modern/spacing/spacing.js +24 -21
- package/modern/styleFunctionSx/styleFunctionSx.js +2 -1
- package/node/breakpoints/breakpoints.js +19 -1
- package/node/createTheme/createSpacing.js +7 -8
- package/node/createTheme/createTheme.js +2 -0
- package/node/cssContainerQueries/cssContainerQueries.js +79 -0
- package/node/cssContainerQueries/index.js +32 -0
- package/node/cssVars/createCssVarsProvider.js +3 -0
- package/node/cssVars/cssVarsParser.js +3 -2
- package/node/index.js +9 -1
- package/node/spacing/spacing.js +24 -21
- package/node/styleFunctionSx/styleFunctionSx.js +2 -1
- package/package.json +5 -5
- package/spacing/spacing.js +24 -21
- package/styleFunctionSx/styleFunctionSx.js +2 -1
- package/legacy/Box/Box.js +0 -30
- package/legacy/Box/boxClasses.js +0 -3
- package/legacy/Box/index.js +0 -5
- package/legacy/Container/Container.js +0 -61
- package/legacy/Container/ContainerProps.js +0 -1
- package/legacy/Container/containerClasses.js +0 -7
- package/legacy/Container/createContainer.js +0 -140
- package/legacy/Container/index.js +0 -5
- package/legacy/GlobalStyles/GlobalStyles.js +0 -37
- package/legacy/GlobalStyles/index.js +0 -4
- package/legacy/RtlProvider/index.js +0 -22
- package/legacy/Stack/Stack.js +0 -62
- package/legacy/Stack/StackProps.js +0 -1
- package/legacy/Stack/createStack.js +0 -180
- package/legacy/Stack/index.js +0 -7
- package/legacy/Stack/stackClasses.js +0 -7
- package/legacy/ThemeProvider/ThemeProvider.js +0 -87
- package/legacy/ThemeProvider/index.js +0 -3
- package/legacy/Unstable_Grid/Grid.js +0 -177
- package/legacy/Unstable_Grid/GridProps.js +0 -1
- package/legacy/Unstable_Grid/createGrid.js +0 -184
- package/legacy/Unstable_Grid/gridClasses.js +0 -28
- package/legacy/Unstable_Grid/gridGenerator.js +0 -216
- package/legacy/Unstable_Grid/index.js +0 -8
- package/legacy/Unstable_Grid/traverseBreakpoints.js +0 -48
- package/legacy/borders/borders.js +0 -51
- package/legacy/borders/index.js +0 -4
- package/legacy/breakpoints/breakpoints.js +0 -162
- package/legacy/breakpoints/index.js +0 -4
- package/legacy/colorManipulator/colorManipulator.js +0 -356
- package/legacy/colorManipulator/index.js +0 -3
- package/legacy/compose/compose.js +0 -32
- package/legacy/compose/index.js +0 -3
- package/legacy/createBox/createBox.js +0 -38
- package/legacy/createBox/index.js +0 -3
- package/legacy/createStyled/createStyled.js +0 -250
- package/legacy/createStyled/index.js +0 -4
- package/legacy/createTheme/applyStyles.js +0 -73
- package/legacy/createTheme/createBreakpoints.js +0 -83
- package/legacy/createTheme/createSpacing.js +0 -36
- package/legacy/createTheme/createTheme.js +0 -49
- package/legacy/createTheme/index.js +0 -3
- package/legacy/createTheme/shape.js +0 -4
- package/legacy/cssGrid/cssGrid.js +0 -91
- package/legacy/cssGrid/index.js +0 -4
- package/legacy/cssVars/createCssVarsProvider.js +0 -335
- package/legacy/cssVars/createCssVarsTheme.js +0 -13
- package/legacy/cssVars/createGetCssVar.js +0 -30
- package/legacy/cssVars/cssVarsParser.js +0 -140
- package/legacy/cssVars/getInitColorSchemeScript.js +0 -28
- package/legacy/cssVars/index.js +0 -6
- package/legacy/cssVars/prepareCssVars.js +0 -92
- package/legacy/cssVars/useCurrentColorScheme.js +0 -237
- package/legacy/display/display.js +0 -29
- package/legacy/display/index.js +0 -4
- package/legacy/flexbox/flexbox.js +0 -43
- package/legacy/flexbox/index.js +0 -4
- package/legacy/getThemeValue/getThemeValue.js +0 -47
- package/legacy/getThemeValue/index.js +0 -4
- package/legacy/index.js +0 -72
- package/legacy/memoize/index.js +0 -3
- package/legacy/memoize/memoize.js +0 -9
- package/legacy/merge/index.js +0 -3
- package/legacy/merge/merge.js +0 -10
- package/legacy/palette/index.js +0 -4
- package/legacy/palette/palette.js +0 -26
- package/legacy/positions/index.js +0 -4
- package/legacy/positions/positions.js +0 -22
- package/legacy/propsToClassKey/index.js +0 -3
- package/legacy/propsToClassKey/propsToClassKey.js +0 -24
- package/legacy/responsivePropType/index.js +0 -3
- package/legacy/responsivePropType/responsivePropType.js +0 -3
- package/legacy/shadows/index.js +0 -3
- package/legacy/shadows/shadows.js +0 -6
- package/legacy/sizing/index.js +0 -4
- package/legacy/sizing/sizing.js +0 -65
- package/legacy/spacing/index.js +0 -4
- package/legacy/spacing/spacing.js +0 -158
- package/legacy/style/index.js +0 -4
- package/legacy/style/style.js +0 -73
- package/legacy/styleFunctionSx/defaultSxConfig.js +0 -293
- package/legacy/styleFunctionSx/extendSxProp.js +0 -45
- package/legacy/styleFunctionSx/index.js +0 -4
- package/legacy/styleFunctionSx/styleFunctionSx.js +0 -126
- package/legacy/styled/index.js +0 -3
- package/legacy/styled/styled.js +0 -3
- package/legacy/typography/index.js +0 -4
- package/legacy/typography/typography.js +0 -37
- package/legacy/useMediaQuery/index.js +0 -2
- package/legacy/useMediaQuery/useMediaQuery.js +0 -145
- package/legacy/useTheme/index.js +0 -4
- package/legacy/useTheme/useTheme.js +0 -10
- package/legacy/useThemeProps/getThemeProps.js +0 -10
- package/legacy/useThemeProps/index.js +0 -4
- package/legacy/useThemeProps/useThemeProps.js +0 -20
- package/legacy/useThemeWithoutDefault/index.js +0 -3
- package/legacy/useThemeWithoutDefault/useThemeWithoutDefault.js +0 -13
package/legacy/styled/index.js
DELETED
package/legacy/styled/styled.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import style from '../style';
|
|
2
|
-
import compose from '../compose';
|
|
3
|
-
export var fontFamily = style({
|
|
4
|
-
prop: 'fontFamily',
|
|
5
|
-
themeKey: 'typography'
|
|
6
|
-
});
|
|
7
|
-
export var fontSize = style({
|
|
8
|
-
prop: 'fontSize',
|
|
9
|
-
themeKey: 'typography'
|
|
10
|
-
});
|
|
11
|
-
export var fontStyle = style({
|
|
12
|
-
prop: 'fontStyle',
|
|
13
|
-
themeKey: 'typography'
|
|
14
|
-
});
|
|
15
|
-
export var fontWeight = style({
|
|
16
|
-
prop: 'fontWeight',
|
|
17
|
-
themeKey: 'typography'
|
|
18
|
-
});
|
|
19
|
-
export var letterSpacing = style({
|
|
20
|
-
prop: 'letterSpacing'
|
|
21
|
-
});
|
|
22
|
-
export var textTransform = style({
|
|
23
|
-
prop: 'textTransform'
|
|
24
|
-
});
|
|
25
|
-
export var lineHeight = style({
|
|
26
|
-
prop: 'lineHeight'
|
|
27
|
-
});
|
|
28
|
-
export var textAlign = style({
|
|
29
|
-
prop: 'textAlign'
|
|
30
|
-
});
|
|
31
|
-
export var typographyVariant = style({
|
|
32
|
-
prop: 'typography',
|
|
33
|
-
cssProperty: false,
|
|
34
|
-
themeKey: 'typography'
|
|
35
|
-
});
|
|
36
|
-
var typography = compose(typographyVariant, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign, textTransform);
|
|
37
|
-
export default typography;
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
6
|
-
import { getThemeProps } from '../useThemeProps';
|
|
7
|
-
import useTheme from '../useThemeWithoutDefault';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Not used internally. Use `MediaQueryListEvent` from lib.dom.d.ts instead.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Not used internally. Use `MediaQueryList` from lib.dom.d.ts instead.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Not used internally. Use `(event: MediaQueryListEvent) => void` instead.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
|
22
|
-
var _React$useState = React.useState(function () {
|
|
23
|
-
if (noSsr && matchMedia) {
|
|
24
|
-
return matchMedia(query).matches;
|
|
25
|
-
}
|
|
26
|
-
if (ssrMatchMedia) {
|
|
27
|
-
return ssrMatchMedia(query).matches;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Once the component is mounted, we rely on the
|
|
31
|
-
// event listeners to return the correct matches value.
|
|
32
|
-
return defaultMatches;
|
|
33
|
-
}),
|
|
34
|
-
match = _React$useState[0],
|
|
35
|
-
setMatch = _React$useState[1];
|
|
36
|
-
useEnhancedEffect(function () {
|
|
37
|
-
var active = true;
|
|
38
|
-
if (!matchMedia) {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
var queryList = matchMedia(query);
|
|
42
|
-
var updateMatch = function updateMatch() {
|
|
43
|
-
// Workaround Safari wrong implementation of matchMedia
|
|
44
|
-
// TODO can we remove it?
|
|
45
|
-
// https://github.com/mui/material-ui/pull/17315#issuecomment-528286677
|
|
46
|
-
if (active) {
|
|
47
|
-
setMatch(queryList.matches);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
updateMatch();
|
|
51
|
-
// TODO: Use `addEventListener` once support for Safari < 14 is dropped
|
|
52
|
-
queryList.addListener(updateMatch);
|
|
53
|
-
return function () {
|
|
54
|
-
active = false;
|
|
55
|
-
queryList.removeListener(updateMatch);
|
|
56
|
-
};
|
|
57
|
-
}, [query, matchMedia]);
|
|
58
|
-
return match;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
62
|
-
var maybeReactUseSyncExternalStore = React['useSyncExternalStore' + ''];
|
|
63
|
-
function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
|
64
|
-
var getDefaultSnapshot = React.useCallback(function () {
|
|
65
|
-
return defaultMatches;
|
|
66
|
-
}, [defaultMatches]);
|
|
67
|
-
var getServerSnapshot = React.useMemo(function () {
|
|
68
|
-
if (noSsr && matchMedia) {
|
|
69
|
-
return function () {
|
|
70
|
-
return matchMedia(query).matches;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
if (ssrMatchMedia !== null) {
|
|
74
|
-
var _ssrMatchMedia = ssrMatchMedia(query),
|
|
75
|
-
matches = _ssrMatchMedia.matches;
|
|
76
|
-
return function () {
|
|
77
|
-
return matches;
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
return getDefaultSnapshot;
|
|
81
|
-
}, [getDefaultSnapshot, query, ssrMatchMedia, noSsr, matchMedia]);
|
|
82
|
-
var _React$useMemo = React.useMemo(function () {
|
|
83
|
-
if (matchMedia === null) {
|
|
84
|
-
return [getDefaultSnapshot, function () {
|
|
85
|
-
return function () {};
|
|
86
|
-
}];
|
|
87
|
-
}
|
|
88
|
-
var mediaQueryList = matchMedia(query);
|
|
89
|
-
return [function () {
|
|
90
|
-
return mediaQueryList.matches;
|
|
91
|
-
}, function (notify) {
|
|
92
|
-
// TODO: Use `addEventListener` once support for Safari < 14 is dropped
|
|
93
|
-
mediaQueryList.addListener(notify);
|
|
94
|
-
return function () {
|
|
95
|
-
mediaQueryList.removeListener(notify);
|
|
96
|
-
};
|
|
97
|
-
}];
|
|
98
|
-
}, [getDefaultSnapshot, matchMedia, query]),
|
|
99
|
-
_React$useMemo2 = _slicedToArray(_React$useMemo, 2),
|
|
100
|
-
getSnapshot = _React$useMemo2[0],
|
|
101
|
-
subscribe = _React$useMemo2[1];
|
|
102
|
-
var match = maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
103
|
-
return match;
|
|
104
|
-
}
|
|
105
|
-
export default function useMediaQuery(queryInput) {
|
|
106
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
107
|
-
var theme = useTheme();
|
|
108
|
-
// Wait for jsdom to support the match media feature.
|
|
109
|
-
// All the browsers MUI support have this built-in.
|
|
110
|
-
// This defensive check is here for simplicity.
|
|
111
|
-
// Most of the time, the match media logic isn't central to people tests.
|
|
112
|
-
var supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
113
|
-
var _getThemeProps = getThemeProps({
|
|
114
|
-
name: 'MuiUseMediaQuery',
|
|
115
|
-
props: options,
|
|
116
|
-
theme: theme
|
|
117
|
-
}),
|
|
118
|
-
_getThemeProps$defaul = _getThemeProps.defaultMatches,
|
|
119
|
-
defaultMatches = _getThemeProps$defaul === void 0 ? false : _getThemeProps$defaul,
|
|
120
|
-
_getThemeProps$matchM = _getThemeProps.matchMedia,
|
|
121
|
-
matchMedia = _getThemeProps$matchM === void 0 ? supportMatchMedia ? window.matchMedia : null : _getThemeProps$matchM,
|
|
122
|
-
_getThemeProps$ssrMat = _getThemeProps.ssrMatchMedia,
|
|
123
|
-
ssrMatchMedia = _getThemeProps$ssrMat === void 0 ? null : _getThemeProps$ssrMat,
|
|
124
|
-
_getThemeProps$noSsr = _getThemeProps.noSsr,
|
|
125
|
-
noSsr = _getThemeProps$noSsr === void 0 ? false : _getThemeProps$noSsr;
|
|
126
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
127
|
-
if (typeof queryInput === 'function' && theme === null) {
|
|
128
|
-
console.error(['MUI: The `query` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\n'));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
var query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
|
|
132
|
-
query = query.replace(/^@media( ?)/m, '');
|
|
133
|
-
|
|
134
|
-
// TODO: Drop `useMediaQueryOld` and use `use-sync-external-store` shim in `useMediaQueryNew` once the package is stable
|
|
135
|
-
var useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
|
|
136
|
-
var match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
|
|
137
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
138
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
139
|
-
React.useDebugValue({
|
|
140
|
-
query: query,
|
|
141
|
-
match: match
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
return match;
|
|
145
|
-
}
|
package/legacy/useTheme/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import createTheme from '../createTheme';
|
|
4
|
-
import useThemeWithoutDefault from '../useThemeWithoutDefault';
|
|
5
|
-
export var systemDefaultTheme = createTheme();
|
|
6
|
-
function useTheme() {
|
|
7
|
-
var defaultTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : systemDefaultTheme;
|
|
8
|
-
return useThemeWithoutDefault(defaultTheme);
|
|
9
|
-
}
|
|
10
|
-
export default useTheme;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import resolveProps from '@mui/utils/resolveProps';
|
|
2
|
-
export default function getThemeProps(params) {
|
|
3
|
-
var theme = params.theme,
|
|
4
|
-
name = params.name,
|
|
5
|
-
props = params.props;
|
|
6
|
-
if (!theme || !theme.components || !theme.components[name] || !theme.components[name].defaultProps) {
|
|
7
|
-
return props;
|
|
8
|
-
}
|
|
9
|
-
return resolveProps(theme.components[name].defaultProps, props);
|
|
10
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import getThemeProps from './getThemeProps';
|
|
4
|
-
import useTheme from '../useTheme';
|
|
5
|
-
export default function useThemeProps(_ref) {
|
|
6
|
-
var props = _ref.props,
|
|
7
|
-
name = _ref.name,
|
|
8
|
-
defaultTheme = _ref.defaultTheme,
|
|
9
|
-
themeId = _ref.themeId;
|
|
10
|
-
var theme = useTheme(defaultTheme);
|
|
11
|
-
if (themeId) {
|
|
12
|
-
theme = theme[themeId] || theme;
|
|
13
|
-
}
|
|
14
|
-
var mergedProps = getThemeProps({
|
|
15
|
-
theme: theme,
|
|
16
|
-
name: name,
|
|
17
|
-
props: props
|
|
18
|
-
});
|
|
19
|
-
return mergedProps;
|
|
20
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { ThemeContext } from '@mui/styled-engine';
|
|
5
|
-
function isObjectEmpty(obj) {
|
|
6
|
-
return Object.keys(obj).length === 0;
|
|
7
|
-
}
|
|
8
|
-
function useTheme() {
|
|
9
|
-
var defaultTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
10
|
-
var contextTheme = React.useContext(ThemeContext);
|
|
11
|
-
return !contextTheme || isObjectEmpty(contextTheme) ? defaultTheme : contextTheme;
|
|
12
|
-
}
|
|
13
|
-
export default useTheme;
|