{"$schema":"https://ui.logic2b.com/schema/registry-item.json","name":"field","type":"registry:ui","description":"Composable primitives for laying out a form field (label, control slot, description, validation error) without requiring react-hook-form. Use for simple forms or to wrap a single control; use the form component instead when you need react-hook-form + zod wiring. Parts: FieldSet, FieldLegend, FieldGroup, Field (orientation vertical | horizontal | responsive), FieldContent, FieldLabel, FieldTitle, FieldDescription, FieldSeparator, FieldError.","dependencies":["class-variance-authority"],"registryDependencies":["utils","label","separator"],"files":[{"path":"ui/field.tsx","type":"registry:ui","content":"import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Label } from \"@/components/ui/label\"\nimport { Separator } from \"@/components/ui/separator\"\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n  return (\n    <fieldset\n      data-slot=\"field-set\"\n      className={cn(\n        \"flex flex-col gap-6\",\n        \"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction FieldLegend({\n  className,\n  variant = \"legend\",\n  ...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n  return (\n    <legend\n      data-slot=\"field-legend\"\n      data-variant={variant}\n      className={cn(\n        \"mb-3 font-medium\",\n        \"data-[variant=legend]:text-base\",\n        \"data-[variant=label]:text-sm\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"field-group\"\n      className={cn(\n        \"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nconst fieldVariants = cva(\n  \"group/field flex w-full gap-3 data-[invalid=true]:text-destructive\",\n  {\n    variants: {\n      orientation: {\n        vertical: \"flex-col [&>*]:w-full\",\n        horizontal: \"flex-row items-center\",\n        responsive:\n          \"flex-col @md/field-group:flex-row @md/field-group:items-center [&>.sr-only]:@md/field-group:not-sr-only\",\n      },\n    },\n    defaultVariants: {\n      orientation: \"vertical\",\n    },\n  }\n)\n\nfunction Field({\n  className,\n  orientation = \"vertical\",\n  ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\n  return (\n    <div\n      role=\"group\"\n      data-slot=\"field\"\n      data-orientation={orientation}\n      className={cn(fieldVariants({ orientation, className }))}\n      {...props}\n    />\n  )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"field-content\"\n      className={cn(\n        \"group/field-content flex flex-1 flex-col gap-1.5 leading-snug\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction FieldLabel({\n  className,\n  ...props\n}: React.ComponentProps<typeof Label>) {\n  return (\n    <Label\n      data-slot=\"field-label\"\n      className={cn(\n        \"flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 group-data-[orientation=horizontal]/field:has-[>[data-slot=field]]:w-full\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"field-title\"\n      className={cn(\n        \"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction FieldDescription({\n  className,\n  ...props\n}: React.ComponentProps<\"p\">) {\n  return (\n    <p\n      data-slot=\"field-description\"\n      className={cn(\n        \"text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance\",\n        \"last:mt-0\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction FieldSeparator({\n  children,\n  className,\n  ...props\n}: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"field-separator\"\n      data-content={!!children}\n      className={cn(\n        \"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2\",\n        className\n      )}\n      {...props}\n    >\n      <Separator className=\"absolute inset-0 top-1/2\" />\n      {children && (\n        <span\n          data-slot=\"field-separator-content\"\n          className=\"bg-background text-muted-foreground relative mx-auto block w-fit px-2\"\n        >\n          {children}\n        </span>\n      )}\n    </div>\n  )\n}\n\nfunction FieldError({\n  className,\n  children,\n  errors,\n  ...props\n}: React.ComponentProps<\"div\"> & {\n  errors?: Array<{ message?: string } | undefined>\n}) {\n  const content = React.useMemo(() => {\n    if (children) return children\n    if (!errors) return null\n\n    const filtered = errors.filter(\n      (error): error is { message?: string } => Boolean(error?.message)\n    )\n\n    if (filtered.length === 1) return filtered[0].message\n\n    return (\n      <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n        {filtered.map((error, index) => (\n          <li key={index}>{error.message}</li>\n        ))}\n      </ul>\n    )\n  }, [children, errors])\n\n  if (!content) return null\n\n  return (\n    <div\n      role=\"alert\"\n      data-slot=\"field-error\"\n      className={cn(\"text-destructive text-sm font-normal\", className)}\n      {...props}\n    >\n      {content}\n    </div>\n  )\n}\n\nexport {\n  Field,\n  FieldLabel,\n  FieldDescription,\n  FieldError,\n  FieldGroup,\n  FieldSeparator,\n  FieldSet,\n  FieldLegend,\n  FieldContent,\n  FieldTitle,\n}\n"}],"categories":["form"],"accessibility":{"support":"authored","pattern":"labelled form field","primitive":"HTML fieldset/label","keyboard":[],"aria":["Field labels, descriptions and validation messages can be associated with the nested native control."],"consumer":["Connect help and error text with aria-describedby and set aria-invalid only while the value is invalid."]},"api":{"source":"src/ui/field.tsx","exports":[{"name":"Field","kind":"component","propsType":"React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>","props":[{"name":"orientation","type":"null | \"horizontal\" | \"vertical\" | \"responsive\"","required":false,"default":"\"vertical\""}]},{"name":"FieldLabel","kind":"component","propsType":"React.ComponentProps<typeof Label>"},{"name":"FieldDescription","kind":"component","propsType":"React.ComponentProps<\"p\">"},{"name":"FieldError","kind":"component","propsType":"React.ComponentProps<\"div\"> & { errors?: Array<{ message?: string } | undefined> }","props":[{"name":"errors","type":"Array<{ message?: string } | undefined>","required":false}]},{"name":"FieldGroup","kind":"component","propsType":"React.ComponentProps<\"div\">"},{"name":"FieldSeparator","kind":"component","propsType":"React.ComponentProps<\"div\">"},{"name":"FieldSet","kind":"component","propsType":"React.ComponentProps<\"fieldset\">"},{"name":"FieldLegend","kind":"component","propsType":"React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }","props":[{"name":"variant","type":"\"legend\" | \"label\"","required":false,"default":"\"legend\""}]},{"name":"FieldContent","kind":"component","propsType":"React.ComponentProps<\"div\">"},{"name":"FieldTitle","kind":"component","propsType":"React.ComponentProps<\"div\">"}]}}