@vention/machine-ui 6.0.5 → 6.1.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
@@ -11713,17 +11713,24 @@ $$5({ target: 'Iterator', proto: true, real: true, forced: someWithoutClosingOnE
11713
11713
  }
11714
11714
  });
11715
11715
 
11716
+ /** This is the default height of the tree item. This value only changes if you stack multiple right captions or show captions below.
11717
+ * This is needed for Machinebuilder for virtualization.
11718
+ */
11719
+ const DEFAULT_VENTION_TREE_ITEM_HEIGHT = 32;
11716
11720
  const VentionCollapsibleCaretButton = ({
11717
11721
  isVisible,
11718
11722
  isExpanded,
11719
11723
  onClick,
11720
- dataTestid
11724
+ dataTestid,
11725
+ size,
11726
+ iconSize
11721
11727
  }) => {
11722
11728
  const {
11723
11729
  classes
11724
11730
  } = useStyles$e({
11725
11731
  isVisible,
11726
- isExpanded
11732
+ isExpanded,
11733
+ size
11727
11734
  });
11728
11735
  return jsx(Box$1, {
11729
11736
  component: "div",
@@ -11732,13 +11739,14 @@ const VentionCollapsibleCaretButton = ({
11732
11739
  "data-testid": dataTestid,
11733
11740
  "aria-expanded": isExpanded,
11734
11741
  children: jsx(IconCaretRightFilled, {
11735
- size: 16
11742
+ size: iconSize
11736
11743
  })
11737
11744
  });
11738
11745
  };
11739
11746
  const useStyles$e = tss.withParams().create(({
11740
11747
  isVisible,
11741
11748
  isExpanded,
11749
+ size,
11742
11750
  theme
11743
11751
  }) => {
11744
11752
  return {
@@ -11747,6 +11755,9 @@ const useStyles$e = tss.withParams().create(({
11747
11755
  cursor: "pointer",
11748
11756
  visibility: isVisible ? "visible" : "hidden",
11749
11757
  alignItems: "center",
11758
+ justifyContent: "center",
11759
+ width: size,
11760
+ height: size,
11750
11761
  transition: "transform 0.2s",
11751
11762
  transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)",
11752
11763
  color: theme.palette.icon.tertiaryHover
@@ -11754,10 +11765,11 @@ const useStyles$e = tss.withParams().create(({
11754
11765
  };
11755
11766
  });
11756
11767
 
11757
- /** This is the default height of the tree item. This value only changes if you stack multiple right captions or show captions below.
11758
- * This is needed for Machinebuilder for virtualization.
11759
- */
11760
- const DEFAULT_VENTION_TREE_ITEM_HEIGHT = 32;
11768
+ /** Fixed minimum row height per size. Rows only grow past it for stacked right captions or captions below. */
11769
+ const MIN_HEIGHT_BY_SIZE = {
11770
+ medium: DEFAULT_VENTION_TREE_ITEM_HEIGHT,
11771
+ "xx-large": 64
11772
+ };
11761
11773
  const hasAnyVisibleItem = (items, isHovering) => {
11762
11774
  if (items === undefined || items.length === 0) return false;
11763
11775
  return items.some(item => !item.showOnHover) || isHovering && items.some(item => item.showOnHover);
@@ -11773,7 +11785,8 @@ const defaultProps$2 = {
11773
11785
  classes: {},
11774
11786
  children: [],
11775
11787
  collapsible: true,
11776
- selectable: true
11788
+ selectable: true,
11789
+ size: "medium"
11777
11790
  };
11778
11791
  const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
11779
11792
  const theme = useTheme();
@@ -11800,7 +11813,8 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
11800
11813
  isRenaming,
11801
11814
  onRenaming,
11802
11815
  collapsible,
11803
- selectable
11816
+ selectable,
11817
+ size
11804
11818
  } = applyDefaultProps(inputProps, defaultProps$2);
11805
11819
  const [isHovering, setIsHovering] = useState(false);
11806
11820
  const [label, setLabel] = useState(labelText);
@@ -11809,12 +11823,13 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
11809
11823
  cx
11810
11824
  } = useStyles$d({
11811
11825
  classesOverrides,
11812
- hasWarning: hasWarning,
11813
- isSelected: isSelected,
11826
+ hasWarning,
11827
+ isSelected,
11814
11828
  isExpanded,
11815
11829
  collapsible,
11816
- indentLevel: indentLevel,
11817
- selectable
11830
+ indentLevel,
11831
+ selectable,
11832
+ size
11818
11833
  });
11819
11834
  const handleRenaming = () => {
11820
11835
  if (onRenaming) {
@@ -11852,7 +11867,7 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
11852
11867
  var _a, _b;
11853
11868
  return jsx(VentionBadge, {
11854
11869
  variant: "filled",
11855
- size: "small",
11870
+ size: size === "xx-large" ? "medium" : "small",
11856
11871
  color: (_a = caption.color) !== null && _a !== void 0 ? _a : "slate",
11857
11872
  className: classes.caption,
11858
11873
  text: caption.text,
@@ -11891,7 +11906,9 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
11891
11906
  isVisible: isCaretVisible,
11892
11907
  isExpanded: isExpanded,
11893
11908
  onClick: handleIsExpandedToggle,
11894
- dataTestid: `${testId}-collapseButton`
11909
+ dataTestid: `${testId}-collapseButton`,
11910
+ size: DEFAULT_VENTION_TREE_ITEM_HEIGHT,
11911
+ iconSize: size === "xx-large" ? 18 : 16
11895
11912
  }), jsx("div", {
11896
11913
  "data-testid": `${testId}-icon`,
11897
11914
  className: classes.iconContainer,
@@ -11902,7 +11919,7 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
11902
11919
  onDoubleClick: handleRenaming,
11903
11920
  children: jsx(Typography, {
11904
11921
  className: classes.label,
11905
- variant: "uiText12Regular",
11922
+ variant: size === "xx-large" ? "uiText18SemiBold" : "uiText12Regular",
11906
11923
  title: label,
11907
11924
  children: isRenaming ? jsx(VentionTextInput, {
11908
11925
  autoFocus: true,
@@ -11947,8 +11964,9 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
11947
11964
  }), captionsPosition === "below" && captionsElement]
11948
11965
  }), captionsPosition === "right" && captionsElement, hasWarning && jsx(IconAlertTriangleFilled, {
11949
11966
  className: classes.alertIcon,
11950
- size: 16,
11951
- color: theme.palette.icon.warning
11967
+ size: size === "xx-large" ? 24 : 16,
11968
+ color: theme.palette.icon.warning,
11969
+ "data-testid": `${testId}-alertIcon`
11952
11970
  })]
11953
11971
  }), jsx("div", {
11954
11972
  className: classes.childrenItems,
@@ -11963,17 +11981,13 @@ const useStyles$d = tss.withParams().withNestedSelectors().create(({
11963
11981
  classes,
11964
11982
  indentLevel,
11965
11983
  collapsible,
11966
- selectable
11984
+ selectable,
11985
+ size
11967
11986
  }) => {
11968
- const getBackgroundColor = () => {
11969
- if (isSelected) return theme.palette.button.shaded;
11970
- return "white";
11971
- };
11972
- const backgroundColor = getBackgroundColor();
11973
11987
  // We use an invisible border to avoid the content from shifting when the border is shown on hover
11974
11988
  const invisibleBorder = `1px solid transparent`;
11975
- // 22 is padding per indent
11976
- const paddingLeft = indentLevel * 22 + 16;
11989
+ // xx-large: 40px per indent (32px caret + 8px gap), so a child's caret sits under its parent's icon.
11990
+ const paddingLeft = size === "xx-large" ? indentLevel * 40 + 8 : indentLevel * 22 + 16;
11977
11991
  // Captions render inside singleLineContainer when below the label, and directly in mainContent when on the right.
11978
11992
  const captionsBelow = `> .${classes.singleLineContainer} > .${classes.captionsContainer}`;
11979
11993
  const multipleCaptionsRight = `> .${classes.captionsContainer} > :nth-child(2)`;
@@ -11982,7 +11996,6 @@ const useStyles$d = tss.withParams().withNestedSelectors().create(({
11982
11996
  display: "flex",
11983
11997
  flexDirection: "column",
11984
11998
  cursor: selectable ? "pointer" : "default",
11985
- backgroundColor: theme.palette.background.default,
11986
11999
  width: "100%"
11987
12000
  },
11988
12001
  mainContent: {
@@ -11993,7 +12006,7 @@ const useStyles$d = tss.withParams().withNestedSelectors().create(({
11993
12006
  border: invisibleBorder,
11994
12007
  display: "flex",
11995
12008
  alignItems: "center",
11996
- backgroundColor: backgroundColor,
12009
+ backgroundColor: isSelected ? theme.palette.button.shaded : "transparent",
11997
12010
  color: theme.palette.text.primary,
11998
12011
  [`&:hover .${classes.actionButton}`]: {
11999
12012
  visibility: "visible"
@@ -12006,7 +12019,7 @@ const useStyles$d = tss.withParams().withNestedSelectors().create(({
12006
12019
  },
12007
12020
  overflow: "hidden",
12008
12021
  gap: theme.spacing(2),
12009
- minHeight: DEFAULT_VENTION_TREE_ITEM_HEIGHT,
12022
+ minHeight: MIN_HEIGHT_BY_SIZE[size],
12010
12023
  boxSizing: "border-box",
12011
12024
  // Stacked content (multiple right captions or captions below the label) needs vertical breathing room.
12012
12025
  [`&:has(${captionsBelow}), &:has(${multipleCaptionsRight})`]: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/machine-ui",
3
- "version": "6.0.5",
3
+ "version": "6.1.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/VentionCo/machine-cloud.git"
@@ -1,4 +1,8 @@
1
1
  import { FC } from "react";
2
+ /** This is the default height of the tree item. This value only changes if you stack multiple right captions or show captions below.
3
+ * This is needed for Machinebuilder for virtualization.
4
+ */
5
+ export declare const DEFAULT_VENTION_TREE_ITEM_HEIGHT = 32;
2
6
  /**
3
7
  * Caret button that is used to collapse and expand the tree item
4
8
  */
@@ -7,6 +11,10 @@ interface VentionCollapsibleCaretButtonProps {
7
11
  isVisible: boolean;
8
12
  onClick: (event: React.MouseEvent<HTMLDivElement>) => void;
9
13
  dataTestid?: string | undefined;
14
+ /** Width and height of the clickable box, in px. */
15
+ size: number;
16
+ /** Size of the caret icon, in px. */
17
+ iconSize: number;
10
18
  }
11
19
  export declare const VentionCollapsibleCaretButton: FC<VentionCollapsibleCaretButtonProps>;
12
20
  export {};
@@ -1,9 +1,8 @@
1
1
  import { ReactElement, MouseEvent, ForwardRefExoticComponent, RefAttributes } from "react";
2
+ import { DEFAULT_VENTION_TREE_ITEM_HEIGHT } from "./vention-collapsible-caret-button";
2
3
  import { VentionBadgeColors } from "../vention-badge/vention-badge";
3
- /** This is the default height of the tree item. This value only changes if you stack multiple right captions or show captions below.
4
- * This is needed for Machinebuilder for virtualization.
5
- */
6
- export declare const DEFAULT_VENTION_TREE_ITEM_HEIGHT = 32;
4
+ import { Sizes, StrictExtract } from "../../theme/machine-ui-theme";
5
+ export { DEFAULT_VENTION_TREE_ITEM_HEIGHT };
7
6
  export interface TrailingElementItem {
8
7
  component: ReactElement;
9
8
  showOnHover?: boolean;
@@ -15,6 +14,7 @@ export interface VentionTreeItemCaption {
15
14
  onClick?: (e: MouseEvent) => void;
16
15
  }
17
16
  export type VentionTreeItemCaptionsPosition = "right" | "below";
17
+ export type VentionTreeItemSize = StrictExtract<Sizes, "medium" | "xx-large">;
18
18
  interface VentionTreeItemProps {
19
19
  labelText: string;
20
20
  indentLevel?: number | undefined;
@@ -45,6 +45,8 @@ interface VentionTreeItemProps {
45
45
  collapsible?: boolean | undefined;
46
46
  /** When false, a row does not select and shows no hover highlight. The caret still works. Defaults to true. */
47
47
  selectable?: boolean | undefined;
48
+ /** Defaults to "medium". */
49
+ size?: VentionTreeItemSize | undefined;
48
50
  }
49
51
  export declare const VentionTreeItem: ForwardRefExoticComponent<VentionTreeItemProps & RefAttributes<HTMLDivElement>>;
50
52
  declare const useStyles: import("tss-react").Tss.UseStyles<{
@@ -56,5 +58,5 @@ declare const useStyles: import("tss-react").Tss.UseStyles<{
56
58
  collapsible: boolean;
57
59
  indentLevel: number;
58
60
  selectable: boolean;
61
+ size: VentionTreeItemSize;
59
62
  }, "caption" | "label" | "root" | "iconContainer" | "labelContainer" | "actionButton" | "trailingElement" | "trailingElementShowOnHover" | "singleLineContainer" | "captionsContainer" | "mainContent" | "actionButtonsContainer" | "showOnHover" | "childrenItems" | "alertIcon", import("tss-react/mui").MuiThemeStyleOverridesPluginParams>;
60
- export {};