"use client"; import { Icon } from "@iconify/react"; import { Input } from "@nextui-org/react"; import React, { useState } from "react"; import { Control, FieldPath, FieldValues } from "react-hook-form"; import { FormControl, FormField, FormMessage } from "@/components/ui/form"; interface CustomInputProps { control: Control; name: FieldPath; label?: string; labelPlacement?: "inside" | "outside"; variant?: "flat" | "bordered" | "underlined" | "faded"; type?: string; placeholder?: string; password?: boolean; isRequired?: boolean; isInvalid?: boolean; } export const CustomInput = ({ control, name, type = "text", label = name, labelPlacement = "inside", placeholder, variant = "bordered", password = false, isRequired = true, isInvalid, }: CustomInputProps) => { const [isVisible, setIsVisible] = useState(false); const toggleVisibility = () => setIsVisible(!isVisible); const inputLabel = password ? "Password" : label; const inputType = password ? (isVisible ? "text" : "password") : type; const inputPlaceholder = password ? "Enter your password" : placeholder; const inputIsRequired = password ? true : isRequired; const endContent = password && ( ); return ( ( <> )} /> ); };