@mui/system 5.11.12 → 5.11.13

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 (38) hide show
  1. package/Box/Box.spec.d.ts +1 -1
  2. package/CHANGELOG.md +43 -2
  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 +173 -173
  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 +33 -33
  17. package/Unstable_Grid/index.d.ts +5 -5
  18. package/createBox.spec.d.ts +1 -1
  19. package/createTheme/createSpacing.d.ts +10 -10
  20. package/cssVars/createCssVarsProvider.d.ts +0 -42
  21. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  22. package/cssVars/createCssVarsTheme.d.ts +13 -10
  23. package/cssVars/createGetCssVar.d.ts +5 -5
  24. package/cssVars/cssVarsParser.d.ts +64 -64
  25. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  26. package/cssVars/index.d.ts +5 -5
  27. package/cssVars/prepareCssVars.d.ts +14 -11
  28. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  29. package/esm/styleFunctionSx/defaultSxConfig.js +30 -3
  30. package/index.js +1 -1
  31. package/index.spec.d.ts +1 -1
  32. package/legacy/index.js +1 -1
  33. package/legacy/styleFunctionSx/defaultSxConfig.js +29 -3
  34. package/modern/index.js +1 -1
  35. package/modern/styleFunctionSx/defaultSxConfig.js +28 -3
  36. package/package.json +3 -3
  37. package/styleFunctionSx/defaultSxConfig.js +30 -3
  38. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
@@ -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: 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
- 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,11 +1,14 @@
1
- export interface DefaultCssVarsTheme {
2
- colorSchemes: Record<string, any>;
3
- }
4
- declare function prepareCssVars<T extends DefaultCssVarsTheme, ThemeVars>(theme: T, parserConfig?: {
5
- prefix?: string;
6
- shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
7
- }): {
8
- vars: ThemeVars;
9
- generateCssVars: (colorScheme?: string) => any;
10
- };
11
- 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 {};
@@ -1,8 +1,32 @@
1
+ import { unstable_capitalize as capitalize } from '@mui/utils';
1
2
  import { padding, margin } from '../spacing';
3
+ import { handleBreakpoints } from '../breakpoints';
2
4
  import { borderRadius, borderTransform } from '../borders';
3
5
  import { gap, rowGap, columnGap } from '../cssGrid';
4
6
  import { paletteTransform } from '../palette';
5
7
  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, _props$prop;
