{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "snow-globe",
  "title": "Snow Globe",
  "author": "VenusUI",
  "description": "A snow globe around any photo: snow drifts gently, and a shake sends a flurry.",
  "files": [
    {
      "path": "registry/default/ui/snow-globe.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface SnowGlobeProps extends React.ComponentProps<\"div\"> {\n  src: string\n  alt: string\n  /** Engraved on the base. */\n  label?: string\n  flakes?: number\n}\n\ninterface Flake {\n  x: number\n  size: number\n  duration: number\n  delay: number\n  drift: number\n}\n\n/** A flake layout that's the same on the server and the first client render. */\nconst settled = (count: number): Flake[] =>\n  Array.from({ length: count }, (_, i) => ({ x: (i * 37) % 100, size: 2 + (i % 3), duration: 7 + (i % 5), delay: -((i * 0.7) % 7), drift: ((i % 7) - 3) * 4 }))\n\n/**\n * A snow globe. A gentle snow always falls; press it (or the Shake button) to\n * shake it and send a flurry swirling round the scene.\n */\nfunction SnowGlobe({ src, alt, label = \"Greetings\", flakes = 40, className, ...props }: SnowGlobeProps) {\n  const [snow, setSnow] = React.useState(() => settled(flakes))\n  const [shakes, setShakes] = React.useState(0)\n\n  const shake = () => {\n    setShakes((value) => value + 1)\n    setSnow(\n      Array.from({ length: flakes * 2 }, () => ({\n        x: Math.random() * 100,\n        size: 2 + Math.random() * 3,\n        duration: 3 + Math.random() * 4,\n        delay: -Math.random() * 1.5,\n        drift: (Math.random() - 0.5) * 60,\n      }))\n    )\n  }\n\n  return (\n    <div data-slot=\"snow-globe\" className={cn(\"flex w-64 max-w-full flex-col items-center\", className)} {...props}>\n      <button\n        type=\"button\"\n        onClick={shake}\n        aria-label={`${alt}. Press to shake the snow globe.`}\n        key={shakes}\n        className={cn(\"relative aspect-square w-full rounded-full outline-none focus-visible:ring-4 focus-visible:ring-ring/60\", shakes > 0 && \"animate-snow-globe-shake motion-reduce:animate-none\")}\n      >\n        <span className=\"absolute inset-0 overflow-hidden rounded-full shadow-[inset_0_-12px_30px_rgb(255_255_255/0.35),inset_0_0_0_3px_rgb(255_255_255/0.5),0_14px_30px_-10px_rgb(0_0_0/0.45)]\">\n          <img src={src} alt=\"\" className=\"size-full scale-110 object-cover\" />\n          <span aria-hidden=\"true\" className=\"absolute inset-0 bg-linear-to-b from-sky-200/10 to-sky-900/20\" />\n          {snow.map((flake, i) => (\n            <span\n              key={`${shakes}-${i}`}\n              aria-hidden=\"true\"\n              className=\"animate-snow-globe-fall absolute -top-2 rounded-full bg-white/90 motion-reduce:animate-none\"\n              style={{ left: `${flake.x}%`, width: flake.size, height: flake.size, animationDuration: `${flake.duration}s`, animationDelay: `${flake.delay}s`, \"--drift\": `${flake.drift}px` } as React.CSSProperties}\n            />\n          ))}\n          <span aria-hidden=\"true\" className=\"absolute top-[8%] left-[16%] h-1/4 w-1/5 -rotate-30 rounded-full bg-white/35 blur-sm\" />\n        </span>\n      </button>\n      <div className=\"-mt-6 h-16 w-[70%] rounded-b-[2rem] rounded-t-md bg-linear-to-b from-amber-800 to-amber-950 shadow-lg\">\n        <p className=\"pt-7 text-center font-serif text-xs tracking-[0.2em] text-amber-100/90 uppercase\">{label}</p>\n      </div>\n      <button type=\"button\" onClick={shake} className=\"mt-3 rounded-md px-3 py-1.5 text-sm text-muted-foreground outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50\">\n        Shake\n      </button>\n    </div>\n  )\n}\n\nexport { SnowGlobe }\n",
      "type": "registry:ui"
    }
  ],
  "cssVars": {
    "theme": {
      "animate-snow-globe-shake": "snow-globe-shake 0.6s ease-in-out",
      "animate-snow-globe-fall": "snow-globe-fall 6s linear infinite"
    }
  },
  "css": {
    "@keyframes snow-globe-shake": {
      "0%, 100%": {
        "transform": "rotate(0)"
      },
      "25%": {
        "transform": "rotate(-8deg)"
      },
      "50%": {
        "transform": "rotate(7deg)"
      },
      "75%": {
        "transform": "rotate(-4deg)"
      }
    },
    "@keyframes snow-globe-fall": {
      "from": {
        "transform": "translate(0, 0)"
      },
      "to": {
        "transform": "translate(var(--drift), 270px)"
      }
    }
  },
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "animations",
    "cards"
  ],
  "type": "registry:ui"
}