@mui/system 5.10.17 → 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 (110) hide show
  1. package/Box/Box.spec.d.ts +1 -1
  2. package/CHANGELOG.md +74 -0
  3. package/Container/Container.d.ts +13 -13
  4. package/Container/ContainerProps.d.ts +40 -40
  5. package/Container/containerClasses.d.ts +22 -22
  6. package/Container/createContainer.d.ts +18 -18
  7. package/Stack/Stack.d.ts +13 -13
  8. package/Stack/StackProps.d.ts +42 -42
  9. package/Stack/createStack.d.ts +21 -21
  10. package/Stack/index.d.ts +5 -5
  11. package/Stack/stackClasses.d.ts +8 -8
  12. package/Unstable_Grid/Grid.d.ts +12 -12
  13. package/Unstable_Grid/GridProps.d.ts +162 -162
  14. package/Unstable_Grid/createGrid.d.ts +11 -11
  15. package/Unstable_Grid/gridClasses.d.ts +20 -20
  16. package/Unstable_Grid/gridGenerator.d.ts +29 -29
  17. package/Unstable_Grid/index.d.ts +5 -5
  18. package/borders.js +12 -7
  19. package/breakpoints.js +2 -0
  20. package/compose.js +3 -0
  21. package/createBox.d.ts +0 -2
  22. package/createBox.js +2 -3
  23. package/createBox.spec.d.ts +1 -1
  24. package/createStyled.js +2 -3
  25. package/createTheme/createSpacing.d.ts +10 -10
  26. package/createTheme/createTheme.d.ts +5 -0
  27. package/createTheme/createTheme.js +9 -0
  28. package/cssGrid.js +8 -0
  29. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  30. package/cssVars/createGetCssVar.d.ts +5 -5
  31. package/cssVars/cssVarsParser.d.ts +63 -63
  32. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  33. package/cssVars/index.d.ts +3 -3
  34. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  35. package/esm/borders.js +9 -6
  36. package/esm/breakpoints.js +2 -0
  37. package/esm/compose.js +3 -0
  38. package/esm/createBox.js +2 -3
  39. package/esm/createStyled.js +2 -3
  40. package/esm/createTheme/createTheme.js +9 -0
  41. package/esm/cssGrid.js +9 -0
  42. package/esm/index.js +1 -2
  43. package/esm/palette.js +4 -4
  44. package/esm/sizing.js +9 -9
  45. package/esm/spacing.js +2 -2
  46. package/esm/style.js +4 -1
  47. package/esm/styleFunctionSx/defaultSxConfig.js +284 -0
  48. package/esm/styleFunctionSx/extendSxProp.js +4 -2
  49. package/esm/styleFunctionSx/index.js +2 -1
  50. package/esm/styleFunctionSx/styleFunctionSx.js +45 -17
  51. package/index.d.ts +1 -2
  52. package/index.js +8 -9
  53. package/index.spec.d.ts +1 -1
  54. package/legacy/borders.js +9 -6
  55. package/legacy/breakpoints.js +2 -0
  56. package/legacy/compose.js +3 -0
  57. package/legacy/createBox.js +2 -4
  58. package/legacy/createStyled.js +2 -4
  59. package/legacy/createTheme/createTheme.js +9 -0
  60. package/legacy/cssGrid.js +9 -0
  61. package/legacy/index.js +2 -3
  62. package/legacy/palette.js +4 -4
  63. package/legacy/sizing.js +9 -9
  64. package/legacy/spacing.js +2 -2
  65. package/legacy/style.js +3 -2
  66. package/legacy/styleFunctionSx/defaultSxConfig.js +286 -0
  67. package/legacy/styleFunctionSx/extendSxProp.js +4 -2
  68. package/legacy/styleFunctionSx/index.js +2 -1
  69. package/legacy/styleFunctionSx/styleFunctionSx.js +44 -20
  70. package/modern/borders.js +9 -6
  71. package/modern/breakpoints.js +2 -0
  72. package/modern/compose.js +3 -0
  73. package/modern/createBox.js +2 -3
  74. package/modern/createStyled.js +2 -3
  75. package/modern/createTheme/createTheme.js +9 -0
  76. package/modern/cssGrid.js +9 -0
  77. package/modern/index.js +2 -3
  78. package/modern/palette.js +4 -4
  79. package/modern/sizing.js +9 -9
  80. package/modern/spacing.js +2 -2
  81. package/modern/style.js +4 -1
  82. package/modern/styleFunctionSx/defaultSxConfig.js +284 -0
  83. package/modern/styleFunctionSx/extendSxProp.js +3 -2
  84. package/modern/styleFunctionSx/index.js +2 -1
  85. package/modern/styleFunctionSx/styleFunctionSx.js +44 -17
  86. package/package.json +6 -6
  87. package/palette.js +5 -4
  88. package/sizing.js +12 -10
  89. package/spacing.js +4 -0
  90. package/style.d.ts +10 -8
  91. package/style.js +4 -1
  92. package/styleFunctionSx/defaultSxConfig.d.ts +20 -0
  93. package/styleFunctionSx/defaultSxConfig.js +291 -0
  94. package/styleFunctionSx/extendSxProp.js +4 -2
  95. package/styleFunctionSx/index.d.ts +4 -0
  96. package/styleFunctionSx/index.js +7 -0
  97. package/styleFunctionSx/styleFunctionSx.d.ts +2 -1
  98. package/styleFunctionSx/styleFunctionSx.js +45 -17
  99. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
  100. package/esm/sx/index.js +0 -1
  101. package/esm/sx/sx.js +0 -10
  102. package/legacy/sx/index.js +0 -1
  103. package/legacy/sx/sx.js +0 -11
  104. package/modern/sx/index.js +0 -1
  105. package/modern/sx/sx.js +0 -10
  106. package/sx/index.d.ts +0 -1
  107. package/sx/index.js +0 -13
  108. package/sx/package.json +0 -6
  109. package/sx/sx.d.ts +0 -4
  110. package/sx/sx.js +0 -18
