@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.
Files changed (141) hide show
  1. package/CHANGELOG.md +243 -4
  2. package/Container/Container.d.ts +1 -1
  3. package/Stack/Stack.d.ts +1 -1
  4. package/Stack/createStack.d.ts +1 -1
  5. package/Unstable_Grid/Grid.d.ts +1 -1
  6. package/Unstable_Grid/createGrid.d.ts +1 -1
  7. package/breakpoints/breakpoints.js +19 -1
  8. package/createTheme/createSpacing.d.ts +2 -2
  9. package/createTheme/createSpacing.js +7 -8
  10. package/createTheme/createTheme.d.ts +2 -1
  11. package/createTheme/createTheme.js +2 -0
  12. package/cssContainerQueries/cssContainerQueries.d.ts +24 -0
  13. package/cssContainerQueries/cssContainerQueries.js +68 -0
  14. package/cssContainerQueries/index.d.ts +3 -0
  15. package/cssContainerQueries/index.js +2 -0
  16. package/cssContainerQueries/package.json +6 -0
  17. package/cssVars/createCssVarsProvider.js +3 -0
  18. package/cssVars/cssVarsParser.d.ts +1 -1
  19. package/cssVars/cssVarsParser.js +3 -2
  20. package/index.d.ts +2 -0
  21. package/index.js +2 -1
  22. package/modern/breakpoints/breakpoints.js +19 -1
  23. package/modern/createTheme/createSpacing.js +7 -8
  24. package/modern/createTheme/createTheme.js +2 -0
  25. package/modern/cssContainerQueries/cssContainerQueries.js +68 -0
  26. package/modern/cssContainerQueries/index.js +2 -0
  27. package/modern/cssVars/createCssVarsProvider.js +3 -0
  28. package/modern/cssVars/cssVarsParser.js +3 -2
  29. package/modern/index.js +2 -1
  30. package/modern/spacing/spacing.js +24 -21
  31. package/modern/styleFunctionSx/styleFunctionSx.js +2 -1
  32. package/node/breakpoints/breakpoints.js +19 -1
  33. package/node/createTheme/createSpacing.js +7 -8
  34. package/node/createTheme/createTheme.js +2 -0
  35. package/node/cssContainerQueries/cssContainerQueries.js +79 -0
  36. package/node/cssContainerQueries/index.js +32 -0
  37. package/node/cssVars/createCssVarsProvider.js +3 -0
  38. package/node/cssVars/cssVarsParser.js +3 -2
  39. package/node/index.js +9 -1
  40. package/node/spacing/spacing.js +24 -21
  41. package/node/styleFunctionSx/styleFunctionSx.js +2 -1
  42. package/package.json +5 -5
  43. package/spacing/spacing.js +24 -21
  44. package/styleFunctionSx/styleFunctionSx.js +2 -1
  45. package/legacy/Box/Box.js +0 -30
  46. package/legacy/Box/boxClasses.js +0 -3
  47. package/legacy/Box/index.js +0 -5
  48. package/legacy/Container/Container.js +0 -61
  49. package/legacy/Container/ContainerProps.js +0 -1
  50. package/legacy/Container/containerClasses.js +0 -7
  51. package/legacy/Container/createContainer.js +0 -140
  52. package/legacy/Container/index.js +0 -5
  53. package/legacy/GlobalStyles/GlobalStyles.js +0 -37
  54. package/legacy/GlobalStyles/index.js +0 -4
  55. package/legacy/RtlProvider/index.js +0 -22
  56. package/legacy/Stack/Stack.js +0 -62
  57. package/legacy/Stack/StackProps.js +0 -1
  58. package/legacy/Stack/createStack.js +0 -180
  59. package/legacy/Stack/index.js +0 -7
  60. package/legacy/Stack/stackClasses.js +0 -7
  61. package/legacy/ThemeProvider/ThemeProvider.js +0 -87
  62. package/legacy/ThemeProvider/index.js +0 -3
  63. package/legacy/Unstable_Grid/Grid.js +0 -177
  64. package/legacy/Unstable_Grid/GridProps.js +0 -1
  65. package/legacy/Unstable_Grid/createGrid.js +0 -184
  66. package/legacy/Unstable_Grid/gridClasses.js +0 -28
  67. package/legacy/Unstable_Grid/gridGenerator.js +0 -216
  68. package/legacy/Unstable_Grid/index.js +0 -8
  69. package/legacy/Unstable_Grid/traverseBreakpoints.js +0 -48
  70. package/legacy/borders/borders.js +0 -51
  71. package/legacy/borders/index.js +0 -4
  72. package/legacy/breakpoints/breakpoints.js +0 -162
  73. package/legacy/breakpoints/index.js +0 -4
  74. package/legacy/colorManipulator/colorManipulator.js +0 -356
  75. package/legacy/colorManipulator/index.js +0 -3
  76. package/legacy/compose/compose.js +0 -32
  77. package/legacy/compose/index.js +0 -3
  78. package/legacy/createBox/createBox.js +0 -38
  79. package/legacy/createBox/index.js +0 -3
  80. package/legacy/createStyled/createStyled.js +0 -250
  81. package/legacy/createStyled/index.js +0 -4
  82. package/legacy/createTheme/applyStyles.js +0 -73
  83. package/legacy/createTheme/createBreakpoints.js +0 -83
  84. package/legacy/createTheme/createSpacing.js +0 -36
  85. package/legacy/createTheme/createTheme.js +0 -49
  86. package/legacy/createTheme/index.js +0 -3
  87. package/legacy/createTheme/shape.js +0 -4
  88. package/legacy/cssGrid/cssGrid.js +0 -91
  89. package/legacy/cssGrid/index.js +0 -4
  90. package/legacy/cssVars/createCssVarsProvider.js +0 -335
  91. package/legacy/cssVars/createCssVarsTheme.js +0 -13
  92. package/legacy/cssVars/createGetCssVar.js +0 -30
  93. package/legacy/cssVars/cssVarsParser.js +0 -140
  94. package/legacy/cssVars/getInitColorSchemeScript.js +0 -28
  95. package/legacy/cssVars/index.js +0 -6
  96. package/legacy/cssVars/prepareCssVars.js +0 -92
  97. package/legacy/cssVars/useCurrentColorScheme.js +0 -237
  98. package/legacy/display/display.js +0 -29
  99. package/legacy/display/index.js +0 -4
  100. package/legacy/flexbox/flexbox.js +0 -43
  101. package/legacy/flexbox/index.js +0 -4
  102. package/legacy/getThemeValue/getThemeValue.js +0 -47
  103. package/legacy/getThemeValue/index.js +0 -4
  104. package/legacy/index.js +0 -72
  105. package/legacy/memoize/index.js +0 -3
  106. package/legacy/memoize/memoize.js +0 -9
  107. package/legacy/merge/index.js +0 -3
  108. package/legacy/merge/merge.js +0 -10
  109. package/legacy/palette/index.js +0 -4
  110. package/legacy/palette/palette.js +0 -26
  111. package/legacy/positions/index.js +0 -4
  112. package/legacy/positions/positions.js +0 -22
  113. package/legacy/propsToClassKey/index.js +0 -3
  114. package/legacy/propsToClassKey/propsToClassKey.js +0 -24
  115. package/legacy/responsivePropType/index.js +0 -3
  116. package/legacy/responsivePropType/responsivePropType.js +0 -3
  117. package/legacy/shadows/index.js +0 -3
  118. package/legacy/shadows/shadows.js +0 -6
  119. package/legacy/sizing/index.js +0 -4
  120. package/legacy/sizing/sizing.js +0 -65
  121. package/legacy/spacing/index.js +0 -4
  122. package/legacy/spacing/spacing.js +0 -158
  123. package/legacy/style/index.js +0 -4
  124. package/legacy/style/style.js +0 -73
  125. package/legacy/styleFunctionSx/defaultSxConfig.js +0 -293
  126. package/legacy/styleFunctionSx/extendSxProp.js +0 -45
  127. package/legacy/styleFunctionSx/index.js +0 -4
  128. package/legacy/styleFunctionSx/styleFunctionSx.js +0 -126
  129. package/legacy/styled/index.js +0 -3
  130. package/legacy/styled/styled.js +0 -3
  131. package/legacy/typography/index.js +0 -4
  132. package/legacy/typography/typography.js +0 -37
  133. package/legacy/useMediaQuery/index.js +0 -2
  134. package/legacy/useMediaQuery/useMediaQuery.js +0 -145
  135. package/legacy/useTheme/index.js +0 -4
  136. package/legacy/useTheme/useTheme.js +0 -10
  137. package/legacy/useThemeProps/getThemeProps.js +0 -10
  138. package/legacy/useThemeProps/index.js +0 -4
  139. package/legacy/useThemeProps/useThemeProps.js +0 -20
  140. package/legacy/useThemeWithoutDefault/index.js +0 -3
  141. package/legacy/useThemeWithoutDefault/useThemeWithoutDefault.js +0 -13
@@ -1,3 +0,0 @@
1
- 'use client';
2
-
3
- export { default } from './styled';
@@ -1,3 +0,0 @@
1
- import createStyled from '../createStyled';
2
- var styled = createStyled();
3
- export default styled;
@@ -1,4 +0,0 @@
1
- 'use client';
2
-
3
- export { default } from './typography';
4
- export * from './typography';
@@ -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,2 +0,0 @@
1
- export { default } from './useMediaQuery';
2
- export * from './useMediaQuery';
@@ -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
- }
@@ -1,4 +0,0 @@
1
- 'use client';
2
-
3
- export { default } from './useTheme';
4
- export * from './useTheme';
@@ -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,4 +0,0 @@
1
- 'use client';
2
-
3
- export { default } from './useThemeProps';
4
- export { default as getThemeProps } from './getThemeProps';
@@ -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,3 +0,0 @@
1
- 'use client';
2
-
3
- export { default } from './useThemeWithoutDefault';
@@ -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;