@mui/system 5.11.14 → 5.11.15

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 (53) hide show
  1. package/Box/Box.spec.d.ts +1 -1
  2. package/CHANGELOG.md +52 -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/Stack.js +11 -1
  9. package/Stack/StackProps.d.ts +53 -42
  10. package/Stack/createStack.d.ts +21 -21
  11. package/Stack/createStack.js +10 -3
  12. package/Stack/index.d.ts +5 -5
  13. package/Stack/stackClasses.d.ts +8 -8
  14. package/Unstable_Grid/Grid.d.ts +12 -12
  15. package/Unstable_Grid/GridProps.d.ts +173 -173
  16. package/Unstable_Grid/createGrid.d.ts +11 -11
  17. package/Unstable_Grid/gridClasses.d.ts +20 -20
  18. package/Unstable_Grid/gridGenerator.d.ts +38 -33
  19. package/Unstable_Grid/gridGenerator.js +24 -10
  20. package/Unstable_Grid/index.d.ts +5 -5
  21. package/createBox.spec.d.ts +1 -1
  22. package/createTheme/createSpacing.d.ts +10 -10
  23. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  24. package/cssVars/createCssVarsTheme.d.ts +13 -13
  25. package/cssVars/createGetCssVar.d.ts +5 -5
  26. package/cssVars/cssVarsParser.d.ts +64 -64
  27. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  28. package/cssVars/index.d.ts +5 -5
  29. package/cssVars/prepareCssVars.d.ts +14 -14
  30. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  31. package/esm/Stack/Stack.js +11 -1
  32. package/esm/Stack/createStack.js +10 -3
  33. package/esm/Unstable_Grid/gridGenerator.js +24 -10
  34. package/esm/styleFunctionSx/defaultSxConfig.js +3 -38
  35. package/esm/styleFunctionSx/styleFunctionSx.js +5 -0
  36. package/index.js +1 -1
  37. package/index.spec.d.ts +1 -1
  38. package/legacy/Stack/Stack.js +11 -1
  39. package/legacy/Stack/createStack.js +10 -2
  40. package/legacy/Unstable_Grid/gridGenerator.js +45 -35
  41. package/legacy/index.js +1 -1
  42. package/legacy/styleFunctionSx/defaultSxConfig.js +3 -38
  43. package/legacy/styleFunctionSx/styleFunctionSx.js +7 -4
  44. package/modern/Stack/Stack.js +11 -1
  45. package/modern/Stack/createStack.js +10 -3
  46. package/modern/Unstable_Grid/gridGenerator.js +24 -10
  47. package/modern/index.js +1 -1
  48. package/modern/styleFunctionSx/defaultSxConfig.js +3 -35
  49. package/modern/styleFunctionSx/styleFunctionSx.js +5 -0
  50. package/package.json +1 -1
  51. package/styleFunctionSx/defaultSxConfig.js +3 -38
  52. package/styleFunctionSx/styleFunctionSx.js +5 -0
  53. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
