@vokality/design-system 1.3.0 → 3.0.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/CHANGELOG.md +54 -0
- package/README.md +51 -5
- package/dist/browser.d.ts +13 -0
- package/dist/browser.js +7 -0
- package/dist/charts/chart.d.ts +6 -5
- package/dist/charts/chart.js +44 -25
- package/dist/chat.d.ts +54 -0
- package/dist/chat.js +1 -0
- package/dist/components/Accordion/Accordion.js +1 -1
- package/dist/components/Alert/Alert.js +5 -2
- package/dist/components/AppShell/AppShell.js +10 -14
- package/dist/components/Avatar/Avatar.js +2 -2
- package/dist/components/AvatarGroup/AvatarGroup.js +2 -2
- package/dist/components/BarChart/BarChart.js +17 -15
- package/dist/components/Breadcrumbs/Breadcrumbs.js +6 -3
- package/dist/components/Calendar/Calendar.js +6 -5
- package/dist/components/Card/Card.js +2 -3
- package/dist/components/ChatInbox/ChatInbox.d.ts +11 -0
- package/dist/components/ChatInbox/ChatInbox.js +49 -0
- package/dist/components/ChatPanel/ChatPanel.d.ts +3 -0
- package/dist/components/ChatPanel/ChatPanel.js +13 -0
- package/dist/components/ChatPanel/composer.d.ts +5 -0
- package/dist/components/ChatPanel/composer.js +32 -0
- package/dist/components/ChatPanel/transcript.d.ts +13 -0
- package/dist/components/ChatPanel/transcript.js +39 -0
- package/dist/components/ChatWidget/ChatWidget.d.ts +12 -0
- package/dist/components/ChatWidget/ChatWidget.js +42 -0
- package/dist/components/Checkbox/Checkbox.d.ts +5 -10
- package/dist/components/Checkbox/Checkbox.js +5 -19
- package/dist/components/CodeBlock/CodeBlock.js +19 -5
- package/dist/components/Combobox/Combobox.js +22 -15
- package/dist/components/Combobox/ListPanel.js +20 -9
- package/dist/components/CommandPalette/CommandPalette.js +33 -14
- package/dist/components/ContextMenu/ContextMenu.d.ts +2 -2
- package/dist/components/ContextMenu/ContextMenu.js +5 -50
- package/dist/components/DatePicker/DatePicker.js +35 -29
- package/dist/components/DescriptionList/DescriptionList.js +1 -1
- package/dist/components/Dialog/Dialog.d.ts +24 -7
- package/dist/components/Dialog/Dialog.js +30 -41
- package/dist/components/Drawer/Drawer.d.ts +4 -2
- package/dist/components/EmptyState/EmptyState.js +2 -2
- package/dist/components/ErrorSummary/ErrorSummary.js +5 -3
- package/dist/components/FaqList/FaqList.js +1 -1
- package/dist/components/Field/Field.js +4 -4
- package/dist/components/Fieldset/Fieldset.js +3 -3
- package/dist/components/FileUpload/FileUpload.js +17 -9
- package/dist/components/Grid/Grid.d.ts +867 -5
- package/dist/components/Grid/Grid.js +3 -4
- package/dist/components/Heading/Heading.js +2 -1
- package/dist/components/Icon/Icon.js +4 -2
- package/dist/components/Inline/Inline.d.ts +867 -5
- package/dist/components/Inline/Inline.js +2 -3
- package/dist/components/LineChart/LineChart.js +17 -15
- package/dist/components/LinkProvider/LinkProvider.d.ts +1 -1
- package/dist/components/LinkProvider/LinkProvider.js +6 -2
- package/dist/components/List/List.js +1 -1
- package/dist/components/MediaCard/MediaCard.js +2 -2
- package/dist/components/Menu/Menu.js +6 -43
- package/dist/components/Menu/entries.d.ts +1 -30
- package/dist/components/Menu/entries.js +16 -100
- package/dist/components/MultiSelect/MultiSelect.js +43 -34
- package/dist/components/NumberInput/NumberInput.js +17 -18
- package/dist/components/OtpInput/OtpInput.d.ts +1 -1
- package/dist/components/OtpInput/OtpInput.js +10 -67
- package/dist/components/PageHeader/PageHeader.js +2 -2
- package/dist/components/Pagination/Pagination.js +3 -1
- package/dist/components/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/components/PasswordInput/PasswordInput.js +9 -4
- package/dist/components/Popover/Popover.d.ts +6 -7
- package/dist/components/Popover/Popover.js +2 -19
- package/dist/components/Progress/Progress.d.ts +1 -1
- package/dist/components/Progress/Progress.js +7 -11
- package/dist/components/Radio/Radio.d.ts +4 -2
- package/dist/components/RadioGroup/RadioGroup.d.ts +5 -12
- package/dist/components/RadioGroup/RadioGroup.js +6 -33
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +63 -0
- package/dist/components/RichTextEditor/RichTextEditor.js +175 -0
- package/dist/components/RichTextEditor/toolbar.d.ts +15 -0
- package/dist/components/RichTextEditor/toolbar.js +142 -0
- package/dist/components/RichTextEditor/uploads.d.ts +41 -0
- package/dist/components/RichTextEditor/uploads.js +124 -0
- package/dist/components/SearchInput/SearchInput.js +4 -2
- package/dist/components/SectionHeader/SectionHeader.js +1 -3
- package/dist/components/SegmentedControl/SegmentedControl.js +2 -12
- package/dist/components/Select/Select.d.ts +15 -16
- package/dist/components/Select/Select.js +11 -252
- package/dist/components/Slider/Slider.js +11 -21
- package/dist/components/Sparkline/Sparkline.js +8 -3
- package/dist/components/Spinner/Spinner.js +5 -2
- package/dist/components/Stack/Stack.d.ts +867 -5
- package/dist/components/Stack/Stack.js +2 -3
- package/dist/components/Stat/Stat.js +6 -3
- package/dist/components/Steps/Steps.js +6 -3
- package/dist/components/Switch/Switch.d.ts +7 -7
- package/dist/components/Switch/Switch.js +4 -10
- package/dist/components/Table/Table.js +38 -19
- package/dist/components/Tabs/Tabs.js +2 -22
- package/dist/components/Tag/Tag.js +3 -1
- package/dist/components/Text/Text.d.ts +9 -5
- package/dist/components/Text/Text.js +3 -4
- package/dist/components/TileGrid/TileGrid.js +1 -1
- package/dist/components/TimePicker/TimePicker.js +35 -33
- package/dist/components/Timeline/Timeline.js +5 -4
- package/dist/components/Toaster/Toaster.js +21 -17
- package/dist/components/Tooltip/Tooltip.d.ts +6 -6
- package/dist/components/Tooltip/Tooltip.js +3 -17
- package/dist/components/TreeView/TreeView.js +15 -12
- package/dist/components.css +281 -60
- package/dist/hooks/useTheme.js +6 -6
- package/dist/icons/message-circle.svg +1 -0
- package/dist/internal/CharCount.js +3 -1
- package/dist/internal/choice.d.ts +10 -48
- package/dist/internal/choice.js +8 -96
- package/dist/internal/describedBy.d.ts +3 -0
- package/dist/internal/describedBy.js +4 -0
- package/dist/internal/options.d.ts +10 -5
- package/dist/internal/options.js +25 -11
- package/dist/internal/status.d.ts +3 -2
- package/dist/internal/status.js +10 -2
- package/dist/internal/useScrollActive.js +2 -2
- package/dist/internal/useToday.d.ts +3 -0
- package/dist/internal/useToday.js +42 -0
- package/dist/lib/dates.js +25 -15
- package/dist/lib/format.js +11 -8
- package/dist/lib/icons.d.ts +5 -0
- package/dist/lib/icons.js +2 -0
- package/dist/lib/math.js +17 -5
- package/dist/lib/rich-text.d.ts +13 -0
- package/dist/lib/rich-text.js +62 -0
- package/dist/lib/space.d.ts +1 -2
- package/dist/lib/space.js +4 -1
- package/dist/lib/text.js +1 -1
- package/dist/lib/theme.js +1 -1
- package/dist/localization.d.ts +166 -0
- package/dist/localization.js +142 -0
- package/dist/tokens.css +2 -0
- package/dist/tokens.dtcg.json +10 -0
- package/dist/tokens.json +10 -0
- package/dist/types.d.ts +6 -1
- package/dist/vokality.css +283 -60
- package/dist/vokality.iife.js +35981 -9698
- package/docs/brand.md +8 -5
- package/docs/components/AppShell/README.md +1 -1
- package/docs/components/Badge/README.md +1 -1
- package/docs/components/BarChart/README.md +1 -0
- package/docs/components/Button/README.md +4 -2
- package/docs/components/ChatInbox/README.md +41 -0
- package/docs/components/ChatWidget/README.md +47 -0
- package/docs/components/Checkbox/README.md +7 -3
- package/docs/components/ContextMenu/README.md +7 -3
- package/docs/components/Dialog/README.md +9 -4
- package/docs/components/Drawer/README.md +1 -1
- package/docs/components/Field/README.md +1 -1
- package/docs/components/Fieldset/README.md +2 -2
- package/docs/components/Inline/README.md +1 -1
- package/docs/components/LineChart/README.md +1 -0
- package/docs/components/LocaleProvider/README.md +48 -0
- package/docs/components/Menu/README.md +13 -8
- package/docs/components/OtpInput/README.md +9 -5
- package/docs/components/PasswordInput/README.md +11 -2
- package/docs/components/Popover/README.md +6 -3
- package/docs/components/Progress/README.md +3 -1
- package/docs/components/RadioGroup/README.md +5 -2
- package/docs/components/RichTextEditor/README.md +84 -0
- package/docs/components/SegmentedControl/README.md +2 -0
- package/docs/components/Select/README.md +13 -17
- package/docs/components/Skeleton/README.md +1 -1
- package/docs/components/Slider/README.md +4 -2
- package/docs/components/Steps/README.md +1 -1
- package/docs/components/Switch/README.md +5 -2
- package/docs/components/Tabs/README.md +4 -2
- package/docs/components/Text/README.md +1 -1
- package/docs/components/Toaster/README.md +3 -1
- package/docs/components/Tooltip/README.md +5 -3
- package/package.json +49 -5
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useLocale } from "../../localization.js";
|
|
4
|
+
import { useSyncExternalStore } from "react";
|
|
4
5
|
import { Portal, Toast as Primitive } from "radix-ui";
|
|
5
6
|
import { Button } from "../Button/Button.js";
|
|
6
7
|
import { Icon } from "../Icon/Icon.js";
|
|
7
8
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
8
|
-
import { STATUS_ICON,
|
|
9
|
+
import { STATUS_ICON, statusWord } from "../../internal/status.js";
|
|
9
10
|
import { cx } from "../../lib/cx.js";
|
|
10
11
|
/** Module-level, so toast() works from anywhere; each mounted Toaster subscribes. */
|
|
11
12
|
export const toastStore = { items: [], listeners: [], seq: 0 };
|
|
12
13
|
export function emitToasts() {
|
|
13
|
-
toastStore.listeners.forEach((l) => l(toastStore.items.slice()));
|
|
14
|
+
toastStore.listeners.forEach((l) => { l(toastStore.items.slice()); });
|
|
14
15
|
}
|
|
15
16
|
function showToast(opts) {
|
|
16
17
|
const o = typeof opts === "string" ? { title: opts } : opts;
|
|
17
18
|
const key = ++toastStore.seq;
|
|
18
|
-
const id = o.id || "t" + key;
|
|
19
|
+
const id = o.id || "t" + String(key);
|
|
19
20
|
const item = { status: "info", duration: o.status === "danger" ? 0 : 5000, ...o, id, key };
|
|
20
21
|
// A toast with the same id replaces the old one and moves to the end (and is announced again).
|
|
21
22
|
toastStore.items = toastStore.items.filter((t) => t.id !== id).concat([item]);
|
|
@@ -36,28 +37,31 @@ export const toast = Object.assign(showToast, {
|
|
|
36
37
|
});
|
|
37
38
|
/** One toast (Radix Toast.Root). Radix runs its timer, pausing it while the pointer or focus is in the stack. */
|
|
38
39
|
export function ToastItem({ toast: t }) {
|
|
40
|
+
const { messages } = useLocale();
|
|
39
41
|
const action = t.action;
|
|
40
42
|
return (_jsxs(Primitive.Root, { className: cx("vk-toast", "vk-toast-" + t.status),
|
|
41
43
|
// Danger interrupts (assertive), the rest wait their turn (polite).
|
|
42
44
|
type: t.status === "danger" ? "foreground" : "background",
|
|
43
|
-
//
|
|
45
|
+
// The public data adapter maps persistence to Radix's native Infinity duration.
|
|
44
46
|
duration: t.duration > 0 ? t.duration : Infinity, open: true, onOpenChange: (open) => { if (!open)
|
|
45
47
|
toast.dismiss(t.id); }, "aria-atomic": "true",
|
|
46
48
|
// Follow the pointer while swiping; Radix sets the variable and clears it on cancel.
|
|
47
|
-
style: { translate: "var(--radix-toast-swipe-move-x, 0) 0" }, children: [_jsx(Icon, { name: STATUS_ICON[t.status], size: 18, className: "vk-alert-icon" }), _jsxs("div", { className: "vk-alert-body", children: [_jsx("span", { className: "vk-sr-only", children:
|
|
49
|
+
style: { translate: "var(--radix-toast-swipe-move-x, 0) 0" }, children: [_jsx(Icon, { name: STATUS_ICON[t.status], size: 18, className: "vk-alert-icon" }), _jsxs("div", { className: "vk-alert-body", children: [_jsx("span", { className: "vk-sr-only", children: statusWord(t.status, messages) + ": " }), _jsx(Primitive.Title, { asChild: true, children: _jsx("p", { className: "vk-alert-title", children: t.title }) }), t.description ? _jsxs(_Fragment, { children: [" ", _jsx(Primitive.Description, { className: "vk-alert-text", children: t.description })] }) : null, action
|
|
48
50
|
? (_jsxs(_Fragment, { children: [" ", _jsx("div", { className: "vk-alert-action", children: _jsx(Primitive.Action, { altText: action.label, asChild: true, children: _jsx(Button, { variant: "outline", size: "sm", onClick: () => action.onClick?.(), children: action.label }) }) })] }))
|
|
49
|
-
: null] }), _jsx(Primitive.Close, { asChild: true, children: _jsx(IconButton, { icon: "x", size: 16, label:
|
|
51
|
+
: null] }), _jsx(Primitive.Close, { asChild: true, children: _jsx(IconButton, { icon: "x", size: 16, label: messages.dismissNotification, className: "vk-alert-close" }) })] }));
|
|
52
|
+
}
|
|
53
|
+
const emptyServerToasts = [];
|
|
54
|
+
const readToasts = () => toastStore.items;
|
|
55
|
+
const readServerToasts = () => emptyServerToasts;
|
|
56
|
+
function subscribeToasts(onChange) {
|
|
57
|
+
const listener = () => { onChange(); };
|
|
58
|
+
toastStore.listeners.push(listener);
|
|
59
|
+
return () => { toastStore.listeners = toastStore.listeners.filter((item) => item !== listener); };
|
|
50
60
|
}
|
|
51
61
|
/** Toast stack; render once per app. Radix Toast: F8 focuses the stack, a swipe right dismisses a toast. */
|
|
52
62
|
export function Toaster({ max, position, label }) {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
const l = (items) => setToasts(items);
|
|
56
|
-
toastStore.listeners.push(l);
|
|
57
|
-
// Pick up anything shown between the first render and subscribing.
|
|
58
|
-
setToasts(toastStore.items.slice());
|
|
59
|
-
return () => { toastStore.listeners = toastStore.listeners.filter((x) => x !== l); };
|
|
60
|
-
}, []);
|
|
63
|
+
const { messages } = useLocale();
|
|
64
|
+
const toasts = useSyncExternalStore(subscribeToasts, readToasts, readServerToasts);
|
|
61
65
|
const items = toasts.slice(-(max || 3));
|
|
62
|
-
return (_jsxs(Primitive.Provider, { swipeDirection: "right", children: [items.map((t) => _jsx(ToastItem, { toast: t }, t.key)), _jsx(Portal.Root, { asChild: true, children: _jsx("div", { className: cx("vk-toaster", position === "top" ? "vk-toaster-top" : null), children: _jsx(Primitive.Viewport, { className: "vk-toast-list", label: label ||
|
|
66
|
+
return (_jsxs(Primitive.Provider, { swipeDirection: "right", label: messages.notificationAnnouncement, children: [items.map((t) => _jsx(ToastItem, { toast: t }, t.key)), _jsx(Portal.Root, { asChild: true, children: _jsx("div", { className: cx("vk-toaster", position === "top" ? "vk-toaster-top" : null), children: _jsx(Primitive.Viewport, { className: "vk-toast-list", label: label || messages.notifications }) }) })] }));
|
|
63
67
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { Tooltip as Primitive } from "radix-ui";
|
|
3
|
+
export interface TooltipProps extends Pick<Primitive.TooltipProps, 'open' | 'defaultOpen' | 'onOpenChange'> {
|
|
3
4
|
content: ReactNode;
|
|
4
5
|
children: ReactElement;
|
|
5
6
|
placement?: 'top' | 'bottom';
|
|
6
7
|
align?: 'center' | 'start';
|
|
7
|
-
delay?: number;
|
|
8
|
-
touchDuration?: number;
|
|
8
|
+
delay?: number;
|
|
9
9
|
}
|
|
10
|
-
/** Text label
|
|
11
|
-
export declare function Tooltip({ content, children, placement, align, delay,
|
|
10
|
+
/** Text label with Radix Tooltip's native hover, focus and dismissal behavior. */
|
|
11
|
+
export declare function Tooltip({ content, children, placement, align, delay, open, defaultOpen, onOpenChange }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useRef, useState } from "react";
|
|
4
3
|
import { Tooltip as Primitive } from "radix-ui";
|
|
5
|
-
/** Text label
|
|
6
|
-
export function Tooltip({ content, children, placement, align, delay,
|
|
7
|
-
|
|
8
|
-
const touchTimer = useRef();
|
|
9
|
-
useEffect(() => () => clearTimeout(touchTimer.current), []);
|
|
10
|
-
const onPointerUp = (e) => {
|
|
11
|
-
if (e.pointerType !== "touch")
|
|
12
|
-
return;
|
|
13
|
-
clearTimeout(touchTimer.current);
|
|
14
|
-
// After the click that follows the tap, which closes a Radix tooltip.
|
|
15
|
-
touchTimer.current = setTimeout(() => {
|
|
16
|
-
setOpen(true);
|
|
17
|
-
touchTimer.current = setTimeout(() => setOpen(false), touchDuration || 1500);
|
|
18
|
-
}, 0);
|
|
19
|
-
};
|
|
20
|
-
return (_jsx(Primitive.Provider, { delayDuration: delay ?? 400, children: _jsxs(Primitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(Primitive.Trigger, { asChild: true, onPointerUp: onPointerUp, children: children }), _jsx(Primitive.Portal, { children: _jsx(Primitive.Content, { className: "vk-tooltip", side: placement || "top", align: align === "start" ? "start" : "center", sideOffset: 6, collisionPadding: 8, children: content }) })] }) }));
|
|
4
|
+
/** Text label with Radix Tooltip's native hover, focus and dismissal behavior. */
|
|
5
|
+
export function Tooltip({ content, children, placement, align, delay, open, defaultOpen, onOpenChange }) {
|
|
6
|
+
return (_jsx(Primitive.Provider, { delayDuration: delay ?? 400, children: _jsxs(Primitive.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange, children: [_jsx(Primitive.Trigger, { asChild: true, children: children }), _jsx(Primitive.Portal, { children: _jsx(Primitive.Content, { className: "vk-tooltip", side: placement || "top", align: align === "start" ? "start" : "center", sideOffset: 6, collisionPadding: 8, children: content }) })] }) }));
|
|
21
7
|
}
|
|
@@ -24,9 +24,9 @@ export function TreeView({ items, selected: selectedProp, defaultSelected, onSel
|
|
|
24
24
|
// Set when the keyboard or a click moves focus, so the effect focuses the new item after render.
|
|
25
25
|
const moved = useRef(false);
|
|
26
26
|
useEffect(() => {
|
|
27
|
-
if (!moved.current || !ref.current)
|
|
27
|
+
if (!moved.current || !ref.current || focusId === undefined)
|
|
28
28
|
return;
|
|
29
|
-
const el = ref.current.querySelector('[data-id="' + focusId + '"]');
|
|
29
|
+
const el = ref.current.querySelector('[data-id="' + CSS.escape(focusId) + '"]');
|
|
30
30
|
if (el)
|
|
31
31
|
el.focus();
|
|
32
32
|
moved.current = false;
|
|
@@ -47,6 +47,11 @@ export function TreeView({ items, selected: selectedProp, defaultSelected, onSel
|
|
|
47
47
|
moved.current = true;
|
|
48
48
|
setFocusId(id);
|
|
49
49
|
};
|
|
50
|
+
const focusAt = (index) => {
|
|
51
|
+
const row = visible[index];
|
|
52
|
+
if (row)
|
|
53
|
+
focus(row.item.id);
|
|
54
|
+
};
|
|
50
55
|
const onKey = (e) => {
|
|
51
56
|
const idx = visible.findIndex((v) => v.item.id === focusId);
|
|
52
57
|
const cur = visible[idx];
|
|
@@ -58,19 +63,17 @@ export function TreeView({ items, selected: selectedProp, defaultSelected, onSel
|
|
|
58
63
|
const k = e.key;
|
|
59
64
|
if (k === "ArrowDown") {
|
|
60
65
|
e.preventDefault();
|
|
61
|
-
|
|
62
|
-
focus(visible[idx + 1].item.id);
|
|
66
|
+
focusAt(idx + 1);
|
|
63
67
|
}
|
|
64
68
|
else if (k === "ArrowUp") {
|
|
65
69
|
e.preventDefault();
|
|
66
|
-
|
|
67
|
-
focus(visible[idx - 1].item.id);
|
|
70
|
+
focusAt(idx - 1);
|
|
68
71
|
}
|
|
69
72
|
else if (k === "ArrowRight") {
|
|
70
73
|
e.preventDefault();
|
|
71
74
|
if (kids && !open)
|
|
72
75
|
toggle(it.id, true);
|
|
73
|
-
else if (kids)
|
|
76
|
+
else if (kids?.[0])
|
|
74
77
|
focus(kids[0].id);
|
|
75
78
|
}
|
|
76
79
|
else if (k === "ArrowLeft") {
|
|
@@ -82,11 +85,11 @@ export function TreeView({ items, selected: selectedProp, defaultSelected, onSel
|
|
|
82
85
|
}
|
|
83
86
|
else if (k === "Home") {
|
|
84
87
|
e.preventDefault();
|
|
85
|
-
|
|
88
|
+
focusAt(0);
|
|
86
89
|
}
|
|
87
90
|
else if (k === "End") {
|
|
88
91
|
e.preventDefault();
|
|
89
|
-
|
|
92
|
+
focusAt(visible.length - 1);
|
|
90
93
|
}
|
|
91
94
|
else if (k === "Enter" || k === " ") {
|
|
92
95
|
e.preventDefault();
|
|
@@ -102,7 +105,7 @@ export function TreeView({ items, selected: selectedProp, defaultSelected, onSel
|
|
|
102
105
|
// Type-ahead: the next visible item whose label starts with the typed character.
|
|
103
106
|
for (let n = 1; n <= visible.length; n++) {
|
|
104
107
|
const v = visible[(idx + n) % visible.length];
|
|
105
|
-
if (
|
|
108
|
+
if (v?.item.label.toLowerCase().startsWith(k.toLowerCase())) {
|
|
106
109
|
focus(v.item.id);
|
|
107
110
|
break;
|
|
108
111
|
}
|
|
@@ -121,7 +124,7 @@ export function TreeView({ items, selected: selectedProp, defaultSelected, onSel
|
|
|
121
124
|
select(it);
|
|
122
125
|
if (kids && toggleOnSelect !== false)
|
|
123
126
|
toggle(it.id);
|
|
124
|
-
}, children: [_jsxs("span", { className: cx("vk-tree-row", it.id === selected && "vk-tree-row-selected"), style: { paddingLeft: 0.5 + (level - 1) * 1.25 + "rem" }, children: [kids ? _jsx(Icon, { name: "chevron-right", size: 14, className: cx("vk-tree-caret", open && "vk-tree-caret-open") }) : _jsx("span", { className: "vk-tree-caret", "aria-hidden": "true" }), it.icon ? _jsx(Icon, { name: it.icon, size: 16, className: "vk-tree-icon" }) : null, _jsx("span", { className: "vk-tree-label", children: it.label }), it.meta ? _jsx("span", { className: "vk-tree-meta", children: it.meta }) : null] }), kids && open ? _jsx("ul", { role: "group", className: "vk-tree-group", children: renderLevel(kids, level + 1) }) : null] }, it.id));
|
|
127
|
+
}, children: [_jsxs("span", { className: cx("vk-tree-row", it.id === selected && "vk-tree-row-selected"), style: { paddingLeft: String(0.5 + (level - 1) * 1.25) + "rem" }, children: [kids ? _jsx(Icon, { name: "chevron-right", size: 14, className: cx("vk-tree-caret", open && "vk-tree-caret-open") }) : _jsx("span", { className: "vk-tree-caret", "aria-hidden": "true" }), it.icon ? _jsx(Icon, { name: it.icon, size: 16, className: "vk-tree-icon" }) : null, _jsx("span", { className: "vk-tree-label", children: it.label }), it.meta ? _jsx("span", { className: "vk-tree-meta", children: it.meta }) : null] }), kids && open ? _jsx("ul", { role: "group", className: "vk-tree-group", children: renderLevel(kids, level + 1) }) : null] }, it.id));
|
|
125
128
|
});
|
|
126
|
-
return (_jsx("ul", { ref: ref, role: "tree", "aria-label": label, className: cx("vk-tree", className), onKeyDown: onKey, children: renderLevel(items
|
|
129
|
+
return (_jsx("ul", { ref: ref, role: "tree", "aria-label": label, className: cx("vk-tree", className), onKeyDown: onKey, children: renderLevel(items, 1) }));
|
|
127
130
|
}
|