import * as React from 'react'; import { cn } from '../lib/utils.ts'; interface FormFieldProps { id: string; name: string; label: string; type?: string; // 'text', 'email', 'datetime-local', etc. For input elements value: string; onChange: (e: React.ChangeEvent) => void; required?: boolean; placeholder?: string; instruction?: string; fieldType?: 'input' | 'textarea'; rows?: number; // for textarea autoComplete?: string; inputPrefix?: string; // New prop for the prefix error?: boolean; // New prop for validation state icon?: React.ReactNode; // New prop for icon } const FormField: React.FC = ({ id, name, label, type = 'text', value, onChange, required = false, placeholder = '', instruction, fieldType = 'input', rows = 4, autoComplete, inputPrefix, error = false, icon, }) => { const dateTimeStyles = type.includes('date') || type.includes('time') ? { colorScheme: 'light' } : {}; const renderInput = () => { const finalInputClasses = cn( "block w-full px-4 py-3.5 bg-[#F8FAFC] border-[1.5px] rounded-xl text-sm font-medium text-[#1B3B5F] placeholder-[#9CA3AF]", "transition-all duration-300 ease-out", "focus:outline-none focus:border-[#1E90FF] focus:bg-white focus:ring-4 focus:ring-[#1E90FF]/10", "disabled:bg-slate-100 disabled:text-slate-400 disabled:border-slate-200 disabled:cursor-not-allowed", inputPrefix ? 'rounded-l-none border-l-0' : '', icon ? 'pl-11' : '', "relative min-w-0 flex-1 hover:border-[#1B3B5F]/50", error ? "border-red-500 text-red-900 placeholder-red-400 focus:border-red-500 focus:ring-red-500/10" : "border-[#1B3B5F]/20" ); if (fieldType === 'textarea') { return (