'use client'; import { Field, Description, Button, Input } from "@headlessui/react"; import { PaperAirplaneIcon } from "@heroicons/react/24/solid"; import { useState } from "react"; export enum FieldType { number = 'number', text = 'text', radio = 'radio', checkbox = 'checkbox' } export type FormFields = { type: FieldType, name: string, label?: string, required?: boolean, default?: string, autocomplete?: boolean, placeholder?: string } const Form = ({ fields, onSubmit }: { fields: FormFields[], onSubmit: (FormData) => any }) => { const [formData, setFormData] = useState({}); const formSubmit = (e) => { e.preventDefault(); setFormData( new FormData( e.target ) ); onSubmit( formData ); } return (