@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
package/dist/components/form.js
CHANGED
|
@@ -1,55 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useRef, useState
|
|
4
|
-
import { cn } from
|
|
5
|
-
import { Alert } from
|
|
6
|
-
import { Badge } from
|
|
7
|
-
import { Button, jumpTo, useActionControl, } from
|
|
8
|
-
import { FieldsDisabled } from
|
|
9
|
-
export const formFooterLayoutNames = [
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { cn } from '../internal/classes.js';
|
|
5
|
+
import { Alert } from './alert.js';
|
|
6
|
+
import { Badge } from './badge.js';
|
|
7
|
+
import { Button, jumpTo, useActionControl, } from './button.js';
|
|
8
|
+
import { FieldsDisabled } from './field.js';
|
|
9
|
+
export const formFooterLayoutNames = ['bar', 'stack', 'compact'];
|
|
10
10
|
export const formSectionLevelNames = [2, 3];
|
|
11
11
|
/**
|
|
12
12
|
* A `noValidate` form that prevents the native submit, locks the fields inside
|
|
13
13
|
* while `disabled`, and moves focus to the first invalid control after a
|
|
14
14
|
* failed submit.
|
|
15
15
|
*/
|
|
16
|
-
export function Form({ id, disabled = false, onSubmit, label, className, children
|
|
16
|
+
export function Form({ id, disabled = false, onSubmit, label, className, children }) {
|
|
17
17
|
const formRef = useRef(null);
|
|
18
18
|
const [failedSubmits, setFailedSubmits] = useState(0);
|
|
19
19
|
useEffect(() => {
|
|
20
|
-
const invalid = failedSubmits > 0
|
|
21
|
-
? formRef.current?.querySelector('[aria-invalid="true"]')
|
|
22
|
-
: null;
|
|
20
|
+
const invalid = failedSubmits > 0 ? formRef.current?.querySelector('[aria-invalid="true"]') : null;
|
|
23
21
|
if (invalid)
|
|
24
22
|
jumpTo(invalid);
|
|
25
23
|
}, [failedSubmits]);
|
|
26
|
-
return (_jsx(FieldsDisabled, { value: disabled, children: _jsx("form", { id: id, ref: formRef, "data-slot": "form", noValidate: true, "aria-label": label, className: cn(
|
|
24
|
+
return (_jsx(FieldsDisabled, { value: disabled, children: _jsx("form", { id: id, ref: formRef, "data-slot": "form", noValidate: true, "aria-label": label, className: cn('sprout-form', className), onSubmit: event => {
|
|
27
25
|
event.preventDefault();
|
|
28
|
-
if (onSubmit() ===
|
|
29
|
-
setFailedSubmits(
|
|
26
|
+
if (onSubmit() === 'invalid')
|
|
27
|
+
setFailedSubmits(count => count + 1);
|
|
30
28
|
}, children: children }) }));
|
|
31
29
|
}
|
|
32
30
|
/** A bordered, named region of a form with a title, description, and optional meta badge. */
|
|
33
|
-
export function FormSection({ title, description, meta, label, id, level = 2, className, children
|
|
34
|
-
const Heading = level === 3 ?
|
|
35
|
-
return (_jsxs("section", { id: id, "data-slot": "form-section", "aria-label": label ?? title, className: cn(
|
|
31
|
+
export function FormSection({ title, description, meta, label, id, level = 2, className, children }) {
|
|
32
|
+
const Heading = level === 3 ? 'h3' : 'h2';
|
|
33
|
+
return (_jsxs("section", { id: id, "data-slot": "form-section", "aria-label": label ?? title, className: cn('sprout-form-section', className), children: [_jsxs("div", { className: "sprout-form-section-header", children: [_jsxs("div", { className: "sprout-form-section-text", children: [_jsx(Heading, { className: "sprout-form-section-title", children: title }), description && _jsx("p", { className: "sprout-form-section-description", children: description })] }), meta && _jsx(Badge, { variant: "secondary", children: meta })] }), _jsx("div", { className: "sprout-form-section-content", children: children })] }));
|
|
36
34
|
}
|
|
37
35
|
/**
|
|
38
36
|
* The save area of a form: the submit with busy and blocked states, an
|
|
39
37
|
* optional secondary submit and cancel, an unsaved-changes line, a note, and
|
|
40
38
|
* an error alert.
|
|
41
39
|
*/
|
|
42
|
-
export function FormFooter({ form, summary, submit, secondarySubmit, dirty, cancel, note, error, layout =
|
|
40
|
+
export function FormFooter({ form, summary, submit, secondarySubmit, dirty, cancel, note, error, layout = 'bar', className, children, }) {
|
|
43
41
|
const action = useActionControl(submit.state);
|
|
44
|
-
const stack = layout ===
|
|
45
|
-
const compact = layout ===
|
|
46
|
-
const size = stack ?
|
|
47
|
-
const wide = stack ?
|
|
48
|
-
const save = (_jsx(Button, { type: "submit", form: form, size: size, className: wide, ...action.button, children: submit.state.kind ===
|
|
42
|
+
const stack = layout === 'stack';
|
|
43
|
+
const compact = layout === 'compact';
|
|
44
|
+
const size = stack ? 'lg' : 'md';
|
|
45
|
+
const wide = stack ? 'sprout-form-footer-wide' : undefined;
|
|
46
|
+
const save = (_jsx(Button, { type: "submit", form: form, size: size, className: wide, ...action.button, children: submit.state.kind === 'busy' ? submit.pendingLabel : submit.label }));
|
|
49
47
|
const secondary = secondarySubmit && (_jsx(Button, { type: "submit", form: form, size: size, variant: "outline", className: wide, disabled: secondarySubmit.disabled, onClick: secondarySubmit.onSelect, children: secondarySubmit.label }));
|
|
50
|
-
const cancelButton = !cancel ? null : cancel.kind ===
|
|
48
|
+
const cancelButton = !cancel ? null : cancel.kind === 'leave' ? (_jsx(Button, { variant: "outline", size: size, className: wide, nativeButton: false, render: cancel.link, children: cancel.label })) : dirty && submit.state.kind !== 'busy' ? (_jsx(Button, { variant: "outline", size: size, className: wide, onClick: cancel.onReset, children: cancel.label })) : null;
|
|
51
49
|
const status = (_jsxs(_Fragment, { children: [dirty && (_jsxs("p", { className: "sprout-form-footer-dirty", children: [_jsx("span", { "aria-hidden": "true", className: "sprout-form-footer-dirty-dot" }), "Unsaved changes"] })), note && _jsx("p", { className: "sprout-form-footer-note", children: note })] }));
|
|
52
|
-
return (_jsxs("div", { "data-slot": "form-footer", "data-layout": layout, className: cn(
|
|
53
|
-
? "sprout-form-footer-sr-only"
|
|
54
|
-
: "sprout-form-footer-status", children: summary ?? status }), _jsxs("div", { className: "sprout-form-footer-actions", children: [compact && children, cancelButton, secondary, save] })] })), action.reason, error && _jsx(Alert, { variant: "destructive", children: error }), !compact && children] }));
|
|
50
|
+
return (_jsxs("div", { "data-slot": "form-footer", "data-layout": layout, className: cn('sprout-form-footer', className), children: [stack ? (_jsxs(_Fragment, { children: [status, _jsxs("div", { className: "sprout-form-footer-stack", children: [save, secondary, cancelButton] })] })) : (_jsxs("div", { className: "sprout-form-footer-row", children: [_jsx("div", { className: compact && !summary ? 'sprout-form-footer-sr-only' : 'sprout-form-footer-status', children: summary ?? status }), _jsxs("div", { className: "sprout-form-footer-actions", children: [compact && children, cancelButton, secondary, save] })] })), action.reason, error && _jsx(Alert, { variant: "destructive", children: error }), !compact && children] }));
|
|
55
51
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ComponentProps, type ReactNode } from
|
|
2
|
-
export interface GlassBannerProps extends Omit<ComponentProps<
|
|
1
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
2
|
+
export interface GlassBannerProps extends Omit<ComponentProps<'div'>, 'title' | 'children'> {
|
|
3
3
|
/** The headline on the glass. */
|
|
4
4
|
title: ReactNode;
|
|
5
5
|
/** A quieter line under the title. It also names the chip list. */
|
|
@@ -13,7 +13,7 @@ export interface GlassBannerProps extends Omit<ComponentProps<"div">, "title" |
|
|
|
13
13
|
* by the caption, or by the title when there is no caption.
|
|
14
14
|
*/
|
|
15
15
|
export declare function GlassBanner({ title, caption, className, children, ...props }: GlassBannerProps): import("react").JSX.Element;
|
|
16
|
-
export interface GlassChipProps extends Omit<ComponentProps<
|
|
16
|
+
export interface GlassChipProps extends Omit<ComponentProps<'li'>, 'children'> {
|
|
17
17
|
/** A 28px round badge before the text, such as a brand glyph or icon. */
|
|
18
18
|
icon?: ReactNode;
|
|
19
19
|
children: ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useId, useImperativeHandle, useRef
|
|
3
|
-
import { cn } from
|
|
2
|
+
import { useEffect, useId, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
import { cn } from '../internal/classes.js';
|
|
4
4
|
/**
|
|
5
5
|
* A frosted showcase banner with draggable glass chips. The bubble art is
|
|
6
6
|
* hidden from assistive technology; the chips are announced as a list named
|
|
@@ -10,16 +10,13 @@ export function GlassBanner({ title, caption, className, children, ...props }) {
|
|
|
10
10
|
const id = useId();
|
|
11
11
|
const titleId = `${id}-title`;
|
|
12
12
|
const captionId = `${id}-caption`;
|
|
13
|
-
const hasCaption = caption !== undefined &&
|
|
14
|
-
|
|
15
|
-
caption !== false &&
|
|
16
|
-
caption !== "";
|
|
17
|
-
return (_jsxs("div", { "data-slot": "glass-banner", ...props, className: cn("sprout-glass-banner", className), children: [_jsx("div", { "data-slot": "glass-banner-art", className: "sprout-glass-banner-art", "aria-hidden": "true", children: Array.from({ length: 5 }, (_, index) => (_jsx("span", { "data-slot": "glass-bubble", className: "sprout-glass-bubble" }, index))) }), _jsxs("div", { "data-slot": "glass-banner-copy", className: "sprout-glass-banner-copy", children: [_jsx("p", { id: titleId, "data-slot": "glass-banner-title", className: "sprout-glass-banner-title", children: title }), hasCaption && (_jsx("p", { id: captionId, "data-slot": "glass-banner-caption", className: "sprout-glass-banner-caption", children: caption }))] }), _jsx("ul", { "data-slot": "glass-banner-chips", className: "sprout-glass-banner-chips", "aria-labelledby": hasCaption ? captionId : titleId, children: children })] }));
|
|
13
|
+
const hasCaption = caption !== undefined && caption !== null && caption !== false && caption !== '';
|
|
14
|
+
return (_jsxs("div", { "data-slot": "glass-banner", ...props, className: cn('sprout-glass-banner', className), children: [_jsx("div", { "data-slot": "glass-banner-art", className: "sprout-glass-banner-art", "aria-hidden": "true", children: Array.from({ length: 5 }, (_, index) => (_jsx("span", { "data-slot": "glass-bubble", className: "sprout-glass-bubble" }, index))) }), _jsxs("div", { "data-slot": "glass-banner-copy", className: "sprout-glass-banner-copy", children: [_jsx("p", { id: titleId, "data-slot": "glass-banner-title", className: "sprout-glass-banner-title", children: title }), hasCaption && (_jsx("p", { id: captionId, "data-slot": "glass-banner-caption", className: "sprout-glass-banner-caption", children: caption }))] }), _jsx("ul", { "data-slot": "glass-banner-chips", className: "sprout-glass-banner-chips", "aria-labelledby": hasCaption ? captionId : titleId, children: children })] }));
|
|
18
15
|
}
|
|
19
16
|
const clamp = (value, limit) => Math.max(-limit, Math.min(limit, value));
|
|
20
|
-
const prefersReducedMotion = () => typeof window !==
|
|
21
|
-
typeof window.matchMedia ===
|
|
22
|
-
window.matchMedia(
|
|
17
|
+
const prefersReducedMotion = () => typeof window !== 'undefined' &&
|
|
18
|
+
typeof window.matchMedia === 'function' &&
|
|
19
|
+
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
23
20
|
/**
|
|
24
21
|
* A glass pill that can be dragged with a pointer and springs back on
|
|
25
22
|
* release, stretching with its speed. The drag is play only: chips are not
|
|
@@ -43,8 +40,8 @@ export function GlassChip({ icon, className, children, ref, ...props }) {
|
|
|
43
40
|
};
|
|
44
41
|
const rest = () => {
|
|
45
42
|
x = y = vx = vy = 0;
|
|
46
|
-
element.style.transform =
|
|
47
|
-
element.removeAttribute(
|
|
43
|
+
element.style.transform = '';
|
|
44
|
+
element.removeAttribute('data-dragging');
|
|
48
45
|
frame = 0;
|
|
49
46
|
};
|
|
50
47
|
const tick = () => {
|
|
@@ -74,7 +71,7 @@ export function GlassChip({ icon, className, children, ref, ...props }) {
|
|
|
74
71
|
return;
|
|
75
72
|
pointer = event.pointerId;
|
|
76
73
|
element.setPointerCapture?.(pointer);
|
|
77
|
-
element.setAttribute(
|
|
74
|
+
element.setAttribute('data-dragging', '');
|
|
78
75
|
startX = event.clientX - x;
|
|
79
76
|
startY = event.clientY - y;
|
|
80
77
|
targetX = x;
|
|
@@ -98,19 +95,19 @@ export function GlassChip({ icon, className, children, ref, ...props }) {
|
|
|
98
95
|
}
|
|
99
96
|
run();
|
|
100
97
|
};
|
|
101
|
-
element.addEventListener(
|
|
102
|
-
element.addEventListener(
|
|
103
|
-
element.addEventListener(
|
|
104
|
-
element.addEventListener(
|
|
105
|
-
element.addEventListener(
|
|
98
|
+
element.addEventListener('pointerdown', down);
|
|
99
|
+
element.addEventListener('pointermove', move);
|
|
100
|
+
element.addEventListener('pointerup', up);
|
|
101
|
+
element.addEventListener('pointercancel', up);
|
|
102
|
+
element.addEventListener('lostpointercapture', up);
|
|
106
103
|
return () => {
|
|
107
104
|
cancelAnimationFrame(frame);
|
|
108
|
-
element.removeEventListener(
|
|
109
|
-
element.removeEventListener(
|
|
110
|
-
element.removeEventListener(
|
|
111
|
-
element.removeEventListener(
|
|
112
|
-
element.removeEventListener(
|
|
105
|
+
element.removeEventListener('pointerdown', down);
|
|
106
|
+
element.removeEventListener('pointermove', move);
|
|
107
|
+
element.removeEventListener('pointerup', up);
|
|
108
|
+
element.removeEventListener('pointercancel', up);
|
|
109
|
+
element.removeEventListener('lostpointercapture', up);
|
|
113
110
|
};
|
|
114
111
|
}, []);
|
|
115
|
-
return (_jsx("li", { ref: chip, "data-slot": "glass-chip", ...props, className: cn(
|
|
112
|
+
return (_jsx("li", { ref: chip, "data-slot": "glass-chip", ...props, className: cn('sprout-glass-chip', className), children: _jsxs("span", { "data-slot": "glass-chip-surface", className: "sprout-glass-chip-surface", children: [icon && (_jsx("span", { "data-slot": "glass-chip-icon", className: "sprout-glass-chip-icon", children: icon })), _jsx("span", { "data-slot": "glass-chip-label", className: "sprout-glass-chip-label", children: children })] }) }));
|
|
116
113
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type ComponentProps } from
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
2
|
export declare const gradientBannerVariantNames: readonly ["aurora", "citrus", "lagoon", "iris", "cobalt", "mint"];
|
|
3
|
-
export declare const gradientBannerSizeNames: readonly ["sm", "md", "lg"
|
|
3
|
+
export declare const gradientBannerSizeNames: readonly ["sm", "md", "lg"];
|
|
4
4
|
export declare const gradientBannerPanelToneNames: readonly ["light", "dark"];
|
|
5
5
|
export type GradientBannerVariant = (typeof gradientBannerVariantNames)[number];
|
|
6
6
|
export type GradientBannerSize = (typeof gradientBannerSizeNames)[number];
|
|
7
7
|
export type GradientBannerPanelTone = (typeof gradientBannerPanelToneNames)[number];
|
|
8
|
-
export interface GradientBannerProps extends ComponentProps<
|
|
8
|
+
export interface GradientBannerProps extends ComponentProps<'div'> {
|
|
9
9
|
/** Color story of the art. Defaults to `"aurora"`. */
|
|
10
10
|
variant?: GradientBannerVariant | undefined;
|
|
11
|
-
/** `sm` 96px, `md` 160px, `lg` 240px (default)
|
|
11
|
+
/** `sm` 96px, `md` 160px, `lg` 240px (default) minimum height. */
|
|
12
12
|
size?: GradientBannerSize | undefined;
|
|
13
13
|
/** Film grain over the art. Defaults to `true`. */
|
|
14
14
|
texture?: boolean | undefined;
|
|
@@ -18,15 +18,15 @@ export interface GradientBannerProps extends ComponentProps<"div"> {
|
|
|
18
18
|
* assistive technology; only children are announced.
|
|
19
19
|
*/
|
|
20
20
|
export declare function GradientBanner({ variant, size, texture, className, children, ...props }: GradientBannerProps): import("react").JSX.Element;
|
|
21
|
-
export interface GradientBannerPanelProps extends ComponentProps<
|
|
21
|
+
export interface GradientBannerPanelProps extends ComponentProps<'div'> {
|
|
22
22
|
/** `"light"` paper (default) or `"dark"` night surface. */
|
|
23
23
|
tone?: GradientBannerPanelTone | undefined;
|
|
24
24
|
}
|
|
25
25
|
/** A solid surface that keeps text readable on any banner variant. */
|
|
26
26
|
export declare function GradientBannerPanel({ tone, className, ...props }: GradientBannerPanelProps): import("react").JSX.Element;
|
|
27
27
|
/** A pill label that adapts to the panel tone around it. */
|
|
28
|
-
export declare function GradientBannerBadge({ className, ...props }: ComponentProps<
|
|
29
|
-
export interface GradientBannerProgressProps extends Omit<ComponentProps<
|
|
28
|
+
export declare function GradientBannerBadge({ className, ...props }: ComponentProps<'span'>): import("react").JSX.Element;
|
|
29
|
+
export interface GradientBannerProgressProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
30
30
|
/** Percent complete. Values outside 0–100 are clamped. */
|
|
31
31
|
value: number;
|
|
32
32
|
}
|
|
@@ -1,43 +1,34 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Children, useId } from
|
|
3
|
-
import { cn } from
|
|
4
|
-
export const gradientBannerVariantNames = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"lagoon",
|
|
8
|
-
"iris",
|
|
9
|
-
"cobalt",
|
|
10
|
-
"mint",
|
|
11
|
-
];
|
|
12
|
-
export const gradientBannerSizeNames = ["sm", "md", "lg", "xl"];
|
|
13
|
-
export const gradientBannerPanelToneNames = ["light", "dark"];
|
|
2
|
+
import { Children, useId } from 'react';
|
|
3
|
+
import { cn } from '../internal/classes.js';
|
|
4
|
+
export const gradientBannerVariantNames = ['aurora', 'citrus', 'lagoon', 'iris', 'cobalt', 'mint'];
|
|
5
|
+
export const gradientBannerSizeNames = ['sm', 'md', 'lg'];
|
|
6
|
+
export const gradientBannerPanelToneNames = ['light', 'dark'];
|
|
14
7
|
/**
|
|
15
8
|
* Decorative gradient art with centered content on top. The art is hidden from
|
|
16
9
|
* assistive technology; only children are announced.
|
|
17
10
|
*/
|
|
18
|
-
export function GradientBanner({ variant =
|
|
11
|
+
export function GradientBanner({ variant = 'aurora', size = 'lg', texture = true, className, children, ...props }) {
|
|
19
12
|
const grainId = useId();
|
|
20
13
|
const hasContent = Children.toArray(children).length > 0;
|
|
21
|
-
return (_jsxs("div", { "data-slot": "gradient-banner", "data-variant": variant, "data-size": size, ...props, className: cn(
|
|
14
|
+
return (_jsxs("div", { "data-slot": "gradient-banner", "data-variant": variant, "data-size": size, ...props, className: cn('sprout-gradient-banner', className), children: [_jsxs("div", { "data-slot": "gradient-banner-art", className: "sprout-gradient-banner-art", "aria-hidden": "true", children: [_jsx("span", { className: "sprout-gradient-banner-fold" }), _jsx("span", { className: "sprout-gradient-banner-light" }), texture && (_jsxs("svg", { "data-slot": "gradient-banner-texture", className: "sprout-gradient-banner-texture", "aria-hidden": "true", focusable: "false", children: [_jsxs("filter", { id: grainId, x: "0%", y: "0%", width: "100%", height: "100%", children: [_jsx("feTurbulence", { type: "fractalNoise", baseFrequency: "0.82", numOctaves: "3", stitchTiles: "stitch", seed: "17" }), _jsx("feColorMatrix", { type: "saturate", values: "0" })] }), _jsx("rect", { width: "100%", height: "100%", filter: `url(#${grainId})` })] }))] }), hasContent && (_jsx("div", { "data-slot": "gradient-banner-content", className: "sprout-gradient-banner-content", children: children }))] }));
|
|
22
15
|
}
|
|
23
16
|
/** A solid surface that keeps text readable on any banner variant. */
|
|
24
|
-
export function GradientBannerPanel({ tone =
|
|
25
|
-
return (_jsx("div", { "data-slot": "gradient-banner-panel", "data-tone": tone, ...props, className: cn(
|
|
17
|
+
export function GradientBannerPanel({ tone = 'light', className, ...props }) {
|
|
18
|
+
return (_jsx("div", { "data-slot": "gradient-banner-panel", "data-tone": tone, ...props, className: cn('sprout-gradient-banner-panel', className) }));
|
|
26
19
|
}
|
|
27
20
|
/** A pill label that adapts to the panel tone around it. */
|
|
28
21
|
export function GradientBannerBadge({ className, ...props }) {
|
|
29
|
-
return (_jsx("span", { "data-slot": "gradient-banner-badge", ...props, className: cn(
|
|
22
|
+
return (_jsx("span", { "data-slot": "gradient-banner-badge", ...props, className: cn('sprout-gradient-banner-badge', className) }));
|
|
30
23
|
}
|
|
31
24
|
/**
|
|
32
25
|
* A thin `progressbar` in the current text color. Name it with `aria-label`
|
|
33
26
|
* or `aria-labelledby`.
|
|
34
27
|
*/
|
|
35
28
|
export function GradientBannerProgress({ value, className, style, ...props }) {
|
|
36
|
-
const percent = Number.isFinite(value)
|
|
37
|
-
? Math.min(Math.max(value, 0), 100)
|
|
38
|
-
: 0;
|
|
29
|
+
const percent = Number.isFinite(value) ? Math.min(Math.max(value, 0), 100) : 0;
|
|
39
30
|
return (_jsx("div", { "data-slot": "gradient-banner-progress", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(percent), ...props, style: {
|
|
40
31
|
...style,
|
|
41
|
-
[
|
|
42
|
-
}, className: cn(
|
|
32
|
+
['--sprout-gradient-banner-progress']: percent / 100,
|
|
33
|
+
}, className: cn('sprout-gradient-banner-progress', className), children: _jsx("div", { className: "sprout-gradient-banner-progress-fill" }) }));
|
|
43
34
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PreviewCard as PreviewCardPrimitive } from
|
|
1
|
+
import { PreviewCard as PreviewCardPrimitive } from '@base-ui/react/preview-card';
|
|
2
2
|
export type HoverCardProps = PreviewCardPrimitive.Root.Props;
|
|
3
3
|
/**
|
|
4
4
|
* A card that previews what a link points to. It opens when the link is
|
|
@@ -12,12 +12,12 @@ export type HoverCardTriggerProps = PreviewCardPrimitive.Trigger.Props;
|
|
|
12
12
|
* `closeDelay` (300ms).
|
|
13
13
|
*/
|
|
14
14
|
export declare function HoverCardTrigger({ className, ...props }: HoverCardTriggerProps): import("react").JSX.Element;
|
|
15
|
-
type PositionerProps = Pick<PreviewCardPrimitive.Positioner.Props,
|
|
15
|
+
type PositionerProps = Pick<PreviewCardPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'anchor' | 'collisionPadding' | 'collisionAvoidance' | 'sticky' | 'positionMethod'>;
|
|
16
16
|
export interface HoverCardContentProps extends PreviewCardPrimitive.Popup.Props, PositionerProps {
|
|
17
17
|
/** Keep the card in the DOM while closed. */
|
|
18
|
-
keepMounted?: PreviewCardPrimitive.Portal.Props[
|
|
18
|
+
keepMounted?: PreviewCardPrimitive.Portal.Props['keepMounted'];
|
|
19
19
|
/** Where the portal renders. Defaults to `document.body`. */
|
|
20
|
-
container?: PreviewCardPrimitive.Portal.Props[
|
|
20
|
+
container?: PreviewCardPrimitive.Portal.Props['container'];
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* The 16rem floating card. It renders its own portal and positioner, so place
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { PreviewCard as PreviewCardPrimitive } from
|
|
4
|
-
import { stateClassName } from
|
|
3
|
+
import { PreviewCard as PreviewCardPrimitive } from '@base-ui/react/preview-card';
|
|
4
|
+
import { stateClassName } from '../internal/classes.js';
|
|
5
5
|
/**
|
|
6
6
|
* A card that previews what a link points to. It opens when the link is
|
|
7
7
|
* hovered or keyboard-focused and closes on Escape, blur, or pointer leave.
|
|
@@ -15,12 +15,12 @@ export function HoverCard(props) {
|
|
|
15
15
|
* `closeDelay` (300ms).
|
|
16
16
|
*/
|
|
17
17
|
export function HoverCardTrigger({ className, ...props }) {
|
|
18
|
-
return (_jsx(PreviewCardPrimitive.Trigger, { "data-slot": "hover-card-trigger", ...props, className: stateClassName(
|
|
18
|
+
return (_jsx(PreviewCardPrimitive.Trigger, { "data-slot": "hover-card-trigger", ...props, className: stateClassName('sprout-hover-card-trigger', className) }));
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* The 16rem floating card. It renders its own portal and positioner, so place
|
|
22
22
|
* it directly inside `HoverCard`.
|
|
23
23
|
*/
|
|
24
|
-
export function HoverCardContent({ side =
|
|
25
|
-
return (_jsx(PreviewCardPrimitive.Portal, { "data-slot": "hover-card-portal", keepMounted: keepMounted, container: container, children: _jsx(PreviewCardPrimitive.Positioner, { className: "sprout-hover-card-positioner", anchor: anchor, align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, collisionPadding: collisionPadding, collisionAvoidance: collisionAvoidance, sticky: sticky, positionMethod: positionMethod, children: _jsx(PreviewCardPrimitive.Popup, { "data-slot": "hover-card-content", ...props, className: stateClassName(
|
|
24
|
+
export function HoverCardContent({ side = 'bottom', sideOffset = 4, align = 'center', alignOffset = 4, collisionPadding = 8, collisionAvoidance, sticky, positionMethod, anchor, keepMounted = false, container, className, ...props }) {
|
|
25
|
+
return (_jsx(PreviewCardPrimitive.Portal, { "data-slot": "hover-card-portal", keepMounted: keepMounted, container: container, children: _jsx(PreviewCardPrimitive.Positioner, { className: "sprout-hover-card-positioner", anchor: anchor, align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, collisionPadding: collisionPadding, collisionAvoidance: collisionAvoidance, sticky: sticky, positionMethod: positionMethod, children: _jsx(PreviewCardPrimitive.Popup, { "data-slot": "hover-card-content", ...props, className: stateClassName('sprout-hover-card-content', className) }) }) }));
|
|
26
26
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { ComponentProps } from
|
|
2
|
-
import { type ButtonProps } from
|
|
3
|
-
import { type InputProps } from
|
|
4
|
-
import { type TextareaProps } from
|
|
5
|
-
export declare const inputGroupSizeNames: readonly ["
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { type ButtonProps } from './button.js';
|
|
3
|
+
import { type InputProps } from './input.js';
|
|
4
|
+
import { type TextareaProps } from './textarea.js';
|
|
5
|
+
export declare const inputGroupSizeNames: readonly ["md", "sm", "lg"];
|
|
6
6
|
export declare const inputGroupVariantNames: readonly ["default", "composer", "question-composer"];
|
|
7
7
|
export declare const inputGroupAddonAlignNames: readonly ["inline-start", "inline-end", "block-start", "block-end"];
|
|
8
|
-
export declare const inputGroupButtonSizeNames: readonly ["
|
|
8
|
+
export declare const inputGroupButtonSizeNames: readonly ["md", "icon"];
|
|
9
9
|
export type InputGroupSize = (typeof inputGroupSizeNames)[number];
|
|
10
10
|
export type InputGroupVariant = (typeof inputGroupVariantNames)[number];
|
|
11
11
|
export type InputGroupAddonAlign = (typeof inputGroupAddonAlignNames)[number];
|
|
12
12
|
export type InputGroupButtonSize = (typeof inputGroupButtonSizeNames)[number];
|
|
13
|
-
export interface InputGroupProps extends ComponentProps<
|
|
14
|
-
/** `
|
|
13
|
+
export interface InputGroupProps extends ComponentProps<'div'> {
|
|
14
|
+
/** `sm` is 28px, `md` is 32px (`--sprout-control-height`), and `lg` is 36px. */
|
|
15
15
|
size?: InputGroupSize | null;
|
|
16
16
|
/**
|
|
17
17
|
* `default` is a single field row. `composer` stacks a message box with
|
|
@@ -28,7 +28,7 @@ export interface InputGroupProps extends ComponentProps<"div"> {
|
|
|
28
28
|
* `InputGroupTextarea`, or a rich text editor, drives those states.
|
|
29
29
|
*/
|
|
30
30
|
export declare function InputGroup({ size, variant, className, ...props }: InputGroupProps): import("react").JSX.Element;
|
|
31
|
-
export interface InputGroupAddonProps extends ComponentProps<
|
|
31
|
+
export interface InputGroupAddonProps extends ComponentProps<'div'> {
|
|
32
32
|
/** Inline additions sit beside the control; block additions span a row above or below it. */
|
|
33
33
|
align?: InputGroupAddonAlign | null;
|
|
34
34
|
}
|
|
@@ -38,28 +38,28 @@ export interface InputGroupAddonProps extends ComponentProps<"div"> {
|
|
|
38
38
|
* in it except a button focuses the control, like a label.
|
|
39
39
|
*/
|
|
40
40
|
export declare function InputGroupAddon({ align, className, onClick, ...props }: InputGroupAddonProps): import("react").JSX.Element;
|
|
41
|
-
export interface InputGroupButtonProps extends Omit<ButtonProps,
|
|
42
|
-
/** `
|
|
41
|
+
export interface InputGroupButtonProps extends Omit<ButtonProps, 'size' | 'type'> {
|
|
42
|
+
/** `md` fits a label; `icon` is square. Both follow the group height. */
|
|
43
43
|
size?: InputGroupButtonSize | null;
|
|
44
|
-
type?:
|
|
44
|
+
type?: 'button' | 'submit' | 'reset';
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* A compact Sprout `Button` sized to sit inside an `InputGroup` addon.
|
|
48
|
-
*
|
|
49
|
-
* submits a form by accident. Use `render` to make it a menu, popover, or
|
|
47
|
+
* A compact Sprout `Button` sized to sit inside an `InputGroup` addon. Its
|
|
48
|
+
* height follows the group, 4px in from each edge. It is `ghost` and a plain
|
|
49
|
+
* `type="button"` by default, so it never submits a form by accident. Use `render` to make it a menu, popover, or
|
|
50
50
|
* combobox trigger.
|
|
51
51
|
*/
|
|
52
52
|
export declare function InputGroupButton({ size, variant, type, className, ...props }: InputGroupButtonProps): import("react").JSX.Element;
|
|
53
|
-
export type InputGroupTextProps = ComponentProps<
|
|
53
|
+
export type InputGroupTextProps = ComponentProps<'span'>;
|
|
54
54
|
/** Muted text or an icon with text inside an addon, such as a URL prefix or a unit. */
|
|
55
55
|
export declare function InputGroupText({ className, ...props }: InputGroupTextProps): import("react").JSX.Element;
|
|
56
|
-
export type InputGroupInputProps = Omit<InputProps,
|
|
56
|
+
export type InputGroupInputProps = Omit<InputProps, 'scale'>;
|
|
57
57
|
/**
|
|
58
58
|
* A Sprout `Input` without its own border, fill, or ring, so the group draws
|
|
59
59
|
* them. It reads a surrounding `Field` the same way `Input` does.
|
|
60
60
|
*/
|
|
61
61
|
export declare function InputGroupInput({ className, ...props }: InputGroupInputProps): import("react").JSX.Element;
|
|
62
|
-
export type InputGroupTextareaProps = Omit<TextareaProps,
|
|
62
|
+
export type InputGroupTextareaProps = Omit<TextareaProps, 'variant'>;
|
|
63
63
|
/**
|
|
64
64
|
* A Sprout `Textarea` without its own border, fill, or ring, so the group
|
|
65
65
|
* draws them. It grows with its content from a 96px floor and never resizes
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from
|
|
4
|
-
import { Button } from
|
|
5
|
-
import { Input } from
|
|
6
|
-
import { Textarea } from
|
|
7
|
-
export const inputGroupSizeNames = [
|
|
8
|
-
export const inputGroupVariantNames = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"question-composer",
|
|
12
|
-
];
|
|
13
|
-
export const inputGroupAddonAlignNames = [
|
|
14
|
-
"inline-start",
|
|
15
|
-
"inline-end",
|
|
16
|
-
"block-start",
|
|
17
|
-
"block-end",
|
|
18
|
-
];
|
|
19
|
-
export const inputGroupButtonSizeNames = [
|
|
20
|
-
"xs",
|
|
21
|
-
"sm",
|
|
22
|
-
"icon-xs",
|
|
23
|
-
"icon-sm",
|
|
24
|
-
];
|
|
3
|
+
import { cn } from '../internal/classes.js';
|
|
4
|
+
import { Button } from './button.js';
|
|
5
|
+
import { Input } from './input.js';
|
|
6
|
+
import { Textarea } from './textarea.js';
|
|
7
|
+
export const inputGroupSizeNames = ['md', 'sm', 'lg'];
|
|
8
|
+
export const inputGroupVariantNames = ['default', 'composer', 'question-composer'];
|
|
9
|
+
export const inputGroupAddonAlignNames = ['inline-start', 'inline-end', 'block-start', 'block-end'];
|
|
10
|
+
export const inputGroupButtonSizeNames = ['md', 'icon'];
|
|
25
11
|
/**
|
|
26
12
|
* One bordered field made of a control and its additions: icons, text,
|
|
27
13
|
* shortcuts, and buttons. The group draws the border, fill, focus ring, and
|
|
@@ -30,9 +16,9 @@ export const inputGroupButtonSizeNames = [
|
|
|
30
16
|
* `InputGroupTextarea`, or a rich text editor, drives those states.
|
|
31
17
|
*/
|
|
32
18
|
export function InputGroup({ size, variant, className, ...props }) {
|
|
33
|
-
const scale = size ??
|
|
34
|
-
const kind = variant ??
|
|
35
|
-
return (_jsx("div", { "data-slot": "input-group", role: "group", "data-size": scale, "data-variant": kind, ...props, className: cn(
|
|
19
|
+
const scale = size ?? 'md';
|
|
20
|
+
const kind = variant ?? 'default';
|
|
21
|
+
return (_jsx("div", { "data-slot": "input-group", role: "group", "data-size": scale, "data-variant": kind, ...props, className: cn('sprout-input-group', `sprout-input-group-size-${scale}`, `sprout-input-group-variant-${kind}`, className) }));
|
|
36
22
|
}
|
|
37
23
|
const controlSelector = '[data-slot="input-group-control"], input, textarea, [contenteditable="true"]';
|
|
38
24
|
/**
|
|
@@ -41,7 +27,7 @@ const controlSelector = '[data-slot="input-group-control"], input, textarea, [co
|
|
|
41
27
|
* in it except a button focuses the control, like a label.
|
|
42
28
|
*/
|
|
43
29
|
export function InputGroupAddon({ align, className, onClick, ...props }) {
|
|
44
|
-
const side = align ??
|
|
30
|
+
const side = align ?? 'inline-start';
|
|
45
31
|
const focusControl = (event) => {
|
|
46
32
|
onClick?.(event);
|
|
47
33
|
if (event.defaultPrevented)
|
|
@@ -50,33 +36,33 @@ export function InputGroupAddon({ align, className, onClick, ...props }) {
|
|
|
50
36
|
if (target.closest("button, a[href], [role='button'], input, textarea"))
|
|
51
37
|
return;
|
|
52
38
|
const control = event.currentTarget.parentElement?.querySelector(controlSelector);
|
|
53
|
-
if (!control || control.matches(
|
|
39
|
+
if (!control || control.matches(':disabled'))
|
|
54
40
|
return;
|
|
55
41
|
control.focus();
|
|
56
42
|
};
|
|
57
|
-
return (_jsx("div", { role: "group", "data-slot": "input-group-addon", "data-align": side, ...props, onClick: focusControl, className: cn(
|
|
43
|
+
return (_jsx("div", { role: "group", "data-slot": "input-group-addon", "data-align": side, ...props, onClick: focusControl, className: cn('sprout-input-group-addon', `sprout-input-group-addon-align-${side}`, className) }));
|
|
58
44
|
}
|
|
59
45
|
/**
|
|
60
|
-
* A compact Sprout `Button` sized to sit inside an `InputGroup` addon.
|
|
61
|
-
*
|
|
62
|
-
* submits a form by accident. Use `render` to make it a menu, popover, or
|
|
46
|
+
* A compact Sprout `Button` sized to sit inside an `InputGroup` addon. Its
|
|
47
|
+
* height follows the group, 4px in from each edge. It is `ghost` and a plain
|
|
48
|
+
* `type="button"` by default, so it never submits a form by accident. Use `render` to make it a menu, popover, or
|
|
63
49
|
* combobox trigger.
|
|
64
50
|
*/
|
|
65
|
-
export function InputGroupButton({ size, variant, type =
|
|
66
|
-
const scale = size ??
|
|
67
|
-
const kind = variant ??
|
|
68
|
-
return (_jsx(Button, { type: type, variant: kind, "data-size": scale, "data-variant": kind, ...props, className:
|
|
51
|
+
export function InputGroupButton({ size, variant, type = 'button', className, ...props }) {
|
|
52
|
+
const scale = size ?? 'md';
|
|
53
|
+
const kind = variant ?? 'ghost';
|
|
54
|
+
return (_jsx(Button, { type: type, variant: kind, "data-size": scale, "data-variant": kind, ...props, className: state => cn('sprout-input-group-button', `sprout-input-group-button-size-${scale}`, typeof className === 'function' ? className(state) : className) }));
|
|
69
55
|
}
|
|
70
56
|
/** Muted text or an icon with text inside an addon, such as a URL prefix or a unit. */
|
|
71
57
|
export function InputGroupText({ className, ...props }) {
|
|
72
|
-
return
|
|
58
|
+
return _jsx("span", { "data-slot": "input-group-text", ...props, className: cn('sprout-input-group-text', className) });
|
|
73
59
|
}
|
|
74
60
|
/**
|
|
75
61
|
* A Sprout `Input` without its own border, fill, or ring, so the group draws
|
|
76
62
|
* them. It reads a surrounding `Field` the same way `Input` does.
|
|
77
63
|
*/
|
|
78
64
|
export function InputGroupInput({ className, ...props }) {
|
|
79
|
-
return (_jsx(Input, { "data-slot": "input-group-control", ...props, className:
|
|
65
|
+
return (_jsx(Input, { "data-slot": "input-group-control", ...props, className: state => cn('sprout-input-group-input', typeof className === 'function' ? className(state) : className) }));
|
|
80
66
|
}
|
|
81
67
|
/**
|
|
82
68
|
* A Sprout `Textarea` without its own border, fill, or ring, so the group
|
|
@@ -84,5 +70,5 @@ export function InputGroupInput({ className, ...props }) {
|
|
|
84
70
|
* by hand.
|
|
85
71
|
*/
|
|
86
72
|
export function InputGroupTextarea({ className, ...props }) {
|
|
87
|
-
return (_jsx(Textarea, { variant: "embedded", "data-slot": "input-group-control", ...props, className: cn(
|
|
73
|
+
return (_jsx(Textarea, { variant: "embedded", "data-slot": "input-group-control", ...props, className: cn('sprout-input-group-textarea', className) }));
|
|
88
74
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { type ComponentProps, type ReactNode } from
|
|
2
|
-
import { OTPField } from
|
|
1
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
2
|
+
import { OTPField } from '@base-ui/react/otp-field';
|
|
3
|
+
export declare const inputOTPSizeNames: readonly ["md", "sm", "lg"];
|
|
4
|
+
export type InputOTPSize = (typeof inputOTPSizeNames)[number];
|
|
3
5
|
export type InputOTPState = OTPField.Root.State;
|
|
4
6
|
export type InputOTPSlotState = OTPField.Input.State;
|
|
5
|
-
type Invalid = boolean |
|
|
6
|
-
export interface InputOTPProps extends Omit<OTPField.Root.Props,
|
|
7
|
+
type Invalid = boolean | 'true' | 'false' | 'grammar' | 'spelling';
|
|
8
|
+
export interface InputOTPProps extends Omit<OTPField.Root.Props, 'length' | 'aria-invalid' | 'children' | 'size'> {
|
|
7
9
|
/** Number of character slots. Matches the slot indexes you render. */
|
|
8
10
|
maxLength: number;
|
|
11
|
+
/** Square slots: `sm` is 28px, `md` is 32px (`--sprout-control-height`), and `lg` is 36px. */
|
|
12
|
+
size?: InputOTPSize | null;
|
|
9
13
|
/** Called with the new code on every edit, paste, or autofill. */
|
|
10
14
|
onChange?: ((value: string) => void) | undefined;
|
|
11
15
|
/** Marks every slot invalid and draws the danger ring on its group. */
|
|
12
|
-
|
|
16
|
+
'aria-invalid'?: Invalid | undefined;
|
|
13
17
|
children?: ReactNode;
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
@@ -18,20 +22,20 @@ export interface InputOTPProps extends Omit<OTPField.Root.Props, "length" | "ari
|
|
|
18
22
|
* End, Backspace, and Delete all work. `aria-label` names the whole code and
|
|
19
23
|
* its first slot; later slots are announced as "Character 2 of 6".
|
|
20
24
|
*/
|
|
21
|
-
export declare function InputOTP({ maxLength, onChange, onValueChange, className, children,
|
|
22
|
-
export type InputOTPGroupProps = ComponentProps<
|
|
25
|
+
export declare function InputOTP({ maxLength, size, onChange, onValueChange, className, children, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-invalid': ariaInvalid, validationType, ...props }: InputOTPProps): import("react").JSX.Element;
|
|
26
|
+
export type InputOTPGroupProps = ComponentProps<'div'>;
|
|
23
27
|
/** Joins adjacent slots into one bordered segment. */
|
|
24
28
|
export declare function InputOTPGroup({ className, ...props }: InputOTPGroupProps): import("react").JSX.Element;
|
|
25
|
-
export interface InputOTPSlotProps extends Omit<OTPField.Input.Props,
|
|
29
|
+
export interface InputOTPSlotProps extends Omit<OTPField.Input.Props, 'aria-invalid'> {
|
|
26
30
|
/** Zero-based position of this slot in the code. */
|
|
27
31
|
index: number;
|
|
28
|
-
|
|
32
|
+
'aria-invalid'?: Invalid | undefined;
|
|
29
33
|
}
|
|
30
34
|
/**
|
|
31
35
|
* One character of the code. Render slots in index order; Base UI tracks
|
|
32
36
|
* focus and value by their DOM order.
|
|
33
37
|
*/
|
|
34
|
-
export declare function InputOTPSlot({ index, className,
|
|
38
|
+
export declare function InputOTPSlot({ index, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-invalid': ariaInvalid, ...props }: InputOTPSlotProps): import("react").JSX.Element;
|
|
35
39
|
export type InputOTPSeparatorProps = ComponentProps<typeof OTPField.Separator>;
|
|
36
40
|
/** A dash between slot groups, such as `123–456`. */
|
|
37
41
|
export declare function InputOTPSeparator({ className, children, ...props }: InputOTPSeparatorProps): import("react").JSX.Element;
|