@tulipfarm/sprout 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +183 -2
- package/dist/components/accordion.d.ts +28 -0
- package/dist/components/accordion.js +26 -0
- package/dist/components/alert-dialog.d.ts +60 -0
- package/dist/components/alert-dialog.js +69 -0
- package/dist/components/alert.d.ts +30 -0
- package/dist/components/alert.js +35 -0
- package/dist/components/aspect-ratio.d.ts +7 -0
- package/dist/components/aspect-ratio.js +6 -0
- package/dist/components/attachment.d.ts +118 -0
- package/dist/components/attachment.js +285 -0
- package/dist/components/avatar.d.ts +32 -0
- package/dist/components/avatar.js +73 -0
- package/dist/components/badge.d.ts +21 -0
- package/dist/components/badge.js +27 -0
- package/dist/components/brand-icon.d.ts +28 -0
- package/dist/components/brand-icon.js +82 -0
- package/dist/components/breadcrumb.d.ts +29 -0
- package/dist/components/breadcrumb.js +44 -0
- package/dist/components/button-group.d.ts +28 -0
- package/dist/components/button-group.js +36 -0
- package/dist/components/button.d.ts +79 -0
- package/dist/components/button.js +93 -0
- package/dist/components/calendar.d.ts +27 -0
- package/dist/components/calendar.js +107 -0
- package/dist/components/canvas.d.ts +78 -0
- package/dist/components/canvas.js +180 -0
- package/dist/components/card.d.ts +43 -0
- package/dist/components/card.js +42 -0
- package/dist/components/carousel.d.ts +57 -0
- package/dist/components/carousel.js +422 -0
- package/dist/components/chart.d.ts +112 -0
- package/dist/components/chart.js +172 -0
- package/dist/components/chat-confirmation.d.ts +42 -0
- package/dist/components/chat-confirmation.js +62 -0
- package/dist/components/chat-input.d.ts +94 -0
- package/dist/components/chat-input.js +279 -0
- package/dist/components/chat-plan.d.ts +21 -0
- package/dist/components/chat-plan.js +35 -0
- package/dist/components/chat-sources.d.ts +64 -0
- package/dist/components/chat-sources.js +66 -0
- package/dist/components/checkbox.d.ts +16 -0
- package/dist/components/checkbox.js +17 -0
- package/dist/components/choice-list.d.ts +53 -0
- package/dist/components/choice-list.js +36 -0
- package/dist/components/code-block.d.ts +35 -0
- package/dist/components/code-block.js +64 -0
- package/dist/components/collapsible.d.ts +24 -0
- package/dist/components/collapsible.js +27 -0
- package/dist/components/combobox.d.ts +95 -0
- package/dist/components/combobox.js +106 -0
- package/dist/components/command.d.ts +94 -0
- package/dist/components/command.js +414 -0
- package/dist/components/context-menu.d.ts +57 -0
- package/dist/components/context-menu.js +60 -0
- package/dist/components/dialog.d.ts +60 -0
- package/dist/components/dialog.js +79 -0
- package/dist/components/direction.d.ts +6 -0
- package/dist/components/direction.js +6 -0
- package/dist/components/dropdown-menu.d.ts +62 -0
- package/dist/components/dropdown-menu.js +59 -0
- package/dist/components/field.d.ts +117 -0
- package/dist/components/field.js +150 -0
- package/dist/components/file-explorer.d.ts +27 -0
- package/dist/components/file-explorer.js +300 -0
- package/dist/components/file-viewer.d.ts +137 -0
- package/dist/components/file-viewer.js +400 -0
- package/dist/components/form.d.ts +87 -0
- package/dist/components/form.js +55 -0
- package/dist/components/glass-banner.d.ts +27 -0
- package/dist/components/glass-banner.js +116 -0
- package/dist/components/gradient-banner.d.ts +37 -0
- package/dist/components/gradient-banner.js +43 -0
- package/dist/components/hover-card.d.ts +27 -0
- package/dist/components/hover-card.js +26 -0
- package/dist/components/input-group.d.ts +68 -0
- package/dist/components/input-group.js +88 -0
- package/dist/components/input-otp.d.ts +38 -0
- package/dist/components/input-otp.js +43 -0
- package/dist/components/input.d.ts +16 -0
- package/dist/components/input.js +18 -0
- package/dist/components/kbd.d.ts +12 -0
- package/dist/components/kbd.js +11 -0
- package/dist/components/label.d.ts +8 -0
- package/dist/components/label.js +10 -0
- package/dist/components/mention-list.d.ts +54 -0
- package/dist/components/mention-list.js +31 -0
- package/dist/components/menubar.d.ts +64 -0
- package/dist/components/menubar.js +68 -0
- package/dist/components/message-actions.d.ts +34 -0
- package/dist/components/message-actions.js +68 -0
- package/dist/components/message-response.d.ts +20 -0
- package/dist/components/message-response.js +46 -0
- package/dist/components/message-scroller.d.ts +71 -0
- package/dist/components/message-scroller.js +217 -0
- package/dist/components/message.d.ts +49 -0
- package/dist/components/message.js +59 -0
- package/dist/components/navigation-menu.d.ts +45 -0
- package/dist/components/navigation-menu.js +54 -0
- package/dist/components/notice-banner.d.ts +14 -0
- package/dist/components/notice-banner.js +11 -0
- package/dist/components/page-content.d.ts +7 -0
- package/dist/components/page-content.js +9 -0
- package/dist/components/page-header.d.ts +37 -0
- package/dist/components/page-header.js +53 -0
- package/dist/components/pagination.d.ts +29 -0
- package/dist/components/pagination.js +29 -0
- package/dist/components/plan-outline.d.ts +60 -0
- package/dist/components/plan-outline.js +108 -0
- package/dist/components/popover.d.ts +34 -0
- package/dist/components/popover.js +35 -0
- package/dist/components/progress.d.ts +27 -0
- package/dist/components/progress.js +35 -0
- package/dist/components/prompt-list.d.ts +23 -0
- package/dist/components/prompt-list.js +11 -0
- package/dist/components/questionnaire.d.ts +148 -0
- package/dist/components/questionnaire.js +1002 -0
- package/dist/components/radio-group.d.ts +16 -0
- package/dist/components/radio-group.js +21 -0
- package/dist/components/reasoning-effort.d.ts +24 -0
- package/dist/components/reasoning-effort.js +269 -0
- package/dist/components/resizable.d.ts +67 -0
- package/dist/components/resizable.js +536 -0
- package/dist/components/result-card.d.ts +58 -0
- package/dist/components/result-card.js +88 -0
- package/dist/components/review-card.d.ts +62 -0
- package/dist/components/review-card.js +49 -0
- package/dist/components/rich-text-editor.d.ts +51 -0
- package/dist/components/rich-text-editor.js +248 -0
- package/dist/components/schema-diagram.d.ts +52 -0
- package/dist/components/schema-diagram.js +226 -0
- package/dist/components/scroll-area.d.ts +22 -0
- package/dist/components/scroll-area.js +19 -0
- package/dist/components/search-dialog.d.ts +103 -0
- package/dist/components/search-dialog.js +65 -0
- package/dist/components/search-field.d.ts +17 -0
- package/dist/components/search-field.js +27 -0
- package/dist/components/select.d.ts +57 -0
- package/dist/components/select.js +57 -0
- package/dist/components/selection-slot.d.ts +18 -0
- package/dist/components/selection-slot.js +53 -0
- package/dist/components/separator.d.ts +48 -0
- package/dist/components/separator.js +54 -0
- package/dist/components/settings-list.d.ts +26 -0
- package/dist/components/settings-list.js +17 -0
- package/dist/components/sheet.d.ts +70 -0
- package/dist/components/sheet.js +77 -0
- package/dist/components/sidebar.d.ts +70 -0
- package/dist/components/sidebar.js +187 -0
- package/dist/components/skeleton.d.ts +31 -0
- package/dist/components/skeleton.js +32 -0
- package/dist/components/slider.d.ts +17 -0
- package/dist/components/slider.js +24 -0
- package/dist/components/spinner.d.ts +37 -0
- package/dist/components/spinner.js +43 -0
- package/dist/components/state-panel-samples.d.ts +25 -0
- package/dist/components/state-panel-samples.js +423 -0
- package/dist/components/state-panel.d.ts +35 -0
- package/dist/components/state-panel.js +29 -0
- package/dist/components/state-sample.d.ts +63 -0
- package/dist/components/state-sample.js +42 -0
- package/dist/components/switch.d.ts +12 -0
- package/dist/components/switch.js +14 -0
- package/dist/components/table-nuqs.d.ts +16 -0
- package/dist/components/table-nuqs.js +59 -0
- package/dist/components/table.d.ts +120 -0
- package/dist/components/table.js +663 -0
- package/dist/components/tabs.d.ts +37 -0
- package/dist/components/tabs.js +36 -0
- package/dist/components/textarea.d.ts +18 -0
- package/dist/components/textarea.js +19 -0
- package/dist/components/toast.d.ts +45 -0
- package/dist/components/toast.js +83 -0
- package/dist/components/toggle-group.d.ts +30 -0
- package/dist/components/toggle-group.js +39 -0
- package/dist/components/toggle.d.ts +27 -0
- package/dist/components/toggle.js +21 -0
- package/dist/components/tool-activity.d.ts +79 -0
- package/dist/components/tool-activity.js +226 -0
- package/dist/components/toolbar-status.d.ts +21 -0
- package/dist/components/toolbar-status.js +14 -0
- package/dist/components/tooltip.d.ts +31 -0
- package/dist/components/tooltip.js +99 -0
- package/dist/components/typed-text.d.ts +17 -0
- package/dist/components/typed-text.js +56 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +90 -0
- package/dist/internal/brand-glyphs.d.ts +370 -0
- package/dist/internal/brand-glyphs.js +262 -0
- package/dist/internal/classes.d.ts +3 -0
- package/dist/internal/classes.js +20 -0
- package/dist/internal/code-tokens.d.ts +4 -0
- package/dist/internal/code-tokens.js +34 -0
- package/dist/internal/fieldset.d.ts +6 -0
- package/dist/internal/fieldset.js +38 -0
- package/dist/internal/file-kind.d.ts +4 -0
- package/dist/internal/file-kind.js +62 -0
- package/dist/internal/languages.d.ts +7 -0
- package/dist/internal/languages.js +1010 -0
- package/dist/internal/message-scroller.d.ts +102 -0
- package/dist/internal/message-scroller.js +637 -0
- package/dist/internal/pressable.d.ts +2 -0
- package/dist/internal/pressable.js +29 -0
- package/dist/internal/syntax.d.ts +14 -0
- package/dist/internal/syntax.js +137 -0
- package/dist/styles/accordion.css +102 -0
- package/dist/styles/alert-dialog.css +198 -0
- package/dist/styles/alert.css +149 -0
- package/dist/styles/aspect-ratio.css +8 -0
- package/dist/styles/attachment.css +700 -0
- package/dist/styles/avatar.css +186 -0
- package/dist/styles/badge.css +178 -0
- package/dist/styles/brand-icon.css +104 -0
- package/dist/styles/breadcrumb.css +121 -0
- package/dist/styles/button-group.css +113 -0
- package/dist/styles/button.css +380 -0
- package/dist/styles/calendar.css +295 -0
- package/dist/styles/canvas.css +313 -0
- package/dist/styles/card.css +146 -0
- package/dist/styles/carousel.css +107 -0
- package/dist/styles/chart.css +227 -0
- package/dist/styles/chat-confirmation.css +29 -0
- package/dist/styles/chat-input.css +240 -0
- package/dist/styles/chat-plan.css +109 -0
- package/dist/styles/chat-sources.css +191 -0
- package/dist/styles/checkbox.css +122 -0
- package/dist/styles/choice-list.css +343 -0
- package/dist/styles/code-block.css +211 -0
- package/dist/styles/collapsible.css +72 -0
- package/dist/styles/combobox.css +347 -0
- package/dist/styles/command.css +233 -0
- package/dist/styles/context-menu.css +151 -0
- package/dist/styles/dialog.css +237 -0
- package/dist/styles/dropdown-menu.css +150 -0
- package/dist/styles/field.css +340 -0
- package/dist/styles/file-explorer.css +517 -0
- package/dist/styles/file-viewer.css +375 -0
- package/dist/styles/form.css +155 -0
- package/dist/styles/glass-banner.css +308 -0
- package/dist/styles/gradient-banner.css +256 -0
- package/dist/styles/hover-card.css +95 -0
- package/dist/styles/index.css +268 -0
- package/dist/styles/input-group.css +285 -0
- package/dist/styles/input-otp.css +138 -0
- package/dist/styles/input.css +98 -0
- package/dist/styles/kbd.css +59 -0
- package/dist/styles/label.css +89 -0
- package/dist/styles/mention-list.css +166 -0
- package/dist/styles/menubar.css +226 -0
- package/dist/styles/message-actions.css +83 -0
- package/dist/styles/message-response.css +176 -0
- package/dist/styles/message-scroller.css +136 -0
- package/dist/styles/message.css +310 -0
- package/dist/styles/navigation-menu.css +291 -0
- package/dist/styles/notice-banner.css +68 -0
- package/dist/styles/page-content.css +21 -0
- package/dist/styles/page-header.css +156 -0
- package/dist/styles/pagination.css +72 -0
- package/dist/styles/plan-outline.css +393 -0
- package/dist/styles/popover.css +140 -0
- package/dist/styles/progress.css +93 -0
- package/dist/styles/prompt-list.css +165 -0
- package/dist/styles/questionnaire.css +308 -0
- package/dist/styles/radio-group.css +119 -0
- package/dist/styles/reasoning-effort.css +157 -0
- package/dist/styles/resizable.css +108 -0
- package/dist/styles/result-card.css +215 -0
- package/dist/styles/review-card.css +235 -0
- package/dist/styles/rich-text-editor.css +169 -0
- package/dist/styles/schema-diagram.css +419 -0
- package/dist/styles/scroll-area.css +77 -0
- package/dist/styles/search-dialog.css +280 -0
- package/dist/styles/search-field.css +17 -0
- package/dist/styles/select.css +285 -0
- package/dist/styles/selection-slot.css +31 -0
- package/dist/styles/separator.css +206 -0
- package/dist/styles/settings-list.css +81 -0
- package/dist/styles/sheet.css +361 -0
- package/dist/styles/sidebar.css +363 -0
- package/dist/styles/skeleton.css +80 -0
- package/dist/styles/slider.css +142 -0
- package/dist/styles/spinner.css +39 -0
- package/dist/styles/state-panel-samples.css +41 -0
- package/dist/styles/state-panel.css +173 -0
- package/dist/styles/state-sample.css +285 -0
- package/dist/styles/switch.css +128 -0
- package/dist/styles/table.css +604 -0
- package/dist/styles/tabs.css +223 -0
- package/dist/styles/textarea.css +77 -0
- package/dist/styles/themes/chatgpt.css +125 -0
- package/dist/styles/themes/claude.css +125 -0
- package/dist/styles/themes/cloudflare.css +125 -0
- package/dist/styles/themes/discord.css +125 -0
- package/dist/styles/themes/github.css +125 -0
- package/dist/styles/themes/grok.css +125 -0
- package/dist/styles/themes/linear.css +126 -0
- package/dist/styles/themes/neutral.css +125 -0
- package/dist/styles/themes/notion.css +125 -0
- package/dist/styles/themes/perplexity.css +125 -0
- package/dist/styles/themes/raycast.css +125 -0
- package/dist/styles/themes/spotify.css +125 -0
- package/dist/styles/themes/stripe.css +125 -0
- package/dist/styles/themes/supabase.css +125 -0
- package/dist/styles/themes/tulipfarm.css +115 -0
- package/dist/styles/themes/vercel.css +126 -0
- package/dist/styles/toast.css +197 -0
- package/dist/styles/toggle-group.css +161 -0
- package/dist/styles/toggle.css +119 -0
- package/dist/styles/tool-activity.css +396 -0
- package/dist/styles/toolbar-status.css +52 -0
- package/dist/styles/tooltip.css +122 -0
- package/dist/styles/typed-text.css +17 -0
- package/package.json +452 -4
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
|
|
4
|
+
import { cn, stateClassName } from "../internal/classes.js";
|
|
5
|
+
export const popoverContentSizeNames = [
|
|
6
|
+
"default",
|
|
7
|
+
"menu",
|
|
8
|
+
"picker",
|
|
9
|
+
"panel",
|
|
10
|
+
"work-list",
|
|
11
|
+
"app-actions",
|
|
12
|
+
"bud",
|
|
13
|
+
];
|
|
14
|
+
export function Popover(props) {
|
|
15
|
+
return _jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
16
|
+
}
|
|
17
|
+
export function PopoverTrigger(props) {
|
|
18
|
+
return _jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The floating panel. It renders its own portal and positioner, so place it
|
|
22
|
+
* directly inside `Popover`.
|
|
23
|
+
*/
|
|
24
|
+
export function PopoverContent({ align = "center", alignOffset = 0, side = "bottom", sideOffset = 4, collisionPadding = 8, collisionAvoidance, sticky, positionMethod, anchor, size = "default", keepMounted = false, container, className, ...props }) {
|
|
25
|
+
return (_jsx(PopoverPrimitive.Portal, { keepMounted: keepMounted, container: container, children: _jsx(PopoverPrimitive.Positioner, { className: "sprout-popover-positioner", anchor: anchor, align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, collisionPadding: collisionPadding, collisionAvoidance: collisionAvoidance, sticky: sticky, positionMethod: positionMethod, children: _jsx(PopoverPrimitive.Popup, { "data-slot": "popover-content", "data-size": size, ...props, className: stateClassName(cn("sprout-popover-content", `sprout-popover-${size}`), className) }) }) }));
|
|
26
|
+
}
|
|
27
|
+
export function PopoverHeader({ className, ...props }) {
|
|
28
|
+
return (_jsx("div", { "data-slot": "popover-header", ...props, className: cn("sprout-popover-header", className) }));
|
|
29
|
+
}
|
|
30
|
+
export function PopoverTitle({ className, ...props }) {
|
|
31
|
+
return (_jsx(PopoverPrimitive.Title, { "data-slot": "popover-title", ...props, className: stateClassName("sprout-popover-title", className) }));
|
|
32
|
+
}
|
|
33
|
+
export function PopoverDescription({ className, ...props }) {
|
|
34
|
+
return (_jsx(PopoverPrimitive.Description, { "data-slot": "popover-description", ...props, className: stateClassName("sprout-popover-description", className) }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Progress as BaseProgress } from "@base-ui/react/progress";
|
|
2
|
+
export type ProgressProps = BaseProgress.Root.Props;
|
|
3
|
+
/**
|
|
4
|
+
* A bar that shows how far a task has come. Pass a number to `value`, or
|
|
5
|
+
* `null` while the amount is unknown. Children, such as `ProgressLabel` and
|
|
6
|
+
* `ProgressValue`, sit on one row above the track. Name it with a
|
|
7
|
+
* `ProgressLabel` or `aria-label`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function Progress({ className, children, ...props }: ProgressProps): import("react").JSX.Element;
|
|
10
|
+
export type ProgressTrackProps = BaseProgress.Track.Props;
|
|
11
|
+
/** The 4px rail behind the indicator. `Progress` renders one for you. */
|
|
12
|
+
export declare function ProgressTrack({ className, ...props }: ProgressTrackProps): import("react").JSX.Element;
|
|
13
|
+
export type ProgressIndicatorProps = BaseProgress.Indicator.Props;
|
|
14
|
+
/**
|
|
15
|
+
* The filled part of the track. Its width follows the value; with a `null`
|
|
16
|
+
* value it slides across the track instead.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ProgressIndicator({ className, ...props }: ProgressIndicatorProps): import("react").JSX.Element;
|
|
19
|
+
export type ProgressLabelProps = BaseProgress.Label.Props;
|
|
20
|
+
/** A visible name for the bar. It labels the `progressbar` for you. */
|
|
21
|
+
export declare function ProgressLabel({ className, ...props }: ProgressLabelProps): import("react").JSX.Element;
|
|
22
|
+
export type ProgressValueProps = BaseProgress.Value.Props;
|
|
23
|
+
/**
|
|
24
|
+
* The formatted value, such as “40%”, at the end of the label row. It is
|
|
25
|
+
* empty while the value is `null`. Pass a function child to show other text.
|
|
26
|
+
*/
|
|
27
|
+
export declare function ProgressValue({ className, ...props }: ProgressValueProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Progress as BaseProgress } from "@base-ui/react/progress";
|
|
4
|
+
import { stateClassName } from "../internal/classes.js";
|
|
5
|
+
/**
|
|
6
|
+
* A bar that shows how far a task has come. Pass a number to `value`, or
|
|
7
|
+
* `null` while the amount is unknown. Children, such as `ProgressLabel` and
|
|
8
|
+
* `ProgressValue`, sit on one row above the track. Name it with a
|
|
9
|
+
* `ProgressLabel` or `aria-label`.
|
|
10
|
+
*/
|
|
11
|
+
export function Progress({ className, children, ...props }) {
|
|
12
|
+
return (_jsxs(BaseProgress.Root, { "data-slot": "progress", ...props, className: stateClassName("sprout-progress", className), children: [children, _jsx(ProgressTrack, { children: _jsx(ProgressIndicator, {}) })] }));
|
|
13
|
+
}
|
|
14
|
+
/** The 4px rail behind the indicator. `Progress` renders one for you. */
|
|
15
|
+
export function ProgressTrack({ className, ...props }) {
|
|
16
|
+
return (_jsx(BaseProgress.Track, { "data-slot": "progress-track", ...props, className: stateClassName("sprout-progress-track", className) }));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The filled part of the track. Its width follows the value; with a `null`
|
|
20
|
+
* value it slides across the track instead.
|
|
21
|
+
*/
|
|
22
|
+
export function ProgressIndicator({ className, ...props }) {
|
|
23
|
+
return (_jsx(BaseProgress.Indicator, { "data-slot": "progress-indicator", ...props, className: stateClassName("sprout-progress-indicator", className) }));
|
|
24
|
+
}
|
|
25
|
+
/** A visible name for the bar. It labels the `progressbar` for you. */
|
|
26
|
+
export function ProgressLabel({ className, ...props }) {
|
|
27
|
+
return (_jsx(BaseProgress.Label, { "data-slot": "progress-label", ...props, className: stateClassName("sprout-progress-label", className) }));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The formatted value, such as “40%”, at the end of the label row. It is
|
|
31
|
+
* empty while the value is `null`. Pass a function child to show other text.
|
|
32
|
+
*/
|
|
33
|
+
export function ProgressValue({ className, ...props }) {
|
|
34
|
+
return (_jsx(BaseProgress.Value, { "data-slot": "progress-value", ...props, className: stateClassName("sprout-progress-value", className) }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
import { type BrandStackItem } from "./brand-icon.js";
|
|
3
|
+
export interface PromptListItem {
|
|
4
|
+
id: string;
|
|
5
|
+
/** One line. Long labels are cut with an ellipsis and shown in full on hover. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** A 16px icon shown before the label. */
|
|
8
|
+
icon: ReactNode;
|
|
9
|
+
/** Apps the prompt uses, shown as overlapping tiles with tooltips. */
|
|
10
|
+
brands?: readonly BrandStackItem[] | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface PromptListProps extends Omit<ComponentProps<"section">, "title" | "children" | "onSelect"> {
|
|
13
|
+
/** Names the list. Shown as a small heading unless `showTitle` is false. */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Hide the heading but keep `title` as the list's accessible name. */
|
|
16
|
+
showTitle?: boolean | undefined;
|
|
17
|
+
items: readonly PromptListItem[];
|
|
18
|
+
onSelect: (id: string) => void;
|
|
19
|
+
/** Locks every row, for example while a message is sending. */
|
|
20
|
+
disabled?: boolean | undefined;
|
|
21
|
+
}
|
|
22
|
+
/** A titled list of one-line prompts. Choosing a row calls `onSelect` with its id. */
|
|
23
|
+
export declare function PromptList({ title, showTitle, items, onSelect, disabled, className, ...props }: PromptListProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, } from "react";
|
|
4
|
+
import { ArrowRight } from "reicon-react/icons/ArrowRight";
|
|
5
|
+
import { cn } from "../internal/classes.js";
|
|
6
|
+
import { BrandStack } from "./brand-icon.js";
|
|
7
|
+
/** A titled list of one-line prompts. Choosing a row calls `onSelect` with its id. */
|
|
8
|
+
export function PromptList({ title, showTitle = true, items, onSelect, disabled = false, className, ...props }) {
|
|
9
|
+
const heading = useId();
|
|
10
|
+
return (_jsxs("section", { "data-slot": "prompt-list", "data-disabled": disabled || undefined, ...props, "aria-labelledby": showTitle ? heading : undefined, "aria-label": showTitle ? undefined : title, className: cn("sprout-prompt-list", className), children: [showTitle && (_jsx("h3", { id: heading, className: "sprout-prompt-list-title", children: title })), _jsx("ul", { className: "sprout-prompt-list-items", children: items.map((item, index) => (_jsxs("li", { "data-slot": "prompt-list-item", className: "sprout-prompt-list-item", style: { "--sprout-prompt-index": index }, children: [_jsx("span", { "aria-hidden": "true", className: "sprout-prompt-list-icon", children: item.icon }), _jsx("button", { type: "button", disabled: disabled, title: item.label, onClick: () => onSelect(item.id), className: "sprout-prompt-list-button", children: item.label }), !!item.brands?.length && (_jsx(BrandStack, { brands: item.brands, className: "sprout-prompt-list-brands" })), _jsx(ArrowRight, { "aria-hidden": "true", className: "sprout-prompt-list-arrow" })] }, item.id))) })] }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import { type ChangeEventHandler, type ComponentProps } from "react";
|
|
3
|
+
import { type ButtonSize, type ButtonVariant } from "./button.js";
|
|
4
|
+
export declare const questionnaireItemStatusNames: readonly ["unanswered", "answered", "skipped"];
|
|
5
|
+
export declare const questionnaireShortcutModeNames: readonly ["letters", "numbers"];
|
|
6
|
+
export type QuestionnaireItemStatus = (typeof questionnaireItemStatusNames)[number];
|
|
7
|
+
export type QuestionnaireShortcutMode = (typeof questionnaireShortcutModeNames)[number];
|
|
8
|
+
export interface QuestionnaireChoiceDefinition {
|
|
9
|
+
value: string;
|
|
10
|
+
disabled?: boolean | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface QuestionnaireItemDefinition {
|
|
13
|
+
name: string;
|
|
14
|
+
choices?: readonly QuestionnaireChoiceDefinition[] | undefined;
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
required?: boolean | undefined;
|
|
17
|
+
}
|
|
18
|
+
export type QuestionnaireInputType = "date" | "datetime-local" | "email" | "month" | "number" | "password" | "search" | "tel" | "text" | "time" | "url" | "week";
|
|
19
|
+
export interface QuestionnaireState extends Record<string, unknown> {
|
|
20
|
+
current: number;
|
|
21
|
+
first: boolean;
|
|
22
|
+
last: boolean;
|
|
23
|
+
total: number;
|
|
24
|
+
}
|
|
25
|
+
export type QuestionnaireProps = Omit<ComponentProps<"form">, "defaultValue" | "value"> & {
|
|
26
|
+
/** The item shown first when uncontrolled. Falls back to the first enabled item. */
|
|
27
|
+
defaultItem?: string | undefined;
|
|
28
|
+
/** The shown item, when controlled. */
|
|
29
|
+
item?: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* The ordered list of items and choices. Sets the step order, progress
|
|
32
|
+
* total, and which letters or numbers each choice gets as a shortcut.
|
|
33
|
+
* Without it, rendered items are used in document order.
|
|
34
|
+
*/
|
|
35
|
+
items?: readonly QuestionnaireItemDefinition[] | undefined;
|
|
36
|
+
onItemChange?: ((item: string) => void) | undefined;
|
|
37
|
+
/** Press a letter or number to pick a choice. Off by default. */
|
|
38
|
+
shortcuts?: QuestionnaireShortcutMode | undefined;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* A form that asks one question at a time. It moves between items with
|
|
42
|
+
* Next, Previous, and Skip, checks required answers before moving on, and
|
|
43
|
+
* submits after the last item.
|
|
44
|
+
*/
|
|
45
|
+
export declare function Questionnaire({ className, defaultItem, item, items, noValidate, onItemChange, onReset, onSubmit, ref, shortcuts, ...props }: QuestionnaireProps): import("react").JSX.Element;
|
|
46
|
+
export type QuestionnaireProgressProps = useRender.ComponentProps<"div", QuestionnaireState>;
|
|
47
|
+
/** "Question 2 of 3", announced politely as the step changes. */
|
|
48
|
+
export declare function QuestionnaireProgress({ children, className, render, ...props }: QuestionnaireProgressProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
49
|
+
export interface QuestionnaireItemState extends Record<string, unknown> {
|
|
50
|
+
active: boolean;
|
|
51
|
+
disabled: boolean;
|
|
52
|
+
invalid: boolean;
|
|
53
|
+
multiple: boolean;
|
|
54
|
+
required: boolean;
|
|
55
|
+
status: QuestionnaireItemStatus;
|
|
56
|
+
}
|
|
57
|
+
export type QuestionnaireItemProps = Omit<ComponentProps<"fieldset">, "name" | "value"> & {
|
|
58
|
+
name: string;
|
|
59
|
+
/** Checkbox choices instead of radios. */
|
|
60
|
+
multiple?: boolean | undefined;
|
|
61
|
+
/** Must be answered; hides Skip. */
|
|
62
|
+
required?: boolean | undefined;
|
|
63
|
+
/** Shows the error even after an answer, such as for a server-side check. */
|
|
64
|
+
invalid?: boolean | undefined;
|
|
65
|
+
onStatusChange?: ((status: QuestionnaireItemStatus) => void) | undefined;
|
|
66
|
+
};
|
|
67
|
+
/** One question. Only the current item is shown; the rest are hidden and inert. */
|
|
68
|
+
export declare function QuestionnaireItem({ "aria-describedby": ariaDescribedBy, "aria-keyshortcuts": ariaKeyShortcuts, children, className, disabled, invalid, multiple, name, onStatusChange, ref, required, ...props }: QuestionnaireItemProps): import("react").JSX.Element;
|
|
69
|
+
export type QuestionnaireTitleProps = useRender.ComponentProps<"legend">;
|
|
70
|
+
/** The question, as the item's `legend`. */
|
|
71
|
+
export declare function QuestionnaireTitle({ className, render, ...props }: QuestionnaireTitleProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
72
|
+
export type QuestionnaireDescriptionProps = useRender.ComponentProps<"p">;
|
|
73
|
+
/** Help text under the question. The item references it with `aria-describedby`. */
|
|
74
|
+
export declare function QuestionnaireDescription({ className, id, render, ...props }: QuestionnaireDescriptionProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
75
|
+
export interface QuestionnaireChoicesState extends Record<string, unknown> {
|
|
76
|
+
shortcuts: QuestionnaireShortcutMode | null;
|
|
77
|
+
}
|
|
78
|
+
export type QuestionnaireChoicesProps = useRender.ComponentProps<"div", QuestionnaireChoicesState>;
|
|
79
|
+
/** Stacks the item's choices. */
|
|
80
|
+
export declare function QuestionnaireChoices({ className, render, ...props }: QuestionnaireChoicesProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
81
|
+
export interface QuestionnaireChoiceState extends Record<string, unknown> {
|
|
82
|
+
checked: boolean;
|
|
83
|
+
disabled: boolean;
|
|
84
|
+
invalid: boolean;
|
|
85
|
+
shortcut: string | null;
|
|
86
|
+
type: "checkbox" | "radio";
|
|
87
|
+
}
|
|
88
|
+
export type QuestionnaireChoiceProps = Omit<useRender.ComponentProps<"label", QuestionnaireChoiceState>, "onChange"> & {
|
|
89
|
+
value: string;
|
|
90
|
+
checked?: boolean | undefined;
|
|
91
|
+
defaultChecked?: boolean | undefined;
|
|
92
|
+
disabled?: boolean | undefined;
|
|
93
|
+
onChange?: ChangeEventHandler<HTMLInputElement> | undefined;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* One answer row. A radio in single-answer items and a checkbox in
|
|
97
|
+
* `multiple` items; the whole row is the hit area.
|
|
98
|
+
*/
|
|
99
|
+
export declare function QuestionnaireChoice({ checked, children, className, defaultChecked, disabled: ownDisabled, onChange, render, value, ...props }: QuestionnaireChoiceProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
100
|
+
export type QuestionnaireChoiceDescriptionProps = ComponentProps<"span">;
|
|
101
|
+
/** A muted second line inside a choice. */
|
|
102
|
+
export declare function QuestionnaireChoiceDescription({ className, ...props }: QuestionnaireChoiceDescriptionProps): import("react").JSX.Element;
|
|
103
|
+
export interface QuestionnaireInputState extends Record<string, unknown> {
|
|
104
|
+
disabled: boolean;
|
|
105
|
+
filled: boolean;
|
|
106
|
+
invalid: boolean;
|
|
107
|
+
}
|
|
108
|
+
export type QuestionnaireInputProps = Omit<useRender.ComponentProps<"input", QuestionnaireInputState>, "form" | "name" | "type"> & {
|
|
109
|
+
type?: QuestionnaireInputType | undefined;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* A typed answer. It counts as answered once it has text, and is only sent
|
|
113
|
+
* with the form while it does.
|
|
114
|
+
*/
|
|
115
|
+
export declare function QuestionnaireInput({ className, defaultValue, disabled: ownDisabled, onChange, ref, render, type, value, ...props }: QuestionnaireInputProps): import("react").JSX.Element;
|
|
116
|
+
export interface QuestionnaireErrorState extends Record<string, unknown> {
|
|
117
|
+
invalid: boolean;
|
|
118
|
+
}
|
|
119
|
+
export type QuestionnaireErrorProps = useRender.ComponentProps<"p", QuestionnaireErrorState>;
|
|
120
|
+
/** Shown after someone tries to move on without a valid answer. */
|
|
121
|
+
export declare function QuestionnaireError({ children, className, id, render, ...props }: QuestionnaireErrorProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
122
|
+
export type QuestionnaireActionsProps = ComponentProps<"div">;
|
|
123
|
+
/** Previous on the start side; Skip and Next or Submit on the end side. */
|
|
124
|
+
export declare function QuestionnaireActions({ className, ...props }: QuestionnaireActionsProps): import("react").JSX.Element;
|
|
125
|
+
export interface QuestionnaireNavigationState extends Record<string, unknown> {
|
|
126
|
+
disabled: boolean;
|
|
127
|
+
shortcut: "Enter" | null;
|
|
128
|
+
status: QuestionnaireItemStatus | null;
|
|
129
|
+
visible: boolean;
|
|
130
|
+
}
|
|
131
|
+
export type QuestionnaireNavigationProps = useRender.ComponentProps<"button", QuestionnaireNavigationState> & {
|
|
132
|
+
/** A Button variant. */
|
|
133
|
+
variant?: ButtonVariant | undefined;
|
|
134
|
+
/** A Button size. */
|
|
135
|
+
size?: ButtonSize | undefined;
|
|
136
|
+
};
|
|
137
|
+
export type QuestionnairePreviousProps = QuestionnaireNavigationProps;
|
|
138
|
+
export type QuestionnaireSkipProps = QuestionnaireNavigationProps;
|
|
139
|
+
export type QuestionnaireNextProps = QuestionnaireNavigationProps;
|
|
140
|
+
export type QuestionnaireSubmitProps = QuestionnaireNavigationProps;
|
|
141
|
+
/** Goes back one item. Hidden on the first item. */
|
|
142
|
+
export declare function QuestionnairePrevious(props: QuestionnairePreviousProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
143
|
+
/** Clears the answer and moves on. Shown only on optional items; submits on the last one. */
|
|
144
|
+
export declare function QuestionnaireSkip(props: QuestionnaireSkipProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
145
|
+
/** Checks the answer and moves on. Hidden on the last item. */
|
|
146
|
+
export declare function QuestionnaireNext(props: QuestionnaireNextProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
147
|
+
/** Submits the form. Shown only on the last item. */
|
|
148
|
+
export declare function QuestionnaireSubmit(props: QuestionnaireSubmitProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|