UNPKG

5.42 kBJavaScriptView Raw
1'use client';
2
3import PropTypes from 'prop-types';
4import { createGrid as createGrid2 } from '@mui/system/Grid';
5import requirePropFactory from "../utils/requirePropFactory.js";
6import { styled } from "../styles/index.js";
7import { useDefaultProps } from "../DefaultPropsProvider/index.js";
8/**
9 *
10 * Demos:
11 *
12 * - [Grid version 2](https://mui.com/material-ui/react-grid2/)
13 *
14 * API:
15 *
16 * - [Grid2 API](https://mui.com/material-ui/api/grid-2/)
17 */
18const Grid2 = createGrid2({
19 createStyledComponent: styled('div', {
20 name: 'MuiGrid2',
21 slot: 'Root',
22 overridesResolver: (props, styles) => styles.root
23 }),
24 componentName: 'MuiGrid2',
25 useThemeProps: inProps => useDefaultProps({
26 props: inProps,
27 name: 'MuiGrid2'
28 })
29});
30process.env.NODE_ENV !== "production" ? Grid2.propTypes /* remove-proptypes */ = {
31 // ┌────────────────────────────── Warning ──────────────────────────────┐
32 // │ These PropTypes are generated from the TypeScript type definitions. │
33 // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
34 // └─────────────────────────────────────────────────────────────────────┘
35 /**
36 * The content of the component.
37 */
38 children: PropTypes.node,
39 /**
40 * The number of columns.
41 * @default 12
42 */
43 columns: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
44 /**
45 * Defines the horizontal space between the type `item` components.
46 * It overrides the value of the `spacing` prop.
47 */
48 columnSpacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
49 /**
50 * If `true`, the component will have the flex *container* behavior.
51 * You should be wrapping *items* with a *container*.
52 * @default false
53 */
54 container: PropTypes.bool,
55 /**
56 * Defines the `flex-direction` style property.
57 * It is applied for all screen sizes.
58 * @default 'row'
59 */
60 direction: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
61 /**
62 * Defines the offset value for the type `item` components.
63 */
64 offset: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), PropTypes.object]),
65 /**
66 * Defines the vertical space between the type `item` components.
67 * It overrides the value of the `spacing` prop.
68 */
69 rowSpacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
70 /**
71 * Defines the size of the the type `item` components.
72 */
73 size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number])), PropTypes.object]),
74 /**
75 * Defines the space between the type `item` components.
76 * It can only be used on a type `container` component.
77 * @default 0
78 */
79 spacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
80 /**
81 * @ignore
82 */
83 sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
84 /**
85 * @internal
86 * The level of the grid starts from `0` and increases when the grid nests
87 * inside another grid. Nesting is defined as a container Grid being a direct
88 * child of a container Grid.
89 *
90 * ```js
91 * <Grid container> // level 0
92 * <Grid container> // level 1
93 * <Grid container> // level 2
94 * ```
95 *
96 * Only consecutive grid is considered nesting. A grid container will start at
97 * `0` if there are non-Grid container element above it.
98 *
99 * ```js
100 * <Grid container> // level 0
101 * <div>
102 * <Grid container> // level 0
103 * ```
104 *
105 * ```js
106 * <Grid container> // level 0
107 * <Grid>
108 * <Grid container> // level 0
109 * ```
110 */
111 unstable_level: PropTypes.number,
112 /**
113 * Defines the `flex-wrap` style property.
114 * It's applied for all screen sizes.
115 * @default 'wrap'
116 */
117 wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
118} : void 0;
119if (process.env.NODE_ENV !== 'production') {
120 const Component = Grid2;
121 const requireProp = requirePropFactory('Grid2', Component);
122 // eslint-disable-next-line no-useless-concat
123 Component['propTypes' + ''] = {
124 // eslint-disable-next-line react/forbid-foreign-prop-types
125 ...Component.propTypes,
126 direction: requireProp('container'),
127 spacing: requireProp('container'),
128 wrap: requireProp('container')
129 };
130}
131export default Grid2;
\No newline at end of file