13
+ let value = (_props$theme$typograp = props.theme.typography) == null ? void 0 : _props$theme$typograp[`${prop}${props[prop] === 'default' || props[prop] === prop ? '' : capitalize((_props$prop = props[prop]) == null ? void 0 : _props$prop.toString())}`];
14
+ if (!value) {
15
+ var _props$theme$typograp2, _props$theme$typograp3;
16
+ value = (_props$theme$typograp2 = props.theme.typography) == null ? void 0 : (_props$theme$typograp3 = _props$theme$typograp2[propValue]) == null ? void 0 : _props$theme$typograp3[prop];
17
+ }
18
+ if (!value) {
19
+ value = propValue;
20
+ }
21
+ return {
22
+ [prop]: value
23
+ };
24
+ };
25
+ return handleBreakpoints(props, props[prop], styleFromPropValue);
26
+ }
27
+ return null;
28
+ };
29
+ };
6
30
  const defaultSxConfig = {
7
31
  // borders
8
32
  border: {
@@ -261,16 +285,19 @@ const defaultSxConfig = {
261
285
  boxSizing: {},
262
286
  // typography
263
287
  fontFamily: {
264
- themeKey: 'typography'
288
+ themeKey: 'typography',
289
+ style: createFontStyleFunction('fontFamily')
265
290
  },
266
291
  fontSize: {
267
- themeKey: 'typography'
292
+ themeKey: 'typography',
293
+ style: createFontStyleFunction('fontSize')
268
294
  },
269
295
  fontStyle: {
270
296
  themeKey: 'typography'
271
297
  },
272
298
  fontWeight: {
273
- themeKey: 'typography'
299
+ themeKey: 'typography',
300
+ style: createFontStyleFunction('fontWeight')
274
301
  },
275
302
  letterSpacing: {},
276
303
  textTransform: {},
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.11.12
2
+ * @mui/system v5.11.13
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 {};
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.11.12
2
+ * @mui/system v5.11.13
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,8 +1,31 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import { unstable_capitalize as capitalize } from '@mui/utils';
1
3
  import { padding, margin } from '../spacing';
4
+ import { handleBreakpoints } from '../breakpoints';
2
5
  import { borderRadius, borderTransform } from '../borders';
3
6
  import { gap, rowGap, columnGap } from '../cssGrid';
4
7
  import { paletteTransform } from '../palette';
5
8
  import { maxWidth, sizingTransform } from '../sizing';
9
+ var createFontStyleFunction = function createFontStyleFunction(prop) {
10
+ return function (props) {
11
+ if (props[prop] !== undefined && props[prop] !== null) {
12
+ var styleFromPropValue = function styleFromPropValue(propValue) {
13
+ var _props$theme$typograp, _props$prop;
14
+ var value = (_props$theme$typograp = props.theme.typography) == null ? void 0 : _props$theme$typograp["".concat(prop).concat(props[prop] === 'default' || props[prop] === prop ? '' : capitalize((_props$prop = props[prop]) == null ? void 0 : _props$prop.toString()))];
15
+ if (!value) {
16
+ var _props$theme$typograp2, _props$theme$typograp3;
17
+ value = (_props$theme$typograp2 = props.theme.typography) == null ? void 0 : (_props$theme$typograp3 = _props$theme$typograp2[propValue]) == null ? void 0 : _props$theme$typograp3[prop];
18
+ }
19
+ if (!value) {
20
+ value = propValue;
21
+ }
22
+ return _defineProperty({}, prop, value);
23
+ };
24
+ return handleBreakpoints(props, props[prop], styleFromPropValue);
25
+ }
26
+ return null;
27
+ };
28
+ };
6
29
  var defaultSxConfig = {
7
30
  // borders
8
31
  border: {
@@ -263,16 +286,19 @@ var defaultSxConfig = {
263
286
  boxSizing: {},
264
287
  // typography
265
288
  fontFamily: {
266
- themeKey: 'typography'
289
+ themeKey: 'typography',
290
+ style: createFontStyleFunction('fontFamily')
267
291
  },
268
292
  fontSize: {
269
- themeKey: 'typography'
293
+ themeKey: 'typography',
294
+ style: createFontStyleFunction('fontSize')
270
295
  },
271
296
  fontStyle: {
272
297
  themeKey: 'typography'
273
298
  },
274
299
  fontWeight: {
275
- themeKey: 'typography'
300
+ themeKey: 'typography',
301
+ style: createFontStyleFunction('fontWeight')
276
302
  },
277
303
  letterSpacing: {},
278
304
  textTransform: {},
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.11.12
2
+ * @mui/system v5.11.13
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,8 +1,30 @@
1
+ import { unstable_capitalize as capitalize } from '@mui/utils';
1
2
  import { padding, margin } from '../spacing';
3
+ import { handleBreakpoints } from '../breakpoints';
2
4
  import { borderRadius, borderTransform } from '../borders';
3
5
  import { gap, rowGap, columnGap } from '../cssGrid';
4
6
  import { paletteTransform } from '../palette';
5
7
  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
+ let value = props.theme.typography?.[`${prop}${props[prop] === 'default' || props[prop] === prop ? '' : capitalize(props[prop]?.toString())}`];
13
+ if (!value) {
14
+ value = props.theme.typography?.[propValue]?.[prop];
15
+ }
16
+ if (!value) {
17
+ value = propValue;
18
+ }
19
+ return {
20
+ [prop]: value
21
+ };
22
+ };
23
+ return handleBreakpoints(props, props[prop], styleFromPropValue);
24
+ }
25
+ return null;
26
+ };
27
+ };
6
28
  const defaultSxConfig = {
7
29
  // borders
8
30
  border: {
@@ -261,16 +283,19 @@ const defaultSxConfig = {
261
283
  boxSizing: {},
262
284
  // typography
263
285
  fontFamily: {
264
- themeKey: 'typography'
286
+ themeKey: 'typography',
287
+ style: createFontStyleFunction('fontFamily')
265
288
  },
266
289
  fontSize: {
267
- themeKey: 'typography'
290
+ themeKey: 'typography',
291
+ style: createFontStyleFunction('fontSize')
268
292
  },
269
293
  fontStyle: {
270
294
  themeKey: 'typography'
271
295
  },
272
296
  fontWeight: {
273
- themeKey: 'typography'
297
+ themeKey: 'typography',
298
+ style: createFontStyleFunction('fontWeight')
274
299
  },
275
300
  letterSpacing: {},
276
301
  textTransform: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/system",
3
- "version": "5.11.12",
3
+ "version": "5.11.13",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "CSS utilities for rapidly laying out custom designs.",
@@ -44,10 +44,10 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@babel/runtime": "^7.21.0",
47
- "@mui/private-theming": "^5.11.12",
47
+ "@mui/private-theming": "^5.11.13",
48
48
  "@mui/styled-engine": "^5.11.11",
49
49
  "@mui/types": "^7.2.3",
50
- "@mui/utils": "^5.11.12",
50
+ "@mui/utils": "^5.11.13",
51
51
  "clsx": "^1.2.1",
52
52
  "csstype": "^3.1.1",
53
53
  "prop-types": "^15.8.1"
@@ -4,11 +4,35 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _utils = require("@mui/utils");
7
8
  var _spacing = require("../spacing");
9
+ var _breakpoints = require("../breakpoints");
8
10
  var _borders = require("../borders");
9
11
  var _cssGrid = require("../cssGrid");
10
12
  var _palette = require("../palette");
11
13
  var _sizing = require("../sizing");
14
+ const createFontStyleFunction = prop => {
15
+ return props => {
16
+ if (props[prop] !== undefined && props[prop] !== null) {
17
+ const styleFromPropValue = propValue => {
18
+ var _props$theme$typograp, _props$prop;
19
+ let value = (_props$theme$typograp = props.theme.typography) == null ? void 0 : _props$theme$typograp[`${prop}${props[prop] === 'default' || props[prop] === prop ? '' : (0, _utils.unstable_capitalize)((_props$prop = props[prop]) == null ? void 0 : _props$prop.toString())}`];
20
+ if (!value) {
21
+ var _props$theme$typograp2, _props$theme$typograp3;
22
+ value = (_props$theme$typograp2 = props.theme.typography) == null ? void 0 : (_props$theme$typograp3 = _props$theme$typograp2[propValue]) == null ? void 0 : _props$theme$typograp3[prop];
23
+ }
24
+ if (!value) {
25
+ value = propValue;
26
+ }
27
+ return {
28
+ [prop]: value
29
+ };
30
+ };
31
+ return (0, _breakpoints.handleBreakpoints)(props, props[prop], styleFromPropValue);
32
+ }
33
+ return null;
34
+ };
35
+ };
12
36
  const defaultSxConfig = {
13
37
  // borders
14
38
  border: {
@@ -267,16 +291,19 @@ const defaultSxConfig = {
267
291
  boxSizing: {},
268
292
  // typography
269
293
  fontFamily: {
270
- themeKey: 'typography'
294
+ themeKey: 'typography',
295
+ style: createFontStyleFunction('fontFamily')
271
296
  },
272
297
  fontSize: {
273
- themeKey: 'typography'
298
+ themeKey: 'typography',
299
+ style: createFontStyleFunction('fontSize')
274
300
  },
275
301
  fontStyle: {
276
302
  themeKey: 'typography'
277
303
  },
278
304
  fontWeight: {
279
- themeKey: 'typography'
305
+ themeKey: 'typography',
306
+ style: createFontStyleFunction('fontWeight')
280
307
  },
281
308
  letterSpacing: {},
282
309
  textTransform: {},
@@ -1 +1 @@
1
- export {};
1
+ export {};