1 import { type FC, useEffect, useRef } from 'react';
3 import { TotpInput } from '@proton/components';
4 import clsx from '@proton/utils/clsx';
6 import './PinCodeInput.scss';
14 onValue: (value: string) => void;
17 export const PinCodeInput: FC<Props> = ({ autoFocus = true, className, disabled, loading = false, value, onValue }) => {
18 const focusRef = useRef<HTMLInputElement>(null);
21 if (autoFocus) focusRef.current?.focus();
22 if (loading || disabled) focusRef.current?.blur();
23 }, [autoFocus, loading]);
26 <div className={clsx('pass-pin--input', className, (loading || disabled) && 'opacity-30 pointer-events-none')}>
33 disableChange={disabled || loading}