import * as React from 'react'; import AssistedSearchStore from './stores/AssistedSearchStore'; import UserEventDispatcher from './stores/KeyboardEventDispatcher'; import { AssistedSearchOptions, Nullable, SearchEntry, Value } from './types'; import { MountedDropdown } from './MountedDropdown'; export interface AssistedSearchProps { /** * The value of the "main" input */ value?: string | Value; /** * The committed entries. When in single mode, there is only ever one entry, * and it is kept in sync with props.value */ entries?: Array; /** * Configuration of the components behavior */ options?: AssistedSearchOptions; /** * Triggered on all state changes to the component. * * Warning: do not use this to trigger a state change a re-render a * parent component as this could cause an infinite loop * @param type * @param store */ onAll?: (type: string, store: AssistedSearchStore) => any; /** * Fires when the component loses focus to an external element. * * @param val * @param entires * @param store */ onBlur?: (val: string, entries: SearchEntry[], store: AssistedSearchStore) => any; /** * Fires when the value of the component changes. * @param val * @param entries * @param store */ onChange?: (val: string, entries: SearchEntry[], store: AssistedSearchStore) => any; /** * Fires when a user explicitly selects a value from the dropdown, or when they hit the enter key * @param val * @param entries * @param store */ onSubmit?: (val: string, entries: SearchEntry[], store: AssistedSearchStore) => any; /** * A custom-configured store component. This store is configured automatically when using one of the provided * react components for each mode. */ store?: AssistedSearchStore; /** * An element to mount the dropdown onto. */ mount?: HTMLElement | false | (() => Nullable); [key: string]: any; } /** * The main container and entry point. * * @extends React.Component */ export default class AssistedSearch extends React.Component { store: AssistedSearchStore; /** Handles keyboard events */ dispatcher: UserEventDispatcher; _update: () => void; mountRef?: MountedDropdown; private _setMount; /** Returns the mounted element, or null if this is a relative mount */ getMountRef: () => HTMLDivElement | null; constructor(props: AssistedSearchProps); componentWillReceiveProps(nextProps: AssistedSearchProps): void; private _focus; componentWillUnmount(): void; render(): JSX.Element; }