import React, { useState } from 'react'; import { Eye, EyeOff } from 'lucide-react'; import type { UseFormRegisterReturn, FieldError } from 'react-hook-form'; import { useLocalize } from '~/hooks'; interface PasswordInputProps { id: string; label: string; register: UseFormRegisterReturn; error?: FieldError; autoComplete?: string; 'data-testid'?: string; } const PasswordInput: React.FC = ({ id, label, register, error, autoComplete = 'current-password', 'data-testid': dataTestId, }) => { const localize = useLocalize(); const [showPassword, setShowPassword] = useState(false); const togglePasswordVisibility = () => { setShowPassword((prev) => !prev); }; return (
{error && ( {String(error.message)} )}
); }; export default PasswordInput;