@major-tech/ui 0.0.0-stage → 1.0.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 (495) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/THIRD_PARTY_NOTICES.md +27 -0
  3. package/dist/components/accordion.d.ts +33 -0
  4. package/dist/components/accordion.d.ts.map +1 -0
  5. package/dist/components/accordion.js +51 -0
  6. package/dist/components/accordion.js.map +1 -0
  7. package/dist/components/activity-chart.d.ts +26 -0
  8. package/dist/components/activity-chart.d.ts.map +1 -0
  9. package/dist/components/activity-chart.js +56 -0
  10. package/dist/components/activity-chart.js.map +1 -0
  11. package/dist/components/alert-dialog.d.ts +28 -0
  12. package/dist/components/alert-dialog.d.ts.map +1 -0
  13. package/dist/components/alert-dialog.js +51 -0
  14. package/dist/components/alert-dialog.js.map +1 -0
  15. package/dist/components/alert.d.ts +34 -0
  16. package/dist/components/alert.d.ts.map +1 -0
  17. package/dist/components/alert.js +59 -0
  18. package/dist/components/alert.js.map +1 -0
  19. package/dist/components/ask-user-question.d.ts +103 -0
  20. package/dist/components/ask-user-question.d.ts.map +1 -0
  21. package/dist/components/ask-user-question.js +401 -0
  22. package/dist/components/ask-user-question.js.map +1 -0
  23. package/dist/components/attachment-gallery.d.ts +137 -0
  24. package/dist/components/attachment-gallery.d.ts.map +1 -0
  25. package/dist/components/attachment-gallery.js +317 -0
  26. package/dist/components/attachment-gallery.js.map +1 -0
  27. package/dist/components/avatar.d.ts +37 -0
  28. package/dist/components/avatar.d.ts.map +1 -0
  29. package/dist/components/avatar.js +62 -0
  30. package/dist/components/avatar.js.map +1 -0
  31. package/dist/components/badge.d.ts +29 -0
  32. package/dist/components/badge.d.ts.map +1 -0
  33. package/dist/components/badge.js +50 -0
  34. package/dist/components/badge.js.map +1 -0
  35. package/dist/components/brand-tile.d.ts +33 -0
  36. package/dist/components/brand-tile.d.ts.map +1 -0
  37. package/dist/components/brand-tile.js +36 -0
  38. package/dist/components/brand-tile.js.map +1 -0
  39. package/dist/components/button.d.ts +51 -0
  40. package/dist/components/button.d.ts.map +1 -0
  41. package/dist/components/button.js +90 -0
  42. package/dist/components/button.js.map +1 -0
  43. package/dist/components/calendar.d.ts +18 -0
  44. package/dist/components/calendar.d.ts.map +1 -0
  45. package/dist/components/calendar.js +78 -0
  46. package/dist/components/calendar.js.map +1 -0
  47. package/dist/components/card.d.ts +18 -0
  48. package/dist/components/card.d.ts.map +1 -0
  49. package/dist/components/card.js +34 -0
  50. package/dist/components/card.js.map +1 -0
  51. package/dist/components/carousel.d.ts +48 -0
  52. package/dist/components/carousel.d.ts.map +1 -0
  53. package/dist/components/carousel.js +227 -0
  54. package/dist/components/carousel.js.map +1 -0
  55. package/dist/components/catalog-card.d.ts +29 -0
  56. package/dist/components/catalog-card.d.ts.map +1 -0
  57. package/dist/components/catalog-card.js +20 -0
  58. package/dist/components/catalog-card.js.map +1 -0
  59. package/dist/components/chart.d.ts +118 -0
  60. package/dist/components/chart.d.ts.map +1 -0
  61. package/dist/components/chart.js +209 -0
  62. package/dist/components/chart.js.map +1 -0
  63. package/dist/components/checkbox.d.ts +8 -0
  64. package/dist/components/checkbox.d.ts.map +1 -0
  65. package/dist/components/checkbox.js +14 -0
  66. package/dist/components/checkbox.js.map +1 -0
  67. package/dist/components/chip.d.ts +68 -0
  68. package/dist/components/chip.d.ts.map +1 -0
  69. package/dist/components/chip.js +100 -0
  70. package/dist/components/chip.js.map +1 -0
  71. package/dist/components/code-block.d.ts +99 -0
  72. package/dist/components/code-block.d.ts.map +1 -0
  73. package/dist/components/code-block.js +144 -0
  74. package/dist/components/code-block.js.map +1 -0
  75. package/dist/components/collapsible.d.ts +17 -0
  76. package/dist/components/collapsible.d.ts.map +1 -0
  77. package/dist/components/collapsible.js +25 -0
  78. package/dist/components/collapsible.js.map +1 -0
  79. package/dist/components/command.d.ts +51 -0
  80. package/dist/components/command.d.ts.map +1 -0
  81. package/dist/components/command.js +120 -0
  82. package/dist/components/command.js.map +1 -0
  83. package/dist/components/composer.d.ts +211 -0
  84. package/dist/components/composer.d.ts.map +1 -0
  85. package/dist/components/composer.js +605 -0
  86. package/dist/components/composer.js.map +1 -0
  87. package/dist/components/connector-request.d.ts +63 -0
  88. package/dist/components/connector-request.d.ts.map +1 -0
  89. package/dist/components/connector-request.js +57 -0
  90. package/dist/components/connector-request.js.map +1 -0
  91. package/dist/components/context-menu.d.ts +26 -0
  92. package/dist/components/context-menu.d.ts.map +1 -0
  93. package/dist/components/context-menu.js +33 -0
  94. package/dist/components/context-menu.js.map +1 -0
  95. package/dist/components/data-table.d.ts +61 -0
  96. package/dist/components/data-table.d.ts.map +1 -0
  97. package/dist/components/data-table.js +79 -0
  98. package/dist/components/data-table.js.map +1 -0
  99. package/dist/components/date-range-picker.d.ts +54 -0
  100. package/dist/components/date-range-picker.d.ts.map +1 -0
  101. package/dist/components/date-range-picker.js +451 -0
  102. package/dist/components/date-range-picker.js.map +1 -0
  103. package/dist/components/dialog.d.ts +46 -0
  104. package/dist/components/dialog.d.ts.map +1 -0
  105. package/dist/components/dialog.js +75 -0
  106. package/dist/components/dialog.js.map +1 -0
  107. package/dist/components/drawer.d.ts +85 -0
  108. package/dist/components/drawer.d.ts.map +1 -0
  109. package/dist/components/drawer.js +166 -0
  110. package/dist/components/drawer.js.map +1 -0
  111. package/dist/components/dropdown-menu.d.ts +77 -0
  112. package/dist/components/dropdown-menu.d.ts.map +1 -0
  113. package/dist/components/dropdown-menu.js +112 -0
  114. package/dist/components/dropdown-menu.js.map +1 -0
  115. package/dist/components/editor-tabs.d.ts +49 -0
  116. package/dist/components/editor-tabs.d.ts.map +1 -0
  117. package/dist/components/editor-tabs.js +157 -0
  118. package/dist/components/editor-tabs.js.map +1 -0
  119. package/dist/components/empty-state.d.ts +21 -0
  120. package/dist/components/empty-state.d.ts.map +1 -0
  121. package/dist/components/empty-state.js +14 -0
  122. package/dist/components/empty-state.js.map +1 -0
  123. package/dist/components/entity-card.d.ts +301 -0
  124. package/dist/components/entity-card.d.ts.map +1 -0
  125. package/dist/components/entity-card.js +392 -0
  126. package/dist/components/entity-card.js.map +1 -0
  127. package/dist/components/entity-row.d.ts +37 -0
  128. package/dist/components/entity-row.d.ts.map +1 -0
  129. package/dist/components/entity-row.js +65 -0
  130. package/dist/components/entity-row.js.map +1 -0
  131. package/dist/components/env-var-request.d.ts +51 -0
  132. package/dist/components/env-var-request.d.ts.map +1 -0
  133. package/dist/components/env-var-request.js +50 -0
  134. package/dist/components/env-var-request.js.map +1 -0
  135. package/dist/components/field.d.ts +30 -0
  136. package/dist/components/field.d.ts.map +1 -0
  137. package/dist/components/field.js +48 -0
  138. package/dist/components/field.js.map +1 -0
  139. package/dist/components/file-upload.d.ts +108 -0
  140. package/dist/components/file-upload.d.ts.map +1 -0
  141. package/dist/components/file-upload.js +217 -0
  142. package/dist/components/file-upload.js.map +1 -0
  143. package/dist/components/hover-card.d.ts +18 -0
  144. package/dist/components/hover-card.d.ts.map +1 -0
  145. package/dist/components/hover-card.js +84 -0
  146. package/dist/components/hover-card.js.map +1 -0
  147. package/dist/components/input-group.d.ts +29 -0
  148. package/dist/components/input-group.d.ts.map +1 -0
  149. package/dist/components/input-group.js +61 -0
  150. package/dist/components/input-group.js.map +1 -0
  151. package/dist/components/input.d.ts +9 -0
  152. package/dist/components/input.d.ts.map +1 -0
  153. package/dist/components/input.js +13 -0
  154. package/dist/components/input.js.map +1 -0
  155. package/dist/components/island.d.ts +18 -0
  156. package/dist/components/island.d.ts.map +1 -0
  157. package/dist/components/island.js +30 -0
  158. package/dist/components/island.js.map +1 -0
  159. package/dist/components/kbd.d.ts +7 -0
  160. package/dist/components/kbd.d.ts.map +1 -0
  161. package/dist/components/kbd.js +11 -0
  162. package/dist/components/kbd.js.map +1 -0
  163. package/dist/components/label.d.ts +8 -0
  164. package/dist/components/label.d.ts.map +1 -0
  165. package/dist/components/label.js +12 -0
  166. package/dist/components/label.js.map +1 -0
  167. package/dist/components/markdown.d.ts +24 -0
  168. package/dist/components/markdown.d.ts.map +1 -0
  169. package/dist/components/markdown.js +38 -0
  170. package/dist/components/markdown.js.map +1 -0
  171. package/dist/components/message.d.ts +38 -0
  172. package/dist/components/message.d.ts.map +1 -0
  173. package/dist/components/message.js +25 -0
  174. package/dist/components/message.js.map +1 -0
  175. package/dist/components/page-header.d.ts +31 -0
  176. package/dist/components/page-header.d.ts.map +1 -0
  177. package/dist/components/page-header.js +94 -0
  178. package/dist/components/page-header.js.map +1 -0
  179. package/dist/components/pagination.d.ts +22 -0
  180. package/dist/components/pagination.d.ts.map +1 -0
  181. package/dist/components/pagination.js +36 -0
  182. package/dist/components/pagination.js.map +1 -0
  183. package/dist/components/password-input.d.ts +5 -0
  184. package/dist/components/password-input.d.ts.map +1 -0
  185. package/dist/components/password-input.js +12 -0
  186. package/dist/components/password-input.js.map +1 -0
  187. package/dist/components/pepper.d.ts +92 -0
  188. package/dist/components/pepper.d.ts.map +1 -0
  189. package/dist/components/pepper.js +1279 -0
  190. package/dist/components/pepper.js.map +1 -0
  191. package/dist/components/permission-request.d.ts +53 -0
  192. package/dist/components/permission-request.d.ts.map +1 -0
  193. package/dist/components/permission-request.js +54 -0
  194. package/dist/components/permission-request.js.map +1 -0
  195. package/dist/components/popover.d.ts +42 -0
  196. package/dist/components/popover.d.ts.map +1 -0
  197. package/dist/components/popover.js +76 -0
  198. package/dist/components/popover.js.map +1 -0
  199. package/dist/components/progress.d.ts +9 -0
  200. package/dist/components/progress.d.ts.map +1 -0
  201. package/dist/components/progress.js +12 -0
  202. package/dist/components/progress.js.map +1 -0
  203. package/dist/components/progressive-blur.d.ts +31 -0
  204. package/dist/components/progressive-blur.d.ts.map +1 -0
  205. package/dist/components/progressive-blur.js +44 -0
  206. package/dist/components/progressive-blur.js.map +1 -0
  207. package/dist/components/radio-group.d.ts +8 -0
  208. package/dist/components/radio-group.d.ts.map +1 -0
  209. package/dist/components/radio-group.js +15 -0
  210. package/dist/components/radio-group.js.map +1 -0
  211. package/dist/components/request-card.d.ts +34 -0
  212. package/dist/components/request-card.d.ts.map +1 -0
  213. package/dist/components/request-card.js +50 -0
  214. package/dist/components/request-card.js.map +1 -0
  215. package/dist/components/resizable.d.ts +24 -0
  216. package/dist/components/resizable.d.ts.map +1 -0
  217. package/dist/components/resizable.js +40 -0
  218. package/dist/components/resizable.js.map +1 -0
  219. package/dist/components/responsive-overlay.d.ts +136 -0
  220. package/dist/components/responsive-overlay.d.ts.map +1 -0
  221. package/dist/components/responsive-overlay.js +302 -0
  222. package/dist/components/responsive-overlay.js.map +1 -0
  223. package/dist/components/scroll-shadows.d.ts +11 -0
  224. package/dist/components/scroll-shadows.d.ts.map +1 -0
  225. package/dist/components/scroll-shadows.js +53 -0
  226. package/dist/components/scroll-shadows.js.map +1 -0
  227. package/dist/components/search-field.d.ts +16 -0
  228. package/dist/components/search-field.d.ts.map +1 -0
  229. package/dist/components/search-field.js +50 -0
  230. package/dist/components/search-field.js.map +1 -0
  231. package/dist/components/searchable-select.d.ts +43 -0
  232. package/dist/components/searchable-select.d.ts.map +1 -0
  233. package/dist/components/searchable-select.js +39 -0
  234. package/dist/components/searchable-select.js.map +1 -0
  235. package/dist/components/select.d.ts +60 -0
  236. package/dist/components/select.d.ts.map +1 -0
  237. package/dist/components/select.js +94 -0
  238. package/dist/components/select.js.map +1 -0
  239. package/dist/components/separator.d.ts +7 -0
  240. package/dist/components/separator.d.ts.map +1 -0
  241. package/dist/components/separator.js +12 -0
  242. package/dist/components/separator.js.map +1 -0
  243. package/dist/components/settings-section.d.ts +41 -0
  244. package/dist/components/settings-section.d.ts.map +1 -0
  245. package/dist/components/settings-section.js +50 -0
  246. package/dist/components/settings-section.js.map +1 -0
  247. package/dist/components/sidebar-item.d.ts +41 -0
  248. package/dist/components/sidebar-item.d.ts.map +1 -0
  249. package/dist/components/sidebar-item.js +59 -0
  250. package/dist/components/sidebar-item.js.map +1 -0
  251. package/dist/components/skeleton.d.ts +7 -0
  252. package/dist/components/skeleton.d.ts.map +1 -0
  253. package/dist/components/skeleton.js +11 -0
  254. package/dist/components/skeleton.js.map +1 -0
  255. package/dist/components/slider.d.ts +10 -0
  256. package/dist/components/slider.d.ts.map +1 -0
  257. package/dist/components/slider.js +36 -0
  258. package/dist/components/slider.js.map +1 -0
  259. package/dist/components/sonner.d.ts +8 -0
  260. package/dist/components/sonner.d.ts.map +1 -0
  261. package/dist/components/sonner.js +21 -0
  262. package/dist/components/sonner.js.map +1 -0
  263. package/dist/components/spinner.d.ts +7 -0
  264. package/dist/components/spinner.d.ts.map +1 -0
  265. package/dist/components/spinner.js +12 -0
  266. package/dist/components/spinner.js.map +1 -0
  267. package/dist/components/stat-strip.d.ts +20 -0
  268. package/dist/components/stat-strip.d.ts.map +1 -0
  269. package/dist/components/stat-strip.js +11 -0
  270. package/dist/components/stat-strip.js.map +1 -0
  271. package/dist/components/status-dot.d.ts +25 -0
  272. package/dist/components/status-dot.d.ts.map +1 -0
  273. package/dist/components/status-dot.js +31 -0
  274. package/dist/components/status-dot.js.map +1 -0
  275. package/dist/components/subagent-run.d.ts +27 -0
  276. package/dist/components/subagent-run.d.ts.map +1 -0
  277. package/dist/components/subagent-run.js +38 -0
  278. package/dist/components/subagent-run.js.map +1 -0
  279. package/dist/components/switch.d.ts +8 -0
  280. package/dist/components/switch.d.ts.map +1 -0
  281. package/dist/components/switch.js +13 -0
  282. package/dist/components/switch.js.map +1 -0
  283. package/dist/components/system-notice.d.ts +34 -0
  284. package/dist/components/system-notice.d.ts.map +1 -0
  285. package/dist/components/system-notice.js +52 -0
  286. package/dist/components/system-notice.js.map +1 -0
  287. package/dist/components/table.d.ts +27 -0
  288. package/dist/components/table.d.ts.map +1 -0
  289. package/dist/components/table.js +37 -0
  290. package/dist/components/table.js.map +1 -0
  291. package/dist/components/tabs.d.ts +40 -0
  292. package/dist/components/tabs.d.ts.map +1 -0
  293. package/dist/components/tabs.js +52 -0
  294. package/dist/components/tabs.js.map +1 -0
  295. package/dist/components/textarea.d.ts +5 -0
  296. package/dist/components/textarea.d.ts.map +1 -0
  297. package/dist/components/textarea.js +9 -0
  298. package/dist/components/textarea.js.map +1 -0
  299. package/dist/components/thinking-indicator.d.ts +21 -0
  300. package/dist/components/thinking-indicator.d.ts.map +1 -0
  301. package/dist/components/thinking-indicator.js +136 -0
  302. package/dist/components/thinking-indicator.js.map +1 -0
  303. package/dist/components/thread-status.d.ts +25 -0
  304. package/dist/components/thread-status.d.ts.map +1 -0
  305. package/dist/components/thread-status.js +41 -0
  306. package/dist/components/thread-status.js.map +1 -0
  307. package/dist/components/todo-list.d.ts +52 -0
  308. package/dist/components/todo-list.d.ts.map +1 -0
  309. package/dist/components/todo-list.js +137 -0
  310. package/dist/components/todo-list.js.map +1 -0
  311. package/dist/components/toggle-group.d.ts +17 -0
  312. package/dist/components/toggle-group.d.ts.map +1 -0
  313. package/dist/components/toggle-group.js +26 -0
  314. package/dist/components/toggle-group.js.map +1 -0
  315. package/dist/components/toggle.d.ts +27 -0
  316. package/dist/components/toggle.d.ts.map +1 -0
  317. package/dist/components/toggle.js +44 -0
  318. package/dist/components/toggle.js.map +1 -0
  319. package/dist/components/tool-call.d.ts +60 -0
  320. package/dist/components/tool-call.d.ts.map +1 -0
  321. package/dist/components/tool-call.js +94 -0
  322. package/dist/components/tool-call.js.map +1 -0
  323. package/dist/components/tool-result.d.ts +127 -0
  324. package/dist/components/tool-result.d.ts.map +1 -0
  325. package/dist/components/tool-result.js +155 -0
  326. package/dist/components/tool-result.js.map +1 -0
  327. package/dist/components/tooltip.d.ts +18 -0
  328. package/dist/components/tooltip.d.ts.map +1 -0
  329. package/dist/components/tooltip.js +38 -0
  330. package/dist/components/tooltip.js.map +1 -0
  331. package/dist/components/trace.d.ts +38 -0
  332. package/dist/components/trace.d.ts.map +1 -0
  333. package/dist/components/trace.js +52 -0
  334. package/dist/components/trace.js.map +1 -0
  335. package/dist/components/turn-summary.d.ts +17 -0
  336. package/dist/components/turn-summary.d.ts.map +1 -0
  337. package/dist/components/turn-summary.js +19 -0
  338. package/dist/components/turn-summary.js.map +1 -0
  339. package/dist/components/usage-meter.d.ts +16 -0
  340. package/dist/components/usage-meter.d.ts.map +1 -0
  341. package/dist/components/usage-meter.js +10 -0
  342. package/dist/components/usage-meter.js.map +1 -0
  343. package/dist/components/view-switcher.d.ts +25 -0
  344. package/dist/components/view-switcher.d.ts.map +1 -0
  345. package/dist/components/view-switcher.js +196 -0
  346. package/dist/components/view-switcher.js.map +1 -0
  347. package/dist/docs/components/accordion.md +151 -0
  348. package/dist/docs/components/activity-chart.md +104 -0
  349. package/dist/docs/components/alert-dialog.md +216 -0
  350. package/dist/docs/components/alert.md +203 -0
  351. package/dist/docs/components/ask-user-question.md +429 -0
  352. package/dist/docs/components/attachment-gallery.md +377 -0
  353. package/dist/docs/components/avatar.md +197 -0
  354. package/dist/docs/components/badge.md +162 -0
  355. package/dist/docs/components/brand-tile.md +138 -0
  356. package/dist/docs/components/button.md +392 -0
  357. package/dist/docs/components/calendar.md +113 -0
  358. package/dist/docs/components/card.md +157 -0
  359. package/dist/docs/components/carousel.md +144 -0
  360. package/dist/docs/components/catalog-card.md +136 -0
  361. package/dist/docs/components/chart.md +608 -0
  362. package/dist/docs/components/checkbox.md +164 -0
  363. package/dist/docs/components/chip.md +411 -0
  364. package/dist/docs/components/code-block.md +389 -0
  365. package/dist/docs/components/collapsible.md +93 -0
  366. package/dist/docs/components/command.md +276 -0
  367. package/dist/docs/components/composer.md +1092 -0
  368. package/dist/docs/components/connector-request.md +497 -0
  369. package/dist/docs/components/context-menu.md +127 -0
  370. package/dist/docs/components/data-table.md +462 -0
  371. package/dist/docs/components/date-range-picker.md +425 -0
  372. package/dist/docs/components/dialog.md +263 -0
  373. package/dist/docs/components/drawer.md +505 -0
  374. package/dist/docs/components/dropdown-menu.md +336 -0
  375. package/dist/docs/components/editor-tabs.md +283 -0
  376. package/dist/docs/components/empty-state.md +134 -0
  377. package/dist/docs/components/entity-card.md +640 -0
  378. package/dist/docs/components/entity-row.md +291 -0
  379. package/dist/docs/components/env-var-request.md +223 -0
  380. package/dist/docs/components/field.md +272 -0
  381. package/dist/docs/components/file-upload.md +255 -0
  382. package/dist/docs/components/hover-card.md +335 -0
  383. package/dist/docs/components/input-group.md +134 -0
  384. package/dist/docs/components/input.md +97 -0
  385. package/dist/docs/components/island.md +97 -0
  386. package/dist/docs/components/kbd.md +91 -0
  387. package/dist/docs/components/markdown.md +180 -0
  388. package/dist/docs/components/message.md +336 -0
  389. package/dist/docs/components/page-header.md +203 -0
  390. package/dist/docs/components/pagination.md +211 -0
  391. package/dist/docs/components/password-input.md +68 -0
  392. package/dist/docs/components/pepper.md +238 -0
  393. package/dist/docs/components/permission-request.md +265 -0
  394. package/dist/docs/components/popover.md +206 -0
  395. package/dist/docs/components/progress.md +142 -0
  396. package/dist/docs/components/progressive-blur.md +195 -0
  397. package/dist/docs/components/radio-group.md +129 -0
  398. package/dist/docs/components/request-card.md +305 -0
  399. package/dist/docs/components/resizable.md +318 -0
  400. package/dist/docs/components/responsive-overlay.md +449 -0
  401. package/dist/docs/components/scroll-shadows.md +161 -0
  402. package/dist/docs/components/search-field.md +86 -0
  403. package/dist/docs/components/searchable-select.md +144 -0
  404. package/dist/docs/components/select.md +331 -0
  405. package/dist/docs/components/separator.md +80 -0
  406. package/dist/docs/components/settings-section.md +246 -0
  407. package/dist/docs/components/sidebar-item.md +307 -0
  408. package/dist/docs/components/skeleton.md +107 -0
  409. package/dist/docs/components/slider.md +171 -0
  410. package/dist/docs/components/sonner.md +122 -0
  411. package/dist/docs/components/spinner.md +112 -0
  412. package/dist/docs/components/stat-strip.md +85 -0
  413. package/dist/docs/components/status-dot.md +190 -0
  414. package/dist/docs/components/subagent-run.md +196 -0
  415. package/dist/docs/components/switch.md +91 -0
  416. package/dist/docs/components/system-notice.md +144 -0
  417. package/dist/docs/components/table.md +201 -0
  418. package/dist/docs/components/tabs.md +233 -0
  419. package/dist/docs/components/textarea.md +89 -0
  420. package/dist/docs/components/thinking-indicator.md +164 -0
  421. package/dist/docs/components/thread-status.md +143 -0
  422. package/dist/docs/components/todo-list.md +225 -0
  423. package/dist/docs/components/toggle-group.md +117 -0
  424. package/dist/docs/components/toggle.md +132 -0
  425. package/dist/docs/components/tool-call.md +237 -0
  426. package/dist/docs/components/tool-result.md +418 -0
  427. package/dist/docs/components/tooltip.md +136 -0
  428. package/dist/docs/components/trace.md +319 -0
  429. package/dist/docs/components/turn-summary.md +218 -0
  430. package/dist/docs/components/usage-meter.md +69 -0
  431. package/dist/docs/components/view-switcher.md +193 -0
  432. package/dist/docs/foundations/colors.md +83 -0
  433. package/dist/docs/foundations/elevation.md +19 -0
  434. package/dist/docs/foundations/iconography.md +34 -0
  435. package/dist/docs/foundations/layout.md +42 -0
  436. package/dist/docs/foundations/logo.md +111 -0
  437. package/dist/docs/foundations/motion.md +91 -0
  438. package/dist/docs/foundations/radius.md +13 -0
  439. package/dist/docs/foundations/spacing.md +23 -0
  440. package/dist/docs/foundations/typography.md +42 -0
  441. package/dist/docs/getting-started/installation.md +116 -0
  442. package/dist/docs/getting-started/releases.md +59 -0
  443. package/dist/docs/getting-started/theming.md +58 -0
  444. package/dist/docs/guidelines/accessibility.md +28 -0
  445. package/dist/docs/guidelines/content.md +36 -0
  446. package/dist/docs/guidelines/forms.md +36 -0
  447. package/dist/docs/guidelines/principles.md +30 -0
  448. package/dist/docs/hooks/use-is-mobile.md +134 -0
  449. package/dist/docs/index.md +182 -0
  450. package/dist/docs/overview.md +35 -0
  451. package/dist/docs/patterns/chat.md +477 -0
  452. package/dist/docs/patterns/index.md +13 -0
  453. package/dist/docs/patterns/login.md +311 -0
  454. package/dist/docs/patterns/share.md +415 -0
  455. package/dist/hooks/use-is-mobile.d.ts +9 -0
  456. package/dist/hooks/use-is-mobile.d.ts.map +1 -0
  457. package/dist/hooks/use-is-mobile.js +26 -0
  458. package/dist/hooks/use-is-mobile.js.map +1 -0
  459. package/dist/lib/cn.d.ts +4 -0
  460. package/dist/lib/cn.d.ts.map +1 -0
  461. package/dist/lib/cn.js +31 -0
  462. package/dist/lib/cn.js.map +1 -0
  463. package/dist/lib/code-language.d.ts +8 -0
  464. package/dist/lib/code-language.d.ts.map +1 -0
  465. package/dist/lib/code-language.js +48 -0
  466. package/dist/lib/code-language.js.map +1 -0
  467. package/dist/lib/date-range.d.ts +122 -0
  468. package/dist/lib/date-range.d.ts.map +1 -0
  469. package/dist/lib/date-range.js +281 -0
  470. package/dist/lib/date-range.js.map +1 -0
  471. package/dist/lib/major-tokens.d.ts +40 -0
  472. package/dist/lib/major-tokens.d.ts.map +1 -0
  473. package/dist/lib/major-tokens.js +602 -0
  474. package/dist/lib/major-tokens.js.map +1 -0
  475. package/dist/lib/markdown.d.ts +25 -0
  476. package/dist/lib/markdown.d.ts.map +1 -0
  477. package/dist/lib/markdown.js +87 -0
  478. package/dist/lib/markdown.js.map +1 -0
  479. package/dist/lib/overlay-portal-branch.d.ts +6 -0
  480. package/dist/lib/overlay-portal-branch.d.ts.map +1 -0
  481. package/dist/lib/overlay-portal-branch.js +15 -0
  482. package/dist/lib/overlay-portal-branch.js.map +1 -0
  483. package/dist/lib/pepper-matcap.d.ts +2 -0
  484. package/dist/lib/pepper-matcap.d.ts.map +1 -0
  485. package/dist/lib/pepper-matcap.js +4 -0
  486. package/dist/lib/pepper-matcap.js.map +1 -0
  487. package/dist/lib/scroll-fade.d.ts +28 -0
  488. package/dist/lib/scroll-fade.d.ts.map +1 -0
  489. package/dist/lib/scroll-fade.js +57 -0
  490. package/dist/lib/scroll-fade.js.map +1 -0
  491. package/dist/tailwind.css +7 -0
  492. package/dist/theme.css +428 -0
  493. package/package.json +145 -3
  494. package/tokens.json +841 -0
  495. package/README.md +0 -3
