@vectara/vectara-ui 16.2.0 → 16.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.
|
@@ -82,7 +82,7 @@ import { VuiTable } from "./table/Table";
|
|
|
82
82
|
import { VuiTab } from "./tabs/Tab";
|
|
83
83
|
import { VuiTabbedRoutes } from "./tabs/TabbedRoutes";
|
|
84
84
|
import { VuiTabs } from "./tabs/Tabs";
|
|
85
|
-
import { VuiTabsNavigator } from "./tabs/
|
|
85
|
+
import { VuiTabsNavigator } from "./tabs/TabsNavigator";
|
|
86
86
|
import { TAB_SIZE, TabSize } from "./tabs/types";
|
|
87
87
|
import { VuiText } from "./typography/Text";
|
|
88
88
|
import { VuiTextColor } from "./typography/TextColor";
|
package/lib/components/index.js
CHANGED
|
@@ -75,7 +75,7 @@ import { VuiTable } from "./table/Table";
|
|
|
75
75
|
import { VuiTab } from "./tabs/Tab";
|
|
76
76
|
import { VuiTabbedRoutes } from "./tabs/TabbedRoutes";
|
|
77
77
|
import { VuiTabs } from "./tabs/Tabs";
|
|
78
|
-
import { VuiTabsNavigator } from "./tabs/
|
|
78
|
+
import { VuiTabsNavigator } from "./tabs/TabsNavigator";
|
|
79
79
|
import { TAB_SIZE } from "./tabs/types";
|
|
80
80
|
import { VuiText } from "./typography/Text";
|
|
81
81
|
import { VuiTextColor } from "./typography/TextColor";
|
|
@@ -3,6 +3,7 @@ import { TabRoute } from "./types";
|
|
|
3
3
|
type Props = {
|
|
4
4
|
routes: TabRoute[];
|
|
5
5
|
popover?: Omit<PopoverProps, "header" | "isOpen" | "setIsOpen" | "button" | "children" | "padding">;
|
|
6
|
+
"data-testid"?: string;
|
|
6
7
|
};
|
|
7
|
-
export declare const VuiTabsNavigator: ({ routes, popover }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const VuiTabsNavigator: ({ routes, popover, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
13
|
import { useState } from "react";
|
|
3
14
|
import { VuiPopover } from "../popover/Popover";
|
|
@@ -6,8 +17,9 @@ import { VuiTabs } from "./Tabs";
|
|
|
6
17
|
import { useVuiContext } from "../context/Context";
|
|
7
18
|
import { VuiIcon } from "../icon/Icon";
|
|
8
19
|
import { BiDotsVertical } from "react-icons/bi";
|
|
9
|
-
export const VuiTabsNavigator = (
|
|
10
|
-
var
|
|
20
|
+
export const VuiTabsNavigator = (_a) => {
|
|
21
|
+
var _b;
|
|
22
|
+
var { routes, popover } = _a, rest = __rest(_a, ["routes", "popover"]);
|
|
11
23
|
const { getPath } = useVuiContext();
|
|
12
24
|
const [isOpen, setIsOpen] = useState(false);
|
|
13
25
|
const isRouteActive = (route) => {
|
|
@@ -15,7 +27,7 @@ export const VuiTabsNavigator = ({ routes, popover }) => {
|
|
|
15
27
|
return (_a = route.isActive) !== null && _a !== void 0 ? _a : (route.href ? getPath().includes(route.href) : false);
|
|
16
28
|
};
|
|
17
29
|
const activeRoute = routes.find((route) => isRouteActive(route));
|
|
18
|
-
return (_jsx(VuiPopover, Object.assign({}, popover, { isOpen: isOpen, setIsOpen: () => setIsOpen(!isOpen), button: _jsx("button", Object.assign({ className: "vuiTabsNavigatorButton" }, { children: _jsxs("div", Object.assign({ className: "vuiTabsNavigatorButton__inner" }, { children: [_jsx(VuiIcon, Object.assign({ size: "xs" }, { children: _jsx(BiDotsVertical, {}) })), _jsx("div", { children: (
|
|
30
|
+
return (_jsx(VuiPopover, Object.assign({}, popover, { isOpen: isOpen, setIsOpen: () => setIsOpen(!isOpen), button: _jsx("button", Object.assign({ className: "vuiTabsNavigatorButton" }, rest, { children: _jsxs("div", Object.assign({ className: "vuiTabsNavigatorButton__inner" }, { children: [_jsx(VuiIcon, Object.assign({ size: "xs" }, { children: _jsx(BiDotsVertical, {}) })), _jsx("div", { children: (_b = activeRoute === null || activeRoute === void 0 ? void 0 : activeRoute.title) !== null && _b !== void 0 ? _b : "No selection" })] })) })), padding: "none" }, { children: _jsx(VuiTabs, Object.assign({ size: "s", tabStyle: "enclosed", vertical: true }, { children: routes.map((route, index) => {
|
|
19
31
|
const { href, onClick, title, render, testId } = route;
|
|
20
32
|
const tabLink = (_jsx(VuiTab, Object.assign({ href: href, isActive: isRouteActive(route), "data-testid": testId, onClick: () => {
|
|
21
33
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|