@area2-ai/a2-react-keystroke-package
Version:
# a2-react-keystroke-package
26 lines (25 loc) • 1.34 kB
TypeScript
import { ChangeEvent, ClipboardEvent } from "react";
export declare type TargetPlatform = 'desktop' | 'ios' | 'android';
export interface IKeystrokeHookTemplate<T> {
handleEndTypingSession: () => T | undefined;
}
export interface IMobileKeystrokeHookTemplate<T> extends IKeystrokeHookTemplate<T> {
handleProcessPaste: (event: ClipboardEvent<HTMLInputElement>) => void;
}
export interface IDesktopKeystrokeHookTemplate<T> extends IKeystrokeHookTemplate<T> {
getIsTypingSessionActive: () => boolean;
handleProcessKeydown: (key: string) => void;
handleProcessKeyup: (key: string) => void;
}
export interface IAndroidKeystrokeHookTemplate<T> extends IMobileKeystrokeHookTemplate<T> {
handleProcessKeydown: (target: HTMLInputElement) => void;
handleProcessKeyInput: (inputContent: string) => void;
handleProcessKeyup: () => void;
handleProcessOnBeforeInput: (newValue: string, inputValue: string) => void;
}
export interface IiOSKeystrokeHookTemplate<T> extends IMobileKeystrokeHookTemplate<T> {
handleProcessInputChange: (event: ChangeEvent<HTMLInputElement>, inputValue: string) => void;
handleProcessKeydown: (keyPressed: string, target: HTMLInputElement) => void;
handleProcessKeyup: (keyPressed: string) => void;
handleProcessOnBeforeInput: (value: number) => void;
}