"use client"; import React, { useState } from "react"; import { Controller, Control } from "react-hook-form"; // icons import { Eye, EyeOff } from "lucide-react"; // ui import { Input } from "@plane/ui"; // helpers import { cn } from "@/helpers/common.helper"; type Props = { control: Control; type: "text" | "password"; name: string; label: string; description?: string | JSX.Element; placeholder: string; error: boolean; required: boolean; }; export type TControllerInputFormField = { key: string; type: "text" | "password"; label: string; description?: string | JSX.Element; placeholder: string; error: boolean; required: boolean; }; export const ControllerInput: React.FC = (props) => { const { name, control, type, label, description, placeholder, error, required } = props; // states const [showPassword, setShowPassword] = useState(false); return (

{label} {!required && "(optional)"}

( )} /> {type === "password" && (showPassword ? ( ) : ( ))}
{description &&

{description}

}
); };