@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
@@ -0,0 +1,284 @@
1
+ import { padding, margin } from '../spacing';
2
+ import { borderRadius, borderTransform } from '../borders';
3
+ import { gap, rowGap, columnGap } from '../cssGrid';
4
+ import { paletteTransform } from '../palette';
5
+ import { maxWidth, sizingTransform } from '../sizing';
6
+ const defaultSxConfig = {
7
+ // borders
8
+ border: {
9
+ themeKey: 'borders',
10
+ transform: borderTransform
11
+ },
12
+ borderTop: {
13
+ themeKey: 'borders',
14
+ transform: borderTransform
15
+ },
16
+ borderRight: {
17
+ themeKey: 'borders',
18
+ transform: borderTransform
19
+ },
20
+ borderBottom: {
21
+ themeKey: 'borders',
22
+ transform: borderTransform
23
+ },
24
+ borderLeft: {
25
+ themeKey: 'borders',
26
+ transform: borderTransform
27
+ },
28
+ borderColor: {
29
+ themeKey: 'palette'
30
+ },
31
+ borderTopColor: {
32
+ themeKey: 'palette'
33
+ },
34
+ borderRightColor: {
35
+ themeKey: 'palette'
36
+ },
37
+ borderBottomColor: {
38
+ themeKey: 'palette'
39
+ },
40
+ borderLeftColor: {
41
+ themeKey: 'palette'
42
+ },
43
+ borderRadius: {
44
+ themeKey: 'shape.borderRadius',
45
+ style: borderRadius
46
+ },
47
+ // palette
48
+ color: {
49
+ themeKey: 'palette',
50
+ transform: paletteTransform
51
+ },
52
+ bgcolor: {
53
+ themeKey: 'palette',
54
+ cssProperty: 'backgroundColor',
55
+ transform: paletteTransform
56
+ },
57
+ backgroundColor: {
58
+ themeKey: 'palette',
59
+ transform: paletteTransform
60
+ },
61
+ // spacing
62
+ p: {
63
+ style: padding
64
+ },
65
+ pt: {
66
+ style: padding
67
+ },
68
+ pr: {
69
+ style: padding
70
+ },
71
+ pb: {
72
+ style: padding
73
+ },
74
+ pl: {
75
+ style: padding
76
+ },
77
+ px: {
78
+ style: padding
79
+ },
80
+ py: {
81
+ style: padding
82
+ },
83
+ padding: {
84
+ style: padding
85
+ },
86
+ paddingTop: {
87
+ style: padding
88
+ },
89
+ paddingRight: {
90
+ style: padding
91
+ },
92
+ paddingBottom: {
93
+ style: padding
94
+ },
95
+ paddingLeft: {
96
+ style: padding
97
+ },
98
+ paddingX: {
99
+ style: padding
100
+ },
101
+ paddingY: {
102
+ style: padding
103
+ },
104
+ paddingInline: {
105
+ style: padding
106
+ },
107
+ paddingInlineStart: {
108
+ style: padding
109
+ },
110
+ paddingInlineEnd: {
111
+ style: padding
112
+ },
113
+ paddingBlock: {
114
+ style: padding
115
+ },
116
+ paddingBlockStart: {
117
+ style: padding
118
+ },
119
+ paddingBlockEnd: {
120
+ style: padding
121
+ },
122
+ m: {
123
+ style: margin
124
+ },
125
+ mt: {
126
+ style: margin
127
+ },
128
+ mr: {
129
+ style: margin
130
+ },
131
+ mb: {
132
+ style: margin
133
+ },
134
+ ml: {
135
+ style: margin
136
+ },
137
+ mx: {
138
+ style: margin
139
+ },
140
+ my: {
141
+ style: margin
142
+ },
143
+ margin: {
144
+ style: margin
145
+ },
146
+ marginTop: {
147
+ style: margin
148
+ },
149
+ marginRight: {
150
+ style: margin
151
+ },
152
+ marginBottom: {
153
+ style: margin
154
+ },
155
+ marginLeft: {
156
+ style: margin
157
+ },
158
+ marginX: {
159
+ style: margin
160
+ },
161
+ marginY: {
162
+ style: margin
163
+ },
164
+ marginInline: {
165
+ style: margin
166
+ },
167
+ marginInlineStart: {
168
+ style: margin
169
+ },
170
+ marginInlineEnd: {
171
+ style: margin
172
+ },
173
+ marginBlock: {
174
+ style: margin
175
+ },
176
+ marginBlockStart: {
177
+ style: margin
178
+ },
179
+ marginBlockEnd: {
180
+ style: margin
181
+ },
182
+ // display
183
+ displayPrint: {
184
+ cssProperty: false,
185
+ transform: value => ({
186
+ '@media print': {
187
+ display: value
188
+ }
189
+ })
190
+ },
191
+ display: {},
192
+ overflow: {},
193
+ textOverflow: {},
194
+ visibility: {},
195
+ whiteSpace: {},
196
+ // flexbox
197
+ flexBasis: {},
198
+ flexDirection: {},
199
+ flexWrap: {},
200
+ justifyContent: {},
201
+ alignItems: {},
202
+ alignContent: {},
203
+ order: {},
204
+ flex: {},
205
+ flexGrow: {},
206
+ flexShrink: {},
207
+ alignSelf: {},
208
+ justifyItems: {},
209
+ justifySelf: {},
210
+ // grid
211
+ gap: {
212
+ style: gap
213
+ },
214
+ rowGap: {
215
+ style: rowGap
216
+ },
217
+ columnGap: {
218
+ style: columnGap
219
+ },
220
+ gridColumn: {},
221
+ gridRow: {},
222
+ gridAutoFlow: {},
223
+ gridAutoColumns: {},
224
+ gridAutoRows: {},
225
+ gridTemplateColumns: {},
226
+ gridTemplateRows: {},
227
+ gridTemplateAreas: {},
228
+ gridArea: {},
229
+ // positions
230
+ position: {},
231
+ zIndex: {
232
+ themeKey: 'zIndex'
233
+ },
234
+ top: {},
235
+ right: {},
236
+ bottom: {},
237
+ left: {},
238
+ // shadows
239
+ boxShadow: {
240
+ themeKey: 'shadows'
241
+ },
242
+ // sizing
243
+ width: {
244
+ transform: sizingTransform
245
+ },
246
+ maxWidth: {
247
+ style: maxWidth
248
+ },
249
+ minWidth: {
250
+ transform: sizingTransform
251
+ },
252
+ height: {
253
+ transform: sizingTransform
254
+ },
255
+ maxHeight: {
256
+ transform: sizingTransform
257
+ },
258
+ minHeight: {
259
+ transform: sizingTransform
260
+ },
261
+ boxSizing: {},
262
+ // typography
263
+ fontFamily: {
264
+ themeKey: 'typography'
265
+ },
266
+ fontSize: {
267
+ themeKey: 'typography'
268
+ },
269
+ fontStyle: {
270
+ themeKey: 'typography'
271
+ },
272
+ fontWeight: {
273
+ themeKey: 'typography'
274
+ },
275
+ letterSpacing: {},
276
+ textTransform: {},
277
+ lineHeight: {},
278
+ textAlign: {},
279
+ typography: {
280
+ cssProperty: false,
281
+ themeKey: 'typography'
282
+ }
283
+ };
284
+ export default defaultSxConfig;
@@ -2,14 +2,16 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["sx"];
4
4
  import { isPlainObject } from '@mui/utils';
