@tulipfarm/sprout 0.3.1 → 0.5.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 +75 -68
- package/dist/components/accordion.d.ts +2 -2
- package/dist/components/accordion.js +9 -9
- package/dist/components/agent-avatar.d.ts +27 -0
- package/dist/components/agent-avatar.js +67 -0
- package/dist/components/agent-fanout.d.ts +2 -2
- package/dist/components/agent-fanout.js +65 -87
- package/dist/components/alert-dialog.d.ts +8 -8
- package/dist/components/alert-dialog.js +21 -21
- 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 +18 -18
- package/dist/components/attachment.js +82 -115
- package/dist/components/avatar.d.ts +9 -17
- package/dist/components/avatar.js +14 -51
- 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 +13 -13
- package/dist/components/button.js +31 -57
- 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 +7 -7
- 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 +12 -6
- package/dist/components/combobox.js +27 -26
- 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 +7 -7
- 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 +18 -18
- package/dist/components/input-group.js +25 -39
- package/dist/components/input-otp.d.ts +14 -10
- package/dist/components/input-otp.js +15 -15
- package/dist/components/input.d.ts +3 -3
- 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 +17 -17
- 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 +5 -5
- 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 +3 -3
- 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 +5 -9
- 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 +7 -7
- 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 +8 -8
- package/dist/components/state-sample.js +18 -31
- package/dist/components/switch.d.ts +3 -3
- 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 +4 -4
- package/dist/components/toggle-group.js +18 -20
- package/dist/components/toggle.d.ts +4 -4
- 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 +99 -93
- package/dist/index.js +99 -93
- package/dist/internal/agent-avatar-artwork.d.ts +4 -0
- package/dist/internal/agent-avatar-artwork.js +219 -0
- 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/hash.d.ts +1 -0
- package/dist/internal/hash.js +9 -0
- 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 +56 -98
- package/dist/styles/avatar.css +14 -33
- 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 +9 -15
- package/dist/styles/button.css +45 -175
- 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 +4 -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 +24 -17
- package/dist/styles/command.css +8 -9
- package/dist/styles/context-menu.css +4 -2
- package/dist/styles/dialog.css +5 -16
- package/dist/styles/dropdown-menu.css +4 -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 +16 -39
- package/dist/styles/hover-card.css +9 -15
- package/dist/styles/index.css +121 -112
- package/dist/styles/input-group.css +61 -69
- package/dist/styles/input-otp.css +18 -9
- package/dist/styles/input.css +19 -11
- 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 +9 -8
- 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 +15 -30
- package/dist/styles/notice-banner.css +1 -2
- package/dist/styles/page-header.css +11 -10
- package/dist/styles/pagination.css +12 -6
- 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 +4 -4
- package/dist/styles/result-notice.css +80 -0
- package/dist/styles/review-card.css +2 -3
- package/dist/styles/rich-text-editor.css +4 -5
- 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 +15 -19
- 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 +32 -34
- 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 +62 -81
- package/dist/styles/tabs.css +13 -19
- 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 +23 -29
- package/dist/styles/toggle.css +14 -14
- 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 +297 -0
- package/package.json +25 -1
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Dialog as DialogPrimitive } from
|
|
4
|
-
import { mergeProps } from
|
|
5
|
-
import { useRender } from
|
|
6
|
-
import { X } from
|
|
7
|
-
import { cn, stateClassName } from
|
|
8
|
-
import { Button } from
|
|
9
|
-
export const dialogSizeNames = [
|
|
10
|
-
|
|
11
|
-
"form",
|
|
12
|
-
"split",
|
|
13
|
-
"fullscreen",
|
|
14
|
-
];
|
|
15
|
-
export const dialogPlacementNames = ["center", "top"];
|
|
3
|
+
import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';
|
|
4
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
5
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
6
|
+
import { X } from 'reicon-react/icons/X';
|
|
7
|
+
import { cn, stateClassName } from '../internal/classes.js';
|
|
8
|
+
import { Button } from './button.js';
|
|
9
|
+
export const dialogSizeNames = ['default', 'form', 'split', 'fullscreen'];
|
|
10
|
+
export const dialogPlacementNames = ['center', 'top'];
|
|
16
11
|
export function Dialog(props) {
|
|
17
12
|
return _jsx(DialogPrimitive.Root, { ...props });
|
|
18
13
|
}
|
|
@@ -26,54 +21,54 @@ export function DialogClose(props) {
|
|
|
26
21
|
return _jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
27
22
|
}
|
|
28
23
|
export function DialogOverlay({ className, ...props }) {
|
|
29
|
-
return (_jsx(DialogPrimitive.Backdrop, { "data-slot": "dialog-overlay", ...props, className: stateClassName(
|
|
24
|
+
return (_jsx(DialogPrimitive.Backdrop, { "data-slot": "dialog-overlay", ...props, className: stateClassName('sprout-dialog-overlay', className) }));
|
|
30
25
|
}
|
|
31
26
|
/**
|
|
32
27
|
* The dialog surface. It renders its own portal and overlay, so place it
|
|
33
28
|
* directly inside `Dialog`.
|
|
34
29
|
*/
|
|
35
|
-
export function DialogContent({ className, children, showCloseButton = true, closeLabel =
|
|
36
|
-
return (_jsxs(DialogPortal, { container: container, children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Popup, { "data-slot": "dialog-content", "data-size": size, "data-placement": size ===
|
|
30
|
+
export function DialogContent({ className, children, showCloseButton = true, closeLabel = 'Close', size = 'default', placement = 'center', container, ...props }) {
|
|
31
|
+
return (_jsxs(DialogPortal, { container: container, children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Popup, { "data-slot": "dialog-content", "data-size": size, "data-placement": size === 'fullscreen' ? undefined : placement, ...props, className: stateClassName(cn('sprout-dialog-content', `sprout-dialog-${size}`), className), children: [children, showCloseButton && (_jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", className: "sprout-dialog-close", "aria-label": closeLabel, render: _jsx(Button, { variant: "ghost", size: "icon-sm" }), children: _jsx(X, { size: 16, "aria-hidden": "true" }) }))] })] }));
|
|
37
32
|
}
|
|
38
33
|
function part(slot, base) {
|
|
39
34
|
return function DialogPart({ className, render, ref, ...props }) {
|
|
40
35
|
return useRender({
|
|
41
|
-
defaultTagName:
|
|
36
|
+
defaultTagName: 'div',
|
|
42
37
|
ref,
|
|
43
38
|
render,
|
|
44
|
-
props: mergeProps({
|
|
39
|
+
props: mergeProps({ 'data-slot': slot, className: cn(base, className) }, props),
|
|
45
40
|
state: { slot },
|
|
46
41
|
});
|
|
47
42
|
};
|
|
48
43
|
}
|
|
49
44
|
/** Stacks the title and description. */
|
|
50
|
-
export const DialogHeader = part(
|
|
45
|
+
export const DialogHeader = part('dialog-header', 'sprout-dialog-header');
|
|
51
46
|
/**
|
|
52
47
|
* The scrolling middle of a `form` dialog. It bleeds to the dialog edges so
|
|
53
48
|
* scrollbars and focus rings are not clipped.
|
|
54
49
|
*/
|
|
55
|
-
export const DialogBody = part(
|
|
50
|
+
export const DialogBody = part('dialog-body', 'sprout-dialog-body');
|
|
56
51
|
/**
|
|
57
52
|
* A tinted action bar pinned to the bottom edge. Actions stack in reverse
|
|
58
53
|
* order on narrow screens and align right from 640px. A leading `<p>` becomes
|
|
59
54
|
* a hint that sits at the start.
|
|
60
55
|
*/
|
|
61
|
-
export function DialogFooter({ className, render, ref, showCloseButton = false, closeLabel =
|
|
56
|
+
export function DialogFooter({ className, render, ref, showCloseButton = false, closeLabel = 'Close', children, ...props }) {
|
|
62
57
|
return useRender({
|
|
63
|
-
defaultTagName:
|
|
58
|
+
defaultTagName: 'div',
|
|
64
59
|
ref,
|
|
65
60
|
render,
|
|
66
61
|
props: mergeProps({
|
|
67
|
-
|
|
68
|
-
className: cn(
|
|
62
|
+
'data-slot': 'dialog-footer',
|
|
63
|
+
className: cn('sprout-dialog-footer', className),
|
|
69
64
|
children: (_jsxs(_Fragment, { children: [children, showCloseButton && (_jsx(DialogPrimitive.Close, { render: _jsx(Button, { variant: "outline" }), children: closeLabel }))] })),
|
|
70
65
|
}, props),
|
|
71
|
-
state: { slot:
|
|
66
|
+
state: { slot: 'dialog-footer' },
|
|
72
67
|
});
|
|
73
68
|
}
|
|
74
69
|
export function DialogTitle({ className, ...props }) {
|
|
75
|
-
return (_jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", ...props, className: stateClassName(
|
|
70
|
+
return (_jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", ...props, className: stateClassName('sprout-dialog-title', className) }));
|
|
76
71
|
}
|
|
77
72
|
export function DialogDescription({ className, ...props }) {
|
|
78
|
-
return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", ...props, className: stateClassName(
|
|
73
|
+
return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", ...props, className: stateClassName('sprout-dialog-description', className) }));
|
|
79
74
|
}
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* indicators, and popup sides follow it. It does not set the `dir` attribute;
|
|
4
4
|
* set `dir` on a wrapping element so CSS and the browser follow the same way.
|
|
5
5
|
*/
|
|
6
|
-
export { DirectionProvider, useDirection, type DirectionProviderProps, type TextDirection, } from
|
|
6
|
+
export { DirectionProvider, useDirection, type DirectionProviderProps, type TextDirection, } from '@base-ui/react/direction-provider';
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* indicators, and popup sides follow it. It does not set the `dir` attribute;
|
|
4
4
|
* set `dir` on a wrapping element so CSS and the browser follow the same way.
|
|
5
5
|
*/
|
|
6
|
-
export { DirectionProvider, useDirection, } from
|
|
6
|
+
export { DirectionProvider, useDirection, } from '@base-ui/react/direction-provider';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentProps } from
|
|
2
|
-
import { Menu as MenuPrimitive } from
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { Menu as MenuPrimitive } from '@base-ui/react/menu';
|
|
3
3
|
export declare const dropdownMenuContentSizeNames: readonly ["anchor", "menu"];
|
|
4
4
|
export declare const dropdownMenuItemVariantNames: readonly ["default", "destructive"];
|
|
5
5
|
export type DropdownMenuContentSize = (typeof dropdownMenuContentSizeNames)[number];
|
|
@@ -10,7 +10,7 @@ export type DropdownMenuPortalProps = MenuPrimitive.Portal.Props;
|
|
|
10
10
|
export declare function DropdownMenuPortal(props: DropdownMenuPortalProps): import("react").JSX.Element;
|
|
11
11
|
export type DropdownMenuTriggerProps = MenuPrimitive.Trigger.Props;
|
|
12
12
|
export declare function DropdownMenuTrigger(props: DropdownMenuTriggerProps): import("react").JSX.Element;
|
|
13
|
-
type PositionerProps = Pick<MenuPrimitive.Positioner.Props,
|
|
13
|
+
type PositionerProps = Pick<MenuPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'collisionPadding' | 'collisionAvoidance' | 'sticky' | 'positionMethod'>;
|
|
14
14
|
export interface DropdownMenuContentProps extends MenuPrimitive.Popup.Props, PositionerProps {
|
|
15
15
|
/**
|
|
16
16
|
* `anchor` matches the trigger width (at least 8rem). `menu` is a fixed
|
|
@@ -18,7 +18,7 @@ export interface DropdownMenuContentProps extends MenuPrimitive.Popup.Props, Pos
|
|
|
18
18
|
*/
|
|
19
19
|
size?: DropdownMenuContentSize;
|
|
20
20
|
/** Where the portal renders. Defaults to `document.body`. */
|
|
21
|
-
container?: MenuPrimitive.Portal.Props[
|
|
21
|
+
container?: MenuPrimitive.Portal.Props['container'];
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* The menu surface. It renders its own portal and positioner, so place it
|
|
@@ -56,7 +56,7 @@ export interface DropdownMenuRadioItemProps extends MenuPrimitive.RadioItem.Prop
|
|
|
56
56
|
export declare function DropdownMenuRadioItem({ className, inset, children, ...props }: DropdownMenuRadioItemProps): import("react").JSX.Element;
|
|
57
57
|
export type DropdownMenuSeparatorProps = MenuPrimitive.Separator.Props;
|
|
58
58
|
export declare function DropdownMenuSeparator({ className, ...props }: DropdownMenuSeparatorProps): import("react").JSX.Element;
|
|
59
|
-
export type DropdownMenuShortcutProps = ComponentProps<
|
|
59
|
+
export type DropdownMenuShortcutProps = ComponentProps<'span'>;
|
|
60
60
|
/** Right-aligned hint text, such as a keyboard shortcut. It does not bind keys. */
|
|
61
61
|
export declare function DropdownMenuShortcut({ className, ...props }: DropdownMenuShortcutProps): import("react").JSX.Element;
|
|
62
62
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Menu as MenuPrimitive } from
|
|
4
|
-
import { Check } from
|
|
5
|
-
import { ChevronRight } from
|
|
6
|
-
import { cn, stateClassName } from
|
|
7
|
-
export const dropdownMenuContentSizeNames = [
|
|
8
|
-
export const dropdownMenuItemVariantNames = [
|
|
3
|
+
import { Menu as MenuPrimitive } from '@base-ui/react/menu';
|
|
4
|
+
import { Check } from 'reicon-react/icons/Check';
|
|
5
|
+
import { ChevronRight } from 'reicon-react/icons/ChevronRight';
|
|
6
|
+
import { cn, stateClassName } from '../internal/classes.js';
|
|
7
|
+
export const dropdownMenuContentSizeNames = ['anchor', 'menu'];
|
|
8
|
+
export const dropdownMenuItemVariantNames = ['default', 'destructive'];
|
|
9
9
|
export function DropdownMenu(props) {
|
|
10
10
|
return _jsx(MenuPrimitive.Root, { ...props });
|
|
11
11
|
}
|
|
@@ -19,41 +19,41 @@ export function DropdownMenuTrigger(props) {
|
|
|
19
19
|
* The menu surface. It renders its own portal and positioner, so place it
|
|
20
20
|
* directly inside `DropdownMenu` or `DropdownMenuSub`.
|
|
21
21
|
*/
|
|
22
|
-
export function DropdownMenuContent({ align =
|
|
23
|
-
return (_jsx(MenuPrimitive.Portal, { container: container, children: _jsx(MenuPrimitive.Positioner, { className: "sprout-dropdown-menu-positioner", align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, collisionPadding: collisionPadding, collisionAvoidance: collisionAvoidance, sticky: sticky, positionMethod: positionMethod, children: _jsx(MenuPrimitive.Popup, { "data-slot": "dropdown-menu-content", "data-size": size, ...props, className: stateClassName(cn(
|
|
22
|
+
export function DropdownMenuContent({ align = 'start', alignOffset = 0, side = 'bottom', sideOffset = 4, collisionPadding = 8, collisionAvoidance, sticky, positionMethod, size = 'anchor', container, className, ...props }) {
|
|
23
|
+
return (_jsx(MenuPrimitive.Portal, { container: container, children: _jsx(MenuPrimitive.Positioner, { className: "sprout-dropdown-menu-positioner", align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, collisionPadding: collisionPadding, collisionAvoidance: collisionAvoidance, sticky: sticky, positionMethod: positionMethod, children: _jsx(MenuPrimitive.Popup, { "data-slot": "dropdown-menu-content", "data-size": size, ...props, className: stateClassName(cn('sprout-dropdown-menu-content', `sprout-dropdown-menu-${size}`), className) }) }) }));
|
|
24
24
|
}
|
|
25
25
|
export function DropdownMenuGroup(props) {
|
|
26
26
|
return _jsx(MenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
27
27
|
}
|
|
28
28
|
export function DropdownMenuLabel({ className, inset, ...props }) {
|
|
29
|
-
return (_jsx(MenuPrimitive.GroupLabel, { "data-slot": "dropdown-menu-label", "data-inset": inset || undefined, ...props, className: stateClassName(
|
|
29
|
+
return (_jsx(MenuPrimitive.GroupLabel, { "data-slot": "dropdown-menu-label", "data-inset": inset || undefined, ...props, className: stateClassName('sprout-dropdown-menu-label', className) }));
|
|
30
30
|
}
|
|
31
|
-
export function DropdownMenuItem({ className, inset, variant =
|
|
32
|
-
return (_jsx(MenuPrimitive.Item, { "data-slot": "dropdown-menu-item", "data-inset": inset || undefined, "data-variant": variant, ...props, className: stateClassName(
|
|
31
|
+
export function DropdownMenuItem({ className, inset, variant = 'default', ...props }) {
|
|
32
|
+
return (_jsx(MenuPrimitive.Item, { "data-slot": "dropdown-menu-item", "data-inset": inset || undefined, "data-variant": variant, ...props, className: stateClassName('sprout-dropdown-menu-item', className) }));
|
|
33
33
|
}
|
|
34
34
|
export function DropdownMenuSub(props) {
|
|
35
35
|
return _jsx(MenuPrimitive.SubmenuRoot, { ...props });
|
|
36
36
|
}
|
|
37
37
|
export function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
38
|
-
return (_jsxs(MenuPrimitive.SubmenuTrigger, { "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset || undefined, ...props, className: stateClassName(
|
|
38
|
+
return (_jsxs(MenuPrimitive.SubmenuTrigger, { "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset || undefined, ...props, className: stateClassName('sprout-dropdown-menu-item sprout-dropdown-menu-sub-trigger', className), children: [children, _jsx(ChevronRight, { size: 16, "aria-hidden": "true", className: "sprout-dropdown-menu-sub-chevron" })] }));
|
|
39
39
|
}
|
|
40
40
|
/** A nested menu surface. It opens to the side and sizes to its content. */
|
|
41
|
-
export function DropdownMenuSubContent({ align =
|
|
42
|
-
return (_jsx(DropdownMenuContent, { "data-slot": "dropdown-menu-sub-content", align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, ...props, className: stateClassName(
|
|
41
|
+
export function DropdownMenuSubContent({ align = 'start', alignOffset = -5, side = 'right', sideOffset = 0, className, ...props }) {
|
|
42
|
+
return (_jsx(DropdownMenuContent, { "data-slot": "dropdown-menu-sub-content", align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, ...props, className: stateClassName('sprout-dropdown-menu-sub-content', className) }));
|
|
43
43
|
}
|
|
44
44
|
export function DropdownMenuCheckboxItem({ className, inset, children, ...props }) {
|
|
45
|
-
return (_jsxs(MenuPrimitive.CheckboxItem, { "data-slot": "dropdown-menu-checkbox-item", "data-inset": inset || undefined, ...props, className: stateClassName(
|
|
45
|
+
return (_jsxs(MenuPrimitive.CheckboxItem, { "data-slot": "dropdown-menu-checkbox-item", "data-inset": inset || undefined, ...props, className: stateClassName('sprout-dropdown-menu-item sprout-dropdown-menu-choice', className), children: [_jsx("span", { className: "sprout-dropdown-menu-indicator", "data-slot": "dropdown-menu-checkbox-item-indicator", children: _jsx(MenuPrimitive.CheckboxItemIndicator, { children: _jsx(Check, { size: 16, "aria-hidden": "true" }) }) }), children] }));
|
|
46
46
|
}
|
|
47
47
|
export function DropdownMenuRadioGroup(props) {
|
|
48
|
-
return
|
|
48
|
+
return _jsx(MenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props });
|
|
49
49
|
}
|
|
50
50
|
export function DropdownMenuRadioItem({ className, inset, children, ...props }) {
|
|
51
|
-
return (_jsxs(MenuPrimitive.RadioItem, { "data-slot": "dropdown-menu-radio-item", "data-inset": inset || undefined, ...props, className: stateClassName(
|
|
51
|
+
return (_jsxs(MenuPrimitive.RadioItem, { "data-slot": "dropdown-menu-radio-item", "data-inset": inset || undefined, ...props, className: stateClassName('sprout-dropdown-menu-item sprout-dropdown-menu-choice', className), children: [_jsx("span", { className: "sprout-dropdown-menu-indicator", "data-slot": "dropdown-menu-radio-item-indicator", children: _jsx(MenuPrimitive.RadioItemIndicator, { children: _jsx(Check, { size: 16, "aria-hidden": "true" }) }) }), children] }));
|
|
52
52
|
}
|
|
53
53
|
export function DropdownMenuSeparator({ className, ...props }) {
|
|
54
|
-
return (_jsx(MenuPrimitive.Separator, { "data-slot": "dropdown-menu-separator", ...props, className: stateClassName(
|
|
54
|
+
return (_jsx(MenuPrimitive.Separator, { "data-slot": "dropdown-menu-separator", ...props, className: stateClassName('sprout-dropdown-menu-separator', className) }));
|
|
55
55
|
}
|
|
56
56
|
/** Right-aligned hint text, such as a keyboard shortcut. It does not bind keys. */
|
|
57
57
|
export function DropdownMenuShortcut({ className, ...props }) {
|
|
58
|
-
return (_jsx("span", { "data-slot": "dropdown-menu-shortcut", ...props, className: cn(
|
|
58
|
+
return (_jsx("span", { "data-slot": "dropdown-menu-shortcut", ...props, className: cn('sprout-dropdown-menu-shortcut', className) }));
|
|
59
59
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AriaAttributes, type ReactElement, type ReactNode } from
|
|
2
|
-
import { type SeparatorLabelProps } from
|
|
1
|
+
import { type AriaAttributes, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { type SeparatorLabelProps } from './separator.js';
|
|
3
3
|
export declare const fieldLabelVisibilityNames: readonly ["visible", "screen-reader"];
|
|
4
4
|
export declare const choiceGroupTypeNames: readonly ["checkbox", "radio"];
|
|
5
5
|
export declare const choiceGroupLayoutNames: readonly ["list", "columns"];
|
|
@@ -24,11 +24,11 @@ export declare const FieldsDisabled: import("react").Context<boolean>;
|
|
|
24
24
|
export interface FieldControlProps {
|
|
25
25
|
id?: string | undefined;
|
|
26
26
|
disabled?: boolean | undefined;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
'aria-describedby'?: string | undefined;
|
|
28
|
+
'aria-invalid'?: AriaAttributes['aria-invalid'];
|
|
29
|
+
'aria-required'?: AriaAttributes['aria-required'];
|
|
30
|
+
'aria-label'?: string | undefined;
|
|
31
|
+
'aria-labelledby'?: string | undefined;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Connects a control to the Field around it. Pass the control's props; it
|
|
@@ -79,11 +79,11 @@ export type ChoiceGroupProps<V extends string> = Requirement & {
|
|
|
79
79
|
id?: string | undefined;
|
|
80
80
|
className?: string | undefined;
|
|
81
81
|
} & ({
|
|
82
|
-
type:
|
|
82
|
+
type: 'checkbox';
|
|
83
83
|
value: readonly V[];
|
|
84
84
|
onValueChange: (value: V[]) => void;
|
|
85
85
|
} | {
|
|
86
|
-
type:
|
|
86
|
+
type: 'radio';
|
|
87
87
|
value: V;
|
|
88
88
|
onValueChange: (value: V) => void;
|
|
89
89
|
});
|
|
@@ -107,8 +107,8 @@ export interface CheckboxFieldProps {
|
|
|
107
107
|
}
|
|
108
108
|
/** One checkbox with its label and a helper or error line, for consent and on/off settings. */
|
|
109
109
|
export declare function CheckboxField({ label, helper, error, checked, onCheckedChange, disabled, id, variant, className, }: CheckboxFieldProps): import("react").JSX.Element;
|
|
110
|
-
export type FieldSeparatorProps = Omit<SeparatorLabelProps,
|
|
111
|
-
children?: SeparatorLabelProps[
|
|
110
|
+
export type FieldSeparatorProps = Omit<SeparatorLabelProps, 'variant' | 'children'> & {
|
|
111
|
+
children?: SeparatorLabelProps['children'];
|
|
112
112
|
};
|
|
113
113
|
/**
|
|
114
114
|
* A labeled separator sized for a field stack: it pulls in the stack gap so
|
package/dist/components/field.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useId
|
|
4
|
-
import { Checkbox as BaseCheckbox } from
|
|
5
|
-
import { Check } from
|
|
6
|
-
import { cn } from
|
|
7
|
-
import { Badge } from
|
|
8
|
-
import { RadioGroup, RadioGroupItem } from
|
|
9
|
-
import { Separator } from
|
|
10
|
-
export const fieldLabelVisibilityNames = [
|
|
11
|
-
export const choiceGroupTypeNames = [
|
|
12
|
-
export const choiceGroupLayoutNames = [
|
|
13
|
-
export const checkboxFieldVariantNames = [
|
|
3
|
+
import { createContext, useContext, useId } from 'react';
|
|
4
|
+
import { Checkbox as BaseCheckbox } from '@base-ui/react/checkbox';
|
|
5
|
+
import { Check } from 'reicon-react/icons/Check';
|
|
6
|
+
import { cn } from '../internal/classes.js';
|
|
7
|
+
import { Badge } from './badge.js';
|
|
8
|
+
import { RadioGroup, RadioGroupItem } from './radio-group.js';
|
|
9
|
+
import { Separator } from './separator.js';
|
|
10
|
+
export const fieldLabelVisibilityNames = ['visible', 'screen-reader'];
|
|
11
|
+
export const choiceGroupTypeNames = ['checkbox', 'radio'];
|
|
12
|
+
export const choiceGroupLayoutNames = ['list', 'columns'];
|
|
13
|
+
export const checkboxFieldVariantNames = ['default', 'neutral'];
|
|
14
14
|
/**
|
|
15
15
|
* Locks every Field, ChoiceGroup, and CheckboxField below it. Render it as a
|
|
16
16
|
* provider: `<FieldsDisabled value={saving}>…</FieldsDisabled>`.
|
|
@@ -25,40 +25,34 @@ const FieldControlContext = createContext(null);
|
|
|
25
25
|
*/
|
|
26
26
|
export function useFieldControl(props) {
|
|
27
27
|
const field = useContext(FieldControlContext);
|
|
28
|
-
if (!field ||
|
|
29
|
-
props["aria-label"] !== undefined ||
|
|
30
|
-
props["aria-labelledby"] !== undefined)
|
|
28
|
+
if (!field || props['aria-label'] !== undefined || props['aria-labelledby'] !== undefined)
|
|
31
29
|
return props;
|
|
32
30
|
return {
|
|
33
31
|
...props,
|
|
34
32
|
id: field.id,
|
|
35
33
|
disabled: field.disabled || props.disabled,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
'aria-describedby': ids(field.describedBy, props['aria-describedby']),
|
|
35
|
+
'aria-invalid': field.invalid || props['aria-invalid'],
|
|
36
|
+
'aria-required': field.required || props['aria-required'],
|
|
39
37
|
};
|
|
40
38
|
}
|
|
41
39
|
// Deduped so a control that applies useFieldControl twice keeps one copy of each id.
|
|
42
40
|
function ids(...values) {
|
|
43
|
-
const tokens = values.flatMap(
|
|
44
|
-
return [...new Set(tokens.filter(Boolean))].join(
|
|
41
|
+
const tokens = values.flatMap(value => (value ? value.split(/\s+/) : []));
|
|
42
|
+
return [...new Set(tokens.filter(Boolean))].join(' ') || undefined;
|
|
45
43
|
}
|
|
46
|
-
function RequirementMarker({ required, id
|
|
47
|
-
return (_jsx("span", { id: id, "aria-hidden": id ? undefined : true, "data-slot": "requirement", className: "sprout-field-requirement", children: required ?
|
|
44
|
+
function RequirementMarker({ required, id }) {
|
|
45
|
+
return (_jsx("span", { id: id, "aria-hidden": id ? undefined : true, "data-slot": "requirement", className: "sprout-field-requirement", children: required ? 'Required' : 'Optional' }));
|
|
48
46
|
}
|
|
49
47
|
/**
|
|
50
48
|
* A labeled form row for one control: label, required or optional marker,
|
|
51
49
|
* optional counter, the control, and a helper or error line.
|
|
52
50
|
*/
|
|
53
|
-
export function Field({ label, labelVisibility =
|
|
51
|
+
export function Field({ label, labelVisibility = 'visible', helper, error, counter, id, disabled, required, className, children, }) {
|
|
54
52
|
const generatedId = useId();
|
|
55
53
|
const controlId = id ?? generatedId;
|
|
56
54
|
const locked = useContext(FieldsDisabled) || disabled === true;
|
|
57
|
-
const lineId = error
|
|
58
|
-
? `${controlId}-error`
|
|
59
|
-
: helper
|
|
60
|
-
? `${controlId}-helper`
|
|
61
|
-
: undefined;
|
|
55
|
+
const lineId = error ? `${controlId}-error` : helper ? `${controlId}-helper` : undefined;
|
|
62
56
|
const markerId = required ? undefined : `${controlId}-requirement`;
|
|
63
57
|
const counterId = counter ? `${controlId}-counter` : undefined;
|
|
64
58
|
const control = {
|
|
@@ -68,23 +62,21 @@ export function Field({ label, labelVisibility = "visible", helper, error, count
|
|
|
68
62
|
required: required === true,
|
|
69
63
|
disabled: locked,
|
|
70
64
|
};
|
|
71
|
-
return (_jsxs("div", { "data-slot": "field", "data-disabled": locked || undefined, "data-invalid": error ? true : undefined, className: cn(
|
|
72
|
-
? "sprout-field-sr-only"
|
|
73
|
-
: "sprout-field-header", children: [_jsxs("div", { className: "sprout-field-heading", children: [_jsx("label", { "data-slot": "label", htmlFor: controlId, className: "sprout-field-label", children: label }), _jsx(RequirementMarker, { required: required === true, id: markerId })] }), counter && (_jsx("p", { id: counterId, "data-slot": "field-counter", className: "sprout-field-counter", children: counter }))] }), _jsx(FieldControlContext, { value: control, children: children }), error ? (_jsx("p", { id: lineId, "data-slot": "field-error", className: "sprout-field-message sprout-field-error", children: error })) : helper ? (_jsx("p", { id: lineId, "data-slot": "field-helper", className: "sprout-field-message", children: helper })) : null] }));
|
|
65
|
+
return (_jsxs("div", { "data-slot": "field", "data-disabled": locked || undefined, "data-invalid": error ? true : undefined, className: cn('sprout-field', className), children: [_jsxs("div", { "data-slot": "field-header", className: labelVisibility === 'screen-reader' ? 'sprout-field-sr-only' : 'sprout-field-header', children: [_jsxs("div", { className: "sprout-field-heading", children: [_jsx("label", { "data-slot": "label", htmlFor: controlId, className: "sprout-field-label", children: label }), _jsx(RequirementMarker, { required: required === true, id: markerId })] }), counter && (_jsx("p", { id: counterId, "data-slot": "field-counter", className: "sprout-field-counter", children: counter }))] }), _jsx(FieldControlContext, { value: control, children: children }), error ? (_jsx("p", { id: lineId, "data-slot": "field-error", className: "sprout-field-message sprout-field-error", children: error })) : helper ? (_jsx("p", { id: lineId, "data-slot": "field-helper", className: "sprout-field-message", children: helper })) : null] }));
|
|
74
66
|
}
|
|
75
|
-
function FieldCheckbox({ variant =
|
|
76
|
-
return (_jsx(BaseCheckbox.Root, { "data-slot": "checkbox", "data-variant": variant, className: cn(
|
|
67
|
+
function FieldCheckbox({ variant = 'default', className, ...props }) {
|
|
68
|
+
return (_jsx(BaseCheckbox.Root, { "data-slot": "checkbox", "data-variant": variant, className: cn('sprout-field-checkbox', className), ...props, children: _jsx(BaseCheckbox.Indicator, { "data-slot": "checkbox-indicator", className: "sprout-field-checkbox-indicator", children: _jsx(Check, { "aria-hidden": "true" }) }) }));
|
|
77
69
|
}
|
|
78
70
|
/**
|
|
79
71
|
* A labeled set of checkboxes (many values) or radios (one value), with
|
|
80
72
|
* optional descriptions per option, a helper, a warning badge, and an error.
|
|
81
73
|
*/
|
|
82
74
|
export function ChoiceGroup(props) {
|
|
83
|
-
const { legend, legendVisibility =
|
|
75
|
+
const { legend, legendVisibility = 'visible', helper, error, warning, options, layout = 'list', required, className, } = props;
|
|
84
76
|
const generatedId = useId();
|
|
85
77
|
const groupId = props.id ?? generatedId;
|
|
86
78
|
const locked = useContext(FieldsDisabled) || props.disabled === true;
|
|
87
|
-
const radio = props.type ===
|
|
79
|
+
const radio = props.type === 'radio';
|
|
88
80
|
const legendId = `${groupId}-legend`;
|
|
89
81
|
const errorId = error ? `${groupId}-error` : undefined;
|
|
90
82
|
const helperId = helper ? `${groupId}-helper` : undefined;
|
|
@@ -92,37 +84,29 @@ export function ChoiceGroup(props) {
|
|
|
92
84
|
const markerId = radio && required ? undefined : `${groupId}-requirement`;
|
|
93
85
|
const labelling = {
|
|
94
86
|
id: groupId,
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
'aria-labelledby': legendId,
|
|
88
|
+
'aria-describedby': ids(errorId, helperId, markerId),
|
|
97
89
|
};
|
|
98
90
|
const rows = options.map((option, index) => {
|
|
99
|
-
const checked = props.type ===
|
|
100
|
-
? props.value.includes(option.value)
|
|
101
|
-
: props.value === option.value;
|
|
91
|
+
const checked = props.type === 'checkbox' ? props.value.includes(option.value) : props.value === option.value;
|
|
102
92
|
const disabled = locked || option.disabled === true;
|
|
103
|
-
const descriptionId = option.description
|
|
104
|
-
? `${groupId}-option-${index}-description`
|
|
105
|
-
: undefined;
|
|
93
|
+
const descriptionId = option.description ? `${groupId}-option-${index}-description` : undefined;
|
|
106
94
|
let control;
|
|
107
|
-
if (props.type ===
|
|
95
|
+
if (props.type === 'checkbox') {
|
|
108
96
|
const { value, onValueChange } = props;
|
|
109
|
-
control = (_jsx(FieldCheckbox, { checked: checked, disabled: disabled, "aria-describedby": descriptionId, "aria-invalid": error ? true : undefined, onCheckedChange:
|
|
110
|
-
? [...value, option.value]
|
|
111
|
-
: value.filter((item) => item !== option.value)) }));
|
|
97
|
+
control = (_jsx(FieldCheckbox, { checked: checked, disabled: disabled, "aria-describedby": descriptionId, "aria-invalid": error ? true : undefined, onCheckedChange: next => onValueChange(next ? [...value, option.value] : value.filter(item => item !== option.value)) }));
|
|
112
98
|
}
|
|
113
99
|
else {
|
|
114
100
|
control = (_jsx(RadioGroupItem, { className: "sprout-field-radio", value: option.value, disabled: disabled, "aria-describedby": descriptionId }));
|
|
115
101
|
}
|
|
116
102
|
return (_jsxs("div", { "data-slot": "choice-option", "data-checked": checked || undefined, "data-disabled": disabled || undefined, className: "sprout-choice-option", children: [_jsxs("label", { className: "sprout-choice-option-label", children: [control, _jsx("span", { className: "sprout-choice-option-text", children: option.label })] }), option.description && (_jsx("p", { id: descriptionId, className: "sprout-choice-option-description", children: option.description }))] }, option.value));
|
|
117
103
|
});
|
|
118
|
-
const content = (_jsxs(_Fragment, { children: [_jsxs("div", { className: legendVisibility ===
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const classes = cn("sprout-choice-group", className);
|
|
122
|
-
if (props.type === "radio") {
|
|
104
|
+
const content = (_jsxs(_Fragment, { children: [_jsxs("div", { className: legendVisibility === 'screen-reader' ? 'sprout-field-sr-only' : 'sprout-choice-group-legend', children: [_jsx("p", { id: legendId, className: "sprout-choice-group-legend-text", children: legend }), _jsx(RequirementMarker, { required: required === true, id: markerId }), warning && _jsx(Badge, { variant: "warning", children: warning })] }), helper && (_jsx("p", { id: helperId, className: "sprout-field-message", children: helper })), _jsx("div", { "data-slot": "choice-group-options", "data-layout": layout, className: "sprout-choice-group-options", children: rows }), error && (_jsx("p", { id: errorId, className: "sprout-field-message sprout-field-error", children: error }))] }));
|
|
105
|
+
const classes = cn('sprout-choice-group', className);
|
|
106
|
+
if (props.type === 'radio') {
|
|
123
107
|
const { onValueChange } = props;
|
|
124
|
-
return (_jsx(RadioGroup, { "data-slot": "choice-group", "data-type": "radio", className: classes, value: props.value, disabled: locked, "aria-required": required || undefined, "aria-invalid": error ? true : undefined, ...labelling, onValueChange:
|
|
125
|
-
const option = options.find(
|
|
108
|
+
return (_jsx(RadioGroup, { "data-slot": "choice-group", "data-type": "radio", className: classes, value: props.value, disabled: locked, "aria-required": required || undefined, "aria-invalid": error ? true : undefined, ...labelling, onValueChange: next => {
|
|
109
|
+
const option = options.find(item => item.value === next);
|
|
126
110
|
if (option)
|
|
127
111
|
onValueChange(option.value);
|
|
128
112
|
}, children: content }));
|
|
@@ -134,17 +118,13 @@ export function CheckboxField({ label, helper, error, checked, onCheckedChange,
|
|
|
134
118
|
const generatedId = useId();
|
|
135
119
|
const fieldId = id ?? generatedId;
|
|
136
120
|
const locked = useContext(FieldsDisabled) || disabled === true;
|
|
137
|
-
const lineId = error
|
|
138
|
-
|
|
139
|
-
: helper
|
|
140
|
-
? `${fieldId}-helper`
|
|
141
|
-
: undefined;
|
|
142
|
-
return (_jsxs("div", { id: fieldId, "data-slot": "checkbox-field", "data-disabled": locked || undefined, className: cn("sprout-checkbox-field", className), children: [_jsxs("label", { className: "sprout-checkbox-field-label", children: [_jsx(FieldCheckbox, { variant: variant, checked: checked, disabled: locked, "aria-describedby": lineId, "aria-invalid": error ? true : undefined, onCheckedChange: (next) => onCheckedChange(next) }), _jsx("span", { className: "sprout-checkbox-field-text", children: label })] }), error ? (_jsx("p", { id: lineId, className: "sprout-field-message sprout-field-error sprout-checkbox-field-message", children: error })) : helper ? (_jsx("p", { id: lineId, className: "sprout-field-message sprout-checkbox-field-message", children: helper })) : null] }));
|
|
121
|
+
const lineId = error ? `${fieldId}-error` : helper ? `${fieldId}-helper` : undefined;
|
|
122
|
+
return (_jsxs("div", { id: fieldId, "data-slot": "checkbox-field", "data-disabled": locked || undefined, className: cn('sprout-checkbox-field', className), children: [_jsxs("label", { className: "sprout-checkbox-field-label", children: [_jsx(FieldCheckbox, { variant: variant, checked: checked, disabled: locked, "aria-describedby": lineId, "aria-invalid": error ? true : undefined, onCheckedChange: next => onCheckedChange(next) }), _jsx("span", { className: "sprout-checkbox-field-text", children: label })] }), error ? (_jsx("p", { id: lineId, className: "sprout-field-message sprout-field-error sprout-checkbox-field-message", children: error })) : helper ? (_jsx("p", { id: lineId, className: "sprout-field-message sprout-checkbox-field-message", children: helper })) : null] }));
|
|
143
123
|
}
|
|
144
124
|
/**
|
|
145
125
|
* A labeled separator sized for a field stack: it pulls in the stack gap so
|
|
146
126
|
* the line sits evenly between fields. Text such as "or" is optional.
|
|
147
127
|
*/
|
|
148
128
|
export function FieldSeparator({ className, children = null, ...props }) {
|
|
149
|
-
return (_jsx(Separator, { "data-slot": "field-separator", className: cn(
|
|
129
|
+
return (_jsx(Separator, { "data-slot": "field-separator", className: cn('sprout-field-separator', className), ...props, children: children }));
|
|
150
130
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type HTMLAttributes } from
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
2
|
export interface FileExplorerTextFile {
|
|
3
3
|
/** A slash-separated path, such as `agents/scout/persona.md`. Folders come from the paths. */
|
|
4
4
|
path: string;
|
|
@@ -10,7 +10,7 @@ export interface FileExplorerUnavailableFile {
|
|
|
10
10
|
unavailable: string;
|
|
11
11
|
}
|
|
12
12
|
export type FileExplorerFile = FileExplorerTextFile | FileExplorerUnavailableFile;
|
|
13
|
-
export interface FileExplorerProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
13
|
+
export interface FileExplorerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
14
14
|
files: FileExplorerFile[];
|
|
15
15
|
/** Heads the sidebar and names the tree, such as “Soul”. */
|
|
16
16
|
label?: string | undefined;
|