@mui/system 5.9.3 → 5.10.2

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 (70) hide show
  1. package/Box/Box.spec.d.ts +1 -1
  2. package/CHANGELOG.md +179 -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/Container/index.d.ts +1 -1
  8. package/README.md +1 -1
  9. package/Stack/Stack.d.ts +12 -0
  10. package/Stack/Stack.js +62 -0
  11. package/Stack/StackProps.d.ts +42 -0
  12. package/Stack/StackProps.js +5 -0
  13. package/Stack/createStack.d.ts +21 -0
  14. package/Stack/createStack.js +209 -0
  15. package/Stack/index.d.ts +5 -0
  16. package/Stack/index.js +65 -0
  17. package/Stack/package.json +6 -0
  18. package/Stack/stackClasses.d.ts +8 -0
  19. package/Stack/stackClasses.js +17 -0
  20. package/Unstable_Grid/Grid.d.ts +12 -12
  21. package/Unstable_Grid/GridProps.d.ts +162 -162
  22. package/Unstable_Grid/createGrid.d.ts +11 -11
  23. package/Unstable_Grid/gridClasses.d.ts +20 -20
  24. package/Unstable_Grid/gridGenerator.d.ts +26 -26
  25. package/Unstable_Grid/index.d.ts +5 -5
  26. package/breakpoints.d.ts +21 -0
  27. package/createBox.js +3 -1
  28. package/createBox.spec.d.ts +1 -1
  29. package/createStyled.js +30 -11
  30. package/createTheme/createSpacing.d.ts +10 -10
  31. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  32. package/cssVars/createGetCssVar.d.ts +5 -5
  33. package/cssVars/cssVarsParser.d.ts +65 -65
  34. package/cssVars/getInitColorSchemeScript.d.ts +45 -45
  35. package/cssVars/index.d.ts +3 -3
  36. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  37. package/cssVars/useCurrentColorScheme.js +28 -18
  38. package/esm/Stack/Stack.js +51 -0
  39. package/esm/Stack/StackProps.js +1 -0
  40. package/esm/Stack/createStack.js +179 -0
  41. package/esm/Stack/index.js +5 -0
  42. package/esm/Stack/stackClasses.js +6 -0
  43. package/esm/createBox.js +3 -1
  44. package/esm/createStyled.js +28 -10
  45. package/esm/cssVars/useCurrentColorScheme.js +28 -18
  46. package/esm/index.js +3 -1
  47. package/index.d.ts +4 -6
  48. package/index.js +25 -2
  49. package/index.spec.d.ts +1 -1
  50. package/legacy/Stack/Stack.js +51 -0
  51. package/legacy/Stack/StackProps.js +1 -0
  52. package/legacy/Stack/createStack.js +187 -0
  53. package/legacy/Stack/index.js +5 -0
  54. package/legacy/Stack/stackClasses.js +6 -0
  55. package/legacy/createBox.js +5 -1
  56. package/legacy/createStyled.js +31 -10
  57. package/legacy/cssVars/useCurrentColorScheme.js +28 -18
  58. package/legacy/index.js +4 -2
  59. package/modern/Stack/Stack.js +51 -0
  60. package/modern/Stack/StackProps.js +1 -0
  61. package/modern/Stack/createStack.js +179 -0
  62. package/modern/Stack/index.js +5 -0
  63. package/modern/Stack/stackClasses.js +6 -0
  64. package/modern/createBox.js +3 -1
  65. package/modern/createStyled.js +28 -10
  66. package/modern/cssVars/useCurrentColorScheme.js +28 -18
  67. package/modern/index.js +4 -2
  68. package/package.json +3 -3
  69. package/spacing.d.ts +6 -0
  70. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
