@handled-ai/design-system 0.8.0 → 0.9.0

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 (336) hide show
  1. package/README.md +14 -4
  2. package/dist/charts/bar-chart-component.d.ts +24 -0
  3. package/dist/charts/bar-chart-component.js +123 -0
  4. package/dist/charts/bar-chart-component.js.map +1 -0
  5. package/dist/charts/chart-tooltip.d.ts +26 -0
  6. package/dist/charts/chart-tooltip.js +69 -0
  7. package/dist/charts/chart-tooltip.js.map +1 -0
  8. package/dist/charts/chart.d.ts +64 -0
  9. package/dist/charts/chart.js +285 -0
  10. package/dist/charts/chart.js.map +1 -0
  11. package/dist/charts/donut-chart.d.ts +21 -0
  12. package/dist/charts/donut-chart.js +96 -0
  13. package/dist/charts/donut-chart.js.map +1 -0
  14. package/dist/charts/index.d.ts +11 -0
  15. package/dist/charts/index.js +10 -0
  16. package/dist/charts/index.js.map +1 -0
  17. package/dist/charts/pipeline-overview.d.ts +76 -0
  18. package/dist/charts/pipeline-overview.js +372 -0
  19. package/dist/charts/pipeline-overview.js.map +1 -0
  20. package/dist/charts/sankey-chart.d.ts +52 -0
  21. package/dist/charts/sankey-chart.js +219 -0
  22. package/dist/charts/sankey-chart.js.map +1 -0
  23. package/dist/charts/top-line-metrics.d.ts +26 -0
  24. package/dist/charts/top-line-metrics.js +224 -0
  25. package/dist/charts/top-line-metrics.js.map +1 -0
  26. package/dist/charts/trend-area-chart.d.ts +21 -0
  27. package/dist/charts/trend-area-chart.js +150 -0
  28. package/dist/charts/trend-area-chart.js.map +1 -0
  29. package/dist/charts/volume-analysis-chart.d.ts +19 -0
  30. package/dist/charts/volume-analysis-chart.js +121 -0
  31. package/dist/charts/volume-analysis-chart.js.map +1 -0
  32. package/dist/components/activity-detail.d.ts +38 -0
  33. package/dist/components/activity-detail.js +163 -0
  34. package/dist/components/activity-detail.js.map +1 -0
  35. package/dist/components/activity-log.d.ts +21 -0
  36. package/dist/components/activity-log.js +61 -0
  37. package/dist/components/activity-log.js.map +1 -0
  38. package/dist/components/agent-popover.d.ts +71 -0
  39. package/dist/components/agent-popover.js +282 -0
  40. package/dist/components/agent-popover.js.map +1 -0
  41. package/dist/components/agent-widget.d.ts +24 -0
  42. package/dist/components/agent-widget.js +117 -0
  43. package/dist/components/agent-widget.js.map +1 -0
  44. package/dist/components/avatar.d.ts +13 -0
  45. package/dist/components/avatar.js +140 -0
  46. package/dist/components/avatar.js.map +1 -0
  47. package/dist/components/badge.d.ts +12 -0
  48. package/dist/components/badge.js +75 -0
  49. package/dist/components/badge.js.map +1 -0
  50. package/dist/components/button.d.ts +13 -0
  51. package/dist/components/button.js +83 -0
  52. package/dist/components/button.js.map +1 -0
  53. package/dist/components/card.d.ts +11 -0
  54. package/dist/components/card.js +119 -0
  55. package/dist/components/card.js.map +1 -0
  56. package/dist/components/contact-list.d.ts +34 -0
  57. package/dist/components/contact-list.js +84 -0
  58. package/dist/components/contact-list.js.map +1 -0
  59. package/dist/components/dashboard-cards.d.ts +10 -0
  60. package/dist/components/dashboard-cards.js +164 -0
  61. package/dist/components/dashboard-cards.js.map +1 -0
  62. package/dist/components/data-table-display.d.ts +19 -0
  63. package/dist/components/data-table-display.js +109 -0
  64. package/dist/components/data-table-display.js.map +1 -0
  65. package/dist/components/data-table-filter.d.ts +18 -0
  66. package/dist/components/data-table-filter.js +107 -0
  67. package/dist/components/data-table-filter.js.map +1 -0
  68. package/dist/components/data-table-quick-views.d.ts +13 -0
  69. package/dist/components/data-table-quick-views.js +90 -0
  70. package/dist/components/data-table-quick-views.js.map +1 -0
  71. package/dist/components/data-table-toolbar.d.ts +18 -0
  72. package/dist/components/data-table-toolbar.js +45 -0
  73. package/dist/components/data-table-toolbar.js.map +1 -0
  74. package/dist/components/data-table.d.ts +39 -0
  75. package/dist/components/data-table.js +821 -0
  76. package/dist/components/data-table.js.map +1 -0
  77. package/dist/components/detail-view.d.ts +44 -0
  78. package/dist/components/detail-view.js +165 -0
  79. package/dist/components/detail-view.js.map +1 -0
  80. package/dist/components/dialog.d.ts +19 -0
  81. package/dist/components/dialog.js +188 -0
  82. package/dist/components/dialog.js.map +1 -0
  83. package/dist/components/dropdown-menu.d.ts +27 -0
  84. package/dist/components/dropdown-menu.js +279 -0
  85. package/dist/components/dropdown-menu.js.map +1 -0
  86. package/dist/components/entity-panel.d.ts +69 -0
  87. package/dist/components/entity-panel.js +584 -0
  88. package/dist/components/entity-panel.js.map +1 -0
  89. package/dist/components/inbox-row.d.ts +27 -0
  90. package/dist/components/inbox-row.js +139 -0
  91. package/dist/components/inbox-row.js.map +1 -0
  92. package/dist/components/inbox-toolbar.d.ts +21 -0
  93. package/dist/components/inbox-toolbar.js +203 -0
  94. package/dist/components/inbox-toolbar.js.map +1 -0
  95. package/dist/components/input.d.ts +5 -0
  96. package/dist/components/input.js +50 -0
  97. package/dist/components/input.js.map +1 -0
  98. package/dist/components/insights-filter-bar.d.ts +21 -0
  99. package/dist/components/insights-filter-bar.js +99 -0
  100. package/dist/components/insights-filter-bar.js.map +1 -0
  101. package/dist/components/item-list-display.d.ts +22 -0
  102. package/dist/components/item-list-display.js +240 -0
  103. package/dist/components/item-list-display.js.map +1 -0
  104. package/dist/components/item-list-filter.d.ts +16 -0
  105. package/dist/components/item-list-filter.js +87 -0
  106. package/dist/components/item-list-filter.js.map +1 -0
  107. package/dist/components/item-list-toolbar.d.ts +25 -0
  108. package/dist/components/item-list-toolbar.js +79 -0
  109. package/dist/components/item-list-toolbar.js.map +1 -0
  110. package/dist/components/item-list.d.ts +20 -0
  111. package/dist/components/item-list.js +702 -0
  112. package/dist/components/item-list.js.map +1 -0
  113. package/dist/components/label.d.ts +6 -0
  114. package/dist/components/label.js +55 -0
  115. package/dist/components/label.js.map +1 -0
  116. package/dist/components/message.d.ts +23 -0
  117. package/dist/components/message.js +117 -0
  118. package/dist/components/message.js.map +1 -0
  119. package/dist/components/metric-card.d.ts +25 -0
  120. package/dist/components/metric-card.js +107 -0
  121. package/dist/components/metric-card.js.map +1 -0
  122. package/dist/components/performance-metrics-table.d.ts +38 -0
  123. package/dist/components/performance-metrics-table.js +342 -0
  124. package/dist/components/performance-metrics-table.js.map +1 -0
  125. package/dist/components/preview-list.d.ts +14 -0
  126. package/dist/components/preview-list.js +83 -0
  127. package/dist/components/preview-list.js.map +1 -0
  128. package/dist/components/progress.d.ts +6 -0
  129. package/dist/components/progress.js +69 -0
  130. package/dist/components/progress.js.map +1 -0
  131. package/dist/components/quick-action-chat-area.d.ts +24 -0
  132. package/dist/components/quick-action-chat-area.js +178 -0
  133. package/dist/components/quick-action-chat-area.js.map +1 -0
  134. package/dist/components/quick-action-modal.d.ts +30 -0
  135. package/dist/components/quick-action-modal.js +288 -0
  136. package/dist/components/quick-action-modal.js.map +1 -0
  137. package/dist/components/quick-action-sidebar-nav.d.ts +51 -0
  138. package/dist/components/quick-action-sidebar-nav.js +528 -0
  139. package/dist/components/quick-action-sidebar-nav.js.map +1 -0
  140. package/dist/components/recommended-actions-section.d.ts +23 -0
  141. package/dist/components/recommended-actions-section.js +215 -0
  142. package/dist/components/recommended-actions-section.js.map +1 -0
  143. package/dist/components/report-card.d.ts +26 -0
  144. package/dist/components/report-card.js +69 -0
  145. package/dist/components/report-card.js.map +1 -0
  146. package/dist/components/score-analysis-modal.d.ts +26 -0
  147. package/dist/components/score-analysis-modal.js +141 -0
  148. package/dist/components/score-analysis-modal.js.map +1 -0
  149. package/dist/components/score-breakdown.d.ts +17 -0
  150. package/dist/components/score-breakdown.js +162 -0
  151. package/dist/components/score-breakdown.js.map +1 -0
  152. package/dist/components/score-feedback.d.ts +40 -0
  153. package/dist/components/score-feedback.js +209 -0
  154. package/dist/components/score-feedback.js.map +1 -0
  155. package/dist/components/score-ring.d.ts +14 -0
  156. package/dist/components/score-ring.js +79 -0
  157. package/dist/components/score-ring.js.map +1 -0
  158. package/dist/components/scroll-area.d.ts +7 -0
  159. package/dist/components/scroll-area.js +101 -0
  160. package/dist/components/scroll-area.js.map +1 -0
  161. package/dist/components/select.d.ts +17 -0
  162. package/dist/components/select.js +228 -0
  163. package/dist/components/select.js.map +1 -0
  164. package/dist/components/separator.d.ts +6 -0
  165. package/dist/components/separator.js +61 -0
  166. package/dist/components/separator.js.map +1 -0
  167. package/dist/components/sheet.d.ts +16 -0
  168. package/dist/components/sheet.js +168 -0
  169. package/dist/components/sheet.js.map +1 -0
  170. package/dist/components/sidebar.d.ts +73 -0
  171. package/dist/components/sidebar.js +723 -0
  172. package/dist/components/sidebar.js.map +1 -0
  173. package/dist/components/signal-feedback-inline.d.ts +51 -0
  174. package/dist/components/signal-feedback-inline.js +548 -0
  175. package/dist/components/signal-feedback-inline.js.map +1 -0
  176. package/dist/components/simple-data-table.d.ts +15 -0
  177. package/dist/components/simple-data-table.js +91 -0
  178. package/dist/components/simple-data-table.js.map +1 -0
  179. package/dist/components/skeleton.d.ts +5 -0
  180. package/dist/components/skeleton.js +44 -0
  181. package/dist/components/skeleton.js.map +1 -0
  182. package/dist/components/status-badge.d.ts +10 -0
  183. package/dist/components/status-badge.js +82 -0
  184. package/dist/components/status-badge.js.map +1 -0
  185. package/dist/components/styled-bar-list.d.ts +20 -0
  186. package/dist/components/styled-bar-list.js +59 -0
  187. package/dist/components/styled-bar-list.js.map +1 -0
  188. package/dist/components/suggested-actions.d.ts +110 -0
  189. package/dist/components/suggested-actions.js +1538 -0
  190. package/dist/components/suggested-actions.js.map +1 -0
  191. package/dist/components/table.d.ts +12 -0
  192. package/dist/components/table.js +147 -0
  193. package/dist/components/table.js.map +1 -0
  194. package/dist/components/tabs.d.ts +14 -0
  195. package/dist/components/tabs.js +129 -0
  196. package/dist/components/tabs.js.map +1 -0
  197. package/dist/components/textarea.d.ts +5 -0
  198. package/dist/components/textarea.js +47 -0
  199. package/dist/components/textarea.js.map +1 -0
  200. package/dist/components/timeline-activity.d.ts +34 -0
  201. package/dist/components/timeline-activity.js +181 -0
  202. package/dist/components/timeline-activity.js.map +1 -0
  203. package/dist/components/tooltip.d.ts +9 -0
  204. package/dist/components/tooltip.js +93 -0
  205. package/dist/components/tooltip.js.map +1 -0
  206. package/dist/components/view-mode-toggle.d.ts +16 -0
  207. package/dist/components/view-mode-toggle.js +24 -0
  208. package/dist/components/view-mode-toggle.js.map +1 -0
  209. package/dist/hooks/use-mobile.d.ts +3 -0
  210. package/dist/hooks/use-mobile.js +21 -0
  211. package/dist/hooks/use-mobile.js.map +1 -0
  212. package/dist/index.d.ts +68 -1878
  213. package/dist/index.js +69 -10918
  214. package/dist/index.js.map +1 -1
  215. package/dist/lib/icons.d.ts +18 -0
  216. package/dist/lib/icons.js +21 -0
  217. package/dist/lib/icons.js.map +1 -0
  218. package/dist/lib/utils.d.ts +5 -0
  219. package/dist/lib/utils.js +9 -0
  220. package/dist/lib/utils.js.map +1 -0
  221. package/dist/prototype/index.d.ts +20 -0
  222. package/dist/prototype/index.js +8 -0
  223. package/dist/prototype/index.js.map +1 -0
  224. package/dist/prototype/prototype-accounts-view.d.ts +22 -0
  225. package/dist/prototype/prototype-accounts-view.js +70 -0
  226. package/dist/prototype/prototype-accounts-view.js.map +1 -0
  227. package/dist/prototype/prototype-admin-view.d.ts +21 -0
  228. package/dist/prototype/prototype-admin-view.js +53 -0
  229. package/dist/prototype/prototype-admin-view.js.map +1 -0
  230. package/dist/prototype/prototype-config.d.ts +226 -0
  231. package/dist/prototype/prototype-config.js +1 -0
  232. package/dist/prototype/prototype-config.js.map +1 -0
  233. package/dist/prototype/prototype-inbox-view.d.ts +48 -0
  234. package/dist/prototype/prototype-inbox-view.js +701 -0
  235. package/dist/prototype/prototype-inbox-view.js.map +1 -0
  236. package/dist/prototype/prototype-insights-view.d.ts +23 -0
  237. package/dist/prototype/prototype-insights-view.js +335 -0
  238. package/dist/prototype/prototype-insights-view.js.map +1 -0
  239. package/dist/prototype/prototype-shell.d.ts +40 -0
  240. package/dist/prototype/prototype-shell.js +190 -0
  241. package/dist/prototype/prototype-shell.js.map +1 -0
  242. package/dist/prototype/prototype-work-queue-view.d.ts +8 -0
  243. package/dist/prototype/prototype-work-queue-view.js +17 -0
  244. package/dist/prototype/prototype-work-queue-view.js.map +1 -0
  245. package/dist/three/agent-orb.d.ts +39 -0
  246. package/dist/three/agent-orb.js +500 -0
  247. package/dist/three/agent-orb.js.map +1 -0
  248. package/dist/three/index.d.ts +2 -0
  249. package/dist/three/index.js +2 -0
  250. package/dist/three/index.js.map +1 -0
  251. package/package.json +98 -17
  252. package/src/charts/bar-chart-component.tsx +150 -0
  253. package/src/charts/chart-tooltip.tsx +86 -0
  254. package/src/charts/chart.tsx +371 -0
  255. package/src/charts/donut-chart.tsx +112 -0
  256. package/src/charts/index.ts +13 -0
  257. package/src/charts/pipeline-overview.tsx +476 -0
  258. package/src/charts/sankey-chart.tsx +290 -0
  259. package/src/charts/top-line-metrics.tsx +261 -0
  260. package/src/charts/trend-area-chart.tsx +150 -0
  261. package/src/charts/volume-analysis-chart.tsx +124 -0
  262. package/src/components/activity-detail.tsx +233 -0
  263. package/src/components/activity-log.tsx +89 -0
  264. package/src/components/agent-popover.tsx +373 -0
  265. package/src/components/agent-widget.tsx +163 -0
  266. package/src/components/avatar.tsx +109 -0
  267. package/src/components/badge.tsx +48 -0
  268. package/src/components/button.tsx +59 -0
  269. package/src/components/card.tsx +92 -0
  270. package/src/components/contact-list.tsx +121 -0
  271. package/src/components/dashboard-cards.tsx +170 -0
  272. package/src/components/data-table-display.tsx +139 -0
  273. package/src/components/data-table-filter.tsx +138 -0
  274. package/src/components/data-table-quick-views.tsx +103 -0
  275. package/src/components/data-table-toolbar.tsx +56 -0
  276. package/src/components/data-table.tsx +915 -0
  277. package/src/components/detail-view.tsx +237 -0
  278. package/src/components/dialog.tsx +158 -0
  279. package/src/components/dropdown-menu.tsx +257 -0
  280. package/src/components/entity-panel.tsx +767 -0
  281. package/src/components/inbox-row.tsx +132 -0
  282. package/src/components/inbox-toolbar.tsx +213 -0
  283. package/src/components/input.tsx +21 -0
  284. package/src/components/insights-filter-bar.tsx +132 -0
  285. package/src/components/item-list-display.tsx +278 -0
  286. package/src/components/item-list-filter.tsx +118 -0
  287. package/src/components/item-list-toolbar.tsx +97 -0
  288. package/src/components/item-list.tsx +843 -0
  289. package/src/components/label.tsx +24 -0
  290. package/src/components/message.tsx +83 -0
  291. package/src/components/metric-card.tsx +178 -0
  292. package/src/components/performance-metrics-table.tsx +442 -0
  293. package/src/components/preview-list.tsx +62 -0
  294. package/src/components/progress.tsx +31 -0
  295. package/src/components/quick-action-chat-area.tsx +156 -0
  296. package/src/components/quick-action-modal.tsx +331 -0
  297. package/src/components/quick-action-sidebar-nav.tsx +592 -0
  298. package/src/components/recommended-actions-section.tsx +258 -0
  299. package/src/components/report-card.tsx +106 -0
  300. package/src/components/score-analysis-modal.tsx +172 -0
  301. package/src/components/score-breakdown.tsx +179 -0
  302. package/src/components/score-feedback.tsx +288 -0
  303. package/src/components/score-ring.tsx +87 -0
  304. package/src/components/scroll-area.tsx +58 -0
  305. package/src/components/select.tsx +190 -0
  306. package/src/components/separator.tsx +28 -0
  307. package/src/components/sheet.tsx +143 -0
  308. package/src/components/sidebar.tsx +726 -0
  309. package/src/components/signal-feedback-inline.tsx +591 -0
  310. package/src/components/simple-data-table.tsx +124 -0
  311. package/src/components/skeleton.tsx +15 -0
  312. package/src/components/status-badge.tsx +63 -0
  313. package/src/components/styled-bar-list.tsx +70 -0
  314. package/src/components/suggested-actions.tsx +1985 -0
  315. package/src/components/table.tsx +116 -0
  316. package/src/components/tabs.tsx +91 -0
  317. package/src/components/textarea.tsx +18 -0
  318. package/src/components/timeline-activity.tsx +234 -0
  319. package/src/components/tooltip.tsx +57 -0
  320. package/src/components/view-mode-toggle.tsx +39 -0
  321. package/src/hooks/use-mobile.ts +21 -0
  322. package/src/index.ts +77 -0
  323. package/src/lib/icons.ts +18 -0
  324. package/src/lib/utils.ts +6 -0
  325. package/src/prototype/index.ts +11 -0
  326. package/src/prototype/prototype-accounts-view.tsx +112 -0
  327. package/src/prototype/prototype-admin-view.tsx +67 -0
  328. package/src/prototype/prototype-config.ts +243 -0
  329. package/src/prototype/prototype-inbox-view.tsx +810 -0
  330. package/src/prototype/prototype-insights-view.tsx +379 -0
  331. package/src/prototype/prototype-shell.tsx +219 -0
  332. package/src/prototype/prototype-work-queue-view.tsx +30 -0
  333. package/src/styles/globals.css +299 -0
  334. package/src/three/agent-orb.tsx +557 -0
  335. package/src/three/index.ts +5 -0
  336. package/src/types/r3f.d.ts +8 -0
