import type { SearchEngine } from '../../app/search-engine/search-engine.js'; import type { StaticFilterValue, StaticFilterValueState } from '../../features/static-filter-set/static-filter-set-state.js'; import { type Controller } from '../controller/headless-controller.js'; import { buildStaticFilterValue, type StaticFilterValueOptions } from './static-filter-value.js'; export type { StaticFilterValue, StaticFilterValueOptions, StaticFilterValueState, }; export { buildStaticFilterValue }; export interface StaticFilterProps { /** * The options for the `StaticFilter` controller. */ options: StaticFilterOptions; } export interface StaticFilterOptions { /** * A unique identifier for the static filter. */ id: string; /** * The values the static filter is responsible for managing. */ values: StaticFilterValue[]; } /** * The `StaticFilter` controller manages a collection of filter values. * * Example: [static-filter.fn.tsx](https://github.com/coveo/ui-kit/blob/main/samples/headless/search-react/src/components/static-filter/static-filter.fn.tsx) * * @group Controllers * @category StaticFilter * */ export interface StaticFilter extends Controller { /** * Toggles the specified static filter value. * * @param value - The static filter value to toggle. */ toggleSelect(value: StaticFilterValue): void; /** * Excludes the specified static filter value. * * @param value - The static filter value to toggle. */ toggleExclude(value: StaticFilterValue): void; /** * Toggles the specified static filter value, deselecting others. * * @param value - The static filter value to toggle. */ toggleSingleSelect(value: StaticFilterValue): void; /** * Excludes the specified static filter value, deselecting others. * * @param value - The static filter value to toggle exclusion. */ toggleSingleExclude(value: StaticFilterValue): void; /** * Deselects all static filter values. * */ deselectAll(): void; /** * Checks whether the specified static filter value is selected. * * @param value - The static filter value to check. * @returns Whether the specified static filter value is selected. */ isValueSelected(value: StaticFilterValue): boolean; /** * Checks whether the specified static filter value is excluded. * * @param value - The static filter value to check. * @returns Whether the specified static filter value is excluded. */ isValueExcluded(value: StaticFilterValue): boolean; /** * A state of the `StaticFilter` controller. */ state: StaticFilterState; } /** * A scoped and simplified part of the headless state that is relevant to the `StaticFilter` controller. * * @group Controllers * @category StaticFilter */ export interface StaticFilterState { /** * The static filter id. */ id: string; /** * The static filter values. */ values: StaticFilterValue[]; /** * `true` if there is at least one non-idle value and `false` otherwise. */ hasActiveValues: boolean; } /** * Creates a `Static Filter` controller instance. * * @param engine - The headless engine. * @param props - The configurable `Sort` controller properties. * @returns A `Sort` controller instance. * * @group Controllers * @category StaticFilter */ export declare function buildStaticFilter(engine: SearchEngine, props: StaticFilterProps): StaticFilter;