import * as React from "react" import { Eye, EyeOff } from "lucide-react" import { cn } from "@/lib/utils" interface PasswordInputProps extends React.InputHTMLAttributes { /** Whether to show the visibility toggle button. Defaults to true. */ showToggle?: boolean; } const PasswordInput = React.forwardRef( ({ className, showToggle = true, ...props }, ref) => { const [showPassword, setShowPassword] = React.useState(false) const [isFocused, setIsFocused] = React.useState(false) return (
{ setIsFocused(true) props.onFocus?.(e) }} onBlur={(e) => { setIsFocused(false) props.onBlur?.(e) }} {...props} /> {showToggle && ( )}
) } ) PasswordInput.displayName = "PasswordInput" export { PasswordInput }