@vectara/vectara-ui 16.0.1 → 16.1.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.
- package/lib/components/screenBlock/_index.scss +2 -2
- package/lib/components/stepsVertical/_index.scss +3 -2
- package/lib/components/tabs/TabNavigator.js +11 -3
- package/lib/components/tabs/TabbedRoutes.js +1 -1
- package/lib/components/tabs/types.d.ts +2 -1
- package/lib/styles/index.css +5 -3
- package/package.json +1 -1
- package/src/docs/pages/drawer/PrimaryDrawer.tsx +17 -0
- package/src/docs/pages/tabs/TabsNavigator.tsx +6 -3
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
.vuiStepVerticalContainer {
|
|
9
9
|
padding-left: $sizeS;
|
|
10
10
|
border-left: 1px solid var(--vui-color-medium-shade);
|
|
11
|
+
transition: border-left-color $transitionSpeed;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
.vuiStepVerticalContainer-isActive {
|
|
14
15
|
padding-left: $sizeS - 1px;
|
|
15
|
-
border-left: 2px
|
|
16
|
+
border-left-width: 2px;
|
|
17
|
+
border-left-color: var(--vui-color-primary-shade);
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
.vuiStepVerticalContainer {
|
|
@@ -45,7 +47,6 @@
|
|
|
45
47
|
|
|
46
48
|
.vuiStepVerticalContainer__icon {
|
|
47
49
|
.vuiIcon--token {
|
|
48
|
-
// border-color: var(--vui-color-medium-shade);
|
|
49
50
|
box-shadow: $shadowSmallEnd;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -10,9 +10,17 @@ export const VuiTabsNavigator = ({ routes, popover }) => {
|
|
|
10
10
|
var _a;
|
|
11
11
|
const { getPath } = useVuiContext();
|
|
12
12
|
const [isOpen, setIsOpen] = useState(false);
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const isRouteActive = (route) => {
|
|
14
|
+
var _a;
|
|
15
|
+
return (_a = route.isActive) !== null && _a !== void 0 ? _a : (route.href ? getPath().includes(route.href) : false);
|
|
16
|
+
};
|
|
17
|
+
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: (_a = activeRoute === null || activeRoute === void 0 ? void 0 : activeRoute.title) !== null && _a !== void 0 ? _a : "No selection" })] })) })), padding: "none" }, { children: _jsx(VuiTabs, Object.assign({ size: "s", tabStyle: "enclosed", vertical: true }, { children: routes.map((route, index) => {
|
|
19
|
+
const { href, onClick, title, render, testId } = route;
|
|
20
|
+
const tabLink = (_jsx(VuiTab, Object.assign({ href: href, isActive: isRouteActive(route), "data-testid": testId, onClick: () => {
|
|
21
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
22
|
+
setIsOpen(false);
|
|
23
|
+
} }, { children: title }), index));
|
|
16
24
|
if (render)
|
|
17
25
|
return render(tabLink);
|
|
18
26
|
return tabLink;
|
|
@@ -6,7 +6,7 @@ import { useVuiContext } from "../context/Context";
|
|
|
6
6
|
export const VuiTabbedRoutes = ({ tabs, size, sideContent, children }) => {
|
|
7
7
|
const { getPath } = useVuiContext();
|
|
8
8
|
return (_jsxs(_Fragment, { children: [_jsx(VuiTabs, Object.assign({ append: sideContent, size: size }, { children: tabs.map(({ href, title, render, testId, isActive }, index) => {
|
|
9
|
-
const tabLink = (_jsx(VuiTab, Object.assign({ href: href, isActive: isActive !== null && isActive !== void 0 ? isActive : getPath().includes(href), "data-testid": testId }, { children: title }), index));
|
|
9
|
+
const tabLink = (_jsx(VuiTab, Object.assign({ href: href, isActive: isActive !== null && isActive !== void 0 ? isActive : (href ? getPath().includes(href) : false), "data-testid": testId }, { children: title }), index));
|
|
10
10
|
if (render)
|
|
11
11
|
return render(tabLink);
|
|
12
12
|
return tabLink;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const TAB_SIZE: readonly ["s", "m"];
|
|
2
2
|
export type TabSize = (typeof TAB_SIZE)[number];
|
|
3
3
|
export type TabRoute = {
|
|
4
|
-
href
|
|
4
|
+
href?: string;
|
|
5
|
+
onClick?: () => void;
|
|
5
6
|
title: React.ReactNode;
|
|
6
7
|
render?: (tabLink: React.ReactNode) => React.ReactNode;
|
|
7
8
|
testId?: string;
|
package/lib/styles/index.css
CHANGED
|
@@ -4502,11 +4502,11 @@ h2.react-datepicker__current-month {
|
|
|
4502
4502
|
opacity: 0;
|
|
4503
4503
|
}
|
|
4504
4504
|
|
|
4505
|
-
.vuiScreenBlock--default {
|
|
4505
|
+
.vuiScreenBlock.vuiScreenBlock--default {
|
|
4506
4506
|
z-index: 10;
|
|
4507
4507
|
}
|
|
4508
4508
|
|
|
4509
|
-
.vuiScreenBlock--modal {
|
|
4509
|
+
.vuiScreenBlock.vuiScreenBlock--modal {
|
|
4510
4510
|
z-index: 12;
|
|
4511
4511
|
}
|
|
4512
4512
|
|
|
@@ -5084,11 +5084,13 @@ h2.react-datepicker__current-month {
|
|
|
5084
5084
|
.vuiStepVerticalContainer {
|
|
5085
5085
|
padding-left: 12px;
|
|
5086
5086
|
border-left: 1px solid var(--vui-color-medium-shade);
|
|
5087
|
+
transition: border-left-color 0.2s;
|
|
5087
5088
|
}
|
|
5088
5089
|
|
|
5089
5090
|
.vuiStepVerticalContainer-isActive {
|
|
5090
5091
|
padding-left: 11px;
|
|
5091
|
-
border-left: 2px
|
|
5092
|
+
border-left-width: 2px;
|
|
5093
|
+
border-left-color: var(--vui-color-primary-shade);
|
|
5092
5094
|
}
|
|
5093
5095
|
|
|
5094
5096
|
.vuiStepVerticalContainer {
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
VuiButtonSecondary,
|
|
6
6
|
VuiDrawer,
|
|
7
7
|
VuiFlexContainer,
|
|
8
|
+
VuiModal,
|
|
8
9
|
VuiNotifications,
|
|
9
10
|
VuiSpacer,
|
|
10
11
|
VuiText,
|
|
@@ -16,6 +17,7 @@ import { FormGroup } from "../searchSelect/FormGroup";
|
|
|
16
17
|
export const PrimaryDrawer = () => {
|
|
17
18
|
const [isOpen, setIsOpen] = useState(false);
|
|
18
19
|
const [hasFooter, setHasFooter] = useState(true);
|
|
20
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
19
21
|
|
|
20
22
|
return (
|
|
21
23
|
<>
|
|
@@ -67,6 +69,12 @@ export const PrimaryDrawer = () => {
|
|
|
67
69
|
|
|
68
70
|
<VuiSpacer size="m" />
|
|
69
71
|
|
|
72
|
+
<VuiButtonSecondary color="primary" onClick={() => setIsModalOpen(true)}>
|
|
73
|
+
Open modal from drawer
|
|
74
|
+
</VuiButtonSecondary>
|
|
75
|
+
|
|
76
|
+
<VuiSpacer size="m" />
|
|
77
|
+
|
|
70
78
|
<VuiText>
|
|
71
79
|
<p>I just thought you should know that your drawer is showing.</p>
|
|
72
80
|
</VuiText>
|
|
@@ -203,6 +211,15 @@ export const PrimaryDrawer = () => {
|
|
|
203
211
|
<VuiSpacer size="l" />
|
|
204
212
|
</VuiDrawer>
|
|
205
213
|
|
|
214
|
+
<VuiModal isOpen={isModalOpen} onClose={() => setIsModalOpen(false)} title="I'm a modal inside a drawer!">
|
|
215
|
+
<VuiText>
|
|
216
|
+
<p>
|
|
217
|
+
This modal is rendered inside the drawer. It demonstrates that you can have multiple layers of overlays and
|
|
218
|
+
that the focus management and scroll locking still work as expected.
|
|
219
|
+
</p>
|
|
220
|
+
</VuiText>
|
|
221
|
+
</VuiModal>
|
|
222
|
+
|
|
206
223
|
<VuiNotifications />
|
|
207
224
|
</>
|
|
208
225
|
);
|
|
@@ -9,19 +9,22 @@ export const TabsNavigator = () => {
|
|
|
9
9
|
href: "#home",
|
|
10
10
|
title: "Home",
|
|
11
11
|
testId: "home-tab",
|
|
12
|
-
isActive: hash.endsWith("#home")
|
|
12
|
+
isActive: hash.endsWith("#home"),
|
|
13
|
+
onClick: () => console.log("Home tab clicked")
|
|
13
14
|
},
|
|
14
15
|
{
|
|
15
16
|
href: "#profile",
|
|
16
17
|
title: "Profile",
|
|
17
18
|
testId: "profile-tab",
|
|
18
|
-
isActive: hash.endsWith("#profile")
|
|
19
|
+
isActive: hash.endsWith("#profile"),
|
|
20
|
+
onClick: () => console.log("Profile tab clicked")
|
|
19
21
|
},
|
|
20
22
|
{
|
|
21
23
|
href: "#settings",
|
|
22
24
|
title: "Settings",
|
|
23
25
|
testId: "settings-tab",
|
|
24
|
-
isActive: hash.endsWith("#settings")
|
|
26
|
+
isActive: hash.endsWith("#settings"),
|
|
27
|
+
onClick: () => console.log("Settings tab clicked")
|
|
25
28
|
}
|
|
26
29
|
];
|
|
27
30
|
|