UNPKG

1.08 kBTypeScriptView Raw
1/// <reference types="react" />
2import { noop } from '../utils';
3import { Id, Option, OptionHandler, SelectEvent } from '../types';
4export interface TypeaheadContextType {
5 activeIndex: number;
6 hintText: string;
7 id: Id;
8 initialItem: Option | null;
9 inputNode: HTMLInputElement | null;
10 isOnlyResult: boolean;
11 onActiveItemChange: OptionHandler;
12 onAdd: OptionHandler;
13 onInitialItemChange: (option?: Option) => void;
14 onMenuItemClick: (option: Option, event: SelectEvent<HTMLElement>) => void;
15 setItem: (option: Option, position: number) => void;
16}
17export declare const defaultContext: {
18 activeIndex: number;
19 hintText: string;
20 id: string;
21 initialItem: null;
22 inputNode: null;
23 isOnlyResult: boolean;
24 onActiveItemChange: typeof noop;
25 onAdd: typeof noop;
26 onInitialItemChange: typeof noop;
27 onMenuItemClick: typeof noop;
28 setItem: typeof noop;
29};
30export declare const TypeaheadContext: import("react").Context<TypeaheadContextType>;
31export declare const useTypeaheadContext: () => TypeaheadContextType;