{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cloud-dropzone",
  "title": "Cloud Dropzone",
  "description": "Particles rise into a cloud that fills with the upload progress.",
  "dependencies": [
    "@uploadcn/core@^0.1.0",
    "@uploadcn/react@^0.1.0",
    "cn",
    "motion"
  ],
  "registryDependencies": [
    "@uploadcn/upload"
  ],
  "files": [
    {
      "path": "registry/default/blocks/cloud-dropzone.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport {\n  type UploadAdapter,\n  type Uploader,\n  type UploadItem as UploadItemData,\n  type ValidationOptions,\n} from \"@uploadcn/core\"\nimport {\n  useUploadContext,\n  useUploadProgress,\n  type UploadRootProps,\n} from \"@uploadcn/react\"\nimport { cn } from \"cn\"\nimport { motion, useReducedMotion } from \"motion/react\"\n\nimport {\n  Upload,\n  UploadDropzone,\n  UploadDropzoneDescription,\n  UploadDropzoneTitle,\n  UploadQueue,\n} from \"@/registry/default/ui/upload\"\n\ninterface CloudDropzoneProps<TResult> extends Pick<\n  ValidationOptions,\n  \"accept\" | \"maxSize\" | \"maxFiles\"\n> {\n  adapter?: UploadAdapter<TResult>\n  /** Use an uploader you created with `useUploader` instead of options. */\n  uploader?: Uploader<TResult>\n  showQueue?: boolean\n  onSuccess?: (item: UploadItemData<TResult>) => void\n  className?: string\n}\n\nconst CLOUD =\n  \"M38 58h46a20 20 0 0 0 1.6-39.94A28 28 0 0 0 31.3 22.1 18 18 0 0 0 38 58Z\"\n\n/**\n * Upload to the cloud, literally: particles rise into the cloud while\n * files upload, and the cloud fills with the progress.\n */\nfunction CloudDropzone<TResult = unknown>({\n  adapter,\n  uploader,\n  showQueue = true,\n  className,\n  ...options\n}: CloudDropzoneProps<TResult>) {\n  return (\n    <Upload\n      {...((uploader\n        ? { uploader }\n        : { adapter, ...options }) as UploadRootProps<TResult>)}\n      className={className}\n    >\n      <UploadDropzone variant=\"outline\" size=\"lg\" className=\"overflow-hidden\">\n        <Cloud />\n      </UploadDropzone>\n      {showQueue ? <UploadQueue size=\"sm\" variant=\"muted\" /> : null}\n    </Upload>\n  )\n}\n\nfunction Cloud() {\n  const { uploader } = useUploadContext()\n  const summary = useUploadProgress(uploader)\n  const reduceMotion = useReducedMotion()\n  const fill = summary.isComplete ? 100 : summary.percent\n  const active = summary.isUploading && !reduceMotion\n  const clipId = React.useId()\n\n  return (\n    <div className=\"flex flex-col items-center gap-3\">\n      <div className=\"relative h-28 w-36\" aria-hidden>\n        <svg\n          viewBox=\"0 0 120 70\"\n          className=\"absolute inset-x-0 top-0 h-20 w-full overflow-visible\"\n        >\n          <defs>\n            <clipPath id={clipId}>\n              <path d={CLOUD} />\n            </clipPath>\n          </defs>\n          <path\n            d={CLOUD}\n            className=\"fill-muted stroke-border\"\n            strokeWidth=\"1.5\"\n          />\n          <g clipPath={`url(#${clipId})`}>\n            <motion.rect\n              x=\"0\"\n              width=\"120\"\n              height=\"70\"\n              className=\"fill-primary/25\"\n              initial={false}\n              animate={{ y: 70 - (fill / 100) * 52 - 6 }}\n              transition={{ type: \"spring\", bounce: 0, duration: 0.8 }}\n            />\n          </g>\n          <motion.path\n            d=\"M48 40l12-12 12 12M60 29v22\"\n            fill=\"none\"\n            strokeWidth=\"3\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            className=\"stroke-foreground\"\n            animate={active ? { y: [0, -3, 0] } : { y: 0 }}\n            transition={{ repeat: Infinity, duration: 1.2, ease: \"easeInOut\" }}\n          />\n        </svg>\n        {/* Rising particles */}\n        {active\n          ? Array.from({ length: 7 }, (_, index) => (\n              <motion.span\n                key={index}\n                className={cn(\n                  \"absolute bottom-0 size-1.5 rounded-full bg-primary\",\n                  index % 2 ? \"opacity-60\" : \"opacity-90\"\n                )}\n                style={{ left: `${22 + index * 9}%` }}\n                initial={{ y: 0, opacity: 0 }}\n                animate={{ y: -62, opacity: [0, 1, 0] }}\n                transition={{\n                  repeat: Infinity,\n                  duration: 1.1 + (index % 3) * 0.25,\n                  delay: index * 0.17,\n                  ease: \"easeOut\",\n                }}\n              />\n            ))\n          : null}\n      </div>\n      <UploadDropzoneTitle>\n        {summary.isUploading\n          ? `Uploading to the cloud… ${Math.round(summary.percent)}%`\n          : summary.isComplete\n            ? \"Safely in the cloud\"\n            : \"Drop files to upload\"}\n      </UploadDropzoneTitle>\n      <UploadDropzoneDescription>\n        <span className=\"group-data-dragging/upload-dropzone:hidden\">\n          or click to browse\n        </span>\n        <span className=\"hidden group-data-dragging/upload-dropzone:inline\">\n          Release to upload\n        </span>\n      </UploadDropzoneDescription>\n    </div>\n  )\n}\n\nexport { CloudDropzone, type CloudDropzoneProps }\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "upload",
    "animated"
  ],
  "type": "registry:block"
}