'use client' import { useState, useEffect, useRef } from 'react' import Image from 'next/image' import useClickOutside from '../../hooks/useClickOutside' import { ChevronDown, X, Search } from 'lucide-react' import { FieldWrapper } from './shared' export type Option = { value: string | number label: string image?: string } export type SelectProps = { label?: string name: string value?: string | number | null onChange?: (value: string | number | null) => void options: Option[] error?: string className?: string disabled?: boolean required?: boolean placeholder?: string info?: string description?: string clearable?: boolean searchable?: boolean textSize?: 'sm' | 'md' } export default function Select({ label, name, value, onChange, options, error, className, disabled, required, placeholder = 'Select an option', info, description, clearable = true, searchable = true, textSize = 'sm', }: SelectProps) { const [isOpen, setIsOpen] = useState(false) const [searchTerm, setSearchTerm] = useState('') const [selectedOption, setSelectedOption] = useState