zim-fuzzysearch
Version:
Client side fuzzy search combined with seperate configurable result highlighting.
54 lines (53 loc) • 1.6 kB
TypeScript
import React from "react";
import { FuzzyOptions } from "../hooks/useFuse";
interface FuzzyInputCtxType {
inputVal: string | null;
placeHolder: string;
handleInput: (val: string | null) => void;
doSearch: (val: string) => void;
clickMode: boolean;
onSearch?: (searchVal: string) => void;
toggleFuseKey: (fuseKey: string[]) => void;
fuseKeyMap?: {
[fuseKey: string]: {
label: string;
};
} | null;
fuseKeyAllLabel: string;
fuseStateOptions: FuzzyOptions;
data?: any[];
setSelTag: React.Dispatch<React.SetStateAction<string[]>>;
suggestions?: {
[property: string]: {
label: string;
value: string;
};
};
}
export declare const FuzzyInputProvider: React.FC<{
inputVal: string | null;
placeHolder: string;
handleInput: (val: string | null) => void;
fuseKeyMap?: {
[fuseKey: string]: {
label: string;
};
} | null;
doSearch: (val: string) => void;
clickMode: boolean;
onSearch?: (searchVal: string) => void;
toggleFuseKey: (fuseKey: string[]) => void;
fuseKeyAllLabel: string;
fuseStateOptions: FuzzyOptions;
data?: any[];
setSelTag: React.Dispatch<React.SetStateAction<string[]>>;
suggestions?: {
[property: string]: {
label: string;
value: string;
};
};
}>;
export declare type UseFuzzyInputType = () => FuzzyInputCtxType;
export declare const useFuzzyInput: () => FuzzyInputCtxType;
export {};