import type { InputHTMLAttributes } from "react"; interface FieldProps extends InputHTMLAttributes { label: string; error?: string; hint?: string; } export function Field({ label, id, error, hint, disabled, style, ...props }: FieldProps) { const inputId = id || `field-${label.toLowerCase().replace(/\s+/g, "-")}`; const errorId = `${inputId}-error`; const hintId = `${inputId}-hint`; return (
{ if (!error) { e.currentTarget.style.borderColor = "var(--color-gold-border-focus)"; e.currentTarget.style.boxShadow = "0 0 0 2px rgba(212, 168, 67, 0.15)"; } }} onBlur={(e) => { if (!error) { e.currentTarget.style.borderColor = "var(--color-gold-border)"; e.currentTarget.style.boxShadow = "none"; } }} {...props} /> {hint && !error && ( {hint} )} {error && ( {error} )}
); }