{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "glide-dock",
  "type": "registry:ui",
  "title": "Glide Dock",
  "author": "Rishabh Bose <https://theb0se.vercel.app/>",
  "description": "A floating, animated navigation dock for React that intelligently hides while scrolling down and reappears when scrolling up. Features smooth spring animations, active item indicators, and a sleek glassmorphism design powered by Framer Motion and Tailwind CSS.",
  "dependencies": [
    "framer-motion",
    "lucide-react",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "components/ui/glide-dock.tsx",
      "content": "\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { motion, AnimatePresence } from \"framer-motion\";\nimport {\n  Home,\n  Search,\n  LayoutGrid,\n  User,\n} from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\n\n\nexport interface GlideDockItem {\n  name: string;\n  icon: React.ElementType;\n  onClick: () => void;\n}\n\ninterface GlideDockProps {\n  items: GlideDockItem[];\n  className?: string;\n}\n\nconst defaultItems: GlideDockItem[] = [\n  { name: \"Home\", icon: Home, onClick: () => { } },\n  { name: \"Explore\", icon: Search, onClick: () => { } },\n  { name: \"Projects\", icon: LayoutGrid, onClick: () => { } },\n  { name: \"Profile\", icon: User, onClick: () => { } },\n];\n\n\nexport function GlideDock({ items = defaultItems, className = \"\" }: GlideDockProps) {\n  const [visible, setVisible] = useState(true);\n  const [active, setActive] = useState(\"Home\");\n\n\n  useEffect(() => {\n    let lastScrollY = window.scrollY;\n\n    const handleScroll = () => {\n      const currentScrollY = window.scrollY;\n\n      // Keep dock visible near the top\n      if (currentScrollY < 80) {\n        setVisible(true);\n      } else if (currentScrollY > lastScrollY + 5) {\n        // Scrolling down\n        setVisible(false);\n      } else if (currentScrollY < lastScrollY - 5) {\n        // Scrolling up\n        setVisible(true);\n      }\n\n      lastScrollY = currentScrollY;\n    };\n\n    window.addEventListener(\"scroll\", handleScroll, {\n      passive: true,\n    });\n\n    return () => window.removeEventListener(\"scroll\", handleScroll);\n  }, []);\n\n  return (\n    <AnimatePresence>\n      {visible && (\n        <motion.nav\n          initial={{ y: 120, opacity: 0 }}\n          animate={{ y: 0, opacity: 1 }}\n          exit={{ y: 120, opacity: 0 }}\n          transition={{\n            type: \"spring\",\n            stiffness: 200,\n            damping: 28,\n            mass: 0.85,\n          }}\n          className={cn(\n            \"fixed bottom-4 sm:bottom-6 left-1/2 z-50 -translate-x-1/2\",\n            \"w-[90vw] min-w-[90vw] max-w-[90vw]\",\n            \"sm:w-auto sm:min-w-0 sm:max-w-none\",\n            className\n          )}\n        >\n          <div className=\"flex w-full items-center justify-around gap-0.5 rounded-full border border-black/10 bg-white/85 p-1.5 shadow-2xl shadow-black/10 backdrop-blur-xl dark:border-white/10 dark:bg-zinc-950/85 dark:shadow-black/30 sm:w-auto sm:justify-center sm:gap-1 sm:p-2\">\n\n            {items.map((item) => {\n              const Icon = item.icon;\n              const isActive = active === item.name;\n\n              return (\n                <button\n                  key={item.name}\n                  onClick={() => {\n                    setActive(item.name);\n                    item.onClick();\n                  }}\n                  aria-label={item.name}\n                  aria-current={isActive ? \"page\" : undefined}\n                  className={cn(\n                    \"relative flex flex-1 items-center justify-center gap-1.5 rounded-full px-2.5 py-2.5 text-xs transition-colors duration-300\",\n                    \"sm:flex-none sm:gap-2 sm:px-4 sm:py-3 sm:text-sm\",\n                    isActive\n                      ? \"text-zinc-950 dark:text-white\"\n                      : \"text-zinc-500 hover:text-zinc-950 dark:text-zinc-400 dark:hover:text-white\"\n                  )}\n                >\n                  {isActive && (\n                    <motion.div\n                      layoutId=\"activeDock\"\n                      className=\"absolute inset-0 rounded-full bg-black/10 dark:bg-white/15\"\n                      transition={{\n                        type: \"spring\",\n                        stiffness: 350,\n                        damping: 30,\n                      }}\n                    />\n                  )}\n\n                  <Icon\n                    size={16}\n                    className=\"relative z-10 shrink-0 sm:h-[18px] sm:w-[18px]\"\n                  />\n\n                  <span className=\"relative z-10 hidden sm:block whitespace-nowrap\">\n                    {item.name}\n                  </span>\n                </button>\n              );\n            })}\n\n          </div>\n        </motion.nav>\n      )}\n    </AnimatePresence>\n  );\n}\n\nexport default GlideDock;",
      "type": "registry:ui",
      "target": "components/ui/glide-dock.tsx"
    },
    {
      "path": "lib/utils.ts",
      "content": "import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport async function copyToClipboard(text: string): Promise<boolean> {\n  if (typeof window === \"undefined\") return false;\n\n  try {\n    if (navigator.clipboard && window.isSecureContext) {\n      await navigator.clipboard.writeText(text);\n      return true;\n    }\n\n    const textArea = document.createElement(\"textarea\");\n    textArea.value = text;\n    textArea.style.position = \"fixed\";\n    textArea.style.left = \"-999999px\";\n    textArea.style.top = \"-999999px\";\n    document.body.appendChild(textArea);\n    textArea.focus();\n    textArea.select();\n    const succeeded = document.execCommand(\"copy\");\n    textArea.remove();\n    return succeeded;\n  } catch {\n    return false;\n  }\n}\n",
      "type": "registry:lib",
      "target": "lib/utils.ts"
    }
  ]
}
