@mui/system 5.8.7 → 5.9.0

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 (50) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/Unstable_Grid/Grid.d.ts +12 -0
  3. package/Unstable_Grid/Grid.js +190 -0
  4. package/Unstable_Grid/GridProps.d.ts +158 -0
  5. package/Unstable_Grid/GridProps.js +5 -0
  6. package/Unstable_Grid/createGrid.d.ts +11 -0
  7. package/Unstable_Grid/createGrid.js +174 -0
  8. package/Unstable_Grid/gridClasses.d.ts +20 -0
  9. package/Unstable_Grid/gridClasses.js +25 -0
  10. package/Unstable_Grid/gridGenerator.d.ts +26 -0
  11. package/Unstable_Grid/gridGenerator.js +269 -0
  12. package/Unstable_Grid/index.d.ts +5 -0
  13. package/Unstable_Grid/index.js +65 -0
  14. package/Unstable_Grid/package.json +6 -0
  15. package/{grid.js → cssGrid.js} +0 -0
  16. package/cssVars/useCurrentColorScheme.js +1 -1
  17. package/esm/Unstable_Grid/Grid.js +179 -0
  18. package/esm/Unstable_Grid/GridProps.js +1 -0
  19. package/esm/Unstable_Grid/createGrid.js +152 -0
  20. package/esm/Unstable_Grid/gridClasses.js +14 -0
  21. package/esm/Unstable_Grid/gridGenerator.js +230 -0
  22. package/esm/Unstable_Grid/index.js +5 -0
  23. package/esm/{grid.js → cssGrid.js} +0 -0
  24. package/esm/cssVars/useCurrentColorScheme.js +1 -1
  25. package/esm/getThemeValue.js +1 -1
  26. package/esm/index.js +9 -3
  27. package/getThemeValue.js +3 -3
  28. package/index.d.ts +3 -0
  29. package/index.js +30 -7
  30. package/legacy/Unstable_Grid/Grid.js +179 -0
  31. package/legacy/Unstable_Grid/GridProps.js +1 -0
  32. package/legacy/Unstable_Grid/createGrid.js +166 -0
  33. package/legacy/Unstable_Grid/gridClasses.js +27 -0
  34. package/legacy/Unstable_Grid/gridGenerator.js +239 -0
  35. package/legacy/Unstable_Grid/index.js +5 -0
  36. package/legacy/{grid.js → cssGrid.js} +0 -0
  37. package/legacy/cssVars/useCurrentColorScheme.js +1 -1
  38. package/legacy/getThemeValue.js +1 -1
  39. package/legacy/index.js +10 -4
  40. package/modern/Unstable_Grid/Grid.js +179 -0
  41. package/modern/Unstable_Grid/GridProps.js +1 -0
  42. package/modern/Unstable_Grid/createGrid.js +150 -0
  43. package/modern/Unstable_Grid/gridClasses.js +14 -0
  44. package/modern/Unstable_Grid/gridGenerator.js +226 -0
  45. package/modern/Unstable_Grid/index.js +5 -0
  46. package/modern/{grid.js → cssGrid.js} +0 -0
  47. package/modern/cssVars/useCurrentColorScheme.js +1 -1
  48. package/modern/getThemeValue.js +1 -1
  49. package/modern/index.js +10 -4
  50. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,79 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 5.9.0
