@vectara/vectara-ui 15.1.0 → 15.3.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.
@@ -25,6 +25,7 @@ export type BaseButtonProps = {
25
25
  title?: string;
26
26
  isSubmit?: boolean;
27
27
  isLoading?: boolean;
28
+ truncate?: boolean;
28
29
  };
29
30
  export declare const BaseButton: import("react").ForwardRefExoticComponent<BaseButtonProps & {
30
31
  spinnerColor?: "accent" | "primary" | "success" | "warning" | "danger" | "subdued" | "empty" | "dark" | undefined;
@@ -27,7 +27,7 @@ const sizeToSpinnerSizeMap = {
27
27
  l: "m"
28
28
  };
29
29
  export const BaseButton = forwardRef((_a, ref) => {
30
- var { children, icon, iconSide = "left", align = "center", className, size = "m", fullWidth, onClick, onMouseOver, onMouseOut, onMouseMove, tabIndex, isInert, isDisabled, href, target, track, htmlFor, isSubmit, isLoading, spinnerColor } = _a, rest = __rest(_a, ["children", "icon", "iconSide", "align", "className", "size", "fullWidth", "onClick", "onMouseOver", "onMouseOut", "onMouseMove", "tabIndex", "isInert", "isDisabled", "href", "target", "track", "htmlFor", "isSubmit", "isLoading", "spinnerColor"]);
30
+ var { children, icon, iconSide = "left", align = "center", className, size = "m", fullWidth, onClick, onMouseOver, onMouseOut, onMouseMove, tabIndex, isInert, isDisabled, href, target, track, htmlFor, isSubmit, isLoading, spinnerColor, truncate } = _a, rest = __rest(_a, ["children", "icon", "iconSide", "align", "className", "size", "fullWidth", "onClick", "onMouseOver", "onMouseOut", "onMouseMove", "tabIndex", "isInert", "isDisabled", "href", "target", "track", "htmlFor", "isSubmit", "isLoading", "spinnerColor", "truncate"]);
31
31
  const { createLink } = useVuiContext();
32
32
  const classes = classNames("vuiBaseButton", className, `vuiBaseButton--${size}`, alignToClassMap[align], {
33
33
  "vuiBaseButton-isInert": isInert,
@@ -62,10 +62,13 @@ export const BaseButton = forwardRef((_a, ref) => {
62
62
  _jsxs("button", Object.assign({ className: classes, tabIndex: -1, ref: ref }, { children: [iconContainer, children] }))), target,
63
63
  tabIndex }, rest), getTrackingProps(track)));
64
64
  }
65
+ const labelClasses = classNames({
66
+ "vuiBaseButtonLabel--truncate": truncate
67
+ });
65
68
  const props = Object.assign({ onClick,
66
69
  onMouseOver,
67
70
  onMouseOut,
68
71
  onMouseMove,
69
72
  tabIndex, type: isSubmit ? "submit" : "button", disabled: isDisabled }, rest);
70
- return (_jsxs("button", Object.assign({ className: classes }, props, { ref: ref }, { children: [iconContainer, children] })));
73
+ return (_jsxs("button", Object.assign({ className: classes }, props, { ref: ref }, { children: [iconContainer, _jsx("span", Object.assign({ className: labelClasses }, { children: children }))] })));
71
74
  });
@@ -25,7 +25,7 @@
25
25
  font-weight: 500;
26
26
  box-shadow: $shadowSmallStart;
27
27
  transition: all $transitionSpeed;
28
- line-height: 1;
28
+ line-height: 1.2;
29
29
  cursor: pointer;
30
30
  }
31
31
 
@@ -94,3 +94,8 @@
94
94
  padding: $sizeS $sizeL;
95
95
  height: 47px;
96
96
  }
97
+
98
+ .vuiBaseButtonLabel--truncate {
99
+ overflow: hidden;
100
+ text-overflow: ellipsis;
101
+ }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- export type AnchorSide = "left" | "right" | "rightUp" | "leftUp" | "upLeft" | "upRight";
2
+ export type AnchorSide = "left" | "right" | "rightUp" | "rightDown" | "leftUp" | "leftDown" | "upLeft" | "upRight";
3
3
  export type Props = {
4
4
  button: React.ReactElement;
5
5
  children?: React.ReactNode;
@@ -26,12 +26,24 @@ const calculatePopoverPosition = (button, anchorOptions) => {
26
26
  const adjustedLeft = left + width + offsetX;
27
27
  return { top: `${adjustedTop}px`, left: `${adjustedLeft}px` };
28
28
  }
29
+ if (anchorSide === "rightDown") {
30
+ // Anchor popover to the right side of the button, extending downwards.
31
+ const adjustedTop = top - offsetY + document.documentElement.scrollTop;
32
+ const adjustedLeft = left + width + offsetX;
33
+ return { top: `${adjustedTop}px`, left: `${adjustedLeft}px` };
34
+ }
29
35
  if (anchorSide === "leftUp") {
30
36
  // Anchor popover to the left side of the button, extending upwards.
31
37
  const adjustedTop = top + height + document.documentElement.scrollTop;
32
38
  const adjustedRight = document.documentElement.clientWidth - left + offsetX;
33
39
  return { top: `${adjustedTop}px`, right: `${adjustedRight}px` };
34
40
  }
41
+ if (anchorSide === "leftDown") {
42
+ // Anchor popover to the left side of the button, extending downwards.
43
+ const adjustedTop = top - offsetY + document.documentElement.scrollTop;
44
+ const adjustedRight = document.documentElement.clientWidth - left + offsetX;
45
+ return { top: `${adjustedTop}px`, right: `${adjustedRight}px` };
46
+ }
35
47
  if (anchorSide === "upLeft") {
36
48
  // Anchor popover above the button, aligned to the left edge.
37
49
  const adjustedBottom = document.documentElement.clientHeight - top + offsetY;
@@ -705,7 +705,7 @@ fieldset {
705
705
  font-weight: 500;
706
706
  box-shadow: rgba(60, 64, 67, 0.3) 0px 0px 0px 0px, rgba(60, 64, 67, 0.15) 0px 0px 0px 0px;
707
707
  transition: all 0.2s;
708
- line-height: 1;
708
+ line-height: 1.2;
709
709
  cursor: pointer;
710
710
  }
711
711
 
@@ -771,6 +771,11 @@ fieldset {
771
771
  height: 47px;
772
772
  }
773
773
 
774
+ .vuiBaseButtonLabel--truncate {
775
+ overflow: hidden;
776
+ text-overflow: ellipsis;
777
+ }
778
+
774
779
  .vuiButtonPrimary:hover {
775
780
  box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
776
781
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectara/vectara-ui",
3
- "version": "15.1.0",
3
+ "version": "15.3.0",
4
4
  "homepage": "./",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",