Allow CandidateBox caret positioning, passing event though onChange. Per https://github.com/hodgef/react-simple-keyboard/issues/1298

This commit is contained in:
Francisco Hodge
2021-06-28 23:26:43 -07:00
parent c6f12f0f92
commit 3032bef324
13 changed files with 201 additions and 25 deletions
+10 -2
View File
@@ -22,14 +22,14 @@ export declare type CandidateBoxParams = {
export declare type CandidateBoxShowParams = {
candidateValue: string;
targetElement: KeyboardElement;
onSelect: (selectedCandidate: string) => void;
onSelect: (selectedCandidate: string, e: MouseEvent) => void;
};
export declare type CandidateBoxRenderParams = {
candidateListPages: string[][];
targetElement: KeyboardElement;
pageIndex: number;
nbPages: number;
onItemSelected: (selectedCandidate: string) => void;
onItemSelected: (selectedCandidate: string, e: MouseEvent) => void;
};
export declare type KeyboardElement = HTMLDivElement | HTMLButtonElement;
export declare type KeyboardHandlerEvent = any;
@@ -195,6 +195,14 @@ export interface KeyboardOptions {
* Executes the callback function once simple-keyboard is rendered for the first time (on initialization).
*/
onInit?: (instance?: SimpleKeyboard) => void;
/**
* Retrieves the current input
*/
onChange?: (input: string, e?: MouseEvent) => any;
/**
* Retrieves all inputs
*/
onChangeAll?: (inputObj: KeyboardInput, e?: MouseEvent) => any;
/**
* Module options can have any format
*/