{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "upload-workflow-01",
  "type": "registry:block",
  "title": "File Processing Workspace",
  "description": "A file processing input panel with drag and drop, format controls, and a local demo processing state.",
  "author": "UIBlocks contributors",
  "registryDependencies": [],
  "dependencies": [
    "lucide-react@0.577.0"
  ],
  "files": [
    {
      "path": "licenses/upload-workflow-01/LICENSE.txt",
      "type": "registry:file",
      "target": "@components/uiblocks/upload-workflow-01/LICENSE.txt",
      "content": "UIBlocks original block: Copyright (c) 2026 UIBlocks contributors. Licensed under the MIT License below.\n\nIncludes source from Blocks.so and its bundled primitives.\nSource: https://github.com/ephraimduncan/blocks\nRevision: 3f759d5171c2391253ec4c772e9e5b3db2bc7c7f\n\nMIT License\n\nCopyright (c) 2025 Ephraim Duncan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
    },
    {
      "path": "content/components/workspace/upload-workflow-01.tsx",
      "type": "registry:component",
      "target": "@components/uiblocks/upload-workflow-01/upload-workflow-01.tsx",
      "content": "\"use client\";\n\nimport {\n  ArrowRight,\n  Check,\n  FileVideo2,\n  Film,\n  LoaderCircle,\n  Plus,\n  ShieldCheck,\n  UploadCloud,\n  X,\n} from \"lucide-react\";\nimport { useId, useRef, useState } from \"react\";\n\nexport type WorkflowFile = { id: string; name: string; size: number };\nexport type UploadWorkflow01Props = {\n  title?: string;\n  description?: string;\n  files?: WorkflowFile[];\n  onFilesChange?: (files: WorkflowFile[]) => void;\n  onRun?: (files: WorkflowFile[], format: string) => void;\n  busy?: boolean;\n};\n\nconst formats = [\"MP4\", \"WebM\", \"GIF\"];\nconst supportedExtension = /\\.(mp4|mov|webm|mkv)$/i;\n\n/** Browser-only file selection. The demo never uploads or transcodes media. */\nexport default function UploadWorkflow01({\n  title = \"Make something ready to share.\",\n  description = \"Add your videos, choose an output, and try the workflow.\",\n  files: controlledFiles,\n  onFilesChange,\n  onRun,\n  busy = false,\n}: UploadWorkflow01Props = {}) {\n  const [localFiles, setLocalFiles] = useState<WorkflowFile[]>([]);\n  const [format, setFormat] = useState(\"MP4\");\n  const [isDragging, setIsDragging] = useState(false);\n  const [error, setError] = useState(\"\");\n  const [notice, setNotice] = useState(\"\");\n  const inputRef = useRef<HTMLInputElement>(null);\n  const inputId = useId();\n  const files = controlledFiles ?? localFiles;\n\n  function updateFiles(next: WorkflowFile[]) {\n    setLocalFiles(next);\n    onFilesChange?.(next);\n    setNotice(\"\");\n  }\n\n  function addFiles(selected: FileList | null) {\n    if (!selected || busy) return;\n    const incoming = Array.from(selected);\n    const invalid = incoming.find(\n      (file) =>\n        !supportedExtension.test(file.name) || file.size > 200 * 1024 * 1024\n    );\n    if (invalid) {\n      setError(\"Choose MP4, MOV, WebM, or MKV videos up to 200 MB each.\");\n      return;\n    }\n    if (files.length + incoming.length > 10) {\n      setError(\"You can add up to 10 videos to a demo batch.\");\n      return;\n    }\n    setError(\"\");\n    updateFiles([\n      ...files,\n      ...incoming.map((file, index) => ({\n        id: `${file.name}-${file.lastModified}-${index}-${crypto.randomUUID()}`,\n        name: file.name,\n        size: file.size,\n      })),\n    ]);\n  }\n\n  return (\n    <section\n      className=\"min-w-0 w-full rounded-2xl border border-zinc-200 bg-white p-5 text-zinc-950 shadow-sm shadow-zinc-950/[0.02] sm:p-6 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50\"\n      aria-labelledby={`${inputId}-title`}\n    >\n      <div className=\"flex items-start gap-3\">\n        <span className=\"grid size-9 shrink-0 place-items-center rounded-xl bg-violet-50 text-violet-600 dark:bg-violet-950/40 dark:text-violet-400\">\n          <Film aria-hidden=\"true\" className=\"size-4\" />\n        </span>\n        <div>\n          <h2\n            className=\"text-base font-semibold tracking-tight\"\n            id={`${inputId}-title`}\n          >\n            {title}\n          </h2>\n          <p className=\"mt-1 text-xs leading-5 text-zinc-500 dark:text-zinc-400\">\n            {description}\n          </p>\n        </div>\n      </div>\n      <div\n        className={`mt-6 rounded-xl border border-dashed p-6 text-center transition-colors sm:p-8 ${isDragging ? \"border-violet-500 bg-violet-50 dark:bg-violet-950/30\" : \"border-zinc-300 bg-zinc-50/70 dark:border-zinc-700 dark:bg-zinc-900/50\"}`}\n        onDragOver={(event) => {\n          event.preventDefault();\n          if (!busy) setIsDragging(true);\n        }}\n        onDragLeave={() => setIsDragging(false)}\n        onDrop={(event) => {\n          event.preventDefault();\n          setIsDragging(false);\n          addFiles(event.dataTransfer.files);\n        }}\n      >\n        <span className=\"mx-auto grid size-11 place-items-center rounded-xl border border-zinc-200 bg-white text-zinc-500 shadow-sm dark:border-zinc-700 dark:bg-zinc-900\">\n          <UploadCloud aria-hidden=\"true\" className=\"size-5\" />\n        </span>\n        <p className=\"mt-4 text-sm font-medium\">Drop your videos here</p>\n        <p className=\"mt-1 text-xs text-zinc-500 dark:text-zinc-400\">\n          MP4, MOV, WebM, MKV · Up to 200 MB each\n        </p>\n        <input\n          accept=\".mp4,.mov,.webm,.mkv\"\n          aria-label=\"Choose videos for the demo\"\n          className=\"sr-only\"\n          disabled={busy}\n          id={inputId}\n          multiple\n          onChange={(event) => {\n            addFiles(event.target.files);\n            event.target.value = \"\";\n          }}\n          ref={inputRef}\n          type=\"file\"\n        />\n        <button\n          className=\"mt-4 inline-flex min-h-9 items-center justify-center gap-1.5 rounded-lg border border-zinc-200 bg-white px-3 text-xs font-medium text-zinc-700 shadow-sm transition-colors hover:bg-zinc-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-violet-600 disabled:opacity-50 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-200 dark:hover:bg-zinc-800\"\n          disabled={busy}\n          onClick={() => inputRef.current?.click()}\n          type=\"button\"\n        >\n          <Plus aria-hidden=\"true\" className=\"size-3.5\" /> Choose files\n        </button>\n      </div>\n      {files.length > 0 && (\n        <ul className=\"mt-4 space-y-2\" aria-label=\"Selected videos\">\n          {files.map((file) => (\n            <li\n              className=\"flex items-center gap-3 rounded-lg border border-zinc-100 bg-zinc-50/50 p-3 dark:border-zinc-800 dark:bg-zinc-900/40\"\n              key={file.id}\n            >\n              <FileVideo2\n                aria-hidden=\"true\"\n                className=\"size-4 shrink-0 text-violet-500\"\n              />\n              <div className=\"min-w-0 flex-1\">\n                <p className=\"truncate text-xs font-medium\">{file.name}</p>\n                <p className=\"mt-0.5 text-[11px] text-zinc-400\">\n                  {file.size < 1024 * 1024\n                    ? `${Math.max(1, Math.round(file.size / 1024))} KB`\n                    : `${(file.size / 1024 / 1024).toFixed(1)} MB`}\n                </p>\n              </div>\n              <button\n                aria-label={`Remove ${file.name}`}\n                className=\"grid size-8 shrink-0 place-items-center rounded-lg text-zinc-400 hover:bg-zinc-100 hover:text-zinc-800 disabled:opacity-40 dark:hover:bg-zinc-800 dark:hover:text-white\"\n                disabled={busy}\n                onClick={() =>\n                  updateFiles(files.filter((item) => item.id !== file.id))\n                }\n                type=\"button\"\n              >\n                <X aria-hidden=\"true\" className=\"size-3.5\" />\n              </button>\n            </li>\n          ))}\n        </ul>\n      )}\n      <fieldset className=\"mt-6\" disabled={busy}>\n        <legend className=\"mb-2.5 text-xs font-medium\">Output format</legend>\n        <div className=\"grid grid-cols-3 gap-2\">\n          {formats.map((item) => (\n            <label\n              className={`flex min-h-10 cursor-pointer items-center justify-between rounded-lg border px-3 text-xs transition-colors focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-violet-500 ${format === item ? \"border-violet-500 bg-violet-50/70 text-violet-700 dark:bg-violet-950/30 dark:text-violet-300\" : \"border-zinc-200 text-zinc-500 hover:border-zinc-300 dark:border-zinc-800 dark:text-zinc-400\"}`}\n              key={item}\n            >\n              <input\n                checked={format === item}\n                className=\"sr-only\"\n                name={`${inputId}-format`}\n                onChange={() => setFormat(item)}\n                type=\"radio\"\n                value={item}\n              />\n              <span>{item}</span>\n              {format === item && (\n                <Check aria-hidden=\"true\" className=\"size-3.5\" />\n              )}\n            </label>\n          ))}\n        </div>\n      </fieldset>\n      {error && (\n        <p className=\"mt-3 text-xs text-red-600 dark:text-red-400\" role=\"alert\">\n          {error}\n        </p>\n      )}\n      <button\n        className=\"mt-6 inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-xl bg-violet-600 px-4 text-sm font-medium text-white shadow-sm shadow-violet-600/10 transition-colors hover:bg-violet-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-violet-500 disabled:cursor-not-allowed disabled:opacity-45\"\n        disabled={busy || files.length === 0}\n        onClick={() => {\n          if (onRun) onRun(files, format);\n          else\n            setNotice(\n              `Demo ready: ${files.length} ${files.length === 1 ? \"video\" : \"videos\"} selected for ${format}. This preview does not convert media.`\n            );\n        }}\n        type=\"button\"\n      >\n        {busy ? (\n          <LoaderCircle aria-hidden=\"true\" className=\"size-4 animate-spin\" />\n        ) : (\n          <ArrowRight aria-hidden=\"true\" className=\"size-4\" />\n        )}\n        {busy ? \"Preparing demo…\" : `Try ${format} workflow`}\n      </button>\n      {notice && (\n        <p\n          className=\"mt-3 text-xs leading-5 text-violet-600 dark:text-violet-300\"\n          role=\"status\"\n        >\n          {notice}\n        </p>\n      )}\n      <p className=\"mt-3 flex items-start justify-center gap-1.5 text-center text-[10px] leading-4 text-zinc-400\">\n        <ShieldCheck aria-hidden=\"true\" className=\"mt-0.5 size-3 shrink-0\" />{\" \"}\n        Browser-only demo. Your videos stay on this device; no media is\n        converted.\n      </p>\n    </section>\n  );\n}\n"
    }
  ],
  "categories": [
    "workspace",
    "application",
    "clean-saas"
  ],
  "docs": "Import the default component from @components/uiblocks/upload-workflow-01/upload-workflow-01.tsx. React 19, Tailwind CSS 4, and the standard shadcn CSS theme variables are required. This block is framework-independent React and works in TanStack Start, Vite, and Next.js projects. Connect links or navigation callbacks to your host application. Demo avatars use public image URLs; replace them with your own assets. Demo handlers must be connected to your product. See https://uiblocks.org/workspace/upload-workflow-01 for content guidelines and source attribution.",
  "meta": {
    "kind": "block",
    "version": "0.1.0",
    "source": {
      "name": "UIBlocks",
      "url": "https://uiblocks.org",
      "license": "MIT",
      "author": "UIBlocks contributors",
      "revision": "uiblocks-v0.1.0"
    },
    "license": "MIT",
    "style": "clean-saas",
    "pageType": "application",
    "featured": true,
    "tags": [
      "upload",
      "dropzone",
      "file",
      "processing",
      "video",
      "workspace",
      "上传",
      "文件",
      "处理",
      "视频",
      "工作台"
    ],
    "contentGuidelines": [
      "The preview simulates processing locally; supply your own processing service.",
      "Validate supported file types and limits on both client and server in a production integration."
    ],
    "recommendedWith": [
      "task-queue-01",
      "results-gallery-01",
      "usage-panel-01"
    ],
    "entry": "@components/uiblocks/upload-workflow-01/upload-workflow-01.tsx",
    "exportName": "default",
    "frameworkIndependent": true,
    "frameworkDependencies": [],
    "compatibleHosts": [
      "react",
      "vite",
      "tanstack-start",
      "nextjs"
    ],
    "requirements": {
      "react": ">=19",
      "tailwind": ">=4"
    },
    "previewUrl": "https://uiblocks.org/preview/upload-workflow-01"
  }
}
