@tulipfarm/sprout 0.3.0 → 0.4.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/README.md +45 -40
- package/dist/components/accordion.d.ts +2 -2
- package/dist/components/accordion.js +9 -9
- package/dist/components/agent-fanout.d.ts +2 -2
- package/dist/components/agent-fanout.js +65 -87
- package/dist/components/alert-dialog.d.ts +6 -6
- package/dist/components/alert-dialog.js +20 -20
- package/dist/components/alert.d.ts +6 -6
- package/dist/components/alert.js +13 -13
- package/dist/components/aspect-ratio.d.ts +2 -2
- package/dist/components/aspect-ratio.js +2 -2
- package/dist/components/attachment.d.ts +17 -17
- package/dist/components/attachment.js +82 -115
- package/dist/components/avatar.d.ts +10 -10
- package/dist/components/avatar.js +14 -14
- package/dist/components/badge.d.ts +4 -4
- package/dist/components/badge.js +18 -18
- package/dist/components/board.d.ts +107 -0
- package/dist/components/board.js +640 -0
- package/dist/components/brand-icon.d.ts +6 -6
- package/dist/components/brand-icon.js +55 -63
- package/dist/components/breadcrumb.d.ts +11 -11
- package/dist/components/breadcrumb.js +16 -18
- package/dist/components/button-group.d.ts +6 -6
- package/dist/components/button-group.js +14 -14
- package/dist/components/button.d.ts +11 -11
- package/dist/components/button.js +46 -56
- package/dist/components/calendar.d.ts +5 -5
- package/dist/components/calendar.js +44 -53
- package/dist/components/canvas.d.ts +4 -4
- package/dist/components/canvas.js +39 -46
- package/dist/components/card.d.ts +6 -6
- package/dist/components/card.js +17 -17
- package/dist/components/carousel.d.ts +7 -7
- package/dist/components/carousel.js +57 -75
- package/dist/components/chart.d.ts +5 -112
- package/dist/components/chart.js +5 -172
- package/dist/components/chat-confirmation.d.ts +13 -11
- package/dist/components/chat-confirmation.js +32 -38
- package/dist/components/chat-input.d.ts +4 -4
- package/dist/components/chat-input.js +74 -81
- package/dist/components/chat-plan.d.ts +2 -2
- package/dist/components/chat-plan.js +15 -20
- package/dist/components/chat-sources.d.ts +8 -8
- package/dist/components/chat-sources.js +18 -27
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +9 -9
- package/dist/components/choice-list.d.ts +2 -2
- package/dist/components/choice-list.js +16 -18
- package/dist/components/code-block.d.ts +5 -5
- package/dist/components/code-block.js +26 -26
- package/dist/components/collapsible.d.ts +1 -1
- package/dist/components/collapsible.js +7 -11
- package/dist/components/combobox.d.ts +3 -3
- package/dist/components/combobox.js +24 -24
- package/dist/components/command.d.ts +13 -13
- package/dist/components/command.js +61 -73
- package/dist/components/context-menu.d.ts +5 -5
- package/dist/components/context-menu.js +22 -22
- package/dist/components/dialog.d.ts +6 -6
- package/dist/components/dialog.js +23 -28
- package/dist/components/direction.d.ts +1 -1
- package/dist/components/direction.js +1 -1
- package/dist/components/dropdown-menu.d.ts +5 -5
- package/dist/components/dropdown-menu.js +20 -20
- package/dist/components/field.d.ts +11 -11
- package/dist/components/field.js +41 -61
- package/dist/components/file-explorer.d.ts +2 -2
- package/dist/components/file-explorer.js +89 -105
- package/dist/components/file-viewer.d.ts +10 -10
- package/dist/components/file-viewer.js +112 -140
- package/dist/components/form.d.ts +7 -7
- package/dist/components/form.js +24 -28
- package/dist/components/glass-banner.d.ts +3 -3
- package/dist/components/glass-banner.js +21 -24
- package/dist/components/gradient-banner.d.ts +5 -5
- package/dist/components/gradient-banner.js +13 -22
- package/dist/components/hover-card.d.ts +4 -4
- package/dist/components/hover-card.js +6 -6
- package/dist/components/input-group.d.ts +11 -11
- package/dist/components/input-group.js +22 -36
- package/dist/components/input-otp.d.ts +10 -10
- package/dist/components/input-otp.js +13 -15
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +7 -7
- package/dist/components/kbd.d.ts +3 -3
- package/dist/components/kbd.js +5 -5
- package/dist/components/label.d.ts +2 -2
- package/dist/components/label.js +2 -2
- package/dist/components/mention-list.d.ts +3 -3
- package/dist/components/mention-list.js +10 -10
- package/dist/components/menubar.d.ts +6 -6
- package/dist/components/menubar.js +22 -22
- package/dist/components/message-actions.d.ts +2 -2
- package/dist/components/message-actions.js +29 -31
- package/dist/components/message-response.d.ts +3 -3
- package/dist/components/message-response.js +18 -18
- package/dist/components/message-scroller.d.ts +12 -12
- package/dist/components/message-scroller.js +44 -56
- package/dist/components/message.d.ts +11 -11
- package/dist/components/message.js +25 -25
- package/dist/components/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu.js +15 -15
- package/dist/components/notice-banner.d.ts +2 -2
- package/dist/components/notice-banner.js +2 -2
- package/dist/components/page-content.d.ts +2 -2
- package/dist/components/page-content.js +2 -2
- package/dist/components/page-header.d.ts +1 -1
- package/dist/components/page-header.js +16 -16
- package/dist/components/pagination.d.ts +9 -9
- package/dist/components/pagination.js +17 -17
- package/dist/components/plan-outline.d.ts +2 -2
- package/dist/components/plan-outline.js +43 -60
- package/dist/components/popover.d.ts +6 -6
- package/dist/components/popover.js +15 -15
- package/dist/components/presence-cursor.d.ts +2 -2
- package/dist/components/presence-cursor.js +3 -3
- package/dist/components/progress.d.ts +1 -1
- package/dist/components/progress.js +8 -8
- package/dist/components/prompt-list.d.ts +3 -3
- package/dist/components/prompt-list.js +6 -6
- package/dist/components/questionnaire.d.ts +19 -19
- package/dist/components/questionnaire.js +183 -242
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +6 -6
- package/dist/components/reasoning-effort.d.ts +3 -3
- package/dist/components/reasoning-effort.js +9 -12
- package/dist/components/record-list.d.ts +66 -0
- package/dist/components/record-list.js +151 -0
- package/dist/components/resizable.d.ts +5 -5
- package/dist/components/resizable.js +76 -102
- package/dist/components/result-card.d.ts +10 -5
- package/dist/components/result-card.js +42 -53
- package/dist/components/result-notice.d.ts +18 -0
- package/dist/components/result-notice.js +29 -0
- package/dist/components/review-card.d.ts +6 -6
- package/dist/components/review-card.js +18 -18
- package/dist/components/rich-text-editor.d.ts +2 -2
- package/dist/components/rich-text-editor.js +56 -72
- package/dist/components/schema-diagram.d.ts +3 -3
- package/dist/components/schema-diagram.js +39 -53
- package/dist/components/scroll-area.d.ts +1 -1
- package/dist/components/scroll-area.js +10 -14
- package/dist/components/search-dialog.d.ts +6 -6
- package/dist/components/search-dialog.js +16 -16
- package/dist/components/search-field.d.ts +1 -1
- package/dist/components/search-field.js +11 -11
- package/dist/components/select.d.ts +3 -3
- package/dist/components/select.js +20 -20
- package/dist/components/selection-slot.d.ts +2 -2
- package/dist/components/selection-slot.js +6 -9
- package/dist/components/separator.d.ts +15 -15
- package/dist/components/separator.js +22 -27
- package/dist/components/settings-list.d.ts +3 -3
- package/dist/components/settings-list.js +5 -5
- package/dist/components/sheet.d.ts +6 -6
- package/dist/components/sheet.js +27 -27
- package/dist/components/sidebar.d.ts +22 -22
- package/dist/components/sidebar.js +57 -58
- package/dist/components/skeleton.d.ts +5 -5
- package/dist/components/skeleton.js +14 -21
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/slider.js +6 -6
- package/dist/components/spinner.d.ts +5 -5
- package/dist/components/spinner.js +22 -26
- package/dist/components/sql-viewer.d.ts +14 -14
- package/dist/components/sql-viewer.js +99 -128
- package/dist/components/state-panel-samples.d.ts +2 -2
- package/dist/components/state-panel-samples.js +209 -245
- package/dist/components/state-panel.d.ts +2 -35
- package/dist/components/state-panel.js +2 -29
- package/dist/components/state-sample.d.ts +7 -7
- package/dist/components/state-sample.js +18 -31
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/switch.js +7 -7
- package/dist/components/table-nuqs.d.ts +2 -2
- package/dist/components/table-nuqs.js +11 -12
- package/dist/components/table.d.ts +4 -4
- package/dist/components/table.js +166 -235
- package/dist/components/tabs.d.ts +2 -2
- package/dist/components/tabs.js +12 -12
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +6 -8
- package/dist/components/timeline.d.ts +3 -0
- package/dist/components/timeline.js +3 -0
- package/dist/components/toast.d.ts +2 -2
- package/dist/components/toast.js +19 -25
- package/dist/components/toggle-group.d.ts +2 -2
- package/dist/components/toggle-group.js +18 -20
- package/dist/components/toggle.d.ts +2 -2
- package/dist/components/toggle.js +8 -8
- package/dist/components/tool-activity.d.ts +1 -1
- package/dist/components/tool-activity.js +83 -110
- package/dist/components/toolbar-status.d.ts +2 -2
- package/dist/components/toolbar-status.js +7 -7
- package/dist/components/tooltip.d.ts +5 -5
- package/dist/components/tooltip.js +12 -11
- package/dist/components/typed-text.d.ts +2 -2
- package/dist/components/typed-text.js +10 -12
- package/dist/components/view-switcher.d.ts +51 -0
- package/dist/components/view-switcher.js +114 -0
- package/dist/index.d.ts +98 -93
- package/dist/index.js +98 -93
- package/dist/internal/chart-kit.d.ts +142 -0
- package/dist/internal/chart-kit.js +200 -0
- package/dist/internal/charts/bars.d.ts +61 -0
- package/dist/internal/charts/bars.js +86 -0
- package/dist/internal/charts/lines.d.ts +67 -0
- package/dist/internal/charts/lines.js +70 -0
- package/dist/internal/charts/more.d.ts +77 -0
- package/dist/internal/charts/more.js +68 -0
- package/dist/internal/charts/parts.d.ts +54 -0
- package/dist/internal/charts/parts.js +82 -0
- package/dist/internal/charts/timeline-dates.d.ts +38 -0
- package/dist/internal/charts/timeline-dates.js +113 -0
- package/dist/internal/charts/timeline-window.d.ts +31 -0
- package/dist/internal/charts/timeline-window.js +26 -0
- package/dist/internal/charts/timeline.d.ts +72 -0
- package/dist/internal/charts/timeline.js +287 -0
- package/dist/internal/classes.d.ts +1 -1
- package/dist/internal/classes.js +7 -9
- package/dist/internal/code-tokens.d.ts +2 -2
- package/dist/internal/code-tokens.js +12 -12
- package/dist/internal/fieldset.d.ts +1 -1
- package/dist/internal/fieldset.js +6 -6
- package/dist/internal/file-kind.d.ts +1 -1
- package/dist/internal/file-kind.js +43 -51
- package/dist/internal/flow.d.ts +4 -4
- package/dist/internal/flow.js +20 -23
- package/dist/internal/languages.js +999 -999
- package/dist/internal/message-scroller.d.ts +3 -3
- package/dist/internal/message-scroller.js +64 -112
- package/dist/internal/pressable.d.ts +1 -1
- package/dist/internal/pressable.js +7 -7
- package/dist/internal/state-panel.d.ts +35 -0
- package/dist/internal/state-panel.js +22 -0
- package/dist/internal/syntax.d.ts +2 -2
- package/dist/internal/syntax.js +36 -47
- package/dist/styles/accordion.css +3 -5
- package/dist/styles/agent-fanout.css +64 -60
- package/dist/styles/alert-dialog.css +12 -26
- package/dist/styles/alert.css +10 -15
- package/dist/styles/attachment.css +51 -93
- package/dist/styles/avatar.css +17 -24
- package/dist/styles/badge.css +11 -36
- package/dist/styles/board.css +571 -0
- package/dist/styles/brand-icon.css +7 -8
- package/dist/styles/breadcrumb.css +4 -7
- package/dist/styles/button-group.css +8 -14
- package/dist/styles/button.css +22 -27
- package/dist/styles/calendar.css +24 -36
- package/dist/styles/canvas.css +2 -3
- package/dist/styles/card.css +7 -23
- package/dist/styles/carousel.css +11 -12
- package/dist/styles/chart.css +215 -31
- package/dist/styles/chat-input.css +15 -39
- package/dist/styles/chat-plan.css +3 -4
- package/dist/styles/chat-sources.css +3 -6
- package/dist/styles/checkbox.css +11 -25
- package/dist/styles/choice-list.css +17 -31
- package/dist/styles/code-block.css +11 -25
- package/dist/styles/collapsible.css +10 -15
- package/dist/styles/combobox.css +11 -15
- package/dist/styles/command.css +5 -8
- package/dist/styles/context-menu.css +2 -2
- package/dist/styles/dialog.css +5 -16
- package/dist/styles/dropdown-menu.css +2 -2
- package/dist/styles/field.css +15 -21
- package/dist/styles/file-explorer.css +19 -33
- package/dist/styles/file-viewer.css +13 -17
- package/dist/styles/form.css +3 -3
- package/dist/styles/glass-banner.css +12 -47
- package/dist/styles/gradient-banner.css +17 -35
- package/dist/styles/hover-card.css +9 -15
- package/dist/styles/index.css +116 -108
- package/dist/styles/input-group.css +25 -41
- package/dist/styles/input-otp.css +5 -6
- package/dist/styles/input.css +5 -5
- package/dist/styles/kbd.css +1 -1
- package/dist/styles/label.css +9 -30
- package/dist/styles/mention-list.css +6 -8
- package/dist/styles/menubar.css +5 -6
- package/dist/styles/message-actions.css +1 -1
- package/dist/styles/message-response.css +3 -5
- package/dist/styles/message-scroller.css +14 -21
- package/dist/styles/message.css +23 -60
- package/dist/styles/navigation-menu.css +14 -29
- package/dist/styles/notice-banner.css +1 -2
- package/dist/styles/page-header.css +7 -10
- package/dist/styles/pagination.css +1 -4
- package/dist/styles/plan-outline.css +20 -37
- package/dist/styles/popover.css +10 -19
- package/dist/styles/presence-cursor.css +1 -2
- package/dist/styles/progress.css +2 -4
- package/dist/styles/prompt-list.css +6 -17
- package/dist/styles/questionnaire.css +16 -40
- package/dist/styles/radio-group.css +12 -23
- package/dist/styles/reasoning-effort.css +8 -15
- package/dist/styles/record-list.css +243 -0
- package/dist/styles/resizable.css +10 -11
- package/dist/styles/result-card.css +17 -3
- package/dist/styles/result-notice.css +80 -0
- package/dist/styles/review-card.css +2 -3
- package/dist/styles/rich-text-editor.css +1 -2
- package/dist/styles/schema-diagram.css +12 -17
- package/dist/styles/scroll-area.css +8 -10
- package/dist/styles/search-dialog.css +1 -5
- package/dist/styles/search-field.css +1 -2
- package/dist/styles/select.css +7 -7
- package/dist/styles/selection-slot.css +1 -2
- package/dist/styles/separator.css +7 -8
- package/dist/styles/settings-list.css +1 -2
- package/dist/styles/sheet.css +40 -73
- package/dist/styles/sidebar.css +17 -21
- package/dist/styles/skeleton.css +9 -11
- package/dist/styles/slider.css +11 -21
- package/dist/styles/spinner.css +2 -2
- package/dist/styles/sql-viewer.css +29 -29
- package/dist/styles/state-panel.css +8 -9
- package/dist/styles/state-sample.css +20 -33
- package/dist/styles/switch.css +11 -18
- package/dist/styles/table.css +51 -77
- package/dist/styles/tabs.css +12 -16
- package/dist/styles/textarea.css +3 -3
- package/dist/styles/themes/chatgpt.css +11 -23
- package/dist/styles/themes/claude.css +12 -24
- package/dist/styles/themes/cloudflare.css +11 -23
- package/dist/styles/themes/discord.css +11 -23
- package/dist/styles/themes/github.css +11 -23
- package/dist/styles/themes/grok.css +11 -23
- package/dist/styles/themes/linear.css +12 -25
- package/dist/styles/themes/neutral.css +11 -23
- package/dist/styles/themes/notion.css +11 -23
- package/dist/styles/themes/perplexity.css +11 -23
- package/dist/styles/themes/raycast.css +11 -23
- package/dist/styles/themes/spotify.css +11 -23
- package/dist/styles/themes/stripe.css +11 -23
- package/dist/styles/themes/supabase.css +11 -23
- package/dist/styles/themes/tulipfarm.css +9 -10
- package/dist/styles/themes/vercel.css +12 -25
- package/dist/styles/timeline.css +276 -0
- package/dist/styles/toast.css +13 -20
- package/dist/styles/toggle-group.css +17 -23
- package/dist/styles/toggle.css +8 -8
- package/dist/styles/tool-activity.css +7 -13
- package/dist/styles/toolbar-status.css +2 -7
- package/dist/styles/tooltip.css +15 -21
- package/dist/styles/view-switcher.css +279 -0
- package/package.json +21 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Tabs as BaseTabs } from '@base-ui/react/tabs';
|
|
4
|
+
import { useEffect, useId, useLayoutEffect, useRef, } from 'react';
|
|
5
|
+
import { Check } from 'reicon-react/icons/Check';
|
|
6
|
+
import { Plus } from 'reicon-react/icons/Plus';
|
|
7
|
+
import { X } from 'reicon-react/icons/X';
|
|
8
|
+
import { cn } from '../internal/classes.js';
|
|
9
|
+
import { Button } from './button.js';
|
|
10
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from './dropdown-menu.js';
|
|
11
|
+
import { Tabs, TabsList, TabsTrigger } from './tabs.js';
|
|
12
|
+
/** The `id` of a view's tab, for the panel's `aria-labelledby`. Needs the same `panelId` as the switcher. */
|
|
13
|
+
export function viewSwitcherTabId(panelId, viewId) {
|
|
14
|
+
return `${panelId}-tab-${viewId}`;
|
|
15
|
+
}
|
|
16
|
+
const fade = 24;
|
|
17
|
+
/**
|
|
18
|
+
* The bar of a table's open views, with an "Add view" menu. It is fully
|
|
19
|
+
* controlled: the app owns which views exist, are open, or can close.
|
|
20
|
+
*/
|
|
21
|
+
export function ViewSwitcher({ views, value, onValueChange, options, onAdd, onClose, label = 'Views', addLabel = 'Add view', actions, panelId, className, }) {
|
|
22
|
+
const baseId = useId();
|
|
23
|
+
const listRef = useRef(null);
|
|
24
|
+
const tabs = useRef(new Map());
|
|
25
|
+
const pendingFocus = useRef(null);
|
|
26
|
+
const open = new Set(views.map(view => view.id));
|
|
27
|
+
const tabId = (id) => (panelId ? viewSwitcherTabId(panelId, id) : `${baseId}-tab-${id}`);
|
|
28
|
+
function close(index) {
|
|
29
|
+
const view = views[index];
|
|
30
|
+
if (!view || !view.closable || !onClose)
|
|
31
|
+
return;
|
|
32
|
+
const tab = tabs.current.get(view.id);
|
|
33
|
+
if (tab && tab === document.activeElement) {
|
|
34
|
+
pendingFocus.current = { closed: view.id, neighbour: (views[index + 1] ?? views[index - 1])?.id };
|
|
35
|
+
}
|
|
36
|
+
onClose(view.id);
|
|
37
|
+
}
|
|
38
|
+
function onTabKeyDown(event, index) {
|
|
39
|
+
if (event.key !== 'Delete' && event.key !== 'Backspace')
|
|
40
|
+
return;
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
close(index);
|
|
43
|
+
}
|
|
44
|
+
useLayoutEffect(() => {
|
|
45
|
+
const pending = pendingFocus.current;
|
|
46
|
+
if (!pending || open.has(pending.closed))
|
|
47
|
+
return;
|
|
48
|
+
pendingFocus.current = null;
|
|
49
|
+
const target = value !== pending.closed && open.has(value) ? value : pending.neighbour;
|
|
50
|
+
if (target)
|
|
51
|
+
tabs.current.get(target)?.focus();
|
|
52
|
+
}, [views, value]);
|
|
53
|
+
useLayoutEffect(() => {
|
|
54
|
+
const list = listRef.current;
|
|
55
|
+
const tab = tabs.current.get(value);
|
|
56
|
+
if (!list || !tab || list.scrollWidth <= list.clientWidth)
|
|
57
|
+
return;
|
|
58
|
+
const bounds = list.getBoundingClientRect();
|
|
59
|
+
const rect = tab.getBoundingClientRect();
|
|
60
|
+
if (rect.left < bounds.left + fade)
|
|
61
|
+
list.scrollLeft -= bounds.left + fade - rect.left;
|
|
62
|
+
else if (rect.right > bounds.right - fade)
|
|
63
|
+
list.scrollLeft += rect.right - (bounds.right - fade);
|
|
64
|
+
}, [value, views]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const list = listRef.current;
|
|
67
|
+
if (!list)
|
|
68
|
+
return;
|
|
69
|
+
const update = () => {
|
|
70
|
+
const scrolled = Math.abs(list.scrollLeft);
|
|
71
|
+
const max = list.scrollWidth - list.clientWidth;
|
|
72
|
+
list.toggleAttribute('data-overflow-start', scrolled > 1);
|
|
73
|
+
list.toggleAttribute('data-overflow-end', max - scrolled > 1);
|
|
74
|
+
};
|
|
75
|
+
update();
|
|
76
|
+
list.addEventListener('scroll', update, { passive: true });
|
|
77
|
+
const observer = new ResizeObserver(update);
|
|
78
|
+
observer.observe(list);
|
|
79
|
+
for (const child of list.children)
|
|
80
|
+
observer.observe(child);
|
|
81
|
+
return () => {
|
|
82
|
+
list.removeEventListener('scroll', update);
|
|
83
|
+
observer.disconnect();
|
|
84
|
+
};
|
|
85
|
+
}, [views]);
|
|
86
|
+
return (_jsxs("div", { "data-slot": "view-switcher", className: cn('sprout-view-switcher', className), children: [_jsx(Tabs, { className: "sprout-view-switcher-tabs", value: open.has(value) ? value : null, onValueChange: next => {
|
|
87
|
+
if (typeof next === 'string')
|
|
88
|
+
onValueChange(next);
|
|
89
|
+
}, children: _jsxs(TabsList, { ref: listRef, variant: "line", activateOnFocus: true, loopFocus: false, "aria-label": label, className: "sprout-view-switcher-list", children: [views.map((view, index) => {
|
|
90
|
+
const Icon = view.icon;
|
|
91
|
+
const closable = Boolean(view.closable && onClose);
|
|
92
|
+
return (_jsxs(TabsTrigger, { value: view.id, id: tabId(view.id), ref: (node) => {
|
|
93
|
+
if (node)
|
|
94
|
+
tabs.current.set(view.id, node);
|
|
95
|
+
else
|
|
96
|
+
tabs.current.delete(view.id);
|
|
97
|
+
}, className: "sprout-view-switcher-tab", "data-closable": closable || undefined, "aria-keyshortcuts": closable ? 'Delete' : undefined, ...(panelId ? { 'aria-controls': panelId } : {}), onKeyDown: event => onTabKeyDown(event, index), children: [_jsx("span", { className: "sprout-view-switcher-icon", "aria-hidden": "true", children: _jsx(Icon, { size: 14 }) }), _jsx("span", { className: "sprout-view-switcher-label", children: view.label }), closable && (_jsx("span", { "aria-hidden": "true", title: `Close ${view.label}`, "data-slot": "view-switcher-close", className: "sprout-view-switcher-close", onPointerDown: event => {
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
}, onMouseDown: event => event.preventDefault(), onClick: event => {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
event.stopPropagation();
|
|
103
|
+
close(index);
|
|
104
|
+
}, children: _jsx(X, { size: 12 }) }))] }, view.id));
|
|
105
|
+
}), _jsx(BaseTabs.Indicator, { className: "sprout-view-switcher-indicator" })] }) }), options && (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "ghost", size: "sm", className: "sprout-view-switcher-add" }), "data-slot": "view-switcher-add", children: [_jsx(Plus, { size: 14, "aria-hidden": "true", "data-icon": "inline-start" }), _jsx("span", { className: "sprout-view-switcher-add-label", children: addLabel })] }), _jsx(DropdownMenuContent, { align: "start", size: "menu", className: "sprout-view-switcher-menu", children: _jsx("div", { className: "sprout-view-switcher-options", children: options.map(option => (_jsx(ViewOption, { option: option, baseId: baseId, isOpen: open.has(option.id), onSelect: () => onAdd?.(option.id) }, option.id))) }) })] })), actions != null && actions !== false && (_jsx("div", { "data-slot": "view-switcher-actions", className: "sprout-view-switcher-actions", children: actions }))] }));
|
|
106
|
+
}
|
|
107
|
+
function ViewOption({ option, baseId, isOpen, onSelect, }) {
|
|
108
|
+
const Icon = option.icon;
|
|
109
|
+
const unavailable = Boolean(option.unavailable);
|
|
110
|
+
const titleId = `${baseId}-option-${option.id}-title`;
|
|
111
|
+
const noteId = `${baseId}-option-${option.id}-note`;
|
|
112
|
+
const openId = `${baseId}-option-${option.id}-open`;
|
|
113
|
+
return (_jsxs(DropdownMenuItem, { "data-slot": "view-switcher-option", className: "sprout-view-switcher-option", disabled: unavailable, "data-open": isOpen || undefined, "aria-labelledby": titleId, "aria-describedby": isOpen ? `${openId} ${noteId}` : noteId, onClick: unavailable ? undefined : onSelect, children: [_jsx("span", { className: "sprout-view-switcher-tile", "aria-hidden": "true", children: _jsx(Icon, { size: 16 }) }), _jsxs("span", { className: "sprout-view-switcher-option-text", children: [_jsx("span", { id: titleId, className: "sprout-view-switcher-option-title", children: option.label }), _jsx("span", { id: noteId, className: "sprout-view-switcher-option-note", "data-kind": unavailable ? 'unavailable' : 'description', children: option.unavailable || option.description })] }), isOpen && (_jsxs("span", { className: "sprout-view-switcher-check", children: [_jsx(Check, { size: 16, "aria-hidden": "true" }), _jsx("span", { id: openId, className: "sprout-view-switcher-sr-only", children: "Already open." })] }))] }));
|
|
114
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,93 +1,98 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
export * from
|
|
24
|
-
export * from
|
|
25
|
-
export * from
|
|
26
|
-
export * from
|
|
27
|
-
export * from
|
|
28
|
-
export * from
|
|
29
|
-
export * from
|
|
30
|
-
export * from
|
|
31
|
-
export * from
|
|
32
|
-
export * from
|
|
33
|
-
export * from
|
|
34
|
-
export * from
|
|
35
|
-
export * from
|
|
36
|
-
export * from
|
|
37
|
-
export * from
|
|
38
|
-
export * from
|
|
39
|
-
export * from
|
|
40
|
-
export * from
|
|
41
|
-
export * from
|
|
42
|
-
export * from
|
|
43
|
-
export * from
|
|
44
|
-
export * from
|
|
45
|
-
export * from
|
|
46
|
-
export * from
|
|
47
|
-
export * from
|
|
48
|
-
export * from
|
|
49
|
-
export * from
|
|
50
|
-
export * from
|
|
51
|
-
export * from
|
|
52
|
-
export * from
|
|
53
|
-
export * from
|
|
54
|
-
export * from
|
|
55
|
-
export * from
|
|
56
|
-
export * from
|
|
57
|
-
export * from
|
|
58
|
-
export * from
|
|
59
|
-
export * from
|
|
60
|
-
export * from
|
|
61
|
-
export * from
|
|
62
|
-
export * from
|
|
63
|
-
export * from
|
|
64
|
-
export * from
|
|
65
|
-
export * from
|
|
66
|
-
export * from
|
|
67
|
-
export * from
|
|
68
|
-
export * from
|
|
69
|
-
export * from
|
|
70
|
-
export * from
|
|
71
|
-
export * from
|
|
72
|
-
export * from
|
|
73
|
-
export * from
|
|
74
|
-
export * from
|
|
75
|
-
export * from
|
|
76
|
-
export * from
|
|
77
|
-
export * from
|
|
78
|
-
export * from
|
|
79
|
-
export * from
|
|
80
|
-
export * from
|
|
81
|
-
export * from
|
|
82
|
-
export * from
|
|
83
|
-
export * from
|
|
84
|
-
export * from
|
|
85
|
-
export * from
|
|
86
|
-
export * from
|
|
87
|
-
export * from
|
|
88
|
-
export * from
|
|
89
|
-
export * from
|
|
90
|
-
export * from
|
|
91
|
-
export * from
|
|
92
|
-
export * from
|
|
93
|
-
export * from
|
|
1
|
+
export * from './components/accordion.js';
|
|
2
|
+
export * from './components/agent-fanout.js';
|
|
3
|
+
export * from './components/alert.js';
|
|
4
|
+
export * from './components/alert-dialog.js';
|
|
5
|
+
export * from './components/aspect-ratio.js';
|
|
6
|
+
export * from './components/attachment.js';
|
|
7
|
+
export * from './components/avatar.js';
|
|
8
|
+
export * from './components/badge.js';
|
|
9
|
+
export * from './components/board.js';
|
|
10
|
+
export * from './components/brand-icon.js';
|
|
11
|
+
export * from './components/breadcrumb.js';
|
|
12
|
+
export * from './components/button.js';
|
|
13
|
+
export * from './components/button-group.js';
|
|
14
|
+
export * from './components/calendar.js';
|
|
15
|
+
export * from './components/canvas.js';
|
|
16
|
+
export * from './components/card.js';
|
|
17
|
+
export * from './components/carousel.js';
|
|
18
|
+
export * from './components/chart.js';
|
|
19
|
+
export * from './components/timeline.js';
|
|
20
|
+
export * from './components/chat-confirmation.js';
|
|
21
|
+
export * from './components/chat-input.js';
|
|
22
|
+
export * from './components/chat-plan.js';
|
|
23
|
+
export * from './components/chat-sources.js';
|
|
24
|
+
export * from './components/checkbox.js';
|
|
25
|
+
export * from './components/choice-list.js';
|
|
26
|
+
export * from './components/code-block.js';
|
|
27
|
+
export * from './components/collapsible.js';
|
|
28
|
+
export * from './components/combobox.js';
|
|
29
|
+
export * from './components/command.js';
|
|
30
|
+
export * from './components/context-menu.js';
|
|
31
|
+
export * from './components/dialog.js';
|
|
32
|
+
export * from './components/direction.js';
|
|
33
|
+
export * from './components/dropdown-menu.js';
|
|
34
|
+
export * from './components/field.js';
|
|
35
|
+
export * from './components/file-explorer.js';
|
|
36
|
+
export * from './components/file-viewer.js';
|
|
37
|
+
export * from './components/form.js';
|
|
38
|
+
export * from './components/glass-banner.js';
|
|
39
|
+
export * from './components/gradient-banner.js';
|
|
40
|
+
export * from './components/hover-card.js';
|
|
41
|
+
export * from './components/input.js';
|
|
42
|
+
export * from './components/input-group.js';
|
|
43
|
+
export * from './components/input-otp.js';
|
|
44
|
+
export * from './components/kbd.js';
|
|
45
|
+
export * from './components/label.js';
|
|
46
|
+
export * from './components/mention-list.js';
|
|
47
|
+
export * from './components/menubar.js';
|
|
48
|
+
export * from './components/message.js';
|
|
49
|
+
export * from './components/message-actions.js';
|
|
50
|
+
export * from './components/message-response.js';
|
|
51
|
+
export * from './components/message-scroller.js';
|
|
52
|
+
export * from './components/navigation-menu.js';
|
|
53
|
+
export * from './components/notice-banner.js';
|
|
54
|
+
export * from './components/page-content.js';
|
|
55
|
+
export * from './components/page-header.js';
|
|
56
|
+
export * from './components/pagination.js';
|
|
57
|
+
export * from './components/plan-outline.js';
|
|
58
|
+
export * from './components/popover.js';
|
|
59
|
+
export * from './components/presence-cursor.js';
|
|
60
|
+
export * from './components/progress.js';
|
|
61
|
+
export * from './components/prompt-list.js';
|
|
62
|
+
export * from './components/questionnaire.js';
|
|
63
|
+
export * from './components/radio-group.js';
|
|
64
|
+
export * from './components/reasoning-effort.js';
|
|
65
|
+
export * from './components/record-list.js';
|
|
66
|
+
export * from './components/resizable.js';
|
|
67
|
+
export * from './components/result-card.js';
|
|
68
|
+
export * from './components/result-notice.js';
|
|
69
|
+
export * from './components/review-card.js';
|
|
70
|
+
export * from './components/rich-text-editor.js';
|
|
71
|
+
export * from './components/schema-diagram.js';
|
|
72
|
+
export * from './components/sql-viewer.js';
|
|
73
|
+
export * from './components/scroll-area.js';
|
|
74
|
+
export * from './components/search-dialog.js';
|
|
75
|
+
export * from './components/search-field.js';
|
|
76
|
+
export * from './components/select.js';
|
|
77
|
+
export * from './components/selection-slot.js';
|
|
78
|
+
export * from './components/separator.js';
|
|
79
|
+
export * from './components/settings-list.js';
|
|
80
|
+
export * from './components/sheet.js';
|
|
81
|
+
export * from './components/sidebar.js';
|
|
82
|
+
export * from './components/skeleton.js';
|
|
83
|
+
export * from './components/slider.js';
|
|
84
|
+
export * from './components/spinner.js';
|
|
85
|
+
export * from './components/state-panel.js';
|
|
86
|
+
export * from './components/state-sample.js';
|
|
87
|
+
export * from './components/switch.js';
|
|
88
|
+
export * from './components/table.js';
|
|
89
|
+
export * from './components/tabs.js';
|
|
90
|
+
export * from './components/textarea.js';
|
|
91
|
+
export * from './components/toast.js';
|
|
92
|
+
export * from './components/toggle.js';
|
|
93
|
+
export * from './components/toggle-group.js';
|
|
94
|
+
export * from './components/tool-activity.js';
|
|
95
|
+
export * from './components/toolbar-status.js';
|
|
96
|
+
export * from './components/tooltip.js';
|
|
97
|
+
export * from './components/typed-text.js';
|
|
98
|
+
export * from './components/view-switcher.js';
|
package/dist/index.js
CHANGED
|
@@ -1,93 +1,98 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
export * from
|
|
24
|
-
export * from
|
|
25
|
-
export * from
|
|
26
|
-
export * from
|
|
27
|
-
export * from
|
|
28
|
-
export * from
|
|
29
|
-
export * from
|
|
30
|
-
export * from
|
|
31
|
-
export * from
|
|
32
|
-
export * from
|
|
33
|
-
export * from
|
|
34
|
-
export * from
|
|
35
|
-
export * from
|
|
36
|
-
export * from
|
|
37
|
-
export * from
|
|
38
|
-
export * from
|
|
39
|
-
export * from
|
|
40
|
-
export * from
|
|
41
|
-
export * from
|
|
42
|
-
export * from
|
|
43
|
-
export * from
|
|
44
|
-
export * from
|
|
45
|
-
export * from
|
|
46
|
-
export * from
|
|
47
|
-
export * from
|
|
48
|
-
export * from
|
|
49
|
-
export * from
|
|
50
|
-
export * from
|
|
51
|
-
export * from
|
|
52
|
-
export * from
|
|
53
|
-
export * from
|
|
54
|
-
export * from
|
|
55
|
-
export * from
|
|
56
|
-
export * from
|
|
57
|
-
export * from
|
|
58
|
-
export * from
|
|
59
|
-
export * from
|
|
60
|
-
export * from
|
|
61
|
-
export * from
|
|
62
|
-
export * from
|
|
63
|
-
export * from
|
|
64
|
-
export * from
|
|
65
|
-
export * from
|
|
66
|
-
export * from
|
|
67
|
-
export * from
|
|
68
|
-
export * from
|
|
69
|
-
export * from
|
|
70
|
-
export * from
|
|
71
|
-
export * from
|
|
72
|
-
export * from
|
|
73
|
-
export * from
|
|
74
|
-
export * from
|
|
75
|
-
export * from
|
|
76
|
-
export * from
|
|
77
|
-
export * from
|
|
78
|
-
export * from
|
|
79
|
-
export * from
|
|
80
|
-
export * from
|
|
81
|
-
export * from
|
|
82
|
-
export * from
|
|
83
|
-
export * from
|
|
84
|
-
export * from
|
|
85
|
-
export * from
|
|
86
|
-
export * from
|
|
87
|
-
export * from
|
|
88
|
-
export * from
|
|
89
|
-
export * from
|
|
90
|
-
export * from
|
|
91
|
-
export * from
|
|
92
|
-
export * from
|
|
93
|
-
export * from
|
|
1
|
+
export * from './components/accordion.js';
|
|
2
|
+
export * from './components/agent-fanout.js';
|
|
3
|
+
export * from './components/alert.js';
|
|
4
|
+
export * from './components/alert-dialog.js';
|
|
5
|
+
export * from './components/aspect-ratio.js';
|
|
6
|
+
export * from './components/attachment.js';
|
|
7
|
+
export * from './components/avatar.js';
|
|
8
|
+
export * from './components/badge.js';
|
|
9
|
+
export * from './components/board.js';
|
|
10
|
+
export * from './components/brand-icon.js';
|
|
11
|
+
export * from './components/breadcrumb.js';
|
|
12
|
+
export * from './components/button.js';
|
|
13
|
+
export * from './components/button-group.js';
|
|
14
|
+
export * from './components/calendar.js';
|
|
15
|
+
export * from './components/canvas.js';
|
|
16
|
+
export * from './components/card.js';
|
|
17
|
+
export * from './components/carousel.js';
|
|
18
|
+
export * from './components/chart.js';
|
|
19
|
+
export * from './components/timeline.js';
|
|
20
|
+
export * from './components/chat-confirmation.js';
|
|
21
|
+
export * from './components/chat-input.js';
|
|
22
|
+
export * from './components/chat-plan.js';
|
|
23
|
+
export * from './components/chat-sources.js';
|
|
24
|
+
export * from './components/checkbox.js';
|
|
25
|
+
export * from './components/choice-list.js';
|
|
26
|
+
export * from './components/code-block.js';
|
|
27
|
+
export * from './components/collapsible.js';
|
|
28
|
+
export * from './components/combobox.js';
|
|
29
|
+
export * from './components/command.js';
|
|
30
|
+
export * from './components/context-menu.js';
|
|
31
|
+
export * from './components/dialog.js';
|
|
32
|
+
export * from './components/direction.js';
|
|
33
|
+
export * from './components/dropdown-menu.js';
|
|
34
|
+
export * from './components/field.js';
|
|
35
|
+
export * from './components/file-explorer.js';
|
|
36
|
+
export * from './components/file-viewer.js';
|
|
37
|
+
export * from './components/form.js';
|
|
38
|
+
export * from './components/glass-banner.js';
|
|
39
|
+
export * from './components/gradient-banner.js';
|
|
40
|
+
export * from './components/hover-card.js';
|
|
41
|
+
export * from './components/input.js';
|
|
42
|
+
export * from './components/input-group.js';
|
|
43
|
+
export * from './components/input-otp.js';
|
|
44
|
+
export * from './components/kbd.js';
|
|
45
|
+
export * from './components/label.js';
|
|
46
|
+
export * from './components/mention-list.js';
|
|
47
|
+
export * from './components/menubar.js';
|
|
48
|
+
export * from './components/message.js';
|
|
49
|
+
export * from './components/message-actions.js';
|
|
50
|
+
export * from './components/message-response.js';
|
|
51
|
+
export * from './components/message-scroller.js';
|
|
52
|
+
export * from './components/navigation-menu.js';
|
|
53
|
+
export * from './components/notice-banner.js';
|
|
54
|
+
export * from './components/page-content.js';
|
|
55
|
+
export * from './components/page-header.js';
|
|
56
|
+
export * from './components/pagination.js';
|
|
57
|
+
export * from './components/plan-outline.js';
|
|
58
|
+
export * from './components/popover.js';
|
|
59
|
+
export * from './components/presence-cursor.js';
|
|
60
|
+
export * from './components/progress.js';
|
|
61
|
+
export * from './components/prompt-list.js';
|
|
62
|
+
export * from './components/questionnaire.js';
|
|
63
|
+
export * from './components/radio-group.js';
|
|
64
|
+
export * from './components/reasoning-effort.js';
|
|
65
|
+
export * from './components/record-list.js';
|
|
66
|
+
export * from './components/resizable.js';
|
|
67
|
+
export * from './components/result-card.js';
|
|
68
|
+
export * from './components/result-notice.js';
|
|
69
|
+
export * from './components/review-card.js';
|
|
70
|
+
export * from './components/rich-text-editor.js';
|
|
71
|
+
export * from './components/schema-diagram.js';
|
|
72
|
+
export * from './components/sql-viewer.js';
|
|
73
|
+
export * from './components/scroll-area.js';
|
|
74
|
+
export * from './components/search-dialog.js';
|
|
75
|
+
export * from './components/search-field.js';
|
|
76
|
+
export * from './components/select.js';
|
|
77
|
+
export * from './components/selection-slot.js';
|
|
78
|
+
export * from './components/separator.js';
|
|
79
|
+
export * from './components/settings-list.js';
|
|
80
|
+
export * from './components/sheet.js';
|
|
81
|
+
export * from './components/sidebar.js';
|
|
82
|
+
export * from './components/skeleton.js';
|
|
83
|
+
export * from './components/slider.js';
|
|
84
|
+
export * from './components/spinner.js';
|
|
85
|
+
export * from './components/state-panel.js';
|
|
86
|
+
export * from './components/state-sample.js';
|
|
87
|
+
export * from './components/switch.js';
|
|
88
|
+
export * from './components/table.js';
|
|
89
|
+
export * from './components/tabs.js';
|
|
90
|
+
export * from './components/textarea.js';
|
|
91
|
+
export * from './components/toast.js';
|
|
92
|
+
export * from './components/toggle.js';
|
|
93
|
+
export * from './components/toggle-group.js';
|
|
94
|
+
export * from './components/tool-activity.js';
|
|
95
|
+
export * from './components/toolbar-status.js';
|
|
96
|
+
export * from './components/tooltip.js';
|
|
97
|
+
export * from './components/typed-text.js';
|
|
98
|
+
export * from './components/view-switcher.js';
|