4
+
5
+ <!-- generated comparing v5.8.7..master -->
6
+
7
+ _Jul 12, 2022_
8
+
9
+ A big thanks to the 19 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 🧪 Exported Grid v2 as `Unstable_Grid2` (#33479) @siriwatknp
12
+ - 📖 Added a guide for using Joy UI and Material UI together (#33396) @siriwatknp
13
+ - 🐛 Fixed a few bugs in Material UI components. Thanks to @ZeeshanTamboli, @ivan-ngchakming, and @joebingham-wk.
14
+ - many other 🐛 bug fixes and 📚 documentation improvements
15
+ - our documentation site is now running with React 18! (#33196) @mnajdova
16
+
17
+ ### `@mui/material@5.9.0`
18
+
19
+ - [CssBaseline] Fixes in overriding style (#33338) @ZeeshanTamboli
20
+ - [Autocomplete] Remove unnecessary `clsx` wrapper for single className (#33398) @ZeeshanTamboli
21
+ - [Grid] Export new grid as unstable (#33479) @siriwatknp
22
+ - [Tooltip] Fix children mouse over detection (#32321) @ivan-ngchakming
23
+ - [TypeScript] getCssVar autocomplete for Material UI (#33464) @siriwatknp
24
+ - [TypeScript] Fix theme options components types to use `Theme` (#33434) @siriwatknp
25
+ - [TypeScript] Reexports necessary types for module augmentation (#33397) @siriwatknp
26
+ - [ScopedCssBaseline] Add sx typings (#33474) @joebingham-wk
27
+
28
+ ### `@mui/system@5.9.0`
29
+
30
+ - [System] Add offset feature to Grid (#33415) @siriwatknp
31
+ - [system] Add new `Grid` implementation (#32746) @siriwatknp
32
+
33
+ ### `@mui/lab@5.0.0-alpha.90`
34
+
35
+ - [lab] Remove the pickers (#33386) @flaviendelangle
36
+ - [Masonry] Support `rem`/`em` values for `spacing` prop (#33384) @hbjORbj
37
+
38
+ ### `@mui/base@5.0.0-alpha.89`
39
+
40
+ - Base] Change the order of class names merged in useSlotProps (#33383) @michaldudak
41
+ - [ModalUnstyled] Accept callbacks in componentsProps (#33181) @michaldudak
42
+ - [SelectUnstyled] Accept callbacks in componentsProps (#33197) @michaldudak
43
+ - [TabsUnstyled] Accept callbacks in componentsProps (#33284) @michaldudak
44
+
45
+ ### `@mui/joy@5.0.0-alpha.36`
46
+
47
+ - [Joy] Add guide about using Joy and Material UI together (#33396) @siriwatknp
48
+ - [Joy] Fix variants color palette regressions (#33394) @danilo-leal
49
+
50
+ ### Docs
51
+
52
+ - [docs] Correcting small grammatical error (#33393) @robyyo
53
+ - [docs] Link to the correct package on Joy component pages (#33439) @cherniavskii
54
+ - [docs] Fix e2e tests (#33477) @siriwatknp
55
+ - [docs] Fix dead links (#33462) @oliviertassinari
56
+ - [docs] Cleanup the migration (#33463) @siriwatknp
57
+ - [docs] Fix broken Sponsoring services links @samuelsycamore
58
+ - [docs] Improve repo README with light/dark logos, relative links and more (#33356) @samuelsycamore
59
+ - [docs] Update links to MUI X Overview and Introduction pages (#33201) @samuelsycamore
60
+ - [docs] Update to React 18 (#33196) @mnajdova
61
+ - [docs] Simplify "Upload button" demo (#33326) @baharalidurrani
62
+ - [docs] Add "refine" demo to showcase (#33240) @omeraplak
63
+ - [docs] Add webpack alias for legacy utils package (#33376) @jgbae
64
+ - [docs] Improve external link icons synonyms (#33257) @davidgarciab
65
+ - [examples] Update MUI Base with Tailwind CSS to use the latest versions of the dependencies (#33401) @mnajdova
66
+ - [examples] Add MUI base example (#33154) @siriwatknp
67
+
68
+ ### Core
69
+
70
+ - [core] Fix @mui/monorepo regression for the import of the docs infra (#33390) @Janpot
71
+ - [core] Remove old babel resolve rule (#33432) @oliviertassinari
72
+ - [website] Shorten the plan descriptions on the pricing page (#32984) @joserodolfofreitas
73
+ - [website] Link EULA in the license quantity section (#33292) @oliviertassinari
74
+
75
+ All contributors of this release in alphabetical order: @baharalidurrani, @cherniavskii, @danilo-leal, @davidgarciab, @flaviendelangle, @hbjORbj, @ivan-ngchakming, @Janpot, @jgbae, @joebingham-wk, @joserodolfofreitas, @michaldudak, @mnajdova, @oliviertassinari, @omeraplak, @robyyo, @samuelsycamore, @siriwatknp, @ZeeshanTamboli
76
+
3
77
  ## 5.8.7
4
78
 
5
79
  <!-- generated comparing v5.8.6..master -->
@@ -0,0 +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;
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _createGrid = _interopRequireDefault(require("./createGrid"));
13
+
14
+ /**
15
+ *
16
+ * Demos:
17
+ *
18
+ * - [Grid (Material UI)](https://mui.com/material-ui/react-grid/)
19
+ *
20
+ * API:
21
+ *
22
+ * - [Grid API](https://mui.com/system/api/grid/)
23
+ */
24
+ const Grid = (0, _createGrid.default)();
25
+ process.env.NODE_ENV !== "production" ? Grid.propTypes
26
+ /* remove-proptypes */
27
+ = {
28
+ // ----------------------------- Warning --------------------------------
29
+ // | These PropTypes are generated from the TypeScript type definitions |
30
+ // | To update them edit TypeScript types and run "yarn proptypes" |
31
+ // ----------------------------------------------------------------------
32
+
33
+ /**
34
+ * The content of the component.
35
+ */
36
+ children: _propTypes.default.node,
37
+
38
+ /**
39
+ * The number of columns.
40
+ * @default 12
41
+ */
42
+ columns: _propTypes.default
43
+ /* @typescript-to-proptypes-ignore */
44
+ .oneOfType([_propTypes.default.arrayOf(_propTypes.default.number), _propTypes.default.number, _propTypes.default.object]),
45
+
46
+ /**
47
+ * Defines the horizontal space between the type `item` components.
48
+ * It overrides the value of the `spacing` prop.
49
+ */
50
+ columnSpacing: _propTypes.default
51
+ /* @typescript-to-proptypes-ignore */
52
+ .oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
53
+
54
+ /**
55
+ * If `true`, the component will have the flex *container* behavior.
56
+ * You should be wrapping *items* with a *container*.
57
+ * @default false
58
+ */
59
+ container: _propTypes.default.bool,
60
+
61
+ /**
62
+ * Defines the `flex-direction` style property.
63
+ * It is applied for all screen sizes.
64
+ * @default 'row'
65
+ */
66
+ direction: _propTypes.default
67
+ /* @typescript-to-proptypes-ignore */
68
+ .oneOfType([_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), _propTypes.default.arrayOf(_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), _propTypes.default.object]),
69
+
70
+ /**
71
+ * If a number, it sets the number of columns the grid item uses.
72
+ * It can't be greater than the total number of columns of the container (12 by default).
73
+ * If 'auto', the grid item's width matches its content.
74
+ * If false, the prop is ignored.
75
+ * If true, the grid item's width grows to use the space available in the grid container.
76
+ * The value is applied for the `lg` breakpoint and wider screens if not overridden.
77
+ * @default false
78
+ */
79
+ lg: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
80
+
81
+ /**
82
+ * If a number, it sets the margin-left equals to the number of columns the grid item uses.
83
+ * If 'auto', the grid item push itself to the right-end of the container.
84
+ * The value is applied for the `lg` breakpoint and wider screens if not overridden.
85
+ */
86
+ lgOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
87
+
88
+ /**
89
+ * If a number, it sets the number of columns the grid item uses.
90
+ * It can't be greater than the total number of columns of the container (12 by default).
91
+ * If 'auto', the grid item's width matches its content.
92
+ * If false, the prop is ignored.
93
+ * If true, the grid item's width grows to use the space available in the grid container.
94
+ * The value is applied for the `md` breakpoint and wider screens if not overridden.
95
+ * @default false
96
+ */
97
+ md: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
98
+
99
+ /**
100
+ * If a number, it sets the margin-left equals to the number of columns the grid item uses.
101
+ * If 'auto', the grid item push itself to the right-end of the container.
102
+ * The value is applied for the `md` breakpoint and wider screens if not overridden.
103
+ */
104
+ mdOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
105
+
106
+ /**
107
+ * Defines the vertical space between the type `item` components.
108
+ * It overrides the value of the `spacing` prop.
109
+ */
110
+ rowSpacing: _propTypes.default
111
+ /* @typescript-to-proptypes-ignore */
112
+ .oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
113
+
114
+ /**
115
+ * If a number, it sets the number of columns the grid item uses.
116
+ * It can't be greater than the total number of columns of the container (12 by default).
117
+ * If 'auto', the grid item's width matches its content.
118
+ * If false, the prop is ignored.
119
+ * If true, the grid item's width grows to use the space available in the grid container.
120
+ * The value is applied for the `sm` breakpoint and wider screens if not overridden.
121
+ * @default false
122
+ */
123
+ sm: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
124
+
125
+ /**
126
+ * If a number, it sets the margin-left equals to the number of columns the grid item uses.
127
+ * If 'auto', the grid item push itself to the right-end of the container.
128
+ * The value is applied for the `sm` breakpoint and wider screens if not overridden.
129
+ */
130
+ smOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
131
+
132
+ /**
133
+ * Defines the space between the type `item` components.
134
+ * It can only be used on a type `container` component.
135
+ * @default 0
136
+ */
137
+ spacing: _propTypes.default
138
+ /* @typescript-to-proptypes-ignore */
139
+ .oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
140
+
141
+ /**
142
+ * @ignore
143
+ */
144
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
145
+
146
+ /**
147
+ * Defines the `flex-wrap` style property.
148
+ * It's applied for all screen sizes.
149
+ * @default 'wrap'
150
+ */
151
+ wrap: _propTypes.default.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
152
+
153
+ /**
154
+ * If a number, it sets the number of columns the grid item uses.
155
+ * It can't be greater than the total number of columns of the container (12 by default).
156
+ * If 'auto', the grid item's width matches its content.
157
+ * If false, the prop is ignored.
158
+ * If true, the grid item's width grows to use the space available in the grid container.
159
+ * The value is applied for the `xl` breakpoint and wider screens if not overridden.
160
+ * @default false
161
+ */
162
+ xl: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
163
+
164
+ /**
165
+ * If a number, it sets the margin-left equals to the number of columns the grid item uses.
166
+ * If 'auto', the grid item push itself to the right-end of the container.
167
+ * The value is applied for the `xl` breakpoint and wider screens if not overridden.
168
+ */
169
+ xlOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
170
+
171
+ /**
172
+ * If a number, it sets the number of columns the grid item uses.
173
+ * It can't be greater than the total number of columns of the container (12 by default).
174
+ * If 'auto', the grid item's width matches its content.
175
+ * If false, the prop is ignored.
176
+ * If true, the grid item's width grows to use the space available in the grid container.
177
+ * The value is applied for all the screen sizes with the lowest priority.
178
+ * @default false
179
+ */
180
+ xs: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
181
+
182
+ /**
183
+ * If a number, it sets the margin-left equals to the number of columns the grid item uses.
184
+ * If 'auto', the grid item push itself to the right-end of the container.
185
+ * The value is applied for the `xs` breakpoint and wider screens if not overridden.
186
+ */
187
+ xsOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
188
+ } : void 0;
189
+ var _default = Grid;
190
+ exports.default = _default;
@@ -0,0 +1,158 @@
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
+ declare type ResponsiveStyleValue<T> = T | Array<T | null> | {
7
+ [key in Breakpoint]?: T | null;
8
+ };
9
+ export declare type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
10
+ export declare type GridSpacing = number | string;
11
+ export declare type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
12
+ export declare 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
+ declare type CustomBreakpoints = Partial<Record<Breakpoint, boolean | GridSize> & Record<`${Breakpoint}Offset`, GridSize>>;
96
+ interface BreakpointOverridesEmpty {
97
+ }
98
+ declare 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
+ * Defines the vertical space between the type `item` components.
128
+ * It overrides the value of the `spacing` prop.
129
+ */
130
+ rowSpacing?: ResponsiveStyleValue<GridSpacing>;
131
+ /**
132
+ * Defines the space between the type `item` components.
133
+ * It can only be used on a type `container` component.
134
+ * @default 0
135
+ */
136
+ spacing?: ResponsiveStyleValue<GridSpacing> | undefined;
137
+ /**
138
+ * Defines the `flex-wrap` style property.
139
+ * It's applied for all screen sizes.
140
+ * @default 'wrap'
141
+ */
142
+ wrap?: GridWrap;
143
+ }
144
+ export interface GridOwnerState extends GridBaseProps {
145
+ nested: boolean;
146
+ gridSize: Partial<Record<Breakpoint, GridSize | boolean>>;
147
+ gridOffset: Partial<Record<Breakpoint, GridSize>>;
148
+ }
149
+ export interface GridTypeMap<P = {}, D extends React.ElementType = 'div'> {
150
+ props: P & GridBaseProps & {
151
+ sx?: SxProps<Theme>;
152
+ } & SystemProps<Theme>;
153
+ defaultComponent: D;
154
+ }
155
+ export declare type GridProps<D extends React.ElementType = GridTypeMap['defaultComponent'], P = {
156
+ component?: React.ElementType;
157
+ }> = OverrideProps<GridTypeMap<P, D>, D>;
158
+ export {};
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +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>(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 {};
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = createGrid;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
13
+
14
+ var React = _interopRequireWildcard(require("react"));
15
+
16
+ var _propTypes = _interopRequireDefault(require("prop-types"));
17
+
18
+ var _clsx = _interopRequireDefault(require("clsx"));
19
+
20
+ var _utils = require("@mui/utils");
21
+
22
+ var _styled = _interopRequireDefault(require("../styled"));
23
+
24
+ var _useThemeProps = _interopRequireDefault(require("../useThemeProps"));
25
+
26
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
27
+
28
+ var _styleFunctionSx = require("../styleFunctionSx");
29
+
30
+ var _createTheme = _interopRequireDefault(require("../createTheme"));
31
+
32
+ var _gridGenerator = require("./gridGenerator");
33
+
34
+ var _jsxRuntime = require("react/jsx-runtime");
35
+
36
+ const _excluded = ["className", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing"];
37
+
38
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
+
40
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
+
42
+ const defaultTheme = (0, _createTheme.default)(); // widening Theme to any so that the consumer can own the theme structure.
43
+
44
+ const defaultCreateStyledComponent = (0, _styled.default)('div', {
45
+ name: 'MuiGrid',
46
+ slot: 'Root',
47
+ overridesResolver: (props, styles) => styles.root
48
+ });
49
+
50
+ function useThemePropsDefault(props) {
51
+ return (0, _useThemeProps.default)({
52
+ props,
53
+ name: 'MuiGrid',
54
+ defaultTheme
55
+ });
56
+ }
57
+
58
+ function createGrid(options = {}) {
59
+ const {
60
+ // This will allow adding custom styled fn (for example for custom sx style function)
61
+ createStyledComponent = defaultCreateStyledComponent,
62
+ useThemeProps = useThemePropsDefault,
63
+ componentName = 'MuiGrid'
64
+ } = options;
65
+ const NestedContext = /*#__PURE__*/React.createContext(false);
66
+
67
+ const useUtilityClasses = (ownerState, theme) => {
68
+ const {
69
+ container,
70
+ direction,
71
+ spacing,
72
+ wrap,
73
+ gridSize
74
+ } = ownerState;
75
+ const slots = {
76
+ root: ['root', container && 'container', direction !== 'row' && `direction-xs-${String(direction)}`, wrap !== 'wrap' && `wrap-xs-${String(wrap)}`, ...(0, _gridGenerator.generateSizeClassNames)(gridSize), ...(container ? (0, _gridGenerator.generateSpacingClassNames)(spacing, theme.breakpoints.keys[0]) : [])]
77
+ };
78
+ return (0, _utils.unstable_composeClasses)(slots, slot => (0, _utils.unstable_generateUtilityClass)(componentName, slot), {});
79
+ };
80
+
81
+ const GridRoot = createStyledComponent(_gridGenerator.generateGridColumnsStyles, _gridGenerator.generateGridColumnSpacingStyles, _gridGenerator.generateGridRowSpacingStyles, _gridGenerator.generateGridSizeStyles, _gridGenerator.generateGridDirectionStyles, _gridGenerator.generateGridStyles, _gridGenerator.generateGridOffsetStyles);
82
+ const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
83
+ var _inProps$columns, _inProps$spacing, _ref, _inProps$rowSpacing, _ref2, _inProps$columnSpacin;
84
+
85
+ const theme = (0, _useTheme.default)();
86
+ const themeProps = useThemeProps(inProps);
87
+ const props = (0, _styleFunctionSx.extendSxProp)(themeProps); // `color` type conflicts with html color attribute.
88
+
89
+ const nested = React.useContext(NestedContext);
90
+ const {
91
+ className,
92
+ columns: columnsProp = 12,
93
+ container = false,
94
+ component = 'div',
95
+ direction = 'row',
96
+ wrap = 'wrap',
97
+ spacing: spacingProp = 0,
98
+ rowSpacing: rowSpacingProp = spacingProp,
99
+ columnSpacing: columnSpacingProp = spacingProp
100
+ } = props,
101
+ rest = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded); // collect breakpoints related props because they can be custom from the theme.
102
+
103
+ const gridSize = {};
104
+ const gridOffset = {};
105
+ const other = {};
106
+ Object.entries(rest).forEach(([key, val]) => {
107
+ if (theme.breakpoints.values[key] !== undefined) {
108
+ gridSize[key] = val;
109
+ } else if (theme.breakpoints.values[key.replace('Offset', '')] !== undefined) {
110
+ gridOffset[key.replace('Offset', '')] = val;
111
+ } else {
112
+ other[key] = val;
113
+ }
114
+ });
115
+ const columns = (_inProps$columns = inProps.columns) != null ? _inProps$columns : nested ? undefined : columnsProp;
116
+ const spacing = (_inProps$spacing = inProps.spacing) != null ? _inProps$spacing : nested ? undefined : spacingProp;
117
+ const rowSpacing = (_ref = (_inProps$rowSpacing = inProps.rowSpacing) != null ? _inProps$rowSpacing : inProps.spacing) != null ? _ref : nested ? undefined : rowSpacingProp;
118
+ const columnSpacing = (_ref2 = (_inProps$columnSpacin = inProps.columnSpacing) != null ? _inProps$columnSpacin : inProps.spacing) != null ? _ref2 : nested ? undefined : columnSpacingProp;
119
+ const ownerState = (0, _extends2.default)({}, props, {
120
+ nested,
121
+ columns,
122
+ container,
123
+ direction,
124
+ wrap,
125
+ spacing,
126
+ rowSpacing,
127
+ columnSpacing,
128
+ gridSize,
129
+ gridOffset
130
+ });
131
+ const classes = useUtilityClasses(ownerState, theme);
132
+ let result = /*#__PURE__*/(0, _jsxRuntime.jsx)(GridRoot, (0, _extends2.default)({
133
+ ref: ref,
134
+ as: component,
135
+ ownerState: ownerState,
136
+ className: (0, _clsx.default)(classes.root, className)
137
+ }, other));
138
+
139
+ if (!nested) {
140
+ result = /*#__PURE__*/(0, _jsxRuntime.jsx)(NestedContext.Provider, {
141
+ value: true,
142
+ children: result
143
+ });
144
+ }
145
+
146
+ return result;
147
+ });
148
+ process.env.NODE_ENV !== "production" ? Grid.propTypes
149
+ /* remove-proptypes */
150
+ = {
151
+ children: _propTypes.default.node,
152
+ className: _propTypes.default.string,
153
+ columns: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.number), _propTypes.default.number, _propTypes.default.object]),
154
+ columnSpacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
155
+ component: _propTypes.default.elementType,
156
+ container: _propTypes.default.bool,
157
+ direction: _propTypes.default.oneOfType([_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), _propTypes.default.arrayOf(_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), _propTypes.default.object]),
158
+ lg: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
159
+ lgOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
160
+ md: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
161
+ mdOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
162
+ rowSpacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
163
+ sm: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
164
+ smOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
165
+ spacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
166
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
167
+ wrap: _propTypes.default.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
168
+ xl: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
169
+ xlOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
170
+ xs: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
171
+ xsOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
172
+ } : void 0;
173
+ return Grid;
174
+ }
@@ -0,0 +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 declare type GridClassKey = keyof GridClasses;
18
+ export declare function getGridUtilityClass(slot: string): string;
19
+ declare const gridClasses: GridClasses;
20
+ export default gridClasses;