import type { JBPinInputWebComponent, JBPinInputEventType } from 'jb-pin-input'; import { useEvent } from 'jb-core/react'; export type PropsEvent = { onChange?: (e: JBPinInputEventType) => void, onKeyUp?: (e: JBPinInputEventType) => void, onKeyDown?: (e: JBPinInputEventType) => void, onEnter?: (e: JBPinInputEventType) => void, onInput?: (e: JBPinInputEventType) => void, onBeforeInput?: (e: JBPinInputEventType) => void, onFocus?: (e: JBPinInputEventType) => void, onBlur?: (e: JBPinInputEventType) => void, onComplete?: (e: JBPinInputEventType) => void, } export function useEvents(props:PropsEvent,element:React.RefObject) { useEvent(element, 'change', props.onChange); useEvent(element, 'keydown', props.onKeyDown); useEvent(element, 'keyup', props.onKeyUp); useEvent(element, 'focus', props.onFocus); useEvent(element, 'blur', props.onBlur); useEvent(element, 'enter', props.onEnter); useEvent(element, 'input', props.onInput); useEvent(element, 'complete', props.onComplete); useEvent(element, 'beforeinput', props.onBeforeInput); }