import React, { PureComponent } from 'react'; import type { CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer'; import type { QuickInsertItem } from '../provider-factory'; import type { EmptyStateHandler } from '../types'; import type { Category, Modes } from './types'; export interface Props { /** * If search field should be focused on the initial load */ autoFocusSearch?: boolean; cache?: CellMeasurerCache; categories?: Category[]; defaultCategory?: string; emptyStateHandler?: EmptyStateHandler; getItems: (query?: string, category?: string) => QuickInsertItem[]; mode: keyof typeof Modes; onInsertItem: (item: QuickInsertItem) => void; onSelectItem?: (item: QuickInsertItem) => void; onViewMore?: () => void; showCategories: boolean; showSearch: boolean; } export interface State { categories: Category[]; items: QuickInsertItem[]; searchTerm?: string; selectedCategory?: string; } export default class ElementBrowser extends PureComponent { static defaultProps: { defaultCategory: string; onInsertItem: () => void; }; state: State; componentDidMount(): void; getCategories: (items?: QuickInsertItem[]) => Category[]; filterCategories: (items: QuickInsertItem[], categories?: Category[]) => Category[]; fetchItems: (query?: string, category?: string) => QuickInsertItem[]; componentDidUpdate(prevProps: Props, prevState: State): void; handleSearch: (searchTerm: string) => void; handleCategorySelection: (clickedCategory: Category) => void; render(): React.JSX.Element; }