@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,46 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useRef
|
|
4
|
-
import { DayPicker, getDefaultClassNames, useDayPicker, } from
|
|
5
|
-
import { ChevronDown } from
|
|
6
|
-
import { ChevronLeft } from
|
|
7
|
-
import { ChevronRight } from
|
|
8
|
-
import { cn } from
|
|
9
|
-
import { Button, buttonVariants } from
|
|
10
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue
|
|
11
|
-
export const calendarCaptionLayoutNames = [
|
|
12
|
-
"label",
|
|
13
|
-
"dropdown",
|
|
14
|
-
"dropdown-months",
|
|
15
|
-
"dropdown-years",
|
|
16
|
-
];
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { DayPicker, getDefaultClassNames, useDayPicker, } from 'react-day-picker';
|
|
5
|
+
import { ChevronDown } from 'reicon-react/icons/ChevronDown';
|
|
6
|
+
import { ChevronLeft } from 'reicon-react/icons/ChevronLeft';
|
|
7
|
+
import { ChevronRight } from 'reicon-react/icons/ChevronRight';
|
|
8
|
+
import { cn } from '../internal/classes.js';
|
|
9
|
+
import { Button, buttonVariants } from './button.js';
|
|
10
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './select.js';
|
|
11
|
+
export const calendarCaptionLayoutNames = ['label', 'dropdown', 'dropdown-months', 'dropdown-years'];
|
|
17
12
|
function CalendarRoot({ className, rootRef, ...props }) {
|
|
18
|
-
return
|
|
13
|
+
return _jsx("div", { "data-slot": "calendar", ref: rootRef, className: className, ...props });
|
|
19
14
|
}
|
|
20
15
|
function CalendarChevron({ className, orientation, size: _size, disabled: _disabled, ...props }) {
|
|
21
|
-
const Icon = orientation ===
|
|
22
|
-
|
|
23
|
-
: orientation === "right"
|
|
24
|
-
? ChevronRight
|
|
25
|
-
: ChevronDown;
|
|
26
|
-
return (_jsx(Icon, { "aria-hidden": "true", className: cn("sprout-calendar-chevron", className), ...props }));
|
|
16
|
+
const Icon = orientation === 'left' ? ChevronLeft : orientation === 'right' ? ChevronRight : ChevronDown;
|
|
17
|
+
return _jsx(Icon, { "aria-hidden": "true", className: cn('sprout-calendar-chevron', className), ...props });
|
|
27
18
|
}
|
|
28
19
|
function CalendarWeekNumber({ children, week: _week, ...props }) {
|
|
29
20
|
return (_jsx("th", { ...props, children: _jsx("div", { className: "sprout-calendar-week-number-cell", children: children }) }));
|
|
30
21
|
}
|
|
31
22
|
/** Month and year pickers use a Base UI select, never a native `<select>`. */
|
|
32
|
-
function CalendarDropdown({ options = [], value, onChange, disabled, className, style,
|
|
33
|
-
const items = options.map(
|
|
23
|
+
function CalendarDropdown({ options = [], value, onChange, disabled, className, style, 'aria-label': label, }) {
|
|
24
|
+
const items = options.map(option => ({
|
|
34
25
|
value: option.value,
|
|
35
26
|
label: option.label,
|
|
36
27
|
}));
|
|
37
|
-
return (_jsxs(Select, { items: items, value: Number(value), disabled: disabled, onValueChange:
|
|
28
|
+
return (_jsxs(Select, { items: items, value: Number(value), disabled: disabled, onValueChange: next => {
|
|
38
29
|
if (next === null)
|
|
39
30
|
return;
|
|
40
31
|
onChange?.({
|
|
41
32
|
target: { value: String(next) },
|
|
42
33
|
});
|
|
43
|
-
}, children: [_jsx(SelectTrigger, { size: "sm", "aria-label": label, style: style, className: cn(
|
|
34
|
+
}, children: [_jsx(SelectTrigger, { size: "sm", "aria-label": label, style: style, className: cn('sprout-calendar-dropdown', className), children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { className: "sprout-calendar-dropdown-content", children: options.map(option => (_jsx(SelectItem, { value: option.value, disabled: option.disabled, children: option.label }, option.value))) })] }));
|
|
44
35
|
}
|
|
45
36
|
/**
|
|
46
37
|
* A month grid for picking one date, several dates, or a range. It takes every
|
|
@@ -48,38 +39,38 @@ function CalendarDropdown({ options = [], value, onChange, disabled, className,
|
|
|
48
39
|
* `defaultMonth`, `disabled`, `weekStartsOn`, `showWeekNumber`, and
|
|
49
40
|
* `numberOfMonths`.
|
|
50
41
|
*/
|
|
51
|
-
export function Calendar({ className, classNames, showOutsideDays = true, captionLayout =
|
|
42
|
+
export function Calendar({ className, classNames, showOutsideDays = true, captionLayout = 'label', buttonVariant = 'ghost', locale, formatters, components, ...props }) {
|
|
52
43
|
const defaults = getDefaultClassNames();
|
|
53
|
-
const navButton = cn(buttonVariants({ variant: buttonVariant, size:
|
|
54
|
-
return (_jsx(DayPicker, { showOutsideDays: showOutsideDays, className: cn(
|
|
55
|
-
formatMonthDropdown:
|
|
44
|
+
const navButton = cn(buttonVariants({ variant: buttonVariant, size: 'icon-sm' }), 'sprout-calendar-nav-button');
|
|
45
|
+
return (_jsx(DayPicker, { showOutsideDays: showOutsideDays, className: cn('sprout-calendar', className), "data-button-variant": buttonVariant, "data-caption-layout": captionLayout, captionLayout: captionLayout, locale: locale, formatters: {
|
|
46
|
+
formatMonthDropdown: date => date.toLocaleString(locale?.code, { month: 'short' }),
|
|
56
47
|
...formatters,
|
|
57
48
|
}, classNames: {
|
|
58
|
-
root: cn(
|
|
59
|
-
months: cn(
|
|
60
|
-
month: cn(
|
|
61
|
-
nav: cn(
|
|
49
|
+
root: cn('sprout-calendar-root', defaults.root),
|
|
50
|
+
months: cn('sprout-calendar-months', defaults.months),
|
|
51
|
+
month: cn('sprout-calendar-month', defaults.month),
|
|
52
|
+
nav: cn('sprout-calendar-nav', defaults.nav),
|
|
62
53
|
button_previous: cn(navButton, defaults.button_previous),
|
|
63
54
|
button_next: cn(navButton, defaults.button_next),
|
|
64
|
-
month_caption: cn(
|
|
65
|
-
dropdowns: cn(
|
|
66
|
-
dropdown_root: cn(
|
|
55
|
+
month_caption: cn('sprout-calendar-caption', defaults.month_caption),
|
|
56
|
+
dropdowns: cn('sprout-calendar-dropdowns', defaults.dropdowns),
|
|
57
|
+
dropdown_root: cn('sprout-calendar-dropdown-root', defaults.dropdown_root),
|
|
67
58
|
dropdown: cn(defaults.dropdown),
|
|
68
|
-
caption_label: cn(
|
|
69
|
-
month_grid: cn(
|
|
70
|
-
weekdays: cn(
|
|
71
|
-
weekday: cn(
|
|
72
|
-
week: cn(
|
|
73
|
-
week_number_header: cn(
|
|
74
|
-
week_number: cn(
|
|
75
|
-
day: cn(
|
|
76
|
-
range_start: cn(
|
|
77
|
-
range_middle: cn(
|
|
78
|
-
range_end: cn(
|
|
79
|
-
today: cn(
|
|
80
|
-
outside: cn(
|
|
81
|
-
disabled: cn(
|
|
82
|
-
hidden: cn(
|
|
59
|
+
caption_label: cn('sprout-calendar-caption-label', defaults.caption_label),
|
|
60
|
+
month_grid: cn('sprout-calendar-grid', defaults.month_grid),
|
|
61
|
+
weekdays: cn('sprout-calendar-weekdays', defaults.weekdays),
|
|
62
|
+
weekday: cn('sprout-calendar-weekday', defaults.weekday),
|
|
63
|
+
week: cn('sprout-calendar-week', defaults.week),
|
|
64
|
+
week_number_header: cn('sprout-calendar-week-number-header', defaults.week_number_header),
|
|
65
|
+
week_number: cn('sprout-calendar-week-number', defaults.week_number),
|
|
66
|
+
day: cn('sprout-calendar-day', defaults.day),
|
|
67
|
+
range_start: cn('sprout-calendar-range-start', defaults.range_start),
|
|
68
|
+
range_middle: cn('sprout-calendar-range-middle', defaults.range_middle),
|
|
69
|
+
range_end: cn('sprout-calendar-range-end', defaults.range_end),
|
|
70
|
+
today: cn('sprout-calendar-today', defaults.today),
|
|
71
|
+
outside: cn('sprout-calendar-outside', defaults.outside),
|
|
72
|
+
disabled: cn('sprout-calendar-disabled', defaults.disabled),
|
|
73
|
+
hidden: cn('sprout-calendar-hidden', defaults.hidden),
|
|
83
74
|
...classNames,
|
|
84
75
|
}, components: {
|
|
85
76
|
Root: CalendarRoot,
|
|
@@ -103,5 +94,5 @@ export function CalendarDayButton({ className, day, modifiers, locale, ...props
|
|
|
103
94
|
ref.current?.focus();
|
|
104
95
|
}, [modifiers.focused]);
|
|
105
96
|
const range = modifiers.range_start || modifiers.range_end || modifiers.range_middle;
|
|
106
|
-
return (_jsx(Button, { ref: ref, variant: "ghost", size: "icon", "data-slot": "calendar-day-button", "data-day": day.date.toLocaleDateString((locale ?? calendarLocale)?.code), "data-selected-single": Boolean(modifiers.selected && !range), "data-range-start": Boolean(modifiers.range_start), "data-range-end": Boolean(modifiers.range_end), "data-range-middle": Boolean(modifiers.range_middle), className: cn(
|
|
97
|
+
return (_jsx(Button, { ref: ref, variant: "ghost", size: "icon", "data-slot": "calendar-day-button", "data-day": day.date.toLocaleDateString((locale ?? calendarLocale)?.code), "data-selected-single": Boolean(modifiers.selected && !range), "data-range-start": Boolean(modifiers.range_start), "data-range-end": Boolean(modifiers.range_end), "data-range-middle": Boolean(modifiers.range_middle), className: cn('sprout-calendar-day-button', getDefaultClassNames().day_button, className), ...props }));
|
|
107
98
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentType, type ReactNode } from
|
|
1
|
+
import { type ComponentType, type ReactNode } from 'react';
|
|
2
2
|
/** Below this split width (px), the canvas opens as a full-screen sheet. */
|
|
3
3
|
export declare const canvasSplitMinWidth = 720;
|
|
4
4
|
export interface CanvasTab {
|
|
@@ -25,7 +25,7 @@ export interface ChatSplitProps {
|
|
|
25
25
|
* sheet. The canvas moves between both without remounting, so drafts,
|
|
26
26
|
* reviews, and scroll survive.
|
|
27
27
|
*/
|
|
28
|
-
export declare function ChatSplit({ open, onOpenChange, chat, canvas, layoutId, className
|
|
28
|
+
export declare function ChatSplit({ open, onOpenChange, chat, canvas, layoutId, className }: ChatSplitProps): import("react").JSX.Element;
|
|
29
29
|
export interface CanvasPanelProps {
|
|
30
30
|
/** Open results. With none, the header reads “Canvas”. */
|
|
31
31
|
tabs: readonly CanvasTab[];
|
|
@@ -53,7 +53,7 @@ export interface CanvasToggleProps {
|
|
|
53
53
|
className?: string | undefined;
|
|
54
54
|
}
|
|
55
55
|
/** A header button that shows or hides the canvas. */
|
|
56
|
-
export declare function CanvasToggle({ open, count, onToggle, className
|
|
56
|
+
export declare function CanvasToggle({ open, count, onToggle, className }: CanvasToggleProps): import("react").JSX.Element;
|
|
57
57
|
export interface CanvasSectionProps {
|
|
58
58
|
title?: string | undefined;
|
|
59
59
|
/** A short line under the title, such as a row count, source, or URL. */
|
|
@@ -64,7 +64,7 @@ export interface CanvasSectionProps {
|
|
|
64
64
|
className?: string | undefined;
|
|
65
65
|
}
|
|
66
66
|
/** Padded content for one result, with an optional title, meta, and actions. */
|
|
67
|
-
export declare function CanvasSection({ title, meta, actions, children, className
|
|
67
|
+
export declare function CanvasSection({ title, meta, actions, children, className }: CanvasSectionProps): import("react").JSX.Element;
|
|
68
68
|
export interface CanvasFrameProps {
|
|
69
69
|
src: string;
|
|
70
70
|
/** Names the frame for assistive tech, such as the page title. */
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore, } from
|
|
4
|
-
import { createPortal } from
|
|
5
|
-
import { ArrowLeft } from
|
|
6
|
-
import { SidebarRight } from
|
|
7
|
-
import { X } from
|
|
8
|
-
import { cn } from
|
|
9
|
-
import { Button } from
|
|
10
|
-
import { Spinner } from
|
|
11
|
-
import { ResizableHandle, ResizablePanel, ResizablePanelGroup, useResizableLayout
|
|
12
|
-
import { Sheet, SheetContent, SheetDescription, SheetTitle } from
|
|
3
|
+
import { createContext, useContext, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore, } from 'react';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
|
+
import { ArrowLeft } from 'reicon-react/icons/ArrowLeft';
|
|
6
|
+
import { SidebarRight } from 'reicon-react/icons/SidebarRight';
|
|
7
|
+
import { X } from 'reicon-react/icons/X';
|
|
8
|
+
import { cn } from '../internal/classes.js';
|
|
9
|
+
import { Button } from './button.js';
|
|
10
|
+
import { Spinner } from './spinner.js';
|
|
11
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup, useResizableLayout } from './resizable.js';
|
|
12
|
+
import { Sheet, SheetContent, SheetDescription, SheetTitle } from './sheet.js';
|
|
13
13
|
/** Below this split width (px), the canvas opens as a full-screen sheet. */
|
|
14
14
|
export const canvasSplitMinWidth = 720;
|
|
15
|
-
const useIsomorphicLayoutEffect = typeof window ===
|
|
16
|
-
const mobileQuery =
|
|
15
|
+
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
|
|
16
|
+
const mobileQuery = '(max-width: 767px)';
|
|
17
17
|
function subscribeMobile(callback) {
|
|
18
18
|
const media = window.matchMedia(mobileQuery);
|
|
19
|
-
media.addEventListener(
|
|
20
|
-
return () => media.removeEventListener(
|
|
19
|
+
media.addEventListener('change', callback);
|
|
20
|
+
return () => media.removeEventListener('change', callback);
|
|
21
21
|
}
|
|
22
22
|
function useViewportMobile() {
|
|
23
23
|
return useSyncExternalStore(subscribeMobile, () => window.matchMedia(mobileQuery).matches, () => false);
|
|
@@ -29,12 +29,11 @@ const CanvasNarrowContext = createContext(null);
|
|
|
29
29
|
* sheet. The canvas moves between both without remounting, so drafts,
|
|
30
30
|
* reviews, and scroll survive.
|
|
31
31
|
*/
|
|
32
|
-
export function ChatSplit({ open, onOpenChange, chat, canvas, layoutId =
|
|
32
|
+
export function ChatSplit({ open, onOpenChange, chat, canvas, layoutId = 'chat-canvas', className }) {
|
|
33
33
|
const viewportMobile = useViewportMobile();
|
|
34
34
|
const container = useRef(null);
|
|
35
35
|
const [availableWidth, setAvailableWidth] = useState(null);
|
|
36
|
-
const mobile = viewportMobile ||
|
|
37
|
-
(availableWidth !== null && availableWidth < canvasSplitMinWidth);
|
|
36
|
+
const mobile = viewportMobile || (availableWidth !== null && availableWidth < canvasSplitMinWidth);
|
|
38
37
|
const split = open && !mobile;
|
|
39
38
|
useIsomorphicLayoutEffect(() => {
|
|
40
39
|
const element = container.current;
|
|
@@ -48,15 +47,15 @@ export function ChatSplit({ open, onOpenChange, chat, canvas, layoutId = "chat-c
|
|
|
48
47
|
}, []);
|
|
49
48
|
const layout = useResizableLayout({
|
|
50
49
|
id: layoutId,
|
|
51
|
-
panelIds: split ? [
|
|
50
|
+
panelIds: split ? ['chat', 'canvas'] : ['chat'],
|
|
52
51
|
onlySaveAfterUserInteractions: true,
|
|
53
52
|
});
|
|
54
53
|
const [desktopHost, setDesktopHost] = useState(null);
|
|
55
54
|
const [mobileHost, setMobileHost] = useState(null);
|
|
56
55
|
const [target, setTarget] = useState(null);
|
|
57
56
|
useIsomorphicLayoutEffect(() => {
|
|
58
|
-
const element = document.createElement(
|
|
59
|
-
element.className =
|
|
57
|
+
const element = document.createElement('div');
|
|
58
|
+
element.className = 'sprout-canvas-host';
|
|
60
59
|
setTarget(element);
|
|
61
60
|
}, []);
|
|
62
61
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -65,7 +64,7 @@ export function ChatSplit({ open, onOpenChange, chat, canvas, layoutId = "chat-c
|
|
|
65
64
|
(mobile ? mobileHost : desktopHost)?.append(target);
|
|
66
65
|
return () => target.remove();
|
|
67
66
|
}, [mobile, open, target, mobileHost, desktopHost]);
|
|
68
|
-
return (_jsx(CanvasNarrowContext, { value: mobile, children: _jsxs("div", { ref: container, "data-slot": "chat-split", "data-layout": mobile ?
|
|
67
|
+
return (_jsx(CanvasNarrowContext, { value: mobile, children: _jsxs("div", { ref: container, "data-slot": "chat-split", "data-layout": mobile ? 'sheet' : 'split', "data-open": open ? '' : undefined, className: cn('sprout-chat-split', className), children: [target && createPortal(canvas, target), _jsxs(ResizablePanelGroup, { orientation: "horizontal", defaultLayout: layout.defaultLayout, onLayoutChanged: layout.onLayoutChanged, children: [_jsx(ResizablePanel, { id: "chat", minSize: "40%", defaultSize: split ? '55%' : '100%', children: _jsx("div", { className: "sprout-chat-split-pane", children: chat }) }), split && (_jsxs(_Fragment, { children: [_jsx(ResizableHandle, { withHandle: true, "aria-label": "Resize canvas" }), _jsx(ResizablePanel, { id: "canvas", minSize: "320px", defaultSize: "45%", children: _jsx("div", { ref: setDesktopHost, className: "sprout-chat-split-pane" }) })] }))] }), _jsx(Sheet, { open: open && mobile, onOpenChange: next => onOpenChange(next), children: _jsxs(SheetContent, { side: "right", size: "full", showCloseButton: false, keepMounted: true, finalFocus: !open, className: "sprout-canvas-sheet", children: [_jsxs("div", { className: "sprout-canvas-sr-only", children: [_jsx(SheetTitle, { children: "Canvas" }), _jsx(SheetDescription, { children: "Detailed result. Return to chat to continue the conversation." })] }), _jsx("div", { ref: setMobileHost, className: "sprout-chat-split-pane" })] }) })] }) }));
|
|
69
68
|
}
|
|
70
69
|
/**
|
|
71
70
|
* The canvas surface: a tab per open result, a close button, and the active
|
|
@@ -83,7 +82,7 @@ export function CanvasPanel({ tabs, activeId, onSelect, onCloseTab, onClose, chi
|
|
|
83
82
|
const heading = useRef(null);
|
|
84
83
|
const refocus = useRef(null);
|
|
85
84
|
const [hovered, setHovered] = useState(null);
|
|
86
|
-
const activeIndex = tabs.findIndex(
|
|
85
|
+
const activeIndex = tabs.findIndex(tab => tab.id === activeId);
|
|
87
86
|
const tabId = (index) => `${base}-tab-${index}`;
|
|
88
87
|
const bodyId = `${base}-body`;
|
|
89
88
|
useEffect(() => {
|
|
@@ -104,9 +103,7 @@ export function CanvasPanel({ tabs, activeId, onSelect, onCloseTab, onClose, chi
|
|
|
104
103
|
return;
|
|
105
104
|
refocus.current = null;
|
|
106
105
|
const next = tabs[Math.min(index, tabs.length - 1)];
|
|
107
|
-
const target = (next && tabButtons.current.get(next.id)) ??
|
|
108
|
-
closeButton.current ??
|
|
109
|
-
heading.current;
|
|
106
|
+
const target = (next && tabButtons.current.get(next.id)) ?? closeButton.current ?? heading.current;
|
|
110
107
|
target?.focus();
|
|
111
108
|
}, [tabs]);
|
|
112
109
|
const closeTab = (index) => {
|
|
@@ -117,18 +114,18 @@ export function CanvasPanel({ tabs, activeId, onSelect, onCloseTab, onClose, chi
|
|
|
117
114
|
onCloseTab(tab.id);
|
|
118
115
|
};
|
|
119
116
|
const onTabKeyDown = (event, index) => {
|
|
120
|
-
if (event.key ===
|
|
117
|
+
if (event.key === 'Delete') {
|
|
121
118
|
event.preventDefault();
|
|
122
119
|
closeTab(index);
|
|
123
120
|
return;
|
|
124
121
|
}
|
|
125
|
-
const next = event.key ===
|
|
122
|
+
const next = event.key === 'ArrowRight'
|
|
126
123
|
? index + 1
|
|
127
|
-
: event.key ===
|
|
124
|
+
: event.key === 'ArrowLeft'
|
|
128
125
|
? index - 1
|
|
129
|
-
: event.key ===
|
|
126
|
+
: event.key === 'Home'
|
|
130
127
|
? 0
|
|
131
|
-
: event.key ===
|
|
128
|
+
: event.key === 'End'
|
|
132
129
|
? tabs.length - 1
|
|
133
130
|
: null;
|
|
134
131
|
if (next === null || tabs.length === 0)
|
|
@@ -140,41 +137,37 @@ export function CanvasPanel({ tabs, activeId, onSelect, onCloseTab, onClose, chi
|
|
|
140
137
|
onSelect(target.id);
|
|
141
138
|
tabButtons.current.get(target.id)?.focus();
|
|
142
139
|
};
|
|
143
|
-
return (_jsxs("section", { "data-slot": "canvas", "data-layout": mobile ?
|
|
144
|
-
if (event.key ===
|
|
140
|
+
return (_jsxs("section", { "data-slot": "canvas", "data-layout": mobile ? 'sheet' : 'split', "aria-label": "Canvas", className: cn('sprout-canvas', className), onKeyDown: event => {
|
|
141
|
+
if (event.key === 'Escape' && !event.defaultPrevented) {
|
|
145
142
|
event.preventDefault();
|
|
146
143
|
onClose();
|
|
147
144
|
}
|
|
148
145
|
}, children: [mobile && (_jsx("div", { className: "sprout-canvas-back", children: _jsxs(Button, { variant: "ghost", size: "sm", onClick: onClose, children: [_jsx(ArrowLeft, { size: 16, "aria-hidden": "true" }), "Back to chat"] }) })), _jsxs("header", { className: "sprout-canvas-header", children: [tabs.length === 0 ? (_jsx("h2", { ref: heading, tabIndex: -1, className: "sprout-canvas-heading", children: "Canvas" })) : (_jsxs("div", { ref: list, className: "sprout-canvas-tabs", children: [_jsx("div", { role: "tablist", "aria-label": "Open in canvas", className: "sprout-canvas-tablist", children: tabs.map((tab, index) => {
|
|
149
146
|
const active = index === activeIndex;
|
|
150
147
|
const Icon = tab.icon;
|
|
151
|
-
return (_jsxs("button", { type: "button", role: "tab", id: tabId(index), ref:
|
|
148
|
+
return (_jsxs("button", { type: "button", role: "tab", id: tabId(index), ref: node => {
|
|
152
149
|
if (node)
|
|
153
150
|
tabButtons.current.set(tab.id, node);
|
|
154
151
|
else
|
|
155
152
|
tabButtons.current.delete(tab.id);
|
|
156
|
-
}, "data-slot": "canvas-tab", "data-active": active ?
|
|
153
|
+
}, "data-slot": "canvas-tab", "data-active": active ? '' : undefined, "data-busy": tab.busy ? '' : undefined, "data-hover": hovered === tab.id ? '' : undefined, "aria-label": tab.busy ? `${tab.title}, loading` : undefined, "aria-selected": active, "aria-controls": bodyId, tabIndex: active || (activeIndex === -1 && index === 0) ? 0 : -1, style: { order: index * 2 }, onClick: () => onSelect(tab.id), onKeyDown: event => onTabKeyDown(event, index), onPointerEnter: () => setHovered(tab.id), onPointerLeave: () => setHovered(null), className: "sprout-canvas-tab", children: [tab.busy ? (_jsx(Spinner, { size: "sm", "aria-hidden": "true" })) : (Icon && (_jsx("span", { "aria-hidden": "true", className: "sprout-canvas-tab-icon", children: _jsx(Icon, { size: 14 }) }))), _jsx("span", { className: "sprout-canvas-tab-title", children: tab.title })] }, tab.id));
|
|
157
154
|
}) }), tabs.map((tab, index) => {
|
|
158
155
|
const active = index === activeIndex;
|
|
159
|
-
return (_jsx("button", { type: "button", "aria-label": `Close ${tab.title}`, "data-active": active ?
|
|
160
|
-
})] })), !mobile && (_jsx(Button, { ref: closeButton, variant: "ghost", size: "icon-sm", "aria-label": "Close canvas", title: "Close canvas (Esc)", onClick: onClose, children: _jsx(X, { size: 16, "aria-hidden": "true" }) }))] }), activity, _jsx("div", { id: bodyId, role: tabs.length ?
|
|
156
|
+
return (_jsx("button", { type: "button", "aria-label": `Close ${tab.title}`, "data-active": active ? '' : undefined, "data-hover": hovered === tab.id ? '' : undefined, tabIndex: active ? 0 : -1, style: { order: index * 2 + 1 }, onClick: () => closeTab(index), onPointerEnter: () => setHovered(tab.id), onPointerLeave: () => setHovered(null), className: "sprout-canvas-tab-close", children: _jsx(X, { size: 12, "aria-hidden": "true" }) }, tab.id));
|
|
157
|
+
})] })), !mobile && (_jsx(Button, { ref: closeButton, variant: "ghost", size: "icon-sm", "aria-label": "Close canvas", title: "Close canvas (Esc)", onClick: onClose, children: _jsx(X, { size: 16, "aria-hidden": "true" }) }))] }), activity, _jsx("div", { id: bodyId, role: tabs.length ? 'tabpanel' : undefined, "aria-labelledby": activeIndex === -1 ? undefined : tabId(activeIndex), tabIndex: tabs.length ? 0 : undefined, className: "sprout-canvas-body", children: children })] }));
|
|
161
158
|
}
|
|
162
159
|
/** A header button that shows or hides the canvas. */
|
|
163
|
-
export function CanvasToggle({ open, count, onToggle, className
|
|
164
|
-
return (_jsxs(Button, { variant: "ghost", size: "sm", "data-slot": "canvas-toggle", "aria-pressed": open, "aria-label": open
|
|
165
|
-
? "Hide canvas"
|
|
166
|
-
: count
|
|
167
|
-
? `Show canvas, ${count} open`
|
|
168
|
-
: "Show canvas", title: "Open detailed results without leaving your chat", onClick: onToggle, className: cn("sprout-canvas-toggle", className), children: [_jsx(SidebarRight, { size: 16, "aria-hidden": "true" }), _jsx("span", { className: "sprout-canvas-toggle-label", children: open ? "Hide results" : "View results" }), count > 0 && (_jsx("span", { "aria-hidden": "true", className: "sprout-canvas-toggle-count", children: count }))] }));
|
|
160
|
+
export function CanvasToggle({ open, count, onToggle, className }) {
|
|
161
|
+
return (_jsxs(Button, { variant: "ghost", size: "sm", "data-slot": "canvas-toggle", "aria-pressed": open, "aria-label": open ? 'Hide canvas' : count ? `Show canvas, ${count} open` : 'Show canvas', title: "Open detailed results without leaving your chat", onClick: onToggle, className: cn('sprout-canvas-toggle', className), children: [_jsx(SidebarRight, { size: 16, "aria-hidden": "true" }), _jsx("span", { className: "sprout-canvas-toggle-label", children: open ? 'Hide results' : 'View results' }), count > 0 && (_jsx("span", { "aria-hidden": "true", className: "sprout-canvas-toggle-count", children: count }))] }));
|
|
169
162
|
}
|
|
170
163
|
/** Padded content for one result, with an optional title, meta, and actions. */
|
|
171
|
-
export function CanvasSection({ title, meta, actions, children, className
|
|
172
|
-
return (_jsxs("div", { "data-slot": "canvas-section", className: cn(
|
|
164
|
+
export function CanvasSection({ title, meta, actions, children, className }) {
|
|
165
|
+
return (_jsxs("div", { "data-slot": "canvas-section", className: cn('sprout-canvas-section', className), children: [(title || actions) && (_jsxs("div", { className: "sprout-canvas-section-header", children: [_jsxs("div", { className: "sprout-canvas-section-text", children: [title && _jsx("h3", { className: "sprout-canvas-section-title", children: title }), meta && _jsx("p", { className: "sprout-canvas-section-meta", children: meta })] }), actions && _jsx("div", { className: "sprout-canvas-section-actions", children: actions })] })), children] }));
|
|
173
166
|
}
|
|
174
167
|
/**
|
|
175
168
|
* A sandboxed page preview. Scripts and popups run; same-origin access,
|
|
176
169
|
* forms, and top navigation are blocked, and no referrer is sent.
|
|
177
170
|
*/
|
|
178
171
|
export function CanvasFrame({ src, title, className }) {
|
|
179
|
-
return (_jsx("div", { "data-slot": "canvas-frame", className: cn(
|
|
172
|
+
return (_jsx("div", { "data-slot": "canvas-frame", className: cn('sprout-canvas-frame', className), children: _jsx("iframe", { src: src, title: title, sandbox: "allow-scripts allow-popups", referrerPolicy: "no-referrer", loading: "lazy" }) }));
|
|
180
173
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRender } from
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
2
|
export declare const cardSizeNames: readonly ["default", "sm"];
|
|
3
3
|
export declare const cardSurfaceNames: readonly ["default", "raised"];
|
|
4
4
|
export type CardSize = (typeof cardSizeNames)[number];
|
|
@@ -8,13 +8,13 @@ export interface CardVariantOptions {
|
|
|
8
8
|
surface?: CardSurface | null;
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare function cardVariants({ size, surface, className
|
|
11
|
+
export declare function cardVariants({ size, surface, className }?: CardVariantOptions): string;
|
|
12
12
|
export interface CardState extends Record<string, unknown> {
|
|
13
|
-
slot:
|
|
13
|
+
slot: 'card';
|
|
14
14
|
size: CardSize;
|
|
15
15
|
surface: CardSurface;
|
|
16
16
|
}
|
|
17
|
-
export interface CardProps extends useRender.ComponentProps<
|
|
17
|
+
export interface CardProps extends useRender.ComponentProps<'div', CardState> {
|
|
18
18
|
/** `sm` tightens padding and gaps from 16px to 12px and shrinks the title. */
|
|
19
19
|
size?: CardSize;
|
|
20
20
|
/** `raised` lifts the card off a surface of the same color. */
|
|
@@ -25,11 +25,11 @@ export interface CardProps extends useRender.ComponentProps<"div", CardState> {
|
|
|
25
25
|
* `CardHeader`, `CardContent`, and `CardFooter`.
|
|
26
26
|
*/
|
|
27
27
|
export declare function Card({ className, size, surface, render, ref, ...props }: CardProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
28
|
-
type PartSlot =
|
|
28
|
+
type PartSlot = 'card-header' | 'card-title' | 'card-description' | 'card-action' | 'card-content' | 'card-footer';
|
|
29
29
|
export interface CardPartState extends Record<string, unknown> {
|
|
30
30
|
slot: PartSlot;
|
|
31
31
|
}
|
|
32
|
-
export type CardPartProps = useRender.ComponentProps<
|
|
32
|
+
export type CardPartProps = useRender.ComponentProps<'div', CardPartState>;
|
|
33
33
|
/** Lays out the title, description, and an optional `CardAction`. */
|
|
34
34
|
export declare const CardHeader: ({ className, render, ref, ...props }: CardPartProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
35
35
|
/** A `div` by default. Pass `render={<h3 />}` to put it in the outline. */
|
package/dist/components/card.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { mergeProps } from
|
|
2
|
-
import { useRender } from
|
|
3
|
-
import { cn } from
|
|
4
|
-
export const cardSizeNames = [
|
|
5
|
-
export const cardSurfaceNames = [
|
|
6
|
-
export function cardVariants({ size, surface, className
|
|
7
|
-
return cn(
|
|
1
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import { cn } from '../internal/classes.js';
|
|
4
|
+
export const cardSizeNames = ['default', 'sm'];
|
|
5
|
+
export const cardSurfaceNames = ['default', 'raised'];
|
|
6
|
+
export function cardVariants({ size, surface, className } = {}) {
|
|
7
|
+
return cn('sprout-card', size === 'sm' && 'sprout-card-sm', surface === 'raised' && 'sprout-card-raised', className);
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* A bordered panel that groups related content. Compose it with
|
|
11
11
|
* `CardHeader`, `CardContent`, and `CardFooter`.
|
|
12
12
|
*/
|
|
13
|
-
export function Card({ className, size =
|
|
13
|
+
export function Card({ className, size = 'default', surface = 'default', render, ref, ...props }) {
|
|
14
14
|
return useRender({
|
|
15
|
-
defaultTagName:
|
|
15
|
+
defaultTagName: 'div',
|
|
16
16
|
ref,
|
|
17
17
|
render,
|
|
18
18
|
props: mergeProps({ className: cardVariants({ size, surface, className }) }, props),
|
|
19
|
-
state: { slot:
|
|
19
|
+
state: { slot: 'card', size, surface },
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
function part(slot, base) {
|
|
23
23
|
return function CardPart({ className, render, ref, ...props }) {
|
|
24
24
|
return useRender({
|
|
25
|
-
defaultTagName:
|
|
25
|
+
defaultTagName: 'div',
|
|
26
26
|
ref,
|
|
27
27
|
render,
|
|
28
28
|
props: mergeProps({ className: cn(base, className) }, props),
|
|
@@ -31,12 +31,12 @@ function part(slot, base) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
/** Lays out the title, description, and an optional `CardAction`. */
|
|
34
|
-
export const CardHeader = part(
|
|
34
|
+
export const CardHeader = part('card-header', 'sprout-card-header');
|
|
35
35
|
/** A `div` by default. Pass `render={<h3 />}` to put it in the outline. */
|
|
36
|
-
export const CardTitle = part(
|
|
37
|
-
export const CardDescription = part(
|
|
36
|
+
export const CardTitle = part('card-title', 'sprout-card-title');
|
|
37
|
+
export const CardDescription = part('card-description', 'sprout-card-description');
|
|
38
38
|
/** Pins a badge or compact control to the header's top-right corner. */
|
|
39
|
-
export const CardAction = part(
|
|
40
|
-
export const CardContent = part(
|
|
39
|
+
export const CardAction = part('card-action', 'sprout-card-action');
|
|
40
|
+
export const CardContent = part('card-content', 'sprout-card-content');
|
|
41
41
|
/** A tinted bar along the bottom edge for actions and status. */
|
|
42
|
-
export const CardFooter = part(
|
|
42
|
+
export const CardFooter = part('card-footer', 'sprout-card-footer');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type ComponentProps, type RefCallback } from
|
|
2
|
-
import { type ButtonProps } from
|
|
1
|
+
import { type ComponentProps, type RefCallback } from 'react';
|
|
2
|
+
import { type ButtonProps } from './button.js';
|
|
3
3
|
export declare const carouselOrientationNames: readonly ["horizontal", "vertical"];
|
|
4
4
|
export declare const carouselAlignNames: readonly ["start", "center", "end"];
|
|
5
5
|
export type CarouselOrientation = (typeof carouselOrientationNames)[number];
|
|
6
6
|
export type CarouselAlign = (typeof carouselAlignNames)[number];
|
|
7
|
-
export type CarouselEvent =
|
|
7
|
+
export type CarouselEvent = 'select' | 'reInit';
|
|
8
8
|
export interface CarouselOptions {
|
|
9
9
|
/** Where a slide lands in the viewport when it is the current one. Default `start`. */
|
|
10
10
|
align?: CarouselAlign | undefined;
|
|
@@ -28,7 +28,7 @@ export interface CarouselApi {
|
|
|
28
28
|
on(event: CarouselEvent, listener: (api: CarouselApi) => void): CarouselApi;
|
|
29
29
|
off(event: CarouselEvent, listener: (api: CarouselApi) => void): CarouselApi;
|
|
30
30
|
}
|
|
31
|
-
export interface CarouselProps extends ComponentProps<
|
|
31
|
+
export interface CarouselProps extends ComponentProps<'div'> {
|
|
32
32
|
opts?: CarouselOptions | undefined;
|
|
33
33
|
orientation?: CarouselOrientation | undefined;
|
|
34
34
|
/** Receives the carousel API once it mounts. */
|
|
@@ -50,8 +50,8 @@ export interface CarouselContextValue {
|
|
|
50
50
|
}
|
|
51
51
|
export declare function useCarousel(): CarouselContextValue;
|
|
52
52
|
export declare function Carousel({ orientation, opts, setApi, className, children, onKeyDownCapture, ...props }: CarouselProps): import("react").JSX.Element;
|
|
53
|
-
export declare function CarouselContent({ className, ...props }: ComponentProps<
|
|
54
|
-
export declare function CarouselItem({ className, ...props }: ComponentProps<
|
|
55
|
-
export type CarouselButtonProps = Omit<ButtonProps,
|
|
53
|
+
export declare function CarouselContent({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
54
|
+
export declare function CarouselItem({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
55
|
+
export type CarouselButtonProps = Omit<ButtonProps, 'state' | 'pendingLabel'>;
|
|
56
56
|
export declare function CarouselPrevious({ className, variant, size, children, ...props }: CarouselButtonProps): import("react").JSX.Element;
|
|
57
57
|
export declare function CarouselNext({ className, variant, size, children, ...props }: CarouselButtonProps): import("react").JSX.Element;
|