@vectara/vectara-ui 13.6.0 → 13.8.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.
@@ -1,4 +1,5 @@
1
1
  import { TreeItem } from "../types";
2
2
  export declare const VuiAppSideNavLink: import("react").ForwardRefExoticComponent<Pick<TreeItem, "className" | "path" | "name" | "isSelected" | "iconBefore" | "iconAfter"> & {
3
3
  onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
4
+ iconAfterAlignEnd?: boolean | undefined;
4
5
  } & import("react").RefAttributes<HTMLAnchorElement | null>>;
@@ -17,11 +17,11 @@ import { VuiIcon } from "../../icon/Icon";
17
17
  import { useVuiContext } from "../../context/Context";
18
18
  import { forwardRef } from "react";
19
19
  export const VuiAppSideNavLink = forwardRef((_a, ref) => {
20
- var { path, onClick, name, iconBefore, iconAfter, isSelected, className } = _a, rest = __rest(_a, ["path", "onClick", "name", "iconBefore", "iconAfter", "isSelected", "className"]);
20
+ var { path, onClick, name, iconBefore, iconAfter, isSelected, className, iconAfterAlignEnd } = _a, rest = __rest(_a, ["path", "onClick", "name", "iconBefore", "iconAfter", "isSelected", "className", "iconAfterAlignEnd"]);
21
21
  const { createLink, getPath } = useVuiContext();
22
22
  const classes = classNames("vuiAppSideNavLink", {
23
23
  "vuiAppSideNavLink--active": isSelected !== null && isSelected !== void 0 ? isSelected : path === getPath()
24
24
  }, className);
25
- const content = iconBefore || iconAfter ? (_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xxs" }, { children: [iconBefore && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiIcon, Object.assign({ size: "s" }, { children: iconBefore })) }))), _jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: name })), iconAfter && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiIcon, Object.assign({ size: "s" }, { children: iconAfter })) })))] }))) : (name);
25
+ const content = iconBefore || iconAfter ? (_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xxs" }, { children: [iconBefore && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiIcon, Object.assign({ size: "s" }, { children: iconBefore })) }))), _jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: name })), iconAfter && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false, className: iconAfterAlignEnd ? "vuiAppSideNavLink__iconAfter--alignEnd" : undefined }, { children: _jsx(VuiIcon, Object.assign({ size: "s" }, { children: iconAfter })) })))] }))) : (name);
26
26
  return createLink(Object.assign({ ref, className: classes, children: content, href: path, onClick }, rest));
27
27
  });
@@ -74,6 +74,10 @@
74
74
  background-color: var(--vui-color-light-shade);
75
75
  }
76
76
 
77
+ .vuiAppSideNavLink__iconAfter--alignEnd {
78
+ margin-left: auto;
79
+ }
80
+
77
81
  .vuiAppSideNav--m {
78
82
  .vuiAppSideNav__inner {
79
83
  padding: 28px 32px 32px 33px;
@@ -453,6 +453,10 @@ fieldset {
453
453
  background-color: var(--vui-color-light-shade);
454
454
  }
455
455
 
456
+ .vuiAppSideNavLink__iconAfter--alignEnd {
457
+ margin-left: auto;
458
+ }
459
+
456
460
  .vuiAppSideNav--m .vuiAppSideNav__inner {
457
461
  padding: 28px 32px 32px 33px;
458
462
  }
@@ -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.6.0",
3
+ "version": "13.8.0",
4
4
  "homepage": "./",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",