@nekobird/controls
Version:
A collection of opinionated user-interface controls.
35 lines (34 loc) • 1.35 kB
TypeScript
declare type InputElement = HTMLInputElement | HTMLTextAreaElement;
export interface InputActiveManagerConfig {
getInputElement: () => HTMLElement | null;
activateOnFocus: boolean;
beforeActivate: (input: InputElement) => Promise<void>;
afterActivate: (input: InputElement) => void;
conditionActivate: (input: InputElement) => boolean;
beforeDeactivate: (input: InputElement) => Promise<void>;
afterDeactivate: (input: InputElement) => void;
activate: (input: InputElement) => Promise<void>;
deactivate: (input: InputElement) => Promise<void>;
onFocus: (input: InputElement, context: InputActiveManager) => void;
onBlur: (input: InputElement, context: InputActiveManager) => void;
onInput: (input: InputElement, context: InputActiveManager) => void;
}
export declare const INPUT_FOCUS_MANAGER_CONFIG: InputActiveManagerConfig;
export declare class InputActiveManager {
config: InputActiveManagerConfig;
element?: InputElement;
isActive: boolean;
isReady: boolean;
constructor(config?: Partial<InputActiveManagerConfig>);
private setConfig;
private updateElement;
initialize(): void;
private activate;
private deactivate;
private eventHandlerFocus;
private eventHandlerBlur;
private eventHandlerInput;
listen(): void;
stop(): void;
}
export {};