@@ -0,0 +1,608 @@
1
+ ---
2
+ name: Chart
3
+ slug: chart
4
+ description: "Every chart, on Recharts: bars by day (stacked or not), lines, areas and parts of a whole, in the series colours, with one tooltip and one legend."
5
+ group: Data
6
+ layer: primitive
7
+ status: beta
8
+ since: 0.4.0
9
+ import: import { ChartContainer, ChartGrid, ChartXAxis, ChartYAxis, ChartBar, ChartBarStack, ChartLine, ChartArea, ChartPie, ChartTooltip, ChartTooltipContent, ChartTooltipPanel, ChartTooltipTitle, ChartTooltipRow, ChartLegend, CHART_COLORS, CHART_MUTED_COLOR, CHART_REFERENCE_COLOR, CHART_SWATCHES, getChartColor } from "@major-tech/ui/chart";
10
+ requires: recharts
11
+ source: packages/ui/src/components/chart.tsx
12
+ ---
13
+
14
+ # Chart
15
+
16
+ > **Install `recharts` too.** Chart doesn't work without it, and the package doesn't install it for you: `pnpm add recharts` (3.6 or later).
17
+
18
+ ## Usage
19
+
20
+ Every chart in Major is a [Recharts](https://recharts.org) chart built from these parts: ChartContainer around one Recharts chart (`BarChart`, `LineChart`, `ComposedChart`, `PieChart`), and inside it ChartGrid, the axes, ChartTooltip and the series. The parts carry the system's look, so a chart only says what it shows.
21
+
22
+ ### Stacked by what it's made of
23
+
24
+ Spend by model, compute and browser; usage by activity. The config lists the series bottom to top, and they take chart-1, chart-2 and chart-3 in that order. ChartBarStack stacks the ChartBars inside it: 2px between parts, the top of the column rounded once, a part that is zero that day left out.
25
+
26
+ Example: `stacked`
27
+
28
+ ```tsx
29
+ "use client";
30
+
31
+ import { Card, CardAction, CardHeader, CardTitle } from "@major-tech/ui/card";
32
+ import {
33
+ ChartBar,
34
+ ChartBarStack,
35
+ ChartContainer,
36
+ ChartGrid,
37
+ ChartLegend,
38
+ ChartTooltip,
39
+ ChartTooltipContent,
40
+ ChartXAxis,
41
+ ChartYAxis,
42
+ type ChartConfig,
43
+ } from "@major-tech/ui/chart";
44
+ import { BarChart } from "recharts";
45
+
46
+ // The series bottom to top: they take chart-1, chart-2 and chart-3 in this order.
47
+ const SPEND_CONFIG = {
48
+ model: { label: "Model" },
49
+ compute: { label: "Compute" },
50
+ browser: { label: "Browser" },
51
+ } satisfies ChartConfig;
52
+
53
+ const SPEND = [
54
+ { day: "Oct 1", model: 1.2, compute: 0.4, browser: 0 },
55
+ { day: "Oct 2", model: 1.62, compute: 0.55, browser: 0.3 },
56
+ { day: "Oct 3", model: 1.95, compute: 0.7, browser: 0.2 },
57
+ { day: "Oct 4", model: 2.0, compute: 0.4, browser: 0.3 },
58
+ { day: "Oct 5", model: 1.69, compute: 0.55, browser: 0 },
59
+ { day: "Oct 6", model: 1.48, compute: 0.7, browser: 0.3 },
60
+ { day: "Oct 7", model: 1.02, compute: 0.4, browser: 0.2 },
61
+ { day: "Oct 8", model: 0.65, compute: 0.55, browser: 0.3 },
62
+ { day: "Oct 9", model: 0.5, compute: 0.7, browser: 0 },
63
+ { day: "Oct 10", model: 0.79, compute: 0.4, browser: 0.3 },
64
+ { day: "Oct 11", model: 1.32, compute: 0.55, browser: 0.2 },
65
+ { day: "Oct 12", model: 1.78, compute: 0.7, browser: 0.3 },
66
+ { day: "Oct 13", model: 2.08, compute: 0.4, browser: 0 },
67
+ { day: "Oct 14", model: 2.12, compute: 0.55, browser: 0.3 },
68
+ ];
69
+
70
+ const formatUsd = (value: number) => `$${value.toFixed(2)}`;
71
+
72
+ export default function ChartStacked() {
73
+ return (
74
+ <Card className="w-full gap-space-16 p-4.5">
75
+ <CardHeader>
76
+ <CardTitle>Spend per day</CardTitle>
77
+ <CardAction>
78
+ <ChartLegend config={SPEND_CONFIG} />
79
+ </CardAction>
80
+ </CardHeader>
81
+ <ChartContainer config={SPEND_CONFIG} className="h-55">
82
+ <BarChart data={SPEND}>
83
+ <ChartGrid />
84
+ <ChartXAxis dataKey="day" />
85
+ <ChartYAxis tickFormatter={formatUsd} />
86
+ <ChartTooltip content={<ChartTooltipContent valueFormatter={formatUsd} hasTotal isZeroHidden />} />
87
+ <ChartBarStack>
88
+ {Object.keys(SPEND_CONFIG).map((key) => (
89
+ <ChartBar key={key} dataKey={key} />
90
+ ))}
91
+ </ChartBarStack>
92
+ </BarChart>
93
+ </ChartContainer>
94
+ </Card>
95
+ );
96
+ }
97
+ ```
98
+
99
+ - Put the chart in a Card under its title, the legend beside the title (CardAction). The chart itself has no frame.
100
+ - `hasTotal` adds the day's total to the tooltip; `isZeroHidden` leaves out the series that day didn't have.
101
+ - Format values for people: `valueFormatter` and the Y axis' `tickFormatter` read $0.25, 1.2K, 340 ms.
102
+
103
+ ### Picking a series
104
+
105
+ With `onSelect`, the legend's names are buttons: the picked series is the only one drawn, and pressing it again brings the others back. A rollup that isn't one thing ("Other") can't be picked.
106
+
107
+ Example: `pick-a-series`
108
+
109
+ ```tsx
110
+ "use client";
111
+
112
+ import { useState } from "react";
113
+ import { Card, CardAction, CardHeader, CardTitle } from "@major-tech/ui/card";
114
+ import {
115
+ CHART_MUTED_COLOR,
116
+ ChartBar,
117
+ ChartBarStack,
118
+ ChartContainer,
119
+ ChartGrid,
120
+ ChartLegend,
121
+ ChartTooltip,
122
+ ChartTooltipContent,
123
+ ChartXAxis,
124
+ ChartYAxis,
125
+ type ChartConfig,
126
+ } from "@major-tech/ui/chart";
127
+ import { BarChart } from "recharts";
128
+
129
+ // "Other" rolls up the rest, so it can't be picked on its own.
130
+ const USAGE_CONFIG = {
131
+ chat: { label: "Chat" },
132
+ building: { label: "Building" },
133
+ running: { label: "Running apps" },
134
+ other: { label: "Other", color: CHART_MUTED_COLOR },
135
+ } satisfies ChartConfig;
136
+
137
+ const OTHER_KEY = "other";
138
+
139
+ const USAGE = [
140
+ { day: "1", chat: 0.82, building: 1.4, running: 0.3, other: 0.1 },
141
+ { day: "2", chat: 0.64, building: 2.1, running: 0.35, other: 0.05 },
142
+ { day: "3", chat: 1.1, building: 1.8, running: 0.42, other: 0.12 },
143
+ { day: "4", chat: 0.4, building: 0.9, running: 0.4, other: 0 },
144
+ { day: "5", chat: 0.95, building: 2.4, running: 0.38, other: 0.08 },
145
+ { day: "6", chat: 1.3, building: 1.2, running: 0.41, other: 0.1 },
146
+ { day: "7", chat: 0.7, building: 0.6, running: 0.44, other: 0.04 },
147
+ { day: "8", chat: 1.05, building: 1.9, running: 0.46, other: 0.09 },
148
+ { day: "9", chat: 0.88, building: 2.6, running: 0.5, other: 0.11 },
149
+ { day: "10", chat: 1.22, building: 1.5, running: 0.48, other: 0.07 },
150
+ ];
151
+
152
+ const formatUsd = (value: number) => `$${value.toFixed(2)}`;
153
+
154
+ export default function ChartPickASeries() {
155
+ const [picked, setPicked] = useState<string | null>(null);
156
+ const keys = Object.keys(USAGE_CONFIG);
157
+ const drawnKeys = picked ? [picked] : keys;
158
+
159
+ return (
160
+ <Card className="w-full gap-space-16 p-4.5">
161
+ <CardHeader>
162
+ <CardTitle>Daily usage</CardTitle>
163
+ <CardAction>
164
+ <ChartLegend config={USAGE_CONFIG} selected={picked} onSelect={setPicked} disabledKeys={[OTHER_KEY]} />
165
+ </CardAction>
166
+ </CardHeader>
167
+ <ChartContainer config={USAGE_CONFIG} className="h-55">
168
+ <BarChart data={USAGE}>
169
+ <ChartGrid />
170
+ <ChartXAxis dataKey="day" />
171
+ <ChartYAxis tickFormatter={formatUsd} />
172
+ <ChartTooltip content={<ChartTooltipContent valueFormatter={formatUsd} hasTotal isZeroHidden />} />
173
+ <ChartBarStack>
174
+ {drawnKeys.map((key) => (
175
+ <ChartBar key={key} dataKey={key} />
176
+ ))}
177
+ </ChartBarStack>
178
+ </BarChart>
179
+ </ChartContainer>
180
+ </Card>
181
+ );
182
+ }
183
+ ```
184
+
185
+ - The chart draws only the picked key; the product decides whether the numbers around it (a StatStrip, a table) follow.
186
+
187
+ ### Against the previous period
188
+
189
+ This period as bars, the previous one as an area behind them in CHART_MUTED_COLOR: a backdrop the eye reads the bars against. Two sets of bars side by side at one day's width become unreadable in a 31-day month.
190
+
191
+ Example: `compared`
192
+
193
+ ```tsx
194
+ "use client";
195
+
196
+ import {
197
+ CHART_MUTED_COLOR,
198
+ CHART_SWATCHES,
199
+ ChartArea,
200
+ ChartBar,
201
+ ChartContainer,
202
+ ChartGrid,
203
+ ChartLegend,
204
+ ChartTooltip,
205
+ ChartTooltipPanel,
206
+ ChartTooltipRow,
207
+ ChartTooltipTitle,
208
+ ChartXAxis,
209
+ ChartYAxis,
210
+ getChartColor,
211
+ type ChartConfig,
212
+ } from "@major-tech/ui/chart";
213
+ import { ComposedChart } from "recharts";
214
+
215
+ const VISITS_CONFIG = {
216
+ visitors: { label: "Visitors" },
217
+ previous: { label: "Previous period", color: CHART_MUTED_COLOR, swatch: CHART_SWATCHES.LINE },
218
+ } satisfies ChartConfig;
219
+
220
+ interface VisitDay {
221
+ day: string;
222
+ previousDay: string;
223
+ visitors: number;
224
+ previous: number;
225
+ }
226
+
227
+ const VISITS: VisitDay[] = [
228
+ { day: "Nov 1", previousDay: "Oct 1", visitors: 42, previous: 30 },
229
+ { day: "Nov 2", previousDay: "Oct 2", visitors: 51, previous: 34 },
230
+ { day: "Nov 3", previousDay: "Oct 3", visitors: 38, previous: 41 },
231
+ { day: "Nov 4", previousDay: "Oct 4", visitors: 60, previous: 39 },
232
+ { day: "Nov 5", previousDay: "Oct 5", visitors: 72, previous: 45 },
233
+ { day: "Nov 6", previousDay: "Oct 6", visitors: 66, previous: 52 },
234
+ { day: "Nov 7", previousDay: "Oct 7", visitors: 31, previous: 28 },
235
+ { day: "Nov 8", previousDay: "Oct 8", visitors: 28, previous: 25 },
236
+ { day: "Nov 9", previousDay: "Oct 9", visitors: 58, previous: 47 },
237
+ { day: "Nov 10", previousDay: "Oct 10", visitors: 64, previous: 50 },
238
+ { day: "Nov 11", previousDay: "Oct 11", visitors: 70, previous: 56 },
239
+ { day: "Nov 12", previousDay: "Oct 12", visitors: 77, previous: 54 },
240
+ ];
241
+
242
+ interface VisitTooltipProps {
243
+ active?: boolean;
244
+ payload?: ReadonlyArray<{ payload: VisitDay }>;
245
+ }
246
+
247
+ /** Each value under the day it is from: a month of 31 days against one of 30 shifts the pairing. */
248
+ function VisitTooltip({ active, payload }: VisitTooltipProps) {
249
+ const row = payload?.[0]?.payload;
250
+
251
+ if (!active || !row) {
252
+ return null;
253
+ }
254
+
255
+ return (
256
+ <ChartTooltipPanel>
257
+ <ChartTooltipTitle>{row.day}</ChartTooltipTitle>
258
+ <ChartTooltipRow color={getChartColor(VISITS_CONFIG, "visitors")} label="Visitors" value={row.visitors} />
259
+ <ChartTooltipRow
260
+ color={CHART_MUTED_COLOR}
261
+ swatch={CHART_SWATCHES.LINE}
262
+ label={row.previousDay}
263
+ value={row.previous}
264
+ />
265
+ </ChartTooltipPanel>
266
+ );
267
+ }
268
+
269
+ export default function ChartCompared() {
270
+ return (
271
+ <div className="flex w-full flex-col gap-space-16">
272
+ <header className="flex flex-wrap items-end justify-between gap-space-12">
273
+ <h3 className="m-0 text-ui font-semibold text-ink">Visitors per day</h3>
274
+ <ChartLegend config={VISITS_CONFIG} />
275
+ </header>
276
+ <ChartContainer config={VISITS_CONFIG} className="h-60">
277
+ <ComposedChart data={VISITS}>
278
+ <ChartGrid />
279
+ <ChartXAxis dataKey="day" />
280
+ <ChartYAxis allowDecimals={false} />
281
+ <ChartTooltip content={<VisitTooltip />} />
282
+ <ChartArea dataKey="previous" />
283
+ <ChartBar dataKey="visitors" />
284
+ </ComposedChart>
285
+ </ChartContainer>
286
+ </div>
287
+ );
288
+ }
289
+ ```
290
+
291
+ - A custom tooltip is built from ChartTooltipPanel, ChartTooltipTitle and ChartTooltipRow: here each value sits under the day it is from.
292
+ - One metric at a time: two units on two axes invite reading a crossing point as meaning something.
293
+
294
+ ### Against a limit
295
+
296
+ A value over time as an area, and the limit it's held to as a dashed line in CHART_REFERENCE_COLOR, stepped (`type="stepAfter"`): a limit holds until the moment it changes.
297
+
298
+ Example: `against-a-limit`
299
+
300
+ ```tsx
301
+ "use client";
302
+
303
+ import {
304
+ CHART_COLORS,
305
+ CHART_REFERENCE_COLOR,
306
+ CHART_SWATCHES,
307
+ ChartArea,
308
+ ChartContainer,
309
+ ChartGrid,
310
+ ChartLegend,
311
+ ChartLine,
312
+ ChartTooltip,
313
+ ChartTooltipContent,
314
+ ChartXAxis,
315
+ ChartYAxis,
316
+ type ChartConfig,
317
+ } from "@major-tech/ui/chart";
318
+ import { ComposedChart } from "recharts";
319
+
320
+ const MEMORY_CONFIG = {
321
+ usage: { label: "Memory", color: CHART_COLORS[1] },
322
+ limit: { label: "Limit", color: CHART_REFERENCE_COLOR, swatch: CHART_SWATCHES.DASHED },
323
+ } satisfies ChartConfig;
324
+
325
+ // The limit was raised at 10:30: it holds until the moment it changes.
326
+ const MEMORY = [
327
+ { time: "10:00", usage: 310, limit: 512 },
328
+ { time: "10:05", usage: 342, limit: 512 },
329
+ { time: "10:10", usage: 398, limit: 512 },
330
+ { time: "10:15", usage: 455, limit: 512 },
331
+ { time: "10:20", usage: 488, limit: 512 },
332
+ { time: "10:25", usage: 501, limit: 512 },
333
+ { time: "10:30", usage: 520, limit: 1024 },
334
+ { time: "10:35", usage: 610, limit: 1024 },
335
+ { time: "10:40", usage: 574, limit: 1024 },
336
+ { time: "10:45", usage: 530, limit: 1024 },
337
+ { time: "10:50", usage: 498, limit: 1024 },
338
+ { time: "10:55", usage: 512, limit: 1024 },
339
+ ];
340
+
341
+ const formatMb = (value: number) => `${value} MB`;
342
+
343
+ export default function ChartAgainstALimit() {
344
+ return (
345
+ <div className="flex w-full flex-col gap-space-12">
346
+ <header className="flex flex-wrap items-end justify-between gap-space-12">
347
+ <h4 className="m-0 text-small font-semibold text-ink-2">Memory</h4>
348
+ <ChartLegend config={MEMORY_CONFIG} />
349
+ </header>
350
+ <ChartContainer config={MEMORY_CONFIG}>
351
+ <ComposedChart data={MEMORY}>
352
+ <ChartGrid />
353
+ <ChartXAxis dataKey="time" minTickGap={32} />
354
+ <ChartYAxis domain={[0, "auto"]} tickFormatter={formatMb} />
355
+ <ChartTooltip content={<ChartTooltipContent valueFormatter={formatMb} />} />
356
+ {/* No animation: the series refreshes every minute, and a redraw that moves distracts. */}
357
+ <ChartArea dataKey="usage" isAnimationActive={false} />
358
+ <ChartLine dataKey="limit" type="stepAfter" strokeDasharray="4 4" isAnimationActive={false} />
359
+ </ComposedChart>
360
+ </ChartContainer>
361
+ </div>
362
+ );
363
+ }
364
+ ```
365
+
366
+ - A series that refreshes on its own (every minute) draws without animation, `isAnimationActive={false}`: a redraw that moves is a distraction.
367
+
368
+ ### A trend
369
+
370
+ Lines for values that move continuously: latency, a rate. No dots; the hovered point gets one.
371
+
372
+ Example: `trend`
373
+
374
+ ```tsx
375
+ "use client";
376
+
377
+ import {
378
+ CHART_SWATCHES,
379
+ ChartContainer,
380
+ ChartGrid,
381
+ ChartLegend,
382
+ ChartLine,
383
+ ChartTooltip,
384
+ ChartTooltipContent,
385
+ ChartXAxis,
386
+ ChartYAxis,
387
+ type ChartConfig,
388
+ } from "@major-tech/ui/chart";
389
+ import { LineChart } from "recharts";
390
+
391
+ const LATENCY_CONFIG = {
392
+ query: { label: "orders.list", swatch: CHART_SWATCHES.LINE },
393
+ upload: { label: "files.upload", swatch: CHART_SWATCHES.LINE },
394
+ } satisfies ChartConfig;
395
+
396
+ const LATENCY = [
397
+ { hour: "08:00", query: 180, upload: 420 },
398
+ { hour: "09:00", query: 210, upload: 460 },
399
+ { hour: "10:00", query: 340, upload: 510 },
400
+ { hour: "11:00", query: 290, upload: 480 },
401
+ { hour: "12:00", query: 260, upload: 620 },
402
+ { hour: "13:00", query: 230, upload: 590 },
403
+ { hour: "14:00", query: 380, upload: 540 },
404
+ { hour: "15:00", query: 310, upload: 500 },
405
+ ];
406
+
407
+ const formatMs = (value: number) => `${value} ms`;
408
+
409
+ export default function ChartTrend() {
410
+ return (
411
+ <div className="flex w-full flex-col gap-space-12">
412
+ <ChartLegend config={LATENCY_CONFIG} className="self-end" />
413
+ <ChartContainer config={LATENCY_CONFIG}>
414
+ <LineChart data={LATENCY}>
415
+ <ChartGrid />
416
+ <ChartXAxis dataKey="hour" />
417
+ <ChartYAxis tickFormatter={formatMs} />
418
+ <ChartTooltip content={<ChartTooltipContent valueFormatter={formatMs} />} />
419
+ <ChartLine dataKey="query" />
420
+ <ChartLine dataKey="upload" />
421
+ </LineChart>
422
+ </ChartContainer>
423
+ </div>
424
+ );
425
+ }
426
+ ```
427
+
428
+ ### Parts of a whole
429
+
430
+ A donut for a few parts of one total. The config is keyed by each slice's name.
431
+
432
+ Example: `parts-of-a-whole`
433
+
434
+ ```tsx
435
+ "use client";
436
+
437
+ import { ChartContainer, ChartLegend, ChartPie, ChartTooltip, type ChartConfig } from "@major-tech/ui/chart";
438
+ import { PieChart } from "recharts";
439
+
440
+ // Keyed by the slice's name: each slice takes its colour from here, in order.
441
+ const TRIGGER_CONFIG = {
442
+ Schedule: { label: "Schedule" },
443
+ Webhook: { label: "Webhook" },
444
+ Manual: { label: "Manual" },
445
+ } satisfies ChartConfig;
446
+
447
+ const RUNS = [
448
+ { trigger: "Schedule", runs: 412 },
449
+ { trigger: "Webhook", runs: 268 },
450
+ { trigger: "Manual", runs: 97 },
451
+ ];
452
+
453
+ export default function ChartPartsOfAWhole() {
454
+ return (
455
+ <div className="flex w-full flex-col items-center gap-space-12">
456
+ <ChartContainer config={TRIGGER_CONFIG} className="h-48">
457
+ <PieChart>
458
+ <ChartTooltip />
459
+ <ChartPie data={RUNS} dataKey="runs" nameKey="trigger" innerRadius="55%" />
460
+ </PieChart>
461
+ </ChartContainer>
462
+ <ChartLegend config={TRIGGER_CONFIG} />
463
+ </div>
464
+ );
465
+ }
466
+ ```
467
+
468
+ - Up to five parts; more read better as bars.
469
+
470
+ ### Colours
471
+
472
+ Series take CHART_COLORS in order: chart-1, chart-2, chart-3, then the same three at 45% on the surface for a fourth to sixth. A rollup ("Other") and the previous period take CHART_MUTED_COLOR; a limit or target, CHART_REFERENCE_COLOR. A series sets its own with `color` in the config, from these constants only.
473
+
474
+ ### Guidelines
475
+
476
+ Do:
477
+
478
+ - One chart, one question: spend per day, memory against its limit.
479
+ - The legend above the plot on the right, or beside the chart's title.
480
+ - Say the period's total in text next to the chart (a StatStrip, the title): the values are otherwise only in the tooltip.
481
+
482
+ Don't:
483
+
484
+ - Status or tool colours (ok, warn, danger, object-*) for series: every chart reads the same.
485
+ - Recharts' own `Bar`, `Line`, `XAxis` or `Tooltip` beside these parts: they draw in Recharts' colours, not the system's.
486
+ - More than six series.
487
+
488
+ ## API
489
+
490
+ ```bash
491
+ yarn add recharts
492
+ # or: pnpm add recharts
493
+ ```
494
+
495
+ ```tsx
496
+ import { ChartContainer, ChartGrid, ChartXAxis, ChartYAxis, ChartBar, ChartBarStack, ChartLine, ChartArea, ChartPie, ChartTooltip, ChartTooltipContent, ChartTooltipPanel, ChartTooltipTitle, ChartTooltipRow, ChartLegend, CHART_COLORS, CHART_MUTED_COLOR, CHART_REFERENCE_COLOR, CHART_SWATCHES, getChartColor } from "@major-tech/ui/chart";
497
+ ```
498
+
499
+ ### `<ChartContainer />`
500
+
501
+ A `<div>` 200px tall and as wide as its parent, around Recharts' ResponsiveContainer.
502
+
503
+ | Prop | Type | Default | Description |
504
+ | --- | --- | --- | --- |
505
+ | `config`* | `ChartConfig` | — | The series by data key: `{ model: { label: "Model", color?, swatch? } }`, in stacking order. |
506
+ | `children`* | `ReactElement` | — | One Recharts chart. |
507
+ | `className` | `string` | — | Its height: `h-55`, `h-65`. |
508
+
509
+ `*` marks a required prop.
510
+
511
+ ### `ChartConfig`
512
+
513
+ | Field | Type | Default | Description |
514
+ | --- | --- | --- | --- |
515
+ | `label`* | `ReactNode` | — | The series' name in the legend and the tooltip. |
516
+ | `color` | `string` | the next of CHART_COLORS | One of CHART_COLORS, CHART_MUTED_COLOR, CHART_REFERENCE_COLOR. |
517
+ | `swatch` | `"square" \| "line" \| "dashed"` | `"square"` | How the legend and tooltip draw it (CHART_SWATCHES): like its mark. |
518
+
519
+ `*` marks a required prop.
520
+
521
+ ### `<ChartGrid />`, `<ChartXAxis />`, `<ChartYAxis />`
522
+
523
+ Recharts' CartesianGrid, XAxis and YAxis with the system's defaults; their props pass through.
524
+
525
+ | Part | Defaults |
526
+ | --- | --- |
527
+ | ChartGrid | Horizontal lines only, in `line`. |
528
+ | ChartXAxis | No ticks or axis line, labels 8px under the plot in 12px `muted`, crowded labels dropped (`minTickGap` 16). |
529
+ | ChartYAxis | No ticks or axis line, as wide as its longest label (`width="auto"`). |
530
+
531
+ ### `<ChartBar />`, `<ChartBarStack />`
532
+
533
+ Recharts' Bar and BarStack; their props pass through.
534
+
535
+ | Prop | Type | Default | Description |
536
+ | --- | --- | --- | --- |
537
+ | `dataKey`* | `string` | — | The series, as in the config: it takes the config's colour. |
538
+ | `isAnimationActive` | `boolean` | `true` | The bars grow in over 450ms; off with reduced motion. |
539
+
540
+ `*` marks a required prop.
541
+
542
+ A bar is rounded 3px on top, at most 32px wide, and a value is never drawn thinner than 2px. Inside ChartBarStack, parts sit 2px apart and only the top of the column is rounded.
543
+
544
+ ### `<ChartLine />`, `<ChartArea />`
545
+
546
+ Recharts' Line and Area; their props pass through (`type`, `strokeDasharray`, `connectNulls`).
547
+
548
+ | Prop | Type | Default | Description |
549
+ | --- | --- | --- | --- |
550
+ | `dataKey`* | `string` | — | The series, as in the config. |
551
+ | `type` | `string` | `"monotone"` | `"stepAfter"` for a limit. |
552
+ | `isAnimationActive` | `boolean` | `true` | Off for a series that refreshes on its own, and with reduced motion. |
553
+
554
+ `*` marks a required prop.
555
+
556
+ Both draw a 2px line without dots; an area fills from 30% of its colour at the line to nothing at the axis.
557
+
558
+ ### `<ChartPie />`
559
+
560
+ Recharts' Pie: a slice per row in the series colours, 2px of surface between slices. `innerRadius="55%"` for a donut.
561
+
562
+ ### `<ChartTooltip />`, `<ChartTooltipContent />`
563
+
564
+ ChartTooltip is Recharts' Tooltip showing ChartTooltipContent; pass `content` for your own.
565
+
566
+ | Prop | Type | Default | Description |
567
+ | --- | --- | --- | --- |
568
+ | `labelFormatter` | `(label, payload) => ReactNode` | — | The title from the point's x value. |
569
+ | `valueFormatter` | `(value: number, key: string) => ReactNode` | thousands separators | A value as it reads: "$0.25". |
570
+ | `hasTotal` | `boolean` | `false` | A Total row under the series. |
571
+ | `isZeroHidden` | `boolean` | `false` | Leaves out series that are zero at this point. |
572
+
573
+ ### `<ChartTooltipPanel />`, `<ChartTooltipTitle />`, `<ChartTooltipRow />`
574
+
575
+ The parts of a custom tooltip: the surface card, the point's title, and a row.
576
+
577
+ | Prop | Type | Default | Description |
578
+ | --- | --- | --- | --- |
579
+ | `label`* | `ReactNode` | — | ChartTooltipRow: the series' name. |
580
+ | `value`* | `ReactNode` | — | ChartTooltipRow: the value, right-aligned in tabular figures. |
581
+ | `color` | `string` | — | ChartTooltipRow: the swatch; a row without one has none. |
582
+ | `swatch` | `"square" \| "line" \| "dashed"` | `"square"` | ChartTooltipRow: its shape. |
583
+ | `isTotal` | `boolean` | `false` | ChartTooltipRow: a sum under the rows, set off by a rule. |
584
+
585
+ `*` marks a required prop.
586
+
587
+ ### `<ChartLegend />`
588
+
589
+ | Prop | Type | Default | Description |
590
+ | --- | --- | --- | --- |
591
+ | `config`* | `ChartConfig` | — | The same config as the chart's. |
592
+ | `keys` | `string[]` | every series | Which series, in order. |
593
+ | `selected` | `string \| null` | `null` | The picked series. |
594
+ | `onSelect` | `(key: string \| null) => void` | — | Makes the names buttons that pick a series. |
595
+ | `disabledKeys` | `string[]` | `[]` | Names that can't be picked. |
596
+
597
+ `*` marks a required prop.
598
+
599
+ ### `getChartColor(config, key)`
600
+
601
+ A series' colour: its own from the config, or the next of CHART_COLORS by its place in the config. For a custom tooltip's swatches.
602
+
603
+ ### Accessibility
604
+
605
+ - The values are only in the tooltip: say the period's total in text next to the chart.
606
+ - The plot takes focus from the keyboard (a ring shows it), and the arrow keys then move the tooltip from point to point.
607
+ - Picking legend names are buttons with `aria-pressed`.
608
+ - Reduced motion turns the grow-in off.