@vention/machine-ui 3.38.0 → 3.39.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
@@ -4197,6 +4197,7 @@ const VentionModal = props => {
4197
4197
  "data-testid": ventionModalTestIds.modalActions,
4198
4198
  children: [props.secondaryButton && jsx(VentionButton, {
4199
4199
  size: buttonSize,
4200
+ "data-testid": props.secondaryButton.dataTestId,
4200
4201
  onClick: props.secondaryButton.onClick,
4201
4202
  variant: props.secondaryButton.variant || "outline",
4202
4203
  loading: props.secondaryButton.loading,
@@ -4204,6 +4205,7 @@ const VentionModal = props => {
4204
4205
  fullWidth: props.buttonPosition === undefined ? true : false,
4205
4206
  children: props.secondaryButton.text
4206
4207
  }), props.primaryButton && jsx(VentionButton, {
4208
+ "data-testid": props.primaryButton.dataTestId,
4207
4209
  size: buttonSize,
4208
4210
  onClick: props.primaryButton.onClick,
4209
4211
  variant: props.primaryButton.variant || "filled",
@@ -4928,7 +4930,7 @@ const VentionSteps = props => {
4928
4930
  classes,
4929
4931
  cx
4930
4932
  } = useStyles$u(props);
4931
- const typographyVariants = getTypographyVariants$1(props.size);
4933
+ const typographyVariants = getTypographyVariants(props.size);
4932
4934
  let variant = props.variant;
4933
4935
  if (props.size === "small" && variant === "number") {
4934
4936
  console.warn("The design system doesn't support vention-steps bullet numbering for the requested size. Defaulting to dots style.");
@@ -5121,7 +5123,7 @@ const ElementTestIds = {
5121
5123
  Description: "step-description",
5122
5124
  CheckIcon: "step-check-icon"
5123
5125
  };
5124
- const getTypographyVariants$1 = size => {
5126
+ const getTypographyVariants = size => {
5125
5127
  switch (size) {
5126
5128
  case "small":
5127
5129
  return {
@@ -5302,31 +5304,37 @@ const getInputPaddingStyles = (size, theme) => {
5302
5304
  const typographyNameFromSizeMap = {
5303
5305
  "x-small": {
5304
5306
  label: "uiText12SemiBold",
5307
+ labelDiminished: "uiText12Regular",
5305
5308
  text: "uiText12Regular",
5306
5309
  helperText: "uiText12Regular"
5307
5310
  },
5308
5311
  small: {
5309
5312
  label: "uiText12SemiBold",
5313
+ labelDiminished: "uiText12Regular",
5310
5314
  text: "uiText12Regular",
5311
5315
  helperText: "uiText12Regular"
5312
5316
  },
5313
5317
  medium: {
5314
5318
  label: "uiText14SemiBold",
5319
+ labelDiminished: "uiText14Regular",
5315
5320
  text: "uiText14Regular",
5316
5321
  helperText: "uiText12Regular"
5317
5322
  },
5318
5323
  large: {
5319
5324
  label: "uiText14SemiBold",
5325
+ labelDiminished: "uiText14Regular",
5320
5326
  text: "uiText14Regular",
5321
5327
  helperText: "uiText12Regular"
5322
5328
  },
5323
5329
  "x-large": {
5324
5330
  label: "heading18SemiBold",
5331
+ labelDiminished: "paragraph18Regular",
5325
5332
  text: "paragraph18Regular",
5326
5333
  helperText: "uiText12Regular"
5327
5334
  },
5328
5335
  "xx-large": {
5329
5336
  label: "hmiText20SemiBold",
5337
+ labelDiminished: "hmiText20Regular",
5330
5338
  text: "hmiText22Regular",
5331
5339
  helperText: "paragraph18Regular"
5332
5340
  }
@@ -5334,6 +5342,7 @@ const typographyNameFromSizeMap = {
5334
5342
  const getTypography = (size, theme) => {
5335
5343
  return {
5336
5344
  label: theme.typography[typographyNameFromSizeMap[size].label],
5345
+ labelDiminished: theme.typography[typographyNameFromSizeMap[size].labelDiminished],
5337
5346
  text: theme.typography[typographyNameFromSizeMap[size].text],
5338
5347
  helperText: theme.typography[typographyNameFromSizeMap[size].helperText]
5339
5348
  };
@@ -9417,6 +9426,10 @@ const useStyles$a = tss.withParams().create(({
9417
9426
  * This is needed for Machinebuilder for virtualization.
9418
9427
  */
9419
9428
  const DEFAULT_VENTION_TREE_ITEM_HEIGHT = 32;
9429
+ const hasAnyVisibleItem = (items, isHovering) => {
9430
+ if (items === undefined || items.length === 0) return false;
9431
+ return items.some(item => !item.showOnHover) || isHovering && items.some(item => item.showOnHover);
9432
+ };
9420
9433
  const defaultProps$2 = {
9421
9434
  indentLevel: 0,
9422
9435
  hasWarning: false,
@@ -9440,6 +9453,7 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9440
9453
  captionsRight,
9441
9454
  onLabelChange,
9442
9455
  actionButtons,
9456
+ trailingElements,
9443
9457
  onClick,
9444
9458
  indentLevel,
9445
9459
  onContextMenu,
@@ -9484,10 +9498,10 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9484
9498
  const handleRename = newLabel => {
9485
9499
  onLabelChange === null || onLabelChange === void 0 ? void 0 : onLabelChange(newLabel);
9486
9500
  };
9487
- const showActionButtonContainer = useCallback(() => {
9488
- if (actionButtons === undefined) return false;
9489
- return actionButtons.some(button => !button.showOnHover) || isHovering && actionButtons.some(button => button.showOnHover);
9490
- }, [actionButtons, isHovering]);
9501
+ const hasVisibleTrailingOrActionItems = hasAnyVisibleItem(trailingElements, isHovering) || hasAnyVisibleItem(actionButtons, isHovering);
9502
+ const handleTrailingElementClick = event => {
9503
+ event.stopPropagation();
9504
+ };
9491
9505
  const handleOnClick = event => {
9492
9506
  event.stopPropagation();
9493
9507
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
@@ -9551,10 +9565,15 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9551
9565
  }
9552
9566
  }) : label
9553
9567
  })
9554
- }), showActionButtonContainer() && jsx("div", {
9568
+ }), hasVisibleTrailingOrActionItems && jsxs("div", {
9555
9569
  className: classes.actionButtonsContainer,
9556
9570
  "data-testid": "actionButtonContainer",
9557
- children: actionButtons.map((button, index) => {
9571
+ children: [trailingElements === null || trailingElements === void 0 ? void 0 : trailingElements.map((trailingElement, index) => jsx("div", {
9572
+ className: cx(classes.trailingElement, trailingElement.showOnHover && classes.trailingElementShowOnHover),
9573
+ "data-testid": `trailingElement-${index}`,
9574
+ onClick: handleTrailingElementClick,
9575
+ children: trailingElement.component
9576
+ }, index)), actionButtons === null || actionButtons === void 0 ? void 0 : actionButtons.map((button, index) => {
9558
9577
  const handleButtonOnClick = event => {
9559
9578
  event.stopPropagation();
9560
9579
  button.onClick(event);
@@ -9566,7 +9585,7 @@ const VentionTreeItem = /*#__PURE__*/forwardRef((inputProps, ref) => {
9566
9585
  onClick: handleButtonOnClick,
9567
9586
  children: button.component
9568
9587
  }, index);
9569
- })
9588
+ })]
9570
9589
  })]
9571
9590
  }), captionsRight && captionsRight.length > 0 && jsx("div", {
9572
9591
  className: classes.captionRightContainer,
@@ -9640,6 +9659,9 @@ const useStyles$9 = tss.withParams().withNestedSelectors().create(({
9640
9659
  [`&:hover .${classes.actionButton}`]: {
9641
9660
  visibility: "visible"
9642
9661
  },
9662
+ [`&:hover .${classes.trailingElementShowOnHover}`]: {
9663
+ visibility: "visible"
9664
+ },
9643
9665
  [`&:hover`]: {
9644
9666
  border: isSelected ? invisibleBorder : `1px solid ${theme.palette.border.blueSelected}`
9645
9667
  },
@@ -9718,6 +9740,17 @@ const useStyles$9 = tss.withParams().withNestedSelectors().create(({
9718
9740
  height: "24px",
9719
9741
  flexShrink: 0
9720
9742
  },
9743
+ trailingElement: {
9744
+ display: "flex",
9745
+ alignItems: "center",
9746
+ justifyContent: "center",
9747
+ width: "24px",
9748
+ height: "24px",
9749
+ flexShrink: 0
9750
+ },
9751
+ trailingElementShowOnHover: {
9752
+ visibility: "hidden"
9753
+ },
9721
9754
  showOnHover: {
9722
9755
  visibility: "hidden",
9723
9756
  [`${classes.actionButton}:hover &`]: {
@@ -11286,6 +11319,7 @@ const useStyles$1 = tss.withParams().create(({
11286
11319
  const defaultProps = {
11287
11320
  variant: "outlined",
11288
11321
  checkboxSize: "large",
11322
+ labelVariant: "default",
11289
11323
  checkboxPosition: "left",
11290
11324
  textAlign: "left",
11291
11325
  disabled: false,
@@ -11295,7 +11329,8 @@ const defaultProps = {
11295
11329
  const VentionCheckbox = checkboxProps => {
11296
11330
  const props = applyDefaultProps(checkboxProps, defaultProps);
11297
11331
  const {
11298
- classes
11332
+ classes,
11333
+ cx
11299
11334
  } = useStyles({
11300
11335
  variant: props.variant,
11301
11336
  checkboxSize: props.checkboxSize,
@@ -11303,37 +11338,31 @@ const VentionCheckbox = checkboxProps => {
11303
11338
  textAlign: props.textAlign,
11304
11339
  checkboxPosition: props.checkboxPosition
11305
11340
  });
11306
- // removing props that would be unknown to FormControlLabel Component
11307
- const {
11308
- labelText,
11309
- helperText,
11310
- checkboxSize,
11311
- checkboxPosition,
11312
- variant,
11313
- textAlign
11314
- } = props;
11315
- __rest(props, ["labelText", "helperText", "checkboxSize", "checkboxPosition", "variant", "textAlign"]);
11341
+ const typographyVariant = props.labelVariant === "default" ? typographyNameFromSizeMap[props.checkboxSize].labelDiminished : typographyNameFromSizeMap[props.checkboxSize].label;
11316
11342
  const sizeStyle = getSizeStyles(props.checkboxSize);
11317
11343
  const renderLabel = () => {
11318
11344
  if (!props.labelText && !props.helperText) {
11319
11345
  return null;
11320
11346
  }
11321
- const typography = getTypographyVariants(props.checkboxSize);
11322
11347
  return jsxs(Stack, {
11323
11348
  className: classes.textContainer,
11324
11349
  children: [props.labelText && jsx(Typography, {
11325
- variant: typography.labelVariant,
11326
- className: `${classes.labelText} ${props.disabled ? "Mui-disabled" : ""}`,
11350
+ variant: typographyVariant,
11351
+ className: cx(classes.labelText, {
11352
+ "Mui-disabled": props.disabled
11353
+ }),
11327
11354
  children: props.labelText
11328
11355
  }), props.labelText && props.helperText && jsx(Typography, {
11329
- variant: typography.helperVariant,
11330
- className: `${classes.helperText} ${props.disabled ? "Mui-disabled" : ""}`,
11356
+ variant: typographyVariant,
11357
+ className: cx(classes.helperText, {
11358
+ "Mui-disabled": props.disabled
11359
+ }),
11331
11360
  children: props.helperText
11332
11361
  })]
11333
11362
  });
11334
11363
  };
11335
11364
  return jsxs(Stack, {
11336
- className: `${classes.root} ${props.className || ""}`,
11365
+ className: cx(classes.root, props.className),
11337
11366
  children: [jsx(Box$1, {
11338
11367
  className: classes.checkboxContainer,
11339
11368
  children: jsx(Checkbox, {
@@ -11371,7 +11400,6 @@ const useStyles = tss.withParams().create(({
11371
11400
  }) => {
11372
11401
  const checkboxColors = getCheckboxColors(variant, disabled);
11373
11402
  const sizeStyle = getSizeStyles(checkboxSize);
11374
- getTypographyVariants(checkboxSize);
11375
11403
  return {
11376
11404
  root: {
11377
11405
  width: "100%",
@@ -11517,26 +11545,6 @@ const getCheckboxColors = (variant, disabled) => {
11517
11545
  };
11518
11546
  }
11519
11547
  };
11520
- const getTypographyVariants = checkboxSize => {
11521
- switch (checkboxSize) {
11522
- case "small":
11523
- return {
11524
- labelVariant: "uiText12Regular",
11525
- helperVariant: "uiText12Regular"
11526
- };
11527
- case "medium":
11528
- return {
11529
- labelVariant: "uiText14Regular",
11530
- helperVariant: "uiText12Regular"
11531
- };
11532
- case "large":
11533
- default:
11534
- return {
11535
- labelVariant: "uiText14Regular",
11536
- helperVariant: "uiText12Regular"
11537
- };
11538
- }
11539
- };
11540
11548
 
11541
11549
  const SIZE_CONFIG = {
11542
11550
  large: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/machine-ui",
3
- "version": "3.38.0",
3
+ "version": "3.39.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/VentionCo/machine-cloud.git"
@@ -8,9 +8,10 @@ export declare const getInputPaddingStyles: (size: Sizes, theme: Theme) => {
8
8
  paddingLeft: string;
9
9
  paddingRight: string;
10
10
  };
11
- export declare const typographyNameFromSizeMap: Record<"x-small" | "small" | "medium" | "large" | "x-large" | "xx-large", Record<"label" | "text" | "helperText", TypographyOwnProps["variant"]>>;
11
+ export declare const typographyNameFromSizeMap: Record<"x-small" | "small" | "medium" | "large" | "x-large" | "xx-large", Record<"label" | "labelDiminished" | "text" | "helperText", TypographyOwnProps["variant"]>>;
12
12
  export declare const getTypography: (size: Sizes, theme: Theme) => {
13
13
  label: any;
14
+ labelDiminished: any;
14
15
  text: any;
15
16
  helperText: any;
16
17
  };
@@ -2,6 +2,7 @@
2
2
  import { FormControlLabelProps } from "@mui/material";
3
3
  import "../../theme/machine-ui-theme";
4
4
  export type VentionCheckboxSizes = "small" | "medium" | "large";
5
+ export type VentionCheckboxLabelVariant = "default" | "bold";
5
6
  export type VentionCheckboxVariantStyle = "outlined";
6
7
  export type VentionCheckboxPosition = "left" | "right";
7
8
  export type VentionCheckboxTextAlign = "left" | "center" | "right";
@@ -9,6 +10,7 @@ export interface VentionCheckboxProps extends Omit<FormControlLabelProps, "contr
9
10
  labelText?: string;
10
11
  helperText?: string;
11
12
  variant?: VentionCheckboxVariantStyle;
13
+ labelVariant?: VentionCheckboxLabelVariant;
12
14
  checkboxSize?: VentionCheckboxSizes;
13
15
  checkboxPosition?: VentionCheckboxPosition;
14
16
  textAlign?: VentionCheckboxTextAlign;
@@ -20,6 +20,7 @@ export interface VentionModalProps {
20
20
  variant?: VentionButtonProps["variant"];
21
21
  loading?: VentionButtonProps["loading"];
22
22
  disabled?: VentionButtonProps["disabled"];
23
+ dataTestId?: string;
23
24
  };
24
25
  secondaryButton?: {
25
26
  text: string;
@@ -27,6 +28,7 @@ export interface VentionModalProps {
27
28
  variant?: VentionButtonProps["variant"];
28
29
  loading?: VentionButtonProps["loading"];
29
30
  disabled?: VentionButtonProps["disabled"];
31
+ dataTestId?: string;
30
32
  };
31
33
  backDropClickClosable?: boolean;
32
34
  /**
@@ -3,6 +3,10 @@ import { ReactElement, MouseEvent, ForwardRefExoticComponent, RefAttributes } fr
3
3
  * This is needed for Machinebuilder for virtualization.
4
4
  */
5
5
  export declare const DEFAULT_VENTION_TREE_ITEM_HEIGHT = 32;
6
+ export interface TrailingElementItem {
7
+ component: ReactElement;
8
+ showOnHover?: boolean;
9
+ }
6
10
  interface VentionTreeItemProps {
7
11
  labelText: string;
8
12
  indentLevel?: number | undefined;
@@ -18,6 +22,8 @@ interface VentionTreeItemProps {
18
22
  showOnHover?: boolean;
19
23
  onClick: (e: MouseEvent) => void;
20
24
  }[] | undefined;
25
+ /** React elements (e.g. icons with tooltips) rendered in the same area as action buttons but without button styling. */
26
+ trailingElements?: TrailingElementItem[] | undefined;
21
27
  onClick?: ((e: MouseEvent) => void) | undefined;
22
28
  onExpansionChange?: ((isExpanded: boolean) => void) | undefined;
23
29
  onLabelChange?: ((newLabel: string) => void) | undefined;
@@ -42,5 +48,5 @@ declare const useStyles: import("tss-react").Tss.UseStyles<{
42
48
  isExpanded: boolean;
43
49
  captionsRight: VentionTreeItemProps["captionsRight"];
44
50
  indentLevel: number;
45
- }, "actionButton" | "root" | "mainContent" | "singleLineContainer" | "iconContainer" | "labelContainer" | "label" | "captionRightContainer" | "captionRight" | "captionRightLabel" | "clickableCaptionRight" | "actionButtonsContainer" | "showOnHover" | "childrenItems" | "alertIcon", import("tss-react/mui").MuiThemeStyleOverridesPluginParams>;
51
+ }, "actionButton" | "trailingElement" | "trailingElementShowOnHover" | "root" | "mainContent" | "singleLineContainer" | "iconContainer" | "labelContainer" | "label" | "captionRightContainer" | "captionRight" | "captionRightLabel" | "clickableCaptionRight" | "actionButtonsContainer" | "showOnHover" | "childrenItems" | "alertIcon", import("tss-react/mui").MuiThemeStyleOverridesPluginParams>;
46
52
  export {};