@vention/machine-ui 4.2.0 → 4.2.1

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 : "vention-modal",
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,
@@ -12180,6 +12183,15 @@ function getDropZoneStatus(type, hasErrorMessages) {
12180
12183
  }
12181
12184
  }
12182
12185
 
12186
+ const VentionDropZoneTestIds = {
12187
+ container: "dropzoneContainer",
12188
+ contents: "dropzoneContents",
12189
+ uploadIcon: "dropzoneUploadIcon",
12190
+ title: "dropzoneTitle",
12191
+ criteria: "dropzoneCriteria",
12192
+ errors: "dropzoneErrors",
12193
+ fileInput: "dropzoneFileInput"
12194
+ };
12183
12195
  const UPLOAD_TITLE = "Drop to start uploading";
12184
12196
 
12185
12197
  /**
@@ -12194,8 +12206,10 @@ function VentionDropZone({
12194
12206
  onFilesSelect,
12195
12207
  fileCriteriaDescription,
12196
12208
  defaultTitle = "Drop files here or click to upload",
12197
- disabled = false
12209
+ disabled = false,
12210
+ dataTestIds
12198
12211
  }) {
12212
+ var _dataTestIds$containe, _dataTestIds$contents, _dataTestIds$uploadIc, _dataTestIds$title, _dataTestIds$criteria, _dataTestIds$errors, _dataTestIds$fileInpu;
12199
12213
  const [state, dispatch] = useReducer(dropZoneReducer, {
12200
12214
  dropZoneStatus: DropZoneState.Default,
12201
12215
  title: defaultTitle,
@@ -12287,16 +12301,16 @@ function VentionDropZone({
12287
12301
  onDragLeave: handleDragLeave,
12288
12302
  onDrop: handleDrop,
12289
12303
  className: classes.dropZoneContainer,
12290
- "data-testid": "dropzoneContainer",
12304
+ "data-testid": (_dataTestIds$containe = dataTestIds == null ? void 0 : dataTestIds.container) != null ? _dataTestIds$containe : VentionDropZoneTestIds.container,
12291
12305
  children: /*#__PURE__*/jsxs(Grid, {
12292
- "data-testid": "dropzoneContents",
12306
+ "data-testid": (_dataTestIds$contents = dataTestIds == null ? void 0 : dataTestIds.contents) != null ? _dataTestIds$contents : VentionDropZoneTestIds.contents,
12293
12307
  container: true,
12294
12308
  className: classes.dropZoneContents,
12295
12309
  children: [/*#__PURE__*/jsx(Grid, {
12296
12310
  item: true,
12297
12311
  className: classes.dropZoneUploadIcon,
12298
12312
  children: /*#__PURE__*/jsx(VentionIcon, {
12299
- dataTestId: "dropzoneUploadIcon",
12313
+ dataTestId: (_dataTestIds$uploadIc = dataTestIds == null ? void 0 : dataTestIds.uploadIcon) != null ? _dataTestIds$uploadIc : VentionDropZoneTestIds.uploadIcon,
12300
12314
  type: "circle-arrow-up",
12301
12315
  size: getDropZoneStyle(size, "iconSize")
12302
12316
  })
@@ -12304,16 +12318,16 @@ function VentionDropZone({
12304
12318
  item: true,
12305
12319
  className: classes.dropZoneTexts,
12306
12320
  children: [/*#__PURE__*/jsx("div", {
12307
- "data-testid": "dropzoneTitle",
12321
+ "data-testid": (_dataTestIds$title = dataTestIds == null ? void 0 : dataTestIds.title) != null ? _dataTestIds$title : VentionDropZoneTestIds.title,
12308
12322
  className: classes.dropTitle,
12309
12323
  children: state.title
12310
12324
  }), state.dropZoneStatus !== DropZoneState.DraggedOver && /*#__PURE__*/jsxs(Fragment, {
12311
12325
  children: [/*#__PURE__*/jsx("div", {
12312
- "data-testid": "dropzoneCriteria",
12326
+ "data-testid": (_dataTestIds$criteria = dataTestIds == null ? void 0 : dataTestIds.criteria) != null ? _dataTestIds$criteria : VentionDropZoneTestIds.criteria,
12313
12327
  className: classes.criteriaDescription,
12314
12328
  children: fileCriteriaDescription
12315
12329
  }), /*#__PURE__*/jsx("div", {
12316
- "data-testid": "dropzoneErrors",
12330
+ "data-testid": (_dataTestIds$errors = dataTestIds == null ? void 0 : dataTestIds.errors) != null ? _dataTestIds$errors : VentionDropZoneTestIds.errors,
12317
12331
  children: state.errorMessages.map(error => {
12318
12332
  return /*#__PURE__*/jsxs("div", {
12319
12333
  className: classes.errorMessage,
@@ -12324,7 +12338,7 @@ function VentionDropZone({
12324
12338
  })]
12325
12339
  }), /*#__PURE__*/jsx("input", {
12326
12340
  onChange: handleFileInputChange,
12327
- "data-testid": "dropzoneFileInput",
12341
+ "data-testid": (_dataTestIds$fileInpu = dataTestIds == null ? void 0 : dataTestIds.fileInput) != null ? _dataTestIds$fileInpu : VentionDropZoneTestIds.fileInput,
12328
12342
  disabled: disabled,
12329
12343
  "aria-label": "File upload",
12330
12344
  type: "file",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/machine-ui",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/VentionCo/machine-cloud.git"
@@ -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".
@@ -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.