@vectara/vectara-ui 16.12.0 → 17.0.1
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.
|
@@ -87,7 +87,7 @@ import { SpansRow } from "./spans/types";
|
|
|
87
87
|
import { VuiTab } from "./tabs/Tab";
|
|
88
88
|
import { VuiTabbedRoutes } from "./tabs/TabbedRoutes";
|
|
89
89
|
import { VuiTabs } from "./tabs/Tabs";
|
|
90
|
-
import { VuiTabsNavigator } from "./tabs/TabsNavigator";
|
|
90
|
+
import { TabNavigatorRoute, VuiTabsNavigator } from "./tabs/TabsNavigator";
|
|
91
91
|
import { TAB_SIZE, TabSize } from "./tabs/types";
|
|
92
92
|
import { VuiText } from "./typography/Text";
|
|
93
93
|
import { VuiTextColor } from "./typography/TextColor";
|
|
@@ -100,5 +100,5 @@ import { VuiInfoTooltip } from "./tooltip/InfoTooltip";
|
|
|
100
100
|
import { VuiTopicButton } from "./topicButton/TopicButton";
|
|
101
101
|
import { copyToClipboard } from "../utils/copyToClipboard";
|
|
102
102
|
import { toRgb, toRgba } from "./context/Theme";
|
|
103
|
-
export type { AnchorSide, AppContentPadding, ButtonColor, CalloutColor, ChatLanguage, ChatStyle, ChatTurn, CheckboxConfig, CodeEditorColorConfig, CodeEditorError, CodeLanguage, InfoListItemType, InfoListType, InfoTableColumnAlign, InfoTableRow, InfoTableRowType, KvTableAlign, KvTableItem, KvTableItems, KvTablePadding, LinkProps, MenuItem, OptionListItem, Pagination, RadioButtonConfig, SearchResult, SearchSuggestion, Sections, SectionItem, SpansRow, Stat, StepStatus, StepSize, Steps, StepsVertical, StepVerticalStatus, TabSize, Tree, TreeItem };
|
|
103
|
+
export type { AnchorSide, AppContentPadding, ButtonColor, CalloutColor, ChatLanguage, ChatStyle, ChatTurn, CheckboxConfig, CodeEditorColorConfig, CodeEditorError, CodeLanguage, InfoListItemType, InfoListType, InfoTableColumnAlign, InfoTableRow, InfoTableRowType, KvTableAlign, KvTableItem, KvTableItems, KvTablePadding, LinkProps, MenuItem, OptionListItem, Pagination, RadioButtonConfig, SearchResult, SearchSuggestion, Sections, SectionItem, SpansRow, Stat, StepStatus, StepSize, Steps, StepsVertical, StepVerticalStatus, TabNavigatorRoute, TabSize, Tree, TreeItem };
|
|
104
104
|
export { BADGE_COLOR, BUTTON_COLOR, BUTTON_SIZE, CALLOUT_COLOR, CALLOUT_SIZE, ICON_COLOR, ICON_SIZE, ICON_TYPE, PROGRESS_BAR_COLOR, SPACER_SIZE, SPINNER_COLOR, SKELETON_COLOR, SPINNER_SIZE, TAB_SIZE, TEXT_COLOR, TEXT_SIZE, TITLE_SIZE, addNotification, copyToClipboard, generateTokensProvider, toRgb, toRgba, VuiAccordion, VuiAccountButton, VuiAppContent, VuiAppHeader, VuiAppLayout, VuiAppSideNav, VuiAppSideNavLink, VuiAppSideNavGroup, VuiBadge, VuiButtonPrimary, VuiButtonSecondary, VuiButtonTertiary, VuiIconButton, VuiCallout, VuiCard, VuiChat, VuiCheckbox, VuiCode, VuiCodeEditor, VuiComplexConfigurationButton, VuiContextProvider, VuiCopyButton, VuiDatePicker, VuiDateRangePicker, VuiDrawer, VuiDurationBar, VuiErrorBoundary, VuiFlexContainer, VuiFlexItem, VuiFormGroup, VuiGrid, VuiGridItem, VuiHorizontalRule, VuiIcon, VuiImage, VuiImagePreview, VuiInfoList, VuiInfoListItem, VuiInfoMenu, VuiInfoTable, VuiInfoTooltip, VuiKvTable, VuiInProgress, VuiItemsInput, VuiLabel, VuiLink, VuiLinkInternal, VuiList, VuiMenu, VuiMenuItem, VuiModal, VuiNotifications, VuiNumberInput, VuiOptionsButton, VuiOptionsList, VuiOptionsListItem, VuiPagination, VuiPanel, VuiPasswordInput, VuiPopover, VuiPortal, VuiProgressBar, VuiPrompt, VuiRadioButton, VuiScreenBlock, VuiSearchInput, VuiSearchResult, VuiSearchSelect, VuiSelect, VuiSetting, VuiSimpleCard, VuiSimpleGrid, VuiSpacer, VuiSpans, VuiSpinner, VuiStat, VuiStatList, VuiStatus, VuiSteps, VuiStepsVertical, VuiSummary, VuiSkeleton, VuiSummaryCitation, VuiSuperCheckboxGroup, VuiSuperRadioGroup, VuiTable, VuiTab, VuiTabbedRoutes, VuiTabs, VuiTabsNavigator, VuiText, VuiTextArea, VuiTextColor, VuiTextInput, VuiTimeline, VuiTimelineItem, VuiTitle, VuiToggle, VuiTooltip, VuiTopicButton };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Props as PopoverProps } from "../popover/Popover";
|
|
2
2
|
import { TabRoute } from "./types";
|
|
3
|
+
export type TabNavigatorRoute = Omit<TabRoute, "render"> & {
|
|
4
|
+
append?: React.ReactNode;
|
|
5
|
+
};
|
|
3
6
|
type Props = {
|
|
4
|
-
routes:
|
|
7
|
+
routes: TabNavigatorRoute[];
|
|
5
8
|
popover?: Omit<PopoverProps, "header" | "isOpen" | "setIsOpen" | "button" | "children" | "padding">;
|
|
6
9
|
"data-testid"?: string;
|
|
7
10
|
};
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
12
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { useState } from "react";
|
|
14
14
|
import { VuiPopover } from "../popover/Popover";
|
|
15
15
|
import { VuiTab } from "./Tab";
|
|
@@ -17,6 +17,7 @@ import { VuiTabs } from "./Tabs";
|
|
|
17
17
|
import { useVuiContext } from "../context/Context";
|
|
18
18
|
import { VuiIcon } from "../icon/Icon";
|
|
19
19
|
import { BiDotsVertical } from "react-icons/bi";
|
|
20
|
+
import { VuiFlexContainer } from "../flex/FlexContainer";
|
|
20
21
|
export const VuiTabsNavigator = (_a) => {
|
|
21
22
|
var _b;
|
|
22
23
|
var { routes, popover } = _a, rest = __rest(_a, ["routes", "popover"]);
|
|
@@ -28,13 +29,10 @@ export const VuiTabsNavigator = (_a) => {
|
|
|
28
29
|
};
|
|
29
30
|
const activeRoute = routes.find((route) => isRouteActive(route));
|
|
30
31
|
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) => {
|
|
31
|
-
const { href, onClick, title,
|
|
32
|
-
|
|
32
|
+
const { href, onClick, title, testId, append } = route;
|
|
33
|
+
return (_jsx(VuiTab, Object.assign({ href: href, isActive: isRouteActive(route), "data-testid": testId, onClick: () => {
|
|
33
34
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
34
35
|
setIsOpen(false);
|
|
35
|
-
} }, { children: title }), index));
|
|
36
|
-
if (render)
|
|
37
|
-
return render(tabLink);
|
|
38
|
-
return tabLink;
|
|
36
|
+
} }, { children: _jsxs(VuiFlexContainer, Object.assign({ spacing: "s", alignItems: "center" }, { children: [title, append] })) }), index));
|
|
39
37
|
}) })) })));
|
|
40
38
|
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useLocation } from "react-router-dom";
|
|
2
|
-
import { VuiTabsNavigator } from "../../../lib";
|
|
2
|
+
import { VuiIcon, VuiTabsNavigator } from "../../../lib";
|
|
3
|
+
import { BiFlag } from "react-icons/bi";
|
|
3
4
|
|
|
4
5
|
export const TabsNavigator = () => {
|
|
5
6
|
const { hash } = useLocation();
|
|
@@ -10,7 +11,12 @@ export const TabsNavigator = () => {
|
|
|
10
11
|
title: "Home",
|
|
11
12
|
testId: "home-tab",
|
|
12
13
|
isActive: hash.endsWith("#home"),
|
|
13
|
-
onClick: () => console.log("Home tab clicked")
|
|
14
|
+
onClick: () => console.log("Home tab clicked"),
|
|
15
|
+
append: (
|
|
16
|
+
<VuiIcon color="warning" size="xs">
|
|
17
|
+
<BiFlag />
|
|
18
|
+
</VuiIcon>
|
|
19
|
+
)
|
|
14
20
|
},
|
|
15
21
|
{
|
|
16
22
|
href: "#profile",
|