@mui/system 5.10.17 → 5.11.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 (85) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/borders.js +12 -7
  3. package/breakpoints.js +2 -0
  4. package/compose.js +3 -0
  5. package/createBox.d.ts +0 -2
  6. package/createBox.js +2 -3
  7. package/createStyled.js +2 -3
  8. package/createTheme/createTheme.d.ts +5 -0
  9. package/createTheme/createTheme.js +9 -0
  10. package/cssGrid.js +8 -0
  11. package/esm/borders.js +9 -6
  12. package/esm/breakpoints.js +2 -0
  13. package/esm/compose.js +3 -0
  14. package/esm/createBox.js +2 -3
  15. package/esm/createStyled.js +2 -3
  16. package/esm/createTheme/createTheme.js +9 -0
  17. package/esm/cssGrid.js +9 -0
  18. package/esm/index.js +7 -2
  19. package/esm/palette.js +4 -4
  20. package/esm/sizing.js +9 -9
  21. package/esm/spacing.js +2 -2
  22. package/esm/style.js +4 -1
  23. package/esm/styleFunctionSx/defaultSxConfig.js +284 -0
  24. package/esm/styleFunctionSx/extendSxProp.js +4 -2
  25. package/esm/styleFunctionSx/index.js +2 -1
  26. package/esm/styleFunctionSx/styleFunctionSx.js +45 -17
  27. package/index.d.ts +4 -1
  28. package/index.js +17 -10
  29. package/legacy/borders.js +9 -6
  30. package/legacy/breakpoints.js +2 -0
  31. package/legacy/compose.js +3 -0
  32. package/legacy/createBox.js +2 -4
  33. package/legacy/createStyled.js +2 -4
  34. package/legacy/createTheme/createTheme.js +9 -0
  35. package/legacy/cssGrid.js +9 -0
  36. package/legacy/index.js +8 -3
  37. package/legacy/palette.js +4 -4
  38. package/legacy/sizing.js +9 -9
  39. package/legacy/spacing.js +2 -2
  40. package/legacy/style.js +3 -2
  41. package/legacy/styleFunctionSx/defaultSxConfig.js +286 -0
  42. package/legacy/styleFunctionSx/extendSxProp.js +4 -2
  43. package/legacy/styleFunctionSx/index.js +2 -1
  44. package/legacy/styleFunctionSx/styleFunctionSx.js +44 -20
  45. package/modern/borders.js +9 -6
  46. package/modern/breakpoints.js +2 -0
  47. package/modern/compose.js +3 -0
  48. package/modern/createBox.js +2 -3
  49. package/modern/createStyled.js +2 -3
  50. package/modern/createTheme/createTheme.js +9 -0
  51. package/modern/cssGrid.js +9 -0
  52. package/modern/index.js +8 -3
  53. package/modern/palette.js +4 -4
  54. package/modern/sizing.js +9 -9
  55. package/modern/spacing.js +2 -2
  56. package/modern/style.js +4 -1
  57. package/modern/styleFunctionSx/defaultSxConfig.js +284 -0
  58. package/modern/styleFunctionSx/extendSxProp.js +3 -2
  59. package/modern/styleFunctionSx/index.js +2 -1
  60. package/modern/styleFunctionSx/styleFunctionSx.js +44 -17
  61. package/package.json +6 -6
  62. package/palette.js +5 -4
  63. package/sizing.js +12 -10
  64. package/spacing.d.ts +2 -2
  65. package/spacing.js +4 -0
  66. package/style.d.ts +10 -8
  67. package/style.js +4 -1
  68. package/styleFunctionSx/defaultSxConfig.d.ts +20 -0
  69. package/styleFunctionSx/defaultSxConfig.js +291 -0
  70. package/styleFunctionSx/extendSxProp.js +4 -2
  71. package/styleFunctionSx/index.d.ts +4 -0
  72. package/styleFunctionSx/index.js +7 -0
  73. package/styleFunctionSx/styleFunctionSx.d.ts +2 -1
  74. package/styleFunctionSx/styleFunctionSx.js +45 -17
  75. package/esm/sx/index.js +0 -1
  76. package/esm/sx/sx.js +0 -10
  77. package/legacy/sx/index.js +0 -1
  78. package/legacy/sx/sx.js +0 -11
  79. package/modern/sx/index.js +0 -1
  80. package/modern/sx/sx.js +0 -10
  81. package/sx/index.d.ts +0 -1
  82. package/sx/index.js +0 -13
  83. package/sx/package.json +0 -6
  84. package/sx/sx.d.ts +0 -4
  85. package/sx/sx.js +0 -18
