import React from 'react'; import { DOMProps, InputControlSize, QAProps } from '@gravity-ui/uikit'; import { DateLocaleConfig } from "../../../hooks/index.js"; import { ChatType } from "../../../types/index.js"; import { ChatFilterFunction } from "../../../utils/chatUtils.js"; import "./History.css"; /** Result of lazy load more callback - either array of new chats or object with chats and hasMore flag */ export type LoadMoreLazyResult = ChatType[] | { chats: ChatType[]; hasMore?: boolean; }; /** Callback for lazy load more - returns only new chats, not previously loaded */ export type OnLoadMoreLazy = (offset: number) => Promise; /** Load mode: full (button, parent manages all data) or lazy (scroll, component accumulates data) */ export type HistoryLoadMode = 'full' | 'lazy'; /** * Props for the HistoryList component */ export interface HistoryListProps extends QAProps, DOMProps { /** Array of chat items */ chats: ChatType[]; /** Currently selected chat */ selectedChat?: ChatType | null; /** Callback when a chat is selected */ onSelectChat?: (chat: ChatType) => void; /** Callback when a chat is deleted */ onDeleteChat?: (chat: ChatType) => Promise; /** * Callback to load more chats. * - Full mode: () => void - triggers load, parent updates chats prop * - Lazy mode: (offset) => Promise - returns only new chats */ onLoadMore?: (() => void) | OnLoadMoreLazy; /** Whether there are more chats to load */ hasMore?: boolean; /** * Load mode: 'full' (button click, parent provides all data) or 'lazy' (scroll, callback returns new data only) * @default 'full' */ loadMode?: HistoryLoadMode; /** Enable search functionality */ searchable?: boolean; /** Group chats by date or none */ groupBy?: 'date' | 'none'; /** Custom dayjs format for non-relative date headers */ dateFormat?: string; /** Locale for non-relative date headers */ dateLocale?: string; /** Dayjs locale configuration for non-relative date headers */ dateLocaleConfig?: DateLocaleConfig; /** Show action buttons (delete, etc.) */ showActions?: boolean; /** Empty state placeholder */ emptyPlaceholder?: React.ReactNode; /** Empty filtered state placeholder (when search returns no results) */ emptyFilteredPlaceholder?: React.ReactNode; /** Placeholder text for the search/filter input (defaults to built-in i18n string) */ searchPlaceholder?: string; /** Additional CSS class */ className?: string; /** Custom filter function for search */ filterFunction?: ChatFilterFunction; /** Loading state */ loading?: boolean; /** Callback when chat is clicked (for closing popup in parent) */ onChatClick?: (chat: ChatType) => void; /** Size of the list */ size?: InputControlSize; } /** * HistoryList component - displays a list of chats with search, grouping, and actions * * @param props - {@link HistoryListProps} * @returns Rendered history list (search, grouping, lazy/full load, chat rows). */ export declare function HistoryList(props: HistoryListProps): import("react/jsx-runtime").JSX.Element;