@vectara/vectara-ui 13.5.0 → 13.7.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/components/button/BaseButton.d.ts +1 -0
- package/lib/components/button/BaseButton.js +1 -1
- package/lib/components/context/Context.js +6 -4
- package/lib/components/link/types.d.ts +1 -0
- package/lib/styles/index.css +4 -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
|
});
|
|
@@ -66,6 +66,6 @@ export const BaseButton = forwardRef((_a, ref) => {
|
|
|
66
66
|
onMouseOver,
|
|
67
67
|
onMouseOut,
|
|
68
68
|
onMouseMove,
|
|
69
|
-
tabIndex,
|
|
69
|
+
tabIndex, type: isSubmit ? "submit" : "button", disabled: isDisabled }, rest);
|
|
70
70
|
return (_jsxs("button", Object.assign({ className: classes }, props, { ref: ref }, { children: [iconContainer, children] })));
|
|
71
71
|
});
|
|
@@ -15,10 +15,12 @@ import { LIGHT_THEME, DARK_THEME, toStyle } from "./Theme";
|
|
|
15
15
|
const VuiContext = createContext(undefined);
|
|
16
16
|
export const VuiContextProvider = ({ children, linkProvider, pathProvider, drawerTitle = "h2", theme = LIGHT_THEME, portalContainer = document.body, isThemeIsolated }) => {
|
|
17
17
|
const createLink = (linkConfig) => {
|
|
18
|
-
if (linkProvider)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
if (!linkProvider || linkConfig.download) {
|
|
19
|
+
const { className, href, onClick, children, ref } = linkConfig, rest = __rest(linkConfig, ["className", "href", "onClick", "children", "ref"]);
|
|
20
|
+
// To support downloads, we must use anchor tags, not a react-router Link.
|
|
21
|
+
return (_jsx("a", Object.assign({ className: className, href: href, onClick: onClick }, rest, { children: children })));
|
|
22
|
+
}
|
|
23
|
+
return linkProvider(linkConfig);
|
|
22
24
|
};
|
|
23
25
|
const getPath = () => {
|
|
24
26
|
return pathProvider ? pathProvider() : window.location.pathname;
|
package/lib/styles/index.css
CHANGED