@mui/system 5.14.3 → 5.14.4

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 (41) hide show
  1. package/Box/Box.d.ts +20 -9
  2. package/CHANGELOG.md +102 -4
  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/GlobalStyles/GlobalStyles.d.ts +13 -13
  8. package/GlobalStyles/index.d.ts +2 -2
  9. package/Stack/Stack.d.ts +14 -14
  10. package/Stack/StackProps.d.ts +53 -53
  11. package/Stack/createStack.d.ts +21 -21
  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 +185 -185
  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 +33 -33
  19. package/Unstable_Grid/index.d.ts +6 -6
  20. package/Unstable_Grid/traverseBreakpoints.d.ts +7 -7
  21. package/createStyled.d.ts +6 -6
  22. package/createStyled.js +23 -4
  23. package/createTheme/createSpacing.d.ts +10 -10
  24. package/cssVars/createCssVarsTheme.d.ts +15 -15
  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 +16 -16
  30. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  31. package/esm/createStyled.js +24 -5
  32. package/esm/styleFunctionSx/styleFunctionSx.js +2 -0
  33. package/index.js +1 -1
  34. package/legacy/createStyled.js +25 -5
  35. package/legacy/index.js +1 -1
  36. package/legacy/styleFunctionSx/styleFunctionSx.js +2 -0
  37. package/modern/createStyled.js +24 -5
  38. package/modern/index.js +1 -1
  39. package/modern/styleFunctionSx/styleFunctionSx.js +2 -0
  40. package/package.json +3 -3
  41. package/styleFunctionSx/styleFunctionSx.js +2 -0
