{
  "name": "label",
  "type": "ui:component",
  "title": "Label & Field",
  "description": "Accessible form Label (with required marker) and Field wrapper for composing custom inputs.",
  "dependencies": [],
  "registryDependencies": [
    "theme"
  ],
  "files": [
    {
      "path": "src/ui/label.tsx",
      "target": "src/ui/label.tsx",
      "sha256": "ded4904ad24985ba75ec1d8fdaf20abc100efd1c2ba0d9a55305048b71a02fc2",
      "content": "import './theme.css';\nimport { scope, type View } from '@fierst/aster';\n\nconst labelScope = scope`\n  :scope {\n    display: inline-flex;\n    align-items: center;\n    gap: 0.25rem;\n    font-family: var(--aster-font-sans);\n    font-size: 0.84rem;\n    font-weight: 500;\n    color: var(--aster-on-surface);\n    line-height: 1.4;\n  }\n  .req { color: var(--aster-danger); }\n`;\n\nconst fieldWrapScope = scope`\n  :scope {\n    display: grid;\n    gap: 0.375rem;\n    font-family: var(--aster-font-sans);\n  }\n  .hint { font-size: 0.78rem; color: var(--aster-on-surface-muted); }\n  .err { font-size: 0.78rem; color: var(--aster-danger); font-weight: 500; }\n`;\n\nexport function Label({\n  for: htmlFor,\n  required = false,\n  class: extraClass,\n  children,\n}: {\n  for?: string;\n  required?: boolean;\n  class?: string;\n  children?: View;\n}) {\n  return (\n    <label for={htmlFor} class={[labelScope, extraClass].filter(Boolean).join(' ')}>\n      <span>{children}</span>\n      {required ? (\n        <span class=\"req\" aria-hidden=\"true\">\n          *\n        </span>\n      ) : null}\n    </label>\n  );\n}\n\nexport function Field({\n  label,\n  for: htmlFor,\n  required = false,\n  hint,\n  error,\n  class: extraClass,\n  children,\n}: {\n  label?: string;\n  for?: string;\n  required?: boolean;\n  hint?: string;\n  error?: string | null;\n  class?: string;\n  children?: View;\n}) {\n  return (\n    <div class={[fieldWrapScope, extraClass].filter(Boolean).join(' ')}>\n      {label ? (\n        <Label for={htmlFor} required={required}>\n          {label}\n        </Label>\n      ) : null}\n      {children}\n      {error ? (\n        <span class=\"err\" role=\"alert\">\n          {error}\n        </span>\n      ) : hint ? (\n        <span class=\"hint\">{hint}</span>\n      ) : null}\n    </div>\n  );\n}\n"
    }
  ]
}
