1 | import { SxProps, SystemProps } from '@mui/system';
|
2 | import { OverridableComponent, OverrideProps } from '@mui/types';
|
3 | import { Theme, Breakpoint } from '../styles';
|
4 | export type Grid2Slot = 'root';
|
5 | type ResponsiveStyleValue<T> = T | Array<T | null> | {
|
6 | [key in Breakpoint]?: T | null;
|
7 | };
|
8 | export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
9 | export type GridSpacing = number | string;
|
10 | export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
|
11 | export type GridSize = 'auto' | 'grow' | number | false;
|
12 | export type GridOffset = 'auto' | number;
|
13 | export interface GridBaseProps {
|
14 | /**
|
15 | * The content of the component.
|
16 | */
|
17 | children?: React.ReactNode;
|
18 | /**
|
19 | * The number of columns.
|
20 | * @default 12
|
21 | */
|
22 | columns?: ResponsiveStyleValue<number>;
|
23 | /**
|
24 | * Defines the horizontal space between the type `item` components.
|
25 | * It overrides the value of the `spacing` prop.
|
26 | */
|
27 | columnSpacing?: ResponsiveStyleValue<GridSpacing>;
|
28 | /**
|
29 | * If `true`, the component will have the flex *container* behavior.
|
30 | * You should be wrapping *items* with a *container*.
|
31 | * @default false
|
32 | */
|
33 | container?: boolean;
|
34 | /**
|
35 | * Defines the `flex-direction` style property.
|
36 | * It is applied for all screen sizes.
|
37 | * @default 'row'
|
38 | */
|
39 | direction?: ResponsiveStyleValue<GridDirection>;
|
40 | /**
|
41 | * Defines the offset value for the type `item` components.
|
42 | */
|
43 | offset?: ResponsiveStyleValue<GridOffset>;
|
44 | /**
|
45 | * @internal
|
46 | * The level of the grid starts from `0` and increases when the grid nests
|
47 | * inside another grid. Nesting is defined as a container Grid being a direct
|
48 | * child of a container Grid.
|
49 | *
|
50 | * ```js
|
51 | * <Grid container> // level 0
|
52 | * <Grid container> // level 1
|
53 | * <Grid container> // level 2
|
54 | * ```
|
55 | *
|
56 | * Only consecutive grid is considered nesting. A grid container will start at
|
57 | * `0` if there are non-Grid container element above it.
|
58 | *
|
59 | * ```js
|
60 | * <Grid container> // level 0
|
61 | * <div>
|
62 | * <Grid container> // level 0
|
63 | * ```
|
64 | *
|
65 | * ```js
|
66 | * <Grid container> // level 0
|
67 | * <Grid>
|
68 | * <Grid container> // level 0
|
69 | * ```
|
70 | */
|
71 | unstable_level?: number;
|
72 | /**
|
73 | * Defines the vertical space between the type `item` components.
|
74 | * It overrides the value of the `spacing` prop.
|
75 | */
|
76 | rowSpacing?: ResponsiveStyleValue<GridSpacing>;
|
77 | /**
|
78 | * Defines the size of the the type `item` components.
|
79 | */
|
80 | size?: ResponsiveStyleValue<GridSize>;
|
81 | /**
|
82 | * Defines the space between the type `item` components.
|
83 | * It can only be used on a type `container` component.
|
84 | * @default 0
|
85 | */
|
86 | spacing?: ResponsiveStyleValue<GridSpacing> | undefined;
|
87 | /**
|
88 | * Defines the `flex-wrap` style property.
|
89 | * It's applied for all screen sizes.
|
90 | * @default 'wrap'
|
91 | */
|
92 | wrap?: GridWrap;
|
93 | }
|
94 | export interface Grid2TypeMap<P = {}, D extends React.ElementType = 'div'> {
|
95 | props: P & GridBaseProps & {
|
96 | sx?: SxProps<Theme>;
|
97 | } & SystemProps<Theme>;
|
98 | defaultComponent: D;
|
99 | }
|
100 | export type Grid2Props<D extends React.ElementType = Grid2TypeMap['defaultComponent'], P = {
|
101 | component?: React.ElementType;
|
102 | }> = OverrideProps<Grid2TypeMap<P, D>, D>;
|
103 | /**
|
104 | *
|
105 | * Demos:
|
106 | *
|
107 | * - [Grid version 2](https://mui.com/material-ui/react-grid2/)
|
108 | *
|
109 | * API:
|
110 | *
|
111 | * - [Grid2 API](https://mui.com/material-ui/api/grid-2/)
|
112 | */
|
113 | declare const Grid2: OverridableComponent<Grid2TypeMap>;
|
114 | export default Grid2;
|