UNPKG

zim-fuzzysearch

Version:

Client side fuzzy search combined with seperate configurable result highlighting.

33 lines (32 loc) 1.08 kB
import React from "react"; interface FuzzyResultCtxType { fuzzyResult: null | { item: any; [property: string]: any; }[]; onSelect?: (sel: any) => void; onTagSelect?: (tagObj: { url: string; }) => void; onFuseScoreToCssClass: (scoreAsFloat: number) => string; resultCountLabel?: string; showResultGrid: boolean; tagConceptMap?: { [tagName: string]: { url: string; }; }; } /** * Component to provide the result context in the children components. * Can then be accessed via useFuzzyResult. */ export declare const FuzzyResultProvider: React.FC<FuzzyResultCtxType>; export declare type UseFuzzyResultType = () => FuzzyResultCtxType; /** * Uses the FuzzyResult context and exposes therefore exposes the fuzzyResult variable. * Do not forget to previously import the FuzzyResultProvider and to assign it as parent * component somewhere. (otherwise useFuzzyResult cannot work) */ export declare const useFuzzyResult: () => FuzzyResultCtxType; export {};