import { forwardRef, useId, type SelectHTMLAttributes, type ReactNode } from 'react'; import { ChevronDown } from 'lucide-react'; import { cn } from '../utils/cn'; export interface SelectOption { value: string; label: string; disabled?: boolean; } interface Props extends Omit, 'children'> { label?: string; hint?: string; error?: string; options?: SelectOption[]; placeholder?: string; containerClassName?: string; children?: ReactNode; } export const Select = forwardRef(function Select( { label, hint, error, options, placeholder, className, containerClassName, id, required, children, ...rest }, ref, ) { const generatedId = useId(); const selId = id || generatedId; const describedBy = error ? `${selId}-error` : hint ? `${selId}-hint` : undefined; return (
{label && ( )}
{hint && !error && (

{hint}

)} {error && (

{error}

)}
); });