@mui/system 5.10.16 → 5.11.0

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 (94) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/borders.js +12 -7
  3. package/breakpoints.js +2 -0
  4. package/colorManipulator.d.ts +10 -0
  5. package/colorManipulator.js +57 -1
  6. package/compose.js +3 -0
  7. package/createBox.d.ts +0 -2
  8. package/createBox.js +2 -3
  9. package/createStyled.js +2 -3
  10. package/createTheme/createTheme.d.ts +5 -0
  11. package/createTheme/createTheme.js +9 -0
  12. package/cssGrid.js +8 -0
  13. package/cssVars/createCssVarsProvider.d.ts +54 -1
  14. package/cssVars/createCssVarsProvider.js +47 -13
  15. package/esm/borders.js +9 -6
  16. package/esm/breakpoints.js +2 -0
  17. package/esm/colorManipulator.js +50 -0
  18. package/esm/compose.js +3 -0
  19. package/esm/createBox.js +2 -3
  20. package/esm/createStyled.js +2 -3
  21. package/esm/createTheme/createTheme.js +9 -0
  22. package/esm/cssGrid.js +9 -0
  23. package/esm/cssVars/createCssVarsProvider.js +47 -13
  24. package/esm/index.js +1 -2
  25. package/esm/palette.js +4 -4
  26. package/esm/sizing.js +9 -9
  27. package/esm/spacing.js +2 -2
  28. package/esm/style.js +4 -1
  29. package/esm/styleFunctionSx/defaultSxConfig.js +284 -0
  30. package/esm/styleFunctionSx/extendSxProp.js +4 -2
  31. package/esm/styleFunctionSx/index.js +2 -1
  32. package/esm/styleFunctionSx/styleFunctionSx.js +45 -17
  33. package/index.d.ts +1 -2
  34. package/index.js +8 -9
  35. package/legacy/borders.js +9 -6
  36. package/legacy/breakpoints.js +2 -0
  37. package/legacy/colorManipulator.js +50 -0
  38. package/legacy/compose.js +3 -0
  39. package/legacy/createBox.js +2 -4
  40. package/legacy/createStyled.js +2 -4
  41. package/legacy/createTheme/createTheme.js +9 -0
  42. package/legacy/cssGrid.js +9 -0
  43. package/legacy/cssVars/createCssVarsProvider.js +47 -11
  44. package/legacy/index.js +2 -3
  45. package/legacy/palette.js +4 -4
  46. package/legacy/sizing.js +9 -9
  47. package/legacy/spacing.js +2 -2
  48. package/legacy/style.js +3 -2
  49. package/legacy/styleFunctionSx/defaultSxConfig.js +286 -0
  50. package/legacy/styleFunctionSx/extendSxProp.js +4 -2
  51. package/legacy/styleFunctionSx/index.js +2 -1
  52. package/legacy/styleFunctionSx/styleFunctionSx.js +44 -20
  53. package/modern/borders.js +9 -6
  54. package/modern/breakpoints.js +2 -0
  55. package/modern/colorManipulator.js +50 -0
  56. package/modern/compose.js +3 -0
  57. package/modern/createBox.js +2 -3
  58. package/modern/createStyled.js +2 -3
  59. package/modern/createTheme/createTheme.js +9 -0
  60. package/modern/cssGrid.js +9 -0
  61. package/modern/cssVars/createCssVarsProvider.js +47 -13
  62. package/modern/index.js +2 -3
  63. package/modern/palette.js +4 -4
  64. package/modern/sizing.js +9 -9
  65. package/modern/spacing.js +2 -2
  66. package/modern/style.js +4 -1
  67. package/modern/styleFunctionSx/defaultSxConfig.js +284 -0
  68. package/modern/styleFunctionSx/extendSxProp.js +3 -2
  69. package/modern/styleFunctionSx/index.js +2 -1
  70. package/modern/styleFunctionSx/styleFunctionSx.js +44 -17
  71. package/package.json +6 -6
  72. package/palette.js +5 -4
  73. package/sizing.js +12 -10
  74. package/spacing.js +4 -0
  75. package/style.d.ts +10 -8
  76. package/style.js +4 -1
  77. package/styleFunctionSx/defaultSxConfig.d.ts +20 -0
  78. package/styleFunctionSx/defaultSxConfig.js +291 -0
  79. package/styleFunctionSx/extendSxProp.js +4 -2
  80. package/styleFunctionSx/index.d.ts +4 -0
  81. package/styleFunctionSx/index.js +7 -0
  82. package/styleFunctionSx/styleFunctionSx.d.ts +2 -1
  83. package/styleFunctionSx/styleFunctionSx.js +45 -17
  84. package/esm/sx/index.js +0 -1
  85. package/esm/sx/sx.js +0 -10
  86. package/legacy/sx/index.js +0 -1
  87. package/legacy/sx/sx.js +0 -11
  88. package/modern/sx/index.js +0 -1
  89. package/modern/sx/sx.js +0 -10
  90. package/sx/index.d.ts +0 -1
  91. package/sx/index.js +0 -13
  92. package/sx/package.json +0 -6
  93. package/sx/sx.d.ts +0 -4
  94. package/sx/sx.js +0 -18
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);
@@ -90,6 +90,16 @@ export const colorChannel = color => {
90
90
  const decomposedColor = decomposeColor(color);
91
91
  return decomposedColor.values.slice(0, 3).map((val, idx) => decomposedColor.type.indexOf('hsl') !== -1 && idx !== 0 ? `${val}%` : val).join(' ');
92
92
  };
