/** * Copyright (c) 2023-present Plane Software, Inc. and contributors * SPDX-License-Identifier: AGPL-3.0-only * See the LICENSE file for details. */ import React, { useState } from "react"; import type { Control } from "react-hook-form"; import { Controller } from "react-hook-form"; // icons import { Eye, EyeOff } from "lucide-react"; // plane internal packages import { Input } from "@plane/ui"; import { cn } from "@plane/utils"; type Props = { control: Control; type: "text" | "password"; name: string; label: string; description?: string | React.ReactNode; placeholder: string; error: boolean; required: boolean; }; export type TControllerInputFormField = { key: string; type: "text" | "password"; label: string; description?: string | React.ReactNode; placeholder: string; error: boolean; required: boolean; }; export function ControllerInput(props: Props) { const { name, control, type, label, description, placeholder, error, required } = props; // states const [showPassword, setShowPassword] = useState(false); return (

{label}

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

{description}

}
); }