"use client"; import * as React from 'react'; import { ChevronDown } from 'lucide-react'; interface SelectOption { value: string; label: string; icon?: string; } interface SelectProps { value?: string; onChange?: (value: string) => void; options: SelectOption[]; placeholder?: string; className?: string; } export function Select({ value, onChange, options, placeholder, className = '' }: SelectProps) { const [isOpen, setIsOpen] = React.useState(false); const containerRef = React.useRef(null); React.useEffect(() => { function handleClickOutside(event: MouseEvent) { if (containerRef.current && !containerRef.current.contains(event.target as Node)) { setIsOpen(false); } } document.addEventListener('mousedown', handleClickOutside); return () => { document.removeEventListener('mousedown', handleClickOutside); }; }, []); const selectedOption = options.find(option => option.value === value); return (
{isOpen && (
{options.map((option) => ( ))}
)}
); }