@mui/material 6.0.0-alpha.12 → 6.0.0-alpha.14
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/Alert/Alert.d.ts +12 -3
- package/ButtonBase/ButtonBase.js +4 -12
- package/CHANGELOG.md +91 -0
- package/Dialog/Dialog.js +2 -1
- package/Hidden/hiddenCssClasses.d.ts +3 -0
- package/Link/Link.js +4 -14
- 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/Rating/Rating.js +5 -12
- package/Tooltip/Tooltip.js +4 -14
- package/index.js +1 -1
- package/modern/ButtonBase/ButtonBase.js +4 -12
- package/modern/Dialog/Dialog.js +2 -1
- package/modern/Link/Link.js +4 -14
- 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/Rating/Rating.js +5 -12
- package/modern/Tooltip/Tooltip.js +4 -14
- package/modern/index.js +1 -1
- package/modern/utils/index.js +0 -1
- package/node/ButtonBase/ButtonBase.js +4 -12
- package/node/Dialog/Dialog.js +2 -1
- package/node/Link/Link.js +4 -14
- 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/Rating/Rating.js +4 -11
- package/node/Tooltip/Tooltip.js +4 -14
- package/node/index.js +1 -1
- package/node/utils/index.js +0 -7
- package/package.json +10 -6
- package/styles/responsiveFontSizes.d.ts +3 -4
- package/utils/index.d.ts +0 -1
- package/utils/index.js +0 -1
- package/modern/utils/useIsFocusVisible.js +0 -4
- package/node/utils/useIsFocusVisible.js +0 -10
- package/utils/useIsFocusVisible.d.ts +0 -3
- package/utils/useIsFocusVisible.js +0 -4
package/Rating/Rating.js
CHANGED
|
@@ -8,7 +8,8 @@ import visuallyHidden from '@mui/utils/visuallyHidden';
|
|
|
8
8
|
import chainPropTypes from '@mui/utils/chainPropTypes';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
11
|
-
import
|
|
11
|
+
import isFocusVisible from '@mui/utils/isFocusVisible';
|
|
12
|
+
import { capitalize, useForkRef, useControlled, unstable_useId as useId } from '../utils';
|
|
12
13
|
import Star from '../internal/svg-icons/Star';
|
|
13
14
|
import StarBorder from '../internal/svg-icons/StarBorder';
|
|
14
15
|
import { styled } from '../zero-styled';
|
|
@@ -353,15 +354,9 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
353
354
|
if (focus !== -1) {
|
|
354
355
|
value = focus;
|
|
355
356
|
}
|
|
356
|
-
const {
|
|
357
|
-
isFocusVisibleRef,
|
|
358
|
-
onBlur: handleBlurVisible,
|
|
359
|
-
onFocus: handleFocusVisible,
|
|
360
|
-
ref: focusVisibleRef
|
|
361
|
-
} = useIsFocusVisible();
|
|
362
357
|
const [focusVisible, setFocusVisible] = React.useState(false);
|
|
363
358
|
const rootRef = React.useRef();
|
|
364
|
-
const handleRef = useForkRef(
|
|
359
|
+
const handleRef = useForkRef(rootRef, ref);
|
|
365
360
|
const handleMouseMove = event => {
|
|
366
361
|
if (onMouseMove) {
|
|
367
362
|
onMouseMove(event);
|
|
@@ -431,8 +426,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
431
426
|
}
|
|
432
427
|
};
|
|
433
428
|
const handleFocus = event => {
|
|
434
|
-
|
|
435
|
-
if (isFocusVisibleRef.current === true) {
|
|
429
|
+
if (isFocusVisible(event.target)) {
|
|
436
430
|
setFocusVisible(true);
|
|
437
431
|
}
|
|
438
432
|
const newFocus = parseFloat(event.target.value);
|
|
@@ -445,8 +439,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
445
439
|
if (hover !== -1) {
|
|
446
440
|
return;
|
|
447
441
|
}
|
|
448
|
-
|
|
449
|
-
if (isFocusVisibleRef.current === false) {
|
|
442
|
+
if (!isFocusVisible(event.target)) {
|
|
450
443
|
setFocusVisible(false);
|
|
451
444
|
}
|
|
452
445
|
const newFocus = -1;
|
package/Tooltip/Tooltip.js
CHANGED
|
@@ -9,6 +9,7 @@ import { appendOwnerState } from '@mui/base/utils';
|
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import { alpha } from '@mui/system/colorManipulator';
|
|
11
11
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
12
|
+
import isFocusVisible from '@mui/utils/isFocusVisible';
|
|
12
13
|
import { styled, useTheme } from '../zero-styled';
|
|
13
14
|
import { useDefaultProps } from '../DefaultPropsProvider';
|
|
14
15
|
import capitalize from '../utils/capitalize';
|
|
@@ -17,7 +18,6 @@ import Popper from '../Popper';
|
|
|
17
18
|
import useEventCallback from '../utils/useEventCallback';
|
|
18
19
|
import useForkRef from '../utils/useForkRef';
|
|
19
20
|
import useId from '../utils/useId';
|
|
20
|
-
import useIsFocusVisible from '../utils/useIsFocusVisible';
|
|
21
21
|
import useControlled from '../utils/useControlled';
|
|
22
22
|
import tooltipClasses, { getTooltipUtilityClass } from './tooltipClasses';
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -444,18 +444,9 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
444
444
|
handleClose(event);
|
|
445
445
|
});
|
|
446
446
|
};
|
|
447
|
-
const {
|
|
448
|
-
isFocusVisibleRef,
|
|
449
|
-
onBlur: handleBlurVisible,
|
|
450
|
-
onFocus: handleFocusVisible,
|
|
451
|
-
ref: focusVisibleRef
|
|
452
|
-
} = useIsFocusVisible();
|
|
453
|
-
// We don't necessarily care about the focusVisible state (which is safe to access via ref anyway).
|
|
454
|
-
// We just need to re-render the Tooltip if the focus-visible state changes.
|
|
455
447
|
const [, setChildIsFocusVisible] = React.useState(false);
|
|
456
448
|
const handleBlur = event => {
|
|
457
|
-
|
|
458
|
-
if (isFocusVisibleRef.current === false) {
|
|
449
|
+
if (!isFocusVisible(event.target)) {
|
|
459
450
|
setChildIsFocusVisible(false);
|
|
460
451
|
handleMouseLeave(event);
|
|
461
452
|
}
|
|
@@ -467,8 +458,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
467
458
|
if (!childNode) {
|
|
468
459
|
setChildNode(event.currentTarget);
|
|
469
460
|
}
|
|
470
|
-
|
|
471
|
-
if (isFocusVisibleRef.current === true) {
|
|
461
|
+
if (isFocusVisible(event.target)) {
|
|
472
462
|
setChildIsFocusVisible(true);
|
|
473
463
|
handleMouseOver(event);
|
|
474
464
|
}
|
|
@@ -520,7 +510,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
520
510
|
document.removeEventListener('keydown', handleKeyDown);
|
|
521
511
|
};
|
|
522
512
|
}, [handleClose, open]);
|
|
523
|
-
const handleRef = useForkRef(children.ref,
|
|
513
|
+
const handleRef = useForkRef(children.ref, setChildNode, ref);
|
|
524
514
|
|
|
525
515
|
// There is no point in displaying an empty tooltip.
|
|
526
516
|
// So we exclude all falsy values, except 0, which is valid.
|
package/index.js
CHANGED
|
@@ -6,11 +6,11 @@ import clsx from 'clsx';
|
|
|
6
6
|
import refType from '@mui/utils/refType';
|
|
7
7
|
import elementTypeAcceptingRef from '@mui/utils/elementTypeAcceptingRef';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
+
import isFocusVisible from '@mui/utils/isFocusVisible';
|
|
9
10
|
import { styled } from '../zero-styled';
|
|
10
11
|
import { useDefaultProps } from '../DefaultPropsProvider';
|
|
11
12
|
import useForkRef from '../utils/useForkRef';
|
|
12
13
|
import useEventCallback from '../utils/useEventCallback';
|
|
13
|
-
import useIsFocusVisible from '../utils/useIsFocusVisible';
|
|
14
14
|
import TouchRipple from './TouchRipple';
|
|
15
15
|
import buttonBaseClasses, { getButtonBaseUtilityClass } from './buttonBaseClasses';
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -119,12 +119,6 @@ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(inProps, re
|
|
|
119
119
|
const buttonRef = React.useRef(null);
|
|
120
120
|
const rippleRef = React.useRef(null);
|
|
121
121
|
const handleRippleRef = useForkRef(rippleRef, touchRippleRef);
|
|
122
|
-
const {
|
|
123
|
-
isFocusVisibleRef,
|
|
124
|
-
onFocus: handleFocusVisible,
|
|
125
|
-
onBlur: handleBlurVisible,
|
|
126
|
-
ref: focusVisibleRef
|
|
127
|
-
} = useIsFocusVisible();
|
|
128
122
|
const [focusVisible, setFocusVisible] = React.useState(false);
|
|
129
123
|
if (disabled && focusVisible) {
|
|
130
124
|
setFocusVisible(false);
|
|
@@ -173,8 +167,7 @@ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(inProps, re
|
|
|
173
167
|
const handleTouchEnd = useRippleHandler('stop', onTouchEnd);
|
|
174
168
|
const handleTouchMove = useRippleHandler('stop', onTouchMove);
|
|
175
169
|
const handleBlur = useRippleHandler('stop', event => {
|
|
176
|
-
|
|
177
|
-
if (isFocusVisibleRef.current === false) {
|
|
170
|
+
if (!isFocusVisible(event.target)) {
|
|
178
171
|
setFocusVisible(false);
|
|
179
172
|
}
|
|
180
173
|
if (onBlur) {
|
|
@@ -186,8 +179,7 @@ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(inProps, re
|
|
|
186
179
|
if (!buttonRef.current) {
|
|
187
180
|
buttonRef.current = event.currentTarget;
|
|
188
181
|
}
|
|
189
|
-
|
|
190
|
-
if (isFocusVisibleRef.current === true) {
|
|
182
|
+
if (isFocusVisible(event.target)) {
|
|
191
183
|
setFocusVisible(true);
|
|
192
184
|
if (onFocusVisible) {
|
|
193
185
|
onFocusVisible(event);
|
|
@@ -256,7 +248,7 @@ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(inProps, re
|
|
|
256
248
|
buttonProps['aria-disabled'] = disabled;
|
|
257
249
|
}
|
|
258
250
|
}
|
|
259
|
-
const handleRef = useForkRef(ref,
|
|
251
|
+
const handleRef = useForkRef(ref, buttonRef);
|
|
260
252
|
if (process.env.NODE_ENV !== 'production') {
|
|
261
253
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
262
254
|
React.useEffect(() => {
|
package/modern/Dialog/Dialog.js
CHANGED
package/modern/Link/Link.js
CHANGED
|
@@ -6,11 +6,10 @@ import clsx from 'clsx';
|
|
|
6
6
|
import { alpha } from '@mui/system/colorManipulator';
|
|
7
7
|
import elementTypeAcceptingRef from '@mui/utils/elementTypeAcceptingRef';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
+
import isFocusVisible from '@mui/utils/isFocusVisible';
|
|
9
10
|
import capitalize from '../utils/capitalize';
|
|
10
11
|
import { styled, useTheme } from '../zero-styled';
|
|
11
12
|
import { useDefaultProps } from '../DefaultPropsProvider';
|
|
12
|
-
import useIsFocusVisible from '../utils/useIsFocusVisible';
|
|
13
|
-
import useForkRef from '../utils/useForkRef';
|
|
14
13
|
import Typography from '../Typography';
|
|
15
14
|
import linkClasses, { getLinkUtilityClass } from './linkClasses';
|
|
16
15
|
import getTextDecoration, { colorTransformations } from './getTextDecoration';
|
|
@@ -135,17 +134,9 @@ const Link = /*#__PURE__*/React.forwardRef(function Link(inProps, ref) {
|
|
|
135
134
|
sx,
|
|
136
135
|
...other
|
|
137
136
|
} = props;
|
|
138
|
-
const {
|
|
139
|
-
isFocusVisibleRef,
|
|
140
|
-
onBlur: handleBlurVisible,
|
|
141
|
-
onFocus: handleFocusVisible,
|
|
142
|
-
ref: focusVisibleRef
|
|
143
|
-
} = useIsFocusVisible();
|
|
144
137
|
const [focusVisible, setFocusVisible] = React.useState(false);
|
|
145
|
-
const handlerRef = useForkRef(ref, focusVisibleRef);
|
|
146
138
|
const handleBlur = event => {
|
|
147
|
-
|
|
148
|
-
if (isFocusVisibleRef.current === false) {
|
|
139
|
+
if (!isFocusVisible(event.target)) {
|
|
149
140
|
setFocusVisible(false);
|
|
150
141
|
}
|
|
151
142
|
if (onBlur) {
|
|
@@ -153,8 +144,7 @@ const Link = /*#__PURE__*/React.forwardRef(function Link(inProps, ref) {
|
|
|
153
144
|
}
|
|
154
145
|
};
|
|
155
146
|
const handleFocus = event => {
|
|
156
|
-
|
|
157
|
-
if (isFocusVisibleRef.current === true) {
|
|
147
|
+
if (isFocusVisible(event.target)) {
|
|
158
148
|
setFocusVisible(true);
|
|
159
149
|
}
|
|
160
150
|
if (onFocus) {
|
|
@@ -177,7 +167,7 @@ const Link = /*#__PURE__*/React.forwardRef(function Link(inProps, ref) {
|
|
|
177
167
|
component: component,
|
|
178
168
|
onBlur: handleBlur,
|
|
179
169
|
onFocus: handleFocus,
|
|
180
|
-
ref:
|
|
170
|
+
ref: ref,
|
|
181
171
|
ownerState: ownerState,
|
|
182
172
|
variant: variant,
|
|
183
173
|
...other,
|
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,
|
|
@@ -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,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;
|