{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dropzone-spreadsheet-import-card",
  "title": "Spreadsheet Import",
  "description": "A single spreadsheet upload feeding a mapping workflow.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "@retab/dropzone",
    "@retab/file-thumbnail",
    "@retab/file-size-format",
    "@retab/utils"
  ],
  "files": [
    {
      "path": "registry/new-york-v4/blocks/dropzone-spreadsheet-import-card.tsx",
      "content": "\"use client\";\n\nimport { Table2, X } from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { useDropzone } from \"@/components/ui/dropzone\";\nimport { formatFileSize } from \"@/components/ui/file-size-format\";\nimport { FileThumbnail } from \"@/components/ui/file-thumbnail\";\n\nimport {\n  RejectionRows,\n  type DropzoneExampleProps,\n} from \"./dropzone-example-shared\";\n\nexport function SpreadsheetImportCard({ className }: DropzoneExampleProps) {\n  const dropzone = useDropzone({\n    accept:\n      \".csv,.xls,.xlsx,text/csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n    maxFiles: 1,\n  });\n  const selectedFile = dropzone.files[0];\n\n  return (\n    <section\n      {...dropzone.getRootProps({\n        className: cn(\n          \"rounded-lg border bg-background p-4 transition-colors\",\n          dropzone.isDragging && \"border-foreground/40 bg-accent/35\",\n          className,\n        ),\n      })}\n    >\n      <input {...dropzone.getInputProps({ className: \"hidden\" })} />\n      <div className=\"flex items-start justify-between gap-3\">\n        <div>\n          <div className=\"flex items-center gap-2 text-sm font-medium\">\n            <Table2 className=\"text-muted-foreground size-4\" aria-hidden />\n            Spreadsheet mapper\n          </div>\n          <div className=\"text-muted-foreground mt-1 text-xs\">\n            A single sheet feeds a mapping workflow.\n          </div>\n        </div>\n        <button\n          {...dropzone.getTriggerProps({\n            native: true,\n            className:\n              \"inline-flex h-8 shrink-0 cursor-pointer items-center rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/24\",\n          })}\n        >\n          Choose\n        </button>\n      </div>\n      <div className=\"bg-muted/20 mt-4 rounded-md border border-dashed p-3\">\n        {selectedFile ? (\n          <div className=\"space-y-3\">\n            <div className=\"flex min-w-0 items-center gap-3\">\n              <FileThumbnail\n                file={selectedFile.file}\n                previewAspectRatio={1}\n                className=\"bg-background size-12 shrink-0\"\n              />\n              <div className=\"min-w-0 flex-1\">\n                <div className=\"truncate text-sm font-medium\">\n                  {selectedFile.file.name}\n                </div>\n                <div className=\"text-muted-foreground text-xs\">\n                  {formatFileSize(selectedFile.file.size)}\n                </div>\n              </div>\n              <button\n                type=\"button\"\n                aria-label={`Remove ${selectedFile.file.name}`}\n                className=\"text-muted-foreground hover:bg-background hover:text-foreground grid size-7 shrink-0 place-items-center rounded-md\"\n                onClick={dropzone.clearFiles}\n              >\n                <X className=\"size-4\" aria-hidden />\n              </button>\n            </div>\n            <div className=\"grid grid-cols-3 gap-2 text-xs\">\n              {[\"Name\", \"Email\", \"Amount\"].map((column) => (\n                <div\n                  key={column}\n                  className=\"bg-background rounded-md border px-2 py-1.5 text-center font-medium\"\n                >\n                  {column}\n                </div>\n              ))}\n            </div>\n          </div>\n        ) : (\n          <div\n            {...dropzone.getTriggerProps({\n              className:\n                \"grid min-h-32 cursor-pointer place-items-center rounded-md bg-background text-center text-xs text-muted-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/24\",\n            })}\n          >\n            Drop CSV or XLSX to preview columns.\n          </div>\n        )}\n      </div>\n      <RejectionRows rejections={dropzone.lastIntake.fileRejections} />\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "@components/blocks/dropzone-spreadsheet-import-card.tsx"
    },
    {
      "path": "registry/new-york-v4/blocks/dropzone-example-shared.tsx",
      "content": "\"use client\";\n\nimport { FileText, X } from \"lucide-react\";\n\nimport type {\n  DropzoneFileItem,\n  DropzoneFileRejection,\n} from \"@/components/ui/dropzone\";\nimport { formatFileSize } from \"@/components/ui/file-size-format\";\n\nexport type DropzoneExampleProps = {\n  className?: string;\n};\n\nexport function InlineFileRows({\n  files,\n  onRemove,\n}: {\n  files: DropzoneFileItem[];\n  onRemove: (fileId: string) => void;\n}) {\n  if (files.length === 0) return null;\n\n  return (\n    <div className=\"mt-3 space-y-1\">\n      {files.map((item) => (\n        <div\n          key={item.id}\n          className=\"bg-background flex min-w-0 items-center gap-2 rounded-md border px-2 py-1.5 text-xs\"\n        >\n          <FileText className=\"text-muted-foreground size-3.5 shrink-0\" />\n          <div className=\"min-w-0 flex-1 truncate\">{item.file.name}</div>\n          <div className=\"text-muted-foreground shrink-0\">\n            {formatFileSize(item.file.size)}\n          </div>\n          <button\n            type=\"button\"\n            aria-label={`Remove ${item.file.name}`}\n            className=\"text-muted-foreground hover:bg-muted hover:text-foreground grid size-5 shrink-0 place-items-center rounded-[4px]\"\n            onClick={() => onRemove(item.id)}\n          >\n            <X className=\"size-3\" aria-hidden />\n          </button>\n        </div>\n      ))}\n    </div>\n  );\n}\n\nexport function RejectionRows({\n  rejections,\n}: {\n  rejections: DropzoneFileRejection[];\n}) {\n  if (rejections.length === 0) return null;\n\n  return (\n    <div className=\"text-destructive mt-3 space-y-1 text-xs\">\n      {rejections.map((rejection) => (\n        <div key={`${rejection.file.name}-${rejection.reason}`}>\n          {rejection.file.name}: {getDropzoneRejectionMessage(rejection)}\n        </div>\n      ))}\n    </div>\n  );\n}\n\nfunction getDropzoneRejectionMessage(rejection: DropzoneFileRejection): string {\n  if (rejection.reason === \"file-invalid-type\") {\n    return \"This file type is not supported here.\";\n  }\n  if (rejection.reason === \"file-too-large\") {\n    return `File must be ${formatFileSize(rejection.maxSize)} or smaller.`;\n  }\n  if (rejection.reason === \"custom\") {\n    return rejection.code;\n  }\n  return rejection.maxFiles === 1\n    ? \"Only one file can be selected.\"\n    : `Only ${rejection.maxFiles} files can be selected.`;\n}\n",
      "type": "registry:component",
      "target": "@components/blocks/dropzone-example-shared.tsx"
    }
  ],
  "categories": [
    "dropzone"
  ],
  "type": "registry:block"
}