@vention/machine-ui 6.4.2 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js
CHANGED
|
@@ -7021,12 +7021,14 @@ const getColors$3 = (color, variant, theme) => {
|
|
|
7021
7021
|
return counterStyleMap[color][variant](theme);
|
|
7022
7022
|
};
|
|
7023
7023
|
|
|
7024
|
+
const DEFAULT_MODAL_MAX_HEIGHT = "calc(100dvh - 96px)";
|
|
7024
7025
|
const VentionModalBase = props => {
|
|
7025
7026
|
const {
|
|
7026
7027
|
modalSize = "medium",
|
|
7027
7028
|
isTouchDevice = false,
|
|
7028
7029
|
backDropClickClosable = true,
|
|
7029
7030
|
width,
|
|
7031
|
+
maxHeight = DEFAULT_MODAL_MAX_HEIGHT,
|
|
7030
7032
|
dataTestId
|
|
7031
7033
|
} = props;
|
|
7032
7034
|
const {
|
|
@@ -7035,7 +7037,8 @@ const VentionModalBase = props => {
|
|
|
7035
7037
|
} = useStyles$C({
|
|
7036
7038
|
modalSize,
|
|
7037
7039
|
isTouchDevice,
|
|
7038
|
-
width
|
|
7040
|
+
width,
|
|
7041
|
+
maxHeight
|
|
7039
7042
|
});
|
|
7040
7043
|
const handleClose = (event, reason) => {
|
|
7041
7044
|
if (!backDropClickClosable && reason === "backdropClick") {
|
|
@@ -7114,6 +7117,7 @@ const useStyles$C = tss.withParams().create(({
|
|
|
7114
7117
|
modalSize,
|
|
7115
7118
|
isTouchDevice,
|
|
7116
7119
|
width,
|
|
7120
|
+
maxHeight,
|
|
7117
7121
|
theme
|
|
7118
7122
|
}) => {
|
|
7119
7123
|
const modalStyle = getModalStyle(modalSize, width);
|
|
@@ -7132,6 +7136,8 @@ const useStyles$C = tss.withParams().create(({
|
|
|
7132
7136
|
display: "flex",
|
|
7133
7137
|
flexDirection: "column",
|
|
7134
7138
|
width: modalStyle.width,
|
|
7139
|
+
maxHeight,
|
|
7140
|
+
overflowY: "auto",
|
|
7135
7141
|
backgroundColor: theme.palette.background.paper,
|
|
7136
7142
|
padding: isTouchDevice ? theme.spacing(9, 8, 8, 8) : theme.spacing(8, 7, 7, 7),
|
|
7137
7143
|
borderRadius: 8,
|
|
@@ -7204,6 +7210,7 @@ const VentionModal = props => {
|
|
|
7204
7210
|
isTouchDevice: isTouchDevice,
|
|
7205
7211
|
backDropClickClosable: backDropClickClosable,
|
|
7206
7212
|
width: props.width,
|
|
7213
|
+
maxHeight: props.maxHeight,
|
|
7207
7214
|
dataTestId: (_b = (_a = props.dataTestIds) === null || _a === void 0 ? void 0 : _a.modal) !== null && _b !== void 0 ? _b : ventionModalTestIds.container,
|
|
7208
7215
|
children: jsxs(Box$1, {
|
|
7209
7216
|
className: classes.modalContent,
|
|
@@ -7230,6 +7237,7 @@ const VentionModal = props => {
|
|
|
7230
7237
|
}), jsx(Typography, {
|
|
7231
7238
|
className: classes.bodyText,
|
|
7232
7239
|
variant: getBodyTextTypography(modalSize, isTouchDevice),
|
|
7240
|
+
"data-testid": ventionModalTestIds.body,
|
|
7233
7241
|
children: props.body
|
|
7234
7242
|
}), jsxs(Box$1, {
|
|
7235
7243
|
className: classes.modalActions,
|
|
@@ -7277,7 +7285,8 @@ const useStyles$B = tss.withParams().create(({
|
|
|
7277
7285
|
modalContent: {
|
|
7278
7286
|
display: "flex",
|
|
7279
7287
|
flexDirection: "column",
|
|
7280
|
-
alignItems: ALIGN_ITEMS[textAlign]
|
|
7288
|
+
alignItems: ALIGN_ITEMS[textAlign],
|
|
7289
|
+
minHeight: 0
|
|
7281
7290
|
},
|
|
7282
7291
|
statusGlow: {
|
|
7283
7292
|
width: status.glowSize,
|
|
@@ -7314,6 +7323,10 @@ const useStyles$B = tss.withParams().create(({
|
|
|
7314
7323
|
bodyText: {
|
|
7315
7324
|
textAlign,
|
|
7316
7325
|
width: "100%",
|
|
7326
|
+
overflowY: "auto",
|
|
7327
|
+
scrollbarWidth: "thin",
|
|
7328
|
+
scrollbarColor: `${theme.palette.border.subtleSlate} transparent`,
|
|
7329
|
+
scrollbarGutter: "stable both-edges",
|
|
7317
7330
|
marginBottom: isTouchDevice || modalSize === "xx-large" ? theme.spacing(9) : theme.spacing(5)
|
|
7318
7331
|
}
|
|
7319
7332
|
};
|
|
@@ -7385,7 +7398,8 @@ const ventionModalTestIds = {
|
|
|
7385
7398
|
loadingIcon: "vention-modal-loading-icon",
|
|
7386
7399
|
warningIcon: "vention-modal-warning-icon",
|
|
7387
7400
|
negativeIcon: "vention-modal-negative-icon",
|
|
7388
|
-
modalActions: "vention-modal-actions"
|
|
7401
|
+
modalActions: "vention-modal-actions",
|
|
7402
|
+
body: "vention-modal-body"
|
|
7389
7403
|
};
|
|
7390
7404
|
|
|
7391
7405
|
const defaultProps$5 = {
|
package/package.json
CHANGED
|
@@ -44,6 +44,12 @@ export interface VentionModalProps {
|
|
|
44
44
|
* If nothing is provided, {@link modalSize} will drive the width.
|
|
45
45
|
*/
|
|
46
46
|
width?: VentionModalBaseProps["width"];
|
|
47
|
+
/**
|
|
48
|
+
* Default max height is calc(100dvh - 96px), so 48px from the top and bottom of the screen.
|
|
49
|
+
* The modal grows until it reaches this size, then the body content begins to scroll,
|
|
50
|
+
* leaving the title and buttons always visible.
|
|
51
|
+
*/
|
|
52
|
+
maxHeight?: VentionModalBaseProps["maxHeight"];
|
|
47
53
|
}
|
|
48
54
|
export declare const VentionModal: (props: VentionModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
49
55
|
export declare const ventionModalTestIds: {
|
|
@@ -54,4 +60,5 @@ export declare const ventionModalTestIds: {
|
|
|
54
60
|
warningIcon: string;
|
|
55
61
|
negativeIcon: string;
|
|
56
62
|
modalActions: string;
|
|
63
|
+
body: string;
|
|
57
64
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Sizes, StrictExtract } from "../../theme/machine-ui-theme";
|
|
2
|
+
import { Property } from "csstype";
|
|
2
3
|
export type ModalSize = StrictExtract<Sizes, "small" | "medium" | "large" | "x-large" | "xx-large" | "dynamic">;
|
|
3
4
|
export interface VentionModalBaseProps {
|
|
4
5
|
modalSize?: ModalSize;
|
|
@@ -13,6 +14,12 @@ export interface VentionModalBaseProps {
|
|
|
13
14
|
* If nothing is provided, {@link modalSize} will drive the width.
|
|
14
15
|
*/
|
|
15
16
|
width?: `${number}px` | `${number}%`;
|
|
17
|
+
/**
|
|
18
|
+
* Default max height is calc(100dvh - 96px), so 48px from the top and bottom of the screen.
|
|
19
|
+
* The modal grows until it reaches this size, then the body content beings to scroll,
|
|
20
|
+
* leaving the title and buttons always visible.
|
|
21
|
+
*/
|
|
22
|
+
maxHeight?: Property.MaxHeight;
|
|
16
23
|
}
|
|
17
24
|
export declare const VentionModalBase: (props: VentionModalBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
25
|
export declare const ventionModalBaseTestIds: {
|