package/CHANGELOG.md CHANGED
@@ -1,5 +1,135 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 5.11.1
4
+
5
+ <!-- generated comparing v5.11.0..master -->
6
+
7
+ _Dec 20, 2022_
8
+
9
+ A big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 💅 @mnajdova added motion and shape design tokens to Material You package (#35384 and #35393).
12
+ - Many other 🐛 bug fixes, 📚 documentation, and ⚙️ infrastructure improvements.
13
+
14
+ ### `@mui/material@5.11.1`
15
+
16
+ - [Chip] Fix hover and focus style with CSS Variables (#35502) @DimaAbr
17
+ - [InputLabel] Enable `size` prop overrides via TypeScript module augmentation (#35460) @MickaelAustoni
18
+ - [l10n] Change Kazakh locale name to match ISO-639-1 codes (#34664) @talgautb
19
+ - [TextField] Fix error focus style (#35167) @42tte
20
+ - [core] Bring `experimental_sx` back with error code (#35528) @siriwatknp
21
+
22
+ ### `@mui/utils@5.11.1`
23
+
24
+ - [Theme] Merge components and slots props (#35477) @siriwatknp
25
+
26
+ ### `@mui/material-next@6.0.0-alpha.67`
27
+
28
+ - [Material You] Add motion design tokens (#35384) @mnajdova
29
+ - [Material You] Add shape design tokens (#35393) @mnajdova
30
+
31
+ ### `@mui/joy@5.0.0-alpha.59`
32
+
33
+ - [Tooltip] Fix arrow does not appear (#35473) @siriwatknp
34
+ - [Input] Fix autofill styles (#35056) @siriwatknp
35
+ - [ChipDelete] Add onDelete prop to ChipDelete (#35412) @sai6855
36
+
37
+ ### `@mui/base@5.0.0-alpha.111`
38
+
39
+ - [Button][base] Set active class when a subcomponent is clicked (#35410) @michaldudak
40
+ - [Popper][base] Fix Tooltip Anchor Element Setter (#35469) @sydneyjodon-wk
41
+
42
+ ### Docs
43
+
44
+ - [docs] Fixed the `Select` component `onChange` event type in the migration guide (#35509) @tzynwang
45
+ - [docs] Add missing comma to `Providing the colors directly` section (#35507) @cassidoo
46
+ - [docs] Add `CardMedia` example without `component="img"` prop (#35470) @lucasmfredmark
47
+ - [docs] Fix `unstable_sxConfig` typo (#35478) @siriwatknp
48
+ - [docs] List component introduction example default code is missing ListItemContent component (#35492) @Miigaarino
49
+ - [website] Close our first people role @oliviertassinari
50
+ - [website] Update product icons (#35413) @danilo-leal
51
+
52
+ ### Core
53
+
54
+ - [test] Terminate BrowserStack after 5 minutes (#35454) @oliviertassinari
55
+ - [test] Fix broken master branch (#35446) @oliviertassinari
56
+
57
+ All contributors of this release in alphabetical order: @42tte, @cassidoo, @danilo-leal, @DimaAbr, @lucasmfredmark, @michaldudak, @MickaelAustoni, @Miigaarino, @mnajdova, @oliviertassinari, @sai6855, @siriwatknp, @sydneyjodon-wk, @talgautb, @tzynwang
58
+
59
+ ## 5.11.0
60
+
61
+ <!-- generated comparing v5.10.17..master -->
62
+
63
+ _Dec 13, 2022_
64
+
65
+ A big thanks to the 19 contributors who made this release possible. Here are some highlights ✨:
66
+
67
+ - 🔥 @mnajdova enabled configuration of the `sx` prop in the `theme` (#35150)
68
+ - Many other 🐛 bug fixes, 📚 documentation, and ⚙️ infrastructure improvements.
69
+
70
+ ### `@mui/material@5.11.0`
71
+
72
+ - [Alert] Update icon color in all variants (#35414) @danilo-leal
73
+ - [Select] Fix `MenuProps.PopoverClasses` being overriden (#35394) @vitorfrs-dev
74
+ - [SwipeableDrawer] Fixed typescript warning "prop open undefined" (#34710) @kraftware
75
+
76
+ ### `@mui/icons-material@5.11.0`
77
+
78
+ - [icons] Restore the PhoneInTalk icons (#35409) @michaldudak
79
+
80
+ ### `@mui/system@5.11.0`
81
+
82
+ #### BREAKING CHANGES
83
+
84
+ - [system] Enable configuring the `sx` prop in the `theme` (#35150) @mnajdova
85
+
86
+ The breaking change is regarding an experimental API:
87
+
88
+ ```diff
89
+ -import { styled, experimental_sx } from '@mui/material/styles';
90
+ +import { styled } from '@mui/material/styles';
91
+
92
+ -const Component = styled('div)(experimental_sx({ p: 1 }});
93
+ +const Component = styled('div)(({ theme }) => theme.unstable_sx({ p: 1 }});
94
+ ```
95
+
96
+ ### `@mui/joy@5.0.0-alpha.58`
97
+
98
+ - [Joy] Miscellaneous fixes (#35447) @siriwatknp
99
+
100
+ ### `@mui/base@5.0.0-alpha.110`
101
+
102
+ - [PopperUnstyled] Update PopperTooltip to have correct width when closing with transition (#34714) @EduardoSCosta
103
+
104
+ ### `@mui/material-next@6.0.0-alpha.66`
105
+
106
+ - [Material You] Add ripple on the button (#35299) @mnajdova
107
+
108
+ ### Docs
109
+
110
+ - [docs] Simplify state management in Text Field demo page (#35051) @PratikDev
111
+ - [docs] Improve `Responsive App bar with Drawer` demo (#35418) @ZeeshanTamboli
112
+ - [docs] Improve line-height readability (#35387) @oliviertassinari
113
+ - [docs] Improve a bit the Composition docs (#35329) @oliviertassinari
114
+ - [docs] Refactor `ToggleButtonSizes` demo (#35375) @Armanio
115
+ - [docs] Standardize the usage of callouts in the MUI Core docs (#35361) @samuelsycamore
116
+ - [docs] Format feedback to add a link to the commented section (#35381) @alexfauquette
117
+ - [docs] Direct users from Material UI to MUI Base for duplicated components (#35293) @samuelsycamore
118
+ - [docs] Fix typo in FormControl API docs (#35449) @Spanishiwa
119
+ - [docs] Update callouts design (#35390) @danilo-leal
120
+ - [website] New wave of open roles (#35240) @mnajdova
121
+ - [website] Developer survey 2022 (#35407) @joserodolfofreitas
122
+
123
+ ### Core
124
+
125
+ - [core] Fix @mui/material package building (#35324) @timbset
126
+ - [core] Fix leaking theme color override (#35444) @oliviertassinari
127
+ - [typescript] Add null to return type of OverridableComponent (#35311) @tsollbach
128
+ - [website] Migrate X page to use CSS theme variables (#34922) @jesrodri
129
+ - [website] Migrate `/core` page to use CSS variables (#35366) @siriwatknp
130
+
131
+ All contributors of this release in alphabetical order: @alexfauquette, @Armanio, @danilo-leal, @EduardoSCosta, @flaviendelangle, @jesrodri, @joserodolfofreitas, @kraftware, @michaldudak, @mnajdova, @oliviertassinari, @PratikDev, @samuelsycamore, @siriwatknp, @Spanishiwa, @timbset, @tsollbach, @vitorfrs-dev, @ZeeshanTamboli
132
+
3
133
  ## 5.10.17
4
134
 
5
135
  <!-- generated comparing v5.10.16..master -->
package/borders.js CHANGED
@@ -4,13 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = exports.borderTopColor = exports.borderTop = exports.borderRightColor = exports.borderRight = exports.borderRadius = exports.borderLeftColor = exports.borderLeft = exports.borderColor = exports.borderBottomColor = exports.borderBottom = exports.border = void 0;
7
+ exports.borderTopColor = exports.borderTop = exports.borderRightColor = exports.borderRight = exports.borderRadius = exports.borderLeftColor = exports.borderLeft = exports.borderColor = exports.borderBottomColor = exports.borderBottom = exports.border = void 0;
8
+ exports.borderTransform = borderTransform;
9
+ exports.default = void 0;
8
10
  var _responsivePropType = _interopRequireDefault(require("./responsivePropType"));
9
11
  var _style = _interopRequireDefault(require("./style"));
10
12
  var _compose = _interopRequireDefault(require("./compose"));
11
13
  var _spacing = require("./spacing");
12
14
  var _breakpoints = require("./breakpoints");
13
- function getBorder(value) {
15
+ function borderTransform(value) {
14
16
  if (typeof value !== 'number') {
15
17
  return value;
16
18
  }
@@ -19,31 +21,31 @@ function getBorder(value) {
19
21
  const border = (0, _style.default)({
20
22
  prop: 'border',
21
23
  themeKey: 'borders',
22
- transform: getBorder
24
+ transform: borderTransform
23
25
  });
24
26
  exports.border = border;
25
27
  const borderTop = (0, _style.default)({
26
28
  prop: 'borderTop',
27
29
  themeKey: 'borders',
28
- transform: getBorder
30
+ transform: borderTransform
29
31
  });
30
32
  exports.borderTop = borderTop;
31
33
  const borderRight = (0, _style.default)({
32
34
  prop: 'borderRight',
33
35
  themeKey: 'borders',
34
- transform: getBorder
36
+ transform: borderTransform
35
37
  });
36
38
  exports.borderRight = borderRight;
37
39
  const borderBottom = (0, _style.default)({
38
40
  prop: 'borderBottom',
39
41
  themeKey: 'borders',
40
- transform: getBorder
42
+ transform: borderTransform
41
43
  });
42
44
  exports.borderBottom = borderBottom;
43
45
  const borderLeft = (0, _style.default)({
44
46
  prop: 'borderLeft',
45
47
  themeKey: 'borders',
46
- transform: getBorder
48
+ transform: borderTransform
47
49
  });
48
50
  exports.borderLeft = borderLeft;
49
51
  const borderColor = (0, _style.default)({
@@ -70,6 +72,9 @@ const borderLeftColor = (0, _style.default)({
70
72
  prop: 'borderLeftColor',
71
73
  themeKey: 'palette'
72
74
  });
75
+
76
+ // false positive
77
+ // eslint-disable-next-line react/function-component-definition
73
78
  exports.borderLeftColor = borderLeftColor;
74
79
  const borderRadius = props => {
75
80
  if (props.borderRadius !== undefined && props.borderRadius !== null) {
package/breakpoints.js CHANGED
@@ -63,6 +63,8 @@ function handleBreakpoints(props, propValue, styleFromPropValue) {
63
63
  return output;
64
64
  }
65
65
  function breakpoints(styleFunction) {
66
+ // false positive
67
+ // eslint-disable-next-line react/function-component-definition
66
68
  const newStyleFunction = props => {
67
69
  const theme = props.theme || {};
68
70
  const base = styleFunction(props);
package/compose.js CHANGED
@@ -13,6 +13,9 @@ function compose(...styles) {
13
13
  });
14
14
  return acc;
15
15
  }, {});
16
+
17
+ // false positive
18
+ // eslint-disable-next-line react/function-component-definition
16
19
  const fn = props => {
17
20
  return Object.keys(props).reduce((acc, prop) => {
18
21
  if (handlers[prop]) {
package/createBox.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import Box from './Box';
2
- import styleFunctionSx from './styleFunctionSx';
3
2
 
4
3
  export default function createBox(options?: {
5
4
  defaultTheme: object;
6
5
  defaultClassName?: string;
7
6
  generateClassName?: (componentName: string) => string;
8
- styleFunctionSx?: typeof styleFunctionSx;
9
7
  }): typeof Box;
package/createBox.js CHANGED
@@ -20,12 +20,11 @@ function createBox(options = {}) {
20
20
  const {
21
21
  defaultTheme,
22
22
  defaultClassName = 'MuiBox-root',
23
- generateClassName,
24
- styleFunctionSx = _styleFunctionSx.default
23
+ generateClassName
25
24
  } = options;
26
25
  const BoxRoot = (0, _styledEngine.default)('div', {
27
26
  shouldForwardProp: prop => prop !== 'theme' && prop !== 'sx' && prop !== 'as'
28
- })(styleFunctionSx);
27
+ })(_styleFunctionSx.default);
29
28
  const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
30
29
  const theme = (0, _useTheme.default)(defaultTheme);
31
30
  const _extendSxProp = (0, _styleFunctionSx.extendSxProp)(inProps),
package/createStyled.js CHANGED
@@ -85,12 +85,11 @@ function createStyled(input = {}) {
85
85
  const {
86
86
  defaultTheme = systemDefaultTheme,
87
87
  rootShouldForwardProp = shouldForwardProp,
88
- slotShouldForwardProp = shouldForwardProp,
89
- styleFunctionSx = _styleFunctionSx.default
88
+ slotShouldForwardProp = shouldForwardProp
90
89
  } = input;
91
90
  const systemSx = props => {
92
91
  const theme = isEmpty(props.theme) ? defaultTheme : props.theme;
93
- return styleFunctionSx((0, _extends2.default)({}, props, {
92
+ return (0, _styleFunctionSx.default)((0, _extends2.default)({}, props, {
94
93
  theme
95
94
  }));
96
95
  };
@@ -1,6 +1,8 @@
1
+ import { CSSObject } from '@mui/styled-engine';
1
2
  import { Breakpoints, BreakpointsOptions } from './createBreakpoints';
2
3
  import { Shape, ShapeOptions } from './shape';
3
4
  import { Spacing, SpacingOptions } from './createSpacing';
5
+ import { SxConfig, SxProps } from '../styleFunctionSx';
4
6
 
5
7
  export { Breakpoint, BreakpointOverrides } from './createBreakpoints';
6
8
 
@@ -18,6 +20,7 @@ export interface ThemeOptions {
18
20
  components?: Record<string, any>;
19
21
  typography?: unknown;
20
22
  zIndex?: Record<string, number>;
23
+ unstable_sxConfig?: SxConfig;
21
24
  }
22
25
 
23
26
  export interface Theme {
@@ -32,6 +35,8 @@ export interface Theme {
32
35
  mixins?: unknown;
33
36
  typography?: unknown;
34
37
  zIndex?: unknown;
38
+ unstable_sxConfig: SxConfig;
39
+ unstable_sx: (props: SxProps<Theme>) => CSSObject;
35
40
  }
36
41
 
37
42
  /**
@@ -11,6 +11,8 @@ var _utils = require("@mui/utils");
11
11
  var _createBreakpoints = _interopRequireDefault(require("./createBreakpoints"));
12
12
  var _shape = _interopRequireDefault(require("./shape"));
13
13
  var _createSpacing = _interopRequireDefault(require("./createSpacing"));
14
+ var _styleFunctionSx = _interopRequireDefault(require("../styleFunctionSx/styleFunctionSx"));
15
+ var _defaultSxConfig = _interopRequireDefault(require("../styleFunctionSx/defaultSxConfig"));
14
16
  const _excluded = ["breakpoints", "palette", "spacing", "shape"];
15
17
  function createTheme(options = {}, ...args) {
16
18
  const {
@@ -34,6 +36,13 @@ function createTheme(options = {}, ...args) {
34
36
  shape: (0, _extends2.default)({}, _shape.default, shapeInput)
35
37
  }, other);
36
38
  muiTheme = args.reduce((acc, argument) => (0, _utils.deepmerge)(acc, argument), muiTheme);
39
+ muiTheme.unstable_sxConfig = (0, _extends2.default)({}, _defaultSxConfig.default, other == null ? void 0 : other.unstable_sxConfig);
40
+ muiTheme.unstable_sx = function sx(props) {
41
+ return (0, _styleFunctionSx.default)({
42
+ sx: props,
43
+ theme: this
44
+ });
45
+ };
37
46
  return muiTheme;
38
47
  }
39
48
  var _default = createTheme;
package/cssGrid.js CHANGED
@@ -10,6 +10,8 @@ var _compose = _interopRequireDefault(require("./compose"));
10
10
  var _spacing = require("./spacing");
11
11
  var _breakpoints = require("./breakpoints");
12
12
  var _responsivePropType = _interopRequireDefault(require("./responsivePropType"));
13
+ // false positive
14
+ // eslint-disable-next-line react/function-component-definition
13
15
  const gap = props => {
14
16
  if (props.gap !== undefined && props.gap !== null) {
15
17
  const transformer = (0, _spacing.createUnaryUnit)(props.theme, 'spacing', 8, 'gap');
@@ -25,6 +27,9 @@ gap.propTypes = process.env.NODE_ENV !== 'production' ? {
25
27
  gap: _responsivePropType.default
26
28
  } : {};
27
29
  gap.filterProps = ['gap'];
30
+
31
+ // false positive
32
+ // eslint-disable-next-line react/function-component-definition
28
33
  const columnGap = props => {
29
34
  if (props.columnGap !== undefined && props.columnGap !== null) {
30
35
  const transformer = (0, _spacing.createUnaryUnit)(props.theme, 'spacing', 8, 'columnGap');
@@ -40,6 +45,9 @@ columnGap.propTypes = process.env.NODE_ENV !== 'production' ? {
40
45
  columnGap: _responsivePropType.default
41
46
  } : {};
42
47
  columnGap.filterProps = ['columnGap'];
48
+
49
+ // false positive
50
+ // eslint-disable-next-line react/function-component-definition
43
51
  const rowGap = props => {
44
52
  if (props.rowGap !== undefined && props.rowGap !== null) {
45
53
  const transformer = (0, _spacing.createUnaryUnit)(props.theme, 'spacing', 8, 'rowGap');
package/esm/borders.js CHANGED
@@ -3,7 +3,7 @@ import style from './style';
3
3
  import compose from './compose';
4
4
  import { createUnaryUnit, getValue } from './spacing';
5
5
  import { handleBreakpoints } from './breakpoints';
6
- function getBorder(value) {
6
+ export function borderTransform(value) {
7
7
  if (typeof value !== 'number') {
8
8
  return value;
9
9
  }
@@ -12,27 +12,27 @@ function getBorder(value) {
12
12
  export const border = style({
13
13
  prop: 'border',
14
14
  themeKey: 'borders',
15
- transform: getBorder
15
+ transform: borderTransform
16
16
  });
17
17
  export const borderTop = style({
18
18
  prop: 'borderTop',
19
19
  themeKey: 'borders',
20
- transform: getBorder
20
+ transform: borderTransform
21
21
  });
22
22
  export const borderRight = style({
23
23
  prop: 'borderRight',
24
24
  themeKey: 'borders',
25
- transform: getBorder
25
+ transform: borderTransform
26
26
  });
27
27
  export const borderBottom = style({
28
28
  prop: 'borderBottom',
29
29
  themeKey: 'borders',
30
- transform: getBorder
30
+ transform: borderTransform
31
31
  });
32
32
  export const borderLeft = style({
33
33
  prop: 'borderLeft',
34
34
  themeKey: 'borders',
35
- transform: getBorder
35
+ transform: borderTransform
36
36
  });
37
37
  export const borderColor = style({
38
38
  prop: 'borderColor',
@@ -54,6 +54,9 @@ export const borderLeftColor = style({
54
54
  prop: 'borderLeftColor',
55
55
  themeKey: 'palette'
56
56
  });
57
+
58
+ // false positive
59
+ // eslint-disable-next-line react/function-component-definition
57
60
  export const borderRadius = props => {
58
61
  if (props.borderRadius !== undefined && props.borderRadius !== null) {
59
62
  const transformer = createUnaryUnit(props.theme, 'shape.borderRadius', 4, 'borderRadius');
@@ -50,6 +50,8 @@ export function handleBreakpoints(props, propValue, styleFromPropValue) {
50
50
  return output;
51
51
  }
52
52
  function breakpoints(styleFunction) {
53
+ // false positive
54
+ // eslint-disable-next-line react/function-component-definition
53
55
  const newStyleFunction = props => {
54
56
  const theme = props.theme || {};
55
57
  const base = styleFunction(props);
package/esm/compose.js CHANGED
@@ -6,6 +6,9 @@ function compose(...styles) {
6
6
  });
7
7
  return acc;
8
8
  }, {});
9
+
10
+ // false positive
11
+ // eslint-disable-next-line react/function-component-definition
9
12
  const fn = props => {
10
13
  return Object.keys(props).reduce((acc, prop) => {
11
14
  if (handlers[prop]) {
package/esm/createBox.js CHANGED
@@ -4,15 +4,14 @@ const _excluded = ["className", "component"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import styled from '@mui/styled-engine';
7
- import defaultStyleFunctionSx, { extendSxProp } from './styleFunctionSx';
7
+ import styleFunctionSx, { extendSxProp } from './styleFunctionSx';
8
8
  import useTheme from './useTheme';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  export default function createBox(options = {}) {
11
11
  const {
12
12
  defaultTheme,
13
13
  defaultClassName = 'MuiBox-root',
14
- generateClassName,
15
- styleFunctionSx = defaultStyleFunctionSx
14
+ generateClassName
16
15
  } = options;
17
16
  const BoxRoot = styled('div', {
18
17
  shouldForwardProp: prop => prop !== 'theme' && prop !== 'sx' && prop !== 'as'
@@ -8,7 +8,7 @@ import styledEngineStyled, { internal_processStyles as processStyles } from '@mu
8
8
  import { getDisplayName } from '@mui/utils';
9
9
  import createTheme from './createTheme';
10
10
  import propsToClassKey from './propsToClassKey';
11
- import defaultStyleFunctionSx from './styleFunctionSx';
11
+ import styleFunctionSx from './styleFunctionSx';
12
12
  function isEmpty(obj) {
13
13
  return Object.keys(obj).length === 0;
14
14
  }
@@ -74,8 +74,7 @@ export default function createStyled(input = {}) {
74
74
  const {
75
75
  defaultTheme = systemDefaultTheme,
76
76
  rootShouldForwardProp = shouldForwardProp,
77
- slotShouldForwardProp = shouldForwardProp,
78
- styleFunctionSx = defaultStyleFunctionSx
77
+ slotShouldForwardProp = shouldForwardProp
79
78
  } = input;
80
79
  const systemSx = props => {
81
80
  const theme = isEmpty(props.theme) ? defaultTheme : props.theme;
@@ -5,6 +5,8 @@ import { deepmerge } from '@mui/utils';
5
5
  import createBreakpoints from './createBreakpoints';
6
6
  import shape from './shape';
7
7
  import createSpacing from './createSpacing';
8
+ import styleFunctionSx from '../styleFunctionSx/styleFunctionSx';
9
+ import defaultSxConfig from '../styleFunctionSx/defaultSxConfig';
8
10
  function createTheme(options = {}, ...args) {
9
11
  const {
10
12
  breakpoints: breakpointsInput = {},
@@ -27,6 +29,13 @@ function createTheme(options = {}, ...args) {
27
29
  shape: _extends({}, shape, shapeInput)
28
30
  }, other);
29
31
  muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
32
+ muiTheme.unstable_sxConfig = _extends({}, defaultSxConfig, other == null ? void 0 : other.unstable_sxConfig);
33
+ muiTheme.unstable_sx = function sx(props) {
34
+ return styleFunctionSx({
35
+ sx: props,
36
+ theme: this
37
+ });
38
+ };
30
39
  return muiTheme;
31
40
  }
32
41
  export default createTheme;
package/esm/cssGrid.js CHANGED
@@ -3,6 +3,9 @@ import compose from './compose';
3
3
  import { createUnaryUnit, getValue } from './spacing';
4
4
  import { handleBreakpoints } from './breakpoints';
5
5
  import responsivePropType from './responsivePropType';
6
+
7
+ // false positive
8
+ // eslint-disable-next-line react/function-component-definition
6
9
  export const gap = props => {
7
10
  if (props.gap !== undefined && props.gap !== null) {
8
11
  const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'gap');
@@ -17,6 +20,9 @@ gap.propTypes = process.env.NODE_ENV !== 'production' ? {
17
20
  gap: responsivePropType
18
21
  } : {};
19
22
  gap.filterProps = ['gap'];
23
+
24
+ // false positive
25
+ // eslint-disable-next-line react/function-component-definition
20
26
  export const columnGap = props => {
21
27
  if (props.columnGap !== undefined && props.columnGap !== null) {
22
28
  const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'columnGap');
@@ -31,6 +37,9 @@ columnGap.propTypes = process.env.NODE_ENV !== 'production' ? {
31
37
  columnGap: responsivePropType
32
38
  } : {};
33
39
  columnGap.filterProps = ['columnGap'];
40
+
41
+ // false positive
42
+ // eslint-disable-next-line react/function-component-definition
34
43
  export const rowGap = props => {
35
44
  if (props.rowGap !== undefined && props.rowGap !== null) {
36
45
  const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'rowGap');
package/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
1
2
  export { css, keyframes, GlobalStyles, StyledEngineProvider } from '@mui/styled-engine';
2
3
  export { default as borders } from './borders';
3
4
  export * from './borders';
@@ -21,8 +22,12 @@ export * from './spacing';
21
22
  export { default as style, getPath, getStyleValue } from './style';
22
23
  export { default as typography } from './typography';
23
24
  export * from './typography';
24
- export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp } from './styleFunctionSx';
25
- export { default as experimental_sx } from './sx';
25
+ export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp, unstable_defaultSxConfig } from './styleFunctionSx';
26
+ // TODO: Remove this function in v6
27
+ // eslint-disable-next-line @typescript-eslint/naming-convention
28
+ export function experimental_sx() {
29
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`experimental_sx\` has been moved to \`theme.unstable_sx\`.For more details, see https://github.com/mui/material-ui/pull/35150.` : _formatMuiErrorMessage(20));
30
+ }
26
31
  export { default as unstable_getThemeValue } from './getThemeValue';
27
32
  export { default as Box } from './Box';
28
33
  export { default as createBox } from './createBox';
package/esm/palette.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import style from './style';
2
2
  import compose from './compose';
3
- function transform(value, userValue) {
3
+ export function paletteTransform(value, userValue) {
4
4
  if (userValue === 'grey') {
5
5
  return userValue;
6
6
  }
@@ -9,18 +9,18 @@ function transform(value, userValue) {
9
9
  export const color = style({
10
10
  prop: 'color',
11
11
  themeKey: 'palette',
12
- transform
12
+ transform: paletteTransform
13
13
  });
14
14
  export const bgcolor = style({
15
15
  prop: 'bgcolor',
16
16
  cssProperty: 'backgroundColor',
17
17
  themeKey: 'palette',
18
- transform
18
+ transform: paletteTransform
19
19
  });
20
20
  export const backgroundColor = style({
21
21
  prop: 'backgroundColor',
22
22
  themeKey: 'palette',
23
- transform
23
+ transform: paletteTransform
24
24
  });
25
25
  const palette = compose(color, bgcolor, backgroundColor);
26
26
  export default palette;
package/esm/sizing.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import style from './style';
2
2
  import compose from './compose';
3
3
  import { handleBreakpoints, values as breakpointsValues } from './breakpoints';
4
- function transform(value) {
4
+ export function sizingTransform(value) {
5
5
  return value <= 1 && value !== 0 ? `${value * 100}%` : value;
6
6
  }
7
7
  export const width = style({
8
8
  prop: 'width',
9
- transform
9
+ transform: sizingTransform
10
10
  });
11
11
  export const maxWidth = props => {
12
12
  if (props.maxWidth !== undefined && props.maxWidth !== null) {
@@ -14,7 +14,7 @@ export const maxWidth = props => {
14
14
  var _props$theme, _props$theme$breakpoi, _props$theme$breakpoi2;
15
15
  const breakpoint = ((_props$theme = props.theme) == null ? void 0 : (_props$theme$breakpoi = _props$theme.breakpoints) == null ? void 0 : (_props$theme$breakpoi2 = _props$theme$breakpoi.values) == null ? void 0 : _props$theme$breakpoi2[propValue]) || breakpointsValues[propValue];
16
16
  return {
17
- maxWidth: breakpoint || transform(propValue)
17
+ maxWidth: breakpoint || sizingTransform(propValue)
18
18
  };
19
19
  };
20
20
  return handleBreakpoints(props, props.maxWidth, styleFromPropValue);
@@ -24,29 +24,29 @@ export const maxWidth = props => {
24
24
  maxWidth.filterProps = ['maxWidth'];
25
25
  export const minWidth = style({
26
26
  prop: 'minWidth',
27
- transform
27
+ transform: sizingTransform
28
28
  });
29
29
  export const height = style({
30
30
  prop: 'height',
31
- transform
31
+ transform: sizingTransform
32
32
  });
33
33
  export const maxHeight = style({
34
34
  prop: 'maxHeight',
35
- transform
35
+ transform: sizingTransform
36
36
  });
37
37
  export const minHeight = style({
38
38
  prop: 'minHeight',
39
- transform
39
+ transform: sizingTransform
40
40
  });
41
41
  export const sizeWidth = style({
42
42
  prop: 'size',
43
43
  cssProperty: 'width',
44
- transform
44
+ transform: sizingTransform
45
45
  });
46
46
  export const sizeHeight = style({
47
47
  prop: 'size',
48
48
  cssProperty: 'height',
49
- transform
49
+ transform: sizingTransform
50
50
  });
51
51
  export const boxSizing = style({
52
52
  prop: 'boxSizing'
package/esm/spacing.js CHANGED
@@ -39,8 +39,8 @@ const getCssProperties = memoize(prop => {
39
39
  const direction = directions[b] || '';
40
40
  return Array.isArray(direction) ? direction.map(dir => property + dir) : [property + direction];
41
41
  });
42
- const marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd'];
43
- const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
42
+ export const marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd'];
43
+ export const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
44
44
  const spacingKeys = [...marginKeys, ...paddingKeys];
45
45
  export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
46
46
  var _getPath;
package/esm/style.js CHANGED
@@ -30,7 +30,7 @@ export function getStyleValue(themeMapping, transform, propValueFinal, userValue
30
30
  value = getPath(themeMapping, propValueFinal) || userValue;
31
31
  }
32
32
  if (transform) {
33
- value = transform(value, userValue);
33
+ value = transform(value, userValue, themeMapping);
34
34
  }
35
35
  return value;
36
36
  }
@@ -41,6 +41,9 @@ function style(options) {
41
41
  themeKey,
42
42
  transform
43
43
  } = options;
44
+
45
+ // false positive
46
+ // eslint-disable-next-line react/function-component-definition
44
47
  const fn = props => {
45
48
  if (props[prop] == null) {
46
49
  return null;