@vention/machine-ui 4.2.0 → 4.2.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.
package/index.esm.js
CHANGED
|
@@ -4029,7 +4029,8 @@ const VentionModalBase = props => {
|
|
|
4029
4029
|
modalSize = "medium",
|
|
4030
4030
|
isTouchDevice = false,
|
|
4031
4031
|
backDropClickClosable = true,
|
|
4032
|
-
width
|
|
4032
|
+
width,
|
|
4033
|
+
dataTestId
|
|
4033
4034
|
} = props;
|
|
4034
4035
|
const {
|
|
4035
4036
|
classes,
|
|
@@ -4070,7 +4071,7 @@ const VentionModalBase = props => {
|
|
|
4070
4071
|
className: classes.modal,
|
|
4071
4072
|
children: /*#__PURE__*/jsxs("div", {
|
|
4072
4073
|
className: classes.modalContainer,
|
|
4073
|
-
"data-testid": ventionModalBaseTestIds.modalContainer,
|
|
4074
|
+
"data-testid": dataTestId != null ? dataTestId : ventionModalBaseTestIds.modalContainer,
|
|
4074
4075
|
children: [/*#__PURE__*/jsx("div", {
|
|
4075
4076
|
className: classes.closeIconButton,
|
|
4076
4077
|
onClick: props.onClose,
|
|
@@ -4169,6 +4170,7 @@ const ventionModalBaseTestIds = {
|
|
|
4169
4170
|
};
|
|
4170
4171
|
|
|
4171
4172
|
const VentionModal = props => {
|
|
4173
|
+
var _props$dataTestIds$mo, _props$dataTestIds, _props$dataTestIds$fo, _props$dataTestIds2;
|
|
4172
4174
|
const {
|
|
4173
4175
|
modalSize = "medium",
|
|
4174
4176
|
isTouchDevice = false,
|
|
@@ -4204,6 +4206,7 @@ const VentionModal = props => {
|
|
|
4204
4206
|
isTouchDevice: isTouchDevice,
|
|
4205
4207
|
backDropClickClosable: backDropClickClosable,
|
|
4206
4208
|
width: props.width,
|
|
4209
|
+
dataTestId: (_props$dataTestIds$mo = (_props$dataTestIds = props.dataTestIds) == null ? void 0 : _props$dataTestIds.modal) != null ? _props$dataTestIds$mo : ventionModalTestIds.container,
|
|
4207
4210
|
children: /*#__PURE__*/jsxs(Box$1, {
|
|
4208
4211
|
className: classes.modalContent,
|
|
4209
4212
|
children: [props.type !== "none" && /*#__PURE__*/jsx(Box$1, {
|
|
@@ -4232,7 +4235,7 @@ const VentionModal = props => {
|
|
|
4232
4235
|
children: props.body
|
|
4233
4236
|
}), /*#__PURE__*/jsxs(Box$1, {
|
|
4234
4237
|
className: classes.modalActions,
|
|
4235
|
-
"data-testid": ventionModalTestIds.modalActions,
|
|
4238
|
+
"data-testid": (_props$dataTestIds$fo = (_props$dataTestIds2 = props.dataTestIds) == null ? void 0 : _props$dataTestIds2.footer) != null ? _props$dataTestIds$fo : ventionModalTestIds.modalActions,
|
|
4236
4239
|
children: [props.secondaryButton && /*#__PURE__*/jsx(VentionButton, {
|
|
4237
4240
|
size: buttonSize,
|
|
4238
4241
|
"data-testid": props.secondaryButton.dataTestId,
|
|
@@ -4378,6 +4381,7 @@ const getBodyTextTypography = (modalSize, isTouchDevice) => {
|
|
|
4378
4381
|
return "paragraph14Regular";
|
|
4379
4382
|
};
|
|
4380
4383
|
const ventionModalTestIds = {
|
|
4384
|
+
container: "vention-modal",
|
|
4381
4385
|
positiveIcon: "vention-modal-positive-icon",
|
|
4382
4386
|
infoIcon: "vention-modal-info-icon",
|
|
4383
4387
|
loadingIcon: "vention-modal-loading-icon",
|
|
@@ -12180,6 +12184,15 @@ function getDropZoneStatus(type, hasErrorMessages) {
|
|
|
12180
12184
|
}
|
|
12181
12185
|
}
|
|
12182
12186
|
|
|
12187
|
+
const VentionDropZoneTestIds = {
|
|
12188
|
+
container: "dropzoneContainer",
|
|
12189
|
+
contents: "dropzoneContents",
|
|
12190
|
+
uploadIcon: "dropzoneUploadIcon",
|
|
12191
|
+
title: "dropzoneTitle",
|
|
12192
|
+
criteria: "dropzoneCriteria",
|
|
12193
|
+
errors: "dropzoneErrors",
|
|
12194
|
+
fileInput: "dropzoneFileInput"
|
|
12195
|
+
};
|
|
12183
12196
|
const UPLOAD_TITLE = "Drop to start uploading";
|
|
12184
12197
|
|
|
12185
12198
|
/**
|
|
@@ -12194,8 +12207,10 @@ function VentionDropZone({
|
|
|
12194
12207
|
onFilesSelect,
|
|
12195
12208
|
fileCriteriaDescription,
|
|
12196
12209
|
defaultTitle = "Drop files here or click to upload",
|
|
12197
|
-
disabled = false
|
|
12210
|
+
disabled = false,
|
|
12211
|
+
dataTestIds
|
|
12198
12212
|
}) {
|
|
12213
|
+
var _dataTestIds$containe, _dataTestIds$contents, _dataTestIds$uploadIc, _dataTestIds$title, _dataTestIds$criteria, _dataTestIds$errors, _dataTestIds$fileInpu;
|
|
12199
12214
|
const [state, dispatch] = useReducer(dropZoneReducer, {
|
|
12200
12215
|
dropZoneStatus: DropZoneState.Default,
|
|
12201
12216
|
title: defaultTitle,
|
|
@@ -12287,16 +12302,16 @@ function VentionDropZone({
|
|
|
12287
12302
|
onDragLeave: handleDragLeave,
|
|
12288
12303
|
onDrop: handleDrop,
|
|
12289
12304
|
className: classes.dropZoneContainer,
|
|
12290
|
-
"data-testid":
|
|
12305
|
+
"data-testid": (_dataTestIds$containe = dataTestIds == null ? void 0 : dataTestIds.container) != null ? _dataTestIds$containe : VentionDropZoneTestIds.container,
|
|
12291
12306
|
children: /*#__PURE__*/jsxs(Grid, {
|
|
12292
|
-
"data-testid":
|
|
12307
|
+
"data-testid": (_dataTestIds$contents = dataTestIds == null ? void 0 : dataTestIds.contents) != null ? _dataTestIds$contents : VentionDropZoneTestIds.contents,
|
|
12293
12308
|
container: true,
|
|
12294
12309
|
className: classes.dropZoneContents,
|
|
12295
12310
|
children: [/*#__PURE__*/jsx(Grid, {
|
|
12296
12311
|
item: true,
|
|
12297
12312
|
className: classes.dropZoneUploadIcon,
|
|
12298
12313
|
children: /*#__PURE__*/jsx(VentionIcon, {
|
|
12299
|
-
dataTestId:
|
|
12314
|
+
dataTestId: (_dataTestIds$uploadIc = dataTestIds == null ? void 0 : dataTestIds.uploadIcon) != null ? _dataTestIds$uploadIc : VentionDropZoneTestIds.uploadIcon,
|
|
12300
12315
|
type: "circle-arrow-up",
|
|
12301
12316
|
size: getDropZoneStyle(size, "iconSize")
|
|
12302
12317
|
})
|
|
@@ -12304,16 +12319,16 @@ function VentionDropZone({
|
|
|
12304
12319
|
item: true,
|
|
12305
12320
|
className: classes.dropZoneTexts,
|
|
12306
12321
|
children: [/*#__PURE__*/jsx("div", {
|
|
12307
|
-
"data-testid":
|
|
12322
|
+
"data-testid": (_dataTestIds$title = dataTestIds == null ? void 0 : dataTestIds.title) != null ? _dataTestIds$title : VentionDropZoneTestIds.title,
|
|
12308
12323
|
className: classes.dropTitle,
|
|
12309
12324
|
children: state.title
|
|
12310
12325
|
}), state.dropZoneStatus !== DropZoneState.DraggedOver && /*#__PURE__*/jsxs(Fragment, {
|
|
12311
12326
|
children: [/*#__PURE__*/jsx("div", {
|
|
12312
|
-
"data-testid":
|
|
12327
|
+
"data-testid": (_dataTestIds$criteria = dataTestIds == null ? void 0 : dataTestIds.criteria) != null ? _dataTestIds$criteria : VentionDropZoneTestIds.criteria,
|
|
12313
12328
|
className: classes.criteriaDescription,
|
|
12314
12329
|
children: fileCriteriaDescription
|
|
12315
12330
|
}), /*#__PURE__*/jsx("div", {
|
|
12316
|
-
"data-testid":
|
|
12331
|
+
"data-testid": (_dataTestIds$errors = dataTestIds == null ? void 0 : dataTestIds.errors) != null ? _dataTestIds$errors : VentionDropZoneTestIds.errors,
|
|
12317
12332
|
children: state.errorMessages.map(error => {
|
|
12318
12333
|
return /*#__PURE__*/jsxs("div", {
|
|
12319
12334
|
className: classes.errorMessage,
|
|
@@ -12324,7 +12339,7 @@ function VentionDropZone({
|
|
|
12324
12339
|
})]
|
|
12325
12340
|
}), /*#__PURE__*/jsx("input", {
|
|
12326
12341
|
onChange: handleFileInputChange,
|
|
12327
|
-
"data-testid":
|
|
12342
|
+
"data-testid": (_dataTestIds$fileInpu = dataTestIds == null ? void 0 : dataTestIds.fileInput) != null ? _dataTestIds$fileInpu : VentionDropZoneTestIds.fileInput,
|
|
12328
12343
|
disabled: disabled,
|
|
12329
12344
|
"aria-label": "File upload",
|
|
12330
12345
|
type: "file",
|
package/package.json
CHANGED
|
@@ -15,6 +15,16 @@ export type DropZoneProps = {
|
|
|
15
15
|
fileCriteriaDescription: string;
|
|
16
16
|
defaultTitle?: string;
|
|
17
17
|
disabled?: boolean;
|
|
18
|
+
dataTestIds?: Partial<Record<keyof typeof VentionDropZoneTestIds, string>>;
|
|
19
|
+
};
|
|
20
|
+
declare const VentionDropZoneTestIds: {
|
|
21
|
+
readonly container: "dropzoneContainer";
|
|
22
|
+
readonly contents: "dropzoneContents";
|
|
23
|
+
readonly uploadIcon: "dropzoneUploadIcon";
|
|
24
|
+
readonly title: "dropzoneTitle";
|
|
25
|
+
readonly criteria: "dropzoneCriteria";
|
|
26
|
+
readonly errors: "dropzoneErrors";
|
|
27
|
+
readonly fileInput: "dropzoneFileInput";
|
|
18
28
|
};
|
|
19
29
|
/**
|
|
20
30
|
* Vention's custom dropzone component. Supports drag and drop as well as
|
|
@@ -22,4 +32,5 @@ export type DropZoneProps = {
|
|
|
22
32
|
* Use onFilesSelect callback to handle file selection and validation.
|
|
23
33
|
* Visualizes basic error state along with error messages returned by onFilesSelect.
|
|
24
34
|
*/
|
|
25
|
-
export declare function VentionDropZone({ style, size, onFilesSelect, fileCriteriaDescription, defaultTitle, disabled, }: DropZoneProps): JSX.Element;
|
|
35
|
+
export declare function VentionDropZone({ style, size, onFilesSelect, fileCriteriaDescription, defaultTitle, disabled, dataTestIds, }: DropZoneProps): JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -31,6 +31,10 @@ export interface VentionModalProps {
|
|
|
31
31
|
dataTestId?: string;
|
|
32
32
|
};
|
|
33
33
|
backDropClickClosable?: boolean;
|
|
34
|
+
dataTestIds?: {
|
|
35
|
+
modal?: string;
|
|
36
|
+
footer?: string;
|
|
37
|
+
};
|
|
34
38
|
/**
|
|
35
39
|
* How to align the text and the content.
|
|
36
40
|
* Defaults to "center".
|
|
@@ -44,6 +48,7 @@ export interface VentionModalProps {
|
|
|
44
48
|
}
|
|
45
49
|
export declare const VentionModal: (props: VentionModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
50
|
export declare const ventionModalTestIds: {
|
|
51
|
+
container: string;
|
|
47
52
|
positiveIcon: string;
|
|
48
53
|
infoIcon: string;
|
|
49
54
|
loadingIcon: string;
|
|
@@ -8,6 +8,7 @@ export interface VentionModalBaseProps {
|
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
isTouchDevice?: boolean;
|
|
10
10
|
backDropClickClosable?: boolean;
|
|
11
|
+
dataTestId?: string;
|
|
11
12
|
/**
|
|
12
13
|
* The custom width will override the modals' default from the {@link modalSize}.
|
|
13
14
|
* If nothing is provided, {@link modalSize} will drive the width.
|