@epicbagel/saas-kit 1.0.0 → 1.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/README.md +72 -3
- package/THIRD_PARTY_NOTICES.md +230 -7
- package/dist/chunk-2AU7ZRGX.cjs +96 -0
- package/dist/chunk-2BTDBZYN.cjs +154 -0
- package/dist/chunk-2HV2KKOE.cjs +38 -0
- package/dist/chunk-2KFZQJH5.cjs +29 -0
- package/dist/chunk-32Q4XOTU.cjs +204 -0
- package/dist/chunk-42RTTHND.js +29 -0
- package/dist/chunk-6FC65AZQ.js +38 -0
- package/dist/chunk-B765DSRG.cjs +66 -0
- package/dist/chunk-ELPV44S6.cjs +44 -0
- package/dist/chunk-EOUO3ORO.cjs +244 -0
- package/dist/chunk-EZCKWTH7.js +204 -0
- package/dist/chunk-F366BHWH.js +116 -0
- package/dist/chunk-GFG2R5BZ.js +132 -0
- package/dist/chunk-HAC32ALJ.js +244 -0
- package/dist/chunk-INNGGLMZ.js +44 -0
- package/dist/chunk-IW4ZIXXG.js +66 -0
- package/dist/chunk-JZOBIPFC.js +96 -0
- package/dist/chunk-KADJ56AH.cjs +416 -0
- package/dist/chunk-KENBU3NV.cjs +27 -0
- package/dist/chunk-M7FYGAGO.js +416 -0
- package/dist/chunk-MHYAVXOE.js +159 -0
- package/dist/chunk-RIWLAMME.cjs +159 -0
- package/dist/chunk-SUB4BAYE.cjs +73 -0
- package/dist/chunk-THWIJG5C.js +73 -0
- package/dist/chunk-V4YWTRLD.cjs +116 -0
- package/dist/chunk-VY5U4VGV.js +27 -0
- package/dist/chunk-XABXUP6L.cjs +132 -0
- package/dist/chunk-Z45YKVAM.js +154 -0
- package/dist/primitives/action-dock.cjs +8 -0
- package/dist/primitives/action-dock.d.cts +10 -0
- package/dist/primitives/action-dock.d.ts +10 -0
- package/dist/primitives/action-dock.js +8 -0
- package/dist/primitives/attachment.cjs +25 -203
- package/dist/primitives/attachment.d.cts +1 -1
- package/dist/primitives/attachment.d.ts +1 -1
- package/dist/primitives/attachment.js +12 -190
- package/dist/primitives/badge.d.cts +1 -1
- package/dist/primitives/badge.d.ts +1 -1
- package/dist/primitives/board-view.cjs +3 -3
- package/dist/primitives/board-view.js +2 -2
- package/dist/primitives/bubble.cjs +14 -0
- package/dist/primitives/bubble.d.cts +21 -0
- package/dist/primitives/bubble.d.ts +21 -0
- package/dist/primitives/bubble.js +14 -0
- package/dist/primitives/button.d.cts +3 -3
- package/dist/primitives/button.d.ts +3 -3
- package/dist/primitives/chat.cjs +881 -0
- package/dist/primitives/chat.d.cts +345 -0
- package/dist/primitives/chat.d.ts +345 -0
- package/dist/primitives/chat.js +881 -0
- package/dist/primitives/connection.cjs +6 -6
- package/dist/primitives/connection.js +7 -7
- package/dist/primitives/file-dropzone.cjs +7 -107
- package/dist/primitives/file-dropzone.d.cts +66 -3
- package/dist/primitives/file-dropzone.d.ts +66 -3
- package/dist/primitives/file-dropzone.js +13 -113
- package/dist/primitives/input-group.cjs +21 -0
- package/dist/primitives/input-group.d.cts +20 -0
- package/dist/primitives/input-group.d.ts +20 -0
- package/dist/primitives/input-group.js +21 -0
- package/dist/primitives/item.cjs +197 -0
- package/dist/primitives/item.d.cts +28 -0
- package/dist/primitives/item.d.ts +28 -0
- package/dist/primitives/item.js +197 -0
- package/dist/primitives/lazy-markdown.cjs +10 -0
- package/dist/primitives/lazy-markdown.d.cts +20 -0
- package/dist/primitives/lazy-markdown.d.ts +20 -0
- package/dist/primitives/lazy-markdown.js +10 -0
- package/dist/primitives/markdown.cjs +17 -0
- package/dist/primitives/markdown.d.cts +32 -0
- package/dist/primitives/markdown.d.ts +32 -0
- package/dist/primitives/markdown.js +17 -0
- package/dist/primitives/marker.cjs +14 -0
- package/dist/primitives/marker.d.cts +15 -0
- package/dist/primitives/marker.d.ts +15 -0
- package/dist/primitives/marker.js +14 -0
- package/dist/primitives/message-scroller.cjs +26 -0
- package/dist/primitives/message-scroller.d.cts +16 -0
- package/dist/primitives/message-scroller.d.ts +16 -0
- package/dist/primitives/message-scroller.js +26 -0
- package/dist/primitives/message.cjs +7 -84
- package/dist/primitives/message.js +8 -85
- package/dist/primitives/resource-list.cjs +3 -3
- package/dist/primitives/resource-list.js +2 -2
- package/dist/primitives/rich-text.cjs +3 -38
- package/dist/primitives/rich-text.js +3 -38
- package/dist/primitives/section-header.d.cts +1 -1
- package/dist/primitives/section-header.d.ts +1 -1
- package/dist/primitives/spinner.cjs +23 -0
- package/dist/primitives/spinner.d.cts +6 -0
- package/dist/primitives/spinner.d.ts +6 -0
- package/dist/primitives/spinner.js +23 -0
- package/dist/primitives/suggestion.cjs +11 -0
- package/dist/primitives/suggestion.d.cts +19 -0
- package/dist/primitives/suggestion.d.ts +19 -0
- package/dist/primitives/suggestion.js +11 -0
- package/dist/primitives/switch-field.cjs +2 -2
- package/dist/primitives/switch-field.js +3 -3
- package/dist/primitives/textarea.cjs +4 -33
- package/dist/primitives/textarea.js +3 -32
- package/dist/primitives/toggle-group.d.cts +2 -2
- package/dist/primitives/toggle-group.d.ts +2 -2
- package/dist/primitives/toggle.d.cts +2 -2
- package/dist/primitives/toggle.d.ts +2 -2
- package/dist/primitives/trace.cjs +23 -0
- package/dist/primitives/trace.d.cts +22 -0
- package/dist/primitives/trace.d.ts +22 -0
- package/dist/primitives/trace.js +23 -0
- package/dist/primitives/voice-dictation-button.cjs +5 -239
- package/dist/primitives/voice-dictation-button.js +4 -238
- package/package.json +125 -2
- package/src/styles/components/bubble.css +81 -0
- package/src/styles/components/marker.css +27 -0
- package/src/styles/components/message-scroller.css +11 -0
- package/src/styles/components.css +3 -0
- package/src/styles/utilities.css +3 -2
- package/dist/{chunk-UGF2K6NR.js → chunk-HRLP4BHJ.js} +6 -6
- package/dist/{chunk-RWWOFWLP.cjs → chunk-IH3COANJ.cjs} +3 -3
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { MarkdownComponents } from './markdown.js';
|
|
5
|
+
import 'react-markdown';
|
|
6
|
+
import './rich-text.js';
|
|
7
|
+
|
|
8
|
+
type ChatRole = "user" | "assistant";
|
|
9
|
+
type ChatAttachment = {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
mediaType?: string;
|
|
13
|
+
size?: number;
|
|
14
|
+
url?: string;
|
|
15
|
+
state?: "idle" | "uploading" | "processing" | "error" | "done";
|
|
16
|
+
};
|
|
17
|
+
/** What opening a file on a message does: open it (a preview, a new tab) or download it. */
|
|
18
|
+
type ChatAttachmentAction = "open" | "download";
|
|
19
|
+
type ChatMessage = {
|
|
20
|
+
/**
|
|
21
|
+
* Stable for the life of the turn. A user turn under an id the thread hasn't
|
|
22
|
+
* seen counts as just arrived and is scrolled into view, so when an
|
|
23
|
+
* optimistic turn is replaced by its stored copy, keep the optimistic id.
|
|
24
|
+
*/
|
|
25
|
+
id: string;
|
|
26
|
+
role: ChatRole;
|
|
27
|
+
/** Controls whether rich content hugs its contents or occupies the transcript width. */
|
|
28
|
+
width?: "content" | "full";
|
|
29
|
+
/** When this persisted turn was created. Enables grouped relative-time separators. */
|
|
30
|
+
createdAt?: string | number | Date;
|
|
31
|
+
/** Markdown body. Use `content` for custom rich children if you need them. */
|
|
32
|
+
text?: string;
|
|
33
|
+
/** Rich children — takes precedence over `text` for rendering. */
|
|
34
|
+
content?: ReactNode;
|
|
35
|
+
/** Files that belong to this turn. */
|
|
36
|
+
attachments?: ReadonlyArray<ChatAttachment>;
|
|
37
|
+
};
|
|
38
|
+
interface ChatThreadProps {
|
|
39
|
+
messages: ChatMessage[];
|
|
40
|
+
/** Show a running line (`pendingLabel`) at the end of the thread. */
|
|
41
|
+
pending?: boolean;
|
|
42
|
+
/** The running line while a reply is pending. Defaults to "Thinking…". */
|
|
43
|
+
pendingLabel?: string;
|
|
44
|
+
/** Accessible name of the scroll-to-latest button. Defaults to "Scroll to latest message". */
|
|
45
|
+
scrollButtonLabel?: string;
|
|
46
|
+
/** Shown on a message's file while it is still uploading. Defaults to "Uploading…". */
|
|
47
|
+
uploadingLabel?: string;
|
|
48
|
+
/** Max height for the scrollable thread. Defaults to "46vh". */
|
|
49
|
+
maxHeight?: string;
|
|
50
|
+
/** `workspace` uses a restrained central transcript with unboxed assistant turns. */
|
|
51
|
+
appearance?: "bubbles" | "workspace";
|
|
52
|
+
/** Rich content rendered as the final assistant artifact in the transcript. */
|
|
53
|
+
footer?: ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* Per-element overrides for Markdown message text (`h1`, `a`, `code`, …),
|
|
56
|
+
* such as a display treatment for document titles. Messages that pass rich
|
|
57
|
+
* `content` are unaffected.
|
|
58
|
+
*/
|
|
59
|
+
markdownComponents?: MarkdownComponents;
|
|
60
|
+
/**
|
|
61
|
+
* Makes each file on a message a control: called with the file the reader
|
|
62
|
+
* picked, to fetch it, start a download or open a preview. Without it a
|
|
63
|
+
* message's files are listed but inert. Files staged in the composer are
|
|
64
|
+
* unaffected.
|
|
65
|
+
*/
|
|
66
|
+
onOpenAttachment?: (attachment: ChatAttachment) => void;
|
|
67
|
+
/** What opening a message's file does, for its label and icon. Defaults to `"open"`. */
|
|
68
|
+
attachmentAction?: ChatAttachmentAction;
|
|
69
|
+
className?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Scrollable message thread, built on shadcn's headless `MessageScroller`
|
|
73
|
+
* (streaming-aware auto-scroll, anchored turns) + the `Message`/`Bubble`
|
|
74
|
+
* primitives. Pass `messages` + `pending`.
|
|
75
|
+
*
|
|
76
|
+
* Every row is a `MessageScrollerItem` directly under the content, which is
|
|
77
|
+
* the one live log (`role="log"`): the scroller measures, anchors and tracks
|
|
78
|
+
* only its direct children. A user turn that arrives settles near the top with
|
|
79
|
+
* the end of the previous exchange peeking above it, and a scroll-to-latest
|
|
80
|
+
* button appears whenever the reader is away from the end. Turns with a
|
|
81
|
+
* `createdAt` are grouped under relative-time markers ("2 days ago"), and a
|
|
82
|
+
* pending reply shows as a running trace line, which the log announces as it
|
|
83
|
+
* appears.
|
|
84
|
+
*/
|
|
85
|
+
declare const ChatThread: React$1.ForwardRefExoticComponent<ChatThreadProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
86
|
+
interface ChatInputProps {
|
|
87
|
+
value: string;
|
|
88
|
+
onChange: (next: string) => void;
|
|
89
|
+
onSend: (text: string, attachments?: ReadonlyArray<ChatAttachment>) => void;
|
|
90
|
+
pending?: boolean;
|
|
91
|
+
disabled?: boolean;
|
|
92
|
+
placeholder?: string;
|
|
93
|
+
/**
|
|
94
|
+
* How tall the empty textarea starts: `sm` a single line (3rem), `md` a
|
|
95
|
+
* couple of lines (4.5rem), `lg` a short paragraph (8rem). It grows with its
|
|
96
|
+
* text from there, up to 12rem, then scrolls. Defaults to `md`.
|
|
97
|
+
*/
|
|
98
|
+
size?: "sm" | "md" | "lg";
|
|
99
|
+
/** Shown on a staged file while it is still uploading. Defaults to "Uploading…". */
|
|
100
|
+
uploadingLabel?: string;
|
|
101
|
+
/** Show the inline voice dictation button. Defaults to true. */
|
|
102
|
+
voice?: boolean;
|
|
103
|
+
/** Title shown inside the voice overlay. */
|
|
104
|
+
voiceTitle?: string;
|
|
105
|
+
/** Language tag for voice dictation. */
|
|
106
|
+
voiceLang?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Label for the submit button. When set, the button renders as a labelled
|
|
109
|
+
* primary action (`{label} →`) instead of the default icon-only send — use
|
|
110
|
+
* it to name the outcome, e.g. "Propose 3 times", "Create link", "Send".
|
|
111
|
+
*/
|
|
112
|
+
submitLabel?: ReactNode;
|
|
113
|
+
/** Auto-focus the textarea on mount. */
|
|
114
|
+
autoFocus?: boolean;
|
|
115
|
+
/** Classes for the composer surface (the bordered input group). */
|
|
116
|
+
className?: string;
|
|
117
|
+
/** Imperative ref handle to focus the underlying textarea. */
|
|
118
|
+
inputRef?: React.RefObject<HTMLTextAreaElement | null>;
|
|
119
|
+
/** Files currently staged in the composer. */
|
|
120
|
+
attachments?: ReadonlyArray<ChatAttachment>;
|
|
121
|
+
/** Enables the `+` action menu and receives files selected by the user. */
|
|
122
|
+
onFilesSelected?: (files: File[]) => void | Promise<void>;
|
|
123
|
+
/** Removes a staged attachment. */
|
|
124
|
+
onRemoveAttachment?: (attachment: ChatAttachment) => void;
|
|
125
|
+
/** Native file-picker accept list. */
|
|
126
|
+
accept?: string;
|
|
127
|
+
/** Whether more than one file may be selected. Defaults to true. */
|
|
128
|
+
multiple?: boolean;
|
|
129
|
+
/** Label in the composer action menu. */
|
|
130
|
+
addFilesLabel?: string;
|
|
131
|
+
/** Visual density for the complete composer surface. */
|
|
132
|
+
appearance?: "default" | "spacious";
|
|
133
|
+
/** Quiet contextual copy between the composer controls. */
|
|
134
|
+
helperText?: ReactNode;
|
|
135
|
+
/** Privacy or visibility reassurance rendered below the composer. */
|
|
136
|
+
privacyNote?: ReactNode;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Compact text input: a form around one bordered input group, with any
|
|
140
|
+
* staged files on top, a textarea that grows with its text, then an action
|
|
141
|
+
* bar (the file menu and voice mic on the left, the submit button on the
|
|
142
|
+
* right). Always text-first; voice is a secondary affordance. Enter sends;
|
|
143
|
+
* Shift+Enter newlines, and Enter that commits an IME candidate never sends.
|
|
144
|
+
*
|
|
145
|
+
* The submit button is icon-only by default; pass `submitLabel` to name the
|
|
146
|
+
* outcome ("Propose 3 times", "Create link") — it then renders as a labelled
|
|
147
|
+
* primary action with a trailing arrow.
|
|
148
|
+
*
|
|
149
|
+
* For the "voice-first hero" empty state on mobile, the higher-level `<Chat>`
|
|
150
|
+
* primitive switches to a different layout (see VoiceHero below) — use
|
|
151
|
+
* `<Chat>` instead of composing `<ChatInput>` directly if you want
|
|
152
|
+
* device-aware default modes.
|
|
153
|
+
*/
|
|
154
|
+
declare function ChatInput({ value, onChange, onSend, pending, disabled, placeholder, size, uploadingLabel, voice, voiceTitle, voiceLang, submitLabel, autoFocus, className, inputRef, attachments, onFilesSelected, onRemoveAttachment, accept, multiple, addFilesLabel, appearance, helperText, privacyNote, }: ChatInputProps): react_jsx_runtime.JSX.Element;
|
|
155
|
+
interface ChatProps {
|
|
156
|
+
/** Conversation messages. */
|
|
157
|
+
messages: ChatMessage[];
|
|
158
|
+
/**
|
|
159
|
+
* Fired when the user submits the input (or commits voice). The composer
|
|
160
|
+
* clears at once; if the returned promise rejects, Chat puts the text back
|
|
161
|
+
* so nothing is lost, then hands the rejection to `onSendError`. Reject only
|
|
162
|
+
* when the turn wasn't stored: a rejection invites the user to send again.
|
|
163
|
+
*/
|
|
164
|
+
onSend: (text: string, attachments?: ReadonlyArray<ChatAttachment>) => void | Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Called with the reason when `onSend` rejects, after the text is back in
|
|
167
|
+
* the composer. Without it Chat reports the rejection through the global
|
|
168
|
+
* `reportError` (the console, and any monitoring listening for `error`
|
|
169
|
+
* events), so a failed send is never silent. Pass it when the app shows the
|
|
170
|
+
* failure itself, with `error`.
|
|
171
|
+
*/
|
|
172
|
+
onSendError?: (error: unknown) => void;
|
|
173
|
+
/** Whether an in-flight request is pending. Disables input and shows a running line (`pendingLabel`). */
|
|
174
|
+
pending?: boolean;
|
|
175
|
+
/** The running line while a reply is pending. Defaults to "Thinking…". */
|
|
176
|
+
pendingLabel?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Replaces the empty composer while its first message is in flight. Use for
|
|
179
|
+
* a deliberate handoff animation instead of leaving a disabled form behind.
|
|
180
|
+
*/
|
|
181
|
+
emptyPendingContent?: ReactNode;
|
|
182
|
+
/** Inline error to surface below the input. */
|
|
183
|
+
error?: string | null;
|
|
184
|
+
/** Headline shown in the empty state. None by default. */
|
|
185
|
+
emptyTitle?: ReactNode;
|
|
186
|
+
/** Subheadline shown under the headline. */
|
|
187
|
+
emptySubtitle?: ReactNode;
|
|
188
|
+
/** Optional list of suggested starter prompts. Click → sends. */
|
|
189
|
+
examplePrompts?: ReadonlyArray<string>;
|
|
190
|
+
/** Label above the example prompts. Defaults to "Try". */
|
|
191
|
+
examplePromptsLabel?: string;
|
|
192
|
+
/**
|
|
193
|
+
* `chips` (the default) wrap onto as many lines as they need; `row` is one
|
|
194
|
+
* line that scrolls sideways, for a few short prompts where height is
|
|
195
|
+
* scarce; `cards` is a two-column grid of wrapping cards for longer prompts.
|
|
196
|
+
*/
|
|
197
|
+
examplePromptsVariant?: "chips" | "row" | "cards";
|
|
198
|
+
/**
|
|
199
|
+
* Render an inline loading state (a running caption over placeholder
|
|
200
|
+
* suggestions) instead of the prompts. Use while async-fetching
|
|
201
|
+
* tailored suggestions so the user sees deliberate progress rather
|
|
202
|
+
* than placeholder copy that then swaps.
|
|
203
|
+
*/
|
|
204
|
+
examplePromptsLoading?: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Caption shown in the loading state. Pass a single string for static,
|
|
207
|
+
* an array to rotate through. Defaults to "Loading suggestions…".
|
|
208
|
+
*/
|
|
209
|
+
examplePromptsLoadingLabel?: string | ReadonlyArray<string>;
|
|
210
|
+
/** Render the empty state inline rather than as a hero block. */
|
|
211
|
+
compactEmptyState?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Force the empty-state input mode. By default, mobile devices get
|
|
214
|
+
* the voice-first hero and desktop devices get the compact text
|
|
215
|
+
* input. Pass `"text"` to always start in text mode, or `"voice"` to
|
|
216
|
+
* always start in voice-first mode.
|
|
217
|
+
*/
|
|
218
|
+
defaultMode?: "voice" | "text";
|
|
219
|
+
/** Placeholder text for the empty-state input. */
|
|
220
|
+
placeholder?: string;
|
|
221
|
+
/** Placeholder text once the conversation has started. */
|
|
222
|
+
activePlaceholder?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Label for the submit button (empty-state input). When set, the button
|
|
225
|
+
* names the outcome (`{label} →`) instead of the icon-only send — e.g.
|
|
226
|
+
* "Propose 3 times". Once the conversation is active the input reverts to
|
|
227
|
+
* the compact icon send.
|
|
228
|
+
*/
|
|
229
|
+
submitLabel?: ReactNode;
|
|
230
|
+
/** Files currently staged in the composer. */
|
|
231
|
+
attachments?: ReadonlyArray<ChatAttachment>;
|
|
232
|
+
/** Enables file selection from the composer action menu. */
|
|
233
|
+
onFilesSelected?: (files: File[]) => void | Promise<void>;
|
|
234
|
+
/** Removes a staged attachment. */
|
|
235
|
+
onRemoveAttachment?: (attachment: ChatAttachment) => void;
|
|
236
|
+
/** Native file-picker accept list. */
|
|
237
|
+
attachmentAccept?: string;
|
|
238
|
+
/** Label used for the file action in the composer menu. */
|
|
239
|
+
addFilesLabel?: string;
|
|
240
|
+
/** Shown on a file, staged or on a message, while it is still uploading. Defaults to "Uploading…". */
|
|
241
|
+
uploadingLabel?: string;
|
|
242
|
+
/** Visual treatment for both empty and active text composers. */
|
|
243
|
+
composerAppearance?: ChatInputProps["appearance"];
|
|
244
|
+
/** Quiet contextual copy inside the composer action row. */
|
|
245
|
+
composerHelperText?: ReactNode;
|
|
246
|
+
/** Privacy or visibility reassurance below the composer. */
|
|
247
|
+
composerPrivacyNote?: ReactNode;
|
|
248
|
+
/** Show a prominent file drop target before the empty-state composer. */
|
|
249
|
+
emptyFileDropzone?: boolean;
|
|
250
|
+
/** Primary copy inside the empty-state file drop target. */
|
|
251
|
+
emptyFileDropzoneLabel?: ReactNode;
|
|
252
|
+
/** Supporting file type or workflow copy inside the drop target. */
|
|
253
|
+
emptyFileDropzoneDescription?: ReactNode;
|
|
254
|
+
/**
|
|
255
|
+
* Where a dragged file can be dropped. With `onFilesSelected`, a file
|
|
256
|
+
* dragged over the conversation raises a "Drop to attach" overlay, and a
|
|
257
|
+
* drop hands every file to `onFilesSelected`, exactly as the composer's
|
|
258
|
+
* file menu does: same validation, same staged files, same errors.
|
|
259
|
+
* `"conversation"` (the default) takes drops on the whole Chat, `"page"`
|
|
260
|
+
* anywhere in the document (its overlay then covers the viewport), and
|
|
261
|
+
* `false` none. Either way a file dropped where nothing takes it never
|
|
262
|
+
* opens in the browser.
|
|
263
|
+
*/
|
|
264
|
+
fileDrop?: "conversation" | "page" | false;
|
|
265
|
+
/** The drop overlay's label. Defaults to "Drop to attach". */
|
|
266
|
+
fileDropLabel?: ReactNode;
|
|
267
|
+
/** A muted line under the overlay's label, such as the accepted types and limits. */
|
|
268
|
+
fileDropDescription?: ReactNode;
|
|
269
|
+
/** Enable voice dictation. Defaults to true. */
|
|
270
|
+
voice?: boolean;
|
|
271
|
+
/** Title shown inside the voice overlay. */
|
|
272
|
+
voiceTitle?: string;
|
|
273
|
+
/** Title shown inside the voice overlay in the active state. */
|
|
274
|
+
activeVoiceTitle?: string;
|
|
275
|
+
/** Language tag for voice dictation. */
|
|
276
|
+
voiceLang?: string;
|
|
277
|
+
/** Under the mic of the voice-first empty state. Defaults to "Tap to speak". */
|
|
278
|
+
voiceHeroLabel?: ReactNode;
|
|
279
|
+
/** The voice-first empty state's switch to the text composer. Defaults to "or type instead". */
|
|
280
|
+
voiceHeroSwitchLabel?: ReactNode;
|
|
281
|
+
/** Max height of the message thread once active. Defaults to "46vh". */
|
|
282
|
+
threadMaxHeight?: string;
|
|
283
|
+
/** Accessible name of the thread's scroll-to-latest button. Defaults to "Scroll to latest message". */
|
|
284
|
+
scrollButtonLabel?: string;
|
|
285
|
+
/** Alignment for the empty chat introduction. */
|
|
286
|
+
emptyAlign?: "start" | "center";
|
|
287
|
+
/** Optional visual above the empty chat title. */
|
|
288
|
+
emptyIcon?: ReactNode;
|
|
289
|
+
/** Supporting content shown after the empty-state composer. */
|
|
290
|
+
emptyFooter?: ReactNode;
|
|
291
|
+
/**
|
|
292
|
+
* `embedded` (the default) sits in a panel, a card or a drawer.
|
|
293
|
+
* `application` is embedded on desktop, but on a phone fills the viewport
|
|
294
|
+
* below a 4rem app header, with the composer docked at the bottom.
|
|
295
|
+
* `workspace` makes the conversation the whole surface on every screen,
|
|
296
|
+
* with a centred transcript and a bottom composer.
|
|
297
|
+
*/
|
|
298
|
+
layout?: "embedded" | "application" | "workspace";
|
|
299
|
+
/** Rich assistant artifact rendered after the message transcript. */
|
|
300
|
+
threadFooter?: ReactNode;
|
|
301
|
+
/**
|
|
302
|
+
* Per-element overrides for Markdown message text in the thread (`h1`,
|
|
303
|
+
* `a`, `code`, …), such as a display treatment for document titles.
|
|
304
|
+
*/
|
|
305
|
+
markdownComponents?: MarkdownComponents;
|
|
306
|
+
/**
|
|
307
|
+
* Makes each file on a message a control: called with the file the reader
|
|
308
|
+
* picked, to fetch it, start a download or open a preview. Without it a
|
|
309
|
+
* message's files are listed but inert.
|
|
310
|
+
*/
|
|
311
|
+
onOpenAttachment?: (attachment: ChatAttachment) => void;
|
|
312
|
+
/** What opening a message's file does, for its label and icon. Defaults to `"open"`. */
|
|
313
|
+
attachmentAction?: ChatAttachmentAction;
|
|
314
|
+
className?: string;
|
|
315
|
+
}
|
|
316
|
+
interface ChatHandle {
|
|
317
|
+
/** Focus the input. */
|
|
318
|
+
focusInput: () => void;
|
|
319
|
+
/** Clear the input value. */
|
|
320
|
+
clearInput: () => void;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* A conversational composer.
|
|
324
|
+
*
|
|
325
|
+
* **Empty state** — device-biased:
|
|
326
|
+
* - On mobile (`<md` viewport), defaults to a voice-first hero: a big
|
|
327
|
+
* tap-to-speak button and a small "or type instead" switcher.
|
|
328
|
+
* - On desktop, defaults to a compact text input with the mic as an
|
|
329
|
+
* accessory icon.
|
|
330
|
+
* - Users can switch modes via the small link.
|
|
331
|
+
* - Optional example prompts render as suggestions below the input.
|
|
332
|
+
*
|
|
333
|
+
* **Active state** (messages exist) — always the compact text input;
|
|
334
|
+
* the mic stays as an accessory icon.
|
|
335
|
+
*
|
|
336
|
+
* **Files** — with `onFilesSelected`, the composer's menu picks files and a
|
|
337
|
+
* file dragged anywhere on the conversation can be dropped (`fileDrop`);
|
|
338
|
+
* both hand the files to `onFilesSelected`, which validates and stages them.
|
|
339
|
+
*
|
|
340
|
+
* Stateless w.r.t. the conversation — pass `messages` and handle
|
|
341
|
+
* `onSend` from the parent. The input text is managed internally.
|
|
342
|
+
*/
|
|
343
|
+
declare const Chat: React$1.ForwardRefExoticComponent<ChatProps & React$1.RefAttributes<ChatHandle>>;
|
|
344
|
+
|
|
345
|
+
export { Chat, type ChatAttachment, type ChatAttachmentAction, type ChatHandle, ChatInput, type ChatInputProps, type ChatMessage, type ChatProps, type ChatRole, ChatThread, type ChatThreadProps };
|