import { h, Component } from 'preact'; import type { HierarchicalMenuItem } from '../../connectors/hierarchical-menu/connectHierarchicalMenu'; import type { PreparedTemplateProps } from '../../lib/templating'; import type { ComponentCSSClasses, CreateURL, Templates } from '../../types'; import type { HierarchicalMenuComponentCSSClasses } from '../../widgets/hierarchical-menu/hierarchical-menu'; import type { RatingMenuComponentCSSClasses } from '../../widgets/rating-menu/rating-menu'; import type { RefinementListOwnCSSClasses } from '../../widgets/refinement-list/refinement-list'; import type { SearchBoxComponentCSSClasses, SearchBoxComponentTemplates } from '../SearchBox/SearchBox'; import type { JSX } from 'preact'; type RefinementListOptionalClasses = 'noResults' | 'checkbox' | 'labelText' | 'showMore' | 'disabledShowMore' | 'searchBox' | 'count'; type RefinementListWidgetCSSClasses = ComponentCSSClasses; type RefinementListRequiredCSSClasses = Omit & Partial>; export type RefinementListComponentCSSClasses = RefinementListRequiredCSSClasses & { searchable?: SearchBoxComponentCSSClasses; } & Partial> & Partial>; type FacetValue = { value: string; label: string; highlighted?: string; count?: number; isRefined: boolean; data?: HierarchicalMenuItem[] | null; }; export type RefinementListProps = { createURL: CreateURL; cssClasses: RefinementListComponentCSSClasses; depth?: number; facetValues?: FacetValue[]; attribute?: string; templateProps: PreparedTemplateProps; toggleRefinement: (value: string) => void; showMore?: boolean; toggleShowMore?: () => void; isShowingMore?: boolean; hasExhaustiveItems?: boolean; canToggleShowMore?: boolean; className?: string; children?: JSX.Element; isFromSearch?: boolean; searchIsAlwaysActive?: boolean; searchFacetValues?: (query: string) => void; searchPlaceholder?: string; searchBoxTemplateProps?: PreparedTemplateProps; searchableSelectOnSubmit?: boolean; }; declare const defaultProps: { cssClasses: {}; depth: number; }; type RefinementListPropsWithDefaultProps = RefinementListProps & Readonly; declare class RefinementList extends Component> { static defaultProps: { cssClasses: {}; depth: number; }; private listRef; private searchBox; private lastRefinedValue; shouldComponentUpdate(nextProps: RefinementListPropsWithDefaultProps): boolean; private refine; private _generateFacetItem; private handleItemClick; componentWillReceiveProps(nextProps: RefinementListPropsWithDefaultProps): void; /** * This sets focus on the last refined input element after a render * because Preact does not perform it automatically. * @see https://github.com/preactjs/preact/issues/3242 */ componentDidUpdate(): void; private refineFirstValue; render(): h.JSX.Element; } export default RefinementList;