@@ -0,0 +1,379 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import {
5
+ BarChart2,
6
+ TrendingUp,
7
+ ThumbsUp,
8
+ ThumbsDown,
9
+ X,
10
+ MessageCircle,
11
+ } from "lucide-react"
12
+
13
+ import { Button } from "../components/button"
14
+ import { Input } from "../components/input"
15
+ import { MetricCard } from "../components/metric-card"
16
+ import type { MetricCardProps } from "../components/metric-card"
17
+ import {
18
+ TopTasksCard,
19
+ UpcomingMeetingsCard,
20
+ RecentlyCompletedCard,
21
+ CheckInsCard,
22
+ } from "../components/dashboard-cards"
23
+ import { PipelineOverview } from "../charts/pipeline-overview"
24
+ import { VolumeAnalysisChart } from "../charts/volume-analysis-chart"
25
+ import { DonutChart } from "../charts/donut-chart"
26
+ import { TrendAreaChart } from "../charts/trend-area-chart"
27
+ import { BarChartComponent } from "../charts/bar-chart-component"
28
+ import { StyledBarList } from "../components/styled-bar-list"
29
+ import { ReportCard } from "../components/report-card"
30
+ import type { InsightsViewConfig } from "./prototype-config"
31
+
32
+ // ---------------------------------------------------------------------------
33
+ // Props
34
+ // ---------------------------------------------------------------------------
35
+
36
+ export interface PrototypeInsightsViewProps extends InsightsViewConfig {
37
+ assistantName?: string
38
+ headerActions?: React.ReactNode
39
+ onNavigateToInbox?: () => void
40
+ }
41
+
42
+ // ---------------------------------------------------------------------------
43
+ // Defaults
44
+ // ---------------------------------------------------------------------------
45
+
46
+ const DEFAULT_METRICS: MetricCardProps[] = [
47
+ {
48
+ title: "Referrals at Risk",
49
+ value: 28,
50
+ change: { value: "2 vs last week", direction: "up", isGood: false },
51
+ showExternalLink: true,
52
+ showInfo: true,
53
+ dataPoints: [
54
+ { label: "No Contact", value: 6, color: "#166534" },
55
+ { label: "Stalled", value: 4, color: "#22c55e" },
56
+ { label: "Needs Attn", value: 8, color: "#6ee7b7" },
57
+ { label: "Auth Delay", value: 5, color: "#ccfbf1" },
58
+ { label: "DCS Hold", value: 3, color: "#99f6e4" },
59
+ { label: "Expired Referral", value: 2, color: "#f1f5f9" },
60
+ ],
61
+ },
62
+ {
63
+ title: "Dropped from Pipeline",
64
+ value: 47,
65
+ change: { value: "12 vs last week", direction: "down", isGood: true },
66
+ showExternalLink: true,
67
+ showInfo: true,
68
+ dataPoints: [
69
+ { label: "No Contact", value: 12, color: "#166534" },
70
+ { label: "Ins. Denied", value: 15, color: "#22c55e" },
71
+ { label: "Refused", value: 6, color: "#6ee7b7" },
72
+ { label: "Intake Stalled", value: 8, color: "#ccfbf1" },
73
+ { label: "Other", value: 6, color: "#f1f5f9" },
74
+ ],
75
+ },
76
+ {
77
+ title: "Time to Schedule",
78
+ value: "4.2 days",
79
+ subtitle: "median, referrals → scheduled",
80
+ change: { value: "0.8d vs last week", direction: "down", isGood: true },
81
+ footerText: "Slowest stage: Contact → Intake (1.5d)",
82
+ showInfo: true,
83
+ },
84
+ {
85
+ title: "Conversion Rate",
86
+ value: "53%",
87
+ subtitle: "referrals → scheduled",
88
+ change: { value: "3% vs last week", direction: "up", isGood: true },
89
+ footerText: "Largest drop-off: No Contact (22%)",
90
+ showInfo: true,
91
+ },
92
+ ]
93
+
94
+ const DEFAULT_EXPANDED_METRICS: MetricCardProps[] = [
95
+ {
96
+ title: "Avg Handle Time",
97
+ value: "1.2",
98
+ unit: "days",
99
+ change: { value: "0.3d vs last week", direction: "down", isGood: true },
100
+ footerText: "Fastest stage: Verification (0.2d)",
101
+ showInfo: true,
102
+ },
103
+ {
104
+ title: "Conversion Rate",
105
+ value: "78%",
106
+ change: { value: "2% vs last week", direction: "up", isGood: true },
107
+ footerText: "Top source: Internal Referrals (85%)",
108
+ showInfo: true,
109
+ },
110
+ {
111
+ title: "Pending Intakes",
112
+ value: "124",
113
+ change: { value: "15 vs last week", direction: "up", isGood: false },
114
+ footerText: "Requires immediate attention: 32",
115
+ showInfo: true,
116
+ },
117
+ {
118
+ title: "Patient Satisfaction",
119
+ value: "4.8",
120
+ unit: "/ 5",
121
+ change: { value: "0.1 vs last month", direction: "up", isGood: true },
122
+ footerText: "Based on 450 recent surveys",
123
+ showInfo: true,
124
+ },
125
+ ]
126
+
127
+ // ---------------------------------------------------------------------------
128
+ // Component
129
+ // ---------------------------------------------------------------------------
130
+
131
+ export function PrototypeInsightsView({
132
+ tabs,
133
+ coaching,
134
+ metrics,
135
+ expandedMetrics,
136
+ dashboardCards,
137
+ analytics,
138
+ assistantName,
139
+ headerActions,
140
+ onNavigateToInbox,
141
+ customTabs,
142
+ }: PrototypeInsightsViewProps) {
143
+ const showOverview = tabs?.overview !== false
144
+ const showAnalytics = tabs?.analytics !== false
145
+ const [insightsTab, setInsightsTab] = React.useState<string>(
146
+ showOverview ? "overview" : showAnalytics ? "analytics" : customTabs?.[0]?.id ?? "overview",
147
+ )
148
+
149
+ const allTabs: { id: string; label: string; icon?: React.ComponentType<{ className?: string }> }[] = []
150
+ if (showOverview) allTabs.push({ id: "overview", label: "Overview", icon: BarChart2 })
151
+ if (showAnalytics) allTabs.push({ id: "analytics", label: "Analytics", icon: TrendingUp })
152
+ if (customTabs) allTabs.push(...customTabs)
153
+ const [showAllMetrics, setShowAllMetrics] = React.useState(false)
154
+ const [showCoaching, setShowCoaching] = React.useState(coaching?.enabled !== false)
155
+
156
+ const resolvedMetrics = metrics ?? DEFAULT_METRICS
157
+ const resolvedExpandedMetrics = expandedMetrics ?? DEFAULT_EXPANDED_METRICS
158
+
159
+ const cards = {
160
+ topTasks: dashboardCards?.topTasks !== false,
161
+ upcomingMeetings: dashboardCards?.upcomingMeetings !== false,
162
+ recentlyCompleted: dashboardCards?.recentlyCompleted !== false,
163
+ checkIns: dashboardCards?.checkIns !== false,
164
+ }
165
+
166
+ return (
167
+ <div className="mx-auto max-w-7xl space-y-5 p-6 md:p-8">
168
+ {/* Header */}
169
+ <div className="flex items-center justify-between">
170
+ <div>
171
+ <h2 className="mb-1 text-xl font-bold tracking-tight text-foreground">Insights & Overview</h2>
172
+ <p className="text-sm text-muted-foreground">Monitor your key performance indicators and daily tasks.</p>
173
+ </div>
174
+ <div className="flex items-center gap-3">
175
+ {assistantName && (
176
+ <Button variant="outline" size="sm" className="h-8 gap-2 text-xs font-semibold rounded-full px-4 border-foreground text-foreground hover:bg-muted/50">
177
+ <MessageCircle className="w-3.5 h-3.5" />
178
+ Talk to {assistantName}
179
+ </Button>
180
+ )}
181
+ {headerActions}
182
+ </div>
183
+ </div>
184
+
185
+ {/* Tab switcher */}
186
+ {allTabs.length >= 2 && (
187
+ <div className="flex items-center gap-1 border-b border-border">
188
+ {allTabs.map((tab) => (
189
+ <button
190
+ key={tab.id}
191
+ type="button"
192
+ onClick={() => setInsightsTab(tab.id)}
193
+ className={`relative px-4 py-2 text-sm font-medium transition-colors ${
194
+ insightsTab === tab.id ? "text-foreground" : "text-muted-foreground hover:text-foreground"
195
+ }`}
196
+ >
197
+ <span className="flex items-center gap-2">
198
+ {tab.icon && <tab.icon className="h-3.5 w-3.5" />}
199
+ {tab.label}
200
+ </span>
201
+ {insightsTab === tab.id && (
202
+ <span className="absolute bottom-0 left-0 right-0 h-0.5 bg-foreground rounded-full" />
203
+ )}
204
+ </button>
205
+ ))}
206
+ </div>
207
+ )}
208
+
209
+ {/* ---- Overview Tab ---- */}
210
+ {insightsTab === "overview" && showOverview && (
211
+ <>
212
+ {/* Coaching Banner */}
213
+ {showCoaching && (
214
+ <div className="border border-border rounded-xl p-6 relative bg-card shadow-sm">
215
+ <Button
216
+ variant="ghost"
217
+ size="icon"
218
+ className="absolute top-4 right-4 h-6 w-6 text-muted-foreground hover:text-foreground"
219
+ onClick={() => setShowCoaching(false)}
220
+ >
221
+ <X className="w-4 h-4" />
222
+ </Button>
223
+ <div className="flex items-center gap-2 mb-2">
224
+ <h3 className="font-bold text-foreground text-sm">Daily Coaching Insight</h3>
225
+ </div>
226
+ <p className="text-sm text-muted-foreground leading-relaxed mb-4 max-w-4xl">
227
+ We analyze your pipeline activity, recent communications, and account health to provide personalized recommendations for your day.
228
+ </p>
229
+ <div className="bg-brand-purple/10 rounded-lg p-5 text-[13px] text-foreground font-medium italic border border-brand-purple/20 relative">
230
+ <div className="absolute top-0 left-0 w-1 h-full bg-brand-purple rounded-l-lg" />
231
+ {coaching?.message ??
232
+ "\u201CGreat job catching the churn risk on Lunchclub yesterday. Today, focus on pushing the stalled intake pipeline. Try making 2 more touches on accounts that have gone dark this week.\u201D"}
233
+ </div>
234
+ <div className="mt-4 flex items-center gap-2">
235
+ <Button variant="outline" size="sm" className="h-7 text-xs text-muted-foreground hover:text-foreground shadow-none">
236
+ <ThumbsUp className="w-3.5 h-3.5 mr-1.5" /> Helpful
237
+ </Button>
238
+ <Button variant="outline" size="sm" className="h-7 text-xs text-muted-foreground hover:text-foreground shadow-none">
239
+ <ThumbsDown className="w-3.5 h-3.5 mr-1.5" /> Not Helpful
240
+ </Button>
241
+ <div className="relative max-w-sm ml-2 flex-1">
242
+ <Input placeholder="Provide additional feedback..." className="h-7 text-xs shadow-none border-border bg-muted/20 w-full" />
243
+ </div>
244
+ </div>
245
+ </div>
246
+ )}
247
+
248
+ {/* Metrics */}
249
+ <div className="space-y-4">
250
+ <div className="flex items-center justify-between">
251
+ <h3 className="text-sm font-semibold text-foreground uppercase tracking-wider">Key Metrics</h3>
252
+ {resolvedExpandedMetrics.length > 0 && (
253
+ <Button
254
+ variant="ghost"
255
+ size="sm"
256
+ className="text-xs text-muted-foreground hover:text-foreground"
257
+ onClick={() => setShowAllMetrics(!showAllMetrics)}
258
+ >
259
+ {showAllMetrics ? "Hide additional metrics" : "Show more metrics"}
260
+ </Button>
261
+ )}
262
+ </div>
263
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
264
+ {resolvedMetrics.map((m, i) => (
265
+ <MetricCard key={i} {...m} />
266
+ ))}
267
+ {showAllMetrics &&
268
+ resolvedExpandedMetrics.map((m, i) => (
269
+ <MetricCard key={`exp-${i}`} {...m} />
270
+ ))}
271
+ </div>
272
+ </div>
273
+
274
+ {/* Dashboard cards */}
275
+ <div className="grid grid-cols-1 lg:grid-cols-3 gap-6 mt-8">
276
+ <div className="lg:col-span-2 space-y-6">
277
+ {cards.topTasks && <TopTasksCard onViewAll={onNavigateToInbox} />}
278
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
279
+ {cards.upcomingMeetings && <UpcomingMeetingsCard />}
280
+ {cards.recentlyCompleted && <RecentlyCompletedCard />}
281
+ </div>
282
+ </div>
283
+ <div className="space-y-6">
284
+ {cards.checkIns && <CheckInsCard />}
285
+ </div>
286
+ </div>
287
+ </>
288
+ )}
289
+
290
+ {/* ---- Analytics Tab ---- */}
291
+ {insightsTab === "analytics" && showAnalytics && (
292
+ <div className="space-y-6">
293
+ {analytics?.pipeline && (
294
+ <PipelineOverview
295
+ stages={analytics.pipeline.stages}
296
+ stageMetrics={analytics.pipeline.stageMetrics}
297
+ stageTimings={analytics.pipeline.stageTimings}
298
+ filterBreakdowns={analytics.pipeline.filterBreakdowns}
299
+ />
300
+ )}
301
+
302
+ {analytics?.volumeChart && (
303
+ <ReportCard
304
+ title="Volume Analysis"
305
+ subtitle="Referral volume broken down by facility over time"
306
+ filterOptions={analytics.volumeChart.filterOptions}
307
+ selectedFilter={analytics.volumeChart.filterOptions?.[0]?.value}
308
+ >
309
+ <VolumeAnalysisChart
310
+ data={analytics.volumeChart.data}
311
+ dataKeys={analytics.volumeChart.dataKeys}
312
+ />
313
+ </ReportCard>
314
+ )}
315
+
316
+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
317
+ {analytics?.donutChart && (
318
+ <ReportCard title="Risk Breakdown" subtitle="Referrals at risk by category">
319
+ <div className="flex items-center justify-center">
320
+ <DonutChart
321
+ data={analytics.donutChart.data}
322
+ centerLabel={analytics.donutChart.centerLabel}
323
+ showLegend
324
+ />
325
+ </div>
326
+ </ReportCard>
327
+ )}
328
+
329
+ {analytics?.trendChart && (
330
+ <ReportCard
331
+ title="Referrals Over Time"
332
+ subtitle="Weekly appointment trends"
333
+ toggleOptions={analytics.trendChart.toggleOptions}
334
+ selectedToggle={analytics.trendChart.toggleOptions?.[0]}
335
+ >
336
+ <TrendAreaChart
337
+ data={analytics.trendChart.data}
338
+ series={analytics.trendChart.series}
339
+ xAxisKey={analytics.trendChart.xAxisKey ?? "name"}
340
+ height={analytics.trendChart.height ?? 220}
341
+ />
342
+ </ReportCard>
343
+ )}
344
+ </div>
345
+
346
+ {(analytics?.barChart || analytics?.barList) && (
347
+ <div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
348
+ {analytics?.barChart && (
349
+ <ReportCard
350
+ title="Outreach Activity"
351
+ subtitle="Daily outreach by channel"
352
+ className="lg:col-span-2"
353
+ >
354
+ <BarChartComponent
355
+ data={analytics.barChart.data}
356
+ bars={analytics.barChart.bars}
357
+ />
358
+ </ReportCard>
359
+ )}
360
+ {analytics?.barList && (
361
+ <ReportCard title="Top Activity Types" subtitle="By completion percentage">
362
+ <StyledBarList
363
+ data={analytics.barList.data}
364
+ valueFormatter={analytics.barList.valueFormatter}
365
+ />
366
+ </ReportCard>
367
+ )}
368
+ </div>
369
+ )}
370
+ </div>
371
+ )}
372
+
373
+ {/* Custom Tabs */}
374
+ {customTabs?.map(tab =>
375
+ insightsTab === tab.id ? <div key={tab.id}>{tab.content}</div> : null
376
+ )}
377
+ </div>
378
+ )
379
+ }
@@ -0,0 +1,219 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import {
5
+ QuickActionSidebarNav,
6
+ } from "../components/quick-action-sidebar-nav"
7
+ import {
8
+ EntityPanel,
9
+ EntityDetails,
10
+ PotentialContacts,
11
+ RecentActivity,
12
+ ConnectedApps,
13
+ SystemActivity,
14
+ } from "../components/entity-panel"
15
+ import { PrototypeInboxView } from "./prototype-inbox-view"
16
+ import { PrototypeInsightsView } from "./prototype-insights-view"
17
+ import { PrototypeAccountsView } from "./prototype-accounts-view"
18
+ import { PrototypeWorkQueueView } from "./prototype-work-queue-view"
19
+ import { PrototypeAdminView } from "./prototype-admin-view"
20
+ import type { PrototypeConfig, EntityPanelSection } from "./prototype-config"
21
+ import type { DataRow } from "../components/data-table"
22
+
23
+ // ---------------------------------------------------------------------------
24
+ // Props
25
+ // ---------------------------------------------------------------------------
26
+
27
+ export interface PrototypeShellProps {
28
+ config: PrototypeConfig
29
+ /**
30
+ * Optional ReactNode rendered in the header area of each view.
31
+ * Useful for adding an "Exit Preview" button in the design system showcase.
32
+ */
33
+ headerActions?: React.ReactNode
34
+ /**
35
+ * Custom content to render inside the EntityPanel.
36
+ * When provided, overrides the default section-based rendering.
37
+ * Receives `onClose` so children can close the panel.
38
+ */
39
+ entityPanelChildren?: React.ReactNode | ((ctx: { onClose: () => void }) => React.ReactNode)
40
+ /**
41
+ * Fired on every sidebar navigation click (both navigable and non-navigable views).
42
+ * Useful for intercepting clicks on product-specific views like "settings"
43
+ * that live outside the shell.
44
+ */
45
+ onNavigate?: (viewId: string) => void
46
+ }
47
+
48
+ // ---------------------------------------------------------------------------
49
+ // View ID → config key mapping
50
+ // ---------------------------------------------------------------------------
51
+
52
+ const VIEW_KEY_MAP: Record<string, keyof PrototypeConfig["views"]> = {
53
+ inbox: "inbox",
54
+ dashboard: "insights",
55
+ insights: "insights",
56
+ accounts: "accounts",
57
+ activity: "workQueue",
58
+ workQueue: "workQueue",
59
+ "work-queue": "workQueue",
60
+ admin: "admin",
61
+ settings: "admin",
62
+ }
63
+
64
+ // ---------------------------------------------------------------------------
65
+ // Default entity panel sections
66
+ // ---------------------------------------------------------------------------
67
+
68
+ const DEFAULT_ENTITY_SECTIONS: EntityPanelSection[] = [
69
+ { type: "details" },
70
+ { type: "contacts" },
71
+ { type: "recentActivity" },
72
+ { type: "connectedApps" },
73
+ { type: "systemActivity" },
74
+ ]
75
+
76
+ // ---------------------------------------------------------------------------
77
+ // Component
78
+ // ---------------------------------------------------------------------------
79
+
80
+ export function PrototypeShell({
81
+ config,
82
+ headerActions,
83
+ entityPanelChildren,
84
+ onNavigate,
85
+ }: PrototypeShellProps) {
86
+ const [currentView, setCurrentView] = React.useState(config.defaultView)
87
+ const [isEntityPanelOpen, setIsEntityPanelOpen] = React.useState(false)
88
+
89
+ const navigableViews = React.useMemo(() => {
90
+ if (config.navigableViews) return config.navigableViews
91
+ const keys: string[] = []
92
+ if (config.views.inbox) keys.push("inbox")
93
+ if (config.views.accounts) keys.push("accounts")
94
+ if (config.views.workQueue) keys.push("activity", "workQueue", "work-queue")
95
+ if (config.views.insights) keys.push("dashboard", "insights")
96
+ if (config.views.admin) keys.push("admin", "settings")
97
+ return keys
98
+ }, [config.navigableViews, config.views])
99
+
100
+ const handleNavigate = React.useCallback(
101
+ (id: string) => {
102
+ if (navigableViews.includes(id)) {
103
+ setCurrentView(id)
104
+ }
105
+ onNavigate?.(id)
106
+ },
107
+ [navigableViews, onNavigate],
108
+ )
109
+
110
+ const handleOpenEntityPanel = React.useCallback((_entity?: DataRow) => setIsEntityPanelOpen(true), [])
111
+ const handleOpenRecentActivity = React.useCallback(() => {
112
+ setIsEntityPanelOpen(true)
113
+ setTimeout(() => {
114
+ document.getElementById("entity-recent-activity")?.scrollIntoView({ behavior: "smooth", block: "start" })
115
+ }, 150)
116
+ }, [])
117
+
118
+ const resolvedViewKey = VIEW_KEY_MAP[currentView] ?? currentView
119
+
120
+ const entitySections = config.entityPanel?.sections ?? DEFAULT_ENTITY_SECTIONS
121
+ const entityIcons = config.entityPanel?.icons ?? {}
122
+
123
+ return (
124
+ <div className="flex h-screen w-full overflow-hidden bg-background font-sans">
125
+ <QuickActionSidebarNav
126
+ className="z-20 h-screen shrink-0"
127
+ brandLabel={config.brand?.name}
128
+ brandSubtitle=""
129
+ navSections={config.sidebar}
130
+ activeItemId={currentView}
131
+ onNavigate={handleNavigate}
132
+ onCreateTask={(draft) => {
133
+ console.log("Quick action created:", draft)
134
+ }}
135
+ />
136
+
137
+ <main className="flex min-w-0 flex-1 flex-col overflow-hidden bg-background">
138
+ <div className="relative h-full flex-1 overflow-auto">
139
+ {resolvedViewKey === "insights" && config.views.insights ? (
140
+ <PrototypeInsightsView
141
+ {...config.views.insights}
142
+ assistantName={config.brand?.assistantName}
143
+ headerActions={headerActions}
144
+ onNavigateToInbox={() => setCurrentView("inbox")}
145
+ />
146
+ ) : resolvedViewKey === "inbox" && config.views.inbox ? (
147
+ <PrototypeInboxView
148
+ {...config.views.inbox}
149
+ headerActions={headerActions}
150
+ onOpenEntityPanel={handleOpenEntityPanel}
151
+ onOpenRecentActivity={handleOpenRecentActivity}
152
+ />
153
+ ) : resolvedViewKey === "accounts" && config.views.accounts ? (
154
+ <PrototypeAccountsView
155
+ {...config.views.accounts}
156
+ headerActions={headerActions}
157
+ onRowClick={handleOpenEntityPanel}
158
+ />
159
+ ) : resolvedViewKey === "workQueue" && config.views.workQueue ? (
160
+ <PrototypeWorkQueueView
161
+ headerActions={headerActions}
162
+ />
163
+ ) : resolvedViewKey === "admin" && config.views.admin ? (
164
+ <PrototypeAdminView
165
+ {...config.views.admin}
166
+ headerActions={headerActions}
167
+ />
168
+ ) : null}
169
+ </div>
170
+ </main>
171
+
172
+ <EntityPanel isOpen={isEntityPanelOpen} onClose={setIsEntityPanelOpen}>
173
+ {(typeof entityPanelChildren === "function"
174
+ ? entityPanelChildren({ onClose: () => setIsEntityPanelOpen(false) })
175
+ : entityPanelChildren) ?? (
176
+ <>
177
+ {entitySections.map((section, i) => {
178
+ switch (section.type) {
179
+ case "details":
180
+ return <EntityDetails key={i} onClose={() => setIsEntityPanelOpen(false)} />
181
+ case "contacts":
182
+ return (
183
+ <PotentialContacts
184
+ key={i}
185
+ icons={{
186
+ linkedin: entityIcons.linkedin,
187
+ gmail: entityIcons.gmail,
188
+ }}
189
+ />
190
+ )
191
+ case "recentActivity":
192
+ return (
193
+ <RecentActivity
194
+ key={i}
195
+ items={(section.props?.items as React.ComponentProps<typeof RecentActivity>["items"]) ?? []}
196
+ />
197
+ )
198
+ case "connectedApps":
199
+ return (
200
+ <ConnectedApps
201
+ key={i}
202
+ icons={{
203
+ slack: entityIcons.slack,
204
+ gdoc: entityIcons.gdoc,
205
+ }}
206
+ />
207
+ )
208
+ case "systemActivity":
209
+ return <SystemActivity key={i} />
210
+ default:
211
+ return null
212
+ }
213
+ })}
214
+ </>
215
+ )}
216
+ </EntityPanel>
217
+ </div>
218
+ )
219
+ }
@@ -0,0 +1,30 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { ItemList } from "../components/item-list"
5
+ // ---------------------------------------------------------------------------
6
+ // Props
7
+ // ---------------------------------------------------------------------------
8
+
9
+ export interface PrototypeWorkQueueViewProps {
10
+ headerActions?: React.ReactNode
11
+ }
12
+
13
+ // ---------------------------------------------------------------------------
14
+ // Component
15
+ // ---------------------------------------------------------------------------
16
+
17
+ export function PrototypeWorkQueueView({
18
+ headerActions,
19
+ }: PrototypeWorkQueueViewProps) {
20
+ return (
21
+ <div className="relative flex h-full w-full flex-col bg-background">
22
+ {headerActions && (
23
+ <div className="absolute top-4 right-4 z-10">{headerActions}</div>
24
+ )}
25
+ <div className="flex-1 overflow-auto">
26
+ <ItemList />
27
+ </div>
28
+ </div>
29
+ )
30
+ }