{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "menu-side-push",
  "type": "registry:component",
  "title": "Menu Side Push",
  "description": "An off-canvas menu that pushes the page aside as a scaled, rounded card with a ghost card behind it, revealing large numbered links. The burger morphs into a cross, focus stays trapped and Escape closes.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "sidebars",
    "off-canvas",
    "menu",
    "push",
    "hamburger",
    "portfolio",
    "mobile"
  ],
  "docs": "https://hyperblur.dev/effects/menu-side-push",
  "files": [
    {
      "path": "registry/hyperblur/menu-side-push.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/menu-side-push.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface MenuSidePushItem {\n  id: string;\n  label: string;\n  href?: string;\n  meta?: string;\n}\n\nexport interface MenuSidePushProps\n  extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n  items?: MenuSidePushItem[];\n  secondary?: { label: string; href?: string }[];\n  active?: string;\n  defaultActive?: string;\n  onChange?: (id: string) => void;\n  open?: boolean;\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  closeOnSelect?: boolean;\n  brand?: string;\n  note?: string;\n  menuWidth?: number;\n  embedded?: boolean;\n  accent?: string;\n  children?: React.ReactNode;\n}\n\nconst defaultItems: MenuSidePushItem[] = [\n  { id: \"work\", label: \"Work\", meta: \"24\" },\n  { id: \"studio\", label: \"Studio\" },\n  { id: \"journal\", label: \"Journal\", meta: \"New\" },\n  { id: \"careers\", label: \"Careers\", meta: \"3\" },\n  { id: \"contact\", label: \"Contact\" },\n];\n\nconst defaultSecondary = [{ label: \"Instagram\" }, { label: \"Dribbble\" }, { label: \"LinkedIn\" }];\n\nconst focusable = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nconst css = `\n.hb-xk2 {\n  --hb-xk2-a: #2f7bff;\n  --hb-xk2-mw: 220px;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  height: 100dvh;\n  overflow: hidden;\n  background:\n    radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--hb-xk2-a) 16%, transparent), transparent 60%),\n    #070707;\n  color: #ededed;\n  font-family: inherit;\n  isolation: isolate;\n}\n.hb-xk2[data-embedded=\"true\"] { height: 100%; }\n.hb-xk2 *, .hb-xk2 *::before, .hb-xk2 *::after { box-sizing: border-box; }\n.hb-xk2-trigger {\n  position: absolute;\n  top: 12px;\n  left: 12px;\n  z-index: 30;\n  display: grid;\n  place-items: center;\n  width: 36px;\n  height: 36px;\n  margin: 0;\n  padding: 0;\n  border: 1px solid rgba(255, 255, 255, .09);\n  border-radius: 11px;\n  background: rgba(20, 20, 20, .72);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 20px -10px rgba(0, 0, 0, .8);\n  color: #ededed;\n  cursor: pointer;\n  backdrop-filter: blur(10px);\n  -webkit-backdrop-filter: blur(10px);\n  transition: background-color .2s ease, transform .2s cubic-bezier(.22, 1, .36, 1);\n}\n.hb-xk2-trigger:hover { background: rgba(34, 34, 34, .9); }\n.hb-xk2-trigger:active { transform: scale(.94); }\n.hb-xk2-trigger:focus-visible { outline: 2px solid var(--hb-xk2-a); outline-offset: 2px; }\n.hb-xk2-bars { position: relative; width: 16px; height: 12px; }\n.hb-xk2-bars span { position: absolute; left: 0; width: 16px; height: 1.6px; border-radius: 2px; background: currentColor; transition: transform .42s cubic-bezier(.65, 0, .35, 1), opacity .2s ease, width .3s ease; }\n.hb-xk2-bars span:nth-child(1) { top: 0; }\n.hb-xk2-bars span:nth-child(2) { top: 5.2px; width: 11px; }\n.hb-xk2-bars span:nth-child(3) { top: 10.4px; }\n.hb-xk2[data-open=\"true\"] .hb-xk2-bars span:nth-child(1) { transform: translateY(5.2px) rotate(45deg); }\n.hb-xk2[data-open=\"true\"] .hb-xk2-bars span:nth-child(2) { opacity: 0; width: 0; }\n.hb-xk2[data-open=\"true\"] .hb-xk2-bars span:nth-child(3) { transform: translateY(-5.2px) rotate(-45deg); }\n.hb-xk2-menu {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  left: 0;\n  z-index: 1;\n  display: flex;\n  flex-direction: column;\n  width: var(--hb-xk2-mw);\n  padding: 16px 18px 16px 20px;\n  visibility: hidden;\n  transition: visibility 0s linear .5s;\n}\n.hb-xk2[data-open=\"true\"] .hb-xk2-menu { visibility: visible; transition: none; }\n.hb-xk2-brand { display: flex; align-items: center; gap: 8px; height: 28px; margin: 2px 0 0 44px; color: #a1a1a1; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }\n.hb-xk2-brand i { width: 6px; height: 6px; border-radius: 99px; background: var(--hb-xk2-a); box-shadow: 0 0 10px var(--hb-xk2-a); font-style: normal; }\n.hb-xk2-list { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 2px; margin: 0; padding: 0; list-style: none; counter-reset: hb-xk2-n; }\n.hb-xk2-li {\n  counter-increment: hb-xk2-n;\n  opacity: 0;\n  transform: translateX(-18px);\n  transition: opacity .2s ease, transform .3s cubic-bezier(.22, 1, .36, 1);\n}\n.hb-xk2[data-open=\"true\"] .hb-xk2-li {\n  opacity: 1;\n  transform: none;\n  transition: opacity .4s ease, transform .6s cubic-bezier(.22, 1, .36, 1);\n  transition-delay: calc(var(--hb-xk2-i) * 45ms + 140ms);\n}\n.hb-xk2-link {\n  position: relative;\n  display: flex;\n  align-items: baseline;\n  gap: 10px;\n  width: 100%;\n  margin: 0;\n  padding: 3px 0;\n  border: 0;\n  background: none;\n  color: #6c6c72;\n  font: inherit;\n  font-family: var(--font-grotesk, inherit);\n  font-size: 26px;\n  font-weight: 500;\n  letter-spacing: -.03em;\n  line-height: 1.12;\n  text-align: left;\n  text-decoration: none;\n  cursor: pointer;\n  transition: color .2s ease;\n}\n.hb-xk2-link::before { content: counter(hb-xk2-n, decimal-leading-zero); align-self: flex-start; margin-top: 5px; color: #4a4a50; font-family: var(--font-mono, ui-monospace, monospace); font-size: 9.5px; letter-spacing: 0; transition: color .2s ease; }\n.hb-xk2-text { position: relative; display: inline-block; transition: transform .35s cubic-bezier(.22, 1, .36, 1); }\n.hb-xk2-text::after { content: \"\"; position: absolute; right: 0; bottom: 1px; left: 0; height: 1.5px; background: var(--hb-xk2-a); transform: scaleX(0); transform-origin: right; transition: transform .4s cubic-bezier(.65, 0, .35, 1); }\n.hb-xk2-link:hover, .hb-xk2-link:focus-visible { color: #ededed; outline: none; }\n.hb-xk2-link:hover .hb-xk2-text, .hb-xk2-link:focus-visible .hb-xk2-text { transform: translateX(4px); }\n.hb-xk2-link:hover .hb-xk2-text::after, .hb-xk2-link:focus-visible .hb-xk2-text::after { transform: scaleX(1); transform-origin: left; }\n.hb-xk2-link[aria-current=\"page\"] { color: #fff; }\n.hb-xk2-link[aria-current=\"page\"]::before { color: var(--hb-xk2-a); }\n.hb-xk2-meta { align-self: center; padding: 1px 6px; border: 1px solid #2a2a2a; border-radius: 99px; color: #8f8f8f; font-family: var(--font-sans, inherit); font-size: 9.5px; font-weight: 600; letter-spacing: .02em; line-height: 14px; }\n.hb-xk2-link[aria-current=\"page\"] .hb-xk2-meta { border-color: color-mix(in srgb, var(--hb-xk2-a) 50%, transparent); color: color-mix(in srgb, var(--hb-xk2-a) 50%, #fff); }\n.hb-xk2-foot { display: flex; flex-direction: column; gap: 8px; opacity: 0; transition: opacity .2s ease; }\n.hb-xk2[data-open=\"true\"] .hb-xk2-foot { opacity: 1; transition: opacity .5s ease .42s; }\n.hb-xk2-sec { display: flex; flex-wrap: wrap; gap: 4px 12px; }\n.hb-xk2-sec a, .hb-xk2-sec span { color: #8f8f8f; font-size: 11px; text-decoration: none; transition: color .15s ease; }\n.hb-xk2-sec a:hover, .hb-xk2-sec a:focus-visible { color: #ededed; outline: none; text-decoration: underline; text-underline-offset: 3px; }\n.hb-xk2-note { display: flex; align-items: center; gap: 6px; color: #5f5f66; font-size: 10.5px; }\n.hb-xk2-note::before { content: \"\"; width: 6px; height: 6px; border-radius: 99px; background: #30a46c; box-shadow: 0 0 0 3px rgba(48, 164, 108, .18); }\n.hb-xk2-ghost, .hb-xk2-page {\n  position: absolute;\n  inset: 0;\n  transform-origin: 0% 50%;\n  transition: transform .62s cubic-bezier(.76, 0, .24, 1), border-radius .62s cubic-bezier(.76, 0, .24, 1), box-shadow .62s ease, opacity .5s ease;\n}\n.hb-xk2-ghost { z-index: 2; border-radius: 0; background: #151515; opacity: 0; }\n.hb-xk2-page { z-index: 3; overflow: hidden; background: #0a0a0a; }\n.hb-xk2-content { position: relative; width: 100%; height: 100%; overflow: auto; }\n.hb-xk2[data-open=\"true\"] .hb-xk2-ghost {\n  border-radius: 18px;\n  opacity: .55;\n  transform: translateX(calc(var(--hb-xk2-mw) - 18px)) scale(.76);\n}\n.hb-xk2[data-open=\"true\"] .hb-xk2-page {\n  border-radius: 18px;\n  box-shadow: 0 0 0 1px rgba(255, 255, 255, .07), -30px 0 60px -20px rgba(0, 0, 0, .9);\n  transform: translateX(var(--hb-xk2-mw)) scale(.84);\n}\n.hb-xk2-scrim {\n  position: absolute;\n  inset: 0;\n  z-index: 4;\n  margin: 0;\n  padding: 0;\n  border: 0;\n  border-radius: inherit;\n  background: rgba(0, 0, 0, .25);\n  cursor: pointer;\n  opacity: 0;\n  pointer-events: none;\n  transition: opacity .4s ease;\n}\n.hb-xk2[data-open=\"true\"] .hb-xk2-scrim { opacity: 1; pointer-events: auto; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xk2 *, .hb-xk2 *::before, .hb-xk2 *::after { transition: none !important; }\n}\n`;\n\nexport function MenuSidePush({\n  items = defaultItems,\n  secondary = defaultSecondary,\n  active,\n  defaultActive,\n  onChange,\n  open,\n  defaultOpen = false,\n  onOpenChange,\n  closeOnSelect = true,\n  brand = \"Northfold Studio\",\n  note = \"Booking projects for March\",\n  menuWidth = 220,\n  embedded = false,\n  accent = \"#2f7bff\",\n  children,\n  className = \"\",\n  style,\n  ...rest\n}: MenuSidePushProps) {\n  const [innerOpen, setInnerOpen] = React.useState(defaultOpen);\n  const [inner, setInner] = React.useState(defaultActive ?? items[0]?.id ?? \"\");\n  const isOpen = open ?? innerOpen;\n  const current = active ?? inner;\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const menuRef = React.useRef<HTMLDivElement>(null);\n  const triggerRef = React.useRef<HTMLButtonElement>(null);\n  const menuId = React.useId();\n  const interacted = React.useRef(false);\n\n  const setOpen = React.useCallback(\n    (next: boolean) => {\n      interacted.current = true;\n      if (open === undefined) setInnerOpen(next);\n      onOpenChange?.(next);\n    },\n    [open, onOpenChange],\n  );\n\n  React.useEffect(() => {\n    if (!isOpen || !interacted.current) return;\n    const first = menuRef.current?.querySelector<HTMLElement>(\"[data-xk2-link]\");\n    const t = window.setTimeout(() => first?.focus({ preventScroll: true }), 120);\n    return () => window.clearTimeout(t);\n  }, [isOpen]);\n\n  React.useEffect(() => {\n    if (!isOpen || embedded) return;\n    const html = document.documentElement;\n    const prev = html.style.overflow;\n    html.style.overflow = \"hidden\";\n    return () => {\n      html.style.overflow = prev;\n    };\n  }, [isOpen, embedded]);\n\n  function close() {\n    setOpen(false);\n    triggerRef.current?.focus({ preventScroll: true });\n  }\n\n  function onKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {\n    rest.onKeyDown?.(e);\n    if (!isOpen || e.defaultPrevented) return;\n    if (e.key === \"Escape\") {\n      e.stopPropagation();\n      close();\n      return;\n    }\n    const links = Array.from(menuRef.current?.querySelectorAll<HTMLElement>(\"[data-xk2-link]\") ?? []);\n    const at = links.indexOf(document.activeElement as HTMLElement);\n    if ((e.key === \"ArrowDown\" || e.key === \"ArrowUp\") && at >= 0) {\n      e.preventDefault();\n      const n = e.key === \"ArrowDown\" ? (at + 1) % links.length : (at - 1 + links.length) % links.length;\n      links[n]?.focus();\n      return;\n    }\n    if (e.key !== \"Tab\") return;\n    const nodes = [triggerRef.current, ...Array.from(menuRef.current?.querySelectorAll<HTMLElement>(focusable) ?? [])].filter(\n      (n): n is HTMLElement => !!n,\n    );\n    if (!nodes.length) return;\n    const first = nodes[0];\n    const last = nodes[nodes.length - 1];\n    if (e.shiftKey && document.activeElement === first) {\n      e.preventDefault();\n      last.focus();\n    } else if (!e.shiftKey && document.activeElement === last) {\n      e.preventDefault();\n      first.focus();\n    }\n  }\n\n  function pick(id: string) {\n    if (active === undefined) setInner(id);\n    onChange?.(id);\n    if (closeOnSelect) close();\n  }\n\n  const vars = { \"--hb-xk2-a\": accent, \"--hb-xk2-mw\": `${menuWidth}px`, ...style } as React.CSSProperties;\n\n  return (\n    <div\n      ref={rootRef}\n      {...rest}\n      className={`hb-xk2 ${className}`}\n      data-open={isOpen}\n      data-embedded={embedded}\n      style={vars}\n      onKeyDown={onKeyDown}\n    >\n      <style href=\"hb-menu-side-push\" precedence=\"default\">{css}</style>\n      <button\n        ref={triggerRef}\n        type=\"button\"\n        className=\"hb-xk2-trigger\"\n        aria-label={isOpen ? \"Close menu\" : \"Open menu\"}\n        aria-expanded={isOpen}\n        aria-controls={menuId}\n        onClick={() => setOpen(!isOpen)}\n      >\n        <span className=\"hb-xk2-bars\" aria-hidden=\"true\">\n          <span />\n          <span />\n          <span />\n        </span>\n      </button>\n      <div\n        ref={menuRef}\n        id={menuId}\n        className=\"hb-xk2-menu\"\n        role=\"dialog\"\n        aria-modal={isOpen && !embedded ? true : undefined}\n        aria-label=\"Site menu\"\n        aria-hidden={!isOpen}\n        inert={!isOpen}\n      >\n        <div className=\"hb-xk2-brand\">\n          <i aria-hidden=\"true\" />\n          {brand}\n        </div>\n        <ul className=\"hb-xk2-list\" role=\"list\">\n          {items.map((item, i) => {\n            const body = (\n              <>\n                <span className=\"hb-xk2-text\">{item.label}</span>\n                {item.meta ? <span className=\"hb-xk2-meta\">{item.meta}</span> : null}\n              </>\n            );\n            const common = {\n              className: \"hb-xk2-link\",\n              \"data-xk2-link\": \"\",\n              \"aria-current\": item.id === current ? (\"page\" as const) : undefined,\n            };\n            return (\n              <li key={item.id} className=\"hb-xk2-li\" style={{ \"--hb-xk2-i\": i } as React.CSSProperties}>\n                {item.href ? (\n                  <a {...common} href={item.href} onClick={() => pick(item.id)}>\n                    {body}\n                  </a>\n                ) : (\n                  <button {...common} type=\"button\" onClick={() => pick(item.id)}>\n                    {body}\n                  </button>\n                )}\n              </li>\n            );\n          })}\n        </ul>\n        <div className=\"hb-xk2-foot\">\n          <div className=\"hb-xk2-sec\">\n            {secondary.map((s) => (s.href ? <a key={s.label} href={s.href}>{s.label}</a> : <span key={s.label}>{s.label}</span>))}\n          </div>\n          {note ? <div className=\"hb-xk2-note\">{note}</div> : null}\n        </div>\n      </div>\n      <div className=\"hb-xk2-ghost\" aria-hidden=\"true\" />\n      <div className=\"hb-xk2-page\">\n        <div className=\"hb-xk2-content\" inert={isOpen}>\n          {children}\n        </div>\n        <button type=\"button\" className=\"hb-xk2-scrim\" tabIndex={-1} aria-hidden=\"true\" onClick={close} />\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}