@@ -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');
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,5 +1,5 @@
1
- /**
2
- * The benefit of this function is to help developers get CSS var from theme without specifying the whole variable
3
- * and they does not need to remember the prefix (defined once).
4
- */
5
- export default function createGetCssVar<T extends string = string>(prefix?: string): <AdditionalVars extends string = never>(field: T | AdditionalVars, ...fallbacks: (T | AdditionalVars)[]) => string;
1
+ /**
2
+ * The benefit of this function is to help developers get CSS var from theme without specifying the whole variable
3
+ * and they does not need to remember the prefix (defined once).
4
+ */
5
+ export default function createGetCssVar<T extends string = string>(prefix?: string): <AdditionalVars extends string = never>(field: T | AdditionalVars, ...fallbacks: (T | AdditionalVars)[]) => string;
@@ -1,63 +1,63 @@
1
- type NestedRecord<V = any> = {
2
- [k: string | number]: NestedRecord<V> | V;
3
- };
4
- /**
5
- * This function create an object from keys, value and then assign to target
6
- *
7
- * @param {Object} obj : the target object to be assigned
8
- * @param {string[]} keys
9
- * @param {string | number} value
10
- *
11
- * @example
12
- * const source = {}
13
- * assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
14
- * console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
15
- *
16
- * @example
17
- * const source = { palette: { primary: 'var(--palette-primary)' } }
18
- * assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
19
- * console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
20
- */
21
- export declare const assignNestedKeys: <T extends string | Record<string, any> | null | undefined = NestedRecord<any>, Value = any>(obj: T, keys: Array<string>, value: Value, arrayKeys?: Array<string>) => void;
22
- /**
23
- *
24
- * @param {Object} obj : source object
25
- * @param {Function} callback : a function that will be called when
26
- * - the deepest key in source object is reached
27
- * - the value of the deepest key is NOT `undefined` | `null`
28
- *
29
- * @example
30
- * walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
31
- * // ['palette', 'primary', 'main'] '#000000'
32
- */
33
- export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, arrayKeys: Array<string>) => void, shouldSkipPaths?: ((keys: Array<string>) => boolean) | undefined) => void;
34
- /**
35
- * a function that parse theme and return { css, vars }
36
- *
37
- * @param {Object} theme
38
- * @param {{
39
- * prefix?: string,
40
- * shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
41
- * }} options.
42
- * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
43
- *
44
- * @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
45
- *
46
- * @example
47
- * const { css, vars } = parser({
48
- * fontSize: 12,
49
- * lineHeight: 1.2,
50
- * palette: { primary: { 500: 'var(--color)' } }
51
- * }, { prefix: 'foo' })
52
- *
53
- * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
54
- * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
55
- */
56
- export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
57
- prefix?: string;
58
- shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
59
- }): {
60
- css: Record<string, string | number>;
61
- vars: NestedRecord<string>;
62
- };
63
- export {};
1
+ type NestedRecord<V = any> = {
2
+ [k: string | number]: NestedRecord<V> | V;
3
+ };
4
+ /**
5
+ * This function create an object from keys, value and then assign to target
6
+ *
7
+ * @param {Object} obj : the target object to be assigned
8
+ * @param {string[]} keys
9
+ * @param {string | number} value
10
+ *
11
+ * @example
12
+ * const source = {}
13
+ * assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
14
+ * console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
15
+ *
16
+ * @example
17
+ * const source = { palette: { primary: 'var(--palette-primary)' } }
18
+ * assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
19
+ * console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
20
+ */
21
+ export declare const assignNestedKeys: <T extends string | Record<string, any> | null | undefined = NestedRecord<any>, Value = any>(obj: T, keys: Array<string>, value: Value, arrayKeys?: Array<string>) => void;
22
+ /**
23
+ *
24
+ * @param {Object} obj : source object
25
+ * @param {Function} callback : a function that will be called when
26
+ * - the deepest key in source object is reached
27
+ * - the value of the deepest key is NOT `undefined` | `null`
28
+ *
29
+ * @example
30
+ * walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
31
+ * // ['palette', 'primary', 'main'] '#000000'
32
+ */
33
+ export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, arrayKeys: Array<string>) => void, shouldSkipPaths?: ((keys: Array<string>) => boolean) | undefined) => void;
34
+ /**
35
+ * a function that parse theme and return { css, vars }
36
+ *
37
+ * @param {Object} theme
38
+ * @param {{
39
+ * prefix?: string,
40
+ * shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
41
+ * }} options.
42
+ * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
43
+ *
44
+ * @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
45
+ *
46
+ * @example
47
+ * const { css, vars } = parser({
48
+ * fontSize: 12,
49
+ * lineHeight: 1.2,
50
+ * palette: { primary: { 500: 'var(--color)' } }
51
+ * }, { prefix: 'foo' })
52
+ *
53
+ * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
54
+ * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
55
+ */
56
+ export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
57
+ prefix?: string;
58
+ shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
59
+ }): {
60
+ css: Record<string, string | number>;
61
+ vars: NestedRecord<string>;
62
+ };
63
+ export {};
@@ -1,42 +1,42 @@
1
- /// <reference types="react" />
2
- export declare const DEFAULT_MODE_STORAGE_KEY = "mode";
3
- export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
4
- export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
5
- export interface GetInitColorSchemeScriptOptions {
6
- /**
7
- * The mode to be used for the first visit
8
- * @default 'light'
9
- */
10
- defaultMode?: 'light' | 'dark' | 'system';
11
- /**
12
- * The default color scheme to be used on the light mode
13
- * @default 'light'
14
- */
15
- defaultLightColorScheme?: string;
16
- /**
17
- * The default color scheme to be used on the dark mode
18
- * * @default 'dark'
19
- */
20
- defaultDarkColorScheme?: string;
21
- /**
22
- * The node (provided as string) used to attach the color-scheme attribute
23
- * @default 'document.documentElement'
24
- */
25
- colorSchemeNode?: string;
26
- /**
27
- * localStorage key used to store `mode`
28
- * @default 'mode'
29
- */
30
- modeStorageKey?: string;
31
- /**
32
- * localStorage key used to store `colorScheme`
33
- * @default 'color-scheme'
34
- */
35
- colorSchemeStorageKey?: string;
36
- /**
37
- * DOM attribute for applying color scheme
38
- * @default 'data-color-scheme'
39
- */
40
- attribute?: string;
41
- }
42
- export default function getInitColorSchemeScript(options?: GetInitColorSchemeScriptOptions): JSX.Element;
1
+ /// <reference types="react" />
2
+ export declare const DEFAULT_MODE_STORAGE_KEY = "mode";
3
+ export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
4
+ export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
5
+ export interface GetInitColorSchemeScriptOptions {
6
+ /**
7
+ * The mode to be used for the first visit
8
+ * @default 'light'
9
+ */
10
+ defaultMode?: 'light' | 'dark' | 'system';
11
+ /**
12
+ * The default color scheme to be used on the light mode
13
+ * @default 'light'
14
+ */
15
+ defaultLightColorScheme?: string;
16
+ /**
17
+ * The default color scheme to be used on the dark mode
18
+ * * @default 'dark'
19
+ */
20
+ defaultDarkColorScheme?: string;
21
+ /**
22
+ * The node (provided as string) used to attach the color-scheme attribute
23
+ * @default 'document.documentElement'
24
+ */
25
+ colorSchemeNode?: string;
26
+ /**
27
+ * localStorage key used to store `mode`
28
+ * @default 'mode'
29
+ */
30
+ modeStorageKey?: string;
31
+ /**
32
+ * localStorage key used to store `colorScheme`
33
+ * @default 'color-scheme'
34
+ */
35
+ colorSchemeStorageKey?: string;
36
+ /**
37
+ * DOM attribute for applying color scheme
38
+ * @default 'data-color-scheme'
39
+ */
40
+ attribute?: string;
41
+ }
42
+ export default function getInitColorSchemeScript(options?: GetInitColorSchemeScriptOptions): JSX.Element;
@@ -1,3 +1,3 @@
1
- export { default } from './createCssVarsProvider';
2
- export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
3
- export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
1
+ export { default } from './createCssVarsProvider';
2
+ export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
3
+ export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
@@ -1,53 +1,53 @@
1
- export type Mode = 'light' | 'dark' | 'system';
2
- export type SystemMode = Exclude<Mode, 'system'>;
3
- export interface State<SupportedColorScheme extends string> {
4
- /**
5
- * User selected mode.
6
- * Note: on the server, mode is always undefined
7
- */
8
- mode: Mode | undefined;
9
- /**
10
- * Only valid if `mode: 'system'`, either 'light' | 'dark'.
11
- */
12
- systemMode: SystemMode | undefined;
13
- /**
14
- * The color scheme for the light mode.
15
- */
16
- lightColorScheme: SupportedColorScheme;
17
- /**
18
- * The color scheme for the dark mode.
19
- */
20
- darkColorScheme: SupportedColorScheme;
21
- }
22
- export type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
23
- /**
24
- * The current application color scheme. It is always `undefined` on the server.
25
- */
26
- colorScheme: SupportedColorScheme | undefined;
27
- /**
28
- * `mode` is saved to internal state and localStorage
29
- * If `mode` is null, it will be reset to the defaultMode
30
- */
31
- setMode: (mode: Mode | null) => void;
32
- /**
33
- * `colorScheme` is saved to internal state and localStorage
34
- * If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
35
- */
36
- setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
37
- light: SupportedColorScheme | null;
38
- dark: SupportedColorScheme | null;
39
- }> | null) => void;
40
- };
41
- export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
42
- export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
43
- interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
44
- defaultLightColorScheme: SupportedColorScheme;
45
- defaultDarkColorScheme: SupportedColorScheme;
46
- supportedColorSchemes: Array<SupportedColorScheme>;
47
- defaultMode?: Mode;
48
- modeStorageKey?: string;
49
- colorSchemeStorageKey?: string;
50
- storageWindow?: Window | null;
51
- }
52
- export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
53
- export {};
1
+ export type Mode = 'light' | 'dark' | 'system';
2
+ export type SystemMode = Exclude<Mode, 'system'>;
3
+ export interface State<SupportedColorScheme extends string> {
4
+ /**
5
+ * User selected mode.
6
+ * Note: on the server, mode is always undefined
7
+ */
8
+ mode: Mode | undefined;
9
+ /**
10
+ * Only valid if `mode: 'system'`, either 'light' | 'dark'.
11
+ */
12
+ systemMode: SystemMode | undefined;
13
+ /**
14
+ * The color scheme for the light mode.
15
+ */
16
+ lightColorScheme: SupportedColorScheme;
17
+ /**
18
+ * The color scheme for the dark mode.
19
+ */
20
+ darkColorScheme: SupportedColorScheme;
21
+ }
22
+ export type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
23
+ /**
24
+ * The current application color scheme. It is always `undefined` on the server.
25
+ */
26
+ colorScheme: SupportedColorScheme | undefined;
27
+ /**
28
+ * `mode` is saved to internal state and localStorage
29
+ * If `mode` is null, it will be reset to the defaultMode
30
+ */
31
+ setMode: (mode: Mode | null) => void;
32
+ /**
33
+ * `colorScheme` is saved to internal state and localStorage
34
+ * If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
35
+ */
36
+ setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
37
+ light: SupportedColorScheme | null;
38
+ dark: SupportedColorScheme | null;
39
+ }> | null) => void;
40
+ };
41
+ export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
42
+ export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
43
+ interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
44
+ defaultLightColorScheme: SupportedColorScheme;
45
+ defaultDarkColorScheme: SupportedColorScheme;
46
+ supportedColorSchemes: Array<SupportedColorScheme>;
47
+ defaultMode?: Mode;
48
+ modeStorageKey?: string;
49
+ colorSchemeStorageKey?: string;
50
+ storageWindow?: Window | null;
51
+ }
52
+ export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
53
+ export {};
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
@@ -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;