import { type ComponentProps, type FormEvent, type RefObject } from 'react'; import { type PromptInputMention, type PromptInputMessage, type PromptInputStatus } from './prompt-input-context'; import { type PromptInputMentionItem } from './prompt-input-mention-registry'; export interface PromptInputActions { /** Focuses the input, dropping the caret at the end of the draft. */ focus: () => void; /** Clears the composer. */ clear: () => void; /** * Inserts a chip at the caret, or at the end of the draft when the editor is * not focused, followed by a trailing space. Requires `PromptInput.Editor`. */ insertMention: (item: PromptInputMentionItem, options?: { trigger?: string; }) => void; /** The current value, untrimmed. */ getValue: () => PromptInputMessage; } export interface PromptInputRootProps extends Omit, 'onSubmit'> { /** * Controlled markup string — the same dialect `onValueChange` reports and * `PromptInput.Editor` parses. Most consumers should stay uncontrolled. */ value?: string; /** * The initial markup when uncontrolled. * @defaultValue "" */ defaultValue?: string; /** * Called on every change. The first argument round-trips into `value` * losslessly, chips included. */ onValueChange?: (markup: string, details: { text: string; mentions: PromptInputMention[]; }) => void; /** * Called with the trimmed message when the prompt is submitted — Enter in the * input or a click on `PromptInput.Submit`. Call * `event.currentTarget.reset()` to clear the composer after sending. */ onSubmit?: (message: PromptInputMessage, event: FormEvent) => void; /** * Called when `PromptInput.Submit` is pressed while `status` is * `"submitted"` or `"streaming"`. */ onStop?: () => void; /** * The consumer-owned request lifecycle. Drives `PromptInput.Submit`: * `"idle"`/`"error"` show a send arrow, `"submitted"` a spinner and * `"streaming"` a stop square (both routed to `onStop`). * @defaultValue "idle" */ status?: PromptInputStatus; /** * Disables the whole composer. * @defaultValue false */ disabled?: boolean; /** * The element the frame focuses when its own padding is clicked. * `PromptInput.Textarea` and `PromptInput.Editor` register themselves here on * mount; pass a ref of your own when you render a custom input instead. * Whichever is set first wins. */ inputRef?: RefObject; /** Imperative handle. `ref` remains the `
` element. */ actionsRef?: RefObject; } export declare function PromptInputRoot({ className, value: valueProp, defaultValue, onValueChange, onSubmit, onStop, onReset, onMouseDown, status, disabled, inputRef: inputRefProp, actionsRef, children, ref, ...props }: PromptInputRootProps): import("react/jsx-runtime").JSX.Element; export declare namespace PromptInputRoot { var displayName: string; } //# sourceMappingURL=prompt-input-root.d.ts.map