{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sidebar-fisheye",
  "type": "registry:component",
  "title": "Sidebar Fisheye",
  "description": "A vertical rail of glossy app tiles that swell under the pointer like a lens, with a floating label that glides to the nearest tile. Keyboard focus drives the same magnification.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "sidebars",
    "sidebar",
    "rail",
    "dock",
    "magnify",
    "icons",
    "music"
  ],
  "docs": "https://hyperblur.dev/effects/sidebar-fisheye",
  "files": [
    {
      "path": "registry/hyperblur/sidebar-fisheye.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/sidebar-fisheye.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nconst PATHS = {\n  home: \"M3.5 9.2L10 3.8l6.5 5.4V16a.8.8 0 0 1-.8.8H12v-4.5H8v4.5H4.3a.8.8 0 0 1-.8-.8z\",\n  search: \"M9 15a6 6 0 1 0 0-12 6 6 0 0 0 0 12zM13.5 13.5L17 17\",\n  music: \"M7.5 15.5V5l9-2v10.5M7.5 15.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16.5 13.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0z\",\n  mic: \"M10 12.5a2.5 2.5 0 0 0 2.5-2.5V5.5a2.5 2.5 0 0 0-5 0V10a2.5 2.5 0 0 0 2.5 2.5zM5 9.5a5 5 0 0 0 10 0M10 14.5V17\",\n  heart: \"M10 16.5S3 12.4 3 7.6A3.6 3.6 0 0 1 10 6a3.6 3.6 0 0 1 7 1.6c0 4.8-7 8.9-7 8.9z\",\n  radio: \"M4 7.5h12a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM5.5 7.5L14 3.5M12.5 12a1.8 1.8 0 1 0 0-.1M5.5 10.5h3M5.5 13.5h3\",\n  download: \"M10 3.5v9M6.5 9l3.5 3.5L13.5 9M4 16.5h12\",\n  gear: \"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zM10 2.8v2M10 15.2v2M17.2 10h-2M4.8 10h-2M15.1 4.9l-1.4 1.4M6.3 13.7l-1.4 1.4M15.1 15.1l-1.4-1.4M6.3 6.3L4.9 4.9\",\n} as const;\n\nexport type SidebarFisheyeIconName = keyof typeof PATHS;\n\nexport interface SidebarFisheyeItem {\n  id: string;\n  label: string;\n  icon?: SidebarFisheyeIconName | React.ReactNode;\n  tint?: string;\n  hint?: string;\n}\n\nexport interface SidebarFisheyeProps\n  extends Omit<React.HTMLAttributes<HTMLElement>, \"onChange\" | \"children\" | \"defaultValue\"> {\n  items?: SidebarFisheyeItem[];\n  active?: string;\n  defaultActive?: string;\n  onChange?: (id: string) => void;\n  magnify?: number;\n  radius?: number;\n  size?: number;\n  gap?: number;\n  footer?: React.ReactNode;\n  accent?: string;\n}\n\nconst defaultItems: SidebarFisheyeItem[] = [\n  { id: \"home\", label: \"Listen now\", icon: \"home\", tint: \"#ff5a5f\" },\n  { id: \"search\", label: \"Search\", icon: \"search\", tint: \"#8b5cf6\", hint: \"/\" },\n  { id: \"library\", label: \"Library\", icon: \"music\", tint: \"#2f7bff\", hint: \"1,284\" },\n  { id: \"podcasts\", label: \"Podcasts\", icon: \"mic\", tint: \"#f5a623\", hint: \"3 new\" },\n  { id: \"liked\", label: \"Liked songs\", icon: \"heart\", tint: \"#ec4899\", hint: \"412\" },\n  { id: \"radio\", label: \"Radio\", icon: \"radio\", tint: \"#14b8a6\" },\n  { id: \"downloads\", label: \"Downloads\", icon: \"download\", tint: \"#64748b\", hint: \"2.1 GB\" },\n];\n\nconst css = `\n.hb-xk4 {\n  --hb-xk4-a: #2f7bff;\n  --hb-xk4-s: 36px;\n  --hb-xk4-g: 8px;\n  position: relative;\n  z-index: 5;\n  box-sizing: border-box;\n  display: flex;\n  flex: none;\n  flex-direction: column;\n  align-items: flex-start;\n  width: calc(var(--hb-xk4-s) + 28px);\n  height: 100%;\n  padding: 12px 0 12px 14px;\n  border-right: 1px solid #1d1d1d;\n  background: linear-gradient(90deg, #0e0e0e, #0b0b0b);\n  color: #ededed;\n  font-family: inherit;\n  font-size: 12.5px;\n}\n.hb-xk4 *, .hb-xk4 *::before, .hb-xk4 *::after { box-sizing: border-box; }\n.hb-xk4-list { position: relative; display: flex; flex-direction: column; gap: var(--hb-xk4-g); margin: auto 0; padding: 0; list-style: none; }\n.hb-xk4-li { position: relative; width: var(--hb-xk4-s); height: var(--hb-xk4-s); }\n.hb-xk4-btn {\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: 100%;\n  height: 100%;\n  margin: 0;\n  padding: 0;\n  border: 0;\n  border-radius: 28%;\n  background:\n    linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 55%),\n    linear-gradient(160deg, color-mix(in srgb, var(--hb-xk4-t) 100%, #fff 10%), color-mix(in srgb, var(--hb-xk4-t) 62%, #000));\n  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .25), inset 0 -2px 4px rgba(0, 0, 0, .25), 0 4px 10px -4px rgba(0, 0, 0, .9);\n  color: #fff;\n  cursor: pointer;\n  transform-origin: 0% 50%;\n  transform: translateX(calc((var(--hb-xk4-k) - 1) * 10px)) scale(var(--hb-xk4-k));\n  transition: transform .5s cubic-bezier(.22, 1, .36, 1), filter .2s ease;\n  will-change: transform;\n}\n.hb-xk4[data-live=\"true\"] .hb-xk4-btn { transition: transform .14s cubic-bezier(.22, 1, .36, 1), filter .2s ease; }\n.hb-xk4-btn svg { width: 52%; height: 52%; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .3)); }\n.hb-xk4-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }\n.hb-xk4-btn:active { filter: brightness(.82); }\n.hb-xk4-li[data-dim=\"true\"] .hb-xk4-btn { filter: saturate(.55) brightness(.75); }\n.hb-xk4-pip {\n  position: absolute;\n  top: 50%;\n  left: -10px;\n  width: 4px;\n  height: 4px;\n  border-radius: 99px;\n  background: #ededed;\n  box-shadow: 0 0 6px rgba(255, 255, 255, .7);\n  transform: translateY(-50%) scale(0);\n  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);\n}\n.hb-xk4-li[data-current=\"true\"] .hb-xk4-pip { transform: translateY(-50%) scale(1); }\n.hb-xk4-label {\n  position: absolute;\n  top: 0;\n  left: calc(var(--hb-xk4-s) + 36px);\n  z-index: 3;\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  height: 28px;\n  padding: 0 6px 0 10px;\n  border: 1px solid rgba(255, 255, 255, .1);\n  border-radius: 9px;\n  background: rgba(24, 24, 24, .86);\n  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .06);\n  color: #fff;\n  font-weight: 500;\n  white-space: nowrap;\n  pointer-events: none;\n  backdrop-filter: blur(12px);\n  -webkit-backdrop-filter: blur(12px);\n  opacity: 0;\n  transform: translate(-6px, calc(var(--hb-xk4-ly) - 14px)) scale(.96);\n  transition: transform .32s cubic-bezier(.22, 1, .36, 1), opacity .16s ease;\n}\n.hb-xk4-label[data-on=\"true\"] { opacity: 1; transform: translate(0, calc(var(--hb-xk4-ly) - 14px)); }\n.hb-xk4-label::before { content: \"\"; position: absolute; top: 50%; left: -4px; width: 7px; height: 7px; border-bottom: 1px solid rgba(255, 255, 255, .1); border-left: 1px solid rgba(255, 255, 255, .1); background: #181818; transform: translateY(-50%) rotate(45deg); }\n.hb-xk4-hint { padding: 0 6px; border-radius: 5px; background: rgba(255, 255, 255, .08); color: #a1a1a1; font-size: 10.5px; line-height: 17px; }\n.hb-xk4-foot { flex: none; margin-top: 8px; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xk4 *, .hb-xk4 *::before, .hb-xk4 *::after { transition: none !important; }\n  .hb-xk4-btn { transform: none !important; }\n}\n`;\n\nfunction Glyph({ icon }: { icon?: SidebarFisheyeIconName | React.ReactNode }) {\n  if (typeof icon === \"string\" || icon === undefined) {\n    const d = PATHS[(icon as SidebarFisheyeIconName | undefined) ?? \"home\"] ?? PATHS.home;\n    return (\n      <svg viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n        <path d={d} />\n      </svg>\n    );\n  }\n  return <>{icon}</>;\n}\n\nexport function SidebarFisheye({\n  items = defaultItems,\n  active,\n  defaultActive,\n  onChange,\n  magnify = 0.5,\n  radius = 96,\n  size = 36,\n  gap = 8,\n  footer,\n  accent = \"#2f7bff\",\n  className = \"\",\n  style,\n  ...rest\n}: SidebarFisheyeProps) {\n  const [inner, setInner] = React.useState(defaultActive ?? items[0]?.id ?? \"\");\n  const [y, setY] = React.useState<number | null>(null);\n  const [live, setLive] = React.useState(false);\n  const [reduced, setReduced] = React.useState(false);\n  const listRef = React.useRef<HTMLUListElement>(null);\n  const current = active ?? inner;\n  const pitch = size + gap;\n\n  React.useEffect(() => {\n    const mq = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    const sync = () => setReduced(mq.matches);\n    sync();\n    mq.addEventListener(\"change\", sync);\n    return () => mq.removeEventListener(\"change\", sync);\n  }, []);\n\n  const nearest = y === null ? -1 : Math.max(0, Math.min(items.length - 1, Math.round((y - size / 2) / pitch)));\n\n  function scaleAt(i: number) {\n    if (y === null || reduced) return 1;\n    const d = Math.abs(i * pitch + size / 2 - y);\n    if (d >= radius) return 1;\n    const f = 1 - d / radius;\n    return 1 + magnify * f * f;\n  }\n\n  function onMove(e: React.PointerEvent<HTMLUListElement>) {\n    const r = listRef.current?.getBoundingClientRect();\n    if (!r) return;\n    setLive(true);\n    setY(e.clientY - r.top);\n  }\n\n  function focusAt(i: number) {\n    setLive(false);\n    setY(i * pitch + size / 2);\n  }\n\n  function onKey(e: React.KeyboardEvent<HTMLUListElement>) {\n    const btns = Array.from(listRef.current?.querySelectorAll<HTMLButtonElement>(\"button\") ?? []);\n    const at = btns.indexOf(document.activeElement as HTMLButtonElement);\n    if (at < 0) return;\n    let n = -1;\n    if (e.key === \"ArrowDown\") n = Math.min(btns.length - 1, at + 1);\n    else if (e.key === \"ArrowUp\") n = Math.max(0, at - 1);\n    else if (e.key === \"Home\") n = 0;\n    else if (e.key === \"End\") n = btns.length - 1;\n    if (n >= 0) {\n      e.preventDefault();\n      btns[n]?.focus();\n    }\n  }\n\n  function pick(id: string) {\n    if (active === undefined) setInner(id);\n    onChange?.(id);\n  }\n\n  const shownItem = nearest >= 0 ? items[nearest] : undefined;\n  const ly = nearest >= 0 ? nearest * pitch + size / 2 : 0;\n  const ci = items.findIndex((i) => i.id === current);\n\n  const vars = { \"--hb-xk4-a\": accent, \"--hb-xk4-s\": `${size}px`, \"--hb-xk4-g\": `${gap}px`, ...style } as React.CSSProperties;\n\n  return (\n    <nav aria-label=\"Library\" className={`hb-xk4 ${className}`} data-live={live} style={vars} {...rest}>\n      <style href=\"hb-sidebar-fisheye\" precedence=\"default\">{css}</style>\n      <ul\n        ref={listRef}\n        className=\"hb-xk4-list\"\n        role=\"list\"\n        onPointerMove={onMove}\n        onPointerLeave={() => {\n          setY(null);\n          setLive(false);\n        }}\n        onKeyDown={onKey}\n        onBlur={(e) => {\n          if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setY(null);\n        }}\n      >\n        {items.map((item, i) => (\n          <li\n            key={item.id}\n            className=\"hb-xk4-li\"\n            data-current={item.id === current}\n            data-dim={y !== null && i !== nearest && item.id !== current}\n            style={{ \"--hb-xk4-t\": item.tint ?? accent, \"--hb-xk4-k\": scaleAt(i).toFixed(3), zIndex: i === nearest ? 2 : 1 } as React.CSSProperties}\n          >\n            <span className=\"hb-xk4-pip\" aria-hidden=\"true\" />\n            <button\n              type=\"button\"\n              className=\"hb-xk4-btn\"\n              aria-label={item.label}\n              aria-current={item.id === current ? \"page\" : undefined}\n              tabIndex={i === (ci >= 0 ? ci : 0) ? 0 : -1}\n              onFocus={() => focusAt(i)}\n              onClick={() => pick(item.id)}\n            >\n              <Glyph icon={item.icon} />\n            </button>\n          </li>\n        ))}\n        <li className=\"hb-xk4-label\" data-on={!!shownItem} aria-hidden=\"true\" style={{ \"--hb-xk4-ly\": `${ly.toFixed(1)}px` } as React.CSSProperties}>\n          {shownItem?.label ?? items[0]?.label}\n          {shownItem?.hint ? <span className=\"hb-xk4-hint\">{shownItem.hint}</span> : null}\n        </li>\n      </ul>\n      {footer ? <div className=\"hb-xk4-foot\">{footer}</div> : null}\n    </nav>\n  );\n}\n"
    }
  ]
}