@vectara/vectara-ui 13.7.0 → 13.9.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.
@@ -27,7 +27,7 @@ export const VuiBadge = (_a) => {
27
27
  const classes = classNames(className, "vuiBadge", `vuiBadge--${color}`, {
28
28
  "vuiBadge--clickable": onClick !== null && onClick !== void 0 ? onClick : href
29
29
  });
30
- const content = (_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xxs" }, { children: [isSelected && (_jsx(VuiFlexItem, { children: _jsx(VuiIcon, Object.assign({ size: "xs", color: "inherit", className: "vuiBadge__icon" }, { children: _jsx(BiCheck, {}) })) })), _jsx(VuiFlexItem, Object.assign({ id: id }, { children: children })), onClose && (_jsx(VuiFlexItem, { children: _jsx(VuiIconButton, { "aria-label": "Remove", "aria-describedby": id, size: "xs", color: "subdued", className: "vuiBadge__icon", onClick: (e) => {
30
+ const content = (_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xxs" }, { children: [isSelected && (_jsx(VuiFlexItem, { children: _jsx(VuiIcon, Object.assign({ size: "xs", color: "inherit", className: "vuiBadge__icon" }, { children: _jsx(BiCheck, {}) })) })), _jsx(VuiFlexItem, Object.assign({ id: id }, { children: _jsx("div", Object.assign({ className: "vuiBadge__content" }, { children: children })) })), onClose && (_jsx(VuiFlexItem, { children: _jsx(VuiIconButton, { "aria-label": "Remove", "aria-describedby": id, size: "xs", color: "subdued", className: "vuiBadge__icon", onClick: (e) => {
31
31
  e.stopPropagation();
32
32
  onClose === null || onClose === void 0 ? void 0 : onClose();
33
33
  }, icon: _jsx(VuiIcon, Object.assign({ size: "xs" }, { children: _jsx(BiX, {}) })) }) }))] })));
@@ -20,6 +20,14 @@
20
20
  height: min-content !important;
21
21
  }
22
22
 
23
+ .vuiBadge__content {
24
+ // text-overflow doesn't work on flexbox elements.
25
+ display: block;
26
+ overflow: hidden;
27
+ white-space: nowrap;
28
+ text-overflow: ellipsis;
29
+ }
30
+
23
31
  // Color
24
32
  $color: (
25
33
  accent: (
@@ -2,6 +2,8 @@
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  align-items: flex-start;
5
+ // Required to enable text truncation within flex items.
6
+ min-width: 0;
5
7
  }
6
8
 
7
9
  .vuiFlexItem--truncate {
@@ -574,6 +574,13 @@ fieldset {
574
574
  height: min-content !important;
575
575
  }
576
576
 
577
+ .vuiBadge__content {
578
+ display: block;
579
+ overflow: hidden;
580
+ white-space: nowrap;
581
+ text-overflow: ellipsis;
582
+ }
583
+
577
584
  .vuiBadge--accent {
578
585
  color: var(--vui-color-accent-shade) !important;
579
586
  background-color: rgba(var(--vui-color-accent-shade-rgb), 0.1);
@@ -2476,6 +2483,7 @@ h2.react-datepicker__current-month {
2476
2483
  display: flex;
2477
2484
  flex-direction: column;
2478
2485
  align-items: flex-start;
2486
+ min-width: 0;
2479
2487
  }
2480
2488
 
2481
2489
  .vuiFlexItem--truncate {
@@ -1,2 +1,5 @@
1
1
  export { formatDate } from "./formatDate";
2
2
  export { truncateStart, truncateEnd } from "./truncateString";
3
+ export { testIdify } from "./testIdify";
4
+ export { copyToClipboard } from "./copyToClipboard";
5
+ export { createId } from "./createId";
@@ -1,2 +1,5 @@
1
1
  export { formatDate } from "./formatDate";
2
2
  export { truncateStart, truncateEnd } from "./truncateString";
3
+ export { testIdify } from "./testIdify";
4
+ export { copyToClipboard } from "./copyToClipboard";
5
+ export { createId } from "./createId";
@@ -0,0 +1 @@
1
+ export declare const testIdify: (str?: string) => string;
@@ -0,0 +1,7 @@
1
+ // Convert a string into a value that's safe to use as a data-testid attribute.
2
+ export const testIdify = (str) => {
3
+ if (!str) {
4
+ return "";
5
+ }
6
+ return str.replace(/ /g, "-").replace(/[@.+]/g, "-");
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { testIdify } from "./testIdify";
2
+ describe("testIdify", () => {
3
+ test("replaces spaces with dashes", () => {
4
+ expect(testIdify("selectPromptTemplateButton-Custom prompt template-1.0")).toBe("selectPromptTemplateButton-Custom-prompt-template-1-0");
5
+ });
6
+ test("replaces @ . and + with dashes", () => {
7
+ expect(testIdify("user@example.com+tag")).toBe("user-example-com-tag");
8
+ });
9
+ test("handles multiple special characters", () => {
10
+ expect(testIdify("prompt@vectara.com + settings")).toBe("prompt-vectara-com---settings");
11
+ });
12
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectara/vectara-ui",
3
- "version": "13.7.0",
3
+ "version": "13.9.0",
4
4
  "homepage": "./",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",