import { BUILT_IN_MATCHERS, getGlobalMatchers, registerMatcher, unregisterMatcher, type BuiltInMatchMode, type FilterMatcher } from './_matchers'; export { registerMatcher, unregisterMatcher, BUILT_IN_MATCHERS, getGlobalMatchers }; export type { FilterMatcher, BuiltInMatchMode }; export type FilterOperator = 'and' | 'or'; export interface FilterConstraint { value: unknown; matchMode?: TMode; } export interface FilterRuleSimple { field: string | string[]; value: unknown; matchMode?: TMode; operator?: never; constraints?: never; } export interface FilterRuleComposite { field: string | string[]; operator?: FilterOperator; constraints: FilterConstraint[]; value?: never; matchMode?: never; } export type FilterRule = FilterRuleSimple | FilterRuleComposite; export interface UseFilterOptions { data: T[]; /** Shorthand: target field for a single-rule filter. Use `rules` / `defaultRules` for multi-rule setups. */ field?: string | string[]; /** Shorthand: value for the single-rule filter declared via `field`. */ value?: unknown; /** Shorthand: match mode for the single-rule filter declared via `field`. Defaults to `contains`. */ matchMode?: TMode; /** Shorthand: callback when the single-rule value changes. */ onValueChange?: (value: unknown) => void; /** Multi-rule controlled state. Omit and use `field/value` for a single rule. */ rules?: FilterRule[]; /** Multi-rule uncontrolled initial state. */ defaultRules?: FilterRule[]; matchers?: Partial> & Record; filterLocale?: string; filterDelay?: number; /** When true, `filteredData` is returned as-is; the consumer is responsible for filtering (server-side). */ lazy?: boolean; /** Fires after rules settle (honours `filterDelay`). The consumer is expected to fetch a new `data` slice. */ onLazyLoad?: (event: LazyFilterEvent) => void; onRulesChange?: (rules: FilterRule[]) => void; } export interface LazyFilterEvent { rules: FilterRule[]; filterLocale?: string; } export interface FilterConstraintCursor { value: unknown; matchMode: TMode | undefined; setValue: (value: unknown) => void; setMatchMode: (matchMode: TMode) => void; remove: () => void; } export interface FilterRuleCursor { field: string | string[]; value: unknown; matchMode: TMode | undefined; operator: FilterOperator | undefined; constraints: FilterConstraint[] | undefined; setValue: (value: unknown) => void; setMatchMode: (matchMode: TMode) => void; setOperator: (operator: FilterOperator) => void; addConstraint: (matchMode?: TMode) => void; constraint: (index: number) => FilterConstraintCursor | undefined; remove: () => void; clear: () => void; } export interface UseFilterReturn { rules: FilterRule[]; filteredData: T[]; isFiltered: boolean; setRules: (rules: FilterRule[]) => void; setValue: (ruleIndex: number, value: unknown) => void; setMatchMode: (ruleIndex: number, matchMode: TMode) => void; setOperator: (ruleIndex: number, operator: FilterOperator) => void; setConstraintValue: (ruleIndex: number, constraintIndex: number, value: unknown) => void; setConstraintMatchMode: (ruleIndex: number, constraintIndex: number, matchMode: TMode) => void; addRule: (rule: FilterRule) => void; removeRule: (ruleIndex: number) => void; clearRule: (ruleIndex: number) => void; addConstraint: (ruleIndex: number, matchMode?: TMode) => void; removeConstraint: (ruleIndex: number, constraintIndex: number) => void; clearAll: () => void; rule: (ruleKey: number | string) => FilterRuleCursor | undefined; match: (item: T) => boolean; matchers: Readonly>; } export declare function matchRule(item: T, rule: FilterRule, matchers: Record, locale?: string): boolean; export declare function useFilter(options: UseFilterOptions): UseFilterReturn; export declare function ruleHasValue(rule: FilterRule): boolean;