@epam/ai-dial-conversation-input 1.2.0-dev.3 → 1.2.0-dev.300
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/components/AddAttachmentButton/AddAttachmentButton.d.ts +6 -0
- package/components/AddAttachmentButton/AddAttachmentButton.d.ts.map +1 -1
- package/components/BottomSheetShell/BottomSheetShell.d.ts +2 -2
- package/components/BottomSheetShell/BottomSheetShell.d.ts.map +1 -1
- package/components/ChatSettingsModal/ChatSettingsModal.d.ts.map +1 -1
- package/components/ConversationInput/ConversationInput.d.ts.map +1 -1
- package/components/EditMessageInput/EditMessageInput.d.ts.map +1 -1
- package/components/Input/Buttons/SendButton.d.ts +2 -0
- package/components/Input/Buttons/SendButton.d.ts.map +1 -1
- package/components/Input/Input.d.ts +2 -3
- package/components/Input/Input.d.ts.map +1 -1
- package/components/Input/ModelSelectorControl.d.ts +3 -1
- package/components/Input/ModelSelectorControl.d.ts.map +1 -1
- package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts +3 -0
- package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts.map +1 -1
- package/components/ToolsChips/ToolsChips.d.ts +11 -0
- package/components/ToolsChips/ToolsChips.d.ts.map +1 -1
- package/components/VoiceBar/VoiceBar.d.ts +1 -3
- package/components/VoiceBar/VoiceBar.d.ts.map +1 -1
- package/constants/public-class-names.d.ts +41 -0
- package/constants/public-class-names.d.ts.map +1 -0
- package/hooks/useAttachments.d.ts +8 -1
- package/hooks/useAttachments.d.ts.map +1 -1
- package/hooks/useCommandMenu/useCommandMenu.d.ts +35 -5
- package/hooks/useCommandMenu/useCommandMenu.d.ts.map +1 -1
- package/hooks/useComposerSeed.d.ts +32 -0
- package/hooks/useComposerSeed.d.ts.map +1 -0
- package/hooks/useMentionSelectionMirror.d.ts +22 -0
- package/hooks/useMentionSelectionMirror.d.ts.map +1 -0
- package/hooks/useModelSelector.d.ts +7 -13
- package/hooks/useModelSelector.d.ts.map +1 -1
- package/hooks/useTextInsertion.d.ts +25 -3
- package/hooks/useTextInsertion.d.ts.map +1 -1
- package/hooks/useVoiceRecorder.d.ts.map +1 -1
- package/index.css +2 -2
- package/index.d.ts +5 -2
- package/index.d.ts.map +1 -1
- package/index.js +1606 -1301
- package/models/ConversationInput.d.ts +115 -18
- package/models/ConversationInput.d.ts.map +1 -1
- package/models/Input.d.ts +219 -34
- package/models/Input.d.ts.map +1 -1
- package/package.json +4 -5
- package/utils/highlight-mirror.d.ts +17 -0
- package/utils/highlight-mirror.d.ts.map +1 -0
- package/hooks/useBottomSheet.d.ts +0 -9
- package/hooks/useBottomSheet.d.ts.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { AttachmentTrayStyles } from '@epam/ai-dial-attachment-input';
|
|
1
2
|
import { Attachment, AttachmentErrorReason, DeploymentItem, DisplayAttachment, ToolMenuItem, UploadedAttachmentResult } from '@epam/ai-dial-chat-shared';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
|
-
import { ChatSettingsConfig, CommandMenuConfig, InputColors, InputTypography, MenuOverlayConfig, ModelSelectorLabels, SendOnEnter, TextInsertion, ToolsChipLabels } from './Input';
|
|
4
|
+
import { ActionRowLayout, ChatSettingsConfig, CommandMenuConfig, HighlightedTextRange, InputColors, InputTypography, MenuOverlayConfig, ModelMenuStyles, ModelSelectorLabels, SendOnEnter, TextInsertion, ToolsChipLabels } from './Input';
|
|
4
5
|
import { TranscribeAudio } from './Voice';
|
|
5
6
|
/** CSS custom-property overrides for the `ConversationInput` component. */
|
|
6
7
|
export interface ConversationInputColors {
|
|
@@ -26,23 +27,71 @@ export interface ConversationInputStyles {
|
|
|
26
27
|
colors?: ConversationInputColors;
|
|
27
28
|
/** Typography overrides for the welcome heading and input. */
|
|
28
29
|
typography?: ConversationInputTypography;
|
|
30
|
+
/**
|
|
31
|
+
* Style overrides for the composer's attachment tray. Its `card` slot
|
|
32
|
+
* carries `AttachmentCardStyles` through to every tile, which is how a host
|
|
33
|
+
* sizes a tile or restyles its meta line without a descendant selector on
|
|
34
|
+
* `ATTACHMENT_INPUT_CLASS`.
|
|
35
|
+
*/
|
|
36
|
+
attachmentTray?: AttachmentTrayStyles;
|
|
37
|
+
/**
|
|
38
|
+
* Styling hooks for the model menu in both presentations — the desktop
|
|
39
|
+
* dropdown and the mobile sheet — so a host restyles its panel, search row
|
|
40
|
+
* and selected row without a descendant selector on
|
|
41
|
+
* `CONVERSATION_INPUT_CLASS.modelMenu*`.
|
|
42
|
+
*/
|
|
43
|
+
modelMenu?: ModelMenuStyles;
|
|
29
44
|
}
|
|
30
45
|
/** Props accepted by the `EditMessageInput` component. */
|
|
31
46
|
export interface EditMessageInputProps {
|
|
32
47
|
/** Initial message text pre-populated in the textarea. */
|
|
33
48
|
message?: string;
|
|
34
49
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
50
|
+
* Optional token that forces the textarea to resync from `message`, even
|
|
51
|
+
* when `message` itself is the same string as before (e.g. the host
|
|
52
|
+
* spliced a mention into its own copy of the draft at a known position and
|
|
53
|
+
* needs the textarea to adopt it). Forwarded to the inner `Input`.
|
|
54
|
+
*/
|
|
55
|
+
messageRevision?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Called with the textarea's current value on every change (typing,
|
|
58
|
+
* deleting, pasting, undo/redo) — not only on save. A host tracking live
|
|
59
|
+
* state derived from the draft (e.g. skill-mention anchors that must
|
|
60
|
+
* reconcile as the user edits around them) wires this; omit it to ignore
|
|
61
|
+
* keystrokes between saves.
|
|
38
62
|
*/
|
|
39
|
-
|
|
63
|
+
onChange?: (message: string) => void;
|
|
40
64
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
65
|
+
* Ranges of `message` rendered as highlighted runs (e.g. a restored skill
|
|
66
|
+
* mention). Forwarded to the inner `Input`.
|
|
67
|
+
*/
|
|
68
|
+
activeMentions?: HighlightedTextRange[];
|
|
69
|
+
/**
|
|
70
|
+
* Called on Backspace with the caret collapsed at some position, to ask
|
|
71
|
+
* whether a tracked range ends exactly there — see `Input`'s prop of the
|
|
72
|
+
* same name. Forwarded to the inner `Input`.
|
|
73
|
+
*/
|
|
74
|
+
onBackspaceAtCaret?: (caretPosition: number) => HighlightedTextRange | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* One-shot caret placement applied whenever the internal message resyncs
|
|
77
|
+
* from a new `message` value (e.g. right after inserting a mention).
|
|
43
78
|
* Forwarded to the inner `Input`.
|
|
44
79
|
*/
|
|
45
|
-
|
|
80
|
+
caretPositionOverride?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Host-injected slash-command menu, forwarded to the inner `Input` — see
|
|
83
|
+
* `Input`'s prop of the same name. Absent disables the mechanism during
|
|
84
|
+
* edit.
|
|
85
|
+
*/
|
|
86
|
+
commandMenu?: CommandMenuConfig;
|
|
87
|
+
/**
|
|
88
|
+
* Host-injected overlay entries for the `+` menu. `EditMessageInput` hides
|
|
89
|
+
* the inner `Input`'s own footer (`hideActionBar`) and renders its own
|
|
90
|
+
* external `AddAttachmentButton` instead, so these entries are forwarded to
|
|
91
|
+
* that button, not to `Input`. Absent renders no add-menu overlay entries
|
|
92
|
+
* during edit.
|
|
93
|
+
*/
|
|
94
|
+
menuOverlays?: MenuOverlayConfig[];
|
|
46
95
|
/** Pre-existing attachments from the original message, shown in the attachment tray. */
|
|
47
96
|
initialAttachments?: DisplayAttachment[];
|
|
48
97
|
/** Called when the user clicks the Cancel button. */
|
|
@@ -63,6 +112,10 @@ export interface EditMessageInputProps {
|
|
|
63
112
|
retryLabel?: string;
|
|
64
113
|
/** Accessible label for each attachment card's in-progress upload progress bar. Defaults to `'Uploading'`. */
|
|
65
114
|
uploadingLabel?: string;
|
|
115
|
+
/** Accessible name of each pasted-text attachment card, which expands its text back into the composer when activated. Defaults to `'Expand pasted text'`. */
|
|
116
|
+
expandLabel?: string;
|
|
117
|
+
/** Accessible name of each non-pasted attachment card when `onAttachmentClick` makes it interactive. Name it after what the host handler does (e.g. opening the attachment in a canvas). When omitted, the card default applies (`'Open attachment'` on image tiles, `'Download attachment'` on file and link tiles). Pasted-text cards keep `expandLabel`. */
|
|
118
|
+
clickLabel?: string;
|
|
66
119
|
/** Accessible label for the add-menu trigger button. */
|
|
67
120
|
addMenuTitle?: string;
|
|
68
121
|
/** Label for the attach-file menu item. */
|
|
@@ -149,8 +202,25 @@ export interface EditMessageInputProps {
|
|
|
149
202
|
}
|
|
150
203
|
/** Props accepted by the `ConversationInput` component. */
|
|
151
204
|
export interface ConversationInputProps {
|
|
205
|
+
/** Changing this token requests textarea focus without altering its value or caret. */
|
|
206
|
+
focusRequestId?: number;
|
|
152
207
|
/** Placeholder text shown inside the textarea when empty. */
|
|
153
208
|
placeholder?: string;
|
|
209
|
+
/**
|
|
210
|
+
* How the action row arranges the textarea and the controls around it.
|
|
211
|
+
* Defaults to `ActionRowLayout.Stacked`. `ActionRowLayout.Inline` applies
|
|
212
|
+
* from the desktop breakpoint (1280px) up, unless
|
|
213
|
+
* `isInlineActionRowAllowedBelowDesktop` opts the narrower widths in.
|
|
214
|
+
*/
|
|
215
|
+
actionRowLayout?: ActionRowLayout;
|
|
216
|
+
/**
|
|
217
|
+
* When `true`, `ActionRowLayout.Inline` also applies below the desktop
|
|
218
|
+
* breakpoint (1280px). Set it when the embedded composer is wide enough
|
|
219
|
+
* there — a phone-width one is not. Affects the action row alone: the add
|
|
220
|
+
* menu and model picker keep their bottom-sheet presentation. Defaults to
|
|
221
|
+
* `false`.
|
|
222
|
+
*/
|
|
223
|
+
isInlineActionRowAllowedBelowDesktop?: boolean;
|
|
154
224
|
/**
|
|
155
225
|
* Message value. Sets the initial textarea content on mount and syncs the
|
|
156
226
|
* textarea whenever the value changes.
|
|
@@ -161,6 +231,14 @@ export interface ConversationInputProps {
|
|
|
161
231
|
* when `message` itself is the same string as before.
|
|
162
232
|
*/
|
|
163
233
|
messageRevision?: number;
|
|
234
|
+
/**
|
|
235
|
+
* Called with the textarea's current value on every change (typing,
|
|
236
|
+
* deleting, pasting, undo/redo) — not only on send. A host tracking live
|
|
237
|
+
* state derived from the draft (e.g. skill-mention anchors that must
|
|
238
|
+
* reconcile as the user edits around them) wires this; omit it to ignore
|
|
239
|
+
* keystrokes between sends, as before this prop existed.
|
|
240
|
+
*/
|
|
241
|
+
onChange?: (message: string) => void;
|
|
164
242
|
/**
|
|
165
243
|
* Text inserted at the caret each time its `revision` changes, leaving the
|
|
166
244
|
* surrounding draft intact. Unlike `message`, this never replaces what the
|
|
@@ -172,6 +250,8 @@ export interface ConversationInputProps {
|
|
|
172
250
|
welcomeText?: string;
|
|
173
251
|
/** Optional description text rendered below the welcome heading. Ignored when `welcomeText` is absent. */
|
|
174
252
|
descriptionText?: string;
|
|
253
|
+
/** Slot rendered between the welcome heading and the input, e.g. conversation starters. */
|
|
254
|
+
belowWelcomeSlot?: ReactNode;
|
|
175
255
|
/** Called when the user submits a message (Enter or send button). Receives the current local attachments as the second argument. */
|
|
176
256
|
onSend?: (message: string, attachments: Attachment[]) => void;
|
|
177
257
|
/** Called immediately after an attachment is added. Returns the uploaded attachment URL and stored name. */
|
|
@@ -219,7 +299,9 @@ export interface ConversationInputProps {
|
|
|
219
299
|
/** Accessible label for the send button. */
|
|
220
300
|
sendLabel?: string;
|
|
221
301
|
/** Tooltip shown on hover over the send button. */
|
|
222
|
-
|
|
302
|
+
sendTooltip?: string;
|
|
303
|
+
/** Tooltip for an empty composer (no text, attachments, or inline-start slot). Defaults to sendTooltip. */
|
|
304
|
+
emptyMessageTooltip?: string;
|
|
223
305
|
/** Accessible label for the stop button. */
|
|
224
306
|
stopLabel?: string;
|
|
225
307
|
/** Accessible label for each attachment card's remove button. Defaults to `'Remove attachment'`. */
|
|
@@ -228,7 +310,17 @@ export interface ConversationInputProps {
|
|
|
228
310
|
retryLabel?: string;
|
|
229
311
|
/** Accessible label for each attachment card's in-progress upload progress bar. Defaults to `'Uploading'`. */
|
|
230
312
|
uploadingLabel?: string;
|
|
231
|
-
/**
|
|
313
|
+
/** Accessible name of each pasted-text attachment card, which expands its text back into the composer when activated. Defaults to `'Expand pasted text'`. */
|
|
314
|
+
expandLabel?: string;
|
|
315
|
+
/** Accessible name of each non-pasted attachment card when `onAttachmentClick` makes it interactive. Name it after what the host handler does (e.g. opening the attachment in a canvas). When omitted, the card default applies (`'Open attachment'` on image tiles, `'Download attachment'` on file and link tiles). Pasted-text cards keep `expandLabel`. */
|
|
316
|
+
clickLabel?: string;
|
|
317
|
+
/**
|
|
318
|
+
* When `true`, blocks typing, the attach menu, dictation, Enter-to-send,
|
|
319
|
+
* and dropped files (`pendingDropFiles` are consumed and discarded, never
|
|
320
|
+
* added to the tray). The send button still submits a message that is
|
|
321
|
+
* already populated (e.g. by a starter). Starter/action buttons and the
|
|
322
|
+
* model selector remain usable. Defaults to `false`.
|
|
323
|
+
*/
|
|
232
324
|
isInputDisabled?: boolean;
|
|
233
325
|
/**
|
|
234
326
|
* When `true`, the model selector renders in a disabled, non-interactive
|
|
@@ -379,17 +471,22 @@ export interface ConversationInputProps {
|
|
|
379
471
|
*/
|
|
380
472
|
menuOverlays?: MenuOverlayConfig[];
|
|
381
473
|
/**
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
* below. Forwarded to the inner `Input`.
|
|
474
|
+
* Ranges of `message` rendered as highlighted runs (e.g. a tracked skill
|
|
475
|
+
* mention). Forwarded to the inner `Input`.
|
|
385
476
|
*/
|
|
386
|
-
|
|
477
|
+
activeMentions?: HighlightedTextRange[];
|
|
387
478
|
/**
|
|
388
|
-
* Called
|
|
389
|
-
*
|
|
390
|
-
* to the inner `Input`.
|
|
479
|
+
* Called on Backspace with the caret collapsed at some position, to ask
|
|
480
|
+
* whether a tracked range ends exactly there — see `Input`'s prop of the
|
|
481
|
+
* same name. Forwarded to the inner `Input`.
|
|
482
|
+
*/
|
|
483
|
+
onBackspaceAtCaret?: (caretPosition: number) => HighlightedTextRange | undefined;
|
|
484
|
+
/**
|
|
485
|
+
* One-shot caret placement applied whenever the internal message resyncs
|
|
486
|
+
* from a new `message` value (e.g. right after inserting a mention).
|
|
487
|
+
* Forwarded to the inner `Input`.
|
|
391
488
|
*/
|
|
392
|
-
|
|
489
|
+
caretPositionOverride?: number;
|
|
393
490
|
/**
|
|
394
491
|
* Host-injected slash-command menu: typing `triggerPrefix` as the first
|
|
395
492
|
* character of an empty textarea — or pasting into an empty textarea a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationInput.d.ts","sourceRoot":"","sources":["../../src/models/ConversationInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,eAAe,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,2EAA2E;AAC3E,MAAM,WAAW,uBAAuB;IACtC,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,kEAAkE;AAClE,MAAM,WAAW,2BAA2B;IAC1C,qGAAqG;IACrG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4GAA4G;IAC5G,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qEAAqE;IACrE,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAED,qFAAqF;AACrF,MAAM,WAAW,uBAAuB;IACtC,wDAAwD;IACxD,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,8DAA8D;IAC9D,UAAU,CAAC,EAAE,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"ConversationInput.d.ts","sourceRoot":"","sources":["../../src/models/ConversationInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EACV,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,eAAe,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,2EAA2E;AAC3E,MAAM,WAAW,uBAAuB;IACtC,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,kEAAkE;AAClE,MAAM,WAAW,2BAA2B;IAC1C,qGAAqG;IACrG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4GAA4G;IAC5G,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qEAAqE;IACrE,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAED,qFAAqF;AACrF,MAAM,WAAW,uBAAuB;IACtC,wDAAwD;IACxD,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,8DAA8D;IAC9D,UAAU,CAAC,EAAE,2BAA2B,CAAC;IACzC;;;;;OAKG;IACH,cAAc,C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AAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,4IAA4I;IAC5I,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1D"}
|
package/models/Input.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AttachmentTrayStyles } from '@epam/ai-dial-attachment-input';
|
|
1
2
|
import { Attachment, AttachmentErrorReason, DeploymentFeatures, DeploymentItem, DisplayAttachment, ResponseFormat, ToolMenuItem, UploadedAttachmentResult } from '@epam/ai-dial-chat-shared';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
4
|
import { TranscribeAudio } from './Voice';
|
|
@@ -8,6 +9,13 @@ export declare enum SendOnEnter {
|
|
|
8
9
|
/** ⌘+Enter (macOS) / Ctrl+Enter (Windows/Linux) submits; bare Enter inserts a newline. */
|
|
9
10
|
MetaEnter = "meta-enter"
|
|
10
11
|
}
|
|
12
|
+
/** Controls how the `Input` component arranges the textarea and the controls around it. */
|
|
13
|
+
export declare enum ActionRowLayout {
|
|
14
|
+
/** Textarea occupies its own line; the add button, tool chips, and footer actions wrap below it. */
|
|
15
|
+
Stacked = "stacked",
|
|
16
|
+
/** Add button, textarea, and footer actions share one line; tool chips move to their own row above. Applies below the desktop breakpoint only when the host opts in. */
|
|
17
|
+
Inline = "inline"
|
|
18
|
+
}
|
|
11
19
|
/** CSS custom-property overrides for the `Input` component. */
|
|
12
20
|
export interface InputColors {
|
|
13
21
|
/** Input area background color. */
|
|
@@ -32,12 +40,18 @@ export interface InputColors {
|
|
|
32
40
|
modelSelectorName?: string;
|
|
33
41
|
/** Model-selector chip version text color (desktop only). Defaults to `--text-secondary`. */
|
|
34
42
|
modelSelectorVersion?: string;
|
|
35
|
-
/** Voice bar
|
|
36
|
-
voiceError?: string;
|
|
37
|
-
/** Voice bar waveform and timer text color. Defaults to `--text-primary`. */
|
|
43
|
+
/** Voice bar waveform color. Defaults to `--text-primary`. */
|
|
38
44
|
voiceWaveform?: string;
|
|
39
|
-
/** Voice bar
|
|
45
|
+
/** Voice bar recording-dot color. Defaults to `--text-error`. */
|
|
40
46
|
voiceAccent?: string;
|
|
47
|
+
/** Background color of a tracked skill mention's highlighted run. Defaults to `--bg-control-accent-alpha`. */
|
|
48
|
+
mentionHighlightBg?: string;
|
|
49
|
+
/** Text color of a tracked skill mention's highlighted run. Defaults to `--text-accent`. */
|
|
50
|
+
mentionHighlightText?: string;
|
|
51
|
+
/** Background color of a tracked skill mention's highlighted run while unsupported. Defaults to `--bg-error`. */
|
|
52
|
+
mentionHighlightUnsupportedBg?: string;
|
|
53
|
+
/** Text color of a tracked skill mention's highlighted run while unsupported. Defaults to `--text-error`. */
|
|
54
|
+
mentionHighlightUnsupportedText?: string;
|
|
41
55
|
}
|
|
42
56
|
/** Typography overrides for the `Input` component. */
|
|
43
57
|
export interface InputTypography {
|
|
@@ -61,10 +75,51 @@ export interface ModelSelectorLabels {
|
|
|
61
75
|
/** Tooltip shown when the selected deployment is no longer available (e.g. removed from the catalog). Defaults to `'This deployment is no longer available'`. */
|
|
62
76
|
unavailableTooltip?: string;
|
|
63
77
|
}
|
|
78
|
+
/** Color overrides for the model menu, applied as CSS custom properties. */
|
|
79
|
+
export interface ModelMenuColors {
|
|
80
|
+
/**
|
|
81
|
+
* Background of the search row above the deployment list. Defaults to
|
|
82
|
+
* `--bg-layer-raised` in the desktop dropdown, where the row is sticky over
|
|
83
|
+
* scrolling items, and to transparent in the mobile sheet.
|
|
84
|
+
*/
|
|
85
|
+
searchHeaderBackground?: string;
|
|
86
|
+
/** Label and icon color of every deployment row. Defaults to `--text-primary`. */
|
|
87
|
+
itemText?: string;
|
|
88
|
+
/** Background of a hovered deployment row. Defaults to `--bg-control-accent-alpha-hover` on desktop and `--bg-layer-raised` in the sheet. */
|
|
89
|
+
itemHoverBackground?: string;
|
|
90
|
+
/** Background of the selected deployment row at rest. Defaults to none. */
|
|
91
|
+
selectedItemBackground?: string;
|
|
92
|
+
/** Label color of the selected deployment row. Defaults to `itemText`. */
|
|
93
|
+
selectedItemText?: string;
|
|
94
|
+
/** Color of the check mark on the selected row. Defaults to the row's text color on desktop and `--text-accent` in the sheet. */
|
|
95
|
+
checkIcon?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Styling hooks for the model menu, applied in both presentations: the desktop
|
|
99
|
+
* dropdown and the mobile bottom sheet. Every class is merged after the
|
|
100
|
+
* component's own, so a conflicting utility replaces the default rather than
|
|
101
|
+
* landing beside it.
|
|
102
|
+
*/
|
|
103
|
+
export interface ModelMenuStyles {
|
|
104
|
+
/** Class on the menu panel: the dropdown overlay on desktop, the sheet on mobile. Also applied when `modelPickerOverlay` supplies the content. */
|
|
105
|
+
className?: string;
|
|
106
|
+
/** Class on the search row above the deployment list. */
|
|
107
|
+
searchHeaderClassName?: string;
|
|
108
|
+
/** Class on every deployment row. */
|
|
109
|
+
itemClassName?: string;
|
|
110
|
+
/** Class on the currently selected deployment row, additive to `itemClassName`. */
|
|
111
|
+
selectedItemClassName?: string;
|
|
112
|
+
/** Color overrides applied as CSS custom properties. */
|
|
113
|
+
colors?: ModelMenuColors;
|
|
114
|
+
}
|
|
64
115
|
/** Labels for the tool chips rendered in the conversation input. */
|
|
65
116
|
export interface ToolsChipLabels {
|
|
66
117
|
/** Returns the accessible label for a chip's × button, which drops the tool from the input. Receives the tool label. Defaults to `"Remove {toolLabel}"`. */
|
|
67
118
|
removeLabel?: (toolLabel: string) => string;
|
|
119
|
+
/** Visible state text shown after the tool label while the tool is on, e.g. `"ON"`. Renders only when `stateOffLabel` is also set. */
|
|
120
|
+
stateOnLabel?: string;
|
|
121
|
+
/** Visible state text shown after the tool label while the tool is off, e.g. `"OFF"`. Renders only when `stateOnLabel` is also set. */
|
|
122
|
+
stateOffLabel?: string;
|
|
68
123
|
}
|
|
69
124
|
/** A host-injected overlay entry for the `+` menu: a menu item whose submenu renders host-owned content. */
|
|
70
125
|
export interface MenuOverlayConfig {
|
|
@@ -74,8 +129,18 @@ export interface MenuOverlayConfig {
|
|
|
74
129
|
title: string;
|
|
75
130
|
/** Icon node rendered to the left of the menu-item label. */
|
|
76
131
|
icon: ReactNode;
|
|
77
|
-
/**
|
|
78
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Renders the overlay panel content. Receives a callback the panel calls to
|
|
134
|
+
* close the whole menu once selection is complete, and the textarea's
|
|
135
|
+
* caret offset at the moment the overlay opened (0 when it cannot be
|
|
136
|
+
* determined) — e.g. so a selection made here can splice text in at that
|
|
137
|
+
* exact position via `message`/`messageRevision`/`caretPositionOverride`.
|
|
138
|
+
* The content is mounted inside a `role="menu"` container — the desktop
|
|
139
|
+
* submenu panel or the mobile sheet's wrapper — so selectable rows should
|
|
140
|
+
* be `role="menuitem"`: those are the rows the desktop submenu's
|
|
141
|
+
* ArrowUp/ArrowDown/Home/End navigation moves between.
|
|
142
|
+
*/
|
|
143
|
+
renderOverlay: (onClose: () => void, caretPosition: number) => ReactNode;
|
|
79
144
|
/** Accessible label for the back arrow in the mobile stacked bottom sheet. Defaults to `'Back'`. */
|
|
80
145
|
backLabel?: string;
|
|
81
146
|
}
|
|
@@ -83,18 +148,44 @@ export interface MenuOverlayConfig {
|
|
|
83
148
|
export interface CommandMenuContext {
|
|
84
149
|
/** Current query: the value typed after the trigger prefix, with no whitespace or second prefix character. */
|
|
85
150
|
query: string;
|
|
151
|
+
/** Character offset where the triggering word (prefix + query) starts in the textarea's current value. */
|
|
152
|
+
caretPosition: number;
|
|
86
153
|
/**
|
|
87
|
-
* Closes the menu.
|
|
88
|
-
* prefix and query from the textarea
|
|
89
|
-
*
|
|
154
|
+
* Closes the menu. `{ consumeQuery: true }` also removes the trigger
|
|
155
|
+
* prefix and query from the textarea; `{ returnFocus: false }` skips
|
|
156
|
+
* refocusing the textarea (see the host's own doc for when to use it).
|
|
90
157
|
*/
|
|
91
158
|
close: (options?: {
|
|
92
159
|
consumeQuery?: boolean;
|
|
160
|
+
returnFocus?: boolean;
|
|
93
161
|
}) => void;
|
|
162
|
+
/**
|
|
163
|
+
* Id the menu puts on its `role="listbox"` element. The textarea references
|
|
164
|
+
* it through `aria-controls` while the menu is open.
|
|
165
|
+
*/
|
|
166
|
+
listboxId: string;
|
|
167
|
+
/**
|
|
168
|
+
* Id of the option the keyboard currently has active, or `null` when none
|
|
169
|
+
* is. The textarea moves it through the menu's `role="option"` elements
|
|
170
|
+
* with ArrowDown/ArrowUp (wrapping at the ends) and exposes it through
|
|
171
|
+
* `aria-activedescendant`; the menu marks the matching option with
|
|
172
|
+
* `aria-selected="true"` and a visible highlight. Enter clicks the active
|
|
173
|
+
* option, so an option's `onClick` is its selection path for mouse and
|
|
174
|
+
* keyboard alike. Options must carry unique `id`s; one with
|
|
175
|
+
* `aria-disabled="true"` is skipped. Reset whenever the query changes.
|
|
176
|
+
*/
|
|
177
|
+
activeOptionId: string | null;
|
|
94
178
|
}
|
|
95
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* Host-injected slash-command menu: an overlay opened by entering a trigger
|
|
181
|
+
* prefix as its own word anywhere in the textarea. While it is open the
|
|
182
|
+
* textarea drives it as a list autocomplete: ArrowDown/ArrowUp move the
|
|
183
|
+
* active option (instead of navigating message history), Enter takes the
|
|
184
|
+
* active option and never sends the message, and Escape closes the menu
|
|
185
|
+
* keeping the text.
|
|
186
|
+
*/
|
|
96
187
|
export interface CommandMenuConfig {
|
|
97
|
-
/** Prefix that opens the menu when
|
|
188
|
+
/** Prefix that opens the menu when it starts a whitespace-delimited word (e.g. `'/'`) — typed as the word's first character, or arriving in a paste that produces such a word. */
|
|
98
189
|
triggerPrefix: string;
|
|
99
190
|
/** Renders the menu content for the current query. */
|
|
100
191
|
renderMenu: (ctx: CommandMenuContext) => ReactNode;
|
|
@@ -107,6 +198,35 @@ export interface CommandMenuConfig {
|
|
|
107
198
|
/** Accessible name for the menu region. When absent, the content is rendered without a labeled wrapper. */
|
|
108
199
|
menuLabel?: string;
|
|
109
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* A range within `Input`'s current `message` text, rendered as a highlighted
|
|
203
|
+
* run (e.g. a skill mention's `/{name}` text). Positional only — beyond
|
|
204
|
+
* placement, `Input` attaches no meaning to what a range represents.
|
|
205
|
+
*/
|
|
206
|
+
export interface HighlightedTextRange {
|
|
207
|
+
/** Character offset where the highlighted run starts. */
|
|
208
|
+
start: number;
|
|
209
|
+
/** Length of the highlighted run. */
|
|
210
|
+
length: number;
|
|
211
|
+
/**
|
|
212
|
+
* Renders the run in its error styling instead of the default highlight
|
|
213
|
+
* (e.g. a skill mention selected on a deployment that doesn't support
|
|
214
|
+
* skills). Ignored when `render` is provided — the renderer owns its own
|
|
215
|
+
* error styling. Defaults to `false`.
|
|
216
|
+
*/
|
|
217
|
+
isUnsupported?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Renders this range as host-owned content (e.g. `ChatSkill`, the same
|
|
220
|
+
* interactive chip a sent message renders it as) instead of the default
|
|
221
|
+
* highlight span. Unlike the rest of the mirror — which duplicates the
|
|
222
|
+
* textarea's own text purely for visual highlighting and stays inert
|
|
223
|
+
* (`pointer-events: none`, `aria-hidden`) — the returned node is rendered
|
|
224
|
+
* with real pointer events and outside `aria-hidden`, so hover/focus/click
|
|
225
|
+
* (a tooltip, a "View details" action) work exactly as they do once the
|
|
226
|
+
* mention is part of sent history.
|
|
227
|
+
*/
|
|
228
|
+
render?: () => ReactNode;
|
|
229
|
+
}
|
|
110
230
|
/** One-shot text hand-off that the `Input` inserts at the caret. */
|
|
111
231
|
export interface TextInsertion {
|
|
112
232
|
/** Text inserted at the caret, replacing whatever is selected. */
|
|
@@ -114,8 +234,20 @@ export interface TextInsertion {
|
|
|
114
234
|
/** Token that performs the insertion; bump it to insert the same text again. */
|
|
115
235
|
revision: number;
|
|
116
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Imperative handle exposed by `Input` via `ref`. Lets a host that renders
|
|
239
|
+
* its own UI outside `Input` (e.g. `EditMessageInput`'s external add-menu
|
|
240
|
+
* button, which sits alongside `Input` rather than inside it) read the live
|
|
241
|
+
* caret position without owning the textarea itself.
|
|
242
|
+
*/
|
|
243
|
+
export interface InputHandle {
|
|
244
|
+
/** The textarea's current caret offset (its `selectionStart`), or the message's length when it cannot be read. */
|
|
245
|
+
getCaretPosition: () => number;
|
|
246
|
+
}
|
|
117
247
|
/** Props accepted by the `Input` component. */
|
|
118
248
|
export interface InputProps {
|
|
249
|
+
/** Changing this token requests textarea focus without altering its value or caret. */
|
|
250
|
+
focusRequestId?: number;
|
|
119
251
|
/**
|
|
120
252
|
* Message value. Sets the initial textarea content on mount and syncs the
|
|
121
253
|
* textarea whenever the value changes.
|
|
@@ -129,8 +261,9 @@ export interface InputProps {
|
|
|
129
261
|
/**
|
|
130
262
|
* Text inserted at the caret each time its `revision` changes, leaving the
|
|
131
263
|
* surrounding draft intact. Unlike `message`, this never replaces what the
|
|
132
|
-
* user has written, and
|
|
133
|
-
* the
|
|
264
|
+
* user has written, and `Ctrl`/`Cmd`+`Z` undoes it. The insert lands one
|
|
265
|
+
* microtask after the render that requests it, and leaves the caret after
|
|
266
|
+
* the inserted text.
|
|
134
267
|
*/
|
|
135
268
|
textInsertion?: TextInsertion;
|
|
136
269
|
/** Called on every keystroke with the current textarea value. */
|
|
@@ -153,6 +286,13 @@ export interface InputProps {
|
|
|
153
286
|
colors?: InputColors;
|
|
154
287
|
/** Typography overrides applied as CSS custom properties. */
|
|
155
288
|
typography?: InputTypography;
|
|
289
|
+
/**
|
|
290
|
+
* Style overrides for the attachment tray inside the composer and, through
|
|
291
|
+
* its `card` slot, for every tile in it.
|
|
292
|
+
*/
|
|
293
|
+
attachmentTray?: AttachmentTrayStyles;
|
|
294
|
+
/** Styling hooks for the model menu: its panel, search row and deployment rows. */
|
|
295
|
+
modelMenu?: ModelMenuStyles;
|
|
156
296
|
/** Label for the attach-file menu item. */
|
|
157
297
|
attachLabel?: string;
|
|
158
298
|
/**
|
|
@@ -171,10 +311,16 @@ export interface InputProps {
|
|
|
171
311
|
retryLabel?: string;
|
|
172
312
|
/** Accessible label for each attachment card's in-progress upload progress bar. Defaults to `'Uploading'`. */
|
|
173
313
|
uploadingLabel?: string;
|
|
314
|
+
/** Accessible name of each pasted-text attachment card, which expands its text back into the composer when activated. Defaults to `'Expand pasted text'`. */
|
|
315
|
+
expandLabel?: string;
|
|
316
|
+
/** Accessible name of each non-pasted attachment card when `onAttachmentClick` makes it interactive. Name it after what the host handler does (e.g. opening the attachment in a canvas). When omitted, the card default applies (`'Open attachment'` on image tiles, `'Download attachment'` on file and link tiles). Pasted-text cards keep `expandLabel`. */
|
|
317
|
+
clickLabel?: string;
|
|
174
318
|
/** Accessible label for the send button. */
|
|
175
319
|
sendLabel?: string;
|
|
176
320
|
/** Tooltip shown on hover over the send button. */
|
|
177
|
-
|
|
321
|
+
sendTooltip?: string;
|
|
322
|
+
/** Tooltip for an empty composer (no text, attachments, or inline-start slot). Defaults to sendTooltip. */
|
|
323
|
+
emptyMessageTooltip?: string;
|
|
178
324
|
/** Accessible label for the stop button. */
|
|
179
325
|
stopLabel?: string;
|
|
180
326
|
/** Extra class name(s) merged onto the root wrapper element. */
|
|
@@ -253,6 +399,21 @@ export interface InputProps {
|
|
|
253
399
|
* `EditMessageInput` where the action row lives outside the bordered box.
|
|
254
400
|
*/
|
|
255
401
|
hideActionBar?: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* How the action row arranges the textarea and the controls around it.
|
|
404
|
+
* Defaults to `ActionRowLayout.Stacked`. `ActionRowLayout.Inline` applies
|
|
405
|
+
* from the desktop breakpoint (1280px) up, unless
|
|
406
|
+
* `isInlineActionRowAllowedBelowDesktop` opts the narrower widths in.
|
|
407
|
+
*/
|
|
408
|
+
actionRowLayout?: ActionRowLayout;
|
|
409
|
+
/**
|
|
410
|
+
* When `true`, `ActionRowLayout.Inline` also applies below the desktop
|
|
411
|
+
* breakpoint (1280px). Set it when the embedded composer is wide enough
|
|
412
|
+
* there — a phone-width one is not. Affects the action row alone: the add
|
|
413
|
+
* menu and model picker keep their bottom-sheet presentation. Defaults to
|
|
414
|
+
* `false`.
|
|
415
|
+
*/
|
|
416
|
+
isInlineActionRowAllowedBelowDesktop?: boolean;
|
|
256
417
|
/**
|
|
257
418
|
* When provided, replaces the default send/stop/model-selector area with custom content.
|
|
258
419
|
* Receives `canSend` (textarea has non-empty trimmed content) and `onSend` (triggers the
|
|
@@ -262,7 +423,13 @@ export interface InputProps {
|
|
|
262
423
|
canSend: boolean;
|
|
263
424
|
onSend: () => void;
|
|
264
425
|
}) => ReactNode;
|
|
265
|
-
/**
|
|
426
|
+
/**
|
|
427
|
+
* When `true`, blocks typing, the attach menu, dictation, Enter-to-send,
|
|
428
|
+
* and dropped files (`pendingDropFiles` are consumed and discarded, never
|
|
429
|
+
* added to the tray). The send button still submits a message that is
|
|
430
|
+
* already populated (e.g. by a starter). Starter/action buttons and the
|
|
431
|
+
* model selector remain usable. Defaults to `false`.
|
|
432
|
+
*/
|
|
266
433
|
isInputDisabled?: boolean;
|
|
267
434
|
/**
|
|
268
435
|
* When `true`, the model selector renders in a disabled, non-interactive
|
|
@@ -339,21 +506,33 @@ export interface InputProps {
|
|
|
339
506
|
*/
|
|
340
507
|
menuOverlays?: MenuOverlayConfig[];
|
|
341
508
|
/**
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
509
|
+
* Ranges of `message` rendered as highlighted runs — e.g. a host-tracked
|
|
510
|
+
* skill mention's `/{name}` text. The textarea's own text is rendered
|
|
511
|
+
* transparent (its caret stays visible and normally colored) and a
|
|
512
|
+
* non-interactive mirror underneath renders the same text with each range
|
|
513
|
+
* wrapped in a highlight span, so the highlighted text stays pixel-aligned
|
|
514
|
+
* with the real, editable characters underneath it. Carries no semantic
|
|
515
|
+
* meaning to `Input` beyond where to draw a highlight. Absent (or empty)
|
|
516
|
+
* renders the text area unchanged, with normal (non-transparent) text.
|
|
517
|
+
*/
|
|
518
|
+
activeMentions?: HighlightedTextRange[];
|
|
519
|
+
/**
|
|
520
|
+
* Called on Backspace with the caret collapsed at some position, to ask the
|
|
521
|
+
* host whether a tracked range ends exactly there. Returning a range makes
|
|
522
|
+
* `Input` delete that whole range in one native edit (preserving undo)
|
|
523
|
+
* instead of the browser's default single-character deletion; returning
|
|
524
|
+
* `undefined` leaves Backspace unhandled. Absent disables the mechanism
|
|
525
|
+
* entirely (ordinary Backspace behavior).
|
|
347
526
|
*/
|
|
348
|
-
|
|
527
|
+
onBackspaceAtCaret?: (caretPosition: number) => HighlightedTextRange | undefined;
|
|
349
528
|
/**
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
529
|
+
* One-shot caret placement applied whenever `messageRevision` changes (e.g.
|
|
530
|
+
* right after the host pushes a new `message` that inserted a mention at a
|
|
531
|
+
* known position) — moves the caret there once, after the value updates.
|
|
532
|
+
* Absent leaves the caret wherever the browser puts it after the value
|
|
533
|
+
* change.
|
|
355
534
|
*/
|
|
356
|
-
|
|
535
|
+
caretPositionOverride?: number;
|
|
357
536
|
/**
|
|
358
537
|
* Host-injected slash-command menu. When provided, typing `triggerPrefix`
|
|
359
538
|
* as the first character of an empty textarea — or pasting into an empty
|
|
@@ -361,13 +540,19 @@ export interface InputProps {
|
|
|
361
540
|
* whitespace-free, prefix-free query — opens an overlay above the input;
|
|
362
541
|
* it stays open while the value keeps matching the prefix followed by a
|
|
363
542
|
* query with no whitespace or second prefix character, and closes on
|
|
364
|
-
* unmatch, Escape, or an outside click
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
543
|
+
* unmatch, Escape, or an outside click. Escape is the one dismissal that
|
|
544
|
+
* latches: the menu stays closed over that same word until the value stops
|
|
545
|
+
* matching and the trigger is typed or pasted again. An outside click only
|
|
546
|
+
* closes it for the moment — typing/deleting within the same still-matching
|
|
547
|
+
* word, or moving the caret back into it (a click, or refocusing the
|
|
548
|
+
* textarea), reopens it with no need to retype the trigger. A message can
|
|
549
|
+
* hold more than one command-shaped word at once; the menu always tracks
|
|
550
|
+
* whichever one the caret is actually in, re-evaluated on every such caret
|
|
551
|
+
* move rather than assumed from whichever word was active before. Any other
|
|
552
|
+
* pasted value, and any paste into a non-empty textarea, inserts as a
|
|
553
|
+
* regular paste and opens nothing. Selection typically goes through
|
|
554
|
+
* `ctx.close({ consumeQuery: true })`, which removes the `/query` text from
|
|
555
|
+
* the textarea. Absent disables the mechanism.
|
|
371
556
|
*/
|
|
372
557
|
commandMenu?: CommandMenuConfig;
|
|
373
558
|
/** When `true`, focuses the textarea on mount. Defaults to `false`. */
|