{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "nav-gooey",
  "type": "registry:component",
  "title": "Gooey Nav",
  "description": "A pill navigation whose active indicator is a gooey blob. Three blobs with different timings stretch and merge through an SVG filter as the selection moves. Arrow keys, Home and End change the selection.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "components",
    "navigation",
    "gooey",
    "svg-filter",
    "tabs",
    "indicator",
    "blob"
  ],
  "docs": "https://hyperblur.dev/effects/nav-gooey",
  "files": [
    {
      "path": "registry/hyperblur/nav-gooey.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/nav-gooey.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface NavGooeyItem {\n  value: string;\n  label: string;\n  icon?: React.ReactNode;\n}\n\nexport interface NavGooeyProps\n  extends Omit<React.HTMLAttributes<HTMLElement>, \"onChange\" | \"defaultValue\"> {\n  items?: NavGooeyItem[];\n  value?: string;\n  defaultValue?: string;\n  onChange?: (value: string) => void;\n  accent?: string;\n  gooeyness?: number;\n  label?: string;\n}\n\nconst defaultItems: NavGooeyItem[] = [\n  { value: \"home\", label: \"Home\" },\n  { value: \"explore\", label: \"Explore\" },\n  { value: \"inbox\", label: \"Inbox\" },\n  { value: \"profile\", label: \"Profile\" },\n];\n\nconst css = `\n.hb-qv4 {\n  --hb-qv4-acc: #2f7bff;\n  --hb-qv4-n: 4;\n  --hb-qv4-i: 0;\n  position: relative;\n  display: grid;\n  grid-auto-flow: column;\n  grid-auto-columns: minmax(0, 1fr);\n  box-sizing: border-box;\n  width: 100%;\n  padding: 6px;\n  border: 1px solid #262626;\n  border-radius: 999px;\n  background: #111111;\n  color: #a1a1a1;\n  font: inherit;\n  isolation: isolate;\n}\n.hb-qv4 *, .hb-qv4 *::before, .hb-qv4 *::after { box-sizing: border-box; }\n.hb-qv4-fx {\n  position: absolute;\n  inset: 6px;\n  z-index: 0;\n  pointer-events: none;\n}\n.hb-qv4-svg { position: absolute; width: 0; height: 0; overflow: hidden; }\n.hb-qv4-g {\n  position: absolute;\n  inset: 0;\n  filter: var(--hb-qv4-f);\n}\n.hb-qv4-b {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  left: 0;\n  width: calc(100% / var(--hb-qv4-n));\n  transform: translateX(calc(var(--hb-qv4-i) * 100%));\n}\n.hb-qv4-b::after {\n  content: \"\";\n  position: absolute;\n  inset: 3px;\n  border-radius: 999px;\n  background: var(--hb-qv4-acc);\n}\n.hb-qv4-b1 { transition: transform 0.62s cubic-bezier(0.5, 1.5, 0.4, 1); }\n.hb-qv4-b2 { transition: transform 0.34s cubic-bezier(0.3, 0, 0.2, 1); }\n.hb-qv4-b3 { transition: transform 0.46s cubic-bezier(0.6, -0.5, 0.3, 1.5); }\n.hb-qv4-b3::after { inset: 18% 24%; }\n.hb-qv4-it {\n  position: relative;\n  z-index: 1;\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: 0.45em;\n  min-width: 0;\n  margin: 0;\n  padding: 0.62em 0.4em;\n  font: inherit;\n  font-size: 0.875em;\n  font-weight: 600;\n  line-height: 1.2;\n  color: inherit;\n  background: transparent;\n  border: 0;\n  border-radius: 999px;\n  cursor: pointer;\n  white-space: nowrap;\n  -webkit-tap-highlight-color: transparent;\n  transition: color 0.3s ease;\n}\n.hb-qv4-it:hover { color: #ededed; }\n.hb-qv4-it[aria-current=\"true\"] { color: #ffffff; }\n.hb-qv4-it:focus-visible { outline: 2px solid #7fb3ff; outline-offset: -2px; }\n.hb-qv4-ic { display: inline-flex; width: 1.1em; height: 1.1em; }\n.hb-qv4-ic > svg { width: 100%; height: 100%; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-qv4-b1, .hb-qv4-b2, .hb-qv4-b3, .hb-qv4-it { transition: none; }\n}\n`;\n\nexport function NavGooey({\n  items = defaultItems,\n  value,\n  defaultValue,\n  onChange,\n  accent = \"#2f7bff\",\n  gooeyness = 7,\n  label = \"Primary\",\n  className = \"\",\n  style,\n  onKeyDown,\n  ...rest\n}: NavGooeyProps) {\n  const uid = React.useId().replace(/[^a-zA-Z0-9]/g, \"\");\n  const filterId = `hb-qv4-f-${uid}`;\n  const [inner, setInner] = React.useState(defaultValue ?? items[0]?.value ?? \"\");\n  const current = value ?? inner;\n  const refs = React.useRef<Array<HTMLButtonElement | null>>([]);\n  const index = Math.max(0, items.findIndex((it) => it.value === current));\n\n  function select(next: number, focus: boolean) {\n    const target = items[next];\n    if (!target) return;\n    if (value === undefined) setInner(target.value);\n    onChange?.(target.value);\n    if (focus) refs.current[next]?.focus();\n  }\n\n  function handleKey(e: React.KeyboardEvent<HTMLElement>) {\n    onKeyDown?.(e);\n    if (e.defaultPrevented) return;\n    const last = items.length - 1;\n    let next = -1;\n    if (e.key === \"ArrowRight\" || e.key === \"ArrowDown\") next = index >= last ? 0 : index + 1;\n    else if (e.key === \"ArrowLeft\" || e.key === \"ArrowUp\") next = index <= 0 ? last : index - 1;\n    else if (e.key === \"Home\") next = 0;\n    else if (e.key === \"End\") next = last;\n    if (next < 0) return;\n    e.preventDefault();\n    select(next, true);\n  }\n\n  const vars = {\n    \"--hb-qv4-acc\": accent,\n    \"--hb-qv4-n\": items.length,\n    \"--hb-qv4-i\": index,\n    \"--hb-qv4-f\": `url(#${filterId})`,\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <>\n      <style href=\"hb-nav-gooey\" precedence=\"default\">{css}</style>\n      <nav\n        aria-label={label}\n        className={`hb-qv4 ${className}`}\n        style={vars}\n        onKeyDown={handleKey}\n        {...rest}\n      >\n        <svg className=\"hb-qv4-svg\" aria-hidden=\"true\" focusable=\"false\">\n          <defs>\n            <filter id={filterId} x=\"-10%\" y=\"-60%\" width=\"120%\" height=\"220%\" colorInterpolationFilters=\"sRGB\">\n              <feGaussianBlur in=\"SourceGraphic\" stdDeviation={gooeyness} result=\"blur\" />\n              <feColorMatrix\n                in=\"blur\"\n                mode=\"matrix\"\n                values=\"1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 22 -10\"\n              />\n            </filter>\n          </defs>\n        </svg>\n        <div className=\"hb-qv4-fx\" aria-hidden=\"true\">\n          <div className=\"hb-qv4-g\">\n            <span className=\"hb-qv4-b hb-qv4-b1\" />\n            <span className=\"hb-qv4-b hb-qv4-b2\" />\n            <span className=\"hb-qv4-b hb-qv4-b3\" />\n          </div>\n        </div>\n        {items.map((item, i) => (\n          <button\n            key={item.value}\n            ref={(node) => {\n              refs.current[i] = node;\n            }}\n            type=\"button\"\n            className=\"hb-qv4-it\"\n            aria-current={i === index ? \"true\" : undefined}\n            tabIndex={i === index ? 0 : -1}\n            onClick={() => select(i, false)}\n          >\n            {item.icon ? <span className=\"hb-qv4-ic\" aria-hidden=\"true\">{item.icon}</span> : null}\n            {item.label}\n          </button>\n        ))}\n      </nav>\n    </>\n  );\n}\n"
    }
  ]
}