@@ -1,12 +1,12 @@
1
- /**
2
- *
3
- * Demos:
4
- *
5
- * - [Grid (Material UI)](https://mui.com/material-ui/react-grid/)
6
- *
7
- * API:
8
- *
9
- * - [Grid API](https://mui.com/system/api/grid/)
10
- */
11
- declare const Grid: import("@mui/types").OverridableComponent<import("./GridProps").GridTypeMap<{}, "div">>;
12
- export default Grid;
1
+ /**
2
+ *
3
+ * Demos:
4
+ *
5
+ * - [Grid (Material UI)](https://mui.com/material-ui/react-grid/)
6
+ *
7
+ * API:
8
+ *
9
+ * - [Grid API](https://mui.com/system/api/grid/)
10
+ */
11
+ declare const Grid: import("@mui/types").OverridableComponent<import("./GridProps").GridTypeMap<{}, "div">>;
12
+ export default Grid;
@@ -1,185 +1,185 @@
1
- import * as React from 'react';
2
- import { OverrideProps, IfEquals } from '@mui/types';
3
- import { SxProps } from '../styleFunctionSx';
4
- import { Theme, Breakpoint, BreakpointOverrides } from '../createTheme';
5
- import { SystemProps } from '../Box';
6
- type ResponsiveStyleValue<T> = T | Array<T | null> | {
7
- [key in Breakpoint]?: T | null;
8
- };
9
- export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
10
- export type GridSpacing = number | string;
11
- export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
12
- export type GridSize = 'auto' | number;
13
- export interface GridDefaultBreakpoints {
14
- /**
15
- * If a number, it sets the number of columns the grid item uses.
16
- * It can't be greater than the total number of columns of the container (12 by default).
17
- * If 'auto', the grid item's width matches its content.
18
- * If false, the prop is ignored.
19
- * If true, the grid item's width grows to use the space available in the grid container.
20
- * The value is applied for the `lg` breakpoint and wider screens if not overridden.
21
- * @default false
22
- */
23
- lg?: boolean | GridSize;
24
- /**
25
- * If a number, it sets the margin-left equals to the number of columns the grid item uses.
26
- * If 'auto', the grid item push itself to the right-end of the container.
27
- * The value is applied for the `lg` breakpoint and wider screens if not overridden.
28
- */
29
- lgOffset?: GridSize;
30
- /**
31
- * If a number, it sets the number of columns the grid item uses.
32
- * It can't be greater than the total number of columns of the container (12 by default).
33
- * If 'auto', the grid item's width matches its content.
34
- * If false, the prop is ignored.
35
- * If true, the grid item's width grows to use the space available in the grid container.
36
- * The value is applied for the `md` breakpoint and wider screens if not overridden.
37
- * @default false
38
- */
39
- md?: boolean | GridSize;
40
- /**
41
- * If a number, it sets the margin-left equals to the number of columns the grid item uses.
42
- * If 'auto', the grid item push itself to the right-end of the container.
43
- * The value is applied for the `md` breakpoint and wider screens if not overridden.
44
- */
45
- mdOffset?: GridSize;
46
- /**
47
- * If a number, it sets the number of columns the grid item uses.
48
- * It can't be greater than the total number of columns of the container (12 by default).
49
- * If 'auto', the grid item's width matches its content.
50
- * If false, the prop is ignored.
51
- * If true, the grid item's width grows to use the space available in the grid container.
52
- * The value is applied for the `sm` breakpoint and wider screens if not overridden.
53
- * @default false
54
- */
55
- sm?: boolean | GridSize;
56
- /**
57
- * If a number, it sets the margin-left equals to the number of columns the grid item uses.
58
- * If 'auto', the grid item push itself to the right-end of the container.
59
- * The value is applied for the `sm` breakpoint and wider screens if not overridden.
60
- */
61
- smOffset?: GridSize;
62
- /**
63
- * If a number, it sets the number of columns the grid item uses.
64
- * It can't be greater than the total number of columns of the container (12 by default).
65
- * If 'auto', the grid item's width matches its content.
66
- * If false, the prop is ignored.
67
- * If true, the grid item's width grows to use the space available in the grid container.
68
- * The value is applied for the `xl` breakpoint and wider screens if not overridden.
69
- * @default false
70
- */
71
- xl?: boolean | GridSize;
72
- /**
73
- * If a number, it sets the margin-left equals to the number of columns the grid item uses.
74
- * If 'auto', the grid item push itself to the right-end of the container.
75
- * The value is applied for the `xl` breakpoint and wider screens if not overridden.
76
- */
77
- xlOffset?: GridSize;
78
- /**
79
- * If a number, it sets the number of columns the grid item uses.
80
- * It can't be greater than the total number of columns of the container (12 by default).
81
- * If 'auto', the grid item's width matches its content.
82
- * If false, the prop is ignored.
83
- * If true, the grid item's width grows to use the space available in the grid container.
84
- * The value is applied for all the screen sizes with the lowest priority.
85
- * @default false
86
- */
87
- xs?: boolean | GridSize;
88
- /**
89
- * If a number, it sets the margin-left equals to the number of columns the grid item uses.
90
- * If 'auto', the grid item push itself to the right-end of the container.
91
- * The value is applied for the `xs` breakpoint and wider screens if not overridden.
92
- */
93
- xsOffset?: GridSize;
94
- }
95
- type CustomBreakpoints = Partial<Record<Breakpoint, boolean | GridSize> & Record<`${Breakpoint}Offset`, GridSize>>;
96
- interface BreakpointOverridesEmpty {
97
- }
98
- type Breakpoints = IfEquals<BreakpointOverrides, BreakpointOverridesEmpty, GridDefaultBreakpoints, CustomBreakpoints>;
99
- export interface GridBaseProps extends Breakpoints {
100
- /**
101
- * The content of the component.
102
- */
103
- children?: React.ReactNode;
104
- /**
105
- * The number of columns.
106
- * @default 12
107
- */
108
- columns?: ResponsiveStyleValue<number>;
109
- /**
110
- * Defines the horizontal space between the type `item` components.
111
- * It overrides the value of the `spacing` prop.
112
- */
113
- columnSpacing?: ResponsiveStyleValue<GridSpacing>;
114
- /**
115
- * If `true`, the component will have the flex *container* behavior.
116
- * You should be wrapping *items* with a *container*.
117
- * @default false
118
- */
119
- container?: boolean;
120
- /**
121
- * Defines the `flex-direction` style property.
122
- * It is applied for all screen sizes.
123
- * @default 'row'
124
- */
125
- direction?: ResponsiveStyleValue<GridDirection>;
126
- /**
127
- * If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
128
- */
129
- disableEqualOverflow?: boolean;
130
- /**
131
- * @internal
132
- * The level of the grid starts from `0`
133
- * and increases when the grid nests inside another grid regardless of container or item.
134
- *
135
- * ```js
136
- * <Grid> // level 0
137
- * <Grid> // level 1
138
- * <Grid> // level 2
139
- * <Grid> // level 1
140
- * ```
141
- *
142
- * Only consecutive grid is considered nesting.
143
- * A grid container will start at `0` if there are non-Grid element above it.
144
- *
145
- * ```js
146
- * <Grid> // level 0
147
- * <div>
148
- * <Grid> // level 0
149
- * <Grid> // level 1
150
- * ```
151
- */
152
- unstable_level?: number;
153
- /**
154
- * Defines the vertical space between the type `item` components.
155
- * It overrides the value of the `spacing` prop.
156
- */
157
- rowSpacing?: ResponsiveStyleValue<GridSpacing>;
158
- /**
159
- * Defines the space between the type `item` components.
160
- * It can only be used on a type `container` component.
161
- * @default 0
162
- */
163
- spacing?: ResponsiveStyleValue<GridSpacing> | undefined;
164
- /**
165
- * Defines the `flex-wrap` style property.
166
- * It's applied for all screen sizes.
167
- * @default 'wrap'
168
- */
169
- wrap?: GridWrap;
170
- }
171
- export interface GridOwnerState extends GridBaseProps {
172
- unstable_level: number;
173
- gridSize: Partial<Record<Breakpoint, GridSize | boolean>>;
174
- gridOffset: Partial<Record<Breakpoint, GridSize>>;
175
- }
176
- export interface GridTypeMap<P = {}, D extends React.ElementType = 'div'> {
177
- props: P & GridBaseProps & {
178
- sx?: SxProps<Theme>;
179
- } & SystemProps<Theme>;
180
- defaultComponent: D;
181
- }
182
- export type GridProps<D extends React.ElementType = GridTypeMap['defaultComponent'], P = {
183
- component?: React.ElementType;
184
- }> = OverrideProps<GridTypeMap<P, D>, D>;
185
- export {};
1
+ import * as React from 'react';
2
+ import { OverrideProps, IfEquals } from '@mui/types';
3
+ import { SxProps } from '../styleFunctionSx';
4
+ import { Theme, Breakpoint, BreakpointOverrides } from '../createTheme';
5
+ import { SystemProps } from '../Box';
6
+ type ResponsiveStyleValue<T> = T | Array<T | null> | {
7
+ [key in Breakpoint]?: T | null;
8
+ };
9
+ export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
10
+ export type GridSpacing = number | string;
11
+ export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
12
+ export type GridSize = 'auto' | number;
13
+ export interface GridDefaultBreakpoints {
14
+ /**
15
+ * If a number, it sets the number of columns the grid item uses.
16
+ * It can't be greater than the total number of columns of the container (12 by default).
17
+ * If 'auto', the grid item's width matches its content.
18
+ * If false, the prop is ignored.
19
+ * If true, the grid item's width grows to use the space available in the grid container.
20
+ * The value is applied for the `lg` breakpoint and wider screens if not overridden.
21
+ * @default false
22
+ */
23
+ lg?: boolean | GridSize;
24
+ /**
25
+ * If a number, it sets the margin-left equals to the number of columns the grid item uses.
26
+ * If 'auto', the grid item push itself to the right-end of the container.
27
+ * The value is applied for the `lg` breakpoint and wider screens if not overridden.
28
+ */
29
+ lgOffset?: GridSize;
30
+ /**
31
+ * If a number, it sets the number of columns the grid item uses.
32
+ * It can't be greater than the total number of columns of the container (12 by default).
33
+ * If 'auto', the grid item's width matches its content.
34
+ * If false, the prop is ignored.
35
+ * If true, the grid item's width grows to use the space available in the grid container.
36
+ * The value is applied for the `md` breakpoint and wider screens if not overridden.
37
+ * @default false
38
+ */
39
+ md?: boolean | GridSize;
40
+ /**
41
+ * If a number, it sets the margin-left equals to the number of columns the grid item uses.
42
+ * If 'auto', the grid item push itself to the right-end of the container.
43
+ * The value is applied for the `md` breakpoint and wider screens if not overridden.
44
+ */
45
+ mdOffset?: GridSize;
46
+ /**
47
+ * If a number, it sets the number of columns the grid item uses.
48
+ * It can't be greater than the total number of columns of the container (12 by default).
49
+ * If 'auto', the grid item's width matches its content.
50
+ * If false, the prop is ignored.
51
+ * If true, the grid item's width grows to use the space available in the grid container.
52
+ * The value is applied for the `sm` breakpoint and wider screens if not overridden.
53
+ * @default false
54
+ */
55
+ sm?: boolean | GridSize;
56
+ /**
57
+ * If a number, it sets the margin-left equals to the number of columns the grid item uses.
58
+ * If 'auto', the grid item push itself to the right-end of the container.
59
+ * The value is applied for the `sm` breakpoint and wider screens if not overridden.
60
+ */
61
+ smOffset?: GridSize;
62
+ /**
63
+ * If a number, it sets the number of columns the grid item uses.
64
+ * It can't be greater than the total number of columns of the container (12 by default).
65
+ * If 'auto', the grid item's width matches its content.
66
+ * If false, the prop is ignored.
67
+ * If true, the grid item's width grows to use the space available in the grid container.
68
+ * The value is applied for the `xl` breakpoint and wider screens if not overridden.
69
+ * @default false
70
+ */
71
+ xl?: boolean | GridSize;
72
+ /**
73
+ * If a number, it sets the margin-left equals to the number of columns the grid item uses.
74
+ * If 'auto', the grid item push itself to the right-end of the container.
75
+ * The value is applied for the `xl` breakpoint and wider screens if not overridden.
76
+ */
77
+ xlOffset?: GridSize;
78
+ /**
79
+ * If a number, it sets the number of columns the grid item uses.
80
+ * It can't be greater than the total number of columns of the container (12 by default).
81
+ * If 'auto', the grid item's width matches its content.
82
+ * If false, the prop is ignored.
83
+ * If true, the grid item's width grows to use the space available in the grid container.
84
+ * The value is applied for all the screen sizes with the lowest priority.
85
+ * @default false
86
+ */
87
+ xs?: boolean | GridSize;
88
+ /**
89
+ * If a number, it sets the margin-left equals to the number of columns the grid item uses.
90
+ * If 'auto', the grid item push itself to the right-end of the container.
91
+ * The value is applied for the `xs` breakpoint and wider screens if not overridden.
92
+ */
93
+ xsOffset?: GridSize;
94
+ }
95
+ type CustomBreakpoints = Partial<Record<Breakpoint, boolean | GridSize> & Record<`${Breakpoint}Offset`, GridSize>>;
96
+ interface BreakpointOverridesEmpty {
97
+ }
98
+ type Breakpoints = IfEquals<BreakpointOverrides, BreakpointOverridesEmpty, GridDefaultBreakpoints, CustomBreakpoints>;
99
+ export interface GridBaseProps extends Breakpoints {
100
+ /**
101
+ * The content of the component.
102
+ */
103
+ children?: React.ReactNode;
104
+ /**
105
+ * The number of columns.
106
+ * @default 12
107
+ */
108
+ columns?: ResponsiveStyleValue<number>;
109
+ /**
110
+ * Defines the horizontal space between the type `item` components.
111
+ * It overrides the value of the `spacing` prop.
112
+ */
113
+ columnSpacing?: ResponsiveStyleValue<GridSpacing>;
114
+ /**
115
+ * If `true`, the component will have the flex *container* behavior.
116
+ * You should be wrapping *items* with a *container*.
117
+ * @default false
118
+ */
119
+ container?: boolean;
120
+ /**
121
+ * Defines the `flex-direction` style property.
122
+ * It is applied for all screen sizes.
123
+ * @default 'row'
124
+ */
125
+ direction?: ResponsiveStyleValue<GridDirection>;
126
+ /**
127
+ * If `true`, the negative margin and padding are apply only to the top and left sides of the grid.
128
+ */
129
+ disableEqualOverflow?: boolean;
130
+ /**
131
+ * @internal
132
+ * The level of the grid starts from `0`
133
+ * and increases when the grid nests inside another grid regardless of container or item.
134
+ *
135
+ * ```js
136
+ * <Grid> // level 0
137
+ * <Grid> // level 1
138
+ * <Grid> // level 2
139
+ * <Grid> // level 1
140
+ * ```
141
+ *
142
+ * Only consecutive grid is considered nesting.
143
+ * A grid container will start at `0` if there are non-Grid element above it.
144
+ *
145
+ * ```js
146
+ * <Grid> // level 0
147
+ * <div>
148
+ * <Grid> // level 0
149
+ * <Grid> // level 1
150
+ * ```
151
+ */
152
+ unstable_level?: number;
153
+ /**
154
+ * Defines the vertical space between the type `item` components.
155
+ * It overrides the value of the `spacing` prop.
156
+ */
157
+ rowSpacing?: ResponsiveStyleValue<GridSpacing>;
158
+ /**
159
+ * Defines the space between the type `item` components.
160
+ * It can only be used on a type `container` component.
161
+ * @default 0
162
+ */
163
+ spacing?: ResponsiveStyleValue<GridSpacing> | undefined;
164
+ /**
165
+ * Defines the `flex-wrap` style property.
166
+ * It's applied for all screen sizes.
167
+ * @default 'wrap'
168
+ */
169
+ wrap?: GridWrap;
170
+ }
171
+ export interface GridOwnerState extends GridBaseProps {
172
+ unstable_level: number;
173
+ gridSize: Partial<Record<Breakpoint, GridSize | boolean>>;
174
+ gridOffset: Partial<Record<Breakpoint, GridSize>>;
175
+ }
176
+ export interface GridTypeMap<AdditionalProps = {}, DefaultComponent extends React.ElementType = 'div'> {
177
+ props: AdditionalProps & GridBaseProps & {
178
+ sx?: SxProps<Theme>;
179
+ } & SystemProps<Theme>;
180
+ defaultComponent: DefaultComponent;
181
+ }
182
+ export type GridProps<RootComponent extends React.ElementType = GridTypeMap['defaultComponent'], AdditionalProps = {
183
+ component?: React.ElementType;
184
+ }> = OverrideProps<GridTypeMap<AdditionalProps, RootComponent>, RootComponent>;
185
+ export {};
@@ -1,11 +1,11 @@
1
- import * as React from 'react';
2
- import { OverridableComponent } from '@mui/types';
3
- import { GridTypeMap } from './GridProps';
4
- declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
5
- declare function useThemePropsDefault<T extends {}>(props: T): T & {};
6
- export default function createGrid(options?: {
7
- createStyledComponent?: typeof defaultCreateStyledComponent;
8
- useThemeProps?: typeof useThemePropsDefault;
9
- componentName?: string;
10
- }): OverridableComponent<GridTypeMap<{}, "div">>;
11
- export {};
1
+ import * as React from 'react';
2
+ import { OverridableComponent } from '@mui/types';
3
+ import { GridTypeMap } from './GridProps';
4
+ declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
5
+ declare function useThemePropsDefault<T extends {}>(props: T): T & {};
6
+ export default function createGrid(options?: {
7
+ createStyledComponent?: typeof defaultCreateStyledComponent;
8
+ useThemeProps?: typeof useThemePropsDefault;
9
+ componentName?: string;
10
+ }): OverridableComponent<GridTypeMap<{}, "div">>;
11
+ export {};
@@ -1,20 +1,20 @@
1
- export interface GridClasses {
2
- /** Styles applied to the root element. */
3
- root: string;
4
- /** Styles applied to the root element if `container={true}`. */
5
- container: string;
6
- /** Styles applied to the root element if `direction="column"`. */
7
- 'direction-xs-column': string;
8
- /** Styles applied to the root element if `direction="column-reverse"`. */
9
- 'direction-xs-column-reverse': string;
10
- /** Styles applied to the root element if `direction="row-reverse"`. */
11
- 'direction-xs-row-reverse': string;
12
- /** Styles applied to the root element if `wrap="nowrap"`. */
13
- 'wrap-xs-nowrap': string;
14
- /** Styles applied to the root element if `wrap="reverse"`. */
15
- 'wrap-xs-wrap-reverse': string;
16
- }
17
- export type GridClassKey = keyof GridClasses;
18
- export declare function getGridUtilityClass(slot: string): string;
19
- declare const gridClasses: GridClasses;
20
- export default gridClasses;
1
+ export interface GridClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ /** Styles applied to the root element if `container={true}`. */
5
+ container: string;
6
+ /** Styles applied to the root element if `direction="column"`. */
7
+ 'direction-xs-column': string;
8
+ /** Styles applied to the root element if `direction="column-reverse"`. */
9
+ 'direction-xs-column-reverse': string;
10
+ /** Styles applied to the root element if `direction="row-reverse"`. */
11
+ 'direction-xs-row-reverse': string;
12
+ /** Styles applied to the root element if `wrap="nowrap"`. */
13
+ 'wrap-xs-nowrap': string;
14
+ /** Styles applied to the root element if `wrap="reverse"`. */
15
+ 'wrap-xs-wrap-reverse': string;
16
+ }
17
+ export type GridClassKey = keyof GridClasses;
18
+ export declare function getGridUtilityClass(slot: string): string;
19
+ declare const gridClasses: GridClasses;
20
+ export default gridClasses;
@@ -1,33 +1,33 @@
1
- import { Breakpoints } from '../createTheme/createBreakpoints';
2
- import { Spacing } from '../createTheme/createSpacing';
3
- import { ResponsiveStyleValue } from '../styleFunctionSx';
4
- import { GridDirection, GridOwnerState } from './GridProps';
5
- interface Props {
6
- theme: {
7
- breakpoints: Breakpoints;
8
- spacing?: Spacing;
9
- };
10
- ownerState: GridOwnerState & {
11
- parentDisableEqualOverflow?: boolean;
12
- };
13
- }
14
- export declare const generateGridSizeStyles: ({ theme, ownerState }: Props) => {};
15
- export declare const generateGridOffsetStyles: ({ theme, ownerState }: Props) => {};
16
- export declare const generateGridColumnsStyles: ({ theme, ownerState }: Props) => {
17
- [x: string]: string;
18
- '--Grid-columns'?: undefined;
19
- } | {
20
- '--Grid-columns': number;
21
- };
22
- export declare const generateGridRowSpacingStyles: ({ theme, ownerState }: Props) => {
23
- [x: string]: string;
24
- };
25
- export declare const generateGridColumnSpacingStyles: ({ theme, ownerState }: Props) => {
26
- [x: string]: string;
27
- };
28
- export declare const generateGridDirectionStyles: ({ theme, ownerState }: Props) => {};
29
- export declare const generateGridStyles: ({ ownerState }: Props) => {};
30
- export declare const generateSizeClassNames: (gridSize: GridOwnerState['gridSize']) => string[];
31
- export declare const generateSpacingClassNames: (spacing: GridOwnerState['spacing'], smallestBreakpoint?: string) => string[];
32
- export declare const generateDirectionClasses: (direction: ResponsiveStyleValue<GridDirection> | undefined) => string[];
33
- export {};
1
+ import { Breakpoints } from '../createTheme/createBreakpoints';
2
+ import { Spacing } from '../createTheme/createSpacing';
3
+ import { ResponsiveStyleValue } from '../styleFunctionSx';
4
+ import { GridDirection, GridOwnerState } from './GridProps';
5
+ interface Props {
6
+ theme: {
7
+ breakpoints: Breakpoints;
8
+ spacing?: Spacing;
9
+ };
10
+ ownerState: GridOwnerState & {
11
+ parentDisableEqualOverflow?: boolean;
12
+ };
13
+ }
14
+ export declare const generateGridSizeStyles: ({ theme, ownerState }: Props) => {};
15
+ export declare const generateGridOffsetStyles: ({ theme, ownerState }: Props) => {};
16
+ export declare const generateGridColumnsStyles: ({ theme, ownerState }: Props) => {
17
+ [x: string]: string;
18
+ '--Grid-columns'?: undefined;
19
+ } | {
20
+ '--Grid-columns': number;
21
+ };
22
+ export declare const generateGridRowSpacingStyles: ({ theme, ownerState }: Props) => {
23
+ [x: string]: string;
24
+ };
25
+ export declare const generateGridColumnSpacingStyles: ({ theme, ownerState }: Props) => {
26
+ [x: string]: string;
27
+ };
28
+ export declare const generateGridDirectionStyles: ({ theme, ownerState }: Props) => {};
29
+ export declare const generateGridStyles: ({ ownerState }: Props) => {};
30
+ export declare const generateSizeClassNames: (gridSize: GridOwnerState['gridSize']) => string[];
31
+ export declare const generateSpacingClassNames: (spacing: GridOwnerState['spacing'], smallestBreakpoint?: string) => string[];
32
+ export declare const generateDirectionClasses: (direction: ResponsiveStyleValue<GridDirection> | undefined) => string[];
33
+ export {};
@@ -1,6 +1,6 @@
1
- export { default } from './Grid';
2
- export { default as createGrid } from './createGrid';
3
- export * from './GridProps';
4
- export { default as gridClasses } from './gridClasses';
5
- export * from './gridClasses';
6
- export { traverseBreakpoints as unstable_traverseBreakpoints } from './traverseBreakpoints';
1
+ export { default } from './Grid';
2
+ export { default as createGrid } from './createGrid';
3
+ export * from './GridProps';
4
+ export { default as gridClasses } from './gridClasses';
5
+ export * from './gridClasses';
6
+ export { traverseBreakpoints as unstable_traverseBreakpoints } from './traverseBreakpoints';
@@ -1,7 +1,7 @@
1
- import { Breakpoints, Breakpoint } from '../createTheme/createBreakpoints';
2
- export declare const filterBreakpointKeys: (breakpointsKeys: Breakpoint[], responsiveKeys: string[]) => Breakpoint[];
3
- interface Iterator<T> {
4
- (appendStyle: (responsiveStyles: Record<string, any>, style: object) => void, value: T): void;
5
- }
6
- export declare const traverseBreakpoints: <T = unknown>(breakpoints: Breakpoints, responsive: Record<string, any> | T | T[] | undefined, iterator: Iterator<T>) => void;
7
- export {};
1
+ import { Breakpoints, Breakpoint } from '../createTheme/createBreakpoints';
2
+ export declare const filterBreakpointKeys: (breakpointsKeys: Breakpoint[], responsiveKeys: string[]) => Breakpoint[];
3
+ interface Iterator<T> {
4
+ (appendStyle: (responsiveStyles: Record<string, any>, style: object) => void, value: T): void;
5
+ }
6
+ export declare const traverseBreakpoints: <T = unknown>(breakpoints: Breakpoints, responsive: Record<string, any> | T | T[] | undefined, iterator: Iterator<T>) => void;
7
+ export {};
package/createStyled.d.ts CHANGED
@@ -24,16 +24,16 @@ export interface MuiStyledOptions {
24
24
  skipSx?: boolean;
25
25
  }
