import React from "react"; import { createSearchStore } from "./redux/store"; import { FullReactFKConfig, UIStrings, ReactGroup, Slots, Group } from "./config"; import { open } from "./utils/shared-helpers"; import { SearchEngine } from "./redux/search-engine"; import { ValuSearchEventListener, ValuSearchEvents } from "./events"; import { GetJwtToken, CustomFields, FindkitFetch } from "@findkit/fetch"; export * from "./components/SharedComponents"; export { useIsSearchActive } from "./utils/use-search-terms"; export * from "./utils/shared-helpers"; export { useValuSearch } from "./config"; export { ValuSearchEvent, ValuSearchBrowserEvent } from "./events"; export * from "./components/ReactIcons"; export { useGroupSearchResults, useIsSearching } from "./redux/hooks"; export { Group, Slots, CustomFields }; interface FindkitWindow { ["rvs-loaded"]?: string; FINDKIT_GET_JWT_TOKEN?: GetJwtToken; } export declare const findkitWindow: FindkitWindow | undefined; /** * English and fallback translations in UI */ export declare const defaultTranslation: UIStrings; /** * Finnish and Swedish UI translations */ export declare const translations: Record; export interface ValuSearchUIConfig { instanceId: FullReactFKConfig["instanceId"]; uiStrings: UIStrings; validateTabbable: FullReactFKConfig["validateTabbable"]; orderBy: FullReactFKConfig["orderBy"]; slots: FullReactFKConfig["slots"]; } /** * Options for the ValuSearch class */ export interface ValuSearchConfig { /** * Enable focus trapping. Defaults to true */ focusTrap?: boolean; /** * Result group configuration. Customize group titles, filters, decays etc. */ groups?: Group[]; /** * Validate tabbable for the focus trapping */ validateTabbable?: FullReactFKConfig["validateTabbable"]; /** * Customize the appearance via render props slots */ slots?: Slots; /** * The group order. Default to "score" */ orderBy?: FullReactFKConfig["orderBy"]; /** * Set UI strings to lang */ uiLang?: string; /** * Set searches to lang, * only first language from the array is supported * array type for possible future extensions to multiple languages * for now, leave undefined to search with all languages */ searchLang?: string[] | undefined; /** * Custom instance id. Only needed when running multiple RVS instances on * the same page. Affects the url query string names */ instanceId?: string; /** * How many items to preview in the groups */ previewGroupSize?: number; /** * How many results to search for in group view */ searchMoreSize?: number; /** * Min search term lenght */ minSearchTermsLength?: number; /** * How often a search is made when user types to an input */ searchThrottleTime?: number; /** * Event listener to be called on ValuSearchEvents */ onEvent?: ValuSearchEventListener; /** * Searchendpoint to target with searches */ searchEndpoint?: string; /** * Identifying publicToken */ publicToken: string; /** * Enable infinite scrolling by automatically loading results when the last * item appears to the screen */ infiniteScroll?: boolean; /** * Custom @findkit/fetch implementation. Can be used to add jwt support */ fetcher?: FindkitFetch; } interface ProviderProps { children: React.ReactNode; uiLang?: string; searchLang?: string[] | undefined; uiStrings?: Partial; groups?: Group[]; disabled?: boolean; slots?: Slots; } export declare class ValuSearch { readonly config: Readonly; fetcher: FindkitFetch; initialized: boolean; instanceId: string; engine: SearchEngine; store: ReturnType; constructorGroups?: Group[]; events: ValuSearchEvents; hasBeenOpened: boolean; constructor(config: ValuSearchConfig); dispose(): void; private unbindEsc; private handleEsc; /** * Just globally listen the Escape key and deactivate the instance when * pressed. */ private bindEsc; getTerms: () => string; private buildEngine; initModal: (options?: { uiStrings?: UIStrings | undefined; } | undefined) => void; /** * Set search terms to a given value */ setSearchTerms: (terms: string) => void; bindInput: (input: HTMLInputElement) => boolean; unbindInput(input: HTMLInputElement): void; /** * Bind input only as an opener. This for fullscreen modals where the * actual vs input is inside the modal but there's another input outside it * which should open the modal when typed on but not really work as bound * vs input. */ bindInputAsOpener: (input: HTMLInputElement) => () => void; useInput: () => React.MutableRefObject; /** * Manage RVS active status */ useStatus: () => { isActive: boolean; activate: () => void; deactivate: () => void; }; /** * Get and set search terms like useState() */ useSearchTerms: () => readonly [string, (terms: string) => void]; private UseValuSearchHooks; private setInputs?; toReactGroups(groups: Group[]): ReactGroup[]; Provider: (props: ProviderProps) => JSX.Element | null; private ProviderInner; Modal: (props: { topMargin?: number | string; }) => JSX.Element; Results: (props: { header?: React.ReactNode; footer?: React.ReactNode; }) => JSX.Element; /** * If you have custom components that you want to include in * focus trap, wrap VS UI with this component * * e.g. * * * * * @param props */ FocusTrapContainer: React.ForwardRefExoticComponent, HTMLDivElement>, "key" | keyof React.HTMLAttributes> & React.RefAttributes>; /** * Helper function for closing Valu Search. * Handles history api calls for you. */ deactivate: () => void; activate: () => void; isActive: () => boolean; addListener: (listener: ValuSearchEventListener) => () => void; /** * Class name used to create FocusTrap containers */ get trapClassName(): string; } export declare const vsOpenOnWindow: typeof open; export declare const VERSION: string;