@vention/machine-ui 4.1.4 → 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,
@@ -8702,7 +8705,8 @@ const VentionSwitch = props => {
8702
8705
  checked,
8703
8706
  size,
8704
8707
  disabled,
8705
- onChange
8708
+ onChange,
8709
+ "data-testid": dataTestId = "vention-switch-root"
8706
8710
  } = props;
8707
8711
  const {
8708
8712
  classes,
@@ -8725,7 +8729,7 @@ const VentionSwitch = props => {
8725
8729
  "aria-checked": getAriaChecked(checked),
8726
8730
  "aria-disabled": disabled ? true : undefined,
8727
8731
  className: classes.root,
8728
- "data-testid": "vention-switch-root",
8732
+ "data-testid": dataTestId,
8729
8733
  onClick: handleOnchange,
8730
8734
  children: [checked === "mixed" ? /*#__PURE__*/jsx(IconMinus, {
8731
8735
  "data-testid": "vention-switch-minus",
@@ -12179,6 +12183,15 @@ function getDropZoneStatus(type, hasErrorMessages) {
12179
12183
  }
12180
12184
  }
12181
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
+ };
12182
12195
  const UPLOAD_TITLE = "Drop to start uploading";
12183
12196
 
12184
12197
  /**
@@ -12193,8 +12206,10 @@ function VentionDropZone({
12193
12206
  onFilesSelect,
12194
12207
  fileCriteriaDescription,
12195
12208
  defaultTitle = "Drop files here or click to upload",
12196
- disabled = false
12209
+ disabled = false,
12210
+ dataTestIds
12197
12211
  }) {
12212
+ var _dataTestIds$containe, _dataTestIds$contents, _dataTestIds$uploadIc, _dataTestIds$title, _dataTestIds$criteria, _dataTestIds$errors, _dataTestIds$fileInpu;
12198
12213
  const [state, dispatch] = useReducer(dropZoneReducer, {
12199
12214
  dropZoneStatus: DropZoneState.Default,
12200
12215
  title: defaultTitle,
@@ -12286,16 +12301,16 @@ function VentionDropZone({
12286
12301
  onDragLeave: handleDragLeave,
12287
12302
  onDrop: handleDrop,
12288
12303
  className: classes.dropZoneContainer,
12289
- "data-testid": "dropzoneContainer",
12304
+ "data-testid": (_dataTestIds$containe = dataTestIds == null ? void 0 : dataTestIds.container) != null ? _dataTestIds$containe : VentionDropZoneTestIds.container,
12290
12305
  children: /*#__PURE__*/jsxs(Grid, {
12291
- "data-testid": "dropzoneContents",
12306
+ "data-testid": (_dataTestIds$contents = dataTestIds == null ? void 0 : dataTestIds.contents) != null ? _dataTestIds$contents : VentionDropZoneTestIds.contents,
12292
12307
  container: true,
12293
12308
  className: classes.dropZoneContents,
12294
12309
  children: [/*#__PURE__*/jsx(Grid, {
12295
12310
  item: true,
12296
12311
  className: classes.dropZoneUploadIcon,
12297
12312
  children: /*#__PURE__*/jsx(VentionIcon, {
12298
- dataTestId: "dropzoneUploadIcon",
12313
+ dataTestId: (_dataTestIds$uploadIc = dataTestIds == null ? void 0 : dataTestIds.uploadIcon) != null ? _dataTestIds$uploadIc : VentionDropZoneTestIds.uploadIcon,
12299
12314
  type: "circle-arrow-up",
12300
12315
  size: getDropZoneStyle(size, "iconSize")
12301
12316
  })
@@ -12303,16 +12318,16 @@ function VentionDropZone({
12303
12318
  item: true,
12304
12319
  className: classes.dropZoneTexts,
12305
12320
  children: [/*#__PURE__*/jsx("div", {
12306
- "data-testid": "dropzoneTitle",
12321
+ "data-testid": (_dataTestIds$title = dataTestIds == null ? void 0 : dataTestIds.title) != null ? _dataTestIds$title : VentionDropZoneTestIds.title,
12307
12322
  className: classes.dropTitle,
12308
12323
  children: state.title
12309
12324
  }), state.dropZoneStatus !== DropZoneState.DraggedOver && /*#__PURE__*/jsxs(Fragment, {
12310
12325
  children: [/*#__PURE__*/jsx("div", {
12311
- "data-testid": "dropzoneCriteria",
12326
+ "data-testid": (_dataTestIds$criteria = dataTestIds == null ? void 0 : dataTestIds.criteria) != null ? _dataTestIds$criteria : VentionDropZoneTestIds.criteria,
12312
12327
  className: classes.criteriaDescription,
12313
12328
  children: fileCriteriaDescription
12314
12329
  }), /*#__PURE__*/jsx("div", {
12315
- "data-testid": "dropzoneErrors",
12330
+ "data-testid": (_dataTestIds$errors = dataTestIds == null ? void 0 : dataTestIds.errors) != null ? _dataTestIds$errors : VentionDropZoneTestIds.errors,
12316
12331
  children: state.errorMessages.map(error => {
12317
12332
  return /*#__PURE__*/jsxs("div", {
12318
12333
  className: classes.errorMessage,
@@ -12323,7 +12338,7 @@ function VentionDropZone({
12323
12338
  })]
12324
12339
  }), /*#__PURE__*/jsx("input", {
12325
12340
  onChange: handleFileInputChange,
12326
- "data-testid": "dropzoneFileInput",
12341
+ "data-testid": (_dataTestIds$fileInpu = dataTestIds == null ? void 0 : dataTestIds.fileInput) != null ? _dataTestIds$fileInpu : VentionDropZoneTestIds.fileInput,
12327
12342
  disabled: disabled,
12328
12343
  "aria-label": "File upload",
12329
12344
  type: "file",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/machine-ui",
3
- "version": "4.1.4",
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.
@@ -7,6 +7,7 @@ interface VentionSwitchProps {
7
7
  onChange?: (checked: "on" | "off") => void;
8
8
  disabled?: SwitchProps["disabled"];
9
9
  variant?: Variant;
10
+ "data-testid"?: string;
10
11
  }
11
12
  export declare const VentionSwitch: (props: VentionSwitchProps) => import("react/jsx-runtime").JSX.Element;
12
13
  export {};