93
+ export const private_safeColorChannel = (color, warning) => {
94
+ try {
95
+ return colorChannel(color);
96
+ } catch (error) {
97
+ if (warning && process.env.NODE_ENV !== 'production') {
98
+ console.warn(warning);
99
+ }
100
+ return color;
101
+ }
102
+ };
93
103
 
94
104
  /**
95
105
  * Converts a color object with type and values to a string.
@@ -220,6 +230,16 @@ export function alpha(color, value) {
220
230
  }
221
231
  return recomposeColor(color);
222
232
  }
233
+ export function private_safeAlpha(color, value, warning) {
234
+ try {
235
+ return alpha(color, value);
236
+ } catch (error) {
237
+ if (warning && process.env.NODE_ENV !== 'production') {
238
+ console.warn(warning);
239
+ }
240
+ return color;
241
+ }
242
+ }
223
243
 
224
244
  /**
225
245
  * Darkens a color.
@@ -239,6 +259,16 @@ export function darken(color, coefficient) {
239
259
  }
240
260
  return recomposeColor(color);
241
261
  }
262
+ export function private_safeDarken(color, coefficient, warning) {
263
+ try {
264
+ return darken(color, coefficient);
265
+ } catch (error) {
266
+ if (warning && process.env.NODE_ENV !== 'production') {
267
+ console.warn(warning);
268
+ }
269
+ return color;
270
+ }
271
+ }
242
272
 
243
273
  /**
244
274
  * Lightens a color.
@@ -262,6 +292,16 @@ export function lighten(color, coefficient) {
262
292
  }
263
293
  return recomposeColor(color);
264
294
  }
295
+ export function private_safeLighten(color, coefficient, warning) {
296
+ try {
297
+ return lighten(color, coefficient);
298
+ } catch (error) {
299
+ if (warning && process.env.NODE_ENV !== 'production') {
300
+ console.warn(warning);
301
+ }
302
+ return color;
303
+ }
304
+ }
265
305
 
266
306
  /**
267
307
  * Darken or lighten a color, depending on its luminance.
@@ -272,4 +312,14 @@ export function lighten(color, coefficient) {
272
312
  */
273
313
  export function emphasize(color, coefficient = 0.15) {
274
314
  return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient);
315
+ }
316
+ export function private_safeEmphasize(color, coefficient, warning) {
317
+ try {
318
+ return private_safeEmphasize(color, coefficient);
319
+ } catch (error) {
320
+ if (warning && process.env.NODE_ENV !== 'production') {
321
+ console.warn(warning);
322
+ }
323
+ return color;
324
+ }
275
325
  }
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');
@@ -6,6 +6,7 @@ import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { deepmerge } from '@mui/utils';
8
8
  import { GlobalStyles } from '@mui/styled-engine';
9
+ import { useTheme as muiUseTheme } from '@mui/private-theming';
9
10
  import cssVarsParser from './cssVarsParser';
10
11
  import ThemeProvider from '../ThemeProvider';
11
12
  import systemGetInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
