UNPKG

@point-api/dropdown-react

Version:

HOC to add a Point API autocomplete dropdown

28 lines (27 loc) 953 B
export declare type Editable = HTMLTextAreaElement | HTMLInputElement | HTMLDivElement; export interface Coordinates { top: number; left: number; } export default interface EditableAdapter { /** The Editable element to wrap */ readonly el: HTMLElement; /** The current text of the Editable */ readonly text: string; /** * Replace the text of the Editable and update the cursor * @param match - RegexMatch for the text chunk to replace * @param text - The new text to insert */ replaceText(match: RegExpExecArray, text: string): void; /** * Get the cursor character index in the Editable * @returns The number of characters a caret is inside an Editable */ getCursorIndex(): number | null; /** * Get the xy coordinates of a user's cursor relative to the window viewport * @returns The Coordiantes of a user's cursor */ getCaretPos(): Coordinates | null; }