@@ -1,13 +1,13 @@
1
- import { DefaultCssVarsTheme } from './prepareCssVars';
2
- interface Theme extends DefaultCssVarsTheme {
3
- cssVarPrefix?: string;
4
- shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
5
- }
6
- declare function createCssVarsTheme<T extends Theme, ThemeVars extends Record<string, any>>(theme: T): T & {
7
- vars: ThemeVars;
8
- generateCssVars: (colorScheme?: string | undefined) => {
9
- css: Record<string, string | number>;
10
- vars: ThemeVars;
11
- };
12
- };
13
- export default createCssVarsTheme;
1
+ import { DefaultCssVarsTheme } from './prepareCssVars';
2
+ interface Theme extends DefaultCssVarsTheme {
3
+ cssVarPrefix?: string;
4
+ shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
5
+ }
6
+ declare function createCssVarsTheme<T extends Theme, ThemeVars extends Record<string, any>>(theme: T): T & {
7
+ vars: ThemeVars;
8
+ generateCssVars: (colorScheme?: string | undefined) => {
9
+ css: Record<string, string | number>;
10
+ vars: ThemeVars;
11
+ };
12
+ };
13
+ export default createCssVarsTheme;
@@ -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,64 +1,64 @@
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: Record<string, any>, options?: {
57
- prefix?: string;
58
- shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
59
- }): {
60
- css: Record<string, string | number>;
61
- vars: T;
62
- varsWithDefaults: {};
63
- };
64
- 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: Record<string, any>, options?: {
57
+ prefix?: string;
58
+ shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
59
+ }): {
60
+ css: Record<string, string | number>;
61
+ vars: T;
62
+ varsWithDefaults: {};
63
+ };
64
+ 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,5 +1,5 @@
1
- export { default } from './createCssVarsProvider';
2
- export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
3
- export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
4
- export { default as prepareCssVars } from './prepareCssVars';
5
- export { default as createCssVarsTheme } from './createCssVarsTheme';
1
+ export { default } from './createCssVarsProvider';
2
+ export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
3
+ export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
4
+ export { default as prepareCssVars } from './prepareCssVars';
5
+ export { default as createCssVarsTheme } from './createCssVarsTheme';
@@ -1,14 +1,14 @@
1
- export interface DefaultCssVarsTheme {
2
- colorSchemes: Record<string, any>;
3
- }
4
- declare function prepareCssVars<T extends DefaultCssVarsTheme, ThemeVars extends Record<string, any>>(theme: T, parserConfig?: {
5
- prefix?: string;
6
- shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
7
- }): {
8
- vars: ThemeVars;
9
- generateCssVars: (colorScheme?: string) => {
10
- css: Record<string, string | number>;
11
- vars: ThemeVars;
12
- };
13
- };
14
- export default prepareCssVars;
1
+ export interface DefaultCssVarsTheme {
2
+ colorSchemes: Record<string, any>;
3
+ }
4
+ declare function prepareCssVars<T extends DefaultCssVarsTheme, ThemeVars extends Record<string, any>>(theme: T, parserConfig?: {
5
+ prefix?: string;
6
+ shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
7
+ }): {
8
+ vars: ThemeVars;
9
+ generateCssVars: (colorScheme?: string) => {
10
+ css: Record<string, string | number>;
11
+ vars: ThemeVars;
12
+ };
13
+ };
14
+ export default prepareCssVars;
@@ -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 {};
@@ -44,6 +44,16 @@ process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ =
44
44
  /**
45
45
  * The system prop, which allows defining system overrides as well as additional CSS styles.
46
46
  */
47
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
47
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
48
+ /**
49
+ * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
50
+ *
51
+ * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
52
+ * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
53
+ *
54
+ * To enable this flag globally, follow the theme's default props configuration.
55
+ * @default false
56
+ */
57
+ useFlexGap: PropTypes.bool
48
58
  } : void 0;
49
59
  export default Stack;
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["component", "direction", "spacing", "divider", "children", "className"];
3
+ const _excluded = ["component", "direction", "spacing", "divider", "children", "className", "useFlexGap"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -95,6 +95,11 @@ export const style = ({
95
95
  });
96
96
  }
