@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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Breakpoint } from '@mui/system';
|
|
3
|
+
export interface HiddenProps {
|
|
4
|
+
/**
|
|
5
|
+
* The content of the component.
|
|
6
|
+
*/
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Specify which implementation to use. 'js' is the default, 'css' works better for
|
|
10
|
+
* server-side rendering.
|
|
11
|
+
* @default 'js'
|
|
12
|
+
*/
|
|
13
|
+
implementation?: 'js' | 'css';
|
|
14
|
+
/**
|
|
15
|
+
* You can use this prop when choosing the `js` implementation with server-side rendering.
|
|
16
|
+
*
|
|
17
|
+
* As `window.innerWidth` is unavailable on the server,
|
|
18
|
+
* we default to rendering an empty component during the first mount.
|
|
19
|
+
* You might want to use a heuristic to approximate
|
|
20
|
+
* the screen width of the client browser screen width.
|
|
21
|
+
*
|
|
22
|
+
* For instance, you could be using the user-agent or the client-hints.
|
|
23
|
+
* https://caniuse.com/#search=client%20hint
|
|
24
|
+
*/
|
|
25
|
+
initialWidth?: Breakpoint;
|
|
26
|
+
/**
|
|
27
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
lgDown?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* If `true`, component is hidden on screens this size and above.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
lgUp?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
mdDown?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* If `true`, component is hidden on screens this size and above.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
mdUp?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Hide the given breakpoint(s).
|
|
48
|
+
*/
|
|
49
|
+
only?: Breakpoint | Breakpoint[];
|
|
50
|
+
/**
|
|
51
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
smDown?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* If `true`, component is hidden on screens this size and above.
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
smUp?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
xlDown?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* If `true`, component is hidden on screens this size and above.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
xlUp?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
xsDown?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* If `true`, component is hidden on screens this size and above.
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
xsUp?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* Demos:
|
|
84
|
+
*
|
|
85
|
+
* - [Hidden](https://next.mui.com/material-ui/react-hidden/)
|
|
86
|
+
*
|
|
87
|
+
* API:
|
|
88
|
+
*
|
|
89
|
+
* - [PigmentHidden API](https://next.mui.com/material-ui/api/pigment-hidden/)
|
|
90
|
+
*/
|
|
91
|
+
declare function PigmentHidden({ implementation, ...props }: HiddenProps & {
|
|
92
|
+
className?: string;
|
|
93
|
+
}): React.JSX.Element;
|
|
94
|
+
declare namespace PigmentHidden {
|
|
95
|
+
var propTypes: any;
|
|
96
|
+
}
|
|
97
|
+
export default PigmentHidden;
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import Hidden from '@pigment-css/react/Hidden';
|
|
8
|
+
import capitalize from '@mui/utils/capitalize';
|
|
9
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
10
|
+
import HiddenJs from '../Hidden/HiddenJs';
|
|
11
|
+
import { getHiddenCssUtilityClass } from '../Hidden/hiddenCssClasses';
|
|
12
|
+
import { useTheme } from '../zero-styled';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
const useUtilityClasses = ownerState => {
|
|
15
|
+
const {
|
|
16
|
+
classes,
|
|
17
|
+
breakpoints
|
|
18
|
+
} = ownerState;
|
|
19
|
+
const slots = {
|
|
20
|
+
root: ['root', ...breakpoints.map(({
|
|
21
|
+
breakpoint,
|
|
22
|
+
dir
|
|
23
|
+
}) => {
|
|
24
|
+
return dir === 'only' ? `${dir}${capitalize(breakpoint)}` : `${breakpoint}${capitalize(dir)}`;
|
|
25
|
+
})]
|
|
26
|
+
};
|
|
27
|
+
return composeClasses(slots, getHiddenCssUtilityClass, classes);
|
|
28
|
+
};
|
|
29
|
+
function HiddenCss(props) {
|
|
30
|
+
const theme = useTheme();
|
|
31
|
+
const {
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
only,
|
|
35
|
+
...other
|
|
36
|
+
} = props;
|
|
37
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
38
|
+
const unknownProps = Object.keys(other).filter(propName => {
|
|
39
|
+
const isUndeclaredBreakpoint = !theme.breakpoints.keys.some(breakpoint => {
|
|
40
|
+
return `${breakpoint}Up` === propName || `${breakpoint}Down` === propName;
|
|
41
|
+
});
|
|
42
|
+
return !['classes', 'theme', 'isRtl', 'sx'].includes(propName) && isUndeclaredBreakpoint;
|
|
43
|
+
});
|
|
44
|
+
if (unknownProps.length > 0) {
|
|
45
|
+
console.error(`MUI: Unsupported props received by \`<Hidden implementation="css" />\`: ${unknownProps.join(', ')}. Did you forget to wrap this component in a ThemeProvider declaring these breakpoints?`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const breakpoints = [];
|
|
49
|
+
for (let i = 0; i < theme.breakpoints.keys.length; i += 1) {
|
|
50
|
+
const breakpoint = theme.breakpoints.keys[i];
|
|
51
|
+
const breakpointUp = other[`${breakpoint}Up`];
|
|
52
|
+
const breakpointDown = other[`${breakpoint}Down`];
|
|
53
|
+
if (breakpointUp) {
|
|
54
|
+
breakpoints.push({
|
|
55
|
+
breakpoint,
|
|
56
|
+
dir: 'up'
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (breakpointDown) {
|
|
60
|
+
breakpoints.push({
|
|
61
|
+
breakpoint,
|
|
62
|
+
dir: 'down'
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (only) {
|
|
67
|
+
const onlyBreakpoints = Array.isArray(only) ? only : [only];
|
|
68
|
+
onlyBreakpoints.forEach(breakpoint => {
|
|
69
|
+
breakpoints.push({
|
|
70
|
+
breakpoint,
|
|
71
|
+
dir: 'only'
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const ownerState = {
|
|
76
|
+
...props,
|
|
77
|
+
classes: {},
|
|
78
|
+
breakpoints
|
|
79
|
+
};
|
|
80
|
+
const classes = useUtilityClasses(ownerState);
|
|
81
|
+
return /*#__PURE__*/_jsx(Hidden, {
|
|
82
|
+
className: clsx(classes.root, className),
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
process.env.NODE_ENV !== "production" ? HiddenCss.propTypes /* remove-proptypes */ = {
|
|
87
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
88
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
89
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
90
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
91
|
+
/**
|
|
92
|
+
* The content of the component.
|
|
93
|
+
*/
|
|
94
|
+
children: PropTypes.node,
|
|
95
|
+
className: PropTypes.string,
|
|
96
|
+
/**
|
|
97
|
+
* Specify which implementation to use. 'js' is the default, 'css' works better for
|
|
98
|
+
* server-side rendering.
|
|
99
|
+
* @default 'js'
|
|
100
|
+
*/
|
|
101
|
+
implementation: PropTypes.oneOf(['css', 'js']),
|
|
102
|
+
/**
|
|
103
|
+
* You can use this prop when choosing the `js` implementation with server-side rendering.
|
|
104
|
+
*
|
|
105
|
+
* As `window.innerWidth` is unavailable on the server,
|
|
106
|
+
* we default to rendering an empty component during the first mount.
|
|
107
|
+
* You might want to use a heuristic to approximate
|
|
108
|
+
* the screen width of the client browser screen width.
|
|
109
|
+
*
|
|
110
|
+
* For instance, you could be using the user-agent or the client-hints.
|
|
111
|
+
* https://caniuse.com/#search=client%20hint
|
|
112
|
+
*/
|
|
113
|
+
initialWidth: PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']),
|
|
114
|
+
/**
|
|
115
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
lgDown: PropTypes.bool,
|
|
119
|
+
/**
|
|
120
|
+
* If `true`, component is hidden on screens this size and above.
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
lgUp: PropTypes.bool,
|
|
124
|
+
/**
|
|
125
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
mdDown: PropTypes.bool,
|
|
129
|
+
/**
|
|
130
|
+
* If `true`, component is hidden on screens this size and above.
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
mdUp: PropTypes.bool,
|
|
134
|
+
/**
|
|
135
|
+
* Hide the given breakpoint(s).
|
|
136
|
+
*/
|
|
137
|
+
only: PropTypes.oneOfType([PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']), PropTypes.arrayOf(PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']).isRequired)]),
|
|
138
|
+
/**
|
|
139
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
smDown: PropTypes.bool,
|
|
143
|
+
/**
|
|
144
|
+
* If `true`, component is hidden on screens this size and above.
|
|
145
|
+
* @default false
|
|
146
|
+
*/
|
|
147
|
+
smUp: PropTypes.bool,
|
|
148
|
+
/**
|
|
149
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
xlDown: PropTypes.bool,
|
|
153
|
+
/**
|
|
154
|
+
* If `true`, component is hidden on screens this size and above.
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
157
|
+
xlUp: PropTypes.bool,
|
|
158
|
+
/**
|
|
159
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
160
|
+
* @default false
|
|
161
|
+
*/
|
|
162
|
+
xsDown: PropTypes.bool,
|
|
163
|
+
/**
|
|
164
|
+
* If `true`, component is hidden on screens this size and above.
|
|
165
|
+
* @default false
|
|
166
|
+
*/
|
|
167
|
+
xsUp: PropTypes.bool
|
|
168
|
+
} : void 0;
|
|
169
|
+
/**
|
|
170
|
+
*
|
|
171
|
+
* Demos:
|
|
172
|
+
*
|
|
173
|
+
* - [Hidden](https://next.mui.com/material-ui/react-hidden/)
|
|
174
|
+
*
|
|
175
|
+
* API:
|
|
176
|
+
*
|
|
177
|
+
* - [PigmentHidden API](https://next.mui.com/material-ui/api/pigment-hidden/)
|
|
178
|
+
*/
|
|
179
|
+
function PigmentHidden({
|
|
180
|
+
implementation = 'js',
|
|
181
|
+
...props
|
|
182
|
+
}) {
|
|
183
|
+
if (implementation === 'js') {
|
|
184
|
+
return /*#__PURE__*/_jsx(HiddenJs, {
|
|
185
|
+
...props
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return /*#__PURE__*/_jsx(HiddenCss, {
|
|
189
|
+
...props
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
process.env.NODE_ENV !== "production" ? PigmentHidden.propTypes /* remove-proptypes */ = {
|
|
193
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
194
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
195
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
196
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
197
|
+
/**
|
|
198
|
+
* The content of the component.
|
|
199
|
+
*/
|
|
200
|
+
children: PropTypes.node,
|
|
201
|
+
/**
|
|
202
|
+
* @ignore
|
|
203
|
+
*/
|
|
204
|
+
className: PropTypes.string,
|
|
205
|
+
/**
|
|
206
|
+
* Specify which implementation to use. 'js' is the default, 'css' works better for
|
|
207
|
+
* server-side rendering.
|
|
208
|
+
* @default 'js'
|
|
209
|
+
*/
|
|
210
|
+
implementation: PropTypes.oneOf(['css', 'js']),
|
|
211
|
+
/**
|
|
212
|
+
* You can use this prop when choosing the `js` implementation with server-side rendering.
|
|
213
|
+
*
|
|
214
|
+
* As `window.innerWidth` is unavailable on the server,
|
|
215
|
+
* we default to rendering an empty component during the first mount.
|
|
216
|
+
* You might want to use a heuristic to approximate
|
|
217
|
+
* the screen width of the client browser screen width.
|
|
218
|
+
*
|
|
219
|
+
* For instance, you could be using the user-agent or the client-hints.
|
|
220
|
+
* https://caniuse.com/#search=client%20hint
|
|
221
|
+
*/
|
|
222
|
+
initialWidth: PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']),
|
|
223
|
+
/**
|
|
224
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
225
|
+
* @default false
|
|
226
|
+
*/
|
|
227
|
+
lgDown: PropTypes.bool,
|
|
228
|
+
/**
|
|
229
|
+
* If `true`, component is hidden on screens this size and above.
|
|
230
|
+
* @default false
|
|
231
|
+
*/
|
|
232
|
+
lgUp: PropTypes.bool,
|
|
233
|
+
/**
|
|
234
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
235
|
+
* @default false
|
|
236
|
+
*/
|
|
237
|
+
mdDown: PropTypes.bool,
|
|
238
|
+
/**
|
|
239
|
+
* If `true`, component is hidden on screens this size and above.
|
|
240
|
+
* @default false
|
|
241
|
+
*/
|
|
242
|
+
mdUp: PropTypes.bool,
|
|
243
|
+
/**
|
|
244
|
+
* Hide the given breakpoint(s).
|
|
245
|
+
*/
|
|
246
|
+
only: PropTypes.oneOfType([PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']), PropTypes.arrayOf(PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']).isRequired)]),
|
|
247
|
+
/**
|
|
248
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
249
|
+
* @default false
|
|
250
|
+
*/
|
|
251
|
+
smDown: PropTypes.bool,
|
|
252
|
+
/**
|
|
253
|
+
* If `true`, component is hidden on screens this size and above.
|
|
254
|
+
* @default false
|
|
255
|
+
*/
|
|
256
|
+
smUp: PropTypes.bool,
|
|
257
|
+
/**
|
|
258
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
259
|
+
* @default false
|
|
260
|
+
*/
|
|
261
|
+
xlDown: PropTypes.bool,
|
|
262
|
+
/**
|
|
263
|
+
* If `true`, component is hidden on screens this size and above.
|
|
264
|
+
* @default false
|
|
265
|
+
*/
|
|
266
|
+
xlUp: PropTypes.bool,
|
|
267
|
+
/**
|
|
268
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
269
|
+
* @default false
|
|
270
|
+
*/
|
|
271
|
+
xsDown: PropTypes.bool,
|
|
272
|
+
/**
|
|
273
|
+
* If `true`, component is hidden on screens this size and above.
|
|
274
|
+
* @default false
|
|
275
|
+
*/
|
|
276
|
+
xsUp: PropTypes.bool
|
|
277
|
+
} : void 0;
|
|
278
|
+
export default PigmentHidden;
|
|
@@ -0,0 +1,51 @@
|
|
|
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 interface PigmentStackOwnProps {
|
|
9
|
+
/**
|
|
10
|
+
* The content of the component.
|
|
11
|
+
*/
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Defines the `flex-direction` style property.
|
|
15
|
+
* It is applied for all screen sizes.
|
|
16
|
+
* @default 'column'
|
|
17
|
+
*/
|
|
18
|
+
direction?: ResponsiveStyleValue<'row' | 'row-reverse' | 'column' | 'column-reverse'>;
|
|
19
|
+
/**
|
|
20
|
+
* Defines the space between immediate children.
|
|
21
|
+
* @default 0
|
|
22
|
+
*/
|
|
23
|
+
spacing?: ResponsiveStyleValue<number | string>;
|
|
24
|
+
/**
|
|
25
|
+
* Add an element between each child.
|
|
26
|
+
*/
|
|
27
|
+
divider?: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* The system prop, which allows defining system overrides as well as additional CSS styles.
|
|
30
|
+
*/
|
|
31
|
+
sx?: SxProps<Theme>;
|
|
32
|
+
}
|
|
33
|
+
export interface PigmentStackTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'div'> {
|
|
34
|
+
props: AdditionalProps & PigmentStackOwnProps;
|
|
35
|
+
defaultComponent: RootComponent;
|
|
36
|
+
}
|
|
37
|
+
export type PigmentStackProps<RootComponent extends React.ElementType = PigmentStackTypeMap['defaultComponent'], AdditionalProps = {}> = OverrideProps<PigmentStackTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|
|
38
|
+
component?: React.ElementType;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* Demos:
|
|
43
|
+
*
|
|
44
|
+
* - [Stack](https://next.mui.com/material-ui/react-stack/)
|
|
45
|
+
*
|
|
46
|
+
* API:
|
|
47
|
+
*
|
|
48
|
+
* - [PigmentStack API](https://next.mui.com/material-ui/api/pigment-stack/)
|
|
49
|
+
*/
|
|
50
|
+
declare const PigmentStack: OverridableComponent<PigmentStackTypeMap<{}, "div">>;
|
|
51
|
+
export default PigmentStack;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import Stack from '@pigment-css/react/Stack';
|
|
6
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const useUtilityClasses = () => {
|
|
10
|
+
const slots = {
|
|
11
|
+
root: ['root']
|
|
12
|
+
};
|
|
13
|
+
return composeClasses(slots, slot => generateUtilityClass('MuiStack', slot), {});
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* Demos:
|
|
18
|
+
*
|
|
19
|
+
* - [Stack](https://next.mui.com/material-ui/react-stack/)
|
|
20
|
+
*
|
|
21
|
+
* API:
|
|
22
|
+
*
|
|
23
|
+
* - [PigmentStack API](https://next.mui.com/material-ui/api/pigment-stack/)
|
|
24
|
+
*/
|
|
25
|
+
const PigmentStack = /*#__PURE__*/React.forwardRef(function PigmentStack({
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}, ref) {
|
|
29
|
+
const classes = useUtilityClasses();
|
|
30
|
+
return /*#__PURE__*/_jsx(Stack, {
|
|
31
|
+
ref: ref,
|
|
32
|
+
className: clsx(classes.root, className),
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
process.env.NODE_ENV !== "production" ? PigmentStack.propTypes /* remove-proptypes */ = {
|
|
37
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
38
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
39
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
40
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
41
|
+
/**
|
|
42
|
+
* The content of the component.
|
|
43
|
+
*/
|
|
44
|
+
children: PropTypes.node,
|
|
45
|
+
/**
|
|
46
|
+
* @ignore
|
|
47
|
+
*/
|
|
48
|
+
className: PropTypes.string,
|
|
49
|
+
/**
|
|
50
|
+
* Defines the `flex-direction` style property.
|
|
51
|
+
* It is applied for all screen sizes.
|
|
52
|
+
* @default 'column'
|
|
53
|
+
*/
|
|
54
|
+
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.shape({
|
|
55
|
+
lg: PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']),
|
|
56
|
+
md: PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']),
|
|
57
|
+
sm: PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']),
|
|
58
|
+
xl: PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']),
|
|
59
|
+
xs: PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])
|
|
60
|
+
})]),
|
|
61
|
+
/**
|
|
62
|
+
* Add an element between each child.
|
|
63
|
+
*/
|
|
64
|
+
divider: PropTypes.node,
|
|
65
|
+
/**
|
|
66
|
+
* Defines the space between immediate children.
|
|
67
|
+
* @default 0
|
|
68
|
+
*/
|
|
69
|
+
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.shape({
|
|
70
|
+
lg: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
71
|
+
md: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
72
|
+
sm: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
73
|
+
xl: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
74
|
+
xs: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
75
|
+
}), PropTypes.string]),
|
|
76
|
+
/**
|
|
77
|
+
* The system prop, which allows defining system overrides as well as additional CSS styles.
|
|
78
|
+
*/
|
|
79
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
80
|
+
} : void 0;
|
|
81
|
+
export default PigmentStack;
|
package/index.js
CHANGED
package/modern/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,
|