@@ -50,9 +51,14 @@ export default function createCssVarsProvider(options) {
50
51
  documentNode = typeof document === 'undefined' ? undefined : document,
51
52
  colorSchemeNode = typeof document === 'undefined' ? undefined : document.documentElement,
52
53
  colorSchemeSelector = ':root',
53
- shouldSkipGeneratingVar = designSystemShouldSkipGeneratingVar
54
+ shouldSkipGeneratingVar = designSystemShouldSkipGeneratingVar,
55
+ disableNestedContext = false,
56
+ disableStyleSheetGeneration = false
54
57
  }) {
55
58
  const hasMounted = React.useRef(false);
59
+ const upperTheme = muiUseTheme();
60
+ const ctx = React.useContext(ColorSchemeContext);
61
+ const nested = !!ctx && !disableNestedContext;
56
62
  const {
57
63
  colorSchemes = {},
58
64
  components = {},
@@ -65,12 +71,12 @@ export default function createCssVarsProvider(options) {
65
71
 
66
72
  // 1. Get the data about the `mode`, `colorScheme`, and setter functions.
67
73
  const {
68
- mode,
74
+ mode: stateMode,
69
75
  setMode,
70
76
  systemMode,
71
77
  lightColorScheme,
72
78
  darkColorScheme,
73
- colorScheme,
79
+ colorScheme: stateColorScheme,
74
80
  setColorScheme
75
81
  } = useCurrentColorScheme({
76
82
  supportedColorSchemes: allColorSchemes,
@@ -81,6 +87,12 @@ export default function createCssVarsProvider(options) {
81
87
  defaultMode,
82
88
  storageWindow
83
89
  });
90
+ let mode = stateMode;
91
+ let colorScheme = stateColorScheme;
92
+ if (nested) {
93
+ mode = ctx.mode;
94
+ colorScheme = ctx.colorScheme;
95
+ }
84
96
  const calculatedMode = (() => {
85
97
  if (!mode) {
86
98
  // This scope occurs on the server
@@ -217,21 +229,33 @@ export default function createCssVarsProvider(options) {
217
229
  setColorScheme,
218
230
  allColorSchemes
219
231
  }), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
220
- return /*#__PURE__*/_jsxs(ColorSchemeContext.Provider, {
221
- value: contextValue,
222
- children: [/*#__PURE__*/_jsx(GlobalStyles, {
223
- styles: {
224
- [colorSchemeSelector]: rootCss
225
- }
226
- }), /*#__PURE__*/_jsx(GlobalStyles, {
227
- styles: defaultColorSchemeStyleSheet
228
- }), /*#__PURE__*/_jsx(GlobalStyles, {
229
- styles: otherColorSchemesStyleSheet
232
+ let shouldGenerateStyleSheet = true;
233
+ if (disableStyleSheetGeneration || nested && (upperTheme == null ? void 0 : upperTheme.cssVarPrefix) === cssVarPrefix) {
234
+ shouldGenerateStyleSheet = false;
235
+ }
236
+ const element = /*#__PURE__*/_jsxs(React.Fragment, {
237
+ children: [shouldGenerateStyleSheet && /*#__PURE__*/_jsxs(React.Fragment, {
238
+ children: [/*#__PURE__*/_jsx(GlobalStyles, {
239
+ styles: {
240
+ [colorSchemeSelector]: rootCss
241
+ }
242
+ }), /*#__PURE__*/_jsx(GlobalStyles, {
243
+ styles: defaultColorSchemeStyleSheet
244
+ }), /*#__PURE__*/_jsx(GlobalStyles, {
245
+ styles: otherColorSchemesStyleSheet
246
+ })]
230
247
  }), /*#__PURE__*/_jsx(ThemeProvider, {
231
248
  theme: resolveTheme ? resolveTheme(theme) : theme,
232
249
  children: children
233
250
  })]
234
251
  });
252
+ if (nested) {
253
+ return element;
254
+ }
255
+ return /*#__PURE__*/_jsx(ColorSchemeContext.Provider, {
256
+ value: contextValue,
257
+ children: element
258
+ });
235
259
  }
236
260
  process.env.NODE_ENV !== "production" ? CssVarsProvider.propTypes = {
237
261
  /**
@@ -262,6 +286,16 @@ export default function createCssVarsProvider(options) {
262
286
  * The initial mode used.
263
287
  */
264
288
  defaultMode: PropTypes.string,
289
+ /**
290
+ * If `true`, the provider creates its own context and generate stylesheet as if it is a root `CssVarsProvider`.
291
+ */
292
+ disableNestedContext: PropTypes.bool,
293
+ /**
294
+ * If `true`, the style sheet won't be generated.
295
+ *
296
+ * This is useful for controlling nested CssVarsProvider behavior.
297
+ */
298
+ disableStyleSheetGeneration: PropTypes.bool,
265
299
  /**
266
300
  * Disable CSS transitions when switching between modes or color schemes
267
301
  */
package/esm/index.js CHANGED
@@ -21,8 +21,7 @@ export * from './spacing';
21
21
  export { default as style, getPath, getStyleValue } from './style';
22
22
  export { default as typography } from './typography';
23
23
  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';
24
+ export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp, unstable_defaultSxConfig } from './styleFunctionSx';
26
25
  export { default as unstable_getThemeValue } from './getThemeValue';
27
26
  export { default as Box } from './Box';
28
27
  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;