97
97
  const styleFromPropValue = (propValue, breakpoint) => {
98
+ if (ownerState.useFlexGap) {
99
+ return {
100
+ gap: getValue(transformer, propValue)
101
+ };
102
+ }
98
103
  return {
99
104
  '& > :not(style) + :not(style)': {
100
105
  margin: 0,
@@ -132,12 +137,14 @@ export default function createStack(options = {}) {
132
137
  spacing = 0,
133
138
  divider,
134
139
  children,
135
- className
140
+ className,
141
+ useFlexGap = false
136
142
  } = props,
137
143
  other = _objectWithoutPropertiesLoose(props, _excluded);
138
144
  const ownerState = {
139
145
  direction,
140
- spacing
146
+ spacing,
147
+ useFlexGap
141
148
  };
142
149
  const classes = useUtilityClasses();
143
150
  return /*#__PURE__*/_jsx(StackRoot, _extends({
@@ -1,10 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ function appendLevel(level) {
3
+ if (!level) {
4
+ return '';
5
+ }
6
+ return `Level${level}`;
7
+ }
2
8
  function isNestedContainer(ownerState) {
3
9
  return ownerState.level > 0 && ownerState.container;
4
10
  }
5
11
  function createGetSelfSpacing(ownerState) {
6
12
  return function getSelfSpacing(axis) {
7
- return `var(--Grid-${axis}Spacing${ownerState.level || ''})`;
13
+ return `var(--Grid-${axis}Spacing${appendLevel(ownerState.level)})`;
8
14
  };
9
15
  }
10
16
  function createGetParentSpacing(ownerState) {
@@ -12,9 +18,15 @@ function createGetParentSpacing(ownerState) {
12
18
  if (ownerState.level === 0) {
13
19
  return `var(--Grid-${axis}Spacing)`;
14
20
  }
15
- return `var(--Grid-${axis}Spacing${ownerState.level - 1 || ''})`;
21
+ return `var(--Grid-${axis}Spacing${appendLevel(ownerState.level - 1)})`;
16
22
  };
17
23
  }
24
+ function getParentColumns(ownerState) {
25
+ if (ownerState.level === 0) {
26
+ return `var(--Grid-columns)`;
27
+ }
28
+ return `var(--Grid-columns${appendLevel(ownerState.level - 1)})`;
29
+ }
18
30
  export const filterBreakpointKeys = (breakpointsKeys, responsiveKeys) => breakpointsKeys.filter(key => responsiveKeys.includes(key));
19
31
  export const traverseBreakpoints = (breakpoints, responsive, iterator) => {
20
32
  const smallestBreakpoint = breakpoints.keys[0]; // the keys is sorted from smallest to largest by `createBreakpoints`.
@@ -85,7 +97,7 @@ export const generateGridSizeStyles = ({
85
97
  style = {
86
98
  flexGrow: 0,
87
99
  flexBasis: 'auto',
88
- width: `calc(100% * ${value} / var(--Grid-columns)${isNestedContainer(ownerState) ? ` + ${getSelfSpacing('column')}` : ''})`
100
+ width: `calc(100% * ${value} / ${getParentColumns(ownerState)}${isNestedContainer(ownerState) ? ` + ${getSelfSpacing('column')}` : ''})`
89
101
  };
90
102
  }
91
103
  appendStyle(styles, style);
@@ -106,7 +118,7 @@ export const generateGridOffsetStyles = ({
106
118
  }
107
119
  if (typeof value === 'number') {
108
120
  style = {
109
- marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / var(--Grid-columns))`
121
+ marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)})`
110
122
  };
111
123
  }
112
124
  appendStyle(styles, style);
@@ -120,12 +132,14 @@ export const generateGridColumnsStyles = ({
120
132
  if (!ownerState.container) {
121
133
  return {};
122
134
  }
123
- const styles = {
135
+ const styles = isNestedContainer(ownerState) ? {
136
+ [`--Grid-columns${appendLevel(ownerState.level)}`]: getParentColumns(ownerState)
137
+ } : {
124
138
  '--Grid-columns': 12
125
139
  };
126
140
  traverseBreakpoints(theme.breakpoints, ownerState.columns, (appendStyle, value) => {
127
141
  appendStyle(styles, {
128
- '--Grid-columns': value
142
+ [`--Grid-columns${appendLevel(ownerState.level)}`]: value
129
143
  });
130
144
  });
131
145
  return styles;
@@ -141,12 +155,12 @@ export const generateGridRowSpacingStyles = ({
141
155
  const styles = isNestedContainer(ownerState) ? {
142
156
  // Set the default spacing as its parent spacing.
143
157
  // It will be overridden if spacing props are provided
144
- [`--Grid-rowSpacing${ownerState.level || ''}`]: getParentSpacing('row')
158
+ [`--Grid-rowSpacing${appendLevel(ownerState.level)}`]: getParentSpacing('row')
145
159
  } : {};
146
160
  traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, (appendStyle, value) => {
147
161
  var _theme$spacing;
148
162
  appendStyle(styles, {
149
- [`--Grid-rowSpacing${ownerState.level || ''}`]: typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)
163
+ [`--Grid-rowSpacing${appendLevel(ownerState.level)}`]: typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)
150
164
  });
151
165
  });
152
166
  return styles;
@@ -162,12 +176,12 @@ export const generateGridColumnSpacingStyles = ({
162
176
  const styles = isNestedContainer(ownerState) ? {
163
177
  // Set the default spacing as its parent spacing.
164
178
  // It will be overridden if spacing props are provided
165
- [`--Grid-columnSpacing${ownerState.level || ''}`]: getParentSpacing('column')
179
+ [`--Grid-columnSpacing${appendLevel(ownerState.level)}`]: getParentSpacing('column')
166
180
  } : {};
167
181
  traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, (appendStyle, value) => {
168
182
  var _theme$spacing2;
169
183
  appendStyle(styles, {
170
- [`--Grid-columnSpacing${ownerState.level || ''}`]: typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)
184
+ [`--Grid-columnSpacing${appendLevel(ownerState.level)}`]: typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)
171
185
  });
172
186
  });
173
187
  return styles;
@@ -1,40 +1,8 @@
1
- import { unstable_capitalize as capitalize } from '@mui/utils';
2
1
  import { padding, margin } from '../spacing';
3
- import { handleBreakpoints } from '../breakpoints';
4
2
  import { borderRadius, borderTransform } from '../borders';
5
3
  import { gap, rowGap, columnGap } from '../cssGrid';
6
4
  import { paletteTransform } from '../palette';
7
5
  import { maxWidth, sizingTransform } from '../sizing';
8
- const createFontStyleFunction = prop => {
9
- return props => {
10
- if (props[prop] !== undefined && props[prop] !== null) {
11
- const styleFromPropValue = propValue => {
12
- var _props$theme$typograp;
13
- // fetch the value directly defined in the theme, like fontWeightLight
14
- let value = (_props$theme$typograp = props.theme.typography) == null ? void 0 : _props$theme$typograp[propValue];
15
- if (typeof value === 'object') {
16
- // typography variant was pulled, but these props can't be an object
17
- value = null;
18
- }
19
- if (!value) {
20
- var _props$theme$typograp2, _props$prop;
21
- // fetch fontWeightLight when the value is 'light'
22
- value = (_props$theme$typograp2 = props.theme.typography) == null ? void 0 : _props$theme$typograp2[`${prop}${props[prop] === 'default' || props[prop] === prop ? '' : capitalize((_props$prop = props[prop]) == null ? void 0 : _props$prop.toString())}`];
23
- }
24
- if (!value) {
25
- var _props$theme$typograp3, _props$theme$typograp4, _props$theme$typograp5;
26
- // fetch the value from the typography variant or default to the propValue
27
- value = (_props$theme$typograp3 = (_props$theme$typograp4 = props.theme.typography) == null ? void 0 : (_props$theme$typograp5 = _props$theme$typograp4[propValue]) == null ? void 0 : _props$theme$typograp5[prop]) != null ? _props$theme$typograp3 : propValue;
28
- }
29
- return {
30
- [prop]: value
31
- };
32
- };
33
- return handleBreakpoints(props, props[prop], styleFromPropValue);
34
- }
35
- return null;
36
- };
37
- };
38
6
  const defaultSxConfig = {
39
7
  // borders
40
8
  border: {
@@ -293,19 +261,16 @@ const defaultSxConfig = {
293
261
  boxSizing: {},
294
262
  // typography
295
263
  fontFamily: {
296
- themeKey: 'typography',
297
- style: createFontStyleFunction('fontFamily')
264
+ themeKey: 'typography'
298
265
  },
299
266
  fontSize: {
300
- themeKey: 'typography',
301
- style: createFontStyleFunction('fontSize')
267
+ themeKey: 'typography'
302
268
  },
303
269
  fontStyle: {
304
270
  themeKey: 'typography'
305
271
  },
306
272
  fontWeight: {
307
- themeKey: 'typography',
308
- style: createFontStyleFunction('fontWeight')
273
+ themeKey: 'typography'
309
274
  },
310
275
  letterSpacing: {},
311
276
  textTransform: {},
@@ -34,6 +34,11 @@ export function unstable_createStyleFunctionSx() {
34
34
  if (val == null) {
35
35
  return null;
36
36
  }
37
+ if (themeKey === 'typography' && val === 'inherit') {
38
+ return {
39
+ [prop]: val
40
+ };
41
+ }
37
42
  const themeMapping = getPath(theme, themeKey) || {};
38
43
  if (style) {
39
44
  return style(props);
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.11.14
2
+ * @mui/system v5.11.15
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/index.spec.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};