import * as React from 'react'; import { cn } from '../lib/utils.ts'; interface Option { value: string; label: string; } interface SelectFieldProps { id: string; name: string; label: string; value: string; onChange: (e: React.ChangeEvent) => void; options: Option[]; required?: boolean; placeholder?: string; // For the default/disabled option instruction?: string; disabled?: boolean; error?: boolean; // New prop for validation state icon?: React.ReactNode; // New prop for icon } const SelectField: React.FC = ({ id, name, label, value, onChange, options, required = false, placeholder = 'Selecione uma opção', instruction, disabled = false, error = false, icon, }) => { const selectClassName = cn( "block w-full appearance-none rounded-xl border-[1.5px] bg-[#F8FAFC] px-4 py-3.5 text-sm font-medium text-[#1B3B5F]", "transition-all duration-300 ease-out", "focus:outline-none focus:border-[#1E90FF] focus:bg-white focus:ring-4 focus:ring-[#1E90FF]/10", "hover:border-[#1B3B5F]/50", "disabled:bg-slate-100 disabled:text-slate-400 disabled:border-slate-200 disabled:cursor-not-allowed", icon ? 'pl-11' : '', error ? "border-red-500 text-red-900 focus:border-red-500 focus:ring-red-500/10" : "border-[#1B3B5F]/20" ); return (
{icon && (
{icon}
)}
{instruction &&

{instruction}

}
); }; export default SelectField;