@mui/material 6.0.0-alpha.12 β 6.0.0-alpha.13
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.
- package/CHANGELOG.md +39 -0
- package/Hidden/hiddenCssClasses.d.ts +3 -0
- package/Modal/Modal.js +27 -17
- package/PigmentContainer/PigmentContainer.d.ts +55 -0
- package/PigmentContainer/PigmentContainer.js +98 -0
- package/PigmentContainer/index.d.ts +3 -0
- package/PigmentContainer/index.js +3 -0
- package/PigmentContainer/package.json +6 -0
- package/PigmentGrid/PigmentGrid.d.ts +108 -0
- package/PigmentGrid/PigmentGrid.js +149 -0
- package/PigmentGrid/index.d.ts +3 -0
- package/PigmentGrid/index.js +3 -0
- package/PigmentGrid/package.json +6 -0
- package/PigmentHidden/PigmentHidden.d.ts +97 -0
- package/PigmentHidden/PigmentHidden.js +278 -0
- package/PigmentHidden/index.d.ts +2 -0
- package/PigmentHidden/index.js +2 -0
- package/PigmentHidden/package.json +6 -0
- package/PigmentStack/PigmentStack.d.ts +51 -0
- package/PigmentStack/PigmentStack.js +81 -0
- package/PigmentStack/index.d.ts +3 -0
- package/PigmentStack/index.js +3 -0
- package/PigmentStack/package.json +6 -0
- package/index.js +1 -1
- package/modern/Modal/Modal.js +27 -17
- package/modern/PigmentContainer/PigmentContainer.js +98 -0
- package/modern/PigmentContainer/index.js +3 -0
- package/modern/PigmentGrid/PigmentGrid.js +149 -0
- package/modern/PigmentGrid/index.js +3 -0
- package/modern/PigmentHidden/PigmentHidden.js +278 -0
- package/modern/PigmentHidden/index.js +2 -0
- package/modern/PigmentStack/PigmentStack.js +81 -0
- package/modern/PigmentStack/index.js +3 -0
- package/modern/index.js +1 -1
- package/node/Modal/Modal.js +27 -18
- package/node/PigmentContainer/PigmentContainer.js +108 -0
- package/node/PigmentContainer/index.js +36 -0
- package/node/PigmentGrid/PigmentGrid.js +159 -0
- package/node/PigmentGrid/index.js +36 -0
- package/node/PigmentHidden/PigmentHidden.js +287 -0
- package/node/PigmentHidden/index.js +26 -0
- package/node/PigmentStack/PigmentStack.js +91 -0
- package/node/PigmentStack/index.js +36 -0
- package/node/index.js +1 -1
- package/package.json +10 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## v6.0.0-alpha.13
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.0.0-alpha.12..next -->
|
|
6
|
+
|
|
7
|
+
_Jun 27, 2024_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 10 contributors who made this release possible. Here are some highlights β¨:
|
|
10
|
+
|
|
11
|
+
- π Added layout components for PigmentΒ CSS integration (#42693) @siriwatknp
|
|
12
|
+
|
|
13
|
+
### `@mui/material@6.0.0-alpha.13`
|
|
14
|
+
|
|
15
|
+
- [Autocomplete] Fix more React 18.3 key spread warnings in demos (#42639) @wbt
|
|
16
|
+
- [Container][Grid][Stack][Hidden] Export PigmentΒ CSS layout components (#42693) @siriwatknp
|
|
17
|
+
- [Text Field] when click password visibility button, text caret position change to very front. (#42595) @appleSimple
|
|
18
|
+
- [Modal] migrate useSlotProps to useSLot (#42150) @sai6855
|
|
19
|
+
|
|
20
|
+
### `@mui/styles@6.0.0-alpha.13`
|
|
21
|
+
|
|
22
|
+
- [withStyles] Expect React defaultProps warning in test (#42752) @aarongarciah
|
|
23
|
+
|
|
24
|
+
### Docs
|
|
25
|
+
|
|
26
|
+
- Fix link in CONTRIBUTING.md (#42755) @Janpot
|
|
27
|
+
- Add documentation on migrating JSS's alternative, array-based syntax to syntax supported by Emotion (#42053) @cjl750
|
|
28
|
+
- Fix type error in virtualized table demo (#42757) @aarongarciah
|
|
29
|
+
- Add first batch of v6 migration (#42242) @siriwatknp
|
|
30
|
+
- Fix quotes on font-family dedeclaration in the Landing Page template theme (#42748) @joetats
|
|
31
|
+
|
|
32
|
+
### Core
|
|
33
|
+
|
|
34
|
+
- [code-infra] Refactor eslint `import/no-cycle` rule (#42705) @LukasTy
|
|
35
|
+
- [core] Target direct version for prerelease (#42768) @siriwatknp
|
|
36
|
+
- [test] Remove enzyme (#42706) @aarongarciah
|
|
37
|
+
- [test] Remove createMount test util (#42703) @aarongarciah
|
|
38
|
+
- [website] Add Ale to team (#42764) @alelthomas
|
|
39
|
+
|
|
40
|
+
All contributors of this release in alphabetical order: @aarongarciah, @alelthomas, @appleSimple, @cjl750, @Janpot, @joetats, @LukasTy, @sai6855, @siriwatknp, @wbt
|
|
41
|
+
|
|
3
42
|
## v6.0.0-alpha.12
|
|
4
43
|
|
|
5
44
|
<!-- generated comparing v6.0.0-alpha.11..next -->
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function getHiddenCssUtilityClass(slot: string): string;
|
|
2
|
+
declare const hiddenCssClasses: Record<"root" | "xlDown" | "xlUp" | "onlyXl" | "lgDown" | "lgUp" | "onlyLg" | "mdDown" | "mdUp" | "onlyMd" | "smDown" | "smUp" | "onlySm" | "xsDown" | "xsUp" | "onlyXs", string>;
|
|
3
|
+
export default hiddenCssClasses;
|
package/Modal/Modal.js
CHANGED
|
@@ -5,7 +5,6 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import HTMLElementType from '@mui/utils/HTMLElementType';
|
|
7
7
|
import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
|
|
8
|
-
import { useSlotProps } from '@mui/base/utils';
|
|
9
8
|
import { unstable_useModal as useModal } from '@mui/base/unstable_useModal';
|
|
10
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
10
|
import FocusTrap from '../Unstable_TrapFocus';
|
|
@@ -14,6 +13,8 @@ import { styled } from '../zero-styled';
|
|
|
14
13
|
import { useDefaultProps } from '../DefaultPropsProvider';
|
|
15
14
|
import Backdrop from '../Backdrop';
|
|
16
15
|
import { getModalUtilityClass } from './modalClasses';
|
|
16
|
+
import useSlot from '../utils/useSlot';
|
|
17
|
+
import { useForkRef } from '../utils';
|
|
17
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
const useUtilityClasses = ownerState => {
|
|
19
20
|
const {
|
|
@@ -106,8 +107,8 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
106
107
|
onTransitionEnter,
|
|
107
108
|
onTransitionExited,
|
|
108
109
|
open,
|
|
109
|
-
slotProps,
|
|
110
|
-
slots,
|
|
110
|
+
slotProps = {},
|
|
111
|
+
slots = {},
|
|
111
112
|
// eslint-disable-next-line react/prop-types
|
|
112
113
|
theme,
|
|
113
114
|
...other
|
|
@@ -155,25 +156,31 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
155
156
|
childProps.onEnter = onEnter;
|
|
156
157
|
childProps.onExited = onExited;
|
|
157
158
|
}
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
159
|
+
const externalForwardedProps = {
|
|
160
|
+
slots: {
|
|
161
|
+
root: components.Root,
|
|
162
|
+
backdrop: components.Backdrop,
|
|
163
|
+
...slots
|
|
164
|
+
},
|
|
165
|
+
slotProps: {
|
|
166
|
+
...componentsProps,
|
|
167
|
+
...slotProps
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const [RootSlot, rootProps] = useSlot('root', {
|
|
171
|
+
elementType: ModalRoot,
|
|
172
|
+
externalForwardedProps,
|
|
166
173
|
getSlotProps: getRootProps,
|
|
167
174
|
additionalProps: {
|
|
168
175
|
ref,
|
|
169
176
|
as: component
|
|
170
177
|
},
|
|
171
178
|
ownerState,
|
|
172
|
-
className: clsx(className,
|
|
179
|
+
className: clsx(className, classes?.root, !ownerState.open && ownerState.exited && classes?.hidden)
|
|
173
180
|
});
|
|
174
|
-
const backdropProps =
|
|
175
|
-
elementType:
|
|
176
|
-
|
|
181
|
+
const [BackdropSlot, backdropProps] = useSlot('backdrop', {
|
|
182
|
+
elementType: BackdropComponent,
|
|
183
|
+
externalForwardedProps,
|
|
177
184
|
additionalProps: BackdropProps,
|
|
178
185
|
getSlotProps: otherHandlers => {
|
|
179
186
|
return getBackdropProps({
|
|
@@ -188,9 +195,10 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
188
195
|
}
|
|
189
196
|
});
|
|
190
197
|
},
|
|
191
|
-
className: clsx(
|
|
198
|
+
className: clsx(BackdropProps?.className, classes?.backdrop),
|
|
192
199
|
ownerState
|
|
193
200
|
});
|
|
201
|
+
const backdropRef = useForkRef(BackdropProps?.ref, backdropProps.ref);
|
|
194
202
|
if (!keepMounted && !open && (!hasTransition || exited)) {
|
|
195
203
|
return null;
|
|
196
204
|
}
|
|
@@ -200,8 +208,10 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
200
208
|
disablePortal: disablePortal,
|
|
201
209
|
children: /*#__PURE__*/_jsxs(RootSlot, {
|
|
202
210
|
...rootProps,
|
|
211
|
+
...other,
|
|
203
212
|
children: [!hideBackdrop && BackdropComponent ? /*#__PURE__*/_jsx(BackdropSlot, {
|
|
204
|
-
...backdropProps
|
|
213
|
+
...backdropProps,
|
|
214
|
+
ref: backdropRef
|
|
205
215
|
}) : null, /*#__PURE__*/_jsx(FocusTrap, {
|
|
206
216
|
disableEnforceFocus: disableEnforceFocus,
|
|
207
217
|
disableAutoFocus: disableAutoFocus,
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { OverridableComponent, OverrideProps } from '@mui/types';
|
|
3
|
+
import { SxProps, Breakpoint } from '@mui/system';
|
|
4
|
+
import { Theme } from '../styles';
|
|
5
|
+
import { ContainerClasses } from '../Container/containerClasses';
|
|
6
|
+
export interface PigmentContainerOwnProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Override or extend the styles applied to the component.
|
|
10
|
+
*/
|
|
11
|
+
classes?: Partial<ContainerClasses>;
|
|
12
|
+
/**
|
|
13
|
+
* If `true`, the left and right padding is removed.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
disableGutters?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Set the max-width to match the min-width of the current breakpoint.
|
|
19
|
+
* This is useful if you'd prefer to design for a fixed set of sizes
|
|
20
|
+
* instead of trying to accommodate a fully fluid viewport.
|
|
21
|
+
* It's fluid by default.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
fixed?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Determine the max-width of the container.
|
|
27
|
+
* The container width grows with the size of the screen.
|
|
28
|
+
* Set to `false` to disable `maxWidth`.
|
|
29
|
+
* @default 'lg'
|
|
30
|
+
*/
|
|
31
|
+
maxWidth?: Breakpoint | false;
|
|
32
|
+
/**
|
|
33
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
34
|
+
*/
|
|
35
|
+
sx?: SxProps<Theme>;
|
|
36
|
+
}
|
|
37
|
+
export interface PigmentContainerTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'div'> {
|
|
38
|
+
props: AdditionalProps & PigmentContainerOwnProps;
|
|
39
|
+
defaultComponent: RootComponent;
|
|
40
|
+
}
|
|
41
|
+
export type PigmentContainerProps<RootComponent extends React.ElementType = PigmentContainerTypeMap['defaultComponent'], AdditionalProps = {}> = OverrideProps<PigmentContainerTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|
|
42
|
+
component?: React.ElementType;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* Demos:
|
|
47
|
+
*
|
|
48
|
+
* - [Container](https://next.mui.com/material-ui/react-container/)
|
|
49
|
+
*
|
|
50
|
+
* API:
|
|
51
|
+
*
|
|
52
|
+
* - [PigmentContainer API](https://next.mui.com/material-ui/api/pigment-container/)
|
|
53
|
+
*/
|
|
54
|
+
declare const PigmentContainer: OverridableComponent<PigmentContainerTypeMap<{}, "div">>;
|
|
55
|
+
export default PigmentContainer;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import Container from '@pigment-css/react/Container';
|
|
6
|
+
import capitalize from '@mui/utils/capitalize';
|
|
7
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const useUtilityClasses = ownerState => {
|
|
11
|
+
const {
|
|
12
|
+
classes,
|
|
13
|
+
fixed,
|
|
14
|
+
disableGutters,
|
|
15
|
+
maxWidth
|
|
16
|
+
} = ownerState;
|
|
17
|
+
const slots = {
|
|
18
|
+
root: ['root', maxWidth && `maxWidth${capitalize(String(maxWidth))}`, fixed && 'fixed', disableGutters && 'disableGutters']
|
|
19
|
+
};
|
|
20
|
+
return composeClasses(slots, slot => generateUtilityClass('MuiContainer', slot), classes);
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* Demos:
|
|
25
|
+
*
|
|
26
|
+
* - [Container](https://next.mui.com/material-ui/react-container/)
|
|
27
|
+
*
|
|
28
|
+
* API:
|
|
29
|
+
*
|
|
30
|
+
* - [PigmentContainer API](https://next.mui.com/material-ui/api/pigment-container/)
|
|
31
|
+
*/
|
|
32
|
+
const PigmentContainer = /*#__PURE__*/React.forwardRef(function PigmentContainer({
|
|
33
|
+
className,
|
|
34
|
+
disableGutters = false,
|
|
35
|
+
fixed = false,
|
|
36
|
+
maxWidth = 'lg',
|
|
37
|
+
...props
|
|
38
|
+
}, ref) {
|
|
39
|
+
const ownerState = {
|
|
40
|
+
...props,
|
|
41
|
+
disableGutters,
|
|
42
|
+
fixed,
|
|
43
|
+
maxWidth
|
|
44
|
+
};
|
|
45
|
+
const classes = useUtilityClasses(ownerState);
|
|
46
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
47
|
+
className: clsx(classes.root, className),
|
|
48
|
+
disableGutters: disableGutters,
|
|
49
|
+
fixed: fixed,
|
|
50
|
+
maxWidth: maxWidth,
|
|
51
|
+
...props,
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
ref: ref
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
process.env.NODE_ENV !== "production" ? PigmentContainer.propTypes /* remove-proptypes */ = {
|
|
57
|
+
// βββββββββββββββββββββββββββββββ Warning βββββββββββββββββββββββββββββββ
|
|
58
|
+
// β These PropTypes are generated from the TypeScript type definitions. β
|
|
59
|
+
// β To update them, edit the TypeScript types and run `pnpm proptypes`. β
|
|
60
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
61
|
+
/**
|
|
62
|
+
* @ignore
|
|
63
|
+
*/
|
|
64
|
+
children: PropTypes.node,
|
|
65
|
+
/**
|
|
66
|
+
* Override or extend the styles applied to the component.
|
|
67
|
+
*/
|
|
68
|
+
classes: PropTypes.object,
|
|
69
|
+
/**
|
|
70
|
+
* @ignore
|
|
71
|
+
*/
|
|
72
|
+
className: PropTypes.string,
|
|
73
|
+
/**
|
|
74
|
+
* If `true`, the left and right padding is removed.
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
disableGutters: PropTypes.bool,
|
|
78
|
+
/**
|
|
79
|
+
* Set the max-width to match the min-width of the current breakpoint.
|
|
80
|
+
* This is useful if you'd prefer to design for a fixed set of sizes
|
|
81
|
+
* instead of trying to accommodate a fully fluid viewport.
|
|
82
|
+
* It's fluid by default.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
fixed: PropTypes.bool,
|
|
86
|
+
/**
|
|
87
|
+
* Determine the max-width of the container.
|
|
88
|
+
* The container width grows with the size of the screen.
|
|
89
|
+
* Set to `false` to disable `maxWidth`.
|
|
90
|
+
* @default 'lg'
|
|
91
|
+
*/
|
|
92
|
+
maxWidth: PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs', false]),
|
|
93
|
+
/**
|
|
94
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
95
|
+
*/
|
|
96
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
97
|
+
} : void 0;
|
|
98
|
+
export default PigmentContainer;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { OverridableComponent, OverrideProps } from '@mui/types';
|
|
3
|
+
import { SxProps } from '@mui/system';
|
|
4
|
+
import { Breakpoint, Theme } from '../styles';
|
|
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;
|
|
12
|
+
export interface GridBaseProps {
|
|
13
|
+
/**
|
|
14
|
+
* The content of the component.
|
|
15
|
+
*/
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* The number of columns.
|
|
19
|
+
* @default 12
|
|
20
|
+
*/
|
|
21
|
+
columns?: ResponsiveStyleValue<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Defines the horizontal space between the type `item` components.
|
|
24
|
+
* It overrides the value of the `spacing` prop.
|
|
25
|
+
*/
|
|
26
|
+
columnSpacing?: ResponsiveStyleValue<GridSpacing>;
|
|
27
|
+
/**
|
|
28
|
+
* If `true`, the component will have the flex *container* behavior.
|
|
29
|
+
* You should be wrapping *items* with a *container*.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
container?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Defines the `flex-direction` style property.
|
|
35
|
+
* It is applied for all screen sizes.
|
|
36
|
+
* @default 'row'
|
|
37
|
+
*/
|
|
38
|
+
direction?: ResponsiveStyleValue<GridDirection>;
|
|
39
|
+
/**
|
|
40
|
+
* Defines the offset of the grid.
|
|
41
|
+
*/
|
|
42
|
+
offset?: ResponsiveStyleValue<number> | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
* The level of the grid starts from `0`
|
|
46
|
+
* and increases when the grid nests inside another grid regardless of container or item.
|
|
47
|
+
*
|
|
48
|
+
* ```js
|
|
49
|
+
* <Grid> // level 0
|
|
50
|
+
* <Grid> // level 1
|
|
51
|
+
* <Grid> // level 2
|
|
52
|
+
* <Grid> // level 1
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* Only consecutive grid is considered nesting.
|
|
56
|
+
* A grid container will start at `0` if there are non-Grid element above it.
|
|
57
|
+
*
|
|
58
|
+
* ```js
|
|
59
|
+
* <Grid> // level 0
|
|
60
|
+
* <div>
|
|
61
|
+
* <Grid> // level 0
|
|
62
|
+
* <Grid> // level 1
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
unstable_level?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Defines the vertical space between the type `item` components.
|
|
68
|
+
* It overrides the value of the `spacing` prop.
|
|
69
|
+
*/
|
|
70
|
+
rowSpacing?: ResponsiveStyleValue<GridSpacing>;
|
|
71
|
+
/**
|
|
72
|
+
* Defines the space between the type `item` components.
|
|
73
|
+
* It can only be used on a type `container` component.
|
|
74
|
+
* @default 0
|
|
75
|
+
*/
|
|
76
|
+
spacing?: ResponsiveStyleValue<GridSpacing> | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Defines the column size of the grid.
|
|
79
|
+
*/
|
|
80
|
+
size?: ResponsiveStyleValue<GridSize> | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Defines the `flex-wrap` style property.
|
|
83
|
+
* It's applied for all screen sizes.
|
|
84
|
+
* @default 'wrap'
|
|
85
|
+
*/
|
|
86
|
+
wrap?: GridWrap;
|
|
87
|
+
}
|
|
88
|
+
export interface GridTypeMap<AdditionalProps = {}, DefaultComponent extends React.ElementType = 'div'> {
|
|
89
|
+
props: AdditionalProps & GridBaseProps & {
|
|
90
|
+
sx?: SxProps<Theme>;
|
|
91
|
+
};
|
|
92
|
+
defaultComponent: DefaultComponent;
|
|
93
|
+
}
|
|
94
|
+
export type GridProps<RootComponent extends React.ElementType = GridTypeMap['defaultComponent'], AdditionalProps = {
|
|
95
|
+
component?: React.ElementType;
|
|
96
|
+
}> = OverrideProps<GridTypeMap<AdditionalProps, RootComponent>, RootComponent>;
|
|
97
|
+
/**
|
|
98
|
+
*
|
|
99
|
+
* Demos:
|
|
100
|
+
*
|
|
101
|
+
* - [Grid version 2](https://next.mui.com/material-ui/react-grid2/)
|
|
102
|
+
*
|
|
103
|
+
* API:
|
|
104
|
+
*
|
|
105
|
+
* - [PigmentGrid API](https://next.mui.com/material-ui/api/pigment-grid/)
|
|
106
|
+
*/
|
|
107
|
+
declare const PigmentGrid: OverridableComponent<GridTypeMap<{}, "div">>;
|
|
108
|
+
export default PigmentGrid;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import Grid from '@pigment-css/react/Grid';
|
|
6
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
8
|
+
import { generateDirectionClasses, generateSizeClassNames, generateSpacingClassNames } from '@mui/system/Unstable_Grid/gridGenerator';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const useUtilityClasses = ownerState => {
|
|
11
|
+
const {
|
|
12
|
+
container,
|
|
13
|
+
direction,
|
|
14
|
+
size,
|
|
15
|
+
spacing
|
|
16
|
+
} = ownerState;
|
|
17
|
+
let gridSize = {};
|
|
18
|
+
if (size) {
|
|
19
|
+
if (Array.isArray(size)) {
|
|
20
|
+
size.forEach((value, index) => {
|
|
21
|
+
gridSize = {
|
|
22
|
+
...gridSize,
|
|
23
|
+
[index]: value
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (typeof size === 'object') {
|
|
28
|
+
gridSize = size;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const slots = {
|
|
32
|
+
root: ['root', container && 'container', ...generateDirectionClasses(direction), ...generateSizeClassNames(gridSize), ...(container ? generateSpacingClassNames(spacing) : [])]
|
|
33
|
+
};
|
|
34
|
+
return composeClasses(slots, slot => generateUtilityClass('MuiGrid2', slot), {});
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* Demos:
|
|
39
|
+
*
|
|
40
|
+
* - [Grid version 2](https://next.mui.com/material-ui/react-grid2/)
|
|
41
|
+
*
|
|
42
|
+
* API:
|
|
43
|
+
*
|
|
44
|
+
* - [PigmentGrid API](https://next.mui.com/material-ui/api/pigment-grid/)
|
|
45
|
+
*/
|
|
46
|
+
const PigmentGrid = /*#__PURE__*/React.forwardRef(function PigmentGrid(props, ref) {
|
|
47
|
+
const {
|
|
48
|
+
className,
|
|
49
|
+
...other
|
|
50
|
+
} = props;
|
|
51
|
+
const classes = useUtilityClasses(props);
|
|
52
|
+
return /*#__PURE__*/_jsx(Grid, {
|
|
53
|
+
ref: ref,
|
|
54
|
+
className: clsx(classes.root, className),
|
|
55
|
+
...other
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
process.env.NODE_ENV !== "production" ? PigmentGrid.propTypes /* remove-proptypes */ = {
|
|
59
|
+
// βββββββββββββββββββββββββββββββ Warning βββββββββββββββββββββββββββββββ
|
|
60
|
+
// β These PropTypes are generated from the TypeScript type definitions. β
|
|
61
|
+
// β To update them, edit the TypeScript types and run `pnpm proptypes`. β
|
|
62
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
63
|
+
/**
|
|
64
|
+
* The content of the component.
|
|
65
|
+
*/
|
|
66
|
+
children: PropTypes.node,
|
|
67
|
+
/**
|
|
68
|
+
* @ignore
|
|
69
|
+
*/
|
|
70
|
+
className: PropTypes.string,
|
|
71
|
+
/**
|
|
72
|
+
* The number of columns.
|
|
73
|
+
* @default 12
|
|
74
|
+
*/
|
|
75
|
+
columns: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
|
76
|
+
/**
|
|
77
|
+
* Defines the horizontal space between the type `item` components.
|
|
78
|
+
* It overrides the value of the `spacing` prop.
|
|
79
|
+
*/
|
|
80
|
+
columnSpacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
81
|
+
/**
|
|
82
|
+
* If `true`, the component will have the flex *container* behavior.
|
|
83
|
+
* You should be wrapping *items* with a *container*.
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
container: PropTypes.bool,
|
|
87
|
+
/**
|
|
88
|
+
* Defines the `flex-direction` style property.
|
|
89
|
+
* It is applied for all screen sizes.
|
|
90
|
+
* @default 'row'
|
|
91
|
+
*/
|
|
92
|
+
direction: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['column', 'column-reverse', 'row', 'row-reverse']), PropTypes.arrayOf(PropTypes.oneOf(['column', 'column-reverse', 'row', 'row-reverse'])), PropTypes.object]),
|
|
93
|
+
/**
|
|
94
|
+
* Defines the offset of the grid.
|
|
95
|
+
*/
|
|
96
|
+
offset: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
|
97
|
+
/**
|
|
98
|
+
* Defines the vertical space between the type `item` components.
|
|
99
|
+
* It overrides the value of the `spacing` prop.
|
|
100
|
+
*/
|
|
101
|
+
rowSpacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
102
|
+
/**
|
|
103
|
+
* Defines the column size of the grid.
|
|
104
|
+
*/
|
|
105
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
|
106
|
+
/**
|
|
107
|
+
* Defines the space between the type `item` components.
|
|
108
|
+
* It can only be used on a type `container` component.
|
|
109
|
+
* @default 0
|
|
110
|
+
*/
|
|
111
|
+
spacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
112
|
+
/**
|
|
113
|
+
* @ignore
|
|
114
|
+
*/
|
|
115
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
116
|
+
/**
|
|
117
|
+
* @internal
|
|
118
|
+
* The level of the grid starts from `0`
|
|
119
|
+
* and increases when the grid nests inside another grid regardless of container or item.
|
|
120
|
+
*
|
|
121
|
+
* ```js
|
|
122
|
+
* <Grid> // level 0
|
|
123
|
+
* <Grid> // level 1
|
|
124
|
+
* <Grid> // level 2
|
|
125
|
+
* <Grid> // level 1
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* Only consecutive grid is considered nesting.
|
|
129
|
+
* A grid container will start at `0` if there are non-Grid element above it.
|
|
130
|
+
*
|
|
131
|
+
* ```js
|
|
132
|
+
* <Grid> // level 0
|
|
133
|
+
* <div>
|
|
134
|
+
* <Grid> // level 0
|
|
135
|
+
* <Grid> // level 1
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
unstable_level: PropTypes.number,
|
|
139
|
+
/**
|
|
140
|
+
* Defines the `flex-wrap` style property.
|
|
141
|
+
* It's applied for all screen sizes.
|
|
142
|
+
* @default 'wrap'
|
|
143
|
+
*/
|
|
144
|
+
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
|
145
|
+
} : void 0;
|
|
146
|
+
|
|
147
|
+
// @ts-ignore internal logic for nested grid
|
|
148
|
+
PigmentGrid.muiName = 'Grid';
|
|
149
|
+
export default PigmentGrid;
|