26
26
 
27
- export type CreateMUIStyled<T extends object = DefaultTheme> = CreateMUIStyledStyledEngine<
28
- MUIStyledCommonProps<T>,
27
+ export type CreateMUIStyled<Theme extends object = DefaultTheme> = CreateMUIStyledStyledEngine<
28
+ MUIStyledCommonProps<Theme>,
29
29
  MuiStyledOptions,
30
- T
30
+ Theme
31
31
  >;
32
32
 
33
- export default function createStyled<T extends object = DefaultTheme>(options?: {
33
+ export default function createStyled<Theme extends object = DefaultTheme>(options?: {
34
34
  themeId?: string;
35
- defaultTheme?: T;
35
+ defaultTheme?: Theme;
36
36
  rootShouldForwardProp?: (prop: PropertyKey) => boolean;
37
37
  slotShouldForwardProp?: (prop: PropertyKey) => boolean;
38
38
  styleFunctionSx?: typeof styleFunctionSx;
39
- }): CreateMUIStyled<T>;
39
+ }): CreateMUIStyled<Theme>;
package/createStyled.js CHANGED
@@ -78,6 +78,9 @@ function shouldForwardProp(prop) {
78
78
  const systemDefaultTheme = (0, _createTheme.default)();
79
79
  exports.systemDefaultTheme = systemDefaultTheme;
80
80
  const lowercaseFirstLetter = string => {
81
+ if (!string) {
82
+ return string;
83
+ }
81
84
  return string.charAt(0).toLowerCase() + string.slice(1);
82
85
  };
83
86
  function resolveTheme({
@@ -87,6 +90,12 @@ function resolveTheme({
87
90
  }) {
88
91
  return isEmpty(theme) ? defaultTheme : theme[themeId] || theme;
89
92
  }
93
+ function defaultOverridesResolver(slot) {
94
+ if (!slot) {
95
+ return null;
96
+ }
97
+ return (props, styles) => styles[slot];
98
+ }
90
99
  function createStyled(input = {}) {
91
100
  const {
92
101
  themeId,
@@ -111,21 +120,31 @@ function createStyled(input = {}) {
111
120
  slot: componentSlot,
112
121
  skipVariantsResolver: inputSkipVariantsResolver,
113
122
  skipSx: inputSkipSx,
114
- overridesResolver
123
+ // TODO v6: remove `lowercaseFirstLetter()` in the next major release
124
+ // For more details: https://github.com/mui/material-ui/pull/37908
125
+ overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot))
115
126
  } = inputOptions,
116
127
  options = (0, _objectWithoutPropertiesLoose2.default)(inputOptions, _excluded);
117
128
 
118
129
  // if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
119
- const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver : componentSlot && componentSlot !== 'Root' || false;
130
+ const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver :
131
+ // TODO v6: remove `Root` in the next major release
132
+ // For more details: https://github.com/mui/material-ui/pull/37908
133
+ componentSlot && componentSlot !== 'Root' && componentSlot !== 'root' || false;
120
134
  const skipSx = inputSkipSx || false;
121
135
  let label;
122
136
  if (process.env.NODE_ENV !== 'production') {
123
137
  if (componentName) {
138
+ // TODO v6: remove `lowercaseFirstLetter()` in the next major release
139
+ // For more details: https://github.com/mui/material-ui/pull/37908
124
140
  label = `${componentName}-${lowercaseFirstLetter(componentSlot || 'Root')}`;
125
141
  }
126
142
  }
127
143
  let shouldForwardPropOption = shouldForwardProp;
128
- if (componentSlot === 'Root') {
144
+
145
+ // TODO v6: remove `Root` in the next major release
146
+ // For more details: https://github.com/mui/material-ui/pull/37908
147
+ if (componentSlot === 'Root' || componentSlot === 'root') {
129
148
  shouldForwardPropOption = rootShouldForwardProp;
130
149
  } else if (componentSlot) {
131
150
  // any other slot specified
@@ -207,7 +226,7 @@ function createStyled(input = {}) {
207
226
  if (process.env.NODE_ENV !== 'production') {
208
227
  let displayName;
209
228
  if (componentName) {
210
- displayName = `${componentName}${componentSlot || ''}`;
229
+ displayName = `${componentName}${(0, _utils.unstable_capitalize)(componentSlot || '')}`;
211
230
  }
212
231
  if (displayName === undefined) {
213
232
  displayName = `Styled(${(0, _utils.getDisplayName)(tag)})`;