{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "zeno-progress-demo",
  "type": "registry:block",
  "title": "Zeno Progress: Image Generation",
  "description": "Loading Progress Bar example, Image Generation: A prompt card. Generate runs Composing, Denoising and Upscaling while the model takes a random 4 to 9 seconds, so the bar is often deep in the ruler when the image arrives; the gap snaps shut and the image resolves in. Generate again for another take. A take on the progress bar (loading bar). Fits features and app UI sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "features",
    "app-ui",
    "progress-bar",
    "preloader",
    "ai-thinking-state",
    "progress",
    "loading",
    "ai",
    "canvas"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/zeno-progress#zeno-progress-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/zeno-progress.json"
  ],
  "files": [
    {
      "path": "components/zeno-progress-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion } from \"motion/react\";\n\nimport { ZenoProgress } from \"@/components/ui/zeno-progress\";\n\nconst prompts = [\n  {\n    text: \"Alpine ridge at first light, low cloud pooled in the valley, 35mm film\",\n    image: \"1464822759023-fed622ff2c3b\",\n  },\n  {\n    text: \"Still lake under a pine slope, late summer, soft overcast light\",\n    image: \"1501785888041-af3ef285b470\",\n  },\n  {\n    text: \"Snowy peaks under a clear night sky, long exposure, cold blue tones\",\n    image: \"1519681393784-d120267933ba\",\n  },\n];\n\nconst photo = (id: string) =>\n  `https://images.unsplash.com/photo-${id}?auto=format&fit=crop&w=960&h=600&q=80`;\n\ntype Phase = \"idle\" | \"running\" | \"finishing\" | \"shown\";\n\nexport function ZenoProgressDemo() {\n  const [phase, setPhase] = React.useState<Phase>(\"idle\");\n  const [take, setTake] = React.useState(0);\n  const prompt = prompts[take % prompts.length];\n\n  // The \"model\" answers after 4–9 s; the bar only finishes when it does.\n  React.useEffect(() => {\n    if (phase !== \"running\") return;\n    const timer = window.setTimeout(() => setPhase(\"finishing\"), 4000 + Math.random() * 5000);\n    return () => window.clearTimeout(timer);\n  }, [phase, take]);\n\n  // Load the next image while the bar runs, so it's ready for the reveal.\n  React.useEffect(() => {\n    const next = new Image();\n    next.src = photo(prompt.image);\n  }, [prompt.image]);\n\n  const generate = () => {\n    if (phase === \"shown\") setTake((t) => t + 1);\n    setPhase(\"running\");\n  };\n\n  const busy = phase === \"running\" || phase === \"finishing\";\n\n  return (\n    <div className=\"w-full max-w-md rounded-2xl border border-zinc-200 bg-white p-3 shadow-sm dark:border-zinc-800 dark:bg-zinc-950\">\n      <div className=\"relative aspect-[8/5] overflow-hidden rounded-xl bg-zinc-100 dark:bg-zinc-900\">\n        <AnimatePresence initial={false}>\n          {phase === \"shown\" ? (\n            <motion.img\n              key={prompt.image}\n              src={photo(prompt.image)}\n              alt={prompt.text}\n              className=\"absolute inset-0 size-full object-cover\"\n              initial={{ opacity: 0, scale: 1.06, filter: \"blur(18px)\" }}\n              animate={{ opacity: 1, scale: 1, filter: \"blur(0px)\" }}\n              exit={{ opacity: 0, transition: { duration: 0.25 } }}\n              transition={{ type: \"spring\", visualDuration: 0.7, bounce: 0 }}\n            />\n          ) : null}\n        </AnimatePresence>\n        <AnimatePresence initial={false}>\n          {phase !== \"shown\" ? (\n            <motion.div\n              key=\"empty\"\n              className=\"absolute inset-0 flex items-end p-4\"\n              initial={{ opacity: 0 }}\n              animate={{ opacity: 1 }}\n              exit={{ opacity: 0, transition: { duration: 0.3 } }}\n            >\n              <div className=\"w-full\">\n                {busy ? (\n                  <ZenoProgress\n                    key={take}\n                    done={phase === \"finishing\"}\n                    steps={[\"Composing\", \"Denoising\", \"Upscaling\"]}\n                    doneLabel=\"Ready\"\n                    interval={900}\n                    onComplete={() => window.setTimeout(() => setPhase(\"shown\"), 220)}\n                  />\n                ) : (\n                  <p className=\"text-sm text-zinc-500 dark:text-zinc-400\">Your image appears here.</p>\n                )}\n              </div>\n            </motion.div>\n          ) : null}\n        </AnimatePresence>\n      </div>\n\n      <div className=\"mt-3 flex items-end gap-3 px-1 pb-1\">\n        <div className=\"min-w-0 flex-1\">\n          <p className=\"text-xs font-medium text-zinc-400 dark:text-zinc-500\">Prompt</p>\n          <p className=\"mt-1 text-sm leading-snug text-zinc-800 dark:text-zinc-200\">{prompt.text}</p>\n        </div>\n        <button\n          type=\"button\"\n          onClick={generate}\n          disabled={busy}\n          className=\"shrink-0 rounded-full bg-zinc-900 px-4 py-2 text-sm font-medium text-white transition-[opacity,transform] active:scale-[0.97] disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-900\"\n        >\n          {phase === \"shown\" ? \"Generate again\" : \"Generate\"}\n        </button>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}