"use client"; import { useId } from "react"; import { cn } from "@/shared/utils/cn"; interface SelectOption { value: string; label: string; } interface SelectProps extends Omit, "size"> { label?: React.ReactNode; options?: SelectOption[]; placeholder?: string; error?: React.ReactNode; hint?: React.ReactNode; selectClassName?: string; } export default function Select({ label, options = [], value, onChange, placeholder = "Select an option", error, hint, disabled = false, required = false, className, selectClassName, id: externalId, ...props }: SelectProps) { const generatedId = useId(); const selectId = externalId || generatedId; const errorId = error ? `${selectId}-error` : undefined; const hintId = hint && !error ? `${selectId}-hint` : undefined; const describedBy = [errorId, hintId].filter(Boolean).join(" ") || undefined; return (
{label && ( )}
{error && ( )} {hint && !error && (

{hint}

)}
); }