{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dock",
  "type": "registry:component",
  "title": "Dock",
  "description": "A macOS-style dock whose icons swell smoothly as the cursor passes over them, with a label tooltip on each.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "components",
    "dock",
    "macos",
    "magnify",
    "navigation",
    "toolbar",
    "hover"
  ],
  "docs": "https://hyperblur.dev/effects/dock",
  "files": [
    {
      "path": "registry/hyperblur/dock.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/dock.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface DockItem {\n  id: string;\n  label: string;\n  icon: React.ReactNode;\n  onClick?: () => void;\n  href?: string;\n}\n\nexport interface DockProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n  items: DockItem[];\n  magnification?: number;\n  distance?: number;\n  size?: number;\n  position?: \"bottom\" | \"top\";\n}\n\nconst css = `\n.hb-dk { position: relative; display: inline-block; }\n.hb-dk-list {\n  position: relative;\n  display: flex;\n  align-items: flex-end;\n  gap: 8px;\n  margin: 0;\n  padding: 8px;\n  list-style: none;\n  border-radius: 18px;\n  background: rgba(255,255,255,.07);\n  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);\n  -webkit-backdrop-filter: blur(12px);\n  backdrop-filter: blur(12px);\n}\n.hb-dk[data-position=\"top\"] .hb-dk-list { align-items: flex-start; }\n.hb-dk-item {\n  position: relative;\n  flex: 0 0 auto;\n  width: var(--hb-size);\n  height: var(--hb-size);\n  transform: translate3d(var(--hb-x, 0px), 0, 0);\n  transition: transform .35s cubic-bezier(.2, .9, .2, 1);\n}\n.hb-dk-btn {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  box-sizing: border-box;\n  width: 100%;\n  height: 100%;\n  margin: 0;\n  padding: 0;\n  border: 0;\n  border-radius: 22%;\n  color: #fff;\n  font: inherit;\n  text-decoration: none;\n  cursor: pointer;\n  background: linear-gradient(160deg, rgba(255,255,255,.2), rgba(255,255,255,.06));\n  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 6px 16px rgba(0,0,0,.35);\n  transform: scale(var(--hb-s, 1));\n  transform-origin: 50% 100%;\n  transition: transform .35s cubic-bezier(.2, .9, .2, 1);\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-dk[data-position=\"top\"] .hb-dk-btn { transform-origin: 50% 0; }\n.hb-dk[data-active=\"true\"] .hb-dk-item,\n.hb-dk[data-active=\"true\"] .hb-dk-btn { transition-duration: .12s; transition-timing-function: ease-out; }\n.hb-dk-btn > svg { width: 50%; height: 50%; }\n.hb-dk-btn:focus-visible { outline: 2px solid #2f7bff; outline-offset: 3px; }\n.hb-dk-tip {\n  position: absolute;\n  left: 50%;\n  bottom: calc(var(--hb-size) * var(--hb-s, 1) + 10px);\n  z-index: 2;\n  padding: 4px 9px;\n  border-radius: 8px;\n  color: #fff;\n  font-size: 12px;\n  line-height: 1.3;\n  white-space: nowrap;\n  pointer-events: none;\n  background: rgba(20,20,20,.92);\n  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);\n  opacity: 0;\n  transform: translate3d(-50%, 4px, 0);\n  transition: opacity .15s ease, transform .15s ease, bottom .12s ease-out, top .12s ease-out;\n}\n.hb-dk[data-position=\"top\"] .hb-dk-tip {\n  bottom: auto;\n  top: calc(var(--hb-size) * var(--hb-s, 1) + 10px);\n  transform: translate3d(-50%, -4px, 0);\n}\n.hb-dk-item:hover .hb-dk-tip,\n.hb-dk-btn:focus-visible + .hb-dk-tip { opacity: 1; transform: translate3d(-50%, 0, 0); }\n@media (prefers-reduced-motion: reduce) {\n  .hb-dk-item, .hb-dk-btn { transform: none; transition: none; }\n  .hb-dk-tip { transition: opacity .01s linear; }\n}\n`;\n\nexport function Dock({\n  items,\n  magnification = 1.6,\n  distance = 120,\n  size = 48,\n  position = \"bottom\",\n  className = \"\",\n  style,\n  onPointerMove,\n  onPointerLeave,\n  ...rest\n}: DockProps) {\n  const rootRef = React.useRef<HTMLElement>(null);\n  const listRef = React.useRef<HTMLUListElement>(null);\n\n  function handleMove(e: React.PointerEvent<HTMLElement>) {\n    onPointerMove?.(e);\n    if (e.pointerType === \"touch\") return;\n    if (typeof window.matchMedia === \"function\" && window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    const list = listRef.current;\n    const root = rootRef.current;\n    if (!list || !root) return;\n    const x = e.clientX - list.getBoundingClientRect().left;\n    const nodes = Array.from(list.children) as HTMLElement[];\n    const reach = Math.max(1, distance);\n    const scales = nodes.map((node) => {\n      const center = node.offsetLeft + node.offsetWidth / 2;\n      const t = Math.min(1, Math.abs(x - center) / reach);\n      return 1 + (magnification - 1) * ((1 + Math.cos(Math.PI * t)) / 2);\n    });\n    const extras = scales.map((s) => (s - 1) * size);\n    const total = extras.reduce((sum, v) => sum + v, 0);\n    let before = 0;\n    nodes.forEach((node, i) => {\n      const shift = before + extras[i] / 2 - total / 2;\n      before += extras[i];\n      node.style.setProperty(\"--hb-s\", scales[i].toFixed(3));\n      node.style.setProperty(\"--hb-x\", `${shift.toFixed(2)}px`);\n    });\n    root.dataset.active = \"true\";\n  }\n\n  function handleLeave(e: React.PointerEvent<HTMLElement>) {\n    onPointerLeave?.(e);\n    const list = listRef.current;\n    const root = rootRef.current;\n    if (root) root.dataset.active = \"false\";\n    if (!list) return;\n    Array.from(list.children).forEach((node) => {\n      const el = node as HTMLElement;\n      el.style.removeProperty(\"--hb-s\");\n      el.style.removeProperty(\"--hb-x\");\n    });\n  }\n\n  const vars = {\n    \"--hb-size\": `${size}px`,\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <nav\n      ref={rootRef}\n      aria-label=\"Dock\"\n      className={`hb-dk ${className}`}\n      style={vars}\n      data-position={position}\n      onPointerMove={handleMove}\n      onPointerLeave={handleLeave}\n      onPointerCancel={handleLeave}\n      {...rest}\n    >\n      <style href=\"hb-dock\" precedence=\"default\">{css}</style>\n      <ul className=\"hb-dk-list\" ref={listRef}>\n        {items.map((item) => (\n          <li className=\"hb-dk-item\" key={item.id}>\n            {item.href ? (\n              <a className=\"hb-dk-btn\" href={item.href} aria-label={item.label} onClick={item.onClick}>\n                {item.icon}\n              </a>\n            ) : (\n              <button className=\"hb-dk-btn\" type=\"button\" aria-label={item.label} onClick={item.onClick}>\n                {item.icon}\n              </button>\n            )}\n            <span className=\"hb-dk-tip\" aria-hidden=\"true\">{item.label}</span>\n          </li>\n        ))}\n      </ul>\n    </nav>\n  );\n}\n"
    }
  ]
}