{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"memory-toast","type":"registry:ui","title":"Memory Toast","description":"The 'Memory updated' receipt — shows the exact fact that was saved, with one-tap Undo and a quiet link to manage memories.","author":"Scrim UI (https://scrimui.dev)","categories":["memory"],"docs":"https://scrimui.dev/components/memory-toast","dependencies":[],"registryDependencies":[],"files":[{"path":"src/showcase/memory-toast/memory-toast.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * \"Memory updated\" — the receipt for a thing the product did for you.\n *\n * When the assistant quietly saves a fact about the user, something has to\n * make that save visible, or memory becomes surveillance. The toast is the\n * receipt: it says what was stored, in the user's own words, the moment it\n * happens.\n *\n * **The content of the toast is the fact itself**, not the event. \"Memory\n * updated\" alone is a receipt with no items on it — the user still has no\n * idea what is now remembered about them. Lead with the saved fact; the\n * \"Saved to memory\" label is context, not content.\n *\n * **Undo beats Manage as the primary action.** The common case is \"no,\n * that's wrong\" or \"I didn't mean in general\" — one tap and it never\n * happened. Manage (the full memory panel) is the secondary path for the\n * rare audit, so it stays a quiet text link.\n *\n * **It is a notification, not a dialog.** It must not steal focus or block\n * the composer; the user was mid-conversation. Dismissal and timing are the\n * caller's job — this renders the toast; when to show and for how long is a\n * product decision.\n */\n\nexport type MemoryToastProps = {\n  /** The fact that was saved, in the user's words — the content of the receipt. */\n  fact: string;\n  /** What happened to it. */\n  kind?: \"saved\" | \"updated\" | \"forgotten\";\n  /** One-tap reversal — the primary action. */\n  onUndo?: () => void;\n  /** Open the full memory panel. Always secondary to undo. */\n  onManage?: () => void;\n  className?: string;\n};\n\nconst LABELS = {\n  saved: \"Saved to memory\",\n  updated: \"Memory updated\",\n  forgotten: \"Forgotten\",\n} as const;\n\n/* ------------------------------------------------------------------ */\n/* Icons                                                               */\n/* ------------------------------------------------------------------ */\n\nfunction MemoryIcon() {\n  return (\n    <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" width=\"15\" height=\"15\">\n      <ellipse cx=\"12\" cy=\"5\" rx=\"8\" ry=\"3\" />\n      <path d=\"M4 5v6c0 1.66 3.58 3 8 3s8-1.34 8-3V5\" />\n      <path d=\"M4 11v6c0 1.66 3.58 3 8 3s8-1.34 8-3v-6\" />\n    </svg>\n  );\n}\n\n/* ------------------------------------------------------------------ */\n/* MemoryToast                                                         */\n/* ------------------------------------------------------------------ */\n\nexport function MemoryToast({\n  fact,\n  kind = \"saved\",\n  onUndo,\n  onManage,\n  className = \"\",\n}: MemoryToastProps) {\n  return (\n    <div\n      role=\"status\"\n      className={`flex items-center gap-3 rounded-xl border border-zinc-200 bg-white px-3.5 py-2.5 shadow-sm dark:border-zinc-800 dark:bg-zinc-900 ${className}`}\n    >\n      <span className=\"shrink-0 text-zinc-500 dark:text-zinc-400\">\n        <MemoryIcon />\n      </span>\n      <div className=\"min-w-0 flex-1\">\n        <div className=\"text-[11px] font-medium uppercase tracking-wide text-zinc-500 dark:text-zinc-400\">\n          {LABELS[kind]}\n        </div>\n        <p className=\"truncate text-sm text-zinc-900 dark:text-zinc-100\">{fact}</p>\n      </div>\n\n      {(onUndo || onManage) && (\n        <div className=\"flex shrink-0 items-center gap-2.5\">\n          {onUndo && (\n            <button\n              type=\"button\"\n              onClick={onUndo}\n              className=\"text-xs font-medium text-zinc-900 underline underline-offset-2 hover:text-zinc-600 dark:text-zinc-100 dark:hover:text-zinc-300\"\n            >\n              Undo\n            </button>\n          )}\n          {onManage && (\n            <button\n              type=\"button\"\n              onClick={onManage}\n              className=\"text-xs font-medium text-zinc-500 underline underline-offset-2 hover:text-zinc-700 dark:text-zinc-400 dark:hover:text-zinc-200\"\n            >\n              Manage\n            </button>\n          )}\n        </div>\n      )}\n    </div>\n  );\n}\n","type":"registry:ui","target":"components/ui/memory-toast.tsx"}]}