diff --git a/bun.lockb b/bun.lockb index 43f65d1..ed569d7 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/Modals/FormModal.tsx b/components/Modals/FormModal.tsx index 47632a2..0fcbaab 100644 --- a/components/Modals/FormModal.tsx +++ b/components/Modals/FormModal.tsx @@ -3,6 +3,7 @@ import { type ReactNode } from "react"; import * as z from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; +import { HiOutlineChevronDown } from "react-icons/hi2"; import { FieldErrors, useForm, @@ -29,6 +30,19 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select"; +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, +} from "@/components/ui/command"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; import { Textarea } from "@/components/ui/textarea"; import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; @@ -53,13 +67,33 @@ type DefaultFieldType = { value?: string | number | boolean; custom?: ReactNode; condition?: keyof z.infer> & string; - options?: { label: string; value: string; icon?: ReactNode }[]; + options?: { + label: string; + value: string; + icon?: ReactNode; + description?: string; + }[]; }; type FieldType = DefaultFieldType & ( + | { + type: "select-search"; + options: { + label: string; + description?: string; + value: string; + icon?: ReactNode; + }[]; + } | { type: "select"; - options: { label: string; value: string; icon?: ReactNode }[]; + description?: string; + options: { + label: string; + value: string; + icon?: ReactNode; + description?: string; + }[]; } | { type: FieldOptions; @@ -111,81 +145,10 @@ export default function FormModal({ condition, ...fieldProps }) => { - if (!condition) { - return ( - } - render={({ field }) => ( - - {label} - {type === "input" ? ( - - - - ) : type === "text-area" ? ( - -