import React from 'react'; import classNames from 'classnames'; import ReactOtpInput, { OTPInputProps as ReactOtpInputProps, InputProps as ReactOtpInputInputProps } from 'react-otp-input'; import './OtpInput.scss'; type OtpInputHTMLProps = Pick< React.InputHTMLAttributes, 'aria-describedby' | 'aria-label' | 'autoComplete' | 'id' | 'name' | 'required' >; export type OtpInputProps = Omit< ReactOtpInputProps, 'containerStyle' | 'inputStyle' | 'renderInput' | 'skipDefaultStyles' > & OtpInputHTMLProps & { className?: string; disabled?: boolean; error?: boolean | string; focus?: boolean; inputClassName?: string; label?: string; }; const getInputAriaLabel = ( index: number, inputCount: number, ariaLabel?: string, label?: string ) => { const baseLabel = ariaLabel || label || 'One-time password digit'; return `${baseLabel} ${index + 1} of ${inputCount}`; }; export const OtpInput: React.FC = ({ 'aria-describedby': ariaDescribedBy, 'aria-label': ariaLabel, autoComplete = 'one-time-code', className, disabled, error, focus, id, inputClassName, inputType = 'tel', label, name, numInputs = 4, onChange, onPaste, placeholder, renderSeparator, required, shouldAutoFocus, value = '', ...rest }) => { return ( <> ( )} /> ); }; OtpInput.displayName = 'OtpInput';