@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.
- package/lib/components/app/appSideNav/AppSideNavLink.d.ts +1 -0
- package/lib/components/app/appSideNav/AppSideNavLink.js +2 -2
- package/lib/components/app/appSideNav/appSideNav.scss +4 -0
- package/lib/styles/index.css +4 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +3 -0
- package/lib/utils/testIdify.d.ts +1 -0
- package/lib/utils/testIdify.js +7 -0
- package/lib/utils/testIdify.test.d.ts +1 -0
- package/lib/utils/testIdify.test.js +12 -0
- package/package.json +1 -1
|
@@ -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
|
});
|
package/lib/styles/index.css
CHANGED
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const testIdify: (str?: string) => string;
|
|
@@ -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
|
+
});
|