@tulipfarm/sprout 0.3.1 → 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 +10 -10
- 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 +4 -4
- 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 +3 -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
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ChevronRight } from
|
|
4
|
-
import { createContext, useContext, useEffect, useId, useRef, useState, useSyncExternalStore, } from
|
|
5
|
-
import { Button } from
|
|
6
|
-
import { Dialog } from
|
|
7
|
-
import { Collapsible } from
|
|
8
|
-
import { cn, stateClassName } from
|
|
9
|
-
import { Pressable } from
|
|
10
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger
|
|
11
|
-
import { Input } from
|
|
12
|
-
import { Separator } from
|
|
3
|
+
import { ChevronRight } from 'reicon-react/icons/ChevronRight';
|
|
4
|
+
import { createContext, useContext, useEffect, useId, useRef, useState, useSyncExternalStore, } from 'react';
|
|
5
|
+
import { Button } from '@base-ui/react/button';
|
|
6
|
+
import { Dialog } from '@base-ui/react/dialog';
|
|
7
|
+
import { Collapsible } from '@base-ui/react/collapsible';
|
|
8
|
+
import { cn, stateClassName } from '../internal/classes.js';
|
|
9
|
+
import { Pressable } from '../internal/pressable.js';
|
|
10
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip.js';
|
|
11
|
+
import { Input } from './input.js';
|
|
12
|
+
import { Separator } from './separator.js';
|
|
13
13
|
const SidebarContext = createContext(null);
|
|
14
14
|
const PanelContext = createContext(null);
|
|
15
15
|
export function useSidebar() {
|
|
16
16
|
const context = useContext(SidebarContext);
|
|
17
17
|
if (!context)
|
|
18
|
-
throw new Error(
|
|
18
|
+
throw new Error('Sidebar parts must be inside SidebarProvider.');
|
|
19
19
|
return context;
|
|
20
20
|
}
|
|
21
21
|
function usePanel() {
|
|
22
22
|
const context = useContext(PanelContext);
|
|
23
23
|
if (!context)
|
|
24
|
-
throw new Error(
|
|
24
|
+
throw new Error('Sidebar navigation parts must be inside Sidebar.');
|
|
25
25
|
return context;
|
|
26
26
|
}
|
|
27
27
|
function subscribeMobile(callback) {
|
|
28
|
-
const media = window.matchMedia(
|
|
29
|
-
media.addEventListener(
|
|
30
|
-
return () => media.removeEventListener(
|
|
28
|
+
const media = window.matchMedia('(max-width: 767px)');
|
|
29
|
+
media.addEventListener('change', callback);
|
|
30
|
+
return () => media.removeEventListener('change', callback);
|
|
31
31
|
}
|
|
32
32
|
export function SidebarProvider({ defaultOpen = true, open: controlledOpen, onOpenChange, openMobile: controlledMobile, onOpenMobileChange, keyboardShortcut = true, className, children, ...props }) {
|
|
33
33
|
const [localOpen, setLocalOpen] = useState(defaultOpen);
|
|
34
34
|
const [localMobile, setLocalMobile] = useState(false);
|
|
35
|
-
const isMobile = useSyncExternalStore(subscribeMobile, () => window.matchMedia(
|
|
35
|
+
const isMobile = useSyncExternalStore(subscribeMobile, () => window.matchMedia('(max-width: 767px)').matches, () => false);
|
|
36
36
|
const open = controlledOpen ?? localOpen;
|
|
37
37
|
const openMobile = controlledMobile ?? localMobile;
|
|
38
38
|
const panelId = useId();
|
|
39
39
|
const triggerRef = useRef(null);
|
|
40
40
|
const wrapperRef = useRef(null);
|
|
41
41
|
function setOpen(value) {
|
|
42
|
-
const next = typeof value ===
|
|
42
|
+
const next = typeof value === 'function' ? value(open) : value;
|
|
43
43
|
if (controlledOpen === undefined)
|
|
44
44
|
setLocalOpen(next);
|
|
45
45
|
onOpenChange?.(next);
|
|
46
46
|
}
|
|
47
47
|
function setOpenMobile(value) {
|
|
48
|
-
const next = typeof value ===
|
|
48
|
+
const next = typeof value === 'function' ? value(openMobile) : value;
|
|
49
49
|
if (controlledMobile === undefined)
|
|
50
50
|
setLocalMobile(next);
|
|
51
51
|
onOpenMobileChange?.(next);
|
|
52
52
|
}
|
|
53
53
|
function toggleSidebar() {
|
|
54
54
|
if (isMobile)
|
|
55
|
-
setOpenMobile(
|
|
55
|
+
setOpenMobile(value => !value);
|
|
56
56
|
else
|
|
57
|
-
setOpen(
|
|
57
|
+
setOpen(value => !value);
|
|
58
58
|
}
|
|
59
59
|
useEffect(() => {
|
|
60
60
|
if (!keyboardShortcut)
|
|
@@ -64,21 +64,21 @@ export function SidebarProvider({ defaultOpen = true, open: controlledOpen, onOp
|
|
|
64
64
|
event.repeat ||
|
|
65
65
|
event.altKey ||
|
|
66
66
|
!(event.metaKey || event.ctrlKey) ||
|
|
67
|
-
event.key.toLowerCase() !==
|
|
67
|
+
event.key.toLowerCase() !== 'b')
|
|
68
68
|
return;
|
|
69
69
|
const target = event.target;
|
|
70
70
|
if (target instanceof Element) {
|
|
71
|
-
if (target.closest(
|
|
71
|
+
if (target.closest('input, textarea, select, [role=combobox], [role=listbox], [role=menu], [aria-haspopup=menu], [contenteditable]:not([contenteditable=false])'))
|
|
72
72
|
return;
|
|
73
|
-
const owner = target.closest(
|
|
73
|
+
const owner = target.closest('[data-sprout-sidebar-provider]');
|
|
74
74
|
if (owner && owner !== wrapperRef.current)
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
event.preventDefault();
|
|
78
78
|
toggleSidebar();
|
|
79
79
|
}
|
|
80
|
-
document.addEventListener(
|
|
81
|
-
return () => document.removeEventListener(
|
|
80
|
+
document.addEventListener('keydown', onKeyDown);
|
|
81
|
+
return () => document.removeEventListener('keydown', onKeyDown);
|
|
82
82
|
});
|
|
83
83
|
return (_jsx(SidebarContext.Provider, { value: {
|
|
84
84
|
open,
|
|
@@ -86,26 +86,26 @@ export function SidebarProvider({ defaultOpen = true, open: controlledOpen, onOp
|
|
|
86
86
|
openMobile,
|
|
87
87
|
setOpenMobile,
|
|
88
88
|
isMobile,
|
|
89
|
-
state: open ?
|
|
89
|
+
state: open ? 'expanded' : 'collapsed',
|
|
90
90
|
toggleSidebar,
|
|
91
91
|
panelId,
|
|
92
92
|
triggerRef,
|
|
93
|
-
}, children: _jsx(TooltipProvider, { delay: 200, children: _jsx("div", { ...props, ref: wrapperRef, "data-sprout-sidebar-provider": "", className: cn(
|
|
93
|
+
}, children: _jsx(TooltipProvider, { delay: 200, children: _jsx("div", { ...props, ref: wrapperRef, "data-sprout-sidebar-provider": "", className: cn('sprout-sidebar-layout font-sprout text-sprout-text', className), children: children }) }) }));
|
|
94
94
|
}
|
|
95
|
-
export function Sidebar({ side =
|
|
95
|
+
export function Sidebar({ side = 'left', collapsible = 'icon', label = 'Navigation', portalContainer, className, children, ...props }) {
|
|
96
96
|
const { open, openMobile, setOpenMobile, isMobile, panelId, triggerRef } = useSidebar();
|
|
97
|
-
const mobile = isMobile && collapsible !==
|
|
98
|
-
const collapsed = !mobile && !open && collapsible ===
|
|
99
|
-
const offcanvas = !open && collapsible ===
|
|
97
|
+
const mobile = isMobile && collapsible !== 'none';
|
|
98
|
+
const collapsed = !mobile && !open && collapsible === 'icon';
|
|
99
|
+
const offcanvas = !open && collapsible === 'offcanvas';
|
|
100
100
|
const content = (_jsx(PanelContext.Provider, { value: { collapsed, side, portalContainer }, children: children }));
|
|
101
101
|
if (mobile) {
|
|
102
|
-
return (_jsx(Dialog.Root, { open: openMobile, onOpenChange: setOpenMobile, children: _jsxs(Dialog.Portal, { container: portalContainer, children: [_jsx(Dialog.Backdrop, { className: "sprout-sidebar-backdrop" }), _jsxs(Dialog.Popup, { id: panelId, "data-side": side, className: "sprout-sidebar-drawer font-sprout text-sprout-text", finalFocus: triggerRef, children: [_jsxs("div", { className: "sprout-sidebar-drawer-heading", children: [_jsx(Dialog.Title, { children: label }), _jsx(Dialog.Close, { className: "sprout-sidebar-close", children: "Close" })] }), _jsx("aside", { ...props, "aria-label": label, "data-sprout-sidebar": "", "data-state": "expanded", className: cn(
|
|
102
|
+
return (_jsx(Dialog.Root, { open: openMobile, onOpenChange: setOpenMobile, children: _jsxs(Dialog.Portal, { container: portalContainer, children: [_jsx(Dialog.Backdrop, { className: "sprout-sidebar-backdrop" }), _jsxs(Dialog.Popup, { id: panelId, "data-side": side, className: "sprout-sidebar-drawer font-sprout text-sprout-text", finalFocus: triggerRef, children: [_jsxs("div", { className: "sprout-sidebar-drawer-heading", children: [_jsx(Dialog.Title, { children: label }), _jsx(Dialog.Close, { className: "sprout-sidebar-close", children: "Close" })] }), _jsx("aside", { ...props, "aria-label": label, "data-sprout-sidebar": "", "data-state": "expanded", className: cn('sprout-sidebar-panel sprout-sidebar-mobile bg-sprout-canvas', className), children: content })] })] }) }));
|
|
103
103
|
}
|
|
104
|
-
return (_jsx("aside", { ...props, id: panelId, "aria-label": label, "data-sprout-sidebar": "", "data-state": collapsed ?
|
|
104
|
+
return (_jsx("aside", { ...props, id: panelId, "aria-label": label, "data-sprout-sidebar": "", "data-state": collapsed ? 'collapsed' : 'expanded', "data-side": side, "data-collapsible": collapsible, "data-offcanvas": offcanvas ? '' : undefined, "aria-hidden": offcanvas || undefined, inert: offcanvas, className: cn('sprout-sidebar-panel bg-sprout-canvas', className), children: content }));
|
|
105
105
|
}
|
|
106
|
-
export function SidebarTrigger({ className, onClick, children =
|
|
106
|
+
export function SidebarTrigger({ className, onClick, children = 'Toggle sidebar', ...props }) {
|
|
107
107
|
const { isMobile, open, openMobile, toggleSidebar, panelId, triggerRef } = useSidebar();
|
|
108
|
-
return (_jsx(Button, { "aria-label": "Toggle sidebar", "aria-expanded": isMobile ? openMobile : open, "aria-controls": panelId, ...props, className: stateClassName(
|
|
108
|
+
return (_jsx(Button, { "aria-label": "Toggle sidebar", "aria-expanded": isMobile ? openMobile : open, "aria-controls": panelId, ...props, className: stateClassName('sprout-sidebar-trigger', className), onClick: event => {
|
|
109
109
|
onClick?.(event);
|
|
110
110
|
if (event.defaultPrevented)
|
|
111
111
|
return;
|
|
@@ -114,43 +114,42 @@ export function SidebarTrigger({ className, onClick, children = "Toggle sidebar"
|
|
|
114
114
|
}, children: children }));
|
|
115
115
|
}
|
|
116
116
|
export function SidebarHeader({ className, ...props }) {
|
|
117
|
-
return _jsx("div", { ...props, className: cn(
|
|
117
|
+
return _jsx("div", { ...props, className: cn('sprout-sidebar-header', className) });
|
|
118
118
|
}
|
|
119
119
|
/** A 32px search or filter field for the sidebar header, on the canvas color. */
|
|
120
120
|
export function SidebarInput({ className, ...props }) {
|
|
121
|
-
return (_jsx(Input, { "data-slot": "sidebar-input", "data-sidebar": "input", ...props, className: stateClassName(
|
|
121
|
+
return (_jsx(Input, { "data-slot": "sidebar-input", "data-sidebar": "input", ...props, className: stateClassName('sprout-sidebar-input', className) }));
|
|
122
122
|
}
|
|
123
123
|
export function SidebarFooter({ className, ...props }) {
|
|
124
|
-
return _jsx("div", { ...props, className: cn(
|
|
124
|
+
return _jsx("div", { ...props, className: cn('sprout-sidebar-footer', className) });
|
|
125
125
|
}
|
|
126
126
|
export function SidebarSeparator({ className, ...props }) {
|
|
127
|
-
return (_jsx(Separator, { "data-sidebar": "separator", ...props, className: stateClassName(
|
|
127
|
+
return (_jsx(Separator, { "data-sidebar": "separator", ...props, className: stateClassName('sprout-sidebar-separator', className) }));
|
|
128
128
|
}
|
|
129
129
|
export function SidebarContent({ className, ...props }) {
|
|
130
|
-
return _jsx("div", { ...props, className: cn(
|
|
130
|
+
return _jsx("div", { ...props, className: cn('sprout-sidebar-content', className) });
|
|
131
131
|
}
|
|
132
132
|
export function SidebarGroup({ className, ...props }) {
|
|
133
|
-
return _jsx("div", { ...props, className: cn(
|
|
133
|
+
return _jsx("div", { ...props, className: cn('sprout-sidebar-group', className) });
|
|
134
134
|
}
|
|
135
135
|
export function SidebarGroupLabel({ className, ...props }) {
|
|
136
|
-
return
|
|
136
|
+
return _jsx("div", { ...props, className: cn('sprout-sidebar-group-label', className) });
|
|
137
137
|
}
|
|
138
138
|
export function SidebarMenu({ className, ...props }) {
|
|
139
|
-
return _jsx("ul", { ...props, className: cn(
|
|
139
|
+
return _jsx("ul", { ...props, className: cn('sprout-sidebar-menu', className) });
|
|
140
140
|
}
|
|
141
141
|
export function SidebarMenuItem({ className, ...props }) {
|
|
142
|
-
return
|
|
142
|
+
return _jsx("li", { ...props, className: cn('sprout-sidebar-menu-item', className) });
|
|
143
143
|
}
|
|
144
144
|
export function SidebarMenuButton({ icon, badge, isActive = false, tooltip, className, children, onClick, ...props }) {
|
|
145
145
|
const { collapsed, side, portalContainer } = usePanel();
|
|
146
146
|
const { setOpenMobile } = useSidebar();
|
|
147
|
-
const content = typeof tooltip ===
|
|
147
|
+
const content = typeof tooltip === 'string' ? { children: tooltip } : tooltip;
|
|
148
148
|
const { hidden: hideTooltip = !collapsed, ...contentProps } = content ?? {};
|
|
149
|
-
const accessibleLabel = props[
|
|
150
|
-
(typeof content?.children ===
|
|
151
|
-
(typeof children ===
|
|
152
|
-
return (_jsxs(Tooltip, { disabled: hideTooltip || props.disabled, children: [_jsxs(TooltipTrigger, { render: _jsx(Pressable, { ...props, "aria-label": accessibleLabel, "aria-current": props[
|
|
153
|
-
(isActive && props.nativeButton === false ? "page" : undefined), "data-active": isActive ? "" : undefined, className: stateClassName("sprout-sidebar-menu-button", className), onClick: (event) => {
|
|
149
|
+
const accessibleLabel = props['aria-label'] ??
|
|
150
|
+
(typeof content?.children === 'string' ? content.children : undefined) ??
|
|
151
|
+
(typeof children === 'string' ? children : undefined);
|
|
152
|
+
return (_jsxs(Tooltip, { disabled: hideTooltip || props.disabled, children: [_jsxs(TooltipTrigger, { render: _jsx(Pressable, { ...props, "aria-label": accessibleLabel, "aria-current": props['aria-current'] ?? (isActive && props.nativeButton === false ? 'page' : undefined), "data-active": isActive ? '' : undefined, className: stateClassName('sprout-sidebar-menu-button', className), onClick: event => {
|
|
154
153
|
onClick?.(event);
|
|
155
154
|
if (!event.defaultPrevented &&
|
|
156
155
|
props.nativeButton === false &&
|
|
@@ -159,29 +158,29 @@ export function SidebarMenuButton({ icon, badge, isActive = false, tooltip, clas
|
|
|
159
158
|
!event.shiftKey &&
|
|
160
159
|
!event.altKey)
|
|
161
160
|
setOpenMobile(false);
|
|
162
|
-
} }), children: [icon && (_jsx("span", { className: "sprout-sidebar-icon", "aria-hidden": "true", children: icon })), _jsx("span", { className: "sprout-sidebar-label", children: children }), badge != null && _jsx("span", { className: "sprout-sidebar-badge", children: badge })] }), _jsx(TooltipContent, { side: side ===
|
|
161
|
+
} }), children: [icon && (_jsx("span", { className: "sprout-sidebar-icon", "aria-hidden": "true", children: icon })), _jsx("span", { className: "sprout-sidebar-label", children: children }), badge != null && _jsx("span", { className: "sprout-sidebar-badge", children: badge })] }), _jsx(TooltipContent, { side: side === 'left' ? 'right' : 'left', sideOffset: 8, container: portalContainer, ...contentProps, className: stateClassName('sprout-sidebar-tooltip', contentProps.className), children: contentProps.children ?? children })] }));
|
|
163
162
|
}
|
|
164
163
|
export function SidebarMenuAction({ className, ...props }) {
|
|
165
164
|
usePanel();
|
|
166
|
-
return
|
|
165
|
+
return _jsx(Button, { ...props, className: stateClassName('sprout-sidebar-menu-action', className) });
|
|
167
166
|
}
|
|
168
167
|
export function SidebarMenuSub({ className, ...props }) {
|
|
169
|
-
return
|
|
168
|
+
return _jsx("ul", { ...props, className: cn('sprout-sidebar-menu sprout-sidebar-sub', className) });
|
|
170
169
|
}
|
|
171
170
|
export const SidebarMenuSubItem = SidebarMenuItem;
|
|
172
171
|
export function SidebarMenuSubButton({ className, ...props }) {
|
|
173
|
-
return (_jsx(SidebarMenuButton, { ...props, className: stateClassName(
|
|
172
|
+
return (_jsx(SidebarMenuButton, { ...props, className: stateClassName('sprout-sidebar-sub-button', className) }));
|
|
174
173
|
}
|
|
175
174
|
export function SidebarSection({ label, children, open: controlledOpen, defaultOpen = false, onOpenChange, ...props }) {
|
|
176
175
|
const [localOpen, setLocalOpen] = useState(defaultOpen);
|
|
177
176
|
const { collapsed } = usePanel();
|
|
178
177
|
const open = !collapsed && (controlledOpen ?? localOpen);
|
|
179
|
-
return (_jsx(SidebarMenuItem, { children: _jsxs(Collapsible.Root, { open: open, onOpenChange:
|
|
178
|
+
return (_jsx(SidebarMenuItem, { children: _jsxs(Collapsible.Root, { open: open, onOpenChange: value => {
|
|
180
179
|
if (controlledOpen === undefined)
|
|
181
180
|
setLocalOpen(value);
|
|
182
181
|
onOpenChange?.(value);
|
|
183
|
-
}, children: [_jsxs("div", { className: "sprout-sidebar-section-heading", children: [_jsx(SidebarMenuButton, { ...props, children: label }), _jsx(Collapsible.Trigger, { render: _jsx(SidebarMenuAction, { "aria-label": `${open ?
|
|
182
|
+
}, children: [_jsxs("div", { className: "sprout-sidebar-section-heading", children: [_jsx(SidebarMenuButton, { ...props, children: label }), _jsx(Collapsible.Trigger, { render: _jsx(SidebarMenuAction, { "aria-label": `${open ? 'Collapse' : 'Expand'} ${label}` }), children: _jsx(ChevronRight, { size: 16, "aria-hidden": "true", className: "sprout-sidebar-chevron" }) })] }), _jsx(Collapsible.Panel, { className: "sprout-sidebar-section-content", inert: !open, children: _jsx(SidebarMenuSub, { children: children }) })] }) }));
|
|
184
183
|
}
|
|
185
184
|
export function SidebarMenuSkeleton({ className, ...props }) {
|
|
186
|
-
return (_jsxs("div", { ...props, "aria-hidden": "true", className: cn(
|
|
185
|
+
return (_jsxs("div", { ...props, "aria-hidden": "true", className: cn('sprout-sidebar-skeleton', className), children: [_jsx("span", {}), _jsx("span", {})] }));
|
|
187
186
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ComponentProps } from
|
|
2
|
-
import { useRender } from
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
3
|
export declare const skeletonShapeNames: readonly ["line", "title", "avatar", "panel", "checkbox", "action"];
|
|
4
4
|
export type SkeletonShape = (typeof skeletonShapeNames)[number];
|
|
5
|
-
export interface SkeletonProps extends ComponentProps<
|
|
5
|
+
export interface SkeletonProps extends ComponentProps<'div'> {
|
|
6
6
|
/**
|
|
7
7
|
* The placeholder footprint. `"line"` is a 16px text row, `"title"` a 24px
|
|
8
8
|
* heading at two thirds width, `"avatar"` a 32px circle, `"panel"` a 128px
|
|
@@ -15,10 +15,10 @@ export declare function Skeleton({ shape, className, ...props }: SkeletonProps):
|
|
|
15
15
|
export declare const skeletonGroupGapNames: readonly ["sm", "md", "lg"];
|
|
16
16
|
export type SkeletonGroupGap = (typeof skeletonGroupGapNames)[number];
|
|
17
17
|
export interface SkeletonGroupState extends Record<string, unknown> {
|
|
18
|
-
slot:
|
|
18
|
+
slot: 'skeleton-group';
|
|
19
19
|
gap: SkeletonGroupGap;
|
|
20
20
|
}
|
|
21
|
-
export interface SkeletonGroupProps extends useRender.ComponentProps<
|
|
21
|
+
export interface SkeletonGroupProps extends useRender.ComponentProps<'div', SkeletonGroupState> {
|
|
22
22
|
/**
|
|
23
23
|
* Names the loading region, such as `"Loading projects"`. It becomes the
|
|
24
24
|
* accessible name and is also read as visually hidden text.
|
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { mergeProps } from
|
|
3
|
-
import { useRender } from
|
|
4
|
-
import { cn } from
|
|
5
|
-
export const skeletonShapeNames = [
|
|
6
|
-
"line",
|
|
7
|
-
"title",
|
|
8
|
-
"avatar",
|
|
9
|
-
"panel",
|
|
10
|
-
"checkbox",
|
|
11
|
-
"action",
|
|
12
|
-
];
|
|
2
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { cn } from '../internal/classes.js';
|
|
5
|
+
export const skeletonShapeNames = ['line', 'title', 'avatar', 'panel', 'checkbox', 'action'];
|
|
13
6
|
/** A pulsing placeholder that holds the space of content still loading. */
|
|
14
|
-
export function Skeleton({ shape =
|
|
15
|
-
return (_jsx("div", { "aria-hidden": "true", "data-slot": "skeleton", "data-shape": shape, className: cn(
|
|
7
|
+
export function Skeleton({ shape = 'line', className, ...props }) {
|
|
8
|
+
return (_jsx("div", { "aria-hidden": "true", "data-slot": "skeleton", "data-shape": shape, className: cn('sprout-skeleton', className), ...props }));
|
|
16
9
|
}
|
|
17
|
-
export const skeletonGroupGapNames = [
|
|
10
|
+
export const skeletonGroupGapNames = ['sm', 'md', 'lg'];
|
|
18
11
|
/** A `status` region that stacks skeletons and names what is loading. */
|
|
19
|
-
export function SkeletonGroup({ label, gap =
|
|
12
|
+
export function SkeletonGroup({ label, gap = 'md', className, children, render, ref, ...props }) {
|
|
20
13
|
return useRender({
|
|
21
|
-
defaultTagName:
|
|
14
|
+
defaultTagName: 'div',
|
|
22
15
|
ref,
|
|
23
16
|
render,
|
|
24
17
|
props: mergeProps({
|
|
25
|
-
role:
|
|
26
|
-
|
|
27
|
-
className: cn(
|
|
28
|
-
children: (_jsxs(_Fragment, { children: [children, label ?
|
|
18
|
+
role: 'status',
|
|
19
|
+
'aria-label': label,
|
|
20
|
+
className: cn('sprout-skeleton-group', className),
|
|
21
|
+
children: (_jsxs(_Fragment, { children: [children, label ? _jsx("span", { className: "sprout-skeleton-group-label", children: `${label}…` }) : null] })),
|
|
29
22
|
}, props),
|
|
30
|
-
state: { slot:
|
|
23
|
+
state: { slot: 'skeleton-group', gap },
|
|
31
24
|
});
|
|
32
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Slider as BaseSlider } from
|
|
1
|
+
import { Slider as BaseSlider } from '@base-ui/react/slider';
|
|
2
2
|
export type SliderValue = number | readonly number[];
|
|
3
3
|
export interface SliderProps<Value extends SliderValue = SliderValue> extends BaseSlider.Root.Props<Value> {
|
|
4
4
|
/**
|
|
@@ -14,4 +14,4 @@ export interface SliderProps<Value extends SliderValue = SliderValue> extends Ba
|
|
|
14
14
|
* Pass a number or an array to `value` or `defaultValue`. Name it with
|
|
15
15
|
* `aria-label`, `aria-labelledby`, or `getAriaLabel`.
|
|
16
16
|
*/
|
|
17
|
-
export declare function Slider<Value extends SliderValue = SliderValue>({ className, defaultValue, value, min, max, getAriaLabel, getAriaValueText,
|
|
17
|
+
export declare function Slider<Value extends SliderValue = SliderValue>({ className, defaultValue, value, min, max, getAriaLabel, getAriaValueText, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...props }: SliderProps<Value>): import("react").JSX.Element;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Slider as BaseSlider } from
|
|
4
|
-
import { stateClassName } from
|
|
3
|
+
import { Slider as BaseSlider } from '@base-ui/react/slider';
|
|
4
|
+
import { stateClassName } from '../internal/classes.js';
|
|
5
5
|
function thumbLabel(label, count) {
|
|
6
6
|
if (!label)
|
|
7
7
|
return undefined;
|
|
8
8
|
if (count === 1)
|
|
9
9
|
return () => label;
|
|
10
10
|
if (count === 2)
|
|
11
|
-
return (index) => `${label} ${index === 0 ?
|
|
11
|
+
return (index) => `${label} ${index === 0 ? 'minimum' : 'maximum'}`;
|
|
12
12
|
return (index) => `${label} ${index + 1}`;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -16,9 +16,9 @@ function thumbLabel(label, count) {
|
|
|
16
16
|
* Pass a number or an array to `value` or `defaultValue`. Name it with
|
|
17
17
|
* `aria-label`, `aria-labelledby`, or `getAriaLabel`.
|
|
18
18
|
*/
|
|
19
|
-
export function Slider({ className, defaultValue, value, min = 0, max = 100, getAriaLabel, getAriaValueText,
|
|
19
|
+
export function Slider({ className, defaultValue, value, min = 0, max = 100, getAriaLabel, getAriaValueText, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...props }) {
|
|
20
20
|
const shape = value ?? defaultValue;
|
|
21
21
|
const count = Array.isArray(shape) ? shape.length : 1;
|
|
22
22
|
const label = getAriaLabel ?? (ariaLabelledBy ? undefined : thumbLabel(ariaLabel, count));
|
|
23
|
-
return (_jsx(BaseSlider.Root, { "data-slot": "slider", defaultValue: defaultValue, value: value, min: min, max: max, thumbAlignment: "edge", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props, className: stateClassName(
|
|
23
|
+
return (_jsx(BaseSlider.Root, { "data-slot": "slider", defaultValue: defaultValue, value: value, min: min, max: max, thumbAlignment: "edge", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props, className: stateClassName('sprout-slider', className), children: _jsxs(BaseSlider.Control, { "data-slot": "slider-control", className: "sprout-slider-control", children: [_jsx(BaseSlider.Track, { "data-slot": "slider-track", className: "sprout-slider-track", children: _jsx(BaseSlider.Indicator, { "data-slot": "slider-range", className: "sprout-slider-range" }) }), Array.from({ length: count }, (_, index) => (_jsx(BaseSlider.Thumb, { index: index, "data-slot": "slider-thumb", className: "sprout-slider-thumb", getAriaLabel: label, getAriaValueText: getAriaValueText }, index)))] }) }));
|
|
24
24
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { type ComponentProps } from
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
2
|
export declare const spinnerSizeNames: readonly ["sm", "default", "lg"];
|
|
3
3
|
export type SpinnerSize = (typeof spinnerSizeNames)[number];
|
|
4
4
|
export declare const thinkingSpinnerSizeNames: readonly ["lg", "xl"];
|
|
5
5
|
export type ThinkingSpinnerSize = (typeof thinkingSpinnerSizeNames)[number];
|
|
6
6
|
export declare const spinnerActivityNames: readonly ["working", "searching", "solving", "listening", "connecting", "weaving", "composing", "breathing", "shaping"];
|
|
7
7
|
export type SpinnerActivity = (typeof spinnerActivityNames)[number];
|
|
8
|
-
export interface LoaderSpinnerProps extends Omit<ComponentProps<
|
|
9
|
-
variant?:
|
|
8
|
+
export interface LoaderSpinnerProps extends Omit<ComponentProps<'svg'>, 'children' | 'color'> {
|
|
9
|
+
variant?: 'default' | undefined;
|
|
10
10
|
/**
|
|
11
11
|
* `"sm"` is 12px, `"default"` 16px, and `"lg"` 20px. The size holds inside
|
|
12
12
|
* buttons; badges shrink it to their 12px icon size.
|
|
@@ -14,9 +14,9 @@ export interface LoaderSpinnerProps extends Omit<ComponentProps<"svg">, "childre
|
|
|
14
14
|
size?: SpinnerSize | undefined;
|
|
15
15
|
activity?: never;
|
|
16
16
|
}
|
|
17
|
-
export interface ThinkingSpinnerProps extends Omit<ComponentProps<
|
|
17
|
+
export interface ThinkingSpinnerProps extends Omit<ComponentProps<'span'>, 'children' | 'color'> {
|
|
18
18
|
/** A dotted thought orb for AI and agent work, in place of the spinning loader. */
|
|
19
|
-
variant:
|
|
19
|
+
variant: 'thinking';
|
|
20
20
|
/**
|
|
21
21
|
* `"lg"` is 20px, for inline text. `"xl"` is 64px, for avatar-scale status.
|
|
22
22
|
* Each is a separately tuned design, so no other sizes exist.
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { lazy, Suspense } from
|
|
3
|
-
import { Loader } from
|
|
4
|
-
import { cn } from
|
|
5
|
-
export const spinnerSizeNames = [
|
|
6
|
-
export const thinkingSpinnerSizeNames = [
|
|
2
|
+
import { lazy, Suspense } from 'react';
|
|
3
|
+
import { Loader } from 'reicon-react/icons/Loader';
|
|
4
|
+
import { cn } from '../internal/classes.js';
|
|
5
|
+
export const spinnerSizeNames = ['sm', 'default', 'lg'];
|
|
6
|
+
export const thinkingSpinnerSizeNames = ['lg', 'xl'];
|
|
7
7
|
export const spinnerActivityNames = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
'working',
|
|
9
|
+
'searching',
|
|
10
|
+
'solving',
|
|
11
|
+
'listening',
|
|
12
|
+
'connecting',
|
|
13
|
+
'weaving',
|
|
14
|
+
'composing',
|
|
15
|
+
'breathing',
|
|
16
|
+
'shaping',
|
|
17
17
|
];
|
|
18
18
|
const orbPixels = { lg: 20, xl: 64 };
|
|
19
19
|
// Loaded on first thinking render, so apps showing only the loader never download the orb.
|
|
20
|
-
const ThinkingOrb = lazy(() => import(
|
|
20
|
+
const ThinkingOrb = lazy(() => import('thinking-orbs').then(({ ThinkingOrb }) => ({ default: ThinkingOrb })));
|
|
21
21
|
/**
|
|
22
22
|
* A loading indicator. By default it is a spinning loader that takes the
|
|
23
23
|
* current text color; `variant="thinking"` shows a monochrome thought orb
|
|
@@ -27,17 +27,13 @@ const ThinkingOrb = lazy(() => import("thinking-orbs").then(({ ThinkingOrb }) =>
|
|
|
27
27
|
* happening.
|
|
28
28
|
*/
|
|
29
29
|
export function Spinner(props) {
|
|
30
|
-
if (props.variant ===
|
|
30
|
+
if (props.variant === 'thinking')
|
|
31
31
|
return _jsx(ThinkingSpinner, { ...props });
|
|
32
|
-
const { variant: _variant, size =
|
|
33
|
-
const decorative = hidden === true || hidden ===
|
|
34
|
-
return (_jsx(Loader, { "data-slot": "spinner", "data-variant": "default", "data-size": size, ...(decorative
|
|
35
|
-
? { "aria-hidden": "true" }
|
|
36
|
-
: { role, "aria-label": label }), focusable: "false", className: cn("sprout-spinner", `sprout-spinner-size-${size}`, className), ...rest }));
|
|
32
|
+
const { variant: _variant, size = 'default', className, role = 'status', 'aria-label': label = 'Loading', 'aria-hidden': hidden, ...rest } = props;
|
|
33
|
+
const decorative = hidden === true || hidden === 'true';
|
|
34
|
+
return (_jsx(Loader, { "data-slot": "spinner", "data-variant": "default", "data-size": size, ...(decorative ? { 'aria-hidden': 'true' } : { role, 'aria-label': label }), focusable: "false", className: cn('sprout-spinner', `sprout-spinner-size-${size}`, className), ...rest }));
|
|
37
35
|
}
|
|
38
|
-
function ThinkingSpinner({ variant, size =
|
|
39
|
-
const decorative = hidden === true || hidden ===
|
|
40
|
-
return (_jsx("span", { "data-slot": "spinner", "data-variant": variant, "data-size": size, "data-activity": activity, ...(decorative
|
|
41
|
-
? { "aria-hidden": "true" }
|
|
42
|
-
: { role, "aria-label": label }), className: cn("sprout-spinner", `sprout-spinner-size-${size}`, className), ...rest, children: _jsx(Suspense, { fallback: null, children: _jsx(ThinkingOrb, { state: activity, size: orbPixels[size], theme: "auto", role: "presentation", "aria-hidden": "true" }) }) }));
|
|
36
|
+
function ThinkingSpinner({ variant, size = 'lg', activity = 'working', className, role = 'status', 'aria-label': label = 'Thinking', 'aria-hidden': hidden, ...rest }) {
|
|
37
|
+
const decorative = hidden === true || hidden === 'true';
|
|
38
|
+
return (_jsx("span", { "data-slot": "spinner", "data-variant": variant, "data-size": size, "data-activity": activity, ...(decorative ? { 'aria-hidden': 'true' } : { role, 'aria-label': label }), className: cn('sprout-spinner', `sprout-spinner-size-${size}`, className), ...rest, children: _jsx(Suspense, { fallback: null, children: _jsx(ThinkingOrb, { state: activity, size: orbPixels[size], theme: "auto", role: "presentation", "aria-hidden": "true" }) }) }));
|
|
43
39
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type HTMLAttributes } from
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
2
|
export declare const sqlViewerLayoutNames: readonly ["auto", "horizontal", "vertical"];
|
|
3
3
|
export type SqlViewerLayout = (typeof sqlViewerLayoutNames)[number];
|
|
4
|
-
export type SqlViewerCardinality =
|
|
4
|
+
export type SqlViewerCardinality = 'one' | 'many';
|
|
5
5
|
export interface SqlViewerOption {
|
|
6
6
|
id: string;
|
|
7
7
|
label: string;
|
|
@@ -13,24 +13,24 @@ export type SqlViewerField = {
|
|
|
13
13
|
label: string;
|
|
14
14
|
required: boolean;
|
|
15
15
|
} & ({
|
|
16
|
-
kind:
|
|
16
|
+
kind: 'text';
|
|
17
17
|
maxLength: number;
|
|
18
18
|
} | {
|
|
19
|
-
kind:
|
|
19
|
+
kind: 'numeric';
|
|
20
20
|
precision: number;
|
|
21
21
|
scale: number;
|
|
22
22
|
} | {
|
|
23
|
-
kind:
|
|
23
|
+
kind: 'boolean';
|
|
24
24
|
} | {
|
|
25
|
-
kind:
|
|
25
|
+
kind: 'date';
|
|
26
26
|
} | {
|
|
27
|
-
kind:
|
|
28
|
-
timezone?:
|
|
27
|
+
kind: 'timestamp';
|
|
28
|
+
timezone?: 'UTC';
|
|
29
29
|
} | {
|
|
30
|
-
kind:
|
|
30
|
+
kind: 'single-select' | 'multi-select';
|
|
31
31
|
options: readonly SqlViewerOption[];
|
|
32
32
|
} | {
|
|
33
|
-
kind:
|
|
33
|
+
kind: 'relationship';
|
|
34
34
|
/** A table name (format 3) or table UUID (format 2), matching a table's `id`. */
|
|
35
35
|
targetTableId: string;
|
|
36
36
|
cardinality: SqlViewerCardinality;
|
|
@@ -39,11 +39,11 @@ export type SqlViewerField = {
|
|
|
39
39
|
fieldId: string;
|
|
40
40
|
label: string;
|
|
41
41
|
} | null;
|
|
42
|
-
onDelete?:
|
|
42
|
+
onDelete?: 'restrict';
|
|
43
43
|
} | {
|
|
44
|
-
kind:
|
|
44
|
+
kind: 'file';
|
|
45
45
|
cardinality: SqlViewerCardinality;
|
|
46
|
-
access?:
|
|
46
|
+
access?: 'independent';
|
|
47
47
|
});
|
|
48
48
|
export interface SqlViewerUniqueKey {
|
|
49
49
|
id: string;
|
|
@@ -57,7 +57,7 @@ export interface SqlViewerTable {
|
|
|
57
57
|
fields: readonly SqlViewerField[];
|
|
58
58
|
uniqueKeys?: readonly SqlViewerUniqueKey[];
|
|
59
59
|
}
|
|
60
|
-
export interface SqlViewerProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
60
|
+
export interface SqlViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'children'> {
|
|
61
61
|
/** TulipFarm table definitions or table documents, in display order. */
|
|
62
62
|
tables: readonly SqlViewerTable[];
|
|
63
63
|
/** Names the diagram for assistive tech, such as “Tables in Sales”. */
|