agentic-ds-kit 0.1.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 (345) hide show
  1. package/AGENTS.md +10 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +21 -0
  4. package/README.md +38 -0
  5. package/contracts/accordion.json +38 -0
  6. package/contracts/alert.json +57 -0
  7. package/contracts/alertdialog.json +89 -0
  8. package/contracts/appheader.json +140 -0
  9. package/contracts/appnav.json +72 -0
  10. package/contracts/avatar.json +63 -0
  11. package/contracts/avatargroup.json +83 -0
  12. package/contracts/badge.json +92 -0
  13. package/contracts/barchart.json +55 -0
  14. package/contracts/breadcrumb.json +76 -0
  15. package/contracts/button.json +120 -0
  16. package/contracts/buttongroup.json +48 -0
  17. package/contracts/calendar.json +93 -0
  18. package/contracts/card.json +123 -0
  19. package/contracts/carousel.json +98 -0
  20. package/contracts/cell.json +203 -0
  21. package/contracts/chat.json +131 -0
  22. package/contracts/checkbox.json +101 -0
  23. package/contracts/collapsible.json +66 -0
  24. package/contracts/command.json +84 -0
  25. package/contracts/datatable.json +126 -0
  26. package/contracts/datepicker.json +102 -0
  27. package/contracts/drawer.json +93 -0
  28. package/contracts/dropdownmenu.json +190 -0
  29. package/contracts/empty.json +79 -0
  30. package/contracts/field.json +49 -0
  31. package/contracts/fieldset.json +29 -0
  32. package/contracts/headercell.json +107 -0
  33. package/contracts/index.json +478 -0
  34. package/contracts/input.json +119 -0
  35. package/contracts/inputotp.json +119 -0
  36. package/contracts/insightcard.json +130 -0
  37. package/contracts/linechart.json +51 -0
  38. package/contracts/loadinganimation.json +33 -0
  39. package/contracts/modal.json +100 -0
  40. package/contracts/modalcard.json +88 -0
  41. package/contracts/navigationmenu.json +65 -0
  42. package/contracts/numbertransition.json +33 -0
  43. package/contracts/pageheader.json +101 -0
  44. package/contracts/pagination.json +85 -0
  45. package/contracts/patterns/activity.json +30 -0
  46. package/contracts/patterns/assistant-workspace.json +16 -0
  47. package/contracts/patterns/dashboard.json +12 -0
  48. package/contracts/patterns/empty-first-run.json +15 -0
  49. package/contracts/patterns/inbox.json +32 -0
  50. package/contracts/patterns/invite-members.json +14 -0
  51. package/contracts/patterns/list-detail.json +13 -0
  52. package/contracts/patterns/settings-form.json +13 -0
  53. package/contracts/piechart.json +68 -0
  54. package/contracts/progress.json +124 -0
  55. package/contracts/progresssteps.json +91 -0
  56. package/contracts/radiogroup.json +132 -0
  57. package/contracts/scoreboard.json +46 -0
  58. package/contracts/scorecard.json +124 -0
  59. package/contracts/section.json +97 -0
  60. package/contracts/select.json +130 -0
  61. package/contracts/shimmertext.json +33 -0
  62. package/contracts/sidenav.json +133 -0
  63. package/contracts/slider.json +81 -0
  64. package/contracts/spinner.json +52 -0
  65. package/contracts/switch.json +94 -0
  66. package/contracts/table.json +92 -0
  67. package/contracts/tabs.json +90 -0
  68. package/contracts/textarea.json +54 -0
  69. package/contracts/thinkinganimation.json +32 -0
  70. package/contracts/timeline.json +49 -0
  71. package/contracts/toast.json +104 -0
  72. package/contracts/tooltip.json +66 -0
  73. package/lib/tokens.css +637 -0
  74. package/package.json +60 -0
  75. package/skills/prototype-from-kit/SKILL.md +29 -0
  76. package/src/index.ts +71 -0
  77. package/tokens/tokens.json +725 -0
  78. package/ui/Accordion/Accordion.module.css +68 -0
  79. package/ui/Accordion/Accordion.tsx +51 -0
  80. package/ui/Accordion/Accordion.types.ts +10 -0
  81. package/ui/Accordion/index.ts +2 -0
  82. package/ui/Alert/Alert.module.css +62 -0
  83. package/ui/Alert/Alert.tsx +27 -0
  84. package/ui/Alert/Alert.types.ts +7 -0
  85. package/ui/Alert/index.ts +2 -0
  86. package/ui/AlertDialog/AlertDialog.module.css +71 -0
  87. package/ui/AlertDialog/AlertDialog.tsx +109 -0
  88. package/ui/AlertDialog/AlertDialog.types.ts +14 -0
  89. package/ui/AlertDialog/index.ts +6 -0
  90. package/ui/AppHeader/AppHeader.module.css +120 -0
  91. package/ui/AppHeader/AppHeader.tsx +70 -0
  92. package/ui/AppHeader/AppHeader.types.ts +28 -0
  93. package/ui/AppHeader/index.ts +2 -0
  94. package/ui/AppNav/AppNav.module.css +168 -0
  95. package/ui/AppNav/AppNav.tsx +137 -0
  96. package/ui/AppNav/AppNav.types.ts +24 -0
  97. package/ui/AppNav/index.ts +2 -0
  98. package/ui/Avatar/Avatar.module.css +52 -0
  99. package/ui/Avatar/Avatar.tsx +62 -0
  100. package/ui/Avatar/Avatar.types.ts +8 -0
  101. package/ui/Avatar/index.ts +2 -0
  102. package/ui/AvatarGroup/AvatarGroup.module.css +49 -0
  103. package/ui/AvatarGroup/AvatarGroup.tsx +29 -0
  104. package/ui/AvatarGroup/AvatarGroup.types.ts +16 -0
  105. package/ui/AvatarGroup/index.ts +2 -0
  106. package/ui/Badge/Badge.module.css +92 -0
  107. package/ui/Badge/Badge.tsx +43 -0
  108. package/ui/Badge/Badge.types.ts +11 -0
  109. package/ui/Badge/index.ts +2 -0
  110. package/ui/BarChart/BarChart.module.css +56 -0
  111. package/ui/BarChart/BarChart.tsx +380 -0
  112. package/ui/BarChart/BarChart.types.ts +18 -0
  113. package/ui/BarChart/index.ts +2 -0
  114. package/ui/Breadcrumb/Breadcrumb.module.css +64 -0
  115. package/ui/Breadcrumb/Breadcrumb.tsx +89 -0
  116. package/ui/Breadcrumb/Breadcrumb.types.ts +14 -0
  117. package/ui/Breadcrumb/index.ts +2 -0
  118. package/ui/Button/Button.module.css +101 -0
  119. package/ui/Button/Button.tsx +49 -0
  120. package/ui/Button/Button.types.ts +18 -0
  121. package/ui/Button/index.ts +2 -0
  122. package/ui/Button/lucideName.tsx +188 -0
  123. package/ui/ButtonGroup/ButtonGroup.module.css +31 -0
  124. package/ui/ButtonGroup/ButtonGroup.tsx +12 -0
  125. package/ui/ButtonGroup/ButtonGroup.types.ts +6 -0
  126. package/ui/ButtonGroup/index.ts +2 -0
  127. package/ui/Calendar/Calendar.module.css +146 -0
  128. package/ui/Calendar/Calendar.tsx +296 -0
  129. package/ui/Calendar/Calendar.types.ts +11 -0
  130. package/ui/Calendar/index.ts +2 -0
  131. package/ui/Card/Card.module.css +95 -0
  132. package/ui/Card/Card.tsx +69 -0
  133. package/ui/Card/Card.types.ts +23 -0
  134. package/ui/Card/index.ts +2 -0
  135. package/ui/Carousel/Carousel.module.css +114 -0
  136. package/ui/Carousel/Carousel.tsx +152 -0
  137. package/ui/Carousel/Carousel.types.ts +17 -0
  138. package/ui/Carousel/index.ts +7 -0
  139. package/ui/Cell/Cell.module.css +133 -0
  140. package/ui/Cell/Cell.tsx +300 -0
  141. package/ui/Cell/Cell.types.ts +69 -0
  142. package/ui/Cell/index.ts +11 -0
  143. package/ui/Chat/Chat.module.css +149 -0
  144. package/ui/Chat/Chat.tsx +175 -0
  145. package/ui/Chat/Chat.types.ts +39 -0
  146. package/ui/Chat/index.ts +2 -0
  147. package/ui/Checkbox/Checkbox.module.css +135 -0
  148. package/ui/Checkbox/Checkbox.tsx +70 -0
  149. package/ui/Checkbox/Checkbox.types.ts +15 -0
  150. package/ui/Checkbox/index.ts +2 -0
  151. package/ui/Collapsible/Collapsible.module.css +68 -0
  152. package/ui/Collapsible/Collapsible.tsx +59 -0
  153. package/ui/Collapsible/Collapsible.types.ts +9 -0
  154. package/ui/Collapsible/index.ts +2 -0
  155. package/ui/Command/Command.module.css +138 -0
  156. package/ui/Command/Command.tsx +152 -0
  157. package/ui/Command/Command.types.ts +20 -0
  158. package/ui/Command/index.ts +2 -0
  159. package/ui/DataTable/DataTable.module.css +211 -0
  160. package/ui/DataTable/DataTable.tsx +429 -0
  161. package/ui/DataTable/DataTable.types.ts +35 -0
  162. package/ui/DataTable/index.ts +8 -0
  163. package/ui/DatePicker/DatePicker.module.css +44 -0
  164. package/ui/DatePicker/DatePicker.tsx +123 -0
  165. package/ui/DatePicker/DatePicker.types.ts +15 -0
  166. package/ui/DatePicker/index.ts +2 -0
  167. package/ui/Drawer/Drawer.module.css +204 -0
  168. package/ui/Drawer/Drawer.tsx +112 -0
  169. package/ui/Drawer/Drawer.types.ts +14 -0
  170. package/ui/Drawer/index.ts +2 -0
  171. package/ui/DropdownMenu/DropdownMenu.module.css +319 -0
  172. package/ui/DropdownMenu/DropdownMenu.tsx +580 -0
  173. package/ui/DropdownMenu/DropdownMenu.types.ts +48 -0
  174. package/ui/DropdownMenu/index.ts +8 -0
  175. package/ui/Empty/Empty.module.css +68 -0
  176. package/ui/Empty/Empty.tsx +35 -0
  177. package/ui/Empty/Empty.types.ts +10 -0
  178. package/ui/Empty/index.ts +2 -0
  179. package/ui/Field/Field.module.css +66 -0
  180. package/ui/Field/Field.tsx +46 -0
  181. package/ui/Field/Field.types.ts +12 -0
  182. package/ui/Field/index.ts +2 -0
  183. package/ui/FieldSet/FieldSet.module.css +30 -0
  184. package/ui/FieldSet/FieldSet.tsx +14 -0
  185. package/ui/FieldSet/FieldSet.types.ts +7 -0
  186. package/ui/FieldSet/index.ts +2 -0
  187. package/ui/HeaderCell/HeaderCell.module.css +85 -0
  188. package/ui/HeaderCell/HeaderCell.tsx +71 -0
  189. package/ui/HeaderCell/HeaderCell.types.ts +18 -0
  190. package/ui/HeaderCell/index.ts +2 -0
  191. package/ui/Input/Input.module.css +59 -0
  192. package/ui/Input/Input.tsx +65 -0
  193. package/ui/Input/Input.types.ts +22 -0
  194. package/ui/Input/index.ts +2 -0
  195. package/ui/InputOTP/InputOTP.module.css +139 -0
  196. package/ui/InputOTP/InputOTP.tsx +136 -0
  197. package/ui/InputOTP/InputOTP.types.ts +19 -0
  198. package/ui/InputOTP/index.ts +2 -0
  199. package/ui/InsightCard/InsightCard.module.css +166 -0
  200. package/ui/InsightCard/InsightCard.tsx +90 -0
  201. package/ui/InsightCard/InsightCard.types.ts +20 -0
  202. package/ui/InsightCard/index.ts +7 -0
  203. package/ui/LineChart/LineChart.module.css +93 -0
  204. package/ui/LineChart/LineChart.tsx +424 -0
  205. package/ui/LineChart/LineChart.types.ts +19 -0
  206. package/ui/LineChart/index.ts +2 -0
  207. package/ui/LoadingAnimation/LoadingAnimation.module.css +66 -0
  208. package/ui/LoadingAnimation/LoadingAnimation.tsx +41 -0
  209. package/ui/LoadingAnimation/LoadingAnimation.types.ts +9 -0
  210. package/ui/LoadingAnimation/index.ts +6 -0
  211. package/ui/Modal/Modal.module.css +48 -0
  212. package/ui/Modal/Modal.tsx +114 -0
  213. package/ui/Modal/Modal.types.ts +15 -0
  214. package/ui/Modal/index.ts +2 -0
  215. package/ui/ModalCard/ModalCard.module.css +137 -0
  216. package/ui/ModalCard/ModalCard.tsx +58 -0
  217. package/ui/ModalCard/ModalCard.types.ts +15 -0
  218. package/ui/ModalCard/index.ts +2 -0
  219. package/ui/NavigationMenu/NavigationMenu.module.css +31 -0
  220. package/ui/NavigationMenu/NavigationMenu.tsx +57 -0
  221. package/ui/NavigationMenu/NavigationMenu.types.ts +22 -0
  222. package/ui/NavigationMenu/index.ts +7 -0
  223. package/ui/NumberTransition/NumberTransition.module.css +110 -0
  224. package/ui/NumberTransition/NumberTransition.tsx +78 -0
  225. package/ui/NumberTransition/NumberTransition.types.ts +9 -0
  226. package/ui/NumberTransition/index.ts +2 -0
  227. package/ui/PageHeader/PageHeader.module.css +57 -0
  228. package/ui/PageHeader/PageHeader.tsx +39 -0
  229. package/ui/PageHeader/PageHeader.types.ts +12 -0
  230. package/ui/PageHeader/index.ts +2 -0
  231. package/ui/Pagination/Pagination.module.css +19 -0
  232. package/ui/Pagination/Pagination.tsx +147 -0
  233. package/ui/Pagination/Pagination.types.ts +12 -0
  234. package/ui/Pagination/index.ts +2 -0
  235. package/ui/PieChart/PieChart.module.css +116 -0
  236. package/ui/PieChart/PieChart.tsx +293 -0
  237. package/ui/PieChart/PieChart.types.ts +22 -0
  238. package/ui/PieChart/index.ts +2 -0
  239. package/ui/Progress/Progress.module.css +226 -0
  240. package/ui/Progress/Progress.tsx +167 -0
  241. package/ui/Progress/Progress.types.ts +15 -0
  242. package/ui/Progress/index.ts +8 -0
  243. package/ui/ProgressSteps/ProgressSteps.module.css +210 -0
  244. package/ui/ProgressSteps/ProgressSteps.tsx +105 -0
  245. package/ui/ProgressSteps/ProgressSteps.types.ts +19 -0
  246. package/ui/ProgressSteps/index.ts +8 -0
  247. package/ui/RadioGroup/RadioGroup.module.css +284 -0
  248. package/ui/RadioGroup/RadioGroup.tsx +116 -0
  249. package/ui/RadioGroup/RadioGroup.types.ts +30 -0
  250. package/ui/RadioGroup/index.ts +8 -0
  251. package/ui/Scoreboard/Scoreboard.module.css +53 -0
  252. package/ui/Scoreboard/Scoreboard.tsx +41 -0
  253. package/ui/Scoreboard/Scoreboard.types.ts +7 -0
  254. package/ui/Scoreboard/index.ts +2 -0
  255. package/ui/Scorecard/Scorecard.module.css +150 -0
  256. package/ui/Scorecard/Scorecard.tsx +92 -0
  257. package/ui/Scorecard/Scorecard.types.ts +18 -0
  258. package/ui/Scorecard/index.ts +2 -0
  259. package/ui/Section/Section.module.css +104 -0
  260. package/ui/Section/Section.tsx +75 -0
  261. package/ui/Section/Section.types.ts +15 -0
  262. package/ui/Section/index.ts +2 -0
  263. package/ui/Select/Select.module.css +7 -0
  264. package/ui/Select/Select.tsx +113 -0
  265. package/ui/Select/Select.types.ts +26 -0
  266. package/ui/Select/index.ts +2 -0
  267. package/ui/ShimmerText/ShimmerText.module.css +46 -0
  268. package/ui/ShimmerText/ShimmerText.tsx +48 -0
  269. package/ui/ShimmerText/ShimmerText.types.ts +12 -0
  270. package/ui/ShimmerText/index.ts +2 -0
  271. package/ui/SideNav/SideNav.module.css +347 -0
  272. package/ui/SideNav/SideNav.tsx +222 -0
  273. package/ui/SideNav/SideNav.types.ts +42 -0
  274. package/ui/SideNav/index.ts +8 -0
  275. package/ui/Slider/Slider.module.css +105 -0
  276. package/ui/Slider/Slider.tsx +187 -0
  277. package/ui/Slider/Slider.types.ts +11 -0
  278. package/ui/Slider/index.ts +2 -0
  279. package/ui/Spinner/Spinner.module.css +58 -0
  280. package/ui/Spinner/Spinner.tsx +19 -0
  281. package/ui/Spinner/Spinner.types.ts +6 -0
  282. package/ui/Spinner/index.ts +2 -0
  283. package/ui/Switch/Switch.module.css +189 -0
  284. package/ui/Switch/Switch.tsx +65 -0
  285. package/ui/Switch/Switch.types.ts +12 -0
  286. package/ui/Switch/index.ts +2 -0
  287. package/ui/Table/Table.module.css +132 -0
  288. package/ui/Table/Table.tsx +108 -0
  289. package/ui/Table/Table.types.ts +26 -0
  290. package/ui/Table/index.ts +8 -0
  291. package/ui/Tabs/Tabs.module.css +162 -0
  292. package/ui/Tabs/Tabs.tsx +150 -0
  293. package/ui/Tabs/Tabs.types.ts +21 -0
  294. package/ui/Tabs/index.ts +2 -0
  295. package/ui/Textarea/Textarea.module.css +74 -0
  296. package/ui/Textarea/Textarea.tsx +38 -0
  297. package/ui/Textarea/Textarea.types.ts +14 -0
  298. package/ui/Textarea/index.ts +2 -0
  299. package/ui/ThinkingAnimation/ThinkingAnimation.module.css +75 -0
  300. package/ui/ThinkingAnimation/ThinkingAnimation.tsx +31 -0
  301. package/ui/ThinkingAnimation/ThinkingAnimation.types.ts +8 -0
  302. package/ui/ThinkingAnimation/index.ts +2 -0
  303. package/ui/Timeline/Timeline.module.css +99 -0
  304. package/ui/Timeline/Timeline.tsx +47 -0
  305. package/ui/Timeline/Timeline.types.ts +16 -0
  306. package/ui/Timeline/index.ts +2 -0
  307. package/ui/Toast/Toast.module.css +133 -0
  308. package/ui/Toast/Toast.tsx +89 -0
  309. package/ui/Toast/Toast.types.ts +17 -0
  310. package/ui/Toast/index.ts +2 -0
  311. package/ui/Tooltip/Tooltip.module.css +111 -0
  312. package/ui/Tooltip/Tooltip.tsx +101 -0
  313. package/ui/Tooltip/index.ts +2 -0
  314. package/ui/patterns/ActivityPattern/ActivityFeed.tsx +77 -0
  315. package/ui/patterns/ActivityPattern/ActivityPattern.tsx +120 -0
  316. package/ui/patterns/ActivityPattern/ActivityTasks.tsx +86 -0
  317. package/ui/patterns/ActivityPattern/TaskDrawer.module.css +39 -0
  318. package/ui/patterns/ActivityPattern/TaskDrawer.tsx +186 -0
  319. package/ui/patterns/ActivityPattern/index.ts +2 -0
  320. package/ui/patterns/AssistantWorkspacePattern/AssistantWorkspacePattern.module.css +16 -0
  321. package/ui/patterns/AssistantWorkspacePattern/AssistantWorkspacePattern.tsx +159 -0
  322. package/ui/patterns/AssistantWorkspacePattern/index.ts +2 -0
  323. package/ui/patterns/DashboardPattern/DashboardPattern.tsx +102 -0
  324. package/ui/patterns/DashboardPattern/index.ts +1 -0
  325. package/ui/patterns/DashboardPattern/patterns.module.css +6 -0
  326. package/ui/patterns/EmptyFirstRunPattern/EmptyFirstRunPattern.tsx +125 -0
  327. package/ui/patterns/EmptyFirstRunPattern/index.ts +2 -0
  328. package/ui/patterns/InboxPattern/InboxPattern.module.css +40 -0
  329. package/ui/patterns/InboxPattern/InboxPattern.tsx +192 -0
  330. package/ui/patterns/InboxPattern/InboxReplyDrawer.tsx +97 -0
  331. package/ui/patterns/InboxPattern/inbox-data.ts +101 -0
  332. package/ui/patterns/InboxPattern/index.ts +2 -0
  333. package/ui/patterns/InviteMembersPattern/InviteMembersPattern.tsx +148 -0
  334. package/ui/patterns/InviteMembersPattern/index.ts +2 -0
  335. package/ui/patterns/ListDetailPattern/ListDetailPattern.module.css +34 -0
  336. package/ui/patterns/ListDetailPattern/ListDetailPattern.tsx +145 -0
  337. package/ui/patterns/ListDetailPattern/index.ts +2 -0
  338. package/ui/patterns/SettingsFormPattern/SettingsFormPattern.module.css +12 -0
  339. package/ui/patterns/SettingsFormPattern/SettingsFormPattern.tsx +89 -0
  340. package/ui/patterns/SettingsFormPattern/index.ts +3 -0
  341. package/ui/shared/ChartFrame.module.css +295 -0
  342. package/ui/shared/ChartFrame.tsx +87 -0
  343. package/ui/shared/chartMath.ts +228 -0
  344. package/ui/shared/controls.module.css +48 -0
  345. package/ui/shared/useChartSize.ts +22 -0