@@ -0,0 +1,209 @@
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 = createStack;
9
+ exports.style = void 0;
10
+
11
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
+
13
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
+
15
+ var React = _interopRequireWildcard(require("react"));
16
+
17
+ var _propTypes = _interopRequireDefault(require("prop-types"));
18
+
19
+ var _clsx = _interopRequireDefault(require("clsx"));
20
+
21
+ var _utils = require("@mui/utils");
22
+
23
+ var _styled = _interopRequireDefault(require("../styled"));
24
+
25
+ var _useThemeProps = _interopRequireDefault(require("../useThemeProps"));
26
+
27
+ var _styleFunctionSx = require("../styleFunctionSx");
28
+
29
+ var _createTheme = _interopRequireDefault(require("../createTheme"));
30
+
31
+ var _breakpoints = require("../breakpoints");
32
+
33
+ var _spacing = require("../spacing");
34
+
35
+ var _jsxRuntime = require("react/jsx-runtime");
36
+
37
+ const _excluded = ["component", "direction", "spacing", "divider", "children", "className"];
38
+
39
+ 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); }
40
+
41
+ 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; }
42
+
43
+ const defaultTheme = (0, _createTheme.default)();
44
+ // widening Theme to any so that the consumer can own the theme structure.
45
+ const defaultCreateStyledComponent = (0, _styled.default)('div', {
46
+ name: 'MuiStack',
47
+ slot: 'Root',
48
+ overridesResolver: (props, styles) => styles.root
49
+ });
50
+
51
+ function useThemePropsDefault(props) {
52
+ return (0, _useThemeProps.default)({
53
+ props,
54
+ name: 'MuiStack',
55
+ defaultTheme
56
+ });
57
+ }
58
+ /**
59
+ * Return an array with the separator React element interspersed between
60
+ * each React node of the input children.
61
+ *
62
+ * > joinChildren([1,2,3], 0)
63
+ * [1,0,2,0,3]
64
+ */
65
+
66
+
67
+ function joinChildren(children, separator) {
68
+ const childrenArray = React.Children.toArray(children).filter(Boolean);
69
+ return childrenArray.reduce((output, child, index) => {
70
+ output.push(child);
71
+
72
+ if (index < childrenArray.length - 1) {
73
+ output.push( /*#__PURE__*/React.cloneElement(separator, {
74
+ key: `separator-${index}`
75
+ }));
76
+ }
77
+
78
+ return output;
79
+ }, []);
80
+ }
81
+
82
+ const getSideFromDirection = direction => {
83
+ return {
84
+ row: 'Left',
85
+ 'row-reverse': 'Right',
86
+ column: 'Top',
87
+ 'column-reverse': 'Bottom'
88
+ }[direction];
89
+ };
90
+
91
+ const style = ({
92
+ ownerState,
93
+ theme
94
+ }) => {
95
+ let styles = (0, _extends2.default)({
96
+ display: 'flex',
97
+ flexDirection: 'column'
98
+ }, (0, _breakpoints.handleBreakpoints)({
99
+ theme
100
+ }, (0, _breakpoints.resolveBreakpointValues)({
101
+ values: ownerState.direction,
102
+ breakpoints: theme.breakpoints.values
103
+ }), propValue => ({
104
+ flexDirection: propValue
105
+ })));
106
+
107
+ if (ownerState.spacing) {
108
+ const transformer = (0, _spacing.createUnarySpacing)(theme);
109
+ const base = Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
110
+ if (typeof ownerState.spacing === 'object' && ownerState.spacing[breakpoint] != null || typeof ownerState.direction === 'object' && ownerState.direction[breakpoint] != null) {
111
+ acc[breakpoint] = true;
112
+ }
113
+
114
+ return acc;
115
+ }, {});
116
+ const directionValues = (0, _breakpoints.resolveBreakpointValues)({
117
+ values: ownerState.direction,
118
+ base
119
+ });
120
+ const spacingValues = (0, _breakpoints.resolveBreakpointValues)({
121
+ values: ownerState.spacing,
122
+ base
123
+ });
124
+
125
+ if (typeof directionValues === 'object') {
126
+ Object.keys(directionValues).forEach((breakpoint, index, breakpoints) => {
127
+ const directionValue = directionValues[breakpoint];
128
+
129
+ if (!directionValue) {
130
+ const previousDirectionValue = index > 0 ? directionValues[breakpoints[index - 1]] : 'column';
131
+ directionValues[breakpoint] = previousDirectionValue;
132
+ }
133
+ });
134
+ }
135
+
136
+ const styleFromPropValue = (propValue, breakpoint) => {
137
+ return {
138
+ '& > :not(style) + :not(style)': {
139
+ margin: 0,
140
+ [`margin${getSideFromDirection(breakpoint ? directionValues[breakpoint] : ownerState.direction)}`]: (0, _spacing.getValue)(transformer, propValue)
141
+ }
142
+ };
143
+ };
144
+
145
+ styles = (0, _utils.deepmerge)(styles, (0, _breakpoints.handleBreakpoints)({
146
+ theme
147
+ }, spacingValues, styleFromPropValue));
148
+ }
149
+
150
+ styles = (0, _breakpoints.mergeBreakpointsInOrder)(theme.breakpoints, styles);
151
+ return styles;
152
+ };
153
+
154
+ exports.style = style;
155
+
156
+ function createStack(options = {}) {
157
+ const {
158
+ // This will allow adding custom styled fn (for example for custom sx style function)
159
+ createStyledComponent = defaultCreateStyledComponent,
160
+ useThemeProps = useThemePropsDefault,
161
+ componentName = 'MuiStack'
162
+ } = options;
163
+
164
+ const useUtilityClasses = () => {
165
+ const slots = {
166
+ root: ['root']
167
+ };
168
+ return (0, _utils.unstable_composeClasses)(slots, slot => (0, _utils.unstable_generateUtilityClass)(componentName, slot), {});
169
+ };
170
+
171
+ const StackRoot = createStyledComponent(style);
172
+ const Stack = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
173
+ const themeProps = useThemeProps(inProps);
174
+ const props = (0, _styleFunctionSx.extendSxProp)(themeProps); // `color` type conflicts with html color attribute.
175
+
176
+ const {
177
+ component = 'div',
178
+ direction = 'column',
179
+ spacing = 0,
180
+ divider,
181
+ children,
182
+ className
183
+ } = props,
184
+ other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
185
+ const ownerState = {
186
+ direction,
187
+ spacing
188
+ };
189
+ const classes = useUtilityClasses();
190
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StackRoot, (0, _extends2.default)({
191
+ as: component,
192
+ ownerState: ownerState,
193
+ ref: ref,
194
+ className: (0, _clsx.default)(classes.root, className)
195
+ }, other, {
196
+ children: divider ? joinChildren(children, divider) : children
197
+ }));
198
+ });
199
+ process.env.NODE_ENV !== "production" ? Stack.propTypes
200
+ /* remove-proptypes */
201
+ = {
202
+ children: _propTypes.default.node,
203
+ 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]),
204
+ divider: _propTypes.default.node,
205
+ 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]),
206
+ 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])
207
+ } : void 0;
208
+ return Stack;
209
+ }
@@ -0,0 +1,5 @@
1
+ export { default } from './Stack';
2
+ export { default as createStack } from './createStack';
3
+ export * from './StackProps';
4
+ export { default as stackClasses } from './stackClasses';
5
+ export * from './stackClasses';
package/Stack/index.js ADDED
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ var _exportNames = {
9
+ createStack: true,
10
+ stackClasses: true
11
+ };
12
+ Object.defineProperty(exports, "createStack", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _createStack.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "default", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _Stack.default;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "stackClasses", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _stackClasses.default;
28
+ }
29
+ });
30
+
31
+ var _Stack = _interopRequireDefault(require("./Stack"));
32
+
33
+ var _createStack = _interopRequireDefault(require("./createStack"));
34
+
35
+ var _StackProps = require("./StackProps");
36
+
37
+ Object.keys(_StackProps).forEach(function (key) {
38
+ if (key === "default" || key === "__esModule") return;
39
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
40
+ if (key in exports && exports[key] === _StackProps[key]) return;
41
+ Object.defineProperty(exports, key, {
42
+ enumerable: true,
43
+ get: function () {
44
+ return _StackProps[key];
45
+ }
46
+ });
47
+ });
48
+
49
+ var _stackClasses = _interopRequireWildcard(require("./stackClasses"));
50
+
51
+ Object.keys(_stackClasses).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
54
+ if (key in exports && exports[key] === _stackClasses[key]) return;
55
+ Object.defineProperty(exports, key, {
56
+ enumerable: true,
57
+ get: function () {
58
+ return _stackClasses[key];
59
+ }
60
+ });
61
+ });
62
+
63
+ 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); }
64
+
65
+ 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; }
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../esm/Stack/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,8 @@
1
+ export interface StackClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ }
5
+ export declare type StackClassKey = keyof StackClasses;
6
+ export declare function getStackUtilityClass(slot: string): string;
7
+ declare const stackClasses: StackClasses;
8
+ export default stackClasses;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ exports.getStackUtilityClass = getStackUtilityClass;
8
+
9
+ var _utils = require("@mui/utils");
10
+
11
+ function getStackUtilityClass(slot) {
12
+ return (0, _utils.unstable_generateUtilityClass)('MuiStack', slot);
13
+ }
14
+
15
+ const stackClasses = (0, _utils.unstable_generateUtilityClasses)('MuiStack', ['root']);
16
+ var _default = stackClasses;
17
+ exports.default = _default;
@@ -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,162 +1,162 @@
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
- * 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
- * Defines the vertical space between the type `item` components.
132
- * It overrides the value of the `spacing` prop.
133
- */
134
- rowSpacing?: ResponsiveStyleValue<GridSpacing>;
135
- /**
136
- * Defines the space between the type `item` components.
137
- * It can only be used on a type `container` component.
138
- * @default 0
139
- */
140
- spacing?: ResponsiveStyleValue<GridSpacing> | undefined;
141
- /**
142
- * Defines the `flex-wrap` style property.
143
- * It's applied for all screen sizes.
144
- * @default 'wrap'
145
- */
146
- wrap?: GridWrap;
147
- }
148
- export interface GridOwnerState extends GridBaseProps {
149
- nested: boolean;
150
- gridSize: Partial<Record<Breakpoint, GridSize | boolean>>;
151
- gridOffset: Partial<Record<Breakpoint, GridSize>>;
152
- }
153
- export interface GridTypeMap<P = {}, D extends React.ElementType = 'div'> {
154
- props: P & GridBaseProps & {
155
- sx?: SxProps<Theme>;
156
- } & SystemProps<Theme>;
157
- defaultComponent: D;
158
- }
159
- export declare type GridProps<D extends React.ElementType = GridTypeMap['defaultComponent'], P = {
160
- component?: React.ElementType;
161
- }> = OverrideProps<GridTypeMap<P, D>, D>;
162
- 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
+ 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
+ * 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
+ * Defines the vertical space between the type `item` components.
132
+ * It overrides the value of the `spacing` prop.
133
+ */
134
+ rowSpacing?: ResponsiveStyleValue<GridSpacing>;
135
+ /**
136
+ * Defines the space between the type `item` components.
137
+ * It can only be used on a type `container` component.
138
+ * @default 0
139
+ */
140
+ spacing?: ResponsiveStyleValue<GridSpacing> | undefined;
141
+ /**
142
+ * Defines the `flex-wrap` style property.
143
+ * It's applied for all screen sizes.
144
+ * @default 'wrap'
145
+ */
146
+ wrap?: GridWrap;
147
+ }
148
+ export interface GridOwnerState extends GridBaseProps {
149
+ nested: boolean;
150
+ gridSize: Partial<Record<Breakpoint, GridSize | boolean>>;
151
+ gridOffset: Partial<Record<Breakpoint, GridSize>>;
152
+ }
153
+ export interface GridTypeMap<P = {}, D extends React.ElementType = 'div'> {
154
+ props: P & GridBaseProps & {
155
+ sx?: SxProps<Theme>;
156
+ } & SystemProps<Theme>;
157
+ defaultComponent: D;
158
+ }
159
+ export declare type GridProps<D extends React.ElementType = GridTypeMap['defaultComponent'], P = {
160
+ component?: React.ElementType;
161
+ }> = OverrideProps<GridTypeMap<P, D>, D>;
162
+ export {};