{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "notification-stack",
  "title": "Notification Stack",
  "author": "VenusUI",
  "description": "Phone-style stacked notifications with frosted glass that fan out into a list on hover or click.",
  "files": [
    {
      "path": "registry/default/ui/notification-stack.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport interface StackNotification {\n  id: string\n  /** App name, e.g. \"Messages\". */\n  app: string\n  title: string\n  body: string\n  /** When it arrived, e.g. \"now\" or \"9:41\". */\n  time: string\n  /** App icon, e.g. a lucide icon. Shown in a colored square (see `iconClassName`). */\n  icon?: React.ReactNode\n  /** Background for the icon square, e.g. \"bg-emerald-500\". */\n  iconClassName?: string\n  /** A person's photo; replaces the icon, with the app icon as a small badge. */\n  avatar?: string\n}\n\ninterface NotificationStackProps extends React.ComponentProps<\"div\"> {\n  notifications: StackNotification[]\n  /** Heading above the stack. */\n  heading?: string\n  expanded?: boolean\n  defaultExpanded?: boolean\n  onExpandedChange?: (expanded: boolean) => void\n}\n\nconst CARD_HEIGHT = 76\nconst GAP = 8\nconst PEEK = 10\n\n/**\n * Notifications stacked like a phone's lock screen. Hovering the stack,\n * clicking it, or the \"Show all\" button fans them out into a list; \"Show\n * less\" stacks them again. Every notification is always in the list for\n * screen readers.\n */\nfunction NotificationStack({\n  notifications,\n  heading = \"Notifications\",\n  expanded: expandedProp,\n  defaultExpanded = false,\n  onExpandedChange,\n  className,\n  ...props\n}: NotificationStackProps) {\n  const [hovered, setHovered] = React.useState(false)\n  const [pinned, setPinned] = React.useState(defaultExpanded)\n  const expanded = expandedProp ?? (hovered || pinned)\n  const count = notifications.length\n  const listId = React.useId()\n\n  const setPinnedAndNotify = (next: boolean) => {\n    setPinned(next)\n    onExpandedChange?.(next)\n  }\n\n  const height = expanded ? count * CARD_HEIGHT + (count - 1) * GAP : CARD_HEIGHT + Math.min(count - 1, 2) * PEEK\n\n  return (\n    <div data-slot=\"notification-stack\" className={cn(\"w-full max-w-sm\", className)} {...props}>\n      <div className=\"mb-2 flex items-center justify-between px-1\">\n        <p className=\"text-sm font-semibold\">{heading}</p>\n        {count > 1 ? (\n          <button\n            type=\"button\"\n            aria-expanded={expanded}\n            aria-controls={listId}\n            onClick={() => setPinnedAndNotify(!pinned)}\n            className=\"rounded-full bg-foreground/10 px-2.5 py-0.5 text-xs font-medium backdrop-blur outline-none hover:bg-foreground/15 focus-visible:ring-3 focus-visible:ring-ring/50\"\n          >\n            {expanded ? \"Show less\" : `Show all ${count}`}\n          </button>\n        ) : null}\n      </div>\n\n      {/* Pointer users can hover or click the stack itself; the button above is the accessible control. */}\n      <div\n        onPointerEnter={(event) => event.pointerType !== \"touch\" && setHovered(true)}\n        onPointerLeave={(event) => event.pointerType !== \"touch\" && setHovered(false)}\n        onClick={() => !expanded && setPinnedAndNotify(true)}\n        className={cn(\"relative transition-[height] duration-500 ease-[cubic-bezier(0.32,1.2,0.6,1)] motion-reduce:transition-none\", !expanded && \"cursor-pointer\")}\n        style={{ height }}\n      >\n        <ul id={listId} className=\"absolute inset-0\">\n          {notifications.map((n, index) => {\n            const behind = !expanded && index > 0\n            const hidden = !expanded && index > 2\n            return (\n              <li\n                key={n.id}\n                className={cn(\n                  \"absolute inset-x-0 top-0 flex items-center gap-3 rounded-2xl border border-white/30 bg-white/70 px-3.5 shadow-[0_8px_24px_-12px_rgb(0_0_0/0.35)] backdrop-blur-xl dark:border-white/10 dark:bg-neutral-900/70\",\n                  \"origin-top transition-[transform,opacity] duration-500 ease-[cubic-bezier(0.32,1.2,0.6,1)] motion-reduce:transition-none\"\n                )}\n                style={{\n                  height: CARD_HEIGHT,\n                  zIndex: count - index,\n                  opacity: hidden ? 0 : 1,\n                  transform: expanded\n                    ? `translateY(${index * (CARD_HEIGHT + GAP)}px)`\n                    : `translateY(${Math.min(index, 2) * PEEK}px) scale(${1 - Math.min(index, 2) * 0.05})`,\n                }}\n              >\n                <span className={cn(\"flex w-full items-center gap-3 transition-opacity duration-300\", behind && \"opacity-0\")}>\n                  <span className=\"relative shrink-0\">\n                    {n.avatar ? (\n                      <img src={n.avatar} alt=\"\" className=\"size-10 rounded-full object-cover\" />\n                    ) : (\n                      <span className={cn(\"grid size-10 place-items-center rounded-[11px] text-white [&_svg]:size-5\", n.iconClassName ?? \"bg-neutral-500\")}>\n                        {n.icon}\n                      </span>\n                    )}\n                    {n.avatar && n.icon ? (\n                      <span\n                        className={cn(\n                          \"absolute -right-1 -bottom-1 grid size-5 place-items-center rounded-md text-white ring-2 ring-white dark:ring-neutral-900 [&_svg]:size-3\",\n                          n.iconClassName ?? \"bg-neutral-500\"\n                        )}\n                      >\n                        {n.icon}\n                      </span>\n                    ) : null}\n                  </span>\n                  <span className=\"min-w-0 flex-1\">\n                    <span className=\"flex items-baseline justify-between gap-2\">\n                      <span className=\"truncate text-sm font-semibold text-neutral-900 dark:text-white\">{n.title}</span>\n                      <span className=\"shrink-0 text-xs text-neutral-500 dark:text-neutral-400\">{n.time}</span>\n                    </span>\n                    <span className=\"line-clamp-2 text-[13px] leading-snug text-neutral-700 dark:text-neutral-300\">\n                      <span className=\"sr-only\">{n.app}: </span>\n                      {n.body}\n                    </span>\n                  </span>\n                </span>\n              </li>\n            )\n          })}\n        </ul>\n      </div>\n    </div>\n  )\n}\n\nexport { NotificationStack }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "data-display",
    "animations"
  ],
  "type": "registry:ui"
}