UNPKG

@automattic/agenttic-ui

Version:

UI components for the Agenttic framework

92 lines 2.55 kB
import type { ComponentType } from 'react'; export interface Suggestion { id: string; label: string; prompt: string; } export interface Message { id: string; role: 'user' | 'agent'; content: Array<{ type: 'text' | 'image_url' | 'component'; text?: string; image_url?: string; component?: React.ComponentType; componentProps?: any; }>; timestamp: number; archived: boolean; showIcon: boolean; icon?: string; actions?: MessageAction[]; disabled?: boolean; } export interface MessageAction { id: string; icon?: React.ReactNode; label: string; onClick: (message: Message) => void | Promise<void>; tooltip?: string; disabled?: boolean; pressed?: boolean; showLabel?: boolean; } export declare const DEFAULT_PLACEHOLDER: import("@wordpress/i18n").TranslatableText<"Ask anything">; export interface AgentUIProps { messages: Message[]; isProcessing: boolean; error?: string | null; onSubmit: (message: string) => void; className?: string; style?: React.CSSProperties; variant?: 'floating' | 'embedded'; triggerIcon?: React.ReactNode; placeholder?: string | string[]; notice?: NoticeConfig; onOpen?: () => void; onExpand?: () => void; onClose?: () => void; onStop?: () => void; emptyView?: React.ReactNode; floatingChatState?: ChatState; suggestions?: Suggestion[]; clearSuggestions?: () => void; messageRenderer?: ComponentType<{ children: string; }>; inputValue?: string; onInputChange?: (value: string) => void; draggableStates?: ChatState[]; } export interface NoticeConfig { icon?: React.ReactNode; message: string; action?: { label: string; onClick: () => void; }; dismissible?: boolean; onDismiss?: () => void; } export interface ChatProps extends AgentUIProps { floatingChatState?: ChatState; } export type ChatState = 'collapsed' | 'compact' | 'expanded'; export interface UseChatReturn { state: ChatState; initialState: ChatState; setState: (state: ChatState) => void; isOpen: boolean; open: () => void; close: () => void; toggle: () => void; } export interface UseInputReturn { value: string; setValue: (value: string) => void; clear: () => void; textareaRef: React.RefObject<HTMLTextAreaElement>; handleKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void; adjustHeight: () => void; } //# sourceMappingURL=index.d.ts.map