{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "floating-navigation",
  "type": "registry:ui",
  "title": "Floating Navigation",
  "description": "A sleek floating navigation bar with fluid hover pill.",
  "dependencies": [
    "react",
    "motion"
  ],
  "devDependencies": [
    "@types/react"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "ui/floating-navigation.tsx",
      "content": "'use client';\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport { motion, AnimatePresence } from 'motion/react';\nimport { cn } from '@/lib/utils';\n\n// --- Types ---\ninterface NavItem {\n  id: string;\n  label: string;\n  icon: React.ReactNode;\n}\n\ninterface FloatingNavigationProps {\n  items?: NavItem[];\n  className?: string;\n}\n\n// --- Icons (Internal SVGs for reliability) ---\nconst HomeIcon = ({ className }: { className?: string }) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width=\"24\"\n    height=\"24\"\n    viewBox=\"0 0 24 24\"\n    fill=\"none\"\n    stroke=\"currentColor\"\n    strokeWidth=\"2\"\n    strokeLinecap=\"round\"\n    strokeLinejoin=\"round\"\n    className={className}\n  >\n    <path d=\"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\" />\n    <polyline points=\"9 22 9 12 15 12 15 22\" />\n  </svg>\n);\nconst SearchIcon = ({ className }: { className?: string }) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width=\"24\"\n    height=\"24\"\n    viewBox=\"0 0 24 24\"\n    fill=\"none\"\n    stroke=\"currentColor\"\n    strokeWidth=\"2\"\n    strokeLinecap=\"round\"\n    strokeLinejoin=\"round\"\n    className={className}\n  >\n    <circle cx=\"11\" cy=\"11\" r=\"8\" />\n    <path d=\"m21 21-4.3-4.3\" />\n  </svg>\n);\nconst BellIcon = ({ className }: { className?: string }) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width=\"24\"\n    height=\"24\"\n    viewBox=\"0 0 24 24\"\n    fill=\"none\"\n    stroke=\"currentColor\"\n    strokeWidth=\"2\"\n    strokeLinecap=\"round\"\n    strokeLinejoin=\"round\"\n    className={className}\n  >\n    <path d=\"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9\" />\n    <path d=\"M10.3 21a1.94 1.94 0 0 0 3.4 0\" />\n  </svg>\n);\nconst UserIcon = ({ className }: { className?: string }) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width=\"24\"\n    height=\"24\"\n    viewBox=\"0 0 24 24\"\n    fill=\"none\"\n    stroke=\"currentColor\"\n    strokeWidth=\"2\"\n    strokeLinecap=\"round\"\n    strokeLinejoin=\"round\"\n    className={className}\n  >\n    <path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\" />\n    <circle cx=\"12\" cy=\"7\" r=\"4\" />\n  </svg>\n);\nconst SettingsIcon = ({ className }: { className?: string }) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width=\"24\"\n    height=\"24\"\n    viewBox=\"0 0 24 24\"\n    fill=\"none\"\n    stroke=\"currentColor\"\n    strokeWidth=\"2\"\n    strokeLinecap=\"round\"\n    strokeLinejoin=\"round\"\n    className={className}\n  >\n    <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.1a2 2 0 0 1-1-1.72v-.51a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n    <circle cx=\"12\" cy=\"12\" r=\"3\" />\n  </svg>\n);\n\nconst defaultItems: NavItem[] = [\n  { id: 'home', label: 'Home', icon: <HomeIcon className=\"h-5 w-5\" /> },\n  { id: 'search', label: 'Search', icon: <SearchIcon className=\"h-5 w-5\" /> },\n  { id: 'notifications', label: 'Inbox', icon: <BellIcon className=\"h-5 w-5\" /> },\n  { id: 'profile', label: 'Profile', icon: <UserIcon className=\"h-5 w-5\" /> },\n  { id: 'settings', label: 'Settings', icon: <SettingsIcon className=\"h-5 w-5\" /> },\n];\n\nconst iconVariants = {\n  home: {\n    active: { scale: 1.1, y: -2, transition: { type: 'spring', stiffness: 400, damping: 10 } },\n    inactive: { scale: 1, y: 0 },\n  },\n  search: {\n    active: {\n      rotate: [0, -10, 10, 0],\n      scale: 1.1,\n      transition: { duration: 0.5, ease: 'easeInOut' },\n    },\n    inactive: { rotate: 0, scale: 1 },\n  },\n  notifications: {\n    active: { rotate: [0, 15, -15, 10, -10, 0], transition: { duration: 0.5 } },\n    inactive: { rotate: 0 },\n  },\n  profile: {\n    active: { scale: 1.1, transition: { type: 'spring', stiffness: 300 } },\n    inactive: { scale: 1 },\n  },\n  settings: {\n    active: { rotate: 90, transition: { type: 'spring', stiffness: 200 } },\n    inactive: { rotate: 0 },\n  },\n};\n\nexport default function FloatingNavigation({\n  items = defaultItems,\n  className,\n}: FloatingNavigationProps) {\n  const [activeTab, setActiveTab] = useState(items[0].id);\n  const [hoveredTab, setHoveredTab] = useState<string | null>(null);\n  const buttonRefs = useRef<(HTMLButtonElement | null)[]>([]);\n\n  useEffect(() => {\n    buttonRefs.current = buttonRefs.current.slice(0, items.length);\n  }, [items]);\n\n  // Auto-dismiss hover tooltip after 1.5s so it never gets stuck on touch devices\n  useEffect(() => {\n    if (!hoveredTab) return;\n    const timer = setTimeout(() => {\n      setHoveredTab(null);\n    }, 1500);\n    return () => clearTimeout(timer);\n  }, [hoveredTab]);\n\n  const handleKeyDown = (e: React.KeyboardEvent, index: number) => {\n    if (e.key === 'ArrowRight') {\n      e.preventDefault();\n      const nextIndex = (index + 1) % items.length;\n      const nextId = items[nextIndex].id;\n      setActiveTab(nextId);\n      buttonRefs.current[nextIndex]?.focus();\n    } else if (e.key === 'ArrowLeft') {\n      e.preventDefault();\n      const prevIndex = (index - 1 + items.length) % items.length;\n      const prevId = items[prevIndex].id;\n      setActiveTab(prevId);\n      buttonRefs.current[prevIndex]?.focus();\n    }\n  };\n\n  return (\n    <div className={cn('fixed bottom-8 left-1/2 z-50 -translate-x-1/2', className)}>\n      <div\n        className=\"flex items-center gap-2 rounded-full border border-neutral-200 bg-white/50 p-2 shadow-[0_8px_32px_rgba(0,0,0,0.12)] backdrop-blur-xl transition-all duration-300 hover:shadow-[0_8px_40px_rgba(0,0,0,0.2)] dark:border-white/10 dark:bg-neutral-900/50\"\n        role=\"tablist\"\n      >\n        {items.map((item, index) => {\n          const isActive = activeTab === item.id;\n          const isHovered = hoveredTab === item.id;\n\n          return (\n            <button\n              key={item.id}\n              ref={(el) => {\n                buttonRefs.current[index] = el;\n              }}\n              onClick={() => {\n                setActiveTab(item.id);\n                setHoveredTab(null);\n              }}\n              onKeyDown={(e) => handleKeyDown(e, index)}\n              onMouseEnter={() => setHoveredTab(item.id)}\n              onMouseLeave={() => setHoveredTab(null)}\n              onTouchStart={() => setHoveredTab(null)}\n              className={cn(\n                'relative flex h-12 w-12 appearance-none items-center justify-center rounded-full border-none bg-transparent p-0 text-[0px] leading-none transition-colors duration-300 outline-none select-none focus:outline-none focus-visible:ring-0 focus-visible:outline-none',\n                isActive\n                  ? 'text-white'\n                  : 'text-neutral-500 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-white'\n              )}\n              style={{ WebkitTapHighlightColor: 'transparent' }}\n              role=\"tab\"\n              aria-selected={isActive}\n              tabIndex={isActive ? 0 : -1}\n            >\n              {/* Hover Background - Subtle light pill */}\n              {isHovered && !isActive && (\n                <motion.div\n                  layoutId=\"nav-hover\"\n                  className=\"absolute inset-0 rounded-full bg-neutral-100 dark:bg-white/10\"\n                  initial={{ opacity: 0, scale: 0.8 }}\n                  animate={{ opacity: 1, scale: 1 }}\n                  exit={{ opacity: 0, scale: 0.8 }}\n                  transition={{ type: 'spring', stiffness: 400, damping: 25 }}\n                />\n              )}\n\n              {/* Active Background - Glowing Pill with Gradient */}\n              {isActive && (\n                <motion.div\n                  layoutId=\"nav-active\"\n                  className=\"absolute inset-0 rounded-full bg-linear-to-b from-neutral-800 to-neutral-900 shadow-[0_0_20px_rgba(0,0,0,0.3)] dark:from-white dark:to-neutral-200 dark:shadow-[0_0_20px_rgba(255,255,255,0.4)]\"\n                  transition={{ type: 'spring', stiffness: 350, damping: 30 }}\n                />\n              )}\n\n              {/* Icon layer with unique animations */}\n              <motion.span\n                className={cn(\n                  'relative z-10 block',\n                  isActive ? 'text-white dark:text-black' : 'text-neutral-600 dark:text-neutral-400'\n                )}\n                variants={(iconVariants as any)[item.id] || iconVariants.home}\n                animate={isActive ? 'active' : 'inactive'}\n              >\n                {item.icon}\n              </motion.span>\n\n              {/* Tooltip */}\n              <AnimatePresence>\n                {isHovered && (\n                  <motion.div\n                    initial={{ opacity: 0, y: 10, scale: 0.8 }}\n                    animate={{ opacity: 1, y: -50, scale: 1 }}\n                    exit={{ opacity: 0, y: 10, scale: 0.8 }}\n                    transition={{ duration: 0.2, ease: 'easeOut' }}\n                    className=\"pointer-events-none absolute top-0 left-1/2 -translate-x-1/2 rounded-lg border border-neutral-700 bg-neutral-900 px-3 py-1.5 text-xs font-semibold whitespace-nowrap text-white shadow-xl dark:border-neutral-200 dark:bg-white dark:text-black\"\n                  >\n                    <div className=\"absolute inset-x-0 -bottom-1 mx-auto h-2 w-2 rotate-45 bg-neutral-900 dark:bg-white\" />\n                    {item.label}\n                  </motion.div>\n                )}\n              </AnimatePresence>\n            </button>\n          );\n        })}\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:ui"
    }
  ]
}