@@ -0,0 +1,295 @@
1
+ .frame {
2
+ display: grid;
3
+ gap: var(--space-4);
4
+ margin: 0;
5
+ padding: var(--space-6);
6
+ width: 100%;
7
+ min-width: 0;
8
+ box-sizing: border-box;
9
+ border: var(--border-width-thin) solid var(--border-faint);
10
+ border-radius: var(--radius-surface-md);
11
+ background: var(--surface-card);
12
+ box-shadow: var(--shadow-sm);
13
+ color: var(--text-primary);
14
+ }
15
+
16
+ .header {
17
+ display: flex;
18
+ flex-wrap: wrap;
19
+ align-items: flex-start;
20
+ justify-content: space-between;
21
+ gap: var(--space-2);
22
+ min-width: 0;
23
+ }
24
+
25
+ .heading {
26
+ display: grid;
27
+ gap: var(--space-1);
28
+ min-width: 0;
29
+ }
30
+
31
+ .title {
32
+ margin: 0;
33
+ font-family: var(--font-sans);
34
+ font-size: var(--type-size-heading-sm);
35
+ font-weight: var(--type-weight-heading);
36
+ line-height: var(--type-line-heading);
37
+ color: var(--text-primary);
38
+ }
39
+
40
+ .description {
41
+ margin: 0;
42
+ font-family: var(--font-sans);
43
+ font-size: var(--type-size-caption);
44
+ line-height: var(--type-line-body);
45
+ color: var(--text-secondary);
46
+ }
47
+
48
+ .actions {
49
+ display: flex;
50
+ align-items: center;
51
+ gap: var(--space-1);
52
+ }
53
+
54
+ .toggle {
55
+ display: inline-flex;
56
+ align-items: center;
57
+ gap: var(--space-1);
58
+ padding: var(--space-1) var(--space-2);
59
+ border: var(--border-width-thin) solid var(--border-faint);
60
+ border-radius: var(--radius-control-sm);
61
+ background: var(--surface-card);
62
+ color: var(--text-secondary);
63
+ cursor: pointer;
64
+ font-family: var(--font-sans);
65
+ font-size: var(--type-size-caption);
66
+ font-weight: var(--type-weight-label);
67
+ transition:
68
+ color var(--motion-interaction-duration) var(--motion-interaction-easing),
69
+ border-color var(--motion-interaction-duration) var(--motion-interaction-easing);
70
+ }
71
+
72
+ .toggle:hover {
73
+ border-color: var(--border-strong);
74
+ color: var(--text-primary);
75
+ }
76
+
77
+ .toggle:focus-visible {
78
+ outline: var(--border-focus-width) solid var(--focus-ring);
79
+ outline-offset: var(--space-inset-2xs);
80
+ }
81
+
82
+ .body {
83
+ min-width: 0;
84
+ overflow: visible;
85
+ }
86
+
87
+ .loading {
88
+ opacity: 0.6;
89
+ transition: opacity var(--motion-interaction-duration) var(--motion-interaction-easing);
90
+ }
91
+
92
+ .empty {
93
+ display: grid;
94
+ place-items: center;
95
+ min-height: 15rem;
96
+ margin: 0;
97
+ padding-inline: var(--space-4);
98
+ text-align: center;
99
+ font-family: var(--font-sans);
100
+ font-size: var(--type-size-body-sm);
101
+ color: var(--text-muted);
102
+ }
103
+
104
+ .footnote {
105
+ margin: 0;
106
+ font-family: var(--font-sans);
107
+ font-size: var(--type-size-caption);
108
+ color: var(--text-muted);
109
+ }
110
+
111
+ .legend {
112
+ display: flex;
113
+ flex-wrap: wrap;
114
+ gap: var(--space-2) var(--space-4);
115
+ margin: 0;
116
+ padding: 0;
117
+ list-style: none;
118
+ }
119
+
120
+ .legendInteractive > li {
121
+ display: contents;
122
+ }
123
+
124
+ .legendVertical {
125
+ display: grid;
126
+ gap: var(--space-2);
127
+ align-content: center;
128
+ }
129
+
130
+ .legendItem {
131
+ display: inline-flex;
132
+ align-items: center;
133
+ gap: var(--space-1);
134
+ font-family: var(--font-sans);
135
+ font-size: var(--type-size-caption);
136
+ color: var(--text-secondary);
137
+ }
138
+
139
+ .legendVertical .legendItem {
140
+ display: grid;
141
+ grid-template-columns: auto 1fr auto;
142
+ align-items: center;
143
+ column-gap: var(--space-2);
144
+ width: 100%;
145
+ }
146
+
147
+ .legendButton {
148
+ margin: 0;
149
+ padding: 0;
150
+ border: 0;
151
+ background: transparent;
152
+ font: inherit;
153
+ color: inherit;
154
+ text-align: inherit;
155
+ cursor: pointer;
156
+ border-radius: var(--radius-control-sm);
157
+ transition: opacity 0.56s cubic-bezier(0.22, 1, 0.36, 1);
158
+ }
159
+
160
+ .legendButton:focus-visible {
161
+ outline: var(--border-focus-width) solid var(--focus-ring);
162
+ outline-offset: var(--space-inset-2xs);
163
+ }
164
+
165
+ .legendItemDimmed {
166
+ opacity: 0.45;
167
+ }
168
+
169
+ .legendSwatch {
170
+ width: 0.625rem;
171
+ height: 0.625rem;
172
+ border-radius: var(--radius-control-sm);
173
+ flex: none;
174
+ }
175
+
176
+ .legendSwatchPill {
177
+ width: 0.5rem;
178
+ height: 0.375rem;
179
+ border-radius: var(--radius-pill);
180
+ }
181
+
182
+ .legendSwatchLine {
183
+ width: 0.75rem;
184
+ height: 0.156rem;
185
+ border-radius: var(--radius-pill);
186
+ }
187
+
188
+ .legendMeta {
189
+ color: var(--text-muted);
190
+ font-variant-numeric: tabular-nums;
191
+ }
192
+
193
+ .legendPercent {
194
+ color: var(--text-primary);
195
+ font-variant-numeric: tabular-nums;
196
+ font-weight: var(--type-weight-label);
197
+ text-align: end;
198
+ }
199
+
200
+ @media (prefers-reduced-motion: reduce) {
201
+ .legendButton {
202
+ transition: none;
203
+ }
204
+ }
205
+
206
+ .tableScroll {
207
+ overflow-x: auto;
208
+ }
209
+
210
+ .table {
211
+ width: 100%;
212
+ border-collapse: collapse;
213
+ font-family: var(--font-sans);
214
+ font-size: var(--type-size-body-sm);
215
+ line-height: var(--type-line-body);
216
+ }
217
+
218
+ .table th,
219
+ .table td {
220
+ padding: var(--space-1) var(--space-2);
221
+ border-bottom: var(--border-width-thin) solid var(--border-faint);
222
+ text-align: start;
223
+ background-color: var(--surface-card);
224
+ }
225
+
226
+ .table thead th {
227
+ color: var(--text-secondary);
228
+ font-size: var(--type-size-caption);
229
+ font-weight: var(--type-weight-label);
230
+ white-space: nowrap;
231
+ }
232
+
233
+ .table tbody th {
234
+ color: var(--text-primary);
235
+ font-weight: var(--type-weight-label);
236
+ }
237
+
238
+ .table td {
239
+ color: var(--text-primary);
240
+ font-variant-numeric: tabular-nums;
241
+ text-align: end;
242
+ }
243
+
244
+ .tooltip {
245
+ position: absolute;
246
+ z-index: var(--z-tooltip);
247
+ min-width: 9.5rem;
248
+ padding: var(--space-2) var(--space-3);
249
+ border: var(--border-width-thin) solid var(--border-faint);
250
+ border-radius: var(--radius-surface-md);
251
+ background: var(--surface-card);
252
+ box-shadow: var(--shadow-md);
253
+ color: var(--text-primary);
254
+ font-family: var(--font-sans);
255
+ pointer-events: none;
256
+ transform: translate(0.5rem, -50%);
257
+ }
258
+
259
+ .tooltipFlip {
260
+ transform: translate(calc(-100% - 0.5rem), -50%);
261
+ }
262
+
263
+ .tooltipTitle {
264
+ margin: 0;
265
+ font-size: var(--type-size-caption);
266
+ font-weight: var(--type-weight-label);
267
+ color: var(--text-primary);
268
+ }
269
+
270
+ .tooltipRow {
271
+ display: flex;
272
+ align-items: center;
273
+ gap: var(--space-2);
274
+ margin-top: var(--space-1);
275
+ font-size: var(--type-size-caption);
276
+ color: var(--text-secondary);
277
+ }
278
+
279
+ .tooltipKey {
280
+ width: 0.5rem;
281
+ height: 0.375rem;
282
+ border-radius: var(--radius-pill);
283
+ flex: none;
284
+ }
285
+
286
+ .tooltipShare {
287
+ flex: 1;
288
+ min-width: 0;
289
+ }
290
+
291
+ .tooltipValue {
292
+ color: var(--text-primary);
293
+ font-variant-numeric: tabular-nums;
294
+ font-weight: var(--type-weight-label);
295
+ }
@@ -0,0 +1,87 @@
1
+ "use client";
2
+
3
+ import { BarChart3, Table2 } from "lucide-react";
4
+ import { useId, useState, type ReactNode } from "react";
5
+ import styles from "./ChartFrame.module.css";
6
+
7
+ export interface ChartFrameProps {
8
+ title?: string;
9
+ description?: string;
10
+ legend?: ReactNode;
11
+ children: ReactNode;
12
+ table?: ReactNode;
13
+ footnote?: string;
14
+ isEmpty?: boolean;
15
+ emptyLabel?: string;
16
+ isLoading?: boolean;
17
+ className?: string;
18
+ }
19
+
20
+ export function ChartFrame({
21
+ title,
22
+ description,
23
+ legend,
24
+ children,
25
+ table,
26
+ footnote,
27
+ isEmpty = false,
28
+ emptyLabel = "No data for this range",
29
+ isLoading = false,
30
+ className = "",
31
+ }: ChartFrameProps) {
32
+ const [view, setView] = useState<"chart" | "table">("chart");
33
+ const titleId = useId();
34
+ const descriptionId = useId();
35
+ const panelId = useId();
36
+ const showTable = view === "table" && Boolean(table);
37
+
38
+ return (
39
+ <figure
40
+ className={`${styles.frame} ${className}`.trim()}
41
+ aria-labelledby={title ? titleId : undefined}
42
+ aria-describedby={description ? descriptionId : undefined}
43
+ >
44
+ {title || table ? (
45
+ <figcaption className={styles.header}>
46
+ <div className={styles.heading}>
47
+ {title ? (
48
+ <h3 id={titleId} className={styles.title}>
49
+ {title}
50
+ </h3>
51
+ ) : null}
52
+ {description ? (
53
+ <p id={descriptionId} className={styles.description}>
54
+ {description}
55
+ </p>
56
+ ) : null}
57
+ </div>
58
+ {table ? (
59
+ <div className={styles.actions}>
60
+ <button
61
+ type="button"
62
+ className={styles.toggle}
63
+ onClick={() => setView(showTable ? "chart" : "table")}
64
+ aria-expanded={showTable}
65
+ aria-controls={panelId}
66
+ >
67
+ {showTable ? <BarChart3 aria-hidden="true" size={14} /> : <Table2 aria-hidden="true" size={14} />}
68
+ <span>{showTable ? "Chart" : "Table"}</span>
69
+ </button>
70
+ </div>
71
+ ) : null}
72
+ </figcaption>
73
+ ) : null}
74
+
75
+ {legend}
76
+
77
+ <div
78
+ id={panelId}
79
+ className={`${styles.body}${isLoading ? ` ${styles.loading}` : ""}`}
80
+ >
81
+ {isEmpty ? <p className={styles.empty}>{emptyLabel}</p> : showTable ? table : children}
82
+ </div>
83
+
84
+ {footnote ? <p className={styles.footnote}>{footnote}</p> : null}
85
+ </figure>
86
+ );
87
+ }
@@ -0,0 +1,228 @@
1
+ export interface ChartDatum {
2
+ label: string;
3
+ value: number;
4
+ color?: string;
5
+ }
6
+
7
+ export interface ChartSeries {
8
+ label: string;
9
+ data: number[];
10
+ color?: string;
11
+ }
12
+
13
+ export const CHART_COLORS = [
14
+ "var(--fill-brand)",
15
+ "var(--fill-success)",
16
+ "var(--fill-warning)",
17
+ "var(--fill-danger)",
18
+ "var(--fill-info)",
19
+ ] as const;
20
+
21
+ export function formatValue(value: number): string {
22
+ if (!Number.isFinite(value)) return "—";
23
+ if (Math.abs(value) >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`;
24
+ if (Math.abs(value) >= 10_000) return `${(value / 1_000).toFixed(1)}k`;
25
+ if (Number.isInteger(value)) return value.toLocaleString("en-US");
26
+ return value.toLocaleString("en-US", { maximumFractionDigits: 1 });
27
+ }
28
+
29
+ export function formatAxisTick(value: number): string {
30
+ if (!Number.isFinite(value)) return "";
31
+ if (Math.abs(value) >= 1_000_000) return `${value / 1_000_000}M`;
32
+ if (Math.abs(value) >= 1_000) return `${value / 1_000}k`;
33
+ return String(value);
34
+ }
35
+
36
+ export function colorAt(index: number, override?: string): string {
37
+ return override ?? CHART_COLORS[index % CHART_COLORS.length];
38
+ }
39
+
40
+ export interface PreparedSegment extends ChartDatum {
41
+ share: number;
42
+ color: string;
43
+ }
44
+
45
+ export function prepareSegments(
46
+ data: ChartDatum[],
47
+ options: { maxSegments?: number; sort?: boolean; otherLabel?: string } = {},
48
+ ): PreparedSegment[] {
49
+ const { maxSegments = 6, sort = true, otherLabel = "Other" } = options;
50
+ const cleaned = data.filter((entry) => Number.isFinite(entry.value) && entry.value > 0);
51
+ const ordered = sort ? [...cleaned].sort((a, b) => b.value - a.value) : [...cleaned];
52
+ const visible = ordered.slice(0, maxSegments);
53
+ const remainder = ordered.slice(maxSegments);
54
+ const remainderTotal = remainder.reduce((sum, entry) => sum + entry.value, 0);
55
+ if (remainderTotal > 0) {
56
+ visible.push({ label: otherLabel, value: remainderTotal });
57
+ }
58
+ const total = visible.reduce((sum, entry) => sum + entry.value, 0);
59
+ return visible.map((entry, index) => ({
60
+ ...entry,
61
+ color: colorAt(index, entry.color),
62
+ share: total > 0 ? entry.value / total : 0,
63
+ }));
64
+ }
65
+
66
+ export function normalizeBarInput(input: {
67
+ data?: ChartDatum[];
68
+ categories?: string[];
69
+ series?: ChartSeries[];
70
+ }): { categories: string[]; series: ChartSeries[] } {
71
+ if (input.categories?.length && input.series?.length) {
72
+ return {
73
+ categories: input.categories,
74
+ series: input.series.map((entry, index) => ({
75
+ ...entry,
76
+ color: colorAt(index, entry.color),
77
+ })),
78
+ };
79
+ }
80
+ const data = input.data ?? [];
81
+ return {
82
+ categories: data.map((entry) => entry.label),
83
+ series: [
84
+ {
85
+ label: "Value",
86
+ data: data.map((entry) => entry.value),
87
+ color: CHART_COLORS[0],
88
+ },
89
+ ],
90
+ };
91
+ }
92
+
93
+ export function normalizeLineInput(input: {
94
+ data?: ChartDatum[];
95
+ labels?: string[];
96
+ series?: ChartSeries[];
97
+ }): { labels: string[]; series: ChartSeries[] } {
98
+ if (input.labels?.length && input.series?.length) {
99
+ return {
100
+ labels: input.labels,
101
+ series: input.series.map((entry, index) => ({
102
+ ...entry,
103
+ color: colorAt(index, entry.color),
104
+ })),
105
+ };
106
+ }
107
+ const data = input.data ?? [];
108
+ return {
109
+ labels: data.map((entry) => entry.label),
110
+ series: [
111
+ {
112
+ label: "Value",
113
+ data: data.map((entry) => entry.value),
114
+ color: CHART_COLORS[0],
115
+ },
116
+ ],
117
+ };
118
+ }
119
+
120
+ export function seriesExtent(
121
+ series: ChartSeries[],
122
+ options: { includeZero?: boolean } = {},
123
+ ): [number, number] {
124
+ const values = series.flatMap((entry) => entry.data).filter((value) => Number.isFinite(value));
125
+ if (!values.length) return [0, 1];
126
+ let min = Math.min(...values);
127
+ let max = Math.max(...values);
128
+ if (options.includeZero) {
129
+ min = Math.min(min, 0);
130
+ max = Math.max(max, 0);
131
+ }
132
+ if (min === max) {
133
+ return min === 0 ? [0, 1] : [min * 0.9, max * 1.1];
134
+ }
135
+ return [min, max];
136
+ }
137
+
138
+ export function niceTicks(min: number, max: number, count = 5): { ticks: number[]; min: number; max: number } {
139
+ const range = niceNum(max - min, false);
140
+ const step = niceNum(range / Math.max(count - 1, 1), true);
141
+ const niceMin = Math.floor(min / step) * step;
142
+ const niceMax = Math.ceil(max / step) * step;
143
+ const ticks: number[] = [];
144
+ for (let tick = niceMin; tick <= niceMax + step / 2; tick += step) {
145
+ ticks.push(Number(tick.toFixed(10)));
146
+ }
147
+ return { ticks, min: niceMin, max: niceMax };
148
+ }
149
+
150
+ function niceNum(value: number, round: boolean): number {
151
+ const exponent = Math.floor(Math.log10(Math.abs(value) || 1));
152
+ const fraction = value / 10 ** exponent;
153
+ let niceFraction: number;
154
+ if (round) {
155
+ if (fraction < 1.5) niceFraction = 1;
156
+ else if (fraction < 3) niceFraction = 2;
157
+ else if (fraction < 7) niceFraction = 5;
158
+ else niceFraction = 10;
159
+ } else if (fraction <= 1) niceFraction = 1;
160
+ else if (fraction <= 2) niceFraction = 2;
161
+ else if (fraction <= 5) niceFraction = 5;
162
+ else niceFraction = 10;
163
+ return niceFraction * 10 ** exponent;
164
+ }
165
+
166
+ export function linearScale(domain: [number, number], range: [number, number]) {
167
+ const [d0, d1] = domain;
168
+ const [r0, r1] = range;
169
+ const span = d1 - d0 || 1;
170
+ return (value: number) => r0 + ((value - d0) / span) * (r1 - r0);
171
+ }
172
+
173
+ export const CHART_MARGINS = { top: 12, right: 12, bottom: 36, left: 44 } as const;
174
+
175
+ export const TAU = Math.PI * 2;
176
+
177
+ export function polarToCartesian(cx: number, cy: number, radius: number, angle: number) {
178
+ return {
179
+ x: cx + radius * Math.cos(angle - Math.PI / 2),
180
+ y: cy + radius * Math.sin(angle - Math.PI / 2),
181
+ };
182
+ }
183
+
184
+ export function pointOnCircle(cx: number, cy: number, radius: number, angle: number) {
185
+ return polarToCartesian(cx, cy, radius, angle);
186
+ }
187
+
188
+ export function wedgePath(options: {
189
+ cx: number;
190
+ cy: number;
191
+ radius: number;
192
+ startAngle: number;
193
+ endAngle: number;
194
+ }): string {
195
+ const { cx, cy, radius, startAngle, endAngle } = options;
196
+ const start = polarToCartesian(cx, cy, radius, endAngle);
197
+ const end = polarToCartesian(cx, cy, radius, startAngle);
198
+ const largeArc = endAngle - startAngle > Math.PI ? 1 : 0;
199
+ return [
200
+ `M ${cx} ${cy}`,
201
+ `L ${start.x} ${start.y}`,
202
+ `A ${radius} ${radius} 0 ${largeArc} 0 ${end.x} ${end.y}`,
203
+ "Z",
204
+ ].join(" ");
205
+ }
206
+
207
+ export function ringPath(options: {
208
+ cx: number;
209
+ cy: number;
210
+ innerRadius: number;
211
+ outerRadius: number;
212
+ startAngle: number;
213
+ endAngle: number;
214
+ }): string {
215
+ const { cx, cy, innerRadius, outerRadius, startAngle, endAngle } = options;
216
+ const outerStart = polarToCartesian(cx, cy, outerRadius, endAngle);
217
+ const outerEnd = polarToCartesian(cx, cy, outerRadius, startAngle);
218
+ const innerStart = polarToCartesian(cx, cy, innerRadius, startAngle);
219
+ const innerEnd = polarToCartesian(cx, cy, innerRadius, endAngle);
220
+ const largeArc = endAngle - startAngle > Math.PI ? 1 : 0;
221
+ return [
222
+ `M ${outerStart.x} ${outerStart.y}`,
223
+ `A ${outerRadius} ${outerRadius} 0 ${largeArc} 0 ${outerEnd.x} ${outerEnd.y}`,
224
+ `L ${innerStart.x} ${innerStart.y}`,
225
+ `A ${innerRadius} ${innerRadius} 0 ${largeArc} 1 ${innerEnd.x} ${innerEnd.y}`,
226
+ "Z",
227
+ ].join(" ");
228
+ }
@@ -0,0 +1,48 @@
1
+ .control {
2
+ display: block;
3
+ width: 100%;
4
+ font-family: var(--font-sans);
5
+ font-size: var(--type-size-body-sm);
6
+ font-weight: var(--type-weight-body);
7
+ line-height: var(--type-line-body);
8
+ color: var(--text-primary);
9
+ background-color: var(--surface-card);
10
+ border: var(--border-width-thin) solid var(--border-faint);
11
+ border-radius: var(--radius-control-md);
12
+ transition: border-color var(--motion-fast) ease, outline-color var(--motion-fast) ease;
13
+ }
14
+
15
+ .control:focus {
16
+ border-color: var(--border-focus);
17
+ outline: var(--border-focus-width) solid var(--focus-ring);
18
+ outline-offset: var(--space-inset-2xs);
19
+ }
20
+
21
+ .control:disabled {
22
+ opacity: 0.5;
23
+ cursor: not-allowed;
24
+ background-color: var(--surface-muted);
25
+ }
26
+
27
+ .controlLg {
28
+ padding: var(--space-3) var(--space-4);
29
+ font-size: var(--type-size-body);
30
+ }
31
+
32
+ .controlMd {
33
+ padding: var(--space-2) var(--space-3);
34
+ }
35
+
36
+ .controlSm {
37
+ padding: var(--space-1) var(--space-2);
38
+ font-size: var(--type-size-label);
39
+ }
40
+
41
+ .controlError {
42
+ border-color: var(--status-danger);
43
+ }
44
+
45
+ .controlError:focus {
46
+ border-color: var(--status-danger);
47
+ outline-color: var(--status-danger);
48
+ }
@@ -0,0 +1,22 @@
1
+ "use client";
2
+
3
+ import { useEffect, useRef, useState } from "react";
4
+
5
+ export function useChartSize(fallbackHeight: number) {
6
+ const ref = useRef<HTMLDivElement>(null);
7
+ const [width, setWidth] = useState(0);
8
+
9
+ useEffect(() => {
10
+ const node = ref.current;
11
+ if (!node) return undefined;
12
+
13
+ const update = () => setWidth(node.clientWidth);
14
+ update();
15
+
16
+ const observer = new ResizeObserver(update);
17
+ observer.observe(node);
18
+ return () => observer.disconnect();
19
+ }, []);
20
+
21
+ return { ref, width, height: fallbackHeight };
22
+ }