5
- import { propToStyleFunction } from '../getThemeValue';
5
+ import defaultSxConfig from './defaultSxConfig';
6
6
  const splitProps = props => {
7
+ var _props$theme$unstable, _props$theme;
7
8
  const result = {
8
9
  systemProps: {},
9
10
  otherProps: {}
10
11
  };
12
+ const config = (_props$theme$unstable = props == null ? void 0 : (_props$theme = props.theme) == null ? void 0 : _props$theme.unstable_sxConfig) != null ? _props$theme$unstable : defaultSxConfig;
11
13
  Object.keys(props).forEach(prop => {
12
- if (propToStyleFunction[prop]) {
14
+ if (config[prop]) {
13
15
  result.systemProps[prop] = props[prop];
14
16
  } else {
15
17
  result.otherProps[prop] = props[prop];
@@ -1,3 +1,4 @@
1
1
  export { default } from './styleFunctionSx';
2
2
  export { unstable_createStyleFunctionSx } from './styleFunctionSx';
3
- export { default as extendSxProp } from './extendSxProp';
3
+ export { default as extendSxProp } from './extendSxProp';
4
+ export { default as unstable_defaultSxConfig } from './defaultSxConfig';
@@ -1,6 +1,8 @@
1
+ import { unstable_capitalize as capitalize } from '@mui/utils';
1
2
  import merge from '../merge';
2
- import { styleFunctionMapping as defaultStyleFunctionMapping } from '../getThemeValue';
3
+ import { getPath, getStyleValue as getValue } from '../style';
3
4
  import { handleBreakpoints, createEmptyBreakpointObject, removeUnusedBreakpoints } from '../breakpoints';
5
+ import defaultSxConfig from './defaultSxConfig';
4
6
  function objectsHaveSameKeys(...objects) {
5
7
  const allKeys = objects.reduce((keys, object) => keys.concat(Object.keys(object)), []);
6
8
  const union = new Set(allKeys);
@@ -11,24 +13,48 @@ function callIfFn(maybeFn, arg) {
11
13
  }
12
14
 
13
15
  // eslint-disable-next-line @typescript-eslint/naming-convention
14
- export function unstable_createStyleFunctionSx(styleFunctionMapping = defaultStyleFunctionMapping) {
15
- const propToStyleFunction = Object.keys(styleFunctionMapping).reduce((acc, styleFnName) => {
16
- styleFunctionMapping[styleFnName].filterProps.forEach(propName => {
17
- acc[propName] = styleFunctionMapping[styleFnName];
18
- });
19
- return acc;
20
- }, {});
21
- function getThemeValue(prop, value, theme) {
22
- const inputProps = {
23
- [prop]: value,
16
+ export function unstable_createStyleFunctionSx() {
17
+ function getThemeValue(prop, val, theme, config) {
18
+ const props = {
19
+ [prop]: val,
24
20
  theme
25
21
  };
26
- const styleFunction = propToStyleFunction[prop];
27
- return styleFunction ? styleFunction(inputProps) : {
28
- [prop]: value
22
+ const options = config[prop];
23
+ if (!options) {
24
+ return {
25
+ [prop]: val
26
+ };
27
+ }
28
+ const {
29
+ cssProperty = prop,
30
+ themeKey,
31
+ transform,
32
+ style
33
+ } = options;
34
+ if (val == null) {
35
+ return null;
36
+ }
37
+ const themeMapping = getPath(theme, themeKey) || {};
38
+ if (style) {
39
+ return style(props);
40
+ }
41
+ const styleFromPropValue = propValueFinal => {
42
+ let value = getValue(themeMapping, transform, propValueFinal);
43
+ if (propValueFinal === value && typeof propValueFinal === 'string') {
44
+ // Haven't found value
45
+ value = getValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
46
+ }
47
+ if (cssProperty === false) {
48
+ return value;
49
+ }
50
+ return {
51
+ [cssProperty]: value
52
+ };
29
53
  };
54
+ return handleBreakpoints(props, val, styleFromPropValue);
30
55
  }
31
56
  function styleFunctionSx(props) {
57
+ var _theme$unstable_sxCon;
32
58
  const {
33
59
  sx,
34
60
  theme = {}
@@ -37,6 +63,8 @@ export function unstable_createStyleFunctionSx(styleFunctionMapping = defaultSty
37
63
  return null; // Emotion & styled-components will neglect null
38
64
  }
39
65
 
66
+ const config = (_theme$unstable_sxCon = theme.unstable_sxConfig) != null ? _theme$unstable_sxCon : defaultSxConfig;
67
+
40
68
  /*
41
69
  * Receive `sxInput` as object or callback
42
70
  * and then recursively check keys & values to create media query object styles.
@@ -60,8 +88,8 @@ export function unstable_createStyleFunctionSx(styleFunctionMapping = defaultSty
60
88
  const value = callIfFn(sxObject[styleKey], theme);
61
89
  if (value !== null && value !== undefined) {
62
90
  if (typeof value === 'object') {
63
- if (propToStyleFunction[styleKey]) {
64
- css = merge(css, getThemeValue(styleKey, value, theme));
91
+ if (config[styleKey]) {
92
+ css = merge(css, getThemeValue(styleKey, value, theme, config));
65
93
  } else {
66
94
  const breakpointsValues = handleBreakpoints({
67
95
  theme
@@ -78,7 +106,7 @@ export function unstable_createStyleFunctionSx(styleFunctionMapping = defaultSty
78
106
  }
79
107
  }
80
108
  } else {
81
- css = merge(css, getThemeValue(styleKey, value, theme));
109
+ css = merge(css, getThemeValue(styleKey, value, theme, config));
82
110
  }
83
111
  }
84
112
  });
package/index.d.ts CHANGED
@@ -119,10 +119,13 @@ export {
119
119
  default as unstable_styleFunctionSx,
120
120
  unstable_createStyleFunctionSx,
121
121
  extendSxProp as unstable_extendSxProp,
122
+ unstable_defaultSxConfig,
122
123
  } from './styleFunctionSx';
123
124
  export * from './styleFunctionSx';
124
125
 
125
- export { default as experimental_sx } from './sx';
126
+ // TODO: Remove this function in v6.
127
+ // eslint-disable-next-line @typescript-eslint/naming-convention
128
+ export function experimental_sx(): any;
126
129
 
127
130
  export { default as Box } from './Box';
128
131
  export * from './Box';
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.10.17
1
+ /** @license MUI v5.11.1
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", {
10
10
  value: true
11
11
  });
12
12
  var _exportNames = {
13
+ experimental_sx: true,
13
14
  css: true,
14
15
  keyframes: true,
15
16
  GlobalStyles: true,
@@ -35,7 +36,7 @@ var _exportNames = {
35
36
  unstable_styleFunctionSx: true,
36
37
  unstable_createStyleFunctionSx: true,
37
38
  unstable_extendSxProp: true,
38
- experimental_sx: true,
39
+ unstable_defaultSxConfig: true,
39
40
  unstable_getThemeValue: true,
40
41
  Box: true,
41
42
  createBox: true,
@@ -166,12 +167,7 @@ Object.defineProperty(exports, "display", {
166
167
  return _display.default;
167
168
  }
168
169
  });
169
- Object.defineProperty(exports, "experimental_sx", {
170
- enumerable: true,
171
- get: function () {
172
- return _sx.default;
173
- }
174
- });
170
+ exports.experimental_sx = experimental_sx;
175
171
  Object.defineProperty(exports, "flexbox", {
176
172
  enumerable: true,
177
173
  get: function () {
@@ -298,6 +294,12 @@ Object.defineProperty(exports, "unstable_createStyleFunctionSx", {
298
294
  return _styleFunctionSx.unstable_createStyleFunctionSx;
299
295
  }
300
296
  });
297
+ Object.defineProperty(exports, "unstable_defaultSxConfig", {
298
+ enumerable: true,
299
+ get: function () {
300
+ return _styleFunctionSx.unstable_defaultSxConfig;
301
+ }
302
+ });
301
303
  Object.defineProperty(exports, "unstable_extendSxProp", {
302
304
  enumerable: true,
303
305
  get: function () {
@@ -340,6 +342,7 @@ Object.defineProperty(exports, "useThemeWithoutDefault", {
340
342
  return _useThemeWithoutDefault.default;
341
343
  }
342
344
  });
345
+ var _utils = require("@mui/utils");
343
346
  var _styledEngine = require("@mui/styled-engine");
344
347
  var _borders = _interopRequireWildcard(require("./borders"));
345
348
  Object.keys(_borders).forEach(function (key) {
@@ -443,7 +446,6 @@ Object.keys(_typography).forEach(function (key) {
443
446
  });
444
447
  });
445
448
  var _styleFunctionSx = _interopRequireWildcard(require("./styleFunctionSx"));
446
- var _sx = _interopRequireDefault(require("./sx"));
447
449
  var _getThemeValue = _interopRequireDefault(require("./getThemeValue"));
448
450
  var _Box = _interopRequireDefault(require("./Box"));
449
451
  var _createBox = _interopRequireDefault(require("./createBox"));
@@ -523,4 +525,9 @@ Object.keys(_Stack2).forEach(function (key) {
523
525
  });
524
526
  });
525
527
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
526
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
528
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
529
+ // TODO: Remove this function in v6
530
+ // eslint-disable-next-line @typescript-eslint/naming-convention
531
+ function experimental_sx() {
532
+ 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.` : (0, _utils.formatMuiErrorMessage)(20));
533
+ }
package/legacy/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 var border = style({
13
13
  prop: 'border',
14
14
  themeKey: 'borders',
15
- transform: getBorder
15
+ transform: borderTransform
16
16
  });
17
17
  export var borderTop = style({
18
18
  prop: 'borderTop',
19
19
  themeKey: 'borders',
20
- transform: getBorder
20
+ transform: borderTransform
21
21
  });
22
22
  export var borderRight = style({
23
23
  prop: 'borderRight',
24
24
  themeKey: 'borders',
25
- transform: getBorder
25
+ transform: borderTransform
26
26
  });
27
27
  export var borderBottom = style({
28
28
  prop: 'borderBottom',
29
29
  themeKey: 'borders',
30
- transform: getBorder
30
+ transform: borderTransform
31
31
  });
32
32
  export var borderLeft = style({
33
33
  prop: 'borderLeft',
34
34
  themeKey: 'borders',
35
- transform: getBorder
35
+ transform: borderTransform
36
36
  });
37
37
  export var borderColor = style({
38
38
  prop: 'borderColor',
@@ -54,6 +54,9 @@ export var 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 var borderRadius = function borderRadius(props) {
58
61
  if (props.borderRadius !== undefined && props.borderRadius !== null) {
59
62
  var transformer = createUnaryUnit(props.theme, 'shape.borderRadius', 4, 'borderRadius');
@@ -54,6 +54,8 @@ export function handleBreakpoints(props, propValue, styleFromPropValue) {
54
54
  return output;
55
55
  }
56
56
  function breakpoints(styleFunction) {
57
+ // false positive
58
+ // eslint-disable-next-line react/function-component-definition
57
59
  var newStyleFunction = function newStyleFunction(props) {
58
60
  var theme = props.theme || {};
59
61
  var base = styleFunction(props);
package/legacy/compose.js CHANGED
@@ -10,6 +10,9 @@ function compose() {
10
10
  });
11
11
  return acc;
12
12
  }, {});
13
+
14
+ // false positive
15
+ // eslint-disable-next-line react/function-component-definition
13
16
  var fn = function fn(props) {
14
17
  return Object.keys(props).reduce(function (acc, prop) {
15
18
  if (handlers[prop]) {
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  import * as React from 'react';
4
4
  import clsx from 'clsx';
5
5
  import styled from '@mui/styled-engine';
6
- import defaultStyleFunctionSx, { extendSxProp } from './styleFunctionSx';
6
+ import styleFunctionSx, { extendSxProp } from './styleFunctionSx';
7
7
  import useTheme from './useTheme';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  export default function createBox() {
@@ -11,9 +11,7 @@ export default function createBox() {
11
11
  var defaultTheme = options.defaultTheme,
12
12
  _options$defaultClass = options.defaultClassName,
13
13
  defaultClassName = _options$defaultClass === void 0 ? 'MuiBox-root' : _options$defaultClass,
14
- generateClassName = options.generateClassName,
15
- _options$styleFunctio = options.styleFunctionSx,
16
- styleFunctionSx = _options$styleFunctio === void 0 ? defaultStyleFunctionSx : _options$styleFunctio;
14
+ generateClassName = options.generateClassName;
17
15
  var BoxRoot = styled('div', {
18
16
  shouldForwardProp: function shouldForwardProp(prop) {
19
17
  return prop !== 'theme' && prop !== 'sx' && prop !== 'as';
@@ -7,7 +7,7 @@ import styledEngineStyled, { internal_processStyles as processStyles } from '@mu
7
7
  import { getDisplayName } from '@mui/utils';
8
8
  import createTheme from './createTheme';
9
9
  import propsToClassKey from './propsToClassKey';
10
- import defaultStyleFunctionSx from './styleFunctionSx';
10
+ import styleFunctionSx from './styleFunctionSx';
11
11
  function isEmpty(obj) {
12
12
  return Object.keys(obj).length === 0;
13
13
  }
@@ -75,9 +75,7 @@ export default function createStyled() {
75
75
  _input$rootShouldForw = input.rootShouldForwardProp,
76
76
  rootShouldForwardProp = _input$rootShouldForw === void 0 ? shouldForwardProp : _input$rootShouldForw,
77
77
  _input$slotShouldForw = input.slotShouldForwardProp,
78
- slotShouldForwardProp = _input$slotShouldForw === void 0 ? shouldForwardProp : _input$slotShouldForw,
79
- _input$styleFunctionS = input.styleFunctionSx,
80
- styleFunctionSx = _input$styleFunctionS === void 0 ? defaultStyleFunctionSx : _input$styleFunctionS;
78
+ slotShouldForwardProp = _input$slotShouldForw === void 0 ? shouldForwardProp : _input$slotShouldForw;
81
79
  var systemSx = function systemSx(props) {
82
80
  var theme = isEmpty(props.theme) ? defaultTheme : props.theme;
83
81
  return styleFunctionSx(_extends({}, props, {
@@ -4,6 +4,8 @@ import { deepmerge } from '@mui/utils';
4
4
  import createBreakpoints from './createBreakpoints';
5
5
  import shape from './shape';
6
6
  import createSpacing from './createSpacing';
7
+ import styleFunctionSx from '../styleFunctionSx/styleFunctionSx';
8
+ import defaultSxConfig from '../styleFunctionSx/defaultSxConfig';
7
9
  function createTheme() {
8
10
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
11
  var _options$breakpoints = options.breakpoints,
@@ -33,6 +35,13 @@ function createTheme() {
33
35
  muiTheme = args.reduce(function (acc, argument) {
34
36
  return deepmerge(acc, argument);
35
37
  }, muiTheme);
38
+ muiTheme.unstable_sxConfig = _extends({}, defaultSxConfig, other == null ? void 0 : other.unstable_sxConfig);
39
+ muiTheme.unstable_sx = function sx(props) {
40
+ return styleFunctionSx({
41
+ sx: props,
42
+ theme: this
43
+ });
44
+ };
36
45
  return muiTheme;
37
46
  }
38
47
  export default createTheme;
package/legacy/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 var gap = function gap(props) {
7
10
  if (props.gap !== undefined && props.gap !== null) {
8
11
  var transformer = createUnaryUnit(props.theme, 'spacing', 8, 'gap');
@@ -19,6 +22,9 @@ gap.propTypes = process.env.NODE_ENV !== 'production' ? {
19
22
  gap: responsivePropType
20
23
  } : {};
21
24
  gap.filterProps = ['gap'];
25
+
26
+ // false positive
27
+ // eslint-disable-next-line react/function-component-definition
22
28
  export var columnGap = function columnGap(props) {
23
29
  if (props.columnGap !== undefined && props.columnGap !== null) {
24
30
  var transformer = createUnaryUnit(props.theme, 'spacing', 8, 'columnGap');
@@ -35,6 +41,9 @@ columnGap.propTypes = process.env.NODE_ENV !== 'production' ? {
35
41
  columnGap: responsivePropType
36
42
  } : {};
37
43
  columnGap.filterProps = ['columnGap'];
44
+
45
+ // false positive
46
+ // eslint-disable-next-line react/function-component-definition
38
47
  export var rowGap = function rowGap(props) {
39
48
  if (props.rowGap !== undefined && props.rowGap !== null) {
40
49
  var transformer = createUnaryUnit(props.theme, 'spacing', 8, 'rowGap');