@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,4 +0,0 @@
1
- 'use client';
2
-
3
- export { default } from './createStyled';
4
- export * from './createStyled';
@@ -1,73 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- /**
3
- * A universal utility to style components with multiple color modes. Always use it from the theme object.
4
- * It works with:
5
- * - [Basic theme](https://mui.com/material-ui/customization/dark-mode/)
6
- * - [CSS theme variables](https://mui.com/material-ui/experimental-api/css-theme-variables/overview/)
7
- * - Zero-runtime engine
8
- *
9
- * Tips: Use an array over object spread and place `theme.applyStyles()` last.
10
- *
11
- * ✅ [{ background: '#e5e5e5' }, theme.applyStyles('dark', { background: '#1c1c1c' })]
12
- *
13
- * 🚫 { background: '#e5e5e5', ...theme.applyStyles('dark', { background: '#1c1c1c' })}
14
- *
15
- * @example
16
- * 1. using with `styled`:
17
- * ```jsx
18
- * const Component = styled('div')(({ theme }) => [
19
- * { background: '#e5e5e5' },
20
- * theme.applyStyles('dark', {
21
- * background: '#1c1c1c',
22
- * color: '#fff',
23
- * }),
24
- * ]);
25
- * ```
26
- *
27
- * @example
28
- * 2. using with `sx` prop:
29
- * ```jsx
30
- * <Box sx={theme => [
31
- * { background: '#e5e5e5' },
32
- * theme.applyStyles('dark', {
33
- * background: '#1c1c1c',
34
- * color: '#fff',
35
- * }),
36
- * ]}
37
- * />
38
- * ```
39
- *
40
- * @example
41
- * 3. theming a component:
42
- * ```jsx
43
- * extendTheme({
44
- * components: {
45
- * MuiButton: {
46
- * styleOverrides: {
47
- * root: ({ theme }) => [
48
- * { background: '#e5e5e5' },
49
- * theme.applyStyles('dark', {
50
- * background: '#1c1c1c',
51
- * color: '#fff',
52
- * }),
53
- * ],
54
- * },
55
- * }
56
- * }
57
- * })
58
- *```
59
- */
60
- export default function applyStyles(key, styles) {
61
- // @ts-expect-error this is 'any' type
62
- var theme = this;
63
- if (theme.vars && typeof theme.getColorSchemeSelector === 'function') {
64
- // If CssVarsProvider is used as a provider,
65
- // returns '* :where([data-mui-color-scheme="light|dark"]) &'
66
- var selector = theme.getColorSchemeSelector(key).replace(/(\[[^\]]+\])/, '*:where($1)');
67
- return _defineProperty({}, selector, styles);
68
- }
69
- if (theme.palette.mode === key) {
70
- return styles;
71
- }
72
- return {};
73
- }
@@ -1,83 +0,0 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _extends from "@babel/runtime/helpers/esm/extends";
4
- // Sorted ASC by size. That's important.
5
- // It can't be configured as it's used statically for propTypes.
6
- export var breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
7
- var sortBreakpointsValues = function sortBreakpointsValues(values) {
8
- var breakpointsAsArray = Object.keys(values).map(function (key) {
9
- return {
10
- key: key,
11
- val: values[key]
12
- };
13
- }) || [];
14
- // Sort in ascending order
15
- breakpointsAsArray.sort(function (breakpoint1, breakpoint2) {
16
- return breakpoint1.val - breakpoint2.val;
17
- });
18
- return breakpointsAsArray.reduce(function (acc, obj) {
19
- return _extends({}, acc, _defineProperty({}, obj.key, obj.val));
20
- }, {});
21
- };
22
-
23
- // Keep in mind that @media is inclusive by the CSS specification.
24
- export default function createBreakpoints(breakpoints) {
25
- var _breakpoints$values = breakpoints.values,
26
- values = _breakpoints$values === void 0 ? {
27
- xs: 0,
28
- // phone
29
- sm: 600,
30
- // tablet
31
- md: 900,
32
- // small laptop
33
- lg: 1200,
34
- // desktop
35
- xl: 1536 // large screen
36
- } : _breakpoints$values,
37
- _breakpoints$unit = breakpoints.unit,
38
- unit = _breakpoints$unit === void 0 ? 'px' : _breakpoints$unit,
39
- _breakpoints$step = breakpoints.step,
40
- step = _breakpoints$step === void 0 ? 5 : _breakpoints$step,
41
- other = _objectWithoutProperties(breakpoints, ["values", "unit", "step"]);
42
- var sortedValues = sortBreakpointsValues(values);
43
- var keys = Object.keys(sortedValues);
44
- function up(key) {
45
- var value = typeof values[key] === 'number' ? values[key] : key;
46
- return "@media (min-width:".concat(value).concat(unit, ")");
47
- }
48
- function down(key) {
49
- var value = typeof values[key] === 'number' ? values[key] : key;
50
- return "@media (max-width:".concat(value - step / 100).concat(unit, ")");
51
- }
52
- function between(start, end) {
53
- var endIndex = keys.indexOf(end);
54
- return "@media (min-width:".concat(typeof values[start] === 'number' ? values[start] : start).concat(unit, ") and ") + "(max-width:".concat((endIndex !== -1 && typeof values[keys[endIndex]] === 'number' ? values[keys[endIndex]] : end) - step / 100).concat(unit, ")");
55
- }
56
- function only(key) {
57
- if (keys.indexOf(key) + 1 < keys.length) {
58
- return between(key, keys[keys.indexOf(key) + 1]);
59
- }
60
- return up(key);
61
- }
62
- function not(key) {
63
- // handle first and last key separately, for better readability
64
- var keyIndex = keys.indexOf(key);
65
- if (keyIndex === 0) {
66
- return up(keys[1]);
67
- }
68
- if (keyIndex === keys.length - 1) {
69
- return down(keys[keyIndex]);
70
- }
71
- return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
72
- }
73
- return _extends({
74
- keys: keys,
75
- values: sortedValues,
76
- up: up,
77
- down: down,
78
- between: between,
79
- only: only,
80
- not: not,
81
- unit: unit
82
- }, other);
83
- }
@@ -1,36 +0,0 @@
1
- import { createUnarySpacing } from '../spacing';
2
-
3
- // The different signatures imply different meaning for their arguments that can't be expressed structurally.
4
- // We express the difference with variable names.
5
-
6
- export default function createSpacing() {
7
- var spacingInput = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 8;
8
- // Already transformed.
9
- if (spacingInput.mui) {
10
- return spacingInput;
11
- }
12
-
13
- // Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout.
14
- // Smaller components, such as icons, can align to a 4dp grid.
15
- // https://m2.material.io/design/layout/understanding-layout.html
16
- var transform = createUnarySpacing({
17
- spacing: spacingInput
18
- });
19
- var spacing = function spacing() {
20
- for (var _len = arguments.length, argsInput = new Array(_len), _key = 0; _key < _len; _key++) {
21
- argsInput[_key] = arguments[_key];
22
- }
23
- if (process.env.NODE_ENV !== 'production') {
24
- if (!(argsInput.length <= 4)) {
25
- console.error("MUI: Too many arguments provided, expected between 0 and 4, got ".concat(argsInput.length));
26
- }
27
- }
28
- var args = argsInput.length === 0 ? [1] : argsInput;
29
- return args.map(function (argument) {
30
- var output = transform(argument);
31
- return typeof output === 'number' ? "".concat(output, "px") : output;
32
- }).join(' ');
33
- };
34
- spacing.mui = true;
35
- return spacing;
36
- }
@@ -1,49 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import deepmerge from '@mui/utils/deepmerge';
4
- import createBreakpoints from './createBreakpoints';
5
- import shape from './shape';
6
- import createSpacing from './createSpacing';
7
- import styleFunctionSx from '../styleFunctionSx/styleFunctionSx';
8
- import defaultSxConfig from '../styleFunctionSx/defaultSxConfig';
9
- import applyStyles from './applyStyles';
10
- function createTheme() {
11
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
- var _options$breakpoints = options.breakpoints,
13
- breakpointsInput = _options$breakpoints === void 0 ? {} : _options$breakpoints,
14
- _options$palette = options.palette,
15
- paletteInput = _options$palette === void 0 ? {} : _options$palette,
16
- spacingInput = options.spacing,
17
- _options$shape = options.shape,
18
- shapeInput = _options$shape === void 0 ? {} : _options$shape,
19
- other = _objectWithoutProperties(options, ["breakpoints", "palette", "spacing", "shape"]);
20
- var breakpoints = createBreakpoints(breakpointsInput);
21
- var spacing = createSpacing(spacingInput);
22
- var muiTheme = deepmerge({
23
- breakpoints: breakpoints,
24
- direction: 'ltr',
25
- components: {},
26
- // Inject component definitions.
27
- palette: _extends({
28
- mode: 'light'
29
- }, paletteInput),
30
- spacing: spacing,
31
- shape: _extends({}, shape, shapeInput)
32
- }, other);
33
- muiTheme.applyStyles = applyStyles;
34
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
35
- args[_key - 1] = arguments[_key];
36
- }
37
- muiTheme = args.reduce(function (acc, argument) {
38
- return deepmerge(acc, argument);
39
- }, muiTheme);
40
- muiTheme.unstable_sxConfig = _extends({}, defaultSxConfig, other == null ? void 0 : other.unstable_sxConfig);
41
- muiTheme.unstable_sx = function sx(props) {
42
- return styleFunctionSx({
43
- sx: props,
44
- theme: this
45
- });
46
- };
47
- return muiTheme;
48
- }
49
- export default createTheme;
@@ -1,3 +0,0 @@
1
- export { default } from './createTheme';
2
- export { default as private_createBreakpoints } from './createBreakpoints';
3
- export { default as unstable_applyStyles } from './applyStyles';
@@ -1,4 +0,0 @@
1
- var shape = {
2
- borderRadius: 4
3
- };
4
- export default shape;
@@ -1,91 +0,0 @@
1
- import style from '../style';
2
- import compose from '../compose';
3
- import { createUnaryUnit, getValue } from '../spacing';
4
- import { handleBreakpoints } from '../breakpoints';
5
- import responsivePropType from '../responsivePropType';
6
-
7
- // false positive
8
- // eslint-disable-next-line react/function-component-definition
9
- export var gap = function gap(props) {
10
- if (props.gap !== undefined && props.gap !== null) {
11
- var transformer = createUnaryUnit(props.theme, 'spacing', 8, 'gap');
12
- var styleFromPropValue = function styleFromPropValue(propValue) {
13
- return {
14
- gap: getValue(transformer, propValue)
15
- };
16
- };
17
- return handleBreakpoints(props, props.gap, styleFromPropValue);
18
- }
19
- return null;
20
- };
21
- gap.propTypes = process.env.NODE_ENV !== 'production' ? {
22
- gap: responsivePropType
23
- } : {};
24
- gap.filterProps = ['gap'];
25
-
26
- // false positive
27
- // eslint-disable-next-line react/function-component-definition
28
- export var columnGap = function columnGap(props) {
29
- if (props.columnGap !== undefined && props.columnGap !== null) {
30
- var transformer = createUnaryUnit(props.theme, 'spacing', 8, 'columnGap');
31
- var styleFromPropValue = function styleFromPropValue(propValue) {
32
- return {
33
- columnGap: getValue(transformer, propValue)
34
- };
35
- };
36
- return handleBreakpoints(props, props.columnGap, styleFromPropValue);
37
- }
38
- return null;
39
- };
40
- columnGap.propTypes = process.env.NODE_ENV !== 'production' ? {
41
- columnGap: responsivePropType
42
- } : {};
43
- columnGap.filterProps = ['columnGap'];
44
-
45
- // false positive
46
- // eslint-disable-next-line react/function-component-definition
47
- export var rowGap = function rowGap(props) {
48
- if (props.rowGap !== undefined && props.rowGap !== null) {
49
- var transformer = createUnaryUnit(props.theme, 'spacing', 8, 'rowGap');
50
- var styleFromPropValue = function styleFromPropValue(propValue) {
51
- return {
52
- rowGap: getValue(transformer, propValue)
53
- };
54
- };
55
- return handleBreakpoints(props, props.rowGap, styleFromPropValue);
56
- }
57
- return null;
58
- };
59
- rowGap.propTypes = process.env.NODE_ENV !== 'production' ? {
60
- rowGap: responsivePropType
61
- } : {};
62
- rowGap.filterProps = ['rowGap'];
63
- export var gridColumn = style({
64
- prop: 'gridColumn'
65
- });
66
- export var gridRow = style({
67
- prop: 'gridRow'
68
- });
69
- export var gridAutoFlow = style({
70
- prop: 'gridAutoFlow'
71
- });
72
- export var gridAutoColumns = style({
73
- prop: 'gridAutoColumns'
74
- });
75
- export var gridAutoRows = style({
76
- prop: 'gridAutoRows'
77
- });
78
- export var gridTemplateColumns = style({
79
- prop: 'gridTemplateColumns'
80
- });
81
- export var gridTemplateRows = style({
82
- prop: 'gridTemplateRows'
83
- });
84
- export var gridTemplateAreas = style({
85
- prop: 'gridTemplateAreas'
86
- });
87
- export var gridArea = style({
88
- prop: 'gridArea'
89
- });
90
- var grid = compose(gap, columnGap, rowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea);
91
- export default grid;
@@ -1,4 +0,0 @@
1
- 'use client';
2
-
3
- export { default } from './cssGrid';
4
- export * from './cssGrid';