import { type ComponentPropsWithoutRef, type ReactNode } from 'react'; import type React from 'react'; import { StateStore } from '@stream-io/state-store'; import { AttachmentPreview } from './AttachmentPreview'; import { type ChatOptionsProps } from './ChatOptions'; import { type UseSpeechToTextOptions } from './hooks/useSpeechToText'; import type { AIConversationController } from '../Conversation/controller/AIConversationController'; import { type AIMessageComposerStore } from './store'; export type { AIMessageComposerStore } from './store'; declare const FileInput: { ({ className, labelProps, style, ...restProps }: ComponentPropsWithoutRef<"input"> & { labelProps?: ComponentPropsWithoutRef<"label">; }): import("react/jsx-runtime").JSX.Element; WithStableId: ({ children, }: { children?: ReactNode | (({ id }: { id: string; }) => ReactNode); }) => import("react/jsx-runtime").JSX.Element; }; export declare const useAIMessageComposerContext: () => StateStore; export declare const useAttachments: () => { attachments: { file: File; id: string; meta?: Record; }[]; removeAttachment: (idOrFile: string | File) => void; updateAttachments: (idsOrAttachments: (string | AIMessageComposerStore["attachments"][number])[], update: (attachment: AIMessageComposerStore["attachments"][number]) => AIMessageComposerStore["attachments"][number]) => void; }; export declare const useText: () => { setText: (text: string) => void; text: string; }; export declare const useIsDisabled: () => { disabled: boolean | undefined; setDisabled: (disabled: boolean) => void; }; /** * How the composer arranges its parts. * * - `stacked`: one part under another, such as the text above a row of `Actions`. * - `inline`: the text and the controls side by side on one line, the controls at the end of * it as the text grows. The attachment previews keep a full-width row above them. */ export type AIMessageComposerLayout = 'stacked' | 'inline'; type AIMessageComposerProps = ComponentPropsWithoutRef<'form'> & { /** * The conversation the person writes in. The composer shows its `composer` store, and * submitting sends what the person wrote through it (`conversation.send`), unless `onSubmit` * calls `event.preventDefault()`. Meanwhile `SubmitButton` turns into a `StopButton`, and * while the person edits a message the composer says so, with a button that cancels it. */ conversation?: AIConversationController; /** * How the composer arranges its parts: one under another, or the text and the controls on * one line, which suits a composer whose only control is the send button. * * @default 'stacked' */ layout?: AIMessageComposerLayout; /** * Clears the file input named `attachments` (see `nameMapping`) after each selection, so the same * file can be selected again. * * @default true */ resetAttachmentsOnSelect?: boolean; nameMapping?: { message?: string; attachments?: string; }; /** Disables the composer. */ disabled?: boolean; }; interface AIMessageComposer { (props: AIMessageComposerProps): React.JSX.Element; FileInput: typeof FileInput; TextInput: typeof TextInput; SpeechToTextButton: typeof SpeechToTextButton; SubmitButton: typeof SubmitButton; StopButton: typeof StopButton; Actions: typeof Actions; ModelSelect: typeof ModelSelect; AttachmentPreview: typeof AttachmentPreview; ChatOptions: typeof ChatOptions; } export declare const AIMessageComposer: AIMessageComposer; /** * Where the message is written. It takes several lines and grows with them, up to a limit: * Enter sends, Shift+Enter starts a new line, and Enter while an input method is still composing * a character does neither. */ declare const TextInput: ({ onKeyDown, ...props }: ComponentPropsWithoutRef<"textarea">) => import("react/jsx-runtime").JSX.Element; declare const SpeechToTextButton: ({ options, ...restProps }: ComponentPropsWithoutRef<"button"> & { options?: UseSpeechToTextOptions; }) => import("react/jsx-runtime").JSX.Element | null; /** * Sends the message. In a composer with a `conversation`, a `StopButton` takes its place while * the agent answers. */ declare const SubmitButton: ({ active, ...restProps }: ComponentPropsWithoutRef<"button"> & { active?: boolean; }) => import("react/jsx-runtime").JSX.Element; /** * Stops a reply the agent is still writing: shown in place of the `SubmitButton` while one is. * Unlike the composer's other controls it does not follow the composer's `disabled`, since a * composer is often disabled exactly while a reply is being written, which is when it is needed. * In a composer with a `conversation` it stops the conversation's reply, unless `onClick` calls * `event.preventDefault()`. */ declare const StopButton: ({ children, onClick, ...restProps }: ComponentPropsWithoutRef<"button">) => import("react/jsx-runtime").JSX.Element; /** * A row for the composer's controls, such as the file picker, dictation and the send button, * lined up at its end. In the `stacked` layout it goes under the text. */ declare const Actions: ({ className, ...restProps }: ComponentPropsWithoutRef<"div">) => import("react/jsx-runtime").JSX.Element; declare const ChatOptions: ({ defaultSelectedId, onSelectedChange, options, selectedId, ...props }: ChatOptionsProps) => import("react/jsx-runtime").JSX.Element; declare const ModelSelect: (props: ComponentPropsWithoutRef<"select"> & { options?: ReactNode; }) => import("react/jsx-runtime").JSX.Element; //# sourceMappingURL=AIMessageComposer.d.ts.map