{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"fizz-menu","type":"registry:ui","title":"Fizz Menu","description":"A pill navbar whose toggle bursts into a cloud of springy bubble links that pop in one after another.","dependencies":["motion"],"registryDependencies":[],"files":[{"path":"registry/ui/fizz-menu.tsx","type":"registry:ui","content":"\"use client\";\n\nimport { useEffect, useId, useRef, useState, type ReactNode } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nexport interface FizzMenuItem {\n  label: string;\n  href: string;\n  /** Bubble color on hover/focus. */\n  color?: string;\n}\n\nexport interface FizzMenuProps {\n  items: FizzMenuItem[];\n  /** Content of the left pill, usually your logo. */\n  logo?: ReactNode;\n  /** `fixed` pins to the viewport, `absolute` keeps it inside the nearest positioned parent. */\n  position?: \"fixed\" | \"absolute\";\n  /** Seconds between bubbles popping in. */\n  stagger?: number;\n  /** Max resting tilt of a bubble in degrees. */\n  tilt?: number;\n  /** Size of the bubble labels in px. */\n  fontSize?: number;\n  /** Start with the menu open. */\n  defaultOpen?: boolean;\n  className?: string;\n}\n\n// Deterministic per-index wobble so SSR and client agree.\nconst wobble = [-1, 0.7, -0.4, 0.9, -0.8, 0.5, -0.6, 1];\n\nexport function FizzMenu({\n  items,\n  logo = \"bubble\",\n  position = \"fixed\",\n  stagger = 0.07,\n  tilt = 6,\n  fontSize = 34,\n  defaultOpen = false,\n  className,\n}: FizzMenuProps) {\n  const [open, setOpen] = useState(defaultOpen);\n  const toggle = useRef<HTMLButtonElement>(null);\n  const reduce = useReducedMotion();\n  const id = useId();\n\n  useEffect(() => {\n    if (!open) return;\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key !== \"Escape\") return;\n      setOpen(false);\n      toggle.current?.focus();\n    };\n    window.addEventListener(\"keydown\", onKey);\n    return () => window.removeEventListener(\"keydown\", onKey);\n  }, [open]);\n\n  const pos = position === \"fixed\" ? \"fixed\" : \"absolute\";\n  const pill = \"rounded-full border border-border bg-card text-foreground shadow-[0_10px_30px_-10px_rgba(0,0,0,.5)]\";\n\n  return (\n    <div className={`contents ${className ?? \"\"}`}>\n      <nav className={`${pos} inset-x-0 top-0 z-50 flex items-center justify-between p-5`} aria-label=\"Main\">\n        <motion.div className={`${pill} flex h-14 items-center px-6 text-lg font-semibold tracking-tight`} animate={{ scale: open ? 0.96 : 1 }}>\n          {logo}\n        </motion.div>\n        <motion.button\n          ref={toggle}\n          type=\"button\"\n          aria-expanded={open}\n          aria-controls={id}\n          aria-label={open ? \"Close menu\" : \"Open menu\"}\n          onClick={() => setOpen((o) => !o)}\n          whileTap={{ scale: 0.9 }}\n          className={`${pill} relative grid size-14 place-items-center outline-none focus-visible:ring-2 focus-visible:ring-ring`}\n        >\n          {[-1, 1].map((s) => (\n            <motion.span\n              key={s}\n              aria-hidden\n              className=\"absolute h-[2px] w-5 rounded-full bg-current\"\n              animate={open ? { y: 0, rotate: s * 45 } : { y: s * 4, rotate: 0 }}\n              transition={{ type: \"spring\", stiffness: 400, damping: 22 }}\n            />\n          ))}\n        </motion.button>\n      </nav>\n\n      <AnimatePresence>\n        {open && (\n          <motion.div\n            id={id}\n            className={`${pos} inset-0 z-40 flex items-center justify-center bg-background/40 px-6 pt-20 pb-6 backdrop-blur-md`}\n            initial={{ opacity: 0 }}\n            animate={{ opacity: 1 }}\n            exit={{ opacity: 0, transition: { delay: reduce ? 0 : items.length * 0.03 } }}\n            onClick={(e) => e.target === e.currentTarget && setOpen(false)}\n          >\n            <ul className=\"flex max-w-3xl flex-wrap items-center justify-center gap-4\">\n              {items.map((item, i) => {\n                const r = wobble[i % wobble.length] * tilt;\n                return (\n                  <motion.li\n                    key={item.label}\n                    initial={reduce ? { opacity: 0 } : { scale: 0, rotate: r * 3, opacity: 0 }}\n                    animate={{ scale: 1, rotate: r, opacity: 1 }}\n                    exit={reduce ? { opacity: 0 } : { scale: 0, opacity: 0, transition: { duration: 0.18, delay: (items.length - 1 - i) * 0.03 } }}\n                    transition={{ type: \"spring\", stiffness: 380, damping: 16, delay: reduce ? 0 : i * stagger }}\n                  >\n                    <motion.a\n                      href={item.href}\n                      onClick={() => setOpen(false)}\n                      whileHover={{ scale: 1.06, rotate: -r }}\n                      whileFocus={{ scale: 1.06, rotate: -r }}\n                      whileTap={{ scale: 0.95 }}\n                      className={`block rounded-full bg-foreground px-9 py-4 text-background shadow-[0_14px_40px_-12px_rgba(0,0,0,.6)] font-semibold tracking-tight outline-none transition-colors duration-200 hover:bg-[var(--bubble)] hover:text-white focus-visible:bg-[var(--bubble)] focus-visible:text-white`}\n                      style={{ fontSize, [\"--bubble\" as string]: item.color ?? \"var(--primary)\" }}\n                    >\n                      {item.label}\n                    </motion.a>\n                  </motion.li>\n                );\n              })}\n            </ul>\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </div>\n  );\n}\n"}]}