'use client' import { Button } from '@admin/components/ui/button' import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@admin/components/ui/form' import { Input } from '@admin/components/ui/input' import { cn } from '@admin/utils/shared/cn' import { Plus, Trash2 } from 'lucide-react' import { useFieldArray, useFormContext } from 'react-hook-form' interface DynamicListFieldProps { name: string label: string hideLabel?: boolean disabled?: boolean maxItems?: number placeholder?: string description?: string className?: string } export function DynamicListField({ name, label, hideLabel, disabled, maxItems, placeholder = 'Enter value', description, className }: DynamicListFieldProps) { const { control } = useFormContext() const { fields, append, remove } = useFieldArray({ control, name }) const canAddMore = !maxItems || fields.length < maxItems const handleAdd = () => { if (canAddMore) { append('') } } return (