import type { LucideIcon } from "lucide-react"; import type { BaseFormBuilderProps, GenericFormElementProps, } from "./DynamicForm.js"; import { Input } from "../UI/Input.js"; import { Controller, FieldValues } from "react-hook-form"; export interface InputFieldProps extends BaseFormBuilderProps { type: "text" | "number" | "password"; properties?: { prefix?: string; suffix?: string; action?: { icon: LucideIcon; onClick: () => void; }; }; } export function GenericInput({ control, disabled, field, }: GenericFormElementProps>) { return ( ( onChange( field.type === "number" ? parseInt(e.target.value) : e.target.value, ) } disabled={disabled} {...field.properties} {...rest} /> )} /> ); }