{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "group-field-form",
  "title": "Group Field Form",
  "description": "Grouped address fields with collapsible billing section.",
  "registryDependencies": [
    "@buzzform/group",
    "@buzzform/text",
    "@buzzform/email",
    "@buzzform/checkbox",
    "@buzzform/row",
    "card",
    "sonner"
  ],
  "files": [
    {
      "path": "registry/shadcn/examples/group-field-form.tsx",
      "content": "\"use client\";\n\nimport { toast } from \"sonner\";\nimport { defineSchema, type InferType } from \"@buildnbuzz/form-react\";\nimport {\n  Form,\n  FormContent,\n  FormFields,\n  FormSubmit,\n  FormReset,\n  FormActions,\n} from \"@/registry/shadcn/form\";\nimport {\n  Card,\n  CardContent,\n  CardDescription,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\";\n\n// Schema with group field containing address information\nconst registrationSchema = defineSchema({\n  fields: [\n    {\n      type: \"text\",\n      name: \"fullName\",\n      label: \"Full Name\",\n      placeholder: \"John Doe\",\n      required: true,\n    },\n    {\n      type: \"email\",\n      name: \"email\",\n      label: \"Email Address\",\n      placeholder: \"john@example.com\",\n      required: true,\n    },\n    {\n      type: \"group\",\n      name: \"address\",\n      label: \"Shipping Address\",\n      description: \"Enter your complete shipping address\",\n      ui: {\n        variant: \"card\",\n        spacing: \"md\",\n        showErrorBadge: true,\n      },\n      fields: [\n        {\n          type: \"text\",\n          name: \"street\",\n          label: \"Street Address\",\n          placeholder: \"123 Main Street\",\n          required: true,\n        },\n        {\n          type: \"row\",\n          fields: [\n            {\n              type: \"text\",\n              name: \"city\",\n              label: \"City\",\n              placeholder: \"New York\",\n              required: true,\n              ui: { width: \"50%\" },\n            },\n            {\n              type: \"text\",\n              name: \"state\",\n              label: \"State/Province\",\n              placeholder: \"NY\",\n              required: true,\n              ui: { width: \"50%\" },\n            },\n          ],\n        },\n        {\n          type: \"row\",\n          fields: [\n            {\n              type: \"text\",\n              name: \"zipCode\",\n              label: \"ZIP/Postal Code\",\n              placeholder: \"10001\",\n              required: true,\n              ui: { width: \"50%\" },\n            },\n            {\n              type: \"text\",\n              name: \"country\",\n              label: \"Country\",\n              placeholder: \"United States\",\n              required: true,\n              ui: { width: \"50%\" },\n            },\n          ],\n        },\n      ],\n    },\n    {\n      type: \"group\",\n      name: \"billingAddress\",\n      label: \"Billing Address\",\n      description: \"Leave blank to use shipping address\",\n      ui: {\n        variant: \"bordered\",\n        spacing: \"md\",\n        collapsed: true,\n        showErrorBadge: true,\n      },\n      fields: [\n        {\n          type: \"checkbox\",\n          name: \"sameAsShipping\",\n          label: \"Same as shipping address\",\n        },\n        {\n          type: \"text\",\n          name: \"street\",\n          label: \"Street Address\",\n          placeholder: \"123 Main Street\",\n        },\n        {\n          type: \"row\",\n          fields: [\n            {\n              type: \"text\",\n              name: \"city\",\n              label: \"City\",\n              placeholder: \"New York\",\n              ui: { width: \"50%\" },\n            },\n            {\n              type: \"text\",\n              name: \"state\",\n              label: \"State/Province\",\n              placeholder: \"NY\",\n              ui: { width: \"50%\" },\n            },\n          ],\n        },\n      ],\n    },\n    {\n      type: \"checkbox\",\n      name: \"agreeToTerms\",\n      label: \"I agree to the terms and conditions\",\n      required: true,\n    },\n  ],\n});\n\ntype RegistrationSchema = InferType<typeof registrationSchema.fields>;\n\nexport default function GroupFieldExample() {\n  const handleSubmit = async ({ value }: { value: unknown }) => {\n    const data = value as RegistrationSchema;\n    await new Promise((r) => setTimeout(r, 1000));\n    toast(\"Registration complete!\", {\n      description: (\n        <pre className=\"mt-2 max-h-48 overflow-auto rounded-md bg-muted text-muted-foreground p-3 text-xs\">\n          <code>{JSON.stringify(data, null, 2)}</code>\n        </pre>\n      ),\n    });\n  };\n\n  return (\n    <Card>\n      <CardHeader>\n        <CardTitle>Shipping & Billing</CardTitle>\n        <CardDescription>\n          Grouped address fields with collapsible sections\n        </CardDescription>\n      </CardHeader>\n      <CardContent>\n        <Form schema={registrationSchema} onSubmit={handleSubmit}>\n          <FormContent>\n            <FormFields />\n            <FormActions>\n              <FormReset>Reset</FormReset>\n              <FormSubmit>Submit</FormSubmit>\n            </FormActions>\n          </FormContent>\n        </Form>\n      </CardContent>\n    </Card>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/buzzform/examples/group-field-form.tsx"
    }
  ],
  "type": "registry:block"
}