instantsearch-ui-components
Version:
Common UI components for InstantSearch.
68 lines (67 loc) • 2.38 kB
TypeScript
/** @jsx createElement */
/** @jsxFrag Fragment */
import type { Renderer, ComponentProps } from '../../types';
import type { ChatHeaderProps, ChatHeaderOwnProps } from './ChatHeader';
import type { ChatMessagesProps } from './ChatMessages';
import type { ChatPromptProps, ChatPromptOwnProps } from './ChatPrompt';
import type { ChatPromptSuggestionsOwnProps } from './ChatPromptSuggestions';
import type { ChatLayoutOwnProps } from './types';
export type ChatClassNames = {
root?: string | string[];
container?: string | string[];
header?: ChatHeaderProps['classNames'];
messages?: ChatMessagesProps['classNames'];
message?: ChatMessagesProps['messageClassNames'];
prompt?: ChatPromptProps['classNames'];
suggestions?: ChatPromptSuggestionsOwnProps['classNames'];
};
export type ChatProps = Omit<ComponentProps<'div'>, 'onError' | 'title'> & {
open: boolean;
maximized?: boolean;
headerProps: ChatHeaderProps;
messagesProps: ChatMessagesProps;
promptProps: ChatPromptProps;
suggestionsProps: ChatPromptSuggestionsOwnProps;
/**
* Optional class names for elements
*/
classNames?: Partial<ChatClassNames>;
/**
* Optional title for the chat
*/
title?: string;
/**
* Optional header component for the chat
*/
headerComponent?: (props: ChatHeaderOwnProps) => JSX.Element;
/**
* Optional prompt component for the chat
*/
promptComponent?: (props: ChatPromptOwnProps) => JSX.Element;
/**
* Optional suggestions component for the chat
*/
suggestionsComponent?: (props: ChatPromptSuggestionsOwnProps) => JSX.Element;
/**
* Function to send a message to the chat.
*/
sendMessage: ChatLayoutOwnProps['sendMessage'];
/**
* Function to regenerate the last assistant response.
*/
regenerate: ChatLayoutOwnProps['regenerate'];
/**
* Function to stop the current streaming response.
*/
stop: ChatLayoutOwnProps['stop'];
/**
* The current error, if any.
*/
error: ChatLayoutOwnProps['error'];
/**
* Optional layout component for the chat.
* @default ChatOverlayLayout
*/
layoutComponent?: (props: ChatLayoutOwnProps) => JSX.Element;
};
export declare function createChatComponent({ createElement, Fragment }: Renderer): (userProps: ChatProps) => JSX.Element;