@ozen-ui/kit
Version:
React component library
21 lines (20 loc) • 1.3 kB
TypeScript
import type { ChangeEvent, ClipboardEvent, ClipboardEventHandler, KeyboardEvent, KeyboardEventHandler } from 'react';
import type { StoredValue } from '../../../hooks/useStoredValue';
import type { InputOTPRawValue, InputOTPInputs, InputOTPOnFinish, InputOTPValidate, InputOTPMask, InputOTPFinishBehavior } from '../types';
export declare const useInputOTPEvents: ({ inputs, valueByIndex, setValueByIndex, validate: validateFromProps, length, onPaste: onPasteFromProps, onKeyDown: onKeyDownFromProps, onFinish, mask, finishBehavior, }: {
inputs: StoredValue<InputOTPInputs>;
valueByIndex: InputOTPRawValue | undefined;
setValueByIndex: (valueByIndex: InputOTPRawValue) => void;
validate: InputOTPValidate | undefined;
length: number;
onKeyDown: KeyboardEventHandler<HTMLElement> | undefined;
onPaste: ClipboardEventHandler<HTMLElement> | undefined;
onFinish: InputOTPOnFinish | undefined;
mask: InputOTPMask | undefined;
finishBehavior: InputOTPFinishBehavior;
}) => {
onInputChange: (event: ChangeEvent<HTMLInputElement>, index: number) => void;
onKeyDown: (event: KeyboardEvent<HTMLInputElement>, index: number) => void;
onPaste: (event: ClipboardEvent<HTMLInputElement>, inputIndex: number) => void;
onInputSelect: (index: number) => void;
};