import type { Ref } from 'react'; import type { LinkProps, MetaListProps, NoChildrenProp, OmitStrict, RadioCheckProps, SearchInputProps } from '@pega/cosmos-react-core'; interface BaseFilterProps { /** The name of the filter. */ name: string; /** * Determines if the filter will start in an expanded state. * @default true */ expanded?: boolean; } export interface SelectFilterItemProps { /** The id for the filter option. */ id: NonNullable; /** The label for the filter option. */ label: RadioCheckProps['label']; /** Determines if the filter option is active or not. */ checked: RadioCheckProps['checked']; /** The name for the filter item that will show in the selected filters section */ name: NonNullable; } export interface SelectFilterProps extends BaseFilterProps { /** Internal prop designating this object as a select filter. */ type: 'select'; /** The set of options for the filter. */ items: SelectFilterItemProps[]; /** * Determines if the filter will render as a RadioButtonGroup or CheckboxGroup. * @default 'multi-select' */ selectType?: 'single-select' | 'multi-select'; } export interface ActiveSelectFilter { id: SelectFilterItemProps['id']; name: SelectFilterItemProps['name']; resetValue: SelectFilterItemProps & { checked: false; }; groupName: SelectFilterProps['name']; type: SelectFilterProps['type']; } export interface TextFilterProps extends BaseFilterProps { /** Internal prop designating this object as a text filter. */ type: 'text'; /** The value of the filter. */ value?: string; /** * Placeholder text. The default value is a locale translation of 'Search…' * @default 'Search…' */ placeholder?: string; } export type FilterProps = SelectFilterProps; export type ActiveFilters = ActiveSelectFilter; export interface SearchResultProps { /** The id of the search result to be displayed. */ id: string; /** The title of the search result. */ title: string; /** LinkProps to be passed to . */ link: OmitStrict; /** A description for the search result. */ description?: string; /** A list of elements to be rendered within a MetaList categorizing the result. */ meta?: MetaListProps['items']; /** Accents the search results with text that matches the regex */ accent?: RegExp; } interface BaseFilterEvent { name: string; } interface SelectFilterEvent extends BaseFilterEvent { type: 'select'; value: SelectFilterItemProps; } export type FilterEvent = SelectFilterEvent; export interface SearchResultsProps extends NoChildrenProp { /** A set of results to render for a given search. */ results: SearchResultProps[]; /** Props related to the SearchInput. */ searchInputProps: SearchInputProps; /** The number of total results related to a given search. */ count: number; /** A set of filters and their current states for a given search. */ filters: FilterProps[]; /** Callback that is fired when the value of a filter changes. */ onFilterChange?: (filter: FilterEvent) => void; /** Callback that is fired when the Clear all button is clicked. */ onClearAllFilters?: () => void; /** Callback that is fired when the Clear button is clicked within a filter. */ onClearFilter?: (name: BaseFilterProps['name']) => void; /** Callback that will render a Show more button at the bottom of the results and is fired when that button is clicked. */ onShowMore?: () => void; /** Sets a loading indicator if true */ loading?: boolean; /** A ref for the wrapping element. */ ref?: Ref; } export {}; //# sourceMappingURL=SearchResults.types.d.ts.map