// src/components/PasswordInput.tsx import React, { useState } from 'react'; import { EyeIcon } from './icons/EyeIcon'; import { EyeSlashIcon } from './icons/EyeSlashIcon'; import { PasswordStrengthIndicator } from './PasswordStrengthIndicator'; /** * Props for the PasswordInput component. * It extends standard HTML input attributes and adds a custom prop to show a strength indicator. */ interface PasswordInputProps extends React.InputHTMLAttributes { showStrength?: boolean; } /** * A reusable password input component with a show/hide toggle * and an optional password strength indicator. */ export const PasswordInput: React.FC = ({ showStrength = false, className, ...props }) => { const [showPassword, setShowPassword] = useState(false); return (
{showStrength && typeof props.value === 'string' && props.value.length > 0 && (
)}
); };