'use client' import { useState, useRef, useEffect } from 'react' interface Option { value: string label: string } interface SelectProps { value: string onChange: (value: string) => void options: Option[] className?: string } export default function Select({ value, onChange, options, className = '' }: SelectProps) { const [isOpen, setIsOpen] = useState(false) const ref = useRef(null) useEffect(() => { function handleClickOutside(event: MouseEvent) { if (ref.current && !ref.current.contains(event.target as Node)) { setIsOpen(false) } } document.addEventListener('mousedown', handleClickOutside) return () => document.removeEventListener('mousedown', handleClickOutside) }, []) const selectedOption = options.find(o => o.value === value) || options.find(o => o.value === 'custom') return (
{isOpen && (
{options.map((option) => ( ))}
)}
) }