{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "document-upload-form",
  "title": "Document Upload Form",
  "description": "Drag-and-drop file upload with validation.",
  "registryDependencies": [
    "@buzzform/upload",
    "@buzzform/textarea",
    "card",
    "sonner"
  ],
  "files": [
    {
      "path": "registry/shadcn/examples/document-upload-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\nconst documentSchema = defineSchema({\n  fields: [\n    {\n      type: \"upload\",\n      name: \"document\",\n      label: \"Upload Document\",\n      description: \"PDF, Word, or text files (max 10MB)\",\n      maxSize: 10 * 1024 * 1024,\n      ui: {\n        variant: \"dropzone\",\n        accept: \".pdf,.doc,.docx,.txt\",\n        dropzoneText: \"Drop your document here or click to browse\",\n      },\n    },\n    {\n      type: \"textarea\",\n      name: \"notes\",\n      label: \"Additional Notes\",\n      placeholder: \"Any notes about this document...\",\n      ui: {\n        rows: 3,\n      },\n    },\n  ],\n});\n\ntype DocumentSchema = InferType<typeof documentSchema.fields>;\n\nexport default function DocumentUploadForm() {\n  const handleSubmit = async ({ value }: { value: unknown }) => {\n    const data = value as DocumentSchema;\n    await new Promise((r) => setTimeout(r, 1000));\n    toast(\"Document uploaded successfully!\", {\n      description: (\n        <div className=\"space-y-2\">\n          <p className=\"text-[10px] text-muted-foreground\">\n            Check the console for the full File objects.\n          </p>\n          <pre className=\"max-h-40 overflow-auto rounded-md bg-muted p-3 text-xs text-muted-foreground\">\n            <code>\n              {JSON.stringify(\n                {\n                  ...data,\n                  document: data.document\n                    ? (typeof window !== \"undefined\" && data.document instanceof window.File)\n                      ? {\n                          name: data.document.name,\n                          size: data.document.size,\n                          type: data.document.type,\n                        }\n                      : data.document\n                    : null,\n                },\n                null,\n                2,\n              )}\n            </code>\n          </pre>\n        </div>\n      ),\n    });\n  };\n\n  return (\n    <Card className=\"w-full max-w-md\">\n      <CardHeader>\n        <CardTitle>Document Upload</CardTitle>\n        <CardDescription>Drag-and-drop file upload with validation</CardDescription>\n      </CardHeader>\n      <CardContent>\n        <Form schema={documentSchema} onSubmit={handleSubmit}>\n          <FormContent>\n            <FormFields className=\"space-y-4\" />\n            <FormActions className=\"mt-6\">\n              <FormReset>Clear</FormReset>\n              <FormSubmit>Upload Document</FormSubmit>\n            </FormActions>\n          </FormContent>\n        </Form>\n      </CardContent>\n    </Card>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/buzzform/examples/document-upload-form.tsx"
    }
  ],
  "type": "registry:block"
}