@vantageos/mosaic-blocks 0.5.35-alpha → 0.5.37-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/README.md +11 -8
  2. package/dist/index.cjs +828 -40
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +415 -11
  5. package/dist/index.d.ts +415 -11
  6. package/dist/index.js +809 -41
  7. package/dist/index.js.map +1 -1
  8. package/dist/styles.css +18 -0
  9. package/package.json +20 -7
  10. package/r/mosaic-accordion.json +1 -2
  11. package/r/mosaic-activity-feed.json +16 -0
  12. package/r/mosaic-adaptive-grid.json +18 -0
  13. package/r/mosaic-adaptive-modal.json +18 -0
  14. package/r/mosaic-adaptive-navigation.json +18 -0
  15. package/r/mosaic-add-memory-form.json +25 -0
  16. package/r/mosaic-admin-only-guard.json +18 -0
  17. package/r/mosaic-agent-builder-modal.json +23 -0
  18. package/r/mosaic-agent-card.json +16 -0
  19. package/r/mosaic-agent-chat.json +26 -0
  20. package/r/mosaic-agent-composer.json +28 -0
  21. package/r/mosaic-agent-editor.json +25 -0
  22. package/r/mosaic-agent-list.json +21 -0
  23. package/r/mosaic-agent-preview.json +21 -0
  24. package/r/mosaic-alert-dialog.json +23 -0
  25. package/r/mosaic-animated-list.json +16 -0
  26. package/r/mosaic-api-key-panel.json +21 -0
  27. package/r/mosaic-app-sidebar.json +18 -0
  28. package/r/mosaic-approval-prompt.json +21 -0
  29. package/r/mosaic-artifact-canvas-adapter.json +26 -0
  30. package/r/mosaic-artifact-chart.json +18 -0
  31. package/r/mosaic-artifact-checklist.json +18 -0
  32. package/r/mosaic-artifact-data-table.json +18 -0
  33. package/r/mosaic-artifact-document.json +16 -0
  34. package/r/mosaic-artifact-library.json +18 -0
  35. package/r/mosaic-artifact-save-as-memory-form.json +24 -0
  36. package/r/mosaic-artifact-version-history.json +16 -0
  37. package/r/mosaic-avatar.json +18 -0
  38. package/r/mosaic-badge.json +23 -0
  39. package/r/mosaic-blurred-orb.json +16 -0
  40. package/r/mosaic-button.json +24 -0
  41. package/r/mosaic-callout.json +23 -0
  42. package/r/mosaic-card.json +16 -0
  43. package/r/mosaic-chat-composer.json +21 -0
  44. package/r/mosaic-chat-message.json +23 -0
  45. package/r/mosaic-chat-sidebar.json +21 -0
  46. package/r/mosaic-chat-thread.json +21 -0
  47. package/r/mosaic-checkbox.json +18 -0
  48. package/r/mosaic-clerk-org-switcher.json +18 -0
  49. package/r/mosaic-clerk-webhook-handler.json +18 -0
  50. package/r/mosaic-collapsible.json +18 -0
  51. package/r/mosaic-combobox.json +18 -0
  52. package/r/mosaic-counter.json +16 -0
  53. package/r/mosaic-dashboard-content.json +18 -0
  54. package/r/mosaic-dashboard-header.json +18 -0
  55. package/r/mosaic-dashboard-layout.json +20 -0
  56. package/r/mosaic-data-table.json +16 -0
  57. package/r/mosaic-delete-confirmation-dialog.json +18 -0
  58. package/r/mosaic-device-provider.json +16 -0
  59. package/r/mosaic-document-table.json +52 -0
  60. package/r/mosaic-document-upload.json +21 -0
  61. package/r/mosaic-drawer.json +23 -0
  62. package/r/mosaic-dropdown-menu.json +18 -0
  63. package/r/mosaic-edit-memory-dialog.json +27 -0
  64. package/r/mosaic-edit-session-dialog.json +25 -0
  65. package/r/mosaic-editable-cell.json +23 -0
  66. package/r/mosaic-empty-state.json +16 -0
  67. package/r/mosaic-falling-pattern.json +16 -0
  68. package/r/mosaic-feature-3col.json +16 -0
  69. package/r/mosaic-feature-centered-media.json +16 -0
  70. package/r/mosaic-field.json +18 -0
  71. package/r/mosaic-filter-bar.json +18 -0
  72. package/r/mosaic-filter-sidebar.json +18 -0
  73. package/r/mosaic-footer-simple.json +16 -0
  74. package/r/mosaic-grille-registre.json +53 -0
  75. package/r/mosaic-hero-split.json +16 -0
  76. package/r/mosaic-input-group.json +16 -0
  77. package/r/mosaic-input.json +18 -0
  78. package/r/mosaic-integrations-badge.json +16 -0
  79. package/r/mosaic-kanban-board.json +21 -0
  80. package/r/mosaic-logos-grid.json +16 -0
  81. package/r/mosaic-main-nav.json +18 -0
  82. package/r/mosaic-markdown.json +21 -0
  83. package/r/mosaic-marketplace-card.json +24 -0
  84. package/r/mosaic-marketplace-list.json +20 -0
  85. package/r/mosaic-match-input.json +23 -0
  86. package/r/mosaic-memory-card.json +21 -0
  87. package/r/mosaic-memory-dashboard.json +23 -0
  88. package/r/mosaic-memory-grid.json +21 -0
  89. package/r/mosaic-memory-list.json +21 -0
  90. package/r/mosaic-memory-search.json +23 -0
  91. package/r/mosaic-mention-input.json +23 -0
  92. package/r/mosaic-message-card.json +16 -0
  93. package/r/mosaic-message-list.json +19 -0
  94. package/r/mosaic-message-search.json +18 -0
  95. package/r/mosaic-model-selector.json +23 -0
  96. package/r/mosaic-module-card.json +16 -0
  97. package/r/mosaic-module-library.json +18 -0
  98. package/r/mosaic-multi-tenant-provider.json +19 -0
  99. package/r/mosaic-navbar.json +16 -0
  100. package/r/mosaic-org-context-display.json +18 -0
  101. package/r/mosaic-org-panel.json +19 -0
  102. package/r/mosaic-org-profile-page.json +18 -0
  103. package/r/mosaic-org-switcher.json +16 -0
  104. package/r/mosaic-pdf-viewer.json +23 -0
  105. package/r/mosaic-popover.json +23 -0
  106. package/r/mosaic-preferences-panel.json +18 -0
  107. package/r/mosaic-pricing-card.json +16 -0
  108. package/r/mosaic-profile-panel.json +18 -0
  109. package/r/mosaic-progress.json +18 -0
  110. package/r/mosaic-quick-action-card.json +16 -0
  111. package/r/mosaic-quick-actions-menu.json +18 -0
  112. package/r/mosaic-quick-agent-selector.json +19 -0
  113. package/r/mosaic-radio-group.json +18 -0
  114. package/r/mosaic-reply-input.json +21 -0
  115. package/r/mosaic-resizable-split-pane.json +23 -0
  116. package/r/mosaic-save-chat-as-memory-form.json +25 -0
  117. package/r/mosaic-save-template-modal.json +27 -0
  118. package/r/mosaic-scroll-area.json +18 -0
  119. package/r/mosaic-select.json +18 -0
  120. package/r/mosaic-selector-modal.json +18 -0
  121. package/r/mosaic-separator.json +18 -0
  122. package/r/mosaic-session-card.json +24 -0
  123. package/r/mosaic-session-list.json +21 -0
  124. package/r/mosaic-sign-in-layout.json +18 -0
  125. package/r/mosaic-sign-up-layout.json +18 -0
  126. package/r/mosaic-skeleton.json +23 -0
  127. package/r/mosaic-slider.json +18 -0
  128. package/r/mosaic-stats-grid.json +16 -0
  129. package/r/mosaic-step-pipeline.json +21 -0
  130. package/r/mosaic-switch.json +18 -0
  131. package/r/mosaic-tabs.json +18 -0
  132. package/r/mosaic-tag-input.json +23 -0
  133. package/r/mosaic-template-agent-card.json +21 -0
  134. package/r/mosaic-template-category-chips.json +21 -0
  135. package/r/mosaic-template-gallery.json +20 -0
  136. package/r/mosaic-template-list.json +21 -0
  137. package/r/mosaic-template-management-panel.json +25 -0
  138. package/r/mosaic-testimonials-grid.json +16 -0
  139. package/r/mosaic-textarea.json +16 -0
  140. package/r/mosaic-theme-provider.json +18 -0
  141. package/r/mosaic-theme-toggle.json +16 -0
  142. package/r/mosaic-thread-indicator.json +21 -0
  143. package/r/mosaic-thread-view.json +21 -0
  144. package/r/mosaic-toast.json +28 -0
  145. package/r/mosaic-tool-toggle-list.json +23 -0
  146. package/r/mosaic-tooltip.json +18 -0
  147. package/r/mosaic-url-scraper.json +21 -0
  148. package/r/mosaic-user-button.json +18 -0
  149. package/r/use-effective-workspace-id.json +18 -0
  150. package/registry.json +77 -130
package/dist/styles.css CHANGED
@@ -49,6 +49,24 @@
49
49
  --color-warning-700: var(--mosaic-color-warning-700);
50
50
  }
51
51
 
52
+ /* Chart series palette — consumed by MosaicArtifactChart as `var(--color-chart-N)`
53
+ from JS (recharts fill/stroke), never through a Tailwind utility.
54
+ Values come from @vantageos/mosaic-tokens (--mosaic-color-chart-*, a distinct
55
+ set in light and in dark); none is chosen here.
56
+ Why `static`: Tailwind v4 emits a plain `@theme` variable only when a utility
57
+ uses it, so a JS-only reference would stay undeclared. Why not import
58
+ @vantageos/mosaic-tokens/theme.css wholesale: it maps every --color-* token
59
+ (measured: it adds danger-*, neutral-* and info-700 utilities this package
60
+ does not expose, and still leaves the chart variables undeclared when no
61
+ `bg-chart-*` utility is present). These five are the only ones needed. */
62
+ @theme static {
63
+ --color-chart-1: var(--mosaic-color-chart-1);
64
+ --color-chart-2: var(--mosaic-color-chart-2);
65
+ --color-chart-3: var(--mosaic-color-chart-3);
66
+ --color-chart-4: var(--mosaic-color-chart-4);
67
+ --color-chart-5: var(--mosaic-color-chart-5);
68
+ }
69
+
52
70
  /* ── MosaicLogosGrid stagger animation ────────────────────────────────────── */
53
71
 
54
72
  @keyframes mosaic-logo-in {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vantageos/mosaic-blocks",
3
- "version": "0.5.35-alpha",
3
+ "version": "0.5.37-alpha",
4
4
  "description": "VantageOS React composed blocks — Next.js 16 + React 19 + Tailwind v4 + @base-ui/react. Published alpha.",
5
5
  "license": "FSL-1.1-Apache-2.0",
6
6
  "type": "module",
@@ -54,7 +54,11 @@
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@clerk/nextjs": "^7",
57
- "@vantageos/cloud-identity": ">=0.2.0 <0.8.0",
57
+ "@heroui/react": "^3.2.5",
58
+ "@vantageos/cloud-identity": ">=0.6.0",
59
+ "ag-grid-community": "^36.1.0",
60
+ "ag-grid-react": "^36.1.0",
61
+ "lucide-react": "^0.511.0",
58
62
  "react": "^19",
59
63
  "react-dom": "^19",
60
64
  "recharts": "^2.12.0 || ^3.0.0",
@@ -83,41 +87,50 @@
83
87
  },
84
88
  "devDependencies": {
85
89
  "@biomejs/biome": "^1.9.4",
90
+ "@heroui/react": "3.2.5",
86
91
  "@playwright/test": "^1.61.1",
87
- "@storybook/addon-a11y": "^10.4.6",
88
- "@storybook/react": "^10.4.6",
89
- "@storybook/react-vite": "^10.4.6",
92
+ "@storybook/addon-a11y": "^10.6.2",
93
+ "@storybook/react": "^10.6.2",
94
+ "@storybook/react-vite": "^10.6.2",
90
95
  "@testing-library/react": "^16.3.0",
91
96
  "@testing-library/user-event": "^14.6.1",
92
97
  "@types/node": "^22.19.21",
93
98
  "@types/react": "^19",
94
99
  "@types/react-dom": "^19",
95
100
  "@vitejs/plugin-react": "^4.5.2",
101
+ "ag-grid-community": "^36.3.0",
102
+ "ag-grid-react": "^36.3.0",
96
103
  "http-server": "^14.1.1",
97
104
  "jsdom": "^26.1.0",
105
+ "lucide-react": "^0.511.0",
106
+ "next": "16.4.1",
98
107
  "react": "^19",
99
108
  "react-dom": "^19",
100
109
  "recharts": "^2.12.0",
101
110
  "rimraf": "^6.0.1",
102
- "storybook": "^10.4.6",
111
+ "storybook": "^10.6.2",
103
112
  "svix": "^1.0.0",
104
113
  "tailwindcss": "^4.3.1",
105
114
  "tsup": "^8.5.0",
106
115
  "typescript": "^5.8.3",
107
- "vitest": "^3.2.3"
116
+ "vitest": "^3.2.3",
117
+ "yaml": "^2.9.1"
108
118
  },
109
119
  "scripts": {
110
120
  "build": "tsup && node scripts/prepend-use-client.mjs && node scripts/copy-assets.mjs",
111
121
  "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
112
122
  "lint": "biome check .",
123
+ "check:recharts-peer": "bash scripts/check-recharts-peer.sh",
113
124
  "test": "vitest run",
114
125
  "test:browser": "playwright test",
115
126
  "sandbox:build": "cd sandbox && pnpm build",
116
127
  "prebuild": "rimraf dist",
117
128
  "sync-versions": "node scripts/sync-versions.mjs",
118
129
  "docs:counts": "node scripts/docs-counts.mjs",
130
+ "gate:local": "node scripts/gate-local.mjs",
119
131
  "registry:derive": "node scripts/registry-json-derive.mjs",
120
132
  "build:registry-items": "node scripts/build-registry-items.mjs",
133
+ "check:registry-items-drift": "node scripts/check-registry-items-drift.mjs",
121
134
  "parse-guard": "node scripts/parse-guard.mjs",
122
135
  "storybook": "storybook dev -p 6006",
123
136
  "build-storybook": "storybook build"
@@ -11,8 +11,7 @@
11
11
  {
12
12
  "path": "src/components/accordion/MosaicAccordion.tsx",
13
13
  "type": "registry:ui",
14
- "content": "/**\n * MosaicAccordion — @base-ui/react Accordion primitive\n *\n * Builds on Accordion.Root + Accordion.Item + Accordion.Header +\n * Accordion.Trigger + Accordion.Panel.\n * Supports single and multiple expansion modes.\n * role=button + aria-expanded + aria-controls managed by the primitive.\n *\n * data-slot=\"accordion\" on Root, \"accordion-item\" on Item,\n * \"accordion-trigger\" on Trigger, \"accordion-panel\" on Panel.\n * Styling: Tailwind v4 semantic tokens only.\n */\n\nimport { Accordion } from \"@base-ui/react/accordion\";\nimport type * as React from \"react\";\n\n// ── Utility ──────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Props ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicAccordionProps extends Accordion.Root.Props {\n className?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport interface MosaicAccordionItemProps extends Accordion.Item.Props {\n className?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport interface MosaicAccordionTriggerProps extends Omit<Accordion.Trigger.Props, \"ref\"> {\n className?: string;\n ref?: React.Ref<HTMLButtonElement>;\n}\n\nexport interface MosaicAccordionPanelProps extends Accordion.Panel.Props {\n className?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// ── Components ────────────────────────────────────────────────────────────────\n\n/**\n * MosaicAccordion — production Accordion root for @vantageos/mosaic-blocks.\n *\n * Compose with MosaicAccordionItem, MosaicAccordionTrigger, MosaicAccordionPanel.\n * By default, only one item can be open at a time (openMultiple={false}).\n *\n * @example\n * <MosaicAccordion>\n * <MosaicAccordionItem value=\"item-1\">\n * <Accordion.Header>\n * <MosaicAccordionTrigger>Section 1</MosaicAccordionTrigger>\n * </Accordion.Header>\n * <MosaicAccordionPanel>Content 1</MosaicAccordionPanel>\n * </MosaicAccordionItem>\n * </MosaicAccordion>\n */\nexport function MosaicAccordion({ className, ref, ...props }: MosaicAccordionProps) {\n return (\n <Accordion.Root\n ref={ref}\n data-slot=\"accordion\"\n className={cn(\"w-full divide-y divide-border\", className)}\n {...props}\n />\n );\n}\n\nMosaicAccordion.displayName = \"MosaicAccordion\";\n\n/**\n * MosaicAccordionItem — individual accordion item wrapper.\n * Must supply a unique `value` prop.\n */\nexport function MosaicAccordionItem({ className, ref, ...props }: MosaicAccordionItemProps) {\n return (\n <Accordion.Item\n ref={ref}\n data-slot=\"accordion-item\"\n className={cn(\"py-0\", className)}\n {...props}\n />\n );\n}\n\nMosaicAccordionItem.displayName = \"MosaicAccordionItem\";\n\n/**\n * MosaicAccordionTrigger — toggle button inside an accordion item header.\n * Must be placed inside an Accordion.Header.\n */\nexport function MosaicAccordionTrigger({\n className,\n children,\n ref,\n ...props\n}: MosaicAccordionTriggerProps) {\n return (\n <Accordion.Trigger\n ref={ref}\n data-slot=\"accordion-trigger\"\n className={cn(\n \"flex w-full flex-1 items-center justify-between py-4\",\n \"text-sm font-medium text-foreground\",\n \"outline-none transition-all\",\n \"hover:text-foreground/80\",\n \"focus-visible:ring-ring focus-visible:ring-[3px]\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"[&>svg]:transition-transform [&>svg]:duration-200\",\n \"data-[panel-open]:[&>svg]:rotate-180\",\n className,\n )}\n {...props}\n >\n {children}\n {/* Chevron icon */}\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"size-4 shrink-0 text-muted-foreground\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </Accordion.Trigger>\n );\n}\n\nMosaicAccordionTrigger.displayName = \"MosaicAccordionTrigger\";\n\n/**\n * MosaicAccordionPanel — collapsible content area for an accordion item.\n */\nexport function MosaicAccordionPanel({ className, ref, ...props }: MosaicAccordionPanelProps) {\n return (\n <Accordion.Panel\n ref={ref}\n data-slot=\"accordion-panel\"\n className={cn(\"overflow-hidden text-sm text-muted-foreground\", \"transition-all\", className)}\n {...props}\n />\n );\n}\n\nMosaicAccordionPanel.displayName = \"MosaicAccordionPanel\";\n\n// Re-export Header from base-ui for composition (no styling needed on header itself)\nexport { Accordion };\n",
15
- "target": "components/ui/MosaicAccordion.tsx"
14
+ "content": "/**\n * MosaicAccordion — @base-ui/react Accordion primitive\n *\n * Builds on Accordion.Root + Accordion.Item + Accordion.Header +\n * Accordion.Trigger + Accordion.Panel.\n * Supports single and multiple expansion modes.\n * role=button + aria-expanded + aria-controls managed by the primitive.\n *\n * data-slot=\"accordion\" on Root, \"accordion-item\" on Item,\n * \"accordion-trigger\" on Trigger, \"accordion-panel\" on Panel.\n * Styling: Tailwind v4 semantic tokens only.\n */\n\nimport { Accordion } from \"@base-ui/react/accordion\";\nimport type * as React from \"react\";\n\n// ── Utility ──────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Props ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicAccordionProps extends Accordion.Root.Props {\n className?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport interface MosaicAccordionItemProps extends Accordion.Item.Props {\n className?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport interface MosaicAccordionTriggerProps extends Omit<Accordion.Trigger.Props, \"ref\"> {\n className?: string;\n ref?: React.Ref<HTMLButtonElement>;\n}\n\nexport interface MosaicAccordionPanelProps extends Accordion.Panel.Props {\n className?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// ── Components ────────────────────────────────────────────────────────────────\n\n/**\n * MosaicAccordion — production Accordion root for @vantageos/mosaic-blocks.\n *\n * Compose with MosaicAccordionItem, MosaicAccordionTrigger, MosaicAccordionPanel.\n * By default, only one item can be open at a time (openMultiple={false}).\n *\n * @example\n * <MosaicAccordion>\n * <MosaicAccordionItem value=\"item-1\">\n * <Accordion.Header>\n * <MosaicAccordionTrigger>Section 1</MosaicAccordionTrigger>\n * </Accordion.Header>\n * <MosaicAccordionPanel>Content 1</MosaicAccordionPanel>\n * </MosaicAccordionItem>\n * </MosaicAccordion>\n */\nexport function MosaicAccordion({ className, ref, ...props }: MosaicAccordionProps) {\n return (\n <Accordion.Root\n ref={ref}\n data-slot=\"accordion\"\n className={cn(\"w-full divide-y divide-border\", className)}\n {...props}\n />\n );\n}\n\nMosaicAccordion.displayName = \"MosaicAccordion\";\n\n/**\n * MosaicAccordionItem — individual accordion item wrapper.\n * Must supply a unique `value` prop.\n */\nexport function MosaicAccordionItem({ className, ref, ...props }: MosaicAccordionItemProps) {\n return (\n <Accordion.Item\n ref={ref}\n data-slot=\"accordion-item\"\n className={cn(\"py-0\", className)}\n {...props}\n />\n );\n}\n\nMosaicAccordionItem.displayName = \"MosaicAccordionItem\";\n\n/**\n * MosaicAccordionTrigger — toggle button inside an accordion item header.\n * Must be placed inside an Accordion.Header.\n */\nexport function MosaicAccordionTrigger({\n className,\n children,\n ref,\n ...props\n}: MosaicAccordionTriggerProps) {\n return (\n <Accordion.Trigger\n ref={ref}\n data-slot=\"accordion-trigger\"\n className={cn(\n \"flex w-full flex-1 items-center justify-between py-4\",\n \"text-sm font-medium text-foreground\",\n \"outline-none transition-all\",\n \"hover:text-foreground/80\",\n \"focus-visible:ring-ring focus-visible:ring-[3px]\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"[&>svg]:transition-transform [&>svg]:duration-200\",\n \"data-[panel-open]:[&>svg]:rotate-180\",\n className,\n )}\n {...props}\n >\n {children}\n {/* Chevron icon */}\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"size-4 shrink-0 text-muted-foreground\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </Accordion.Trigger>\n );\n}\n\nMosaicAccordionTrigger.displayName = \"MosaicAccordionTrigger\";\n\n/**\n * MosaicAccordionPanel — collapsible content area for an accordion item.\n */\nexport function MosaicAccordionPanel({ className, ref, ...props }: MosaicAccordionPanelProps) {\n return (\n <Accordion.Panel\n ref={ref}\n data-slot=\"accordion-panel\"\n className={cn(\"overflow-hidden text-sm text-muted-foreground\", \"transition-all\", className)}\n {...props}\n />\n );\n}\n\nMosaicAccordionPanel.displayName = \"MosaicAccordionPanel\";\n\n// Re-export Header from base-ui for composition (no styling needed on header itself)\nexport { Accordion };\n"
16
15
  }
17
16
  ],
18
17
  "type": "registry:ui"
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-activity-feed",
4
+ "title": "MosaicActivityFeed",
5
+ "description": "Activity feed card with stagger-reveal rows. Status badges (active/completed/archived), participant avatar stack, message count, timestamp. Props: activities[] {id, type, title, description, timestamp, status, participants?, messages?}, iconMap, viewAllHref, renderLink.",
6
+ "dependencies": [],
7
+ "registryDependencies": [],
8
+ "files": [
9
+ {
10
+ "path": "src/components/activity-feed/MosaicActivityFeed.tsx",
11
+ "type": "registry:ui",
12
+ "content": "\"use client\";\n\n/**\n * MosaicActivityFeed — stagger-reveal activity list with status badges (PC-08)\n *\n * Ported (source: private upstream) components/dashboard/RecentActivity.tsx\n *\n * Feed card with stagger-reveal rows. Each row (MosaicActivityItem):\n * - icon slot (caller-provided ReactNode)\n * - title, description\n * - participant avatar stack (initials fallback)\n * - message count\n * - status badge (active / completed / archived + accent colors)\n * - timestamp\n *\n * Generalized: hardcoded debate mock data stripped; externalized as activities[].\n * \"View All\" link slot via viewAllHref prop + optional renderLink.\n *\n * Framer-motion replaced with CSS stagger (precedent: MosaicAnimatedList).\n * Respects prefers-reduced-motion.\n * Icons: inline SVG (no lucide dep).\n */\n\nimport * as React from \"react\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Keyframe injection ────────────────────────────────────────────────────────\n\nconst ANIM_ID = \"mosaic-activity-feed-kf\";\n\nfunction injectStyles() {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(ANIM_ID)) return;\n const s = document.createElement(\"style\");\n s.id = ANIM_ID;\n s.textContent = `\n @keyframes mosaic-activity-in {\n from { opacity: 0; transform: translateX(-12px); }\n to { opacity: 1; transform: translateX(0); }\n }\n .mosaic-activity-row {\n opacity: 0;\n animation: mosaic-activity-in 300ms ease-out forwards;\n }\n @media (prefers-reduced-motion: reduce) {\n .mosaic-activity-row {\n animation: none !important;\n opacity: 1 !important;\n }\n }\n `;\n document.head.appendChild(s);\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport type MosaicActivityStatus = \"active\" | \"completed\" | \"archived\";\n\n/**\n * Participant shape.\n *\n * Two forms accepted (union, both backward-compat):\n * - `string` — plain label, rendered as initials avatar (original API)\n * - `{ actor?: string; excerpt?: string }` — structured form (VP ActivityEvent shape)\n * `actor` is used as the avatar label; `excerpt` is surfaced as a sub-line when rendering.\n */\nexport type MosaicActivityParticipant = string | { actor?: string; excerpt?: string };\n\nexport interface MosaicActivity {\n /** Stable unique identifier */\n id: string;\n /** Activity category string (used to pick icon if iconMap provided) */\n type: string;\n title: string;\n description?: string;\n /**\n * Timestamp label. Accepts:\n * - `string` — display-ready label or ISO string (original API)\n * - `number` — Unix ms epoch (VP `updatedAt` numeric form)\n */\n timestamp: string | number;\n /**\n * Activity status. Accepts the canonical `MosaicActivityStatus` values\n * (`\"active\" | \"completed\" | \"archived\"`) OR any free string from upstream\n * systems (e.g. VP `ActivityEvent.status`). Known values receive accent styling;\n * unknown strings fall back to the \"archived\" (neutral) style.\n *\n * Using `MosaicActivityStatus | (string & {})` preserves IDE autocomplete\n * for the well-known values while accepting arbitrary strings at runtime.\n */\n status: MosaicActivityStatus | (string & {});\n /**\n * Participant list. Accepts:\n * - `string[]` — plain labels rendered as initials avatars (original API)\n * - `MosaicActivityParticipant[]` — union shape also accepting `{ actor?, excerpt? }` objects\n */\n participants?: MosaicActivityParticipant[];\n /** Number of messages/events in this activity */\n messages?: number;\n /**\n * Optional excerpt / summary text (VP ActivityEvent field).\n * Shown below description when present.\n */\n excerpt?: string;\n}\n\nexport interface MosaicActivityFeedProps {\n activities: MosaicActivity[];\n /**\n * Section heading. Required — the host owns the language\n * (e.g. `t('ActivityFeed.heading')`). No default, no fallback.\n */\n heading: string;\n /** Href for \"View All\" link */\n viewAllHref?: string;\n /**\n * Label for the \"View All\" link, shown when `viewAllHref` is set.\n * Required whenever `viewAllHref` is provided — host-owned, no default.\n */\n viewAllLabel: string;\n /**\n * Message shown when `activities` is empty. Required — the host owns\n * the language (e.g. `t('ActivityFeed.empty')`). No default, no fallback.\n */\n emptyMessage: string;\n /**\n * Visible message-count text on an activity that carries `messages`.\n * Receives the count; the host owns the unit word and word order.\n * Required, no default.\n */\n formatMessageCount: (count: number) => string;\n /**\n * Map of activity.type → icon ReactNode.\n * Default: generic clock icon for all types.\n */\n iconMap?: Record<string, React.ReactNode>;\n /**\n * Custom link renderer (e.g. Next.js Link).\n * Default: native <a>.\n */\n renderLink?: (href: string, children: React.ReactNode) => React.ReactNode;\n className?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// ── Status colors ─────────────────────────────────────────────────────────────\n\nconst STATUS_CLASSES: Record<string, string> = {\n // success-700 already carries a dark-mode-adjusted value in the token set\n // (@vantageos/mosaic-tokens [data-theme=\"dark\"] block), so no dark: prefix\n // is needed here — it replaces the old dark:text-green-400 override.\n active: \"bg-success-500/10 text-success-700 border border-success-500/20\",\n completed: \"bg-blue-500/10 text-blue-600 border border-blue-500/20 dark:text-blue-400\",\n archived: \"bg-gray-500/10 text-gray-600 border border-gray-500/20 dark:text-gray-400\",\n};\n\n/** Fallback style for unrecognised status strings */\nconst STATUS_FALLBACK = \"bg-gray-500/10 text-gray-600 border border-gray-500/20 dark:text-gray-400\";\n\n/** Resolve status display class — known values get accent colours, others neutral. */\nfunction getStatusClass(status: string): string {\n return STATUS_CLASSES[status] ?? STATUS_FALLBACK;\n}\n\n/** Normalise a participant (string or structured object) to a display label. */\nfunction participantLabel(p: MosaicActivityParticipant): string {\n if (typeof p === \"string\") return p;\n return p.actor ?? \"\";\n}\n\n/**\n * Normalise timestamp to a display string.\n * Numeric values are treated as Unix ms and formatted as a locale date-time.\n */\nfunction formatTimestamp(ts: string | number): string {\n if (typeof ts === \"string\") return ts;\n return new Date(ts).toLocaleString();\n}\n\n// ── Default icon ──────────────────────────────────────────────────────────────\n\nfunction ClockIcon() {\n return (\n <svg\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <polyline points=\"12 6 12 12 16 14\" />\n </svg>\n );\n}\n\nfunction ArrowRightIcon() {\n return (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\" />\n <polyline points=\"12 5 19 12 12 19\" />\n </svg>\n );\n}\n\n// ── MosaicActivityItem (exported standalone) ──────────────────────────────────\n\nexport interface MosaicActivityItemProps {\n activity: MosaicActivity;\n /** Visible message-count text. Receives the count; host owns the unit word. Required, no default. */\n formatMessageCount: (count: number) => string;\n icon?: React.ReactNode;\n className?: string;\n}\n\n/**\n * MosaicActivityItem — single row in the activity feed.\n * Can be used standalone outside MosaicActivityFeed.\n */\nexport function MosaicActivityItem({\n activity,\n formatMessageCount,\n icon,\n className,\n}: MosaicActivityItemProps) {\n return (\n <div\n data-slot=\"activity-item\"\n className={cn(\n \"flex cursor-pointer items-start gap-4 rounded-lg p-3 transition-colors hover:bg-muted/50\",\n className,\n )}\n >\n {/* Icon */}\n <div className=\"mt-0.5 flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary\">\n {icon ?? <ClockIcon />}\n </div>\n\n {/* Body */}\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0 flex-1\">\n <h4 className=\"truncate text-sm font-medium text-foreground\">{activity.title}</h4>\n {activity.description && (\n <p className=\"mt-0.5 text-sm text-muted-foreground line-clamp-1\">\n {activity.description}\n </p>\n )}\n\n {/* Participant avatars */}\n {activity.participants && activity.participants.length > 0 && (\n <div className=\"mt-2 flex items-center gap-2\">\n <div className=\"flex -space-x-2\">\n {activity.participants.slice(0, 3).map((p) => {\n const label = participantLabel(p);\n return (\n <div\n key={label}\n aria-label={label}\n className=\"flex h-6 w-6 items-center justify-center rounded-full border-2 border-background bg-muted text-[10px] font-medium text-muted-foreground\"\n >\n {label.slice(0, 2).toUpperCase()}\n </div>\n );\n })}\n </div>\n {activity.messages !== undefined && (\n <span className=\"text-xs text-muted-foreground\">\n {formatMessageCount(activity.messages)}\n </span>\n )}\n </div>\n )}\n {/* Excerpt (VP ActivityEvent field) */}\n {activity.excerpt && (\n <p className=\"mt-0.5 text-xs text-muted-foreground line-clamp-1\">\n {activity.excerpt}\n </p>\n )}\n </div>\n\n {/* Status + timestamp */}\n <div className=\"flex shrink-0 flex-col items-end gap-1.5\">\n <span\n className={cn(\n \"rounded-full px-2 py-0.5 text-xs font-medium\",\n getStatusClass(activity.status),\n )}\n >\n {activity.status}\n </span>\n <span className=\"text-xs text-muted-foreground\">\n {formatTimestamp(activity.timestamp)}\n </span>\n </div>\n </div>\n </div>\n </div>\n );\n}\n\nMosaicActivityItem.displayName = \"MosaicActivityItem\";\n\n// ── MosaicActivityFeed ────────────────────────────────────────────────────────\n\n/**\n * MosaicActivityFeed — scrollable card listing recent activities with stagger reveal.\n *\n * @example\n * // Host owns i18n (e.g. next-intl) — heading/viewAllLabel/emptyMessage are required.\n * <MosaicActivityFeed\n * heading={t('ActivityFeed.heading')}\n * viewAllHref=\"/history\"\n * viewAllLabel={t('ActivityFeed.viewAll')}\n * emptyMessage={t('ActivityFeed.empty')}\n * activities={[\n * { id: \"1\", type: \"task\", title: \"Published report\", description: \"PDF export\", timestamp: \"2h ago\", status: \"completed\" },\n * ]}\n * />\n */\nexport function MosaicActivityFeed({\n activities,\n heading,\n viewAllHref,\n viewAllLabel,\n emptyMessage,\n formatMessageCount,\n iconMap,\n renderLink,\n className,\n ref,\n}: MosaicActivityFeedProps) {\n React.useEffect(() => {\n injectStyles();\n }, []);\n\n const defaultRenderLink = (href: string, children: React.ReactNode) => (\n <a\n href={href}\n className=\"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors\"\n >\n {children}\n </a>\n );\n\n const link = renderLink ?? defaultRenderLink;\n\n return (\n <div\n ref={ref}\n data-slot=\"activity-feed\"\n className={cn(\"rounded-xl border border-border bg-card\", className)}\n >\n {/* Header */}\n <div className=\"flex items-center justify-between border-b border-border px-6 py-4\">\n <h3 className=\"text-lg font-semibold text-foreground\">{heading}</h3>\n {viewAllHref &&\n link(\n viewAllHref,\n <>\n {viewAllLabel}\n <ArrowRightIcon />\n </>,\n )}\n </div>\n\n {/* Activity rows */}\n <div className=\"divide-y divide-border p-2\">\n {activities.length === 0 ? (\n <p className=\"px-4 py-8 text-center text-sm text-muted-foreground\">{emptyMessage}</p>\n ) : (\n activities.map((activity, idx) => (\n <div\n key={activity.id}\n className=\"mosaic-activity-row\"\n style={{ animationDelay: `${idx * 80}ms` }}\n >\n <MosaicActivityItem\n activity={activity}\n formatMessageCount={formatMessageCount}\n icon={iconMap?.[activity.type]}\n />\n </div>\n ))\n )}\n </div>\n </div>\n );\n}\n\nMosaicActivityFeed.displayName = \"MosaicActivityFeed\";\n"
13
+ }
14
+ ],
15
+ "type": "registry:ui"
16
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-adaptive-grid",
4
+ "title": "MosaicAdaptiveGrid",
5
+ "description": "Device-aware CSS grid wrapper. Reads isMobile/isTablet/isDesktop from MosaicDeviceProvider and applies the correct column count. Props: mobileColumns, tabletColumns, desktopColumns, gap. Uses inline CSS for dynamic columns (no JIT issues).",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.37-alpha/r/mosaic-device-provider.json"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/components/adaptive-grid/MosaicAdaptiveGrid.tsx",
13
+ "type": "registry:ui",
14
+ "content": "\"use client\";\n\n/**\n * MosaicAdaptiveGrid — device-aware CSS grid wrapper (PC-02)\n *\n * Ported (source: private upstream) components/adaptive/AdaptiveGrid.tsx\n *\n * Reads isMobile/isTablet/isDesktop from useDevice() and applies the correct\n * column count via inline CSS variables (avoids Tailwind JIT dynamic class issues).\n * Zero debate coupling. Fully generic.\n *\n * Framer-motion: N/A (layout-only).\n */\n\nimport type * as React from \"react\";\nimport { useDevice } from \"@/components/ui/MosaicDeviceProvider\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicAdaptiveGridProps {\n children: React.ReactNode;\n /** Grid columns on mobile (default 1) */\n mobileColumns?: number;\n /** Grid columns on tablet (default 2) */\n tabletColumns?: number;\n /** Grid columns on desktop (default 3) */\n desktopColumns?: number;\n /** Gap between cells (Tailwind gap class, default \"gap-4\") */\n gap?: string;\n className?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicAdaptiveGrid — responsive grid that switches column count based on\n * the device breakpoint provided by MosaicDeviceProvider.\n *\n * @example\n * <MosaicDeviceProvider>\n * <MosaicAdaptiveGrid mobileColumns={1} tabletColumns={2} desktopColumns={3}>\n * <Card />\n * <Card />\n * <Card />\n * </MosaicAdaptiveGrid>\n * </MosaicDeviceProvider>\n */\nexport function MosaicAdaptiveGrid({\n children,\n mobileColumns = 1,\n tabletColumns = 2,\n desktopColumns = 3,\n gap = \"gap-4\",\n className,\n ref,\n}: MosaicAdaptiveGridProps) {\n const { isMobile, isTablet } = useDevice();\n\n const cols = isMobile ? mobileColumns : isTablet ? tabletColumns : desktopColumns;\n\n return (\n <div\n ref={ref}\n data-slot=\"adaptive-grid\"\n className={cn(\"grid\", gap, className)}\n style={{ gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` }}\n >\n {children}\n </div>\n );\n}\n\nMosaicAdaptiveGrid.displayName = \"MosaicAdaptiveGrid\";\n"
15
+ }
16
+ ],
17
+ "type": "registry:ui"
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-adaptive-modal",
4
+ "title": "MosaicAdaptiveModal",
5
+ "description": "Unified modal/sheet: Dialog on desktop, bottom-sheet on mobile. Uses native <dialog> element (focus trap, Escape key, backdrop). Single API: isOpen, onClose, title, children, description. No Radix/Vaul dep — fully portable.",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.37-alpha/r/mosaic-device-provider.json"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/components/adaptive-modal/MosaicAdaptiveModal.tsx",
13
+ "type": "registry:ui",
14
+ "content": "\"use client\";\n\n/**\n * MosaicAdaptiveModal — Dialog on desktop, bottom sheet on mobile (PC-03)\n *\n * Ported (source: private upstream) components/adaptive/AdaptiveModal.tsx\n *\n * Implementation: uses native <dialog> element for a11y (keyboard focus trap\n * handled by browser on showModal, Escape auto-closes).\n * - Desktop: centered modal overlay + dialog panel\n * - Mobile: bottom sheet (CSS slide-up)\n *\n * Framer-motion replaced with CSS transitions + @keyframes.\n * Respects prefers-reduced-motion.\n * No Radix/Vaul dependency — lib-portable.\n */\n\nimport * as React from \"react\";\nimport { useDevice } from \"@/components/ui/MosaicDeviceProvider\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Keyframe injection ────────────────────────────────────────────────────────\n\nconst ANIM_ID = \"mosaic-adaptive-modal-kf\";\n\nfunction injectStyles() {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(ANIM_ID)) return;\n const s = document.createElement(\"style\");\n s.id = ANIM_ID;\n s.textContent = `\n @keyframes mosaic-modal-in {\n from { opacity: 0; transform: scale(0.96) translateY(4px); }\n to { opacity: 1; transform: scale(1) translateY(0); }\n }\n @keyframes mosaic-sheet-in {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n @keyframes mosaic-overlay-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n .mosaic-modal-panel {\n animation: mosaic-modal-in 200ms ease-out forwards;\n }\n .mosaic-sheet-panel {\n animation: mosaic-sheet-in 280ms ease-out forwards;\n }\n .mosaic-modal-overlay {\n animation: mosaic-overlay-in 150ms ease-out forwards;\n }\n dialog.mosaic-modal-dialog::backdrop {\n background: transparent;\n }\n @media (prefers-reduced-motion: reduce) {\n .mosaic-modal-panel,\n .mosaic-sheet-panel,\n .mosaic-modal-overlay {\n animation: none !important;\n }\n }\n `;\n document.head.appendChild(s);\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicAdaptiveModalProps {\n isOpen: boolean;\n onClose: () => void;\n title: string;\n children: React.ReactNode;\n className?: string;\n description?: string;\n /**\n * aria-label for the desktop close button. Required — the host owns the\n * language (e.g. `t('AdaptiveModal.aria.close')`). No default, no fallback.\n */\n closeAriaLabel: string;\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicAdaptiveModal — unified modal/sheet. On desktop renders a centered\n * dialog; on mobile renders a bottom-sheet drawer. Single API for both.\n *\n * @example\n * // Host owns i18n (e.g. next-intl) — closeAriaLabel is always required.\n * <MosaicAdaptiveModal\n * isOpen={open}\n * onClose={() => setOpen(false)}\n * title=\"Settings\"\n * closeAriaLabel={t('AdaptiveModal.aria.close')}\n * >\n * <p>Modal body content</p> // allow-hardcode-i18n: JSDoc @example doc comment, not shipped code\n * </MosaicAdaptiveModal>\n */\nexport function MosaicAdaptiveModal({\n isOpen,\n onClose,\n title,\n children,\n className,\n description,\n closeAriaLabel,\n}: MosaicAdaptiveModalProps) {\n const { isMobile } = useDevice();\n const dialogRef = React.useRef<HTMLDialogElement>(null);\n const titleId = React.useId();\n const descId = React.useId();\n\n React.useEffect(() => {\n injectStyles();\n }, []);\n\n // Control native dialog open/close\n React.useEffect(() => {\n const el = dialogRef.current;\n if (!el) return;\n if (isOpen) {\n if (!el.open) el.showModal();\n } else {\n if (el.open) el.close();\n }\n }, [isOpen]);\n\n // Native dialog fires 'cancel' on Escape — map to onClose\n React.useEffect(() => {\n const el = dialogRef.current;\n if (!el) return;\n const handler = (e: Event) => {\n e.preventDefault();\n onClose();\n };\n el.addEventListener(\"cancel\", handler);\n return () => el.removeEventListener(\"cancel\", handler);\n }, [onClose]);\n\n // Lock body scroll when open\n React.useEffect(() => {\n if (!isOpen) return;\n const prev = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n return () => {\n document.body.style.overflow = prev;\n };\n }, [isOpen]);\n\n if (!isOpen) return null;\n\n // Handle backdrop click: native <dialog> fires click on the dialog element when\n // the user clicks the ::backdrop. We close when the click target IS the dialog itself.\n const handleDialogClick = (e: React.MouseEvent<HTMLDialogElement>) => {\n if (e.target === e.currentTarget) onClose();\n };\n\n if (isMobile) {\n // Bottom sheet — rendered inside a <dialog>\n return (\n <dialog\n ref={dialogRef}\n aria-labelledby={titleId}\n aria-describedby={description ? descId : undefined}\n data-slot=\"adaptive-modal\"\n className=\"mosaic-modal-dialog m-0 h-full w-full max-w-full border-0 bg-transparent p-0 backdrop:bg-black/50 open:flex open:items-end\"\n onClick={handleDialogClick}\n onKeyDown={() => {\n /* Escape handled natively via dialog cancel event */\n }}\n >\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: stopPropagation on aria-hidden container is intentional backdrop isolation */}\n <div\n className={cn(\n \"mosaic-sheet-panel relative w-full rounded-t-2xl border-t border-border bg-background\",\n \"max-h-[90dvh] flex flex-col\",\n className,\n )}\n onClick={(e) => e.stopPropagation()}\n >\n {/* Drag handle */}\n <div className=\"flex justify-center pt-3 pb-1 shrink-0\">\n <div className=\"h-1.5 w-10 rounded-full bg-muted-foreground/30\" aria-hidden=\"true\" />\n </div>\n {/* Header */}\n <div className=\"px-4 pb-3 pt-1 shrink-0 border-b border-border\">\n <h2 id={titleId} className=\"text-base font-semibold text-foreground\">\n {title}\n </h2>\n {description && (\n <p id={descId} className=\"text-sm text-muted-foreground mt-0.5\">\n {description}\n </p>\n )}\n </div>\n {/* Body */}\n <div className=\"flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3\">{children}</div>\n </div>\n </dialog>\n );\n }\n\n // Desktop centered modal\n return (\n <dialog\n ref={dialogRef}\n aria-labelledby={titleId}\n aria-describedby={description ? descId : undefined}\n data-slot=\"adaptive-modal\"\n className=\"mosaic-modal-dialog fixed inset-0 m-auto border-0 bg-transparent p-0 backdrop:bg-black/50\"\n onClick={handleDialogClick}\n onKeyDown={() => {\n /* Escape handled natively via dialog cancel event */\n }}\n >\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: stopPropagation only; keyboard handled by dialog cancel event */}\n <div\n className={cn(\n \"mosaic-modal-panel relative w-[min(90vw,42rem)] rounded-xl border border-border bg-background shadow-xl\",\n \"max-h-[90vh] flex flex-col\",\n className,\n )}\n onClick={(e) => e.stopPropagation()}\n >\n {/* Header */}\n <div className=\"flex items-center justify-between px-6 py-4 border-b border-border shrink-0\">\n <div>\n <h2 id={titleId} className=\"text-lg font-semibold text-foreground\">\n {title}\n </h2>\n {description && (\n <p id={descId} className=\"text-sm text-muted-foreground mt-0.5\">\n {description}\n </p>\n )}\n </div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={closeAriaLabel}\n className=\"flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </div>\n {/* Body */}\n <div className=\"flex-1 min-h-0 overflow-y-auto px-6 py-4\">{children}</div>\n </div>\n </dialog>\n );\n}\n\nMosaicAdaptiveModal.displayName = \"MosaicAdaptiveModal\";\n"
15
+ }
16
+ ],
17
+ "type": "registry:ui"
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-adaptive-navigation",
4
+ "title": "MosaicAdaptiveNavigation",
5
+ "description": "Step navigation: tab strip on desktop, expandable accordion on mobile. Props: items[] {id, title, duration?, isComplete?, children?}, activeItem, onItemChange, expandedItems, onToggleExpanded. Zero debate coupling; generic items API.",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.37-alpha/r/mosaic-device-provider.json"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/components/adaptive-navigation/MosaicAdaptiveNavigation.tsx",
13
+ "type": "registry:ui",
14
+ "content": "\"use client\";\n\n/**\n * MosaicAdaptiveNavigation — tabs on desktop, accordion on mobile (PC-04)\n *\n * Ported (source: private upstream) components/adaptive/AdaptiveNavigation.tsx\n *\n * Desktop: horizontal tab strip (custom Tailwind tabs — no Radix dep).\n * Mobile: accordion-style collapsible list with step indicators.\n * Zero debate coupling. Generic items[] prop.\n *\n * Framer-motion: N/A (CSS transitions only).\n * Icons: inline SVG (no lucide dep).\n */\n\nimport type * as React from \"react\";\nimport { useDevice } from \"@/components/ui/MosaicDeviceProvider\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicNavigationItem {\n id: string;\n title: string;\n /** Optional duration label (e.g. seconds) */\n duration?: number;\n /** Whether this step is complete (shows checkmark) */\n isComplete?: boolean;\n /** Content rendered inside accordion panel (mobile only) */\n children?: React.ReactNode;\n}\n\nexport interface MosaicAdaptiveNavigationProps {\n items: MosaicNavigationItem[];\n activeItem: string;\n onItemChange: (id: string) => void;\n /** Controlled expanded set for accordion (mobile). If uncontrolled, pass undefined. */\n expandedItems?: Set<string>;\n onToggleExpanded?: (id: string) => void;\n /**\n * aria-label for the mobile accordion `<nav>`. Required — the host owns\n * the language (e.g. `t('AdaptiveNavigation.aria.step')`). No default.\n */\n stepNavAriaLabel: string;\n /**\n * aria-label for the desktop tab-strip `<nav>`. Required — the host owns\n * the language (e.g. `t('AdaptiveNavigation.aria.tab')`). No default.\n */\n tabNavAriaLabel: string;\n /** Status caption shown when a step is complete. Required, no default. */\n completeStatusLabel: string;\n /** Status caption shown when a step is not yet complete. Required, no default. */\n inProgressStatusLabel: string;\n /**\n * Visible duration badge text for an item that carries `duration`. Receives\n * the raw value in seconds; the host owns the unit word and formatting.\n * Required, no default.\n */\n formatDuration: (seconds: number) => string;\n className?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// ── Inline icons ──────────────────────────────────────────────────────────────\n\nfunction CheckIcon() {\n return (\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n );\n}\n\nfunction ChevronDownIcon({ rotated }: { rotated: boolean }) {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n style={{\n transform: rotated ? \"rotate(180deg)\" : \"rotate(0deg)\",\n transition: \"transform 200ms ease-out\",\n }}\n >\n <polyline points=\"6 9 12 15 18 9\" />\n </svg>\n );\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicAdaptiveNavigation — step navigation that adapts by device.\n * Desktop: tab strip. Mobile: expandable accordion with step indicators.\n *\n * @example\n * const [active, setActive] = useState(items[0].id);\n * const [expanded, setExpanded] = useState(new Set<string>());\n * const toggle = (id: string) =>\n * setExpanded(prev => { const s = new Set(prev); s.has(id) ? s.delete(id) : s.add(id); return s; });\n *\n * <MosaicAdaptiveNavigation\n * items={items}\n * activeItem={active}\n * onItemChange={setActive}\n * expandedItems={expanded}\n * onToggleExpanded={toggle}\n * stepNavAriaLabel={t('AdaptiveNavigation.aria.step')}\n * tabNavAriaLabel={t('AdaptiveNavigation.aria.tab')}\n * />\n */\nexport function MosaicAdaptiveNavigation({\n items,\n activeItem,\n onItemChange,\n expandedItems,\n onToggleExpanded,\n stepNavAriaLabel,\n tabNavAriaLabel,\n completeStatusLabel,\n inProgressStatusLabel,\n formatDuration,\n className,\n ref,\n}: MosaicAdaptiveNavigationProps) {\n const { isMobile } = useDevice();\n\n if (isMobile) {\n return (\n <nav\n ref={ref}\n data-slot=\"adaptive-navigation\"\n className={cn(\"space-y-3\", className)}\n aria-label={stepNavAriaLabel}\n >\n {items.map((item, idx) => {\n const isExpanded = expandedItems?.has(item.id) ?? false;\n return (\n <div key={item.id} className=\"overflow-hidden rounded-lg border border-border\">\n <button\n type=\"button\"\n className=\"flex w-full items-center justify-between p-4 text-left transition-colors hover:bg-muted\"\n onClick={() => onToggleExpanded?.(item.id)}\n aria-expanded={isExpanded}\n aria-controls={`mosaic-nav-panel-${item.id}`}\n >\n <div className=\"flex items-center gap-3\">\n <div\n className={cn(\n \"flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-xs font-bold\",\n item.isComplete\n ? \"bg-success-500 text-white\"\n : \"bg-muted text-muted-foreground\",\n )}\n aria-hidden=\"true\"\n >\n {item.isComplete ? <CheckIcon /> : idx + 1}\n </div>\n <div>\n <p className=\"text-base font-medium text-foreground\">{item.title}</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {item.isComplete ? completeStatusLabel : inProgressStatusLabel}\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-2 shrink-0\">\n {item.duration !== undefined && (\n <span className=\"rounded bg-primary px-2 py-0.5 text-xs text-primary-foreground\">\n {formatDuration(item.duration)}\n </span>\n )}\n <ChevronDownIcon rotated={isExpanded} />\n </div>\n </button>\n\n {isExpanded && item.children && (\n <div id={`mosaic-nav-panel-${item.id}`} className=\"border-t border-border p-4\">\n {item.children}\n </div>\n )}\n </div>\n );\n })}\n </nav>\n );\n }\n\n // Desktop tabs\n return (\n <nav\n ref={ref}\n data-slot=\"adaptive-navigation\"\n className={cn(\"w-full\", className)}\n aria-label={tabNavAriaLabel}\n >\n <div\n role=\"tablist\"\n className=\"flex w-full rounded-lg bg-muted p-1\"\n style={{ display: \"grid\", gridTemplateColumns: `repeat(${items.length}, minmax(0, 1fr))` }}\n >\n {items.map((item, idx) => {\n const isActive = item.id === activeItem;\n return (\n <button\n key={item.id}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n onClick={() => onItemChange(item.id)}\n className={cn(\n \"flex items-center justify-center gap-2 rounded-md px-3 py-2 text-sm font-medium transition-colors\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1\",\n isActive\n ? \"bg-primary text-primary-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground\",\n )}\n >\n <div\n className={cn(\n \"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold\",\n item.isComplete\n ? \"bg-success-500 text-white\"\n : isActive\n ? \"bg-primary-foreground/20 text-primary-foreground\"\n : \"bg-background text-muted-foreground\",\n )}\n aria-hidden=\"true\"\n >\n {item.isComplete ? <CheckIcon /> : idx + 1}\n </div>\n <span className=\"hidden sm:inline\">{item.title}</span>\n {item.duration !== undefined && (\n <span\n className={cn(\n \"rounded px-1 py-0.5 text-xs\",\n isActive ? \"bg-primary-foreground/20\" : \"bg-muted\",\n )}\n >\n {formatDuration(item.duration)}\n </span>\n )}\n </button>\n );\n })}\n </div>\n </nav>\n );\n}\n\nMosaicAdaptiveNavigation.displayName = \"MosaicAdaptiveNavigation\";\n"
15
+ }
16
+ ],
17
+ "type": "registry:ui"
18
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-add-memory-form",
4
+ "title": "MosaicAddMemoryForm",
5
+ "description": "MosaicAddMemoryForm — presentational \"record a new memory\" form",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.37-alpha/r/mosaic-select.json",
9
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.37-alpha/r/mosaic-tag-input.json",
10
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.37-alpha/r/mosaic-textarea.json"
11
+ ],
12
+ "files": [
13
+ {
14
+ "path": "src/components/add-memory-form/MosaicAddMemoryForm.tsx",
15
+ "type": "registry:ui",
16
+ "content": "/**\n * MosaicAddMemoryForm — presentational \"record a new memory\" form\n *\n * Presentational atom composed from existing mosaic-blocks primitives:\n * MosaicTextarea, MosaicSelect and MosaicTagInput. This component never\n * invents a new form field or tag chip — it assembles the ones the library\n * already ships.\n *\n * Fully controlled: `content`/`type`/`tags` are single-source-of-truth\n * values supplied by the host, every change is reported via a callback. The\n * component keeps no internal form state.\n *\n * Validation belongs to the host (SIN-01 + doctrine \"the host decides\"):\n * `canSubmit` is a host-computed boolean gating the submit button, and\n * `contentError` is a host-computed string — this component only *displays*\n * an error, it never decides whether one exists. When an error string is\n * supplied, the content field gets `aria-invalid=\"true\"` and\n * `aria-describedby` pointing at the rendered error text; the field is\n * `aria-invalid=\"false\"` otherwise, so the absence of an error is never\n * ambiguous.\n *\n * No hardcoded taxonomy: `types` is a required host-supplied list — the\n * set of memory categories/types is business knowledge, never baked into\n * the library. Suggested tags (`suggestedTags`) are likewise entirely\n * host-supplied.\n *\n * isSubmitting sets `aria-busy=\"true\"` on the submit button and disables\n * both actions — a submission-in-progress is announced, never silent.\n *\n * data-slot=\"add-memory-form\" on the form root.\n * Bilingual: every user-facing string (labels/placeholders/errors/button\n * labels) is a required host-supplied prop — zero hardcoded copy, zero\n * default (SIN-01).\n *\n * No \"use client\" in source — prepend-use-client.mjs adds it to dist.\n * Design tokens: --border, --destructive, --foreground.\n *\n * @example\n * <MosaicAddMemoryForm\n * content={content}\n * onContentChange={setContent}\n * contentLabel=\"Content\"\n * contentPlaceholder=\"What do you want to remember?\"\n * contentError={contentError}\n * types={types}\n * type={type}\n * onTypeChange={setType}\n * typeLabel=\"Type\"\n * tags={tags}\n * onAddTag={(t) => setTags((prev) => [...prev, t])}\n * onRemoveTag={(t) => setTags((prev) => prev.filter((x) => x !== t))}\n * tagsLabel=\"Tags\"\n * tagInputPlaceholder=\"Add a tag…\"\n * removeTagAriaLabel={(t) => `Remove ${t}`}\n * isSubmitting={isSubmitting}\n * canSubmit={canSubmit}\n * onSubmit={handleSubmit}\n * onCancel={() => setOpen(false)}\n * submitButtonLabel=\"Save Memory\"\n * submittingLabel=\"Saving…\"\n * cancelButtonLabel=\"Cancel\"\n * />\n */\n\nimport { useId } from \"react\";\nimport { MosaicSelect, type MosaicSelectItem } from \"@/components/ui/MosaicSelect\";\nimport { MosaicTagInput } from \"@/components/ui/MosaicTagInput\";\nimport { MosaicTextarea } from \"@/components/ui/MosaicTextarea\";\nimport {\n addMemoryFormButtonVariants,\n addMemoryFormErrorVariants,\n addMemoryFormFieldVariants,\n addMemoryFormFooterVariants,\n addMemoryFormRootVariants,\n} from \"./add-memory-form-variants.js\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicAddMemoryFormProps {\n /** Current memory content value — controlled. */\n content: string;\n /** Called on every keystroke in the content field. */\n onContentChange: (value: string) => void;\n /** Label for the content field. Required, no default. */\n contentLabel: string;\n /** Placeholder for the content field. */\n contentPlaceholder?: string;\n /** Host-computed validation message for the content field, or absent when valid. */\n contentError?: string;\n\n /** Host-supplied type/category taxonomy — never hardcoded in the library. */\n types: MosaicSelectItem[];\n /** Currently selected type value — controlled. */\n type: string;\n /** Called when the host user picks a different type. */\n onTypeChange: (value: string) => void;\n /** Label for the type field. Required, no default. */\n typeLabel: string;\n\n /** Current tag list — controlled, single source of truth owned by the host. */\n tags: string[];\n /** Called when a tag should be added. */\n onAddTag: (tag: string) => void;\n /** Called when a tag should be removed. */\n onRemoveTag: (tag: string) => void;\n /** Label for the tags field. Required, no default. */\n tagsLabel: string;\n /** Placeholder for the tag input. Required, no default. */\n tagInputPlaceholder: string;\n /** Per-tag accessible name for the remove button. Required, no default. */\n removeTagAriaLabel: (tag: string) => string;\n /** Optional host-supplied suggested tags (e.g. derived from the chosen type). */\n suggestedTags?: string[];\n /** Optional maximum number of tags. */\n maxTags?: number;\n\n /** True while a submit request is in flight — announced via aria-busy, disables both actions. */\n isSubmitting: boolean;\n /**\n * Host-computed form validity gating the submit button. This component\n * never decides validation itself — it only reflects the host's verdict.\n */\n canSubmit: boolean;\n /** Called when the host user submits the form. */\n onSubmit: () => void;\n /** Called when the host user clicks Cancel. */\n onCancel: () => void;\n /** Label for the submit button while idle. Required, no default. */\n submitButtonLabel: string;\n /** Label for the submit button while isSubmitting=true. Required, no default. */\n submittingLabel: string;\n /** Label for the cancel button. Required, no default. */\n cancelButtonLabel: string;\n\n /** Additional Tailwind classes on the form root. */\n className?: string;\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicAddMemoryForm — production \"record a new memory\" form for\n * @vantageos/mosaic-blocks.\n *\n * Purely presentational and fully controlled: composes MosaicTextarea +\n * MosaicSelect + MosaicTagInput. No network call, no built-in taxonomy, no\n * built-in validation, no built-in copy.\n */\nexport function MosaicAddMemoryForm({\n content,\n onContentChange,\n contentLabel,\n contentPlaceholder,\n contentError,\n types,\n type,\n onTypeChange,\n typeLabel,\n tags,\n onAddTag,\n onRemoveTag,\n tagsLabel,\n tagInputPlaceholder,\n removeTagAriaLabel,\n suggestedTags,\n maxTags,\n isSubmitting,\n canSubmit,\n onSubmit,\n onCancel,\n submitButtonLabel,\n submittingLabel,\n cancelButtonLabel,\n className,\n}: MosaicAddMemoryFormProps) {\n const contentErrorId = useId();\n\n return (\n <div data-slot=\"add-memory-form\" className={cn(addMemoryFormRootVariants(), className)}>\n <div className={addMemoryFormFieldVariants()}>\n <label htmlFor=\"mosaic-add-memory-content\" className=\"text-sm font-medium text-foreground\">\n {contentLabel}\n </label>\n <MosaicTextarea\n id=\"mosaic-add-memory-content\"\n value={content}\n placeholder={contentPlaceholder}\n onChange={(e) => onContentChange(e.target.value)}\n rows={4}\n aria-invalid={contentError ? \"true\" : \"false\"}\n aria-describedby={contentError ? contentErrorId : undefined}\n />\n {contentError && (\n <p id={contentErrorId} className={addMemoryFormErrorVariants()}>\n {contentError}\n </p>\n )}\n </div>\n\n <div className={addMemoryFormFieldVariants()}>\n <span className=\"text-sm font-medium text-foreground\">{typeLabel}</span>\n <MosaicSelect\n items={types}\n value={type}\n onValueChange={(value) => {\n if (value) onTypeChange(value);\n }}\n />\n </div>\n\n <div className={addMemoryFormFieldVariants()}>\n <span className=\"text-sm font-medium text-foreground\">{tagsLabel}</span>\n <MosaicTagInput\n tags={tags}\n onAddTag={onAddTag}\n onRemoveTag={onRemoveTag}\n placeholder={tagInputPlaceholder}\n removeTagAriaLabel={removeTagAriaLabel}\n suggestions={suggestedTags}\n maxTags={maxTags}\n />\n </div>\n\n <div className={addMemoryFormFooterVariants()}>\n <button\n type=\"button\"\n data-slot=\"add-memory-form-cancel-button\"\n onClick={onCancel}\n disabled={isSubmitting}\n className={addMemoryFormButtonVariants({ intent: \"cancel\" })}\n >\n {cancelButtonLabel}\n </button>\n <button\n type=\"button\"\n data-slot=\"add-memory-form-submit-button\"\n onClick={onSubmit}\n disabled={!canSubmit || isSubmitting}\n aria-busy={isSubmitting ? \"true\" : \"false\"}\n className={addMemoryFormButtonVariants({ intent: \"submit\" })}\n >\n {isSubmitting ? submittingLabel : submitButtonLabel}\n </button>\n </div>\n </div>\n );\n}\n\nMosaicAddMemoryForm.displayName = \"MosaicAddMemoryForm\";\n"
17
+ },
18
+ {
19
+ "path": "src/components/add-memory-form/add-memory-form-variants.ts",
20
+ "type": "registry:ui",
21
+ "content": "/**\n * addMemoryFormVariants — pure CVA variant functions for MosaicAddMemoryForm.\n *\n * Isolated in their own module so they can be re-exported from the\n * `@vantageos/mosaic-blocks/server` subpath without pulling in React.\n *\n * Zero browser / React runtime dependencies — safe in RSC / Node.js.\n */\n\nimport { cva } from \"class-variance-authority\";\n\n/** Form vertical layout. */\nexport const addMemoryFormRootVariants = cva([\"flex flex-col gap-4\"]);\n\n/** Field group (label + control + helper/error) vertical layout. */\nexport const addMemoryFormFieldVariants = cva([\"flex flex-col gap-1.5\"]);\n\n/** Field error text. */\nexport const addMemoryFormErrorVariants = cva([\"text-xs font-medium text-destructive\"]);\n\n/** Footer action row. */\nexport const addMemoryFormFooterVariants = cva([\n \"flex items-center justify-end gap-3 border-t border-border pt-4\",\n]);\n\n/** Submit / cancel button variants by intent. */\nexport const addMemoryFormButtonVariants = cva(\n [\n \"inline-flex min-h-9 items-center justify-center gap-2 rounded-md px-4 text-sm font-medium\",\n \"transition-colors disabled:cursor-not-allowed disabled:opacity-50\",\n ],\n {\n variants: {\n intent: {\n cancel: \"border border-border bg-background hover:bg-muted\",\n submit: \"border border-transparent bg-primary text-primary-foreground hover:bg-primary/90\",\n },\n },\n defaultVariants: {\n intent: \"cancel\",\n },\n },\n);\n"
22
+ }
23
+ ],
24
+ "type": "registry:ui"
25
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-admin-only-guard",
4
+ "title": "MosaicAdminOnlyGuard",
5
+ "description": "MosaicAdminOnlyGuard — permission gate that renders `children` for admins, an access-denied card for non-admins, and a loading fallback while permissions resolve, EveVantage M3 C7.",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.37-alpha/r/mosaic-button.json"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/components/admin-only-guard/MosaicAdminOnlyGuard.tsx",
13
+ "type": "registry:ui",
14
+ "content": "\"use client\";\n\n/**\n * MosaicAdminOnlyGuard — permission gate that renders `children` for admins,\n * an access-denied card for non-admins, and a loading fallback while\n * permissions resolve, EveVantage M3 C7.\n *\n * Reuse: ported from any-debate-ai —\n * components/organization/admin-only-guard.tsx — stripped of its\n * `next/navigation` `useRouter`, its mock `useOrganizationContext` Clerk\n * fixture, its `useDevice()` JS branch, and its shadcn/ui `Button` / `lucide-react`\n * icon imports. Button primitive reused from this repo's own `MosaicButton`\n * (`src/components/button/Button.tsx`) rather than a fresh port.\n *\n * The gate is a pure, prop-driven display: the host supplies `isAdmin` and\n * `isLoaded` (from wherever it resolves organization membership) and, when it\n * wants an exit affordance on the denied state, an `onExit` handler. There is\n * no backend, no fetch, no router — the host owns navigation from `onExit`.\n *\n * Responsive sizing (icon dimensions) is done via Tailwind breakpoints\n * (`size-16 md:size-20`), never via a `useDevice()` JS branch — see\n * `MosaicOrgContextDisplay` for the rationale (jsdom's `matchMedia` always\n * reports non-matching, so a JS-branched \"desktop-only\" size is permanently\n * wrong under test).\n *\n * data-slot=\"admin-only-guard\" on the denied-state root.\n *\n * i18n: zero hardcoded user-facing strings (mosaic-blocks doctrine — see\n * src/__tests__/i18n-no-hardcoded-literals.test.ts). Every label is a\n * required prop; the host owns the language.\n */\n\nimport type * as React from \"react\";\nimport { MosaicButton } from \"@/components/ui/Button\";\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\nfunction ShieldIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"size-3 shrink-0 md:size-4\"\n >\n <path d=\"M20 13c0 5-3.5 7.5-7.35 8.95a1 1 0 0 1-1.3 0C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.79 17 5 19 5a1 1 0 0 1 1 1z\" />\n </svg>\n );\n}\n\nfunction AlertTriangleIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"size-8 shrink-0 text-destructive md:size-10\"\n >\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </svg>\n );\n}\n\nfunction ArrowLeftIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"size-4 shrink-0\"\n >\n <path d=\"m12 19-7-7 7-7\" />\n <path d=\"M19 12H5\" />\n </svg>\n );\n}\n\nexport interface MosaicAdminOnlyGuardBaseProps {\n /** Content rendered only when `isAdmin` is true. */\n children: React.ReactNode;\n /** Whether the current user holds the admin role. */\n isAdmin: boolean;\n /** Whether permission resolution has completed. `false` renders `loadingFallback`. */\n isLoaded: boolean;\n /** Host-owned title for the access-denied card (e.g. \"Admin Access Required\"). Required, no default. */\n title: string;\n /** Host-owned description for the access-denied card. Required, no default. */\n description: string;\n /** Host-owned label for the required-role badge (e.g. \"Required role: Admin\"). Required, no default. */\n requiredRoleLabel: string;\n /** Rendered while `isLoaded` is false. Defaults to a minimal spinner div. */\n loadingFallback?: React.ReactNode;\n className?: string;\n}\n\n/**\n * Discriminated union on `onExit` — the exit button only ever renders on\n * the branch where an exit handler is supplied, so its accessible-name\n * props are required EXACTLY there, never on the branch without a handler.\n * See `MosaicOrgContextDisplaySwitchProps` for the same repo-wide pattern.\n */\nexport type MosaicAdminOnlyGuardExitProps =\n | {\n /** Invoked only by the exit button's click on the denied state. Never called automatically — not on mount, not when permissions finish loading; the host owns navigation. */\n onExit: () => void;\n /** Visible label on the exit button (e.g. \"Back to Dashboard\"). Required — the button renders whenever `onExit` is provided. */\n exitLabel: string;\n /** Accessible name for the exit button. Required — the button renders whenever `onExit` is provided. */\n exitAriaLabel: string;\n }\n | {\n /** Omit to render the denied card with no exit button. */\n onExit?: undefined;\n };\n\nexport type MosaicAdminOnlyGuardProps = MosaicAdminOnlyGuardBaseProps &\n MosaicAdminOnlyGuardExitProps;\n\nfunction DefaultLoadingFallback() {\n return (\n <div className=\"flex min-h-screen items-center justify-center p-4 md:p-8\">\n <div\n data-slot=\"admin-only-guard-loading\"\n aria-hidden=\"true\"\n className=\"size-8 animate-spin rounded-full border-2 border-muted-foreground/30 border-t-primary md:size-10\"\n />\n </div>\n );\n}\n\nexport function MosaicAdminOnlyGuard(props: MosaicAdminOnlyGuardProps) {\n const {\n children,\n isAdmin,\n isLoaded,\n title,\n description,\n requiredRoleLabel,\n loadingFallback,\n className,\n } = props;\n\n if (!isLoaded) {\n return <>{loadingFallback ?? <DefaultLoadingFallback />}</>;\n }\n\n if (!isAdmin) {\n return (\n <div\n data-slot=\"admin-only-guard\"\n className={cn(\n \"flex min-h-screen flex-col items-center justify-center p-4 md:p-8\",\n className,\n )}\n >\n <div className=\"flex w-full max-w-md flex-col items-center gap-4 rounded-lg border bg-card p-6 md:gap-6 md:p-8\">\n <div className=\"flex size-16 items-center justify-center rounded-full bg-destructive/10 md:size-20\">\n <AlertTriangleIcon />\n </div>\n\n <h2 className=\"text-center font-semibold text-lg md:text-xl\">{title}</h2>\n\n <p className=\"text-center text-muted-foreground text-sm md:text-base\">{description}</p>\n\n <div className=\"flex items-center gap-2 rounded-md bg-primary/10 px-3 py-2 text-primary text-xs md:text-sm\">\n <ShieldIcon />\n <span className=\"font-medium\">{requiredRoleLabel}</span>\n </div>\n\n {props.onExit ? (\n <MosaicButton\n onClick={props.onExit}\n aria-label={props.exitAriaLabel}\n className=\"mt-2 min-h-[44px] w-full\"\n >\n <ArrowLeftIcon />\n {props.exitLabel}\n </MosaicButton>\n ) : null}\n </div>\n </div>\n );\n }\n\n return <>{children}</>;\n}\n\nMosaicAdminOnlyGuard.displayName = \"MosaicAdminOnlyGuard\";\n"
15
+ }
16
+ ],
17
+ "type": "registry:ui"
18
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-agent-builder-modal",
4
+ "title": "MosaicAgentBuilderModal",
5
+ "description": "MosaicAgentBuilderModal — modal shell for composing/configuring an agent, confirmed or cancelled by the host.",
6
+ "dependencies": [
7
+ "@base-ui/react"
8
+ ],
9
+ "registryDependencies": [],
10
+ "files": [
11
+ {
12
+ "path": "src/components/agent-builder-modal/MosaicAgentBuilderModal.tsx",
13
+ "type": "registry:ui",
14
+ "content": "\"use client\";\n\n/**\n * MosaicAgentBuilderModal — modal shell for composing/configuring an agent,\n * confirmed or cancelled by the host.\n *\n * Ported (shape only) from any-debate-ai's agent-builder modal pattern — no\n * business logic carried over: no field list, no model presets, no default\n * prompts. This component owns the dialog shell (backdrop, popup, title,\n * description, footer actions) only. The agent configuration form itself\n * (fields, values, validation) is entirely host-supplied via `children` —\n * see MosaicAgentEditor for a form that composes naturally inside it.\n *\n * Built on `@base-ui/react/dialog` (not `alert-dialog`): confirming a\n * composed agent is not a destructive action needing an `alertdialog` role,\n * so the plain Dialog primitive is the correct fit — same focus trap,\n * Escape-to-cancel, and background-inert behavior as `alert-dialog`.\n *\n * Fully host-controlled: `open` + `onOpenChange` come from the caller, the\n * component keeps no state of its own (cf. MosaicDrawer / MosaicAdaptiveModal\n * convention in this package).\n *\n * The confirm button does NOT auto-close the modal on click: creating an\n * agent is commonly asynchronous (a network call), so the host decides when\n * to flip `open` to `false` — typically only after the save succeeds. The\n * cancel button, however, always closes immediately (`Dialog.Close`) in\n * addition to notifying the host via `onCancel`.\n *\n * SIN-01: every visible string (`title`, `description`, `closeAriaLabel`,\n * `confirmLabel`, `cancelLabel`, `confirmingLabel`) is a REQUIRED prop with\n * no default — the library carries no copy, the host owns i18n.\n */\n\nimport { Dialog } from \"@base-ui/react/dialog\";\nimport * as React from \"react\";\nimport {\n agentBuilderModalBackdropVariants,\n agentBuilderModalPopupVariants,\n} from \"./agent-builder-modal-variants.js\";\n\n// ── Utility ──────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Props ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicAgentBuilderModalProps {\n /** Controlled open state — the host owns the truth. */\n open: boolean;\n /** Controlled state setter, called on every open/close intent (including Escape and Cancel). */\n onOpenChange: (open: boolean) => void;\n\n /** Modal title, wired to `aria-labelledby`. Required — no default, no fallback. */\n title: string;\n /** Modal description, wired to `aria-describedby`. Required — no default, no fallback. */\n description: string;\n /** aria-label for the close (X) button. Required — the host owns the language. */\n closeAriaLabel: string;\n\n /** Confirm button label, shown when not confirming. Required — no default. */\n confirmLabel: string;\n /** Confirm button label, shown while `isConfirming` is true. Required — no default. */\n confirmingLabel: string;\n /** Cancel button label. Required — no default. */\n cancelLabel: string;\n\n /** Called when the confirm button is clicked and `canConfirm` is true. Does not close the modal. */\n onConfirm: () => void;\n /** Called when the cancel button is clicked, before the modal closes. */\n onCancel: () => void;\n /** Host decides whether the confirm action is currently allowed (e.g. form validity). */\n canConfirm: boolean;\n /** Host-controlled submission-in-flight state — disables confirm and swaps its label. */\n isConfirming: boolean;\n\n /** The agent configuration form/content — entirely host-owned. */\n children: React.ReactNode;\n className?: string;\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicAgentBuilderModal — production agent-builder modal shell for\n * @vantageos/mosaic-blocks.\n *\n * @example\n * // Host owns i18n (e.g. next-intl) and the agent schema/config.\n * <MosaicAgentBuilderModal\n * open={open}\n * onOpenChange={setOpen}\n * title={t('AgentBuilder.title')}\n * description={t('AgentBuilder.description')}\n * closeAriaLabel={t('AgentBuilder.aria.close')}\n * confirmLabel={t('AgentBuilder.confirm')}\n * confirmingLabel={t('AgentBuilder.confirming')}\n * cancelLabel={t('AgentBuilder.cancel')}\n * onConfirm={handleCreate}\n * onCancel={() => setOpen(false)}\n * canConfirm={isValid}\n * isConfirming={isSaving}\n * >\n * <MosaicAgentEditor {...editorProps} /> // allow-hardcode-i18n: JSDoc @example doc comment, not shipped code\n * </MosaicAgentBuilderModal>\n */\nexport function MosaicAgentBuilderModal({\n open,\n onOpenChange,\n title,\n description,\n closeAriaLabel,\n confirmLabel,\n confirmingLabel,\n cancelLabel,\n onConfirm,\n onCancel,\n canConfirm,\n isConfirming,\n children,\n className,\n}: MosaicAgentBuilderModalProps) {\n const titleId = React.useId();\n const descriptionId = React.useId();\n\n const confirmDisabled = !canConfirm || isConfirming;\n\n const handleConfirm = () => {\n if (confirmDisabled) return;\n onConfirm();\n };\n\n return (\n <Dialog.Root open={open} onOpenChange={(nextOpen) => onOpenChange(nextOpen)} modal>\n <Dialog.Portal>\n <Dialog.Backdrop\n data-slot=\"agent-builder-modal-backdrop\"\n className={agentBuilderModalBackdropVariants()}\n />\n <Dialog.Popup\n data-slot=\"agent-builder-modal\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n aria-modal=\"true\"\n className={cn(agentBuilderModalPopupVariants(), className)}\n >\n <div\n data-slot=\"agent-builder-modal-header\"\n className=\"flex items-start justify-between gap-4 border-b border-border p-4\"\n >\n <div className=\"flex flex-col gap-1\">\n <Dialog.Title id={titleId} className=\"text-base font-semibold text-foreground\">\n {title}\n </Dialog.Title>\n <Dialog.Description id={descriptionId} className=\"text-sm text-muted-foreground\">\n {description}\n </Dialog.Description>\n </div>\n <Dialog.Close\n aria-label={closeAriaLabel}\n className={cn(\n \"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors\",\n \"hover:bg-muted hover:text-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </Dialog.Close>\n </div>\n\n <div data-slot=\"agent-builder-modal-body\" className=\"min-h-0 flex-1 overflow-y-auto p-4\">\n {children}\n </div>\n\n <div\n data-slot=\"agent-builder-modal-footer\"\n className=\"flex flex-col-reverse gap-2 border-t border-border p-4 sm:flex-row sm:justify-end\"\n >\n <Dialog.Close\n onClick={onCancel}\n className={cn(\n \"inline-flex h-9 items-center justify-center gap-1.5 rounded-md border border-border px-4\",\n \"bg-background text-sm font-medium text-foreground shadow-xs\",\n \"hover:bg-muted hover:text-foreground\",\n \"focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n >\n {cancelLabel}\n </Dialog.Close>\n <button\n type=\"button\"\n onClick={handleConfirm}\n disabled={confirmDisabled}\n className={cn(\n \"inline-flex h-9 items-center justify-center gap-1.5 rounded-md px-4\",\n \"bg-primary text-sm font-medium text-primary-foreground\",\n \"hover:bg-primary/90\",\n \"focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n >\n {isConfirming ? confirmingLabel : confirmLabel}\n </button>\n </div>\n </Dialog.Popup>\n </Dialog.Portal>\n </Dialog.Root>\n );\n}\n\nMosaicAgentBuilderModal.displayName = \"MosaicAgentBuilderModal\";\n"
15
+ },
16
+ {
17
+ "path": "src/components/agent-builder-modal/agent-builder-modal-variants.ts",
18
+ "type": "registry:ui",
19
+ "content": "/**\n * agentBuilderModalVariants — pure CVA variant functions for\n * MosaicAgentBuilderModal.\n *\n * Isolated in its own module so it can be re-exported from the\n * `@vantageos/mosaic-blocks/server` subpath without pulling in React or\n * @base-ui/react (which live in MosaicAgentBuilderModal.tsx but not here).\n *\n * Zero browser / React runtime dependencies — safe in RSC / Node.js.\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const agentBuilderModalPopupVariants = cva([\n \"fixed top-1/2 left-1/2 z-50 flex max-h-[85vh] w-full max-w-[calc(100%-2rem)] flex-col\",\n \"-translate-x-1/2 -translate-y-1/2\",\n \"rounded-lg border border-border bg-background shadow-lg outline-none\",\n \"sm:max-w-lg\",\n]);\n\nexport const agentBuilderModalBackdropVariants = cva([\"fixed inset-0 z-50 bg-black/50\"]);\n"
20
+ }
21
+ ],
22
+ "type": "registry:ui"
23
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-agent-card",
4
+ "title": "MosaicAgentCard",
5
+ "description": "Generic agent/resource card with status toggle, accent dot, 3-dot dropdown menu. All actions are callbacks.",
6
+ "dependencies": [],
7
+ "registryDependencies": [],
8
+ "files": [
9
+ {
10
+ "path": "src/components/agent-card/MosaicAgentCard.tsx",
11
+ "type": "registry:ui",
12
+ "content": "\"use client\";\n\n/**\n * MosaicAgentCard — generic agent/resource card with status toggle\n *\n * Ported from components/agent-management/AgentCard.tsx\n *\n * Features:\n * - Status indicator bar (top) + colored dot (model type)\n * - Active/inactive badge + toggle button\n * - 3-dot dropdown menu (activate/deactivate, edit, delete)\n * - Accent dot color per agent type via props\n *\n * Framer-motion replaced with CSS transitions.\n * toast/router removed — all actions are callbacks.\n * next/navigation removed.\n */\n\nimport * as React from \"react\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MosaicAgentData {\n id: string;\n name: string;\n description?: string;\n type?: string;\n isActive?: boolean;\n createdAt?: string | Date;\n /** Tailwind bg class for the accent dot (e.g. \"bg-green-500\") */\n accentColor?: string;\n /** Whether edit/delete actions are available */\n isEditable?: boolean;\n}\n\nexport interface MosaicAgentCardProps {\n agent: MosaicAgentData;\n onToggleStatus?: (agentId: string) => void;\n onDelete?: (agentId: string) => void;\n onEdit?: (agentId: string) => void;\n /** Whether a toggle/save action is in progress */\n isLoading?: boolean;\n /**\n * Label shown in the \"active\" badge next to the agent name. Required —\n * the host owns the language (e.g. `t('AgentCard.active')`). No default.\n */\n activeBadgeLabel: string;\n /**\n * aria-label for the 3-dot actions menu trigger. Required — host-owned,\n * no default.\n */\n agentActionsAriaLabel: string;\n /** Label for the \"deactivate\" menu item. Required — host-owned, no default. */\n deactivateLabel: string;\n /** Label for the \"activate\" menu item. Required — host-owned, no default. */\n activateLabel: string;\n /** Label for the \"edit\" menu item. Required — host-owned, no default. */\n editLabel: string;\n /** Label for the \"delete\" menu item. Required — host-owned, no default. */\n deleteLabel: string;\n /** Label for the \"pause\" toggle button. Required — host-owned, no default. */\n pauseLabel: string;\n /** Label for the \"start\" toggle button. Required — host-owned, no default. */\n startLabel: string;\n /**\n * Formatter for the \"Created <date>\" caption. Required — the host owns\n * the language (e.g. `(date) => t('AgentCard.created', { date })`).\n */\n createdLabel: (date: string) => string;\n className?: string;\n}\n\n// ── Inline SVG icons ──────────────────────────────────────────────────────────\n\nfunction MoreVertIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <circle cx=\"12\" cy=\"5\" r=\"1\" />\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"12\" cy=\"19\" r=\"1\" />\n </svg>\n );\n}\n\nfunction PlayIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polygon points=\"5 3 19 12 5 21 5 3\" />\n </svg>\n );\n}\n\nfunction PauseIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <rect x=\"6\" y=\"4\" width=\"4\" height=\"16\" />\n <rect x=\"14\" y=\"4\" width=\"4\" height=\"16\" />\n </svg>\n );\n}\n\nfunction EditIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\" />\n <path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\" />\n </svg>\n );\n}\n\nfunction TrashIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"3 6 5 6 21 6\" />\n <path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2\" />\n </svg>\n );\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\nexport function MosaicAgentCard({\n agent,\n onToggleStatus,\n onDelete,\n onEdit,\n isLoading = false,\n activeBadgeLabel,\n agentActionsAriaLabel,\n deactivateLabel,\n activateLabel,\n editLabel,\n deleteLabel,\n pauseLabel,\n startLabel,\n createdLabel,\n className,\n}: MosaicAgentCardProps) {\n const [menuOpen, setMenuOpen] = React.useState(false);\n const menuRef = React.useRef<HTMLDivElement>(null);\n\n const formattedDate = agent.createdAt\n ? new Date(agent.createdAt).toLocaleDateString()\n : undefined;\n\n // Close menu on outside click\n React.useEffect(() => {\n if (!menuOpen) return;\n const handler = (e: MouseEvent) => {\n if (menuRef.current && !menuRef.current.contains(e.target as Node)) {\n setMenuOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, [menuOpen]);\n\n return (\n <div\n data-slot=\"agent-card\"\n className={cn(\n \"relative overflow-hidden rounded-lg border border-border bg-card text-card-foreground shadow-sm\",\n \"transition-shadow hover:shadow-md\",\n agent.isActive && \"ring-2 ring-primary\",\n className,\n )}\n >\n {/* Status bar */}\n <div\n className={cn(\n \"absolute left-0 top-0 h-1 w-full\",\n agent.isActive ? \"bg-primary\" : \"bg-muted\",\n )}\n />\n\n <div className=\"p-4 pt-5\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n {agent.accentColor && (\n <span\n className={cn(\"h-3 w-3 shrink-0 rounded-full\", agent.accentColor)}\n aria-hidden=\"true\"\n />\n )}\n <div className=\"min-w-0\">\n <div className=\"flex items-center gap-2\">\n <p className=\"truncate text-base font-semibold\">{agent.name}</p>\n {agent.isActive && (\n <span className=\"shrink-0 rounded-full bg-primary px-2 py-0.5 text-xs font-medium text-primary-foreground\">\n {activeBadgeLabel}\n </span>\n )}\n </div>\n {agent.description && (\n <p className=\"mt-0.5 truncate text-sm text-muted-foreground\">{agent.description}</p>\n )}\n </div>\n </div>\n\n {/* 3-dot menu */}\n <div ref={menuRef} className=\"relative shrink-0\">\n <button\n type=\"button\"\n onClick={() => setMenuOpen((v) => !v)}\n className={cn(\n \"inline-flex h-8 w-8 items-center justify-center rounded-md\",\n \"text-muted-foreground hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n aria-label={agentActionsAriaLabel}\n aria-haspopup=\"menu\"\n aria-expanded={menuOpen}\n >\n <MoreVertIcon />\n </button>\n\n {menuOpen && (\n <div\n role=\"menu\"\n className={cn(\n \"absolute right-0 top-full z-50 mt-1 min-w-[140px] rounded-md border border-border\",\n \"bg-popover py-1 shadow-md\",\n )}\n >\n {onToggleStatus && (\n <button\n type=\"button\"\n role=\"menuitem\"\n disabled={isLoading}\n onClick={() => {\n onToggleStatus(agent.id);\n setMenuOpen(false);\n }}\n className={cn(\n \"flex w-full items-center gap-2 px-3 py-2 text-sm text-foreground\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n >\n {agent.isActive ? <PauseIcon /> : <PlayIcon />}\n {agent.isActive ? deactivateLabel : activateLabel}\n </button>\n )}\n {agent.isEditable && onEdit && (\n <button\n type=\"button\"\n role=\"menuitem\"\n onClick={() => {\n onEdit(agent.id);\n setMenuOpen(false);\n }}\n className=\"flex w-full items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-accent hover:text-accent-foreground\"\n >\n <EditIcon />\n {editLabel}\n </button>\n )}\n {agent.isEditable && onDelete && (\n <button\n type=\"button\"\n role=\"menuitem\"\n onClick={() => {\n onDelete(agent.id);\n setMenuOpen(false);\n }}\n className=\"flex w-full items-center gap-2 px-3 py-2 text-sm text-destructive hover:bg-destructive/10\"\n >\n <TrashIcon />\n {deleteLabel}\n </button>\n )}\n </div>\n )}\n </div>\n </div>\n\n <div className=\"mt-3 flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n {agent.type && (\n <span className=\"rounded-md border border-border px-2 py-0.5 text-xs font-medium\">\n {agent.type}\n </span>\n )}\n {formattedDate && (\n <span className=\"text-xs text-muted-foreground\">{createdLabel(formattedDate)}</span>\n )}\n </div>\n\n {onToggleStatus && (\n <button\n type=\"button\"\n disabled={isLoading}\n onClick={() => onToggleStatus(agent.id)}\n className={cn(\n \"inline-flex h-7 items-center justify-center rounded-md px-3 text-xs font-medium\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n agent.isActive\n ? \"bg-secondary text-secondary-foreground hover:bg-secondary/80\"\n : \"bg-primary text-primary-foreground hover:bg-primary/90\",\n )}\n >\n {agent.isActive ? pauseLabel : startLabel}\n </button>\n )}\n </div>\n </div>\n </div>\n );\n}\n\nMosaicAgentCard.displayName = \"MosaicAgentCard\";\n"
13
+ }
14
+ ],
15
+ "type": "registry:ui"
16
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "mosaic-agent-chat",
4
+ "title": "MosaicAgentChat",
5
+ "description": "MosaicAgentChat — presentational session harness: MVP-8, the last MVP piece, wiring MosaicChatThread + MosaicChatMessage + MosaicChatComposer + MosaicApprovalPrompt into one send/resume/respond harness.",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.37-alpha/r/mosaic-approval-prompt.json",
9
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.37-alpha/r/mosaic-chat-composer.json",
10
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.37-alpha/r/mosaic-chat-message.json",
11
+ "https://cdn.jsdelivr.net/npm/@vantageos/mosaic-blocks@0.5.37-alpha/r/mosaic-chat-thread.json"
12
+ ],
13
+ "files": [
14
+ {
15
+ "path": "src/components/agent-chat/MosaicAgentChat.tsx",
16
+ "type": "registry:ui",
17
+ "content": "/**\n * MosaicAgentChat — presentational session harness: MVP-8, the last MVP\n * piece, wiring MosaicChatThread + MosaicChatMessage + MosaicChatComposer +\n * MosaicApprovalPrompt into one send/resume/respond harness.\n *\n * Presentational only: no network call, no SDK, no stored client. The\n * message thread is NEVER accumulated as local state — `messages` is a\n * required, host-controlled prop recomputed by the host from its own event\n * journal on every render (this is what lets the thread survive a page\n * reload or a server restart: nothing here owns durable state). The three\n * things this harness actually owns are ephemeral UI-only concerns:\n * - which approval requests have already been answered IN THIS MOUNT\n * (`decisions` — cleared implicitly once the host's `messages` replaces\n * the underlying tool part with a real `output-available` / `output-denied`\n * / `output-error` state);\n * - a one-shot guard so `onResumeSession` fires exactly once per `sessionId`\n * value, never once per render;\n * - forwarding the composer's controlled `value`.\n *\n * Three extension seams, matching the eve/react send-turn contract:\n * - `onSubmit(text)` — send a new turn (idle branch of the composer state).\n * - `onResumeSession(sessionId)` — fired once when a host passes a\n * `sessionId` prop, standing in for `agent.resume(sessionId)`.\n * - `onApprovalResponse({ requestId, optionId?, text? })` — the payload\n * shape mirrors `SendTurnPayload.inputResponses` exactly (eve/react\n * `client/types.ts`); this is the wire that lets an approval decision made\n * in `MosaicApprovalPrompt` travel back to the agent runtime.\n *\n * Pattern: MosaicUrlScraper.tsx (data-slot, inline cn, React 19 ref prop,\n * displayName, JSDoc, pure variants module, host-controlled discriminated\n * union). Composes MosaicChatThread (MVP-1), MosaicChatMessage (MVP-2),\n * MosaicApprovalPrompt (MVP-3), and MosaicChatComposer (T10) — none of\n * these are reimplemented here.\n * No \"use client\" — prepend-use-client.mjs adds it to dist.\n * Design tokens: --border, --card (root only — the composed children carry\n * their own tokens).\n * a11y: delegated entirely to the composed children (MosaicChatThread's\n * `role=\"log\"`, MosaicChatComposer's labelled textarea/button,\n * MosaicApprovalPrompt's `fieldset`/`legend`) — this harness adds no new\n * interactive surface of its own beyond wiring props through.\n * Bilingual: every user-facing string this component reads directly\n * (`scrollToBottomLabel`, `textareaAriaLabel`, `placeholder`,\n * `sendButtonAriaLabel`/`stopButtonAriaLabel`, `reasoningLabel`,\n * `reasoningStreamingLabel`, `toolStatusLabels`, and every\n * `MosaicAgentChatApprovalLabels` field) is a required caller-supplied\n * prop — zero hardcoded copy, zero default.\n *\n * Props are pushed into the `MosaicAgentChatState` discriminated union\n * exactly where they are read: `onSubmit`/`sendButtonAriaLabel` only exist\n * on the \"idle\" branch (forwarded to the composer's own \"idle\" branch);\n * `onStop`/`stopButtonAriaLabel` only exist on the \"responding\" branch.\n * Likewise `MosaicAgentChatToolPartState`'s `approval` field is required\n * ONLY on the `\"approval-requested\"` member, mirroring\n * `MosaicChatMessageToolState`'s own per-branch contract.\n *\n * Ported from eve-tpl app/_components/agent-chat.tsx (rewritten from\n * scratch — no shared code, no license carried over): kept the\n * `agent.send({ inputResponses })` payload shape\n * (`{ requestId; optionId?; text? }`, client/types.ts:140-143) and the\n * \"send a turn\" / \"respond to a pending input request\" duality, dropped\n * every app-specific concern (sign-in gating, rate limiting, Convex\n * persistence, connection authorization, pending-message optimistic UI) —\n * all out of scope for a presentational harness.\n *\n * @example\n * // idle — can submit a new turn, resuming session \"sess_42\"\n * <MosaicAgentChat\n * status=\"idle\"\n * messages={messagesFromEventLog}\n * sessionId=\"sess_42\"\n * onResumeSession={(id) => resumeAgentSession(id)}\n * onSubmit={(text) => sendTurn(text)}\n * sendButtonAriaLabel=\"Envoyer le message\"\n * composerValue={draft}\n * onComposerValueChange={setDraft}\n * textareaAriaLabel=\"Message à eve\"\n * placeholder=\"Demandez ce que vous voulez à eve...\"\n * scrollToBottomLabel=\"Revenir au dernier message\"\n * reasoningLabel=\"Raisonnement\"\n * reasoningStreamingLabel=\"Réflexion en cours…\"\n * toolStatusLabels={{ running: \"En cours\", completed: \"Terminé\", denied: \"Refusé\", error: \"Erreur\" }}\n * renderText={(text) => text}\n * onApprovalResponse={(payload) => agent.send({ inputResponses: [payload] })}\n * />\n */\n\nimport type * as React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport {\n MosaicApprovalPrompt,\n type MosaicApprovalPromptProps,\n} from \"@/components/ui/MosaicApprovalPrompt\";\nimport { MosaicChatComposer } from \"@/components/ui/MosaicChatComposer\";\nimport {\n MosaicChatMessage,\n type MosaicChatMessagePart,\n type MosaicChatMessageSenderRole,\n type MosaicChatMessageToolStatusLabels,\n} from \"@/components/ui/MosaicChatMessage\";\nimport { MosaicChatThread } from \"@/components/ui/MosaicChatThread\";\nimport { agentChatRootVariants } from \"./agent-chat-variants.js\";\n\n// ── Utility ───────────────────────────────────────────────────────────────────\n\nfunction cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\nfunction formatPayload(value: unknown): string {\n if (typeof value === \"string\") {\n return value;\n }\n try {\n return JSON.stringify(value, null, 2);\n } catch {\n return String(value);\n }\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\n/** The exact payload sent back to the agent runtime for one approval decision. */\nexport interface MosaicAgentChatApprovalResponsePayload {\n /** Identifies which pending input request this response answers. */\n requestId: string;\n /** Which choice was made — mirrors eve/react's `optionId` field. */\n optionId?: string;\n /** Free-text response, when the pending request expects one. */\n text?: string;\n}\n\n/** Host-owned copy for one approval request. Required, no default. */\nexport interface MosaicAgentChatApprovalLabels {\n promptTitle: string;\n toolNameLabel: string;\n approveButtonLabel: string;\n denyButtonLabel: string;\n approvedMessage: string;\n deniedMessage: string;\n}\n\n/**\n * Everything needed to render + resolve a pending approval, decoupled from\n * the tool part's own `toolCallId` (a request can outlive a specific tool\n * call id in some agent runtimes, so the two are kept distinct on the wire).\n */\nexport interface MosaicAgentChatApprovalRequest {\n /** Sent back as `requestId` in `MosaicAgentChatApprovalResponsePayload`. */\n requestId: string;\n /** `optionId` sent back when the host approves. */\n approveOptionId: string;\n /** `optionId` sent back when the host denies. */\n denyOptionId: string;\n approvalLabels: MosaicAgentChatApprovalLabels;\n}\n\ntype MosaicAgentChatToolPartBase = {\n type: \"tool\";\n /** Stable identifier for this tool call, used as the React key. */\n toolCallId: string;\n /** Tool name, displayed as-is. */\n toolName: string;\n /** Tool call input payload, shown (JSON-stringified) when present. */\n input?: unknown;\n};\n\n/**\n * Tool-call lifecycle, mirroring `MosaicChatMessageToolState` — each\n * member's own required field lives on that member alone. `approval` is\n * required EXACTLY on `\"approval-requested\"`, the only branch that needs to\n * build a `MosaicApprovalPrompt` and respond on the wire.\n */\nexport type MosaicAgentChatToolPartState =\n | { state: \"input-streaming\" }\n | {\n state: \"approval-requested\";\n /** Everything needed to render + resolve this pending approval. */\n approval: MosaicAgentChatApprovalRequest;\n }\n | { state: \"output-available\"; output: unknown }\n | { state: \"output-denied\" }\n | { state: \"output-error\"; errorText: string };\n\nexport type MosaicAgentChatToolPart = MosaicAgentChatToolPartBase & MosaicAgentChatToolPartState;\n\nexport type MosaicAgentChatMessagePart =\n | { type: \"text\"; text: string }\n | { type: \"reasoning\"; text: string; isStreaming?: boolean }\n | MosaicAgentChatToolPart;\n\n/** One message in the thread, recomputed by the host from its event journal. */\nexport interface MosaicAgentChatMessage {\n /** Stable identifier, used as the React key. */\n id: string;\n messageRole: MosaicChatMessageSenderRole;\n parts: MosaicAgentChatMessagePart[];\n}\n\n/**\n * Base props required in EVERY status — read unconditionally by the\n * component regardless of `status`.\n */\ntype MosaicAgentChatBaseProps = {\n /** The full thread, recomputed by the host from its own event journal. */\n messages: MosaicAgentChatMessage[];\n /** Renders a text/reasoning part's raw string (e.g. MosaicMarkdown). */\n renderText: (text: string) => React.ReactNode;\n reasoningLabel: string;\n reasoningStreamingLabel: string;\n toolStatusLabels: MosaicChatMessageToolStatusLabels;\n /** Accessible name for the thread's \"scroll to bottom\" button. */\n scrollToBottomLabel: string;\n /** Host-controlled current composer text. */\n composerValue: string;\n onComposerValueChange: (value: string) => void;\n textareaAriaLabel: string;\n placeholder: string;\n /**\n * Sends one approval decision back to the agent runtime. Mirrors\n * `agent.send({ inputResponses: [payload] })` — this harness never calls\n * a transport itself, it only builds and forwards the payload.\n */\n onApprovalResponse: (payload: MosaicAgentChatApprovalResponsePayload) => void;\n /**\n * When set, this harness is resuming an existing session rather than\n * starting a new one — `onResumeSession` fires exactly once per distinct\n * `sessionId` value, standing in for `agent.resume(sessionId)`.\n */\n sessionId?: string;\n onResumeSession?: (sessionId: string) => void;\n /** Disables the composer (e.g. host-level connectivity loss). */\n disabled?: boolean;\n className?: string;\n /** React 19 ref prop — forwarded to the root element. */\n ref?: React.Ref<HTMLDivElement>;\n};\n\n/**\n * Host-controlled turn status, forwarded to `MosaicChatComposer`'s own\n * status union. `onSubmit`/`sendButtonAriaLabel` only exist on \"idle\";\n * `onStop`/`stopButtonAriaLabel` only exist on \"responding\".\n */\nexport type MosaicAgentChatState =\n | {\n status: \"idle\";\n /** Sends a new turn — the trimmed composer text. */\n onSubmit: (text: string) => void;\n sendButtonAriaLabel: string;\n }\n | {\n status: \"responding\";\n /** Cancels the in-flight agent response. */\n onStop: () => void;\n stopButtonAriaLabel: string;\n };\n\nexport type MosaicAgentChatProps = MosaicAgentChatBaseProps & MosaicAgentChatState;\n\n// ── Approval wiring ───────────────────────────────────────────────────────────\n\ntype ApprovalDecisions = Record<string, \"approved\" | \"denied\">;\n\nfunction renderApprovalPrompt(\n part: MosaicAgentChatToolPart & { state: \"approval-requested\" },\n decisions: ApprovalDecisions,\n onDecide: (\n payload: MosaicAgentChatApprovalResponsePayload,\n decision: \"approved\" | \"denied\",\n ) => void,\n): React.ReactNode {\n const { approval } = part;\n const decision = decisions[approval.requestId];\n const renderArguments = (\n <pre\n data-slot=\"agent-chat-approval-arguments\"\n className=\"max-h-56 overflow-auto rounded bg-muted/30 p-2 font-mono text-[11px] leading-5 text-muted-foreground\"\n >\n {formatPayload(part.input)}\n </pre>\n );\n\n const sharedProps = {\n toolName: part.toolName,\n toolNameLabel: approval.approvalLabels.toolNameLabel,\n promptTitle: approval.approvalLabels.promptTitle,\n renderArguments,\n };\n\n if (decision === \"approved\" || decision === \"denied\") {\n const decisionMessage =\n decision === \"approved\"\n ? approval.approvalLabels.approvedMessage\n : approval.approvalLabels.deniedMessage;\n const respondedProps: MosaicApprovalPromptProps = {\n ...sharedProps,\n status: \"responded\",\n decision,\n decisionMessage,\n };\n return <MosaicApprovalPrompt {...respondedProps} />;\n }\n\n const pendingProps: MosaicApprovalPromptProps = {\n ...sharedProps,\n status: \"pending\",\n approveButtonLabel: approval.approvalLabels.approveButtonLabel,\n denyButtonLabel: approval.approvalLabels.denyButtonLabel,\n onApprove: () =>\n onDecide({ requestId: approval.requestId, optionId: approval.approveOptionId }, \"approved\"),\n onDeny: () =>\n onDecide({ requestId: approval.requestId, optionId: approval.denyOptionId }, \"denied\"),\n };\n return <MosaicApprovalPrompt {...pendingProps} />;\n}\n\nfunction toRenderPart(\n part: MosaicAgentChatMessagePart,\n decisions: ApprovalDecisions,\n onDecide: (\n payload: MosaicAgentChatApprovalResponsePayload,\n decision: \"approved\" | \"denied\",\n ) => void,\n): MosaicChatMessagePart {\n if (part.type !== \"tool\") {\n return part;\n }\n\n if (part.state === \"approval-requested\") {\n return {\n type: \"tool\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n input: part.input,\n state: \"approval-requested\",\n renderApproval: () => renderApprovalPrompt(part, decisions, onDecide),\n };\n }\n\n switch (part.state) {\n case \"input-streaming\":\n return {\n type: \"tool\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n input: part.input,\n state: \"input-streaming\",\n };\n case \"output-available\":\n return {\n type: \"tool\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n input: part.input,\n state: \"output-available\",\n output: part.output,\n };\n case \"output-denied\":\n return {\n type: \"tool\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n input: part.input,\n state: \"output-denied\",\n };\n case \"output-error\":\n return {\n type: \"tool\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n input: part.input,\n state: \"output-error\",\n errorText: part.errorText,\n };\n }\n}\n\n// ── Component ─────────────────────────────────────────────────────────────────\n\n/**\n * MosaicAgentChat — production session-harness atom for\n * @vantageos/mosaic-blocks.\n *\n * Purely presentational: composes MosaicChatThread + MosaicChatMessage +\n * MosaicApprovalPrompt + MosaicChatComposer, sends a turn, resumes a\n * session once, and forwards approval decisions on the exact\n * `{ requestId; optionId?; text? }` wire shape. No network call, no SDK,\n * no stored thread.\n */\nexport function MosaicAgentChat(props: MosaicAgentChatProps) {\n const {\n messages,\n renderText,\n reasoningLabel,\n reasoningStreamingLabel,\n toolStatusLabels,\n scrollToBottomLabel,\n composerValue,\n onComposerValueChange,\n textareaAriaLabel,\n placeholder,\n onApprovalResponse,\n sessionId,\n onResumeSession,\n disabled = false,\n className,\n ref,\n } = props;\n\n const [decisions, setDecisions] = useState<ApprovalDecisions>({});\n const resumedSessionIdRef = useRef<string | undefined>(undefined);\n\n useEffect(() => {\n if (!sessionId || !onResumeSession) {\n return;\n }\n if (resumedSessionIdRef.current === sessionId) {\n return;\n }\n resumedSessionIdRef.current = sessionId;\n onResumeSession(sessionId);\n }, [sessionId, onResumeSession]);\n\n function handleDecide(\n payload: MosaicAgentChatApprovalResponsePayload,\n decision: \"approved\" | \"denied\",\n ): void {\n setDecisions((previous) => ({ ...previous, [payload.requestId]: decision }));\n onApprovalResponse(payload);\n }\n\n return (\n <div ref={ref} data-slot=\"agent-chat\" className={cn(agentChatRootVariants(), className)}>\n <MosaicChatThread scrollToBottomLabel={scrollToBottomLabel}>\n {messages.map((message) => (\n <MosaicChatMessage\n key={message.id}\n messageRole={message.messageRole}\n parts={message.parts.map((part) => toRenderPart(part, decisions, handleDecide))}\n renderText={renderText}\n reasoningLabel={reasoningLabel}\n reasoningStreamingLabel={reasoningStreamingLabel}\n toolStatusLabels={toolStatusLabels}\n />\n ))}\n </MosaicChatThread>\n\n {props.status === \"responding\" ? (\n <MosaicChatComposer\n status=\"responding\"\n value={composerValue}\n onValueChange={onComposerValueChange}\n textareaAriaLabel={textareaAriaLabel}\n placeholder={placeholder}\n disabled={disabled}\n onStop={props.onStop}\n stopButtonAriaLabel={props.stopButtonAriaLabel}\n />\n ) : (\n <MosaicChatComposer\n status=\"idle\"\n value={composerValue}\n onValueChange={onComposerValueChange}\n textareaAriaLabel={textareaAriaLabel}\n placeholder={placeholder}\n disabled={disabled}\n onSubmit={props.onSubmit}\n sendButtonAriaLabel={props.sendButtonAriaLabel}\n />\n )}\n </div>\n );\n}\n\nMosaicAgentChat.displayName = \"MosaicAgentChat\";\n"
18
+ },
19
+ {
20
+ "path": "src/components/agent-chat/agent-chat-variants.ts",
21
+ "type": "registry:ui",
22
+ "content": "/**\n * agentChatVariants — pure CVA variant functions for MosaicAgentChat.\n *\n * Isolated in its own module so it can be re-exported from the\n * `@vantageos/mosaic-blocks/server` subpath without pulling in React.\n *\n * Zero browser / React runtime dependencies — safe in RSC / Node.js.\n */\n\nimport { cva } from \"class-variance-authority\";\n\n/** Root harness container — thread above, composer pinned below. */\nexport const agentChatRootVariants = cva([\n \"flex min-h-0 w-full flex-1 flex-col gap-2 overflow-hidden rounded-lg border border-border bg-card\",\n]);\n"
23
+ }
24
+ ],
25
+ "type": "registry:ui"
26
+ }