@mui/system 9.0.0-alpha.4 → 9.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/Box/Box.d.mts +1 -1
  2. package/Box/Box.d.ts +1 -1
  3. package/CHANGELOG.md +119 -4
  4. package/Grid/Grid.js +8 -3
  5. package/Grid/Grid.mjs +8 -3
  6. package/Grid/GridProps.d.mts +8 -3
  7. package/Grid/GridProps.d.ts +8 -3
  8. package/Stack/StackProps.d.mts +1 -2
  9. package/Stack/StackProps.d.ts +1 -2
  10. package/Stack/createStack.js +1 -3
  11. package/Stack/createStack.mjs +1 -3
  12. package/breakpoints/breakpoints.d.mts +4 -1
  13. package/breakpoints/breakpoints.d.ts +4 -1
  14. package/breakpoints/breakpoints.js +90 -49
  15. package/breakpoints/breakpoints.mjs +86 -49
  16. package/compose/compose.js +6 -6
  17. package/compose/compose.mjs +6 -6
  18. package/createBox/createBox.js +2 -2
  19. package/createBox/createBox.mjs +2 -2
  20. package/createBreakpoints/createBreakpoints.d.mts +5 -0
  21. package/createBreakpoints/createBreakpoints.d.ts +5 -0
  22. package/createBreakpoints/createBreakpoints.js +5 -0
  23. package/createBreakpoints/createBreakpoints.mjs +5 -0
  24. package/createStyled/createStyled.js +2 -8
  25. package/createStyled/createStyled.mjs +1 -7
  26. package/createTheme/createTheme.js +1 -0
  27. package/createTheme/createTheme.mjs +1 -0
  28. package/cssContainerQueries/cssContainerQueries.d.mts +1 -0
  29. package/cssContainerQueries/cssContainerQueries.d.ts +1 -0
  30. package/cssContainerQueries/cssContainerQueries.js +27 -14
  31. package/cssContainerQueries/cssContainerQueries.mjs +27 -14
  32. package/cssVars/createCssVarsTheme.js +1 -0
  33. package/cssVars/createCssVarsTheme.mjs +1 -0
  34. package/index.js +1 -1
  35. package/index.mjs +1 -1
  36. package/merge/merge.js +4 -3
  37. package/merge/merge.mjs +4 -3
  38. package/package.json +6 -6
  39. package/spacing/spacing.js +45 -45
  40. package/spacing/spacing.mjs +47 -45
  41. package/style/index.d.mts +1 -0
  42. package/style/index.d.ts +1 -0
  43. package/style/index.js +9 -1
  44. package/style/index.mjs +1 -0
  45. package/style/style.d.mts +36 -7
  46. package/style/style.d.ts +36 -7
  47. package/style/style.js +85 -34
  48. package/style/style.mjs +84 -34
  49. package/styleFunctionSx/styleFunctionSx.js +95 -100
  50. package/styleFunctionSx/styleFunctionSx.mjs +98 -102
  51. package/version/index.js +2 -2
  52. package/version/index.mjs +2 -2
package/Box/Box.d.mts CHANGED
@@ -21,7 +21,7 @@ export type SimpleSystemKeys = keyof PropsFor<ComposedStyleFunction<[typeof bord
21
21
  // This is needed as these are used as keys inside AllSystemCSSProperties
22
22
  type StandardSystemKeys = Extract<SimpleSystemKeys, keyof AllSystemCSSProperties>;
23
23
  export type SystemProps<Theme extends object = {}> = { [K in StandardSystemKeys]?: ResponsiveStyleValue<AllSystemCSSProperties[K]> | ((theme: Theme) => ResponsiveStyleValue<AllSystemCSSProperties[K]>) };
24
- export interface BoxOwnProps<Theme extends object = SystemTheme> extends SystemProps<Theme> {
24
+ export interface BoxOwnProps<Theme extends object = SystemTheme> {
25
25
  children?: React.ReactNode;
26
26
  ref?: React.Ref<unknown> | undefined;
27
27
  /**
package/Box/Box.d.ts CHANGED
@@ -21,7 +21,7 @@ export type SimpleSystemKeys = keyof PropsFor<ComposedStyleFunction<[typeof bord
21
21
  // This is needed as these are used as keys inside AllSystemCSSProperties
22
22
  type StandardSystemKeys = Extract<SimpleSystemKeys, keyof AllSystemCSSProperties>;
23
23
  export type SystemProps<Theme extends object = {}> = { [K in StandardSystemKeys]?: ResponsiveStyleValue<AllSystemCSSProperties[K]> | ((theme: Theme) => ResponsiveStyleValue<AllSystemCSSProperties[K]>) };
24
- export interface BoxOwnProps<Theme extends object = SystemTheme> extends SystemProps<Theme> {
24
+ export interface BoxOwnProps<Theme extends object = SystemTheme> {
25
25
  children?: React.ReactNode;
26
26
  ref?: React.Ref<unknown> | undefined;
27
27
  /**
package/CHANGELOG.md CHANGED
@@ -1,5 +1,110 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 9.0.0-beta.1
4
+
5
+ <!-- generated comparing v9.0.0-beta.0..master -->
6
+
7
+ _Apr 2, 2026_
8
+
9
+ A big thanks to the 11 contributors who made this release possible.
10
+
11
+ ### `@mui/material@9.0.0-beta.1`
12
+
13
+ #### Breaking Changes
14
+
15
+ - [grid] Remove 'column' and 'column-reverse' options from `direction` prop (#47564) @sai6855
16
+ - [icons] Remove legacy `*Outline` icons (#48116) @mj12albert
17
+ - [list-item-icon] Use theme spacing instead of hardcoded minWidth (#46597) @adiitxa
18
+
19
+ #### Changes
20
+
21
+ - [all components] Fix `slotProps.transition` types (#48153) @mj12albert
22
+ - [alert][dialog] Accessibility improvements (#48113) @silviuaavram
23
+ - [autocomplete] Fix helper text focusing input when clicked (#48156) @mj12albert
24
+ - [button-base] Add `nativeButton` prop (#47989) @mj12albert
25
+ - [input] Fix high contrast cutoff on first character (#48150) @silviuaavram
26
+ - [menu] Fix empty roving focus container (#48114) @mj12albert
27
+ - [utils] Explicitly register roving tab items with parent (#48122) @mj12albert
28
+
29
+ ### Docs
30
+
31
+ - Fix HTML validation errors (#48107) @Janpot
32
+ - Fix duplicate IDs and HTML validation issues (#48095) @Janpot
33
+ - Fix the dark mode footer row shadow for the Data Grid on the advanced components page (#48149) @arminmeh
34
+ - Improve jsdom section (#48098) @oliviertassinari
35
+ - Update "Deprecated APIs removed" section to h2 in "Upgrade to v9" docs (#48115) @ZeeshanTamboli
36
+ - [docs][progress] Label all demo components (#48143) @mj12albert
37
+ - [docs-infra] Add x-scheduler to component API URL resolver (#48097) @rita-codes
38
+ - [docs-infra] Resolve some redirects (#48165) @Janpot
39
+ - [docs-infra] Update v9 Search Index (#48028) @dav-is
40
+
41
+ ### Core
42
+
43
+ - [code-infra] Discover exports for bundle size report (#48170) @Janpot
44
+ - [internal] Fix use of ellipsis (#48096) @oliviertassinari
45
+ - [test] Add screenshot test for Virtualized Table (#47947) @mnajdova
46
+ - [test] Remove `componentsProp` from `describeConformance` tests (#48142) @ZeeshanTamboli
47
+ - [theme] Do not create channel tokens for custom colors when `nativeColor` is used (#47765) @ZeeshanTamboli
48
+
49
+ All contributors of this release in alphabetical order: @adiitxa, @arminmeh, @dav-is, @Janpot, @mj12albert, @mnajdova, @oliviertassinari, @rita-codes, @sai6855, @silviuaavram, @ZeeshanTamboli
50
+
51
+ ## 9.0.0-beta.0
52
+
53
+ <!-- generated comparing v9.0.0-alpha.4..master -->
54
+
55
+ _Mar 25, 2026_
56
+
57
+ A big thanks to the 8 contributors who made this release possible.
58
+
59
+ ### `@mui/material@9.0.0-beta.0`
60
+
61
+ #### Breaking Changes
62
+
63
+ - [linear-progress] Remove deprecated CSS classes (#48068) @mj12albert
64
+ - [list-item, list-item-text] Remove deprecated props (#48042) @siriwatknp
65
+ - [button-group] Remove deprecated classes (#48043) @siriwatknp
66
+ - [card] Remove deprecated CardHeader props (#47995) @silviuaavram
67
+ - [checkbox][radio][switch] Remove deprecated inputProps and inputRef (#48059) @siriwatknp
68
+ - [chip] Remove deprecated classes (#48046) @silviuaavram
69
+ - [dialog][modal][drawer][swipeabledrawer] Remove deprecated props and classes (#48039) @silviuaavram
70
+ - [divider] Remove deprecated CSS classes (#48075) @siriwatknp
71
+ - [drawer] Remove deprecated CSS classes (#48077) @siriwatknp
72
+ - [image-list-item-bar] Remove deprecated CSS classes (#48064) @siriwatknp
73
+ - [inputs] Remove deprecated props & classes (#48071) @mj12albert
74
+ - [material-ui] Remove unnecessary overridesResolvers from styled components (#48082) @ZeeshanTamboli
75
+ - [material-ui][system] Remove deprecated system props from Box, Stack, Typography (#48072) @siriwatknp
76
+ - [pagination-item] Remove deprecated CSS classes (#48076) @siriwatknp
77
+ - [pagination-item] Remove deprecated props (#48038) @siriwatknp
78
+ - [rating] Remove deprecated IconContainerComponent (#48019) @siriwatknp
79
+ - [select] Remove deprecated CSS classes (#48065) @mj12albert
80
+ - [slider] Remove deprecated CSS classes (#48074) @siriwatknp
81
+ - [step-connector][step-content][step-label] Remove deprecated props and classes (#48058) @siriwatknp
82
+ - [tabs][tab] Remove deprecated CSS classes (#48078) @siriwatknp
83
+ - [table-pagination][table-sort-label] Remove deprecated props and classes (#48060) @siriwatknp
84
+ - [toggle-button-group] Remove deprecated classes (#48061) @siriwatknp
85
+
86
+ #### Changes
87
+
88
+ - [system] Improve performance when using sx prop (#44254) @romgrk
89
+
90
+ ### `@mui/codemod@9.0.0-beta.0`
91
+
92
+ - [codemod] Add missing codemod links in upgrade guide (#48069) @silviuaavram
93
+
94
+ ### Docs
95
+
96
+ - Mention all breaking changes in changelog (#48091) @silviuaavram
97
+ - Fix link to upgrade-to-v9 docs in release CHANGELOG (#48081) @ZeeshanTamboli
98
+
99
+ ### Core
100
+
101
+ - Update browserslistrc (#48085) @silviuaavram
102
+ - [code-infra] Prevent major version updates of bundler/framework packages in bundling fixtures (#48062) @Copilot
103
+ - [code-infra][icons-material] Avoid material utils barrel in createSvgIcon (#48029) @anchmelev
104
+ - [docs-infra] Migrate more leaf components to mui-docs (#48018) @brijeshb42
105
+
106
+ All contributors of this release in alphabetical order: @anchmelev, @brijeshb42, @Copilot, @mj12albert, @romgrk, @silviuaavram, @siriwatknp, @ZeeshanTamboli
107
+
3
108
  ## 9.0.0-alpha.4
4
109
 
5
110
  <!-- generated comparing v9.0.0-alpha.3..master -->
@@ -118,7 +223,7 @@ A big thanks to the 11 contributors who made this release possible.
118
223
  - [tablepagination] Format pagination numbers according to locale (#47803) @siriwatknp
119
224
  - [textfield] Use non-native label for `<TextField select/>` (#47958) @mj12albert
120
225
 
121
- Check out the [v9 upgrade guide](https://mui.com/material-ui/migration/upgrade-to-v9/).
226
+ Check out the [v9 upgrade guide](https://next.mui.com/material-ui/migration/upgrade-to-v9/).
122
227
 
123
228
  #### Changes
124
229
 
@@ -167,11 +272,16 @@ A big thanks to the 10 contributors who made this release possible. Here are som
167
272
 
168
273
  ### `@mui/material@9.0.0-alpha.3`
169
274
 
275
+ #### Breaking Changes
276
+
277
+ - [stepper][menulist][tabs] Improve accessibility (#47687) @silviuaavram
278
+
279
+ #### Changes
280
+
170
281
  - [autocomplete] Add `root` slot (#47852) @GerardasB
171
282
  - [autocomplete] Fix popup reopening on window focus regain with openOnFocus (#47790) @aman44444
172
283
  - [autocomplete] Support full slots for clearIndicator and popupIndicator (#47891) @silviuaavram
173
284
  - [material-ui] Partially revert "[material-ui] Clean up duplicated CSS rules (#47838)" (#47927) @sai6855
174
- - [stepper][menulist][tabs] Improve accessibility (#47687) @silviuaavram
175
285
 
176
286
  ### Docs
177
287
 
@@ -229,16 +339,21 @@ A big thanks to the 13 contributors who made this release possible. Here are som
229
339
 
230
340
  ### @mui/material@9.0.0-alpha.1
231
341
 
342
+ #### Breaking Changes
343
+
232
344
  - [Autocomplete] Prevents Autocomplete menu from opening on right click (#47797) @silviuaavram
233
345
  - [Backdrop] Remove aria-hidden by default (#47798) @silviuaavram
234
346
  - [ButtonBase] Ensure that onClick propagates when non-native button is clicked (#47800) @silviuaavram
235
347
  - [Dialog][Modal] Remove `disableEscapeKeyDown` prop (#47695) @silviuaavram
236
348
  - [Grid] Remove system props support (#47846) @siriwatknp
237
- - [TableCell][theme] Apply `alpha` before color mixing to border bottom color when nativeColor + cssVariables is used (#47762) @ZeeshanTamboli
238
349
  - [theme] Remove MuiTouchRipple from theme component types (#47849) @siriwatknp
239
- - [Tooltip] Fix error is thrown when wrapping an input which is disabled while focused (#47684) @ZeeshanTamboli
240
350
  - [useAutocomplete] Improve isOptionEqualToValue value argument type (#47801) @silviuaavram
241
351
 
352
+ #### Changes
353
+
354
+ - [TableCell][theme] Apply `alpha` before color mixing to border bottom color when nativeColor + cssVariables is used (#47762) @ZeeshanTamboli
355
+ - [Tooltip] Fix error is thrown when wrapping an input which is disabled while focused (#47684) @ZeeshanTamboli
356
+
242
357
  ### Docs
243
358
 
244
359
  - [docs] Add updated community theme resource (#47847) @PeterTYLiu
package/Grid/Grid.js CHANGED
@@ -45,11 +45,16 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ =
45
45
  */
46
46
  container: _propTypes.default.bool,
47
47
  /**
48
- * Defines the `flex-direction` style property.
49
- * It is applied for all screen sizes.
48
+ * Defines the `flex-direction` style property for the container.
49
+ *
50
+ * ⚠️ Only `row` and `row-reverse` are supported. `column` and `column-reverse` are not supported,
51
+ * because the Grid component is designed to subdivide layouts into **columns**, not rows.
52
+ *
53
+ * For vertical layouts, use `Stack` instead.
54
+ *
50
55
  * @default 'row'
51
56
  */
52
- 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]),
57
+ direction: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['row-reverse', 'row']), _propTypes.default.arrayOf(_propTypes.default.oneOf(['row-reverse', 'row'])), _propTypes.default.object]),
53
58
  /**
54
59
  * Defines the offset value for the type `item` components.
55
60
  */
