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
+12 -2
View File
@@ -31,7 +31,7 @@ export type CandidateBoxShowParams = {
candidateValue: string,
targetElement: KeyboardElement,
// eslint-disable-next-line no-unused-vars
onSelect: (selectedCandidate: string) => void
onSelect: (selectedCandidate: string, e: MouseEvent) => void
}
export type CandidateBoxRenderParams = {
@@ -40,7 +40,7 @@ export type CandidateBoxRenderParams = {
pageIndex: number;
nbPages: number;
// eslint-disable-next-line no-unused-vars
onItemSelected: (selectedCandidate: string) => void
onItemSelected: (selectedCandidate: string, e: MouseEvent) => void
}
export type KeyboardElement = HTMLDivElement | HTMLButtonElement;
@@ -240,6 +240,16 @@ export interface KeyboardOptions {
*/
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
*/