--- /** * Rule V. A labelled field: input, select or text area in the 10px box, with * the filament drawn across its base on focus. */ import type { HTMLAttributes } from "astro/types"; type Props = { label: string; name: string; as?: "input" | "select" | "textarea"; hint?: string; error?: string; options?: (string | { value: string; label: string })[]; /** Rows for a text area. */ rows?: number; class?: string; } & HTMLAttributes<"input">; const { label, name, as = "input", hint, error, options = [], rows, class: className, id = `f-${name}`, ...rest } = Astro.props; const describedBy = [hint && `${id}-hint`, error && `${id}-error`].filter(Boolean).join(" ") || undefined; const common = { id, name, class: "gk-field", "aria-describedby": describedBy, "aria-invalid": error ? ("true" as const) : undefined }; ---