{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "form-field",
  "type": "registry:ui",
  "title": "Form Field",
  "description": "Form Field is a shared field wrapper for label, description, required indicator, and validation placement — not a visual input.",
  "author": "Skrewww",
  "dependencies": [],
  "registryDependencies": [
    "@skrewww/validation-message",
    "@skrewww/foundation"
  ],
  "docs": "Host requirements (assumed already present, not installed by this command): react, react-dom.",
  "files": [
    {
      "path": "components/ui/FormField.tsx",
      "content": "/** @skrewww-component form-field */\n\"use client\";\n\nimport { useId, type ReactNode } from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport { ValidationMessage } from \"@/components/ui/ValidationMessage\";\nimport styles from \"@/components/ui/form-field.module.css\";\n\nexport type FormFieldProps = {\n  label: string;\n  controlId?: string;\n  required?: boolean;\n  hideLabel?: boolean;\n  supportingText?: string;\n  error?: string;\n  className?: string;\n  children: (args: {\n    controlId: string;\n    describedBy?: string;\n    invalid?: boolean;\n  }) => ReactNode;\n};\n\nexport function FormField({\n  label,\n  controlId,\n  required = false,\n  hideLabel = false,\n  supportingText,\n  error,\n  className,\n  children,\n}: FormFieldProps) {\n  const generatedId = useId();\n  const id = controlId ?? generatedId;\n  const supportingId = supportingText ? `${id}-supporting` : undefined;\n  const errorId = error ? `${id}-error` : undefined;\n  const describedBy = [errorId, !error ? supportingId : undefined].filter(Boolean).join(\" \");\n\n  return (\n    <div className={cn(styles.field, className)}>\n      <label htmlFor={id} className={hideLabel ? styles.srOnly : styles.label}>\n        {label}\n        {required ? (\n          <>\n            <span className={styles.required} aria-hidden=\"true\">\n              *\n            </span>\n            <span className=\"sr-only\"> (required)</span>\n          </>\n        ) : null}\n      </label>\n\n      {children({\n        controlId: id,\n        describedBy: describedBy || undefined,\n        invalid: Boolean(error),\n      })}\n\n      {error ? (\n        <ValidationMessage id={errorId} type=\"error\" announce=\"off\">\n          {error}\n        </ValidationMessage>\n      ) : supportingText ? (\n        <p id={supportingId} className={styles.supporting}>\n          {supportingText}\n        </p>\n      ) : null}\n    </div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "~/components/ui/FormField.tsx"
    },
    {
      "path": "components/ui/form-field.module.css",
      "content": ".field {\n  display: flex;\n  flex-direction: column;\n  gap: 0.5rem;\n  width: 100%;\n}\n\n.label {\n  font-size: 0.875rem;\n  font-weight: 500;\n  line-height: 1.4;\n  color: var(--semantic-text-primary);\n}\n\n.required {\n  margin-left: 0.125rem;\n  color: var(--semantic-text-danger);\n}\n\n.srOnly {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  padding: 0;\n  margin: -1px;\n  overflow: hidden;\n  clip: rect(0, 0, 0, 0);\n  white-space: nowrap;\n  border: 0;\n}\n\n.supporting {\n  font-size: 0.8125rem;\n  line-height: 1.4;\n  color: var(--semantic-text-secondary);\n}\n",
      "type": "registry:ui",
      "target": "~/components/ui/form-field.module.css"
    },
    {
      "path": "lib/cn.ts",
      "content": "export function cn(...classes: Array<string | false | null | undefined>): string {\n  return classes.filter(Boolean).join(\" \");\n}\n",
      "type": "registry:lib",
      "target": "~/lib/cn.ts"
    }
  ]
}