package/Grid/Grid.mjs CHANGED
@@ -39,11 +39,16 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ =
39
39
  */
40
40
  container: PropTypes.bool,
41
41
  /**
42
- * Defines the `flex-direction` style property.
43
- * It is applied for all screen sizes.
42
+ * Defines the `flex-direction` style property for the container.
43
+ *
44
+ * ⚠️ Only `row` and `row-reverse` are supported. `column` and `column-reverse` are not supported,
45
+ * because the Grid component is designed to subdivide layouts into **columns**, not rows.
46
+ *
47
+ * For vertical layouts, use `Stack` instead.
48
+ *
44
49
  * @default 'row'
45
50
  */
46
- 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]),
51
+ direction: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['row-reverse', 'row'])), PropTypes.object]),
47
52
  /**
48
53
  * Defines the offset value for the type `item` components.
49
54
  */
@@ -3,7 +3,7 @@ import { OverrideProps, PartiallyRequired } from '@mui/types';
3
3
  import { SxProps } from "../styleFunctionSx/index.mjs";
4
4
  import { Theme, Breakpoint } from "../createTheme/index.mjs";
5
5
  type ResponsiveStyleValue<T> = T | Array<T | null> | { [key in Breakpoint]?: T | null };
6
- export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
6
+ export type GridDirection = 'row' | 'row-reverse';
7
7
  export type GridSpacing = number | string;
8
8
  export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
9
9
  export type GridSize = 'auto' | 'grow' | number | false;
@@ -30,8 +30,13 @@ export interface GridBaseProps {
30
30
  */
31
31
  container?: boolean | undefined;
32
32
  /**
33
- * Defines the `flex-direction` style property.
34
- * It is applied for all screen sizes.
33
+ * Defines the `flex-direction` style property for the container.
34
+ *
35
+ * ⚠️ Only `row` and `row-reverse` are supported. `column` and `column-reverse` are not supported,
36
+ * because the Grid component is designed to subdivide layouts into **columns**, not rows.
37
+ *
38
+ * For vertical layouts, use `Stack` instead.
39
+ *
35
40
  * @default 'row'
36
41
  */
37
42
  direction?: ResponsiveStyleValue<GridDirection> | undefined;
@@ -3,7 +3,7 @@ import { OverrideProps, PartiallyRequired } from '@mui/types';
3
3
  import { SxProps } from "../styleFunctionSx/index.js";
4
4
  import { Theme, Breakpoint } from "../createTheme/index.js";
5
5
  type ResponsiveStyleValue<T> = T | Array<T | null> | { [key in Breakpoint]?: T | null };
6
- export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
6
+ export type GridDirection = 'row' | 'row-reverse';
7
7
  export type GridSpacing = number | string;
8
8
  export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
9
9
  export type GridSize = 'auto' | 'grow' | number | false;
@@ -30,8 +30,13 @@ export interface GridBaseProps {
30
30
  */
31
31
  container?: boolean | undefined;
32
32
  /**
33
- * Defines the `flex-direction` style property.
34
- * It is applied for all screen sizes.
33
+ * Defines the `flex-direction` style property for the container.
34
+ *
35
+ * ⚠️ Only `row` and `row-reverse` are supported. `column` and `column-reverse` are not supported,
36
+ * because the Grid component is designed to subdivide layouts into **columns**, not rows.
37
+ *
38
+ * For vertical layouts, use `Stack` instead.
39
+ *
35
40
  * @default 'row'
36
41
  */
37
42
  direction?: ResponsiveStyleValue<GridDirection> | undefined;
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { OverrideProps } from '@mui/types';
3
3
  import { ResponsiveStyleValue, SxProps } from "../styleFunctionSx/index.mjs";
4
- import { SystemProps } from "../Box/index.mjs";
5
4
  import { Theme } from "../createTheme/index.mjs";
6
5
  export interface StackBaseProps {
7
6
  /**
@@ -40,7 +39,7 @@ export interface StackTypeMap<AdditionalProps = {}, DefaultComponent extends Rea
40
39
  * The system prop, which allows defining system overrides as well as additional CSS styles.
41
40
  */
42
41
  sx?: SxProps<Theme> | undefined;
43
- } & SystemProps<Theme>;
42
+ };
44
43
  defaultComponent: DefaultComponent;
45
44
  }
46
45
  export type StackProps<RootComponent extends React.ElementType = StackTypeMap['defaultComponent'], AdditionalProps = {
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { OverrideProps } from '@mui/types';
3
3
  import { ResponsiveStyleValue, SxProps } from "../styleFunctionSx/index.js";
4
- import { SystemProps } from "../Box/index.js";
5
4
  import { Theme } from "../createTheme/index.js";
6
5
  export interface StackBaseProps {
7
6
  /**
@@ -40,7 +39,7 @@ export interface StackTypeMap<AdditionalProps = {}, DefaultComponent extends Rea
40
39
  * The system prop, which allows defining system overrides as well as additional CSS styles.
41
40
  */
42
41
  sx?: SxProps<Theme> | undefined;
43
- } & SystemProps<Theme>;
42
+ };
44
43
  defaultComponent: DefaultComponent;
45
44
  }
46
45
  export type StackProps<RootComponent extends React.ElementType = StackTypeMap['defaultComponent'], AdditionalProps = {
@@ -16,7 +16,6 @@ var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateU
16
16
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
17
17
  var _styled = _interopRequireDefault(require("../styled"));
18
18
  var _useThemeProps = _interopRequireDefault(require("../useThemeProps"));
19
- var _styleFunctionSx = require("../styleFunctionSx");
20
19
  var _createTheme = _interopRequireDefault(require("../createTheme"));
21
20
  var _breakpoints = require("../breakpoints");
22
21
  var _spacing = require("../spacing");
@@ -144,7 +143,6 @@ function createStack(options = {}) {
144
143
  const StackRoot = createStyledComponent(style);
145
144
  const Stack = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
146
145
  const themeProps = useThemeProps(inProps);
147
- const props = (0, _styleFunctionSx.extendSxProp)(themeProps); // `color` type conflicts with html color attribute.
148
146
  const {
149
147
  component = 'div',
150
148
  direction = 'column',
@@ -154,7 +152,7 @@ function createStack(options = {}) {
154
152
  className,
155
153
  useFlexGap = false,
156
154
  ...other
157
- } = props;
155
+ } = themeProps;
158
156
  const ownerState = {
159
157
  direction,
160
158
  spacing,
@@ -8,7 +8,6 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
8
8
  import composeClasses from '@mui/utils/composeClasses';
9
9
  import systemStyled from "../styled/index.mjs";
10
10
  import useThemePropsSystem from "../useThemeProps/index.mjs";
11
- import { extendSxProp } from "../styleFunctionSx/index.mjs";
12
11
  import createTheme from "../createTheme/index.mjs";
13
12
  import { handleBreakpoints, mergeBreakpointsInOrder, resolveBreakpointValues } from "../breakpoints/index.mjs";
14
13
  import { createUnarySpacing, getValue } from "../spacing/index.mjs";
@@ -135,7 +134,6 @@ export default function createStack(options = {}) {
135
134
  const StackRoot = createStyledComponent(style);
136
135
  const Stack = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
137
136
  const themeProps = useThemeProps(inProps);
138
- const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
139
137
  const {
140
138
  component = 'div',
141
139
  direction = 'column',
@@ -145,7 +143,7 @@ export default function createStack(options = {}) {
145
143
  className,
146
144
  useFlexGap = false,
147
145
  ...other
148
- } = props;
146
+ } = themeProps;
149
147
  const ownerState = {
150
148
  direction,
151
149
  spacing,
@@ -1,8 +1,9 @@
1
1
  import { CSSObject } from '@mui/styled-engine';
2
2
  import { Breakpoints } from "../createBreakpoints/createBreakpoints.mjs";
3
- import type { Breakpoint } from "../createTheme/index.mjs";
3
+ import type { Breakpoint, Theme } from "../createTheme/index.mjs";
4
4
  import { ResponsiveStyleValue } from "../styleFunctionSx/index.mjs";
5
5
  import { StyleFunction } from "../style/index.mjs";
6
+ export const DEFAULT_BREAKPOINTS: Breakpoints;
6
7
  export interface ResolveBreakpointValuesOptions<T> {
7
8
  values: ResponsiveStyleValue<T>;
8
9
  breakpoints?: Breakpoints['values'] | undefined;
@@ -10,7 +11,9 @@ export interface ResolveBreakpointValuesOptions<T> {
10
11
  }
11
12
  export function resolveBreakpointValues<T>(options: ResolveBreakpointValuesOptions<T>): Record<string, T>;
12
13
  export function mergeBreakpointsInOrder(breakpoints: Breakpoints, styles: CSSObject[]): CSSObject;
14
+ export function iterateBreakpoints(target: any, theme: Theme, propValue: any, callback: (mediaKey: string | undefined, value: any, initialKey?: string) => any): any;
13
15
  export function handleBreakpoints<Props>(props: Props, propValue: any, styleFromPropValue: (value: any, breakpoint?: Breakpoint) => any): any;
16
+ export function hasBreakpoint(breakpoints: Breakpoints, value: any): boolean;
14
17
  type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
15
18
 
16
19
  /**
@@ -1,8 +1,9 @@
1
1
  import { CSSObject } from '@mui/styled-engine';
2
2
  import { Breakpoints } from "../createBreakpoints/createBreakpoints.js";
3
- import type { Breakpoint } from "../createTheme/index.js";
3
+ import type { Breakpoint, Theme } from "../createTheme/index.js";
4
4
  import { ResponsiveStyleValue } from "../styleFunctionSx/index.js";
5
5
  import { StyleFunction } from "../style/index.js";
6
+ export const DEFAULT_BREAKPOINTS: Breakpoints;
6
7
  export interface ResolveBreakpointValuesOptions<T> {
7
8
  values: ResponsiveStyleValue<T>;
8
9
  breakpoints?: Breakpoints['values'] | undefined;
@@ -10,7 +11,9 @@ export interface ResolveBreakpointValuesOptions<T> {
10
11
  }
11
12
  export function resolveBreakpointValues<T>(options: ResolveBreakpointValuesOptions<T>): Record<string, T>;
12
13
  export function mergeBreakpointsInOrder(breakpoints: Breakpoints, styles: CSSObject[]): CSSObject;
14
+ export function iterateBreakpoints(target: any, theme: Theme, propValue: any, callback: (mediaKey: string | undefined, value: any, initialKey?: string) => any): any;
13
15
  export function handleBreakpoints<Props>(props: Props, propValue: any, styleFromPropValue: (value: any, breakpoint?: Breakpoint) => any): any;
16
+ export function hasBreakpoint(breakpoints: Breakpoints, value: any): boolean;
14
17
  type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
15
18
 
16
19
  /**
@@ -4,18 +4,26 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ exports.DEFAULT_BREAKPOINTS = void 0;
7
8
  exports.computeBreakpointsBase = computeBreakpointsBase;
8
9
  exports.createEmptyBreakpointObject = createEmptyBreakpointObject;
9
10
  exports.default = void 0;
10
11
  exports.handleBreakpoints = handleBreakpoints;
12
+ exports.hasBreakpoint = hasBreakpoint;
13
+ exports.iterateBreakpoints = iterateBreakpoints;
11
14
  exports.mergeBreakpointsInOrder = mergeBreakpointsInOrder;
12
15
  exports.removeUnusedBreakpoints = removeUnusedBreakpoints;
13
16
  exports.resolveBreakpointValues = resolveBreakpointValues;
14
17
  exports.values = void 0;
15
18
  var _propTypes = _interopRequireDefault(require("prop-types"));
19
+ var _isObjectEmpty = _interopRequireDefault(require("@mui/utils/isObjectEmpty"));
20
+ var _fastDeepAssign = _interopRequireDefault(require("@mui/utils/fastDeepAssign"));
16
21
  var _deepmerge = _interopRequireDefault(require("@mui/utils/deepmerge"));
17
22
  var _merge = _interopRequireDefault(require("../merge"));
18
23
  var _cssContainerQueries = require("../cssContainerQueries");
24
+ var _createBreakpoints = _interopRequireDefault(require("../createBreakpoints/createBreakpoints"));
25
+ const EMPTY_THEME = {};
26
+
19
27
  // The breakpoint **start** at this value.
20
28
  // For instance with the first breakpoint xs: [xs, sm[.
21
29
  const values = exports.values = {
@@ -29,12 +37,9 @@ const values = exports.values = {
29
37
  // desktop
30
38
  xl: 1536 // large screen
31
39
  };
32
- const defaultBreakpoints = {
33
- // Sorted ASC by size. That's important.
34
- // It can't be configured as it's used statically for propTypes.
35
- keys: ['xs', 'sm', 'md', 'lg', 'xl'],
36
- up: key => `@media (min-width:${values[key]}px)`
37
- };
40
+ const DEFAULT_BREAKPOINTS = exports.DEFAULT_BREAKPOINTS = (0, _createBreakpoints.default)({
41
+ values
42
+ });
38
43
  const defaultContainerQueries = {
39
44
  containerQueries: containerName => ({
40
45
  up: key => {
@@ -47,44 +52,59 @@ const defaultContainerQueries = {
47
52
  })
48
53
  };
49
54
  function handleBreakpoints(props, propValue, styleFromPropValue) {
50
- const theme = props.theme || {};
55
+ const result = {};
56
+ return iterateBreakpoints(result, props.theme, propValue, (mediaKey, value, initialKey) => {
57
+ const finalValue = styleFromPropValue(value, initialKey);
58
+ if (mediaKey) {
59
+ result[mediaKey] = finalValue;
60
+ } else {
61
+ (0, _fastDeepAssign.default)(result, finalValue);
62
+ }
63
+ });
64
+ }
65
+ function iterateBreakpoints(target, theme, propValue, callback) {
66
+ theme ?? (theme = EMPTY_THEME);
51
67
  if (Array.isArray(propValue)) {
52
- const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
53
- return propValue.reduce((acc, item, index) => {
54
- acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);
55
- return acc;
56
- }, {});
68
+ const breakpoints = theme.breakpoints ?? DEFAULT_BREAKPOINTS;
69
+ for (let i = 0; i < propValue.length; i += 1) {
70
+ buildBreakpoint(target, breakpoints.up(breakpoints.keys[i]), propValue[i], undefined, callback);
71
+ }
72
+ return target;
57
73
  }
58
74
  if (typeof propValue === 'object') {
59
- const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
60
- return Object.keys(propValue).reduce((acc, breakpoint) => {
61
- if ((0, _cssContainerQueries.isCqShorthand)(themeBreakpoints.keys, breakpoint)) {
62
- const containerKey = (0, _cssContainerQueries.getContainerQuery)(theme.containerQueries ? theme : defaultContainerQueries, breakpoint);
75
+ const breakpoints = theme.breakpoints ?? DEFAULT_BREAKPOINTS;
76
+ const breakpointValues = breakpoints.values ?? values;
77
+ for (const key in propValue) {
78
+ if ((0, _cssContainerQueries.isCqShorthand)(breakpoints.keys, key)) {
79
+ const containerKey = (0, _cssContainerQueries.getContainerQuery)(theme.containerQueries ? theme : defaultContainerQueries, key);
63
80
  if (containerKey) {
64
- acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
81
+ buildBreakpoint(target, containerKey, propValue[key], key, callback);
65
82
  }
66
83
  }
67
- // key is breakpoint
68
- else if (Object.keys(themeBreakpoints.values || values).includes(breakpoint)) {
69
- const mediaKey = themeBreakpoints.up(breakpoint);
70
- acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
84
+ // key is key
85
+ else if (key in breakpointValues) {
86
+ const mediaKey = breakpoints.up(key);
87
+ buildBreakpoint(target, mediaKey, propValue[key], key, callback);
71
88
  } else {
72
- const cssKey = breakpoint;
73
- acc[cssKey] = propValue[cssKey];
89
+ const cssKey = key;
90
+ target[cssKey] = propValue[cssKey];
74
91
  }
75
- return acc;
76
- }, {});
92
+ }
93
+ return target;
77
94
  }
78
- const output = styleFromPropValue(propValue);
79
- return output;
95
+ callback(undefined, propValue);
96
+ return target;
97
+ }
98
+ function buildBreakpoint(target, mediaKey, value, initialKey, callback) {
99
+ target[mediaKey] ?? (target[mediaKey] = {});
100
+ callback(mediaKey, value, initialKey);
80
101
  }
81
- function breakpoints(styleFunction) {
82
- // false positive
102
+ function setupBreakpoints(styleFunction) {
83
103
  // eslint-disable-next-line react/function-component-definition
84
104
  const newStyleFunction = props => {
85
105
  const theme = props.theme || {};
86
106
  const base = styleFunction(props);
87
- const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
107
+ const themeBreakpoints = theme.breakpoints || DEFAULT_BREAKPOINTS;
88
108
  const extended = themeBreakpoints.keys.reduce((acc, key) => {
89
109
  if (props[key]) {
90
110
  acc = acc || {};
@@ -108,28 +128,30 @@ function breakpoints(styleFunction) {
108
128
  newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl', ...styleFunction.filterProps];
109
129
  return newStyleFunction;
110
130
  }
111
- function createEmptyBreakpointObject(breakpointsInput = {}) {
112
- const breakpointsInOrder = breakpointsInput.keys?.reduce((acc, key) => {
113
- const breakpointStyleKey = breakpointsInput.up(key);
114
- acc[breakpointStyleKey] = {};
115
- return acc;
116
- }, {});
117
- return breakpointsInOrder || {};
131
+ function createEmptyBreakpointObject(breakpoints = DEFAULT_BREAKPOINTS) {
132
+ const {
133
+ internal_mediaKeys: mediaKeys
134
+ } = breakpoints;
135
+ const result = {};
136
+ for (let i = 0; i < mediaKeys.length; i += 1) {
137
+ result[mediaKeys[i]] = {};
138
+ }
139
+ return result;
118
140
  }
119
- function removeUnusedBreakpoints(breakpointKeys, style) {
120
- return breakpointKeys.reduce((acc, key) => {
121
- const breakpointOutput = acc[key];
122
- const isBreakpointUnused = !breakpointOutput || Object.keys(breakpointOutput).length === 0;
123
- if (isBreakpointUnused) {
124
- delete acc[key];
141
+ function removeUnusedBreakpoints(breakpoints, style) {
142
+ const breakpointKeys = breakpoints.internal_mediaKeys;
143
+ for (let i = 0; i < breakpointKeys.length; i += 1) {
144
+ const key = breakpointKeys[i];
145
+ if ((0, _isObjectEmpty.default)(style[key])) {
146
+ delete style[key];
125
147
  }
126
- return acc;
127
- }, style);
148
+ }
149
+ return style;
128
150
  }
129
- function mergeBreakpointsInOrder(breakpointsInput, ...styles) {
130
- const emptyBreakpoints = createEmptyBreakpointObject(breakpointsInput);
151
+ function mergeBreakpointsInOrder(breakpoints, ...styles) {
152
+ const emptyBreakpoints = createEmptyBreakpointObject(breakpoints);
131
153
  const mergedOutput = [emptyBreakpoints, ...styles].reduce((prev, next) => (0, _deepmerge.default)(prev, next), {});
132
- return removeUnusedBreakpoints(Object.keys(emptyBreakpoints), mergedOutput);
154
+ return removeUnusedBreakpoints(breakpoints, mergedOutput);
133
155
  }
134
156
 
135
157
  // compute base for responsive values; e.g.,
@@ -181,4 +203,23 @@ function resolveBreakpointValues({
181
203
  return acc;
182
204
  }, {});
183
205
  }
184
- var _default = exports.default = breakpoints;
206
+ function hasBreakpoint(breakpoints, value) {
207
+ if (Array.isArray(value)) {
208
+ return true;
209
+ }
210
+ if (typeof value === 'object' && value !== null) {
211
+ for (let i = 0; i < breakpoints.keys.length; i += 1) {
212
+ if (breakpoints.keys[i] in value) {
213
+ return true;
214
+ }
215
+ }
216
+ const valueKeys = Object.keys(value);
217
+ for (let i = 0; i < valueKeys.length; i += 1) {
218
+ if ((0, _cssContainerQueries.isCqShorthand)(breakpoints.keys, valueKeys[i])) {
219
+ return true;
220
+ }
221
+ }
222
+ }
223
+ return false;
224
+ }
225
+ var _default = exports.default = setupBreakpoints;