@vention/machine-ui 3.47.0 → 4.1.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
@@ -8506,9 +8506,13 @@ const VentionSwitch = props => {
8506
8506
  }
8507
8507
  };
8508
8508
  return jsxs("div", {
8509
+ role: "switch",
8510
+ "aria-busy": checked === "loading" ? true : undefined,
8511
+ "aria-checked": getAriaChecked(checked),
8512
+ "aria-disabled": disabled ? true : undefined,
8509
8513
  className: classes.root,
8510
- onClick: handleOnchange,
8511
8514
  "data-testid": "vention-switch-root",
8515
+ onClick: handleOnchange,
8512
8516
  children: [checked === "mixed" ? jsx(IconMinus, {
8513
8517
  "data-testid": "vention-switch-minus",
8514
8518
  className: classes.iconMinus
@@ -8671,6 +8675,18 @@ function getRootBorderColor(theme, checked) {
8671
8675
  return theme.palette.icon.tertiary;
8672
8676
  }
8673
8677
  }
8678
+ function getAriaChecked(checked) {
8679
+ switch (checked) {
8680
+ case "on":
8681
+ return true;
8682
+ case "off":
8683
+ return false;
8684
+ case "mixed":
8685
+ return "mixed";
8686
+ case "loading":
8687
+ return false;
8688
+ }
8689
+ }
8674
8690
 
8675
8691
  const ventionPopoverArrowSize = 10;
8676
8692
  const VentionPopover = props => {
@@ -9404,7 +9420,8 @@ const VentionCollapsibleCaretButton = ({
9404
9420
  component: "div",
9405
9421
  className: classes.root,
9406
9422
  onClick: onClick,
9407
- "data-testid": dataTestid ? `${dataTestid}-collapse-button` : "collapsibleCaretButton",
9423
+ "data-testid": dataTestid,
9424
+ "aria-expanded": isExpanded,
9408
9425
  children: jsx(IconCaretRightFilled, {
9409
9426
  size: 16
9410
9427
  })
@@ -9512,13 +9529,14 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9512
9529
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
9513
9530
  };
9514
9531
  const isCaretVisible = Children.count(children) > 0;
9532
+ const testId = dataTestid !== null && dataTestid !== void 0 ? dataTestid : "vention-tree-item";
9515
9533
  return jsxs("div", {
9516
9534
  className: classes.root,
9517
9535
  onClick: handleOnClick,
9518
9536
  ref: ref,
9519
9537
  children: [jsxs("div", {
9520
- "data-testid": "mainContent",
9521
9538
  "aria-selected": isSelected,
9539
+ "data-testid": testId,
9522
9540
  className: classes.mainContent,
9523
9541
  onContextMenu: event => onContextMenu === null || onContextMenu === void 0 ? void 0 : onContextMenu(event),
9524
9542
  onMouseEnter: event => {
@@ -9539,14 +9557,14 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9539
9557
  isVisible: isCaretVisible,
9540
9558
  isExpanded: isExpanded,
9541
9559
  onClick: handleIsExpandedToggle,
9542
- dataTestid: dataTestid
9560
+ dataTestid: `${testId}-collapseButton`
9543
9561
  }), jsx("div", {
9544
- "data-testid": "treeItemIcon",
9562
+ "data-testid": `${testId}-icon`,
9545
9563
  className: classes.iconContainer,
9546
9564
  children: icon
9547
9565
  }), jsx("div", {
9548
9566
  className: classes.labelContainer,
9549
- "data-testid": dataTestid,
9567
+ "data-testid": `${testId}-label`,
9550
9568
  onDoubleClick: handleRenaming,
9551
9569
  children: jsx(Typography, {
9552
9570
  className: classes.label,
@@ -9561,7 +9579,7 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9561
9579
  paddingLeft: theme.spacing(2)
9562
9580
  }
9563
9581
  },
9564
- "data-testid": "tree-item-text-input",
9582
+ "data-testid": `${testId}-textInput`,
9565
9583
  onChange: event => setLabel(event.target.value),
9566
9584
  onBlur: () => handleRename(label),
9567
9585
  onKeyUp: event => {
@@ -9573,10 +9591,10 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9573
9591
  })
9574
9592
  }), hasVisibleTrailingOrActionItems && jsxs("div", {
9575
9593
  className: classes.actionButtonsContainer,
9576
- "data-testid": "actionButtonContainer",
9594
+ "data-testid": `${testId}-contextItems`,
9577
9595
  children: [trailingElements === null || trailingElements === void 0 ? void 0 : trailingElements.map((trailingElement, index) => jsx("div", {
9578
9596
  className: cx(classes.trailingElement, trailingElement.showOnHover && classes.trailingElementShowOnHover),
9579
- "data-testid": `trailingElement-${index}`,
9597
+ "data-testid": `${testId}-trailingElement-${index}`,
9580
9598
  onClick: handleTrailingElementClick,
9581
9599
  children: trailingElement.component
9582
9600
  }, index)), actionButtons === null || actionButtons === void 0 ? void 0 : actionButtons.map((button, index) => {
@@ -9587,7 +9605,7 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9587
9605
  return jsx(VentionIconButton, {
9588
9606
  variant: "shaded",
9589
9607
  className: `${classes.actionButton} ${button.showOnHover ? classes.showOnHover : ""}`,
9590
- "data-testid": `actionButtonContainer-${index}`,
9608
+ "data-testid": `${testId}-actionButton-${index}`,
9591
9609
  onClick: handleButtonOnClick,
9592
9610
  children: button.component
9593
9611
  }, index);
@@ -9595,7 +9613,7 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9595
9613
  })]
9596
9614
  }), captionsRight && captionsRight.length > 0 && jsx("div", {
9597
9615
  className: classes.captionRightContainer,
9598
- "data-testid": "captionRight",
9616
+ "data-testid": `${testId}-captionRightContainer`,
9599
9617
  children: captionsRight.map((caption, index) => jsx("div", {
9600
9618
  className: cx(classes.captionRight, !!caption.onClick && classes.clickableCaptionRight),
9601
9619
  onClick: caption.onClick ? event => {
@@ -9605,7 +9623,7 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9605
9623
  style: {
9606
9624
  color: caption.color
9607
9625
  },
9608
- "data-testid": `captionRight-${index}`,
9626
+ "data-testid": `${testId}-captionRight-${index}`,
9609
9627
  children: jsx(Typography, {
9610
9628
  className: cx(classes.label, classes.captionRightLabel),
9611
9629
  variant: "uiTableNumbers12Reg",
@@ -9625,7 +9643,6 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9625
9643
  });
9626
9644
  });
9627
9645
  const useStyles$a = tss.withParams().withNestedSelectors().create(({
9628
- hasWarning,
9629
9646
  isSelected,
9630
9647
  isExpanded,
9631
9648
  theme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/machine-ui",
3
- "version": "3.47.0",
3
+ "version": "4.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/VentionCo/machine-cloud.git"
@@ -6,7 +6,7 @@ interface VentionCollapsibleCaretButtonProps {
6
6
  isExpanded: boolean;
7
7
  isVisible: boolean;
8
8
  onClick: (event: React.MouseEvent<HTMLDivElement>) => void;
9
- dataTestid?: string;
9
+ dataTestid?: string | undefined;
10
10
  }
11
11
  export declare const VentionCollapsibleCaretButton: FC<VentionCollapsibleCaretButtonProps>;
12
12
  export {};