@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 @@
1
+ {"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../src/components/drawer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAuC,MAAM,OAAO,CAAC;AACv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ACL,4BACY,eAAe,EACzB,SAAS,EAAE,EAAE,CACX,kGAAkG,EAClG,wRAAwR,EACxR,SAAS,CACV,KACG,KAAK,aAER,KAAK,IAAI,CACR,2BACY,qBAAqB,EAC/B,SAAS,EAAC,gNAAgN,YAEzN,KAAK,GACF,CACP,EACA,QAAQ,IACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentProps, type ReactNode } from \"react\";\nimport { Drawer as DrawerPrimitive } from \"@base-ui/react/drawer\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"../lib/cn.ts\";\nimport { eventTargetsOverlayPortalBranch } from \"../lib/overlay-portal-branch.ts\";\nimport { BUTTON_SIZES, BUTTON_VARIANTS, Button } from \"./button.tsx\";\n\n/**\n * The edge a drawer comes from, which is also the way it swipes closed. The product picks it; the drawer never\n * switches by itself.\n */\nexport const DRAWER_SWIPE_DIRECTIONS = {\n /** A side panel: a member's details, the workflow inspector. The default. */\n RIGHT: \"right\",\n /** The phone's navigation. */\n LEFT: \"left\",\n /** Phones only: a sheet from the bottom with a handle on top, in place of a dialog or menu. */\n DOWN: \"down\",\n} as const;\n\ntype DrawerSwipeDirection = (typeof DRAWER_SWIPE_DIRECTIONS)[keyof typeof DRAWER_SWIPE_DIRECTIONS];\n\n/** The two side widths. Each is a maximum: on a narrow screen a side drawer is full width. A down drawer always is. */\nexport const DRAWER_SIZES = {\n /** 24rem: the workflow node inspector. The default. */\n SM: \"sm\",\n /** 46rem: a member's details. */\n LG: \"lg\",\n} as const;\n\ntype DrawerSize = (typeof DRAWER_SIZES)[keyof typeof DRAWER_SIZES];\n\nconst DRAWER_SIZE_CLASSES = {\n [DRAWER_SIZES.SM]: \"max-w-96\",\n [DRAWER_SIZES.LG]: \"max-w-184\",\n} satisfies Record<DrawerSize, string>;\n\ninterface DrawerContextValue {\n modal: DrawerPrimitive.Root.Props[\"modal\"];\n swipeDirection: DrawerSwipeDirection;\n}\n\nconst DrawerContext = createContext<DrawerContextValue>({ modal: true, swipeDirection: DRAWER_SWIPE_DIRECTIONS.RIGHT });\n\nexport type DrawerProps = Omit<DrawerPrimitive.Root.Props, \"swipeDirection\"> & {\n /** `right` (default), `left` or `down`. */\n swipeDirection?: DrawerSwipeDirection;\n};\n\n/**\n * Root. Controlled with `open` / `onOpenChange`, or uncontrolled with a `DrawerTrigger`. Modal by default: the page\n * dims and an outside click closes it. `modal={false}` floats it as a card over a page that stays usable: an outside\n * click doesn't close it (`disablePointerDismissal` defaults to true) and opening it doesn't move focus. A Drawer\n * inside another's content nests over it, and the page dims once; a down drawer behind it steps back. A click inside\n * an element marked `data-overlay-portal-branch` doesn't close it.\n */\nexport function Drawer({\n swipeDirection = DRAWER_SWIPE_DIRECTIONS.RIGHT,\n modal = true,\n disablePointerDismissal = modal === false,\n onOpenChange,\n ...props\n}: DrawerProps) {\n const handleOpenChange: DrawerPrimitive.Root.Props[\"onOpenChange\"] = (open, eventDetails) => {\n const isOutsideReason = eventDetails.reason === \"outside-press\" || eventDetails.reason === \"focus-out\";\n\n if (!open && isOutsideReason && eventTargetsOverlayPortalBranch(eventDetails.event)) {\n eventDetails.cancel();\n return;\n }\n\n onOpenChange?.(open, eventDetails);\n };\n\n return (\n <DrawerContext.Provider value={{ modal, swipeDirection }}>\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n swipeDirection={swipeDirection}\n modal={modal}\n disablePointerDismissal={disablePointerDismissal}\n onOpenChange={handleOpenChange}\n {...props}\n />\n </DrawerContext.Provider>\n );\n}\n\n/** Pass the opening control as `render`: `<DrawerTrigger render={<Button />}>Details</DrawerTrigger>`. */\nexport function DrawerTrigger(props: DrawerPrimitive.Trigger.Props) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />;\n}\n\nexport function DrawerPortal(props: DrawerPrimitive.Portal.Props) {\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />;\n}\n\n/** Closes the drawer: pass a footer button as `render`. */\nexport function DrawerClose(props: DrawerPrimitive.Close.Props) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />;\n}\n\n/**\n * The page dims behind a modal drawer, fading in over 200ms and out over 150ms, and lightens as the drawer is\n * swiped away. A nested drawer doesn't dim it again.\n */\nexport function DrawerOverlay({ className, ...props }: DrawerPrimitive.Backdrop.Props) {\n return (\n <DrawerPrimitive.Backdrop\n data-slot=\"drawer-overlay\"\n className={cn(\n \"fixed inset-0 z-50 min-h-dvh bg-dim opacity-[calc(1-var(--drawer-swipe-progress,0))] transition-opacity duration-200 ease-out\",\n \"data-starting-style:opacity-0 data-ending-style:opacity-0 data-ending-style:duration-[calc(var(--drawer-swipe-strength,1)*150ms)] data-ending-style:ease-in data-swiping:duration-0\",\n \"supports-[-webkit-touch-callout:none]:absolute\",\n className\n )}\n {...props}\n />\n );\n}\n\n/** The 36 × 4px grab handle on top of a down drawer, in a 12px strip a mouse can drag. DrawerContent adds it. */\nexport function DrawerSwipeHandle({ className, ...props }: ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"drawer-swipe-handle\"\n aria-hidden\n className={cn(\n \"flex h-3 shrink-0 cursor-grab items-end justify-center transition-opacity duration-200 active:cursor-grabbing after:h-1 after:w-9 after:rounded-full after:bg-line\",\n \"group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100\",\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * The sheet and its motion. It sits `--drawer-inset` from its edge (0 flush, 12px floating), slides by its own size\n * plus that inset, and follows `--drawer-swipe-movement-*` (set by Base UI) while swiped.\n */\nconst POPUP_CLASSES = [\n \"group/drawer-popup pointer-events-auto fixed z-50 m-(--drawer-inset) flex min-h-0 flex-col border-panel-edge bg-surface font-sans text-ink shadow-pop outline-none select-none\",\n \"transform-[translate3d(var(--translate-x,0px),var(--translate-y,0px),0)_scale(var(--stack-scale,1))] will-change-transform [interpolate-size:allow-keywords]\",\n \"transition-[transform,height,opacity] duration-200 ease-out\",\n \"data-starting-style:transform-(--closed-transform) data-ending-style:transform-(--closed-transform) data-ending-style:opacity-[0.9999] data-ending-style:duration-[calc(var(--drawer-swipe-strength,1)*150ms)] data-ending-style:ease-in data-ending-style:data-swipe-dismiss:ease-out\",\n \"data-swiping:duration-0 data-nested-drawer-swiping:duration-0 data-ending-style:data-swiping:duration-[calc(var(--drawer-swipe-strength,1)*150ms)] data-ending-style:data-nested-drawer-swiping:duration-[calc(var(--drawer-swipe-strength,1)*150ms)]\",\n \"[--drawer-inset:0px] [--bleed:var(--spacing-space-48)]\",\n];\n\n/**\n * A down drawer behind an open nested one steps back, as on iOS: it takes the front one's height, scales back by 5%\n * per level and peeks out 16px above it, and comes forward as the front one is swiped away. Side drawers stay put\n * (a nested side drawer covers its parent), so a bottom sheet opened from the phone's navigation doesn't move it.\n */\nconst STACK_CLASSES = [\n \"[--peek:var(--spacing-space-16)] [--stack-step:0.05] [--stack-height:var(--drawer-frontmost-height,var(--drawer-height,0px))]\",\n \"[--stack-progress:clamp(0,var(--drawer-swipe-progress,0),1)] [--stack-peek-offset:max(0px,calc((var(--nested-drawers,0)-var(--stack-progress))*var(--peek)))]\",\n \"[--stack-scale-base:max(0,calc(1-(var(--nested-drawers,0)*var(--stack-step))))] [--stack-scale:clamp(0,calc(var(--stack-scale-base)+(var(--stack-step)*var(--stack-progress))),1)]\",\n \"[--stack-shrink:calc(1-var(--stack-scale))]\",\n \"data-nested-drawer-open:h-(--stack-height) data-nested-drawer-open:overflow-hidden\",\n];\n\nconst DIRECTION_CLASSES = {\n [DRAWER_SWIPE_DIRECTIONS.RIGHT]: [\n \"inset-y-0 right-0 border-l\",\n \"[--closed-transform:translate3d(calc(100%+var(--drawer-inset)+2px),0,0)]\",\n \"[--translate-x:var(--drawer-swipe-movement-x,0px)]\",\n ],\n [DRAWER_SWIPE_DIRECTIONS.LEFT]: [\n \"inset-y-0 left-0 border-r\",\n \"[--closed-transform:translate3d(calc(-100%-var(--drawer-inset)-2px),0,0)]\",\n \"[--translate-x:var(--drawer-swipe-movement-x,0px)]\",\n ],\n [DRAWER_SWIPE_DIRECTIONS.DOWN]: [\n \"inset-x-0 bottom-0 h-[var(--drawer-height,auto)] max-h-[calc(100dvh-6rem)] origin-bottom rounded-t-xl border-t pb-[env(safe-area-inset-bottom)]\",\n STACK_CLASSES,\n \"[--closed-transform:translate3d(0,calc(100%+var(--drawer-inset)+2px),0)]\",\n \"[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height)))]\",\n ],\n} satisfies Record<DrawerSwipeDirection, (string | string[])[]>;\n\n/**\n * Flush with its edge: rounded on the inner corners (from md up; a phone's panel is square), with a strip of the\n * sheet's fill past the edge, so swiping it the wrong way never shows the page behind.\n */\nconst FLUSH_CLASSES = {\n [DRAWER_SWIPE_DIRECTIONS.RIGHT]: \"w-full md:rounded-l-xl after:inset-y-0 after:left-full after:w-(--bleed)\",\n [DRAWER_SWIPE_DIRECTIONS.LEFT]: \"w-full md:rounded-r-xl after:inset-y-0 after:right-full after:w-(--bleed)\",\n [DRAWER_SWIPE_DIRECTIONS.DOWN]: \"after:inset-x-0 after:top-full after:h-(--bleed)\",\n} satisfies Record<DrawerSwipeDirection, string>;\n\nconst BLEED_CLASSES = \"after:pointer-events-none after:absolute after:bg-inherit\";\n\n/** Non-modal: a card inset 12px from the viewport's edges, rounded all round. */\nconst FLOATING_CLASSES = \"w-[calc(100%-2*var(--drawer-inset))] rounded-xl border [--drawer-inset:var(--spacing-space-12)]\";\n\ntype DrawerContentProps = DrawerPrimitive.Popup.Props & {\n /** A side drawer's maximum width: 24rem (`sm`, default) or 46rem (`lg`). A down drawer is always full width. */\n size?: DrawerSize;\n /** The grab handle on top. On by default for a down drawer, off for a side one. */\n showSwipeHandle?: boolean;\n};\n\n/**\n * The sheet, with its portal, viewport and (modal only) dimmed overlay: `surface`, `panel-edge` border, `shadow-pop`.\n * Modal: full height and flush with its edge. Non-modal: a floating card that leaves focus where it was. Down: full\n * width, as tall as its content up to the viewport minus 6rem, rounded on top. Slides in over 200ms ease-out and out\n * over 150ms ease-in, or follows the finger and closes on a swipe toward its edge. Its className styles the sheet.\n */\nexport function DrawerContent({\n className,\n children,\n size = DRAWER_SIZES.SM,\n showSwipeHandle,\n initialFocus,\n ...props\n}: DrawerContentProps) {\n const { modal, swipeDirection } = useContext(DrawerContext);\n const isFloating = modal === false;\n const isSideDrawer = swipeDirection !== DRAWER_SWIPE_DIRECTIONS.DOWN;\n const isSwipeHandleVisible = showSwipeHandle ?? !isSideDrawer;\n\n return (\n <DrawerPortal>\n {modal === true && <DrawerOverlay />}\n <DrawerPrimitive.Viewport\n data-slot=\"drawer-viewport\"\n className={cn(\"fixed inset-0 z-50\", modal !== true && \"pointer-events-none\")}\n >\n <DrawerPrimitive.Popup\n data-slot=\"drawer-popup\"\n initialFocus={initialFocus ?? (isFloating ? false : undefined)}\n className={cn(\n POPUP_CLASSES,\n DIRECTION_CLASSES[swipeDirection],\n isFloating ? FLOATING_CLASSES : [BLEED_CLASSES, FLUSH_CLASSES[swipeDirection]],\n isSideDrawer && DRAWER_SIZE_CLASSES[size],\n className\n )}\n {...props}\n >\n {isSwipeHandleVisible && <DrawerSwipeHandle />}\n <DrawerPrimitive.Content\n data-slot=\"drawer-content\"\n className={cn(\n \"flex min-h-0 flex-1 flex-col select-text transition-opacity duration-200 ease-out group-data-swiping/drawer-popup:select-none\",\n // A down drawer behind a nested one keeps only its outline: the front one's content is what reads.\n !isSideDrawer &&\n \"group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100\"\n )}\n >\n {children}\n </DrawerPrimitive.Content>\n </DrawerPrimitive.Popup>\n </DrawerPrimitive.Viewport>\n </DrawerPortal>\n );\n}\n\ntype DrawerHeaderProps = ComponentProps<\"div\"> & {\n /** A small label above the title, such as the node's type tag (\"Router\"). */\n label?: ReactNode;\n /** The × on the right, named \"Close\". */\n showCloseButton?: boolean;\n};\n\n/** The optional label, then the title and description on the left; the × on the right. Doesn't scroll. */\nexport function DrawerHeader({ className, label, showCloseButton = true, children, ...props }: DrawerHeaderProps) {\n return (\n <div\n data-slot=\"drawer-header\"\n className={cn(\n \"flex shrink-0 items-start gap-space-12 px-5 pt-4.5 pb-space-12 group-data-[swipe-direction=down]/drawer-popup:pt-3\",\n className\n )}\n {...props}\n >\n <div className=\"flex min-w-0 flex-1 flex-col gap-space-2\">\n {label && (\n <div data-slot=\"drawer-label\" className=\"mb-space-6 flex items-center\">\n {label}\n </div>\n )}\n {children}\n </div>\n {showCloseButton && (\n <DrawerPrimitive.Close\n data-slot=\"drawer-close\"\n aria-label=\"Close\"\n render={\n <Button variant={BUTTON_VARIANTS.GHOST} size={BUTTON_SIZES.ICON} className=\"-mt-space-4 -mr-space-8\" />\n }\n >\n <X />\n </DrawerPrimitive.Close>\n )}\n </div>\n );\n}\n\n/** 17px semibold, 14.5px in a down drawer. Required: it names the drawer for screen readers. */\nexport function DrawerTitle({ className, ...props }: DrawerPrimitive.Title.Props) {\n return (\n <DrawerPrimitive.Title\n data-slot=\"drawer-title\"\n className={cn(\n \"m-0 font-sans text-title-sm text-ink group-data-[swipe-direction=down]/drawer-popup:text-card-title\",\n className\n )}\n {...props}\n />\n );\n}\n\n/** One `muted` line under the title: the member's email, what the node does. */\nexport function DrawerDescription({ className, ...props }: DrawerPrimitive.Description.Props) {\n return (\n <DrawerPrimitive.Description\n data-slot=\"drawer-description\"\n className={cn(\"m-0 text-ui text-muted\", className)}\n {...props}\n />\n );\n}\n\n/** The part that scrolls, between the header and the footer: a column of its content, 16px apart. */\nexport function DrawerBody({ className, ...props }: ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"drawer-body\"\n className={cn(\n \"flex min-h-0 flex-1 flex-col gap-space-16 overflow-y-auto overscroll-contain px-5 pt-space-4 pb-5\",\n className\n )}\n {...props}\n />\n );\n}\n\ntype DrawerFooterProps = ComponentProps<\"div\"> & {\n /** Actions on the left, such as Run node; the children sit on the right. */\n start?: ReactNode;\n};\n\n/**\n * Actions under a `line` rule, at the bottom: `start` on the left, the children on the right, 8px apart. In a down\n * drawer they stack full width, with no rule.\n */\nexport function DrawerFooter({ className, start, children, ...props }: DrawerFooterProps) {\n return (\n <div\n data-slot=\"drawer-footer\"\n className={cn(\n \"mt-auto flex shrink-0 items-center justify-end gap-space-8 border-t border-line px-5 py-space-12\",\n \"group-data-[swipe-direction=down]/drawer-popup:flex-col group-data-[swipe-direction=down]/drawer-popup:items-stretch group-data-[swipe-direction=down]/drawer-popup:border-t-0 group-data-[swipe-direction=down]/drawer-popup:pt-3 group-data-[swipe-direction=down]/drawer-popup:pb-5\",\n className\n )}\n {...props}\n >\n {start && (\n <div\n data-slot=\"drawer-footer-start\"\n className=\"mr-auto flex items-center gap-space-8 group-data-[swipe-direction=down]/drawer-popup:mr-0 group-data-[swipe-direction=down]/drawer-popup:flex-col group-data-[swipe-direction=down]/drawer-popup:items-stretch\"\n >\n {start}\n </div>\n )}\n {children}\n </div>\n );\n}\n"]}
@@ -0,0 +1,77 @@
1
+ import { type ComponentProps, type ReactNode } from "react";
2
+ import { Menu as MenuPrimitive } from "@base-ui/react/menu";
3
+ export declare const DROPDOWN_MENU_ITEM_VARIANTS: {
4
+ readonly DEFAULT: "default";
5
+ /** Danger text and icon. Goes last, after a separator. */
6
+ readonly DESTRUCTIVE: "destructive";
7
+ };
8
+ type DropdownMenuItemVariant = (typeof DROPDOWN_MENU_ITEM_VARIANTS)[keyof typeof DROPDOWN_MENU_ITEM_VARIANTS];
9
+ /** The menu sheet, for a menu driven from outside Base UI (an editor's `@` list). */
10
+ export declare const DROPDOWN_MENU_SHEET_CLASSES = "z-50 flex flex-col overflow-y-auto rounded-xl border border-panel-edge bg-surface p-space-6 text-ink shadow-pop outline-none animate-pop-in";
11
+ /** A 30px section header in 12px `muted`, sentence case. */
12
+ export declare const DROPDOWN_MENU_LABEL_CLASSES = "flex min-h-7.5 items-center px-space-8 pt-space-2 pb-space-4 font-sans text-small text-muted";
13
+ /** A 32px menu row; `data-highlighted` marks the active one. */
14
+ export declare const DROPDOWN_MENU_ITEM_CLASSES = "relative flex min-h-8 w-full cursor-pointer select-none items-center gap-space-10 rounded-row px-space-8 text-left font-sans text-ui text-ink outline-none data-[highlighted]:bg-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&>svg]:text-ink-2";
15
+ /**
16
+ * Root. Controlled with `open` / `onOpenChange`, or uncontrolled. The arrow keys stop at the first and last rows
17
+ * (`loopFocus` wraps them).
18
+ */
19
+ export declare function DropdownMenu({ loopFocus, ...props }: MenuPrimitive.Root.Props): import("react").JSX.Element;
20
+ /**
21
+ * Pass the anchor as `render`: `<DropdownMenuTrigger render={<Button … />}>`. Overflow triggers are vertical dots
22
+ * (`EllipsisVertical`). While the menu is open the trigger carries `aria-expanded`; style the open state off it,
23
+ * since a Tooltip around the trigger sets `data-popup-open` too.
24
+ */
25
+ export declare function DropdownMenuTrigger(props: MenuPrimitive.Trigger.Props): import("react").JSX.Element;
26
+ /** Rows under one `DropdownMenuLabel`: the label must sit inside a group. */
27
+ export declare function DropdownMenuGroup(props: MenuPrimitive.Group.Props): import("react").JSX.Element;
28
+ /** Single choice (sort by): holds `DropdownMenuRadioItem`s, and can hold their `DropdownMenuLabel`. */
29
+ export declare function DropdownMenuRadioGroup(props: MenuPrimitive.RadioGroup.Props): import("react").JSX.Element;
30
+ type DropdownMenuContentProps = MenuPrimitive.Popup.Props & Pick<MenuPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset" | "collisionPadding" | "collisionAvoidance">;
31
+ /**
32
+ * The sheet, 6px below its anchor and centred on it: 280px by default; `className="w-49"` (196px) for short action
33
+ * menus (Edit · Pin · Download · Delete). Scrolls when it runs out of room.
34
+ */
35
+ export declare function DropdownMenuContent({ className, side, sideOffset, align, alignOffset, collisionPadding, collisionAvoidance, children, ...props }: DropdownMenuContentProps): import("react").JSX.Element;
36
+ interface ItemExtras {
37
+ /** A second line in 12px `muted`. */
38
+ description?: ReactNode;
39
+ /** Right-aligned meta text ("Asks first"). */
40
+ meta?: ReactNode;
41
+ }
42
+ type DropdownMenuItemProps = MenuPrimitive.Item.Props & ItemExtras & {
43
+ /** `destructive` for delete: danger text and icon, last, after a separator. */
44
+ variant?: DropdownMenuItemVariant;
45
+ };
46
+ /**
47
+ * A row: a plain 16px icon (no tile) then the label, as children. `onClick` runs the action and closes the menu
48
+ * (`closeOnClick={false}` keeps it open). A link row passes the link as `render`:
49
+ * `<DropdownMenuItem render={<Link href="/settings" />}>Settings</DropdownMenuItem>`.
50
+ */
51
+ export declare function DropdownMenuItem({ className, variant, description, meta, children, ...props }: DropdownMenuItemProps): import("react").JSX.Element;
52
+ /** A toggle (filters). Checked, it shows a `link` check on the right. The menu stays open (`closeOnClick` closes it). */
53
+ export declare function DropdownMenuCheckboxItem({ className, children, description, meta, ...props }: MenuPrimitive.CheckboxItem.Props & ItemExtras): import("react").JSX.Element;
54
+ /**
55
+ * One option of a `DropdownMenuRadioGroup`. The current one shows a `link` check on the right. The menu stays open
56
+ * (`closeOnClick` closes it on a pick).
57
+ */
58
+ export declare function DropdownMenuRadioItem({ className, children, description, meta, ...props }: MenuPrimitive.RadioItem.Props & ItemExtras): import("react").JSX.Element;
59
+ /**
60
+ * Section header in 12px `muted`, sentence case ("Sort by"). It labels its group, so it goes inside a
61
+ * `DropdownMenuGroup` or `DropdownMenuRadioGroup` with the rows it heads.
62
+ */
63
+ export declare function DropdownMenuLabel({ className, ...props }: MenuPrimitive.GroupLabel.Props): import("react").JSX.Element;
64
+ export declare function DropdownMenuSeparator({ className, ...props }: MenuPrimitive.Separator.Props): import("react").JSX.Element;
65
+ /** A keyboard shortcut at the end of a row, in 12px `muted`. */
66
+ export declare function DropdownMenuShortcut({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
67
+ /**
68
+ * One level of nesting: `DropdownMenuSubTrigger` and `DropdownMenuSubContent`. Escape closes the whole menu;
69
+ * `closeParentOnEsc={false}` closes only the submenu.
70
+ */
71
+ export declare function DropdownMenuSub({ loopFocus, closeParentOnEsc, ...props }: MenuPrimitive.SubmenuRoot.Props): import("react").JSX.Element;
72
+ /** A row that opens a submenu, with a `muted` chevron on the right. */
73
+ export declare function DropdownMenuSubTrigger({ className, children, ...props }: MenuPrimitive.SubmenuTrigger.Props): import("react").JSX.Element;
74
+ /** The same sheet as the menu it opens from, 196px wide, beside its row and level with it. */
75
+ export declare function DropdownMenuSubContent({ className, side, sideOffset, align, alignOffset, collisionPadding, collisionAvoidance, ...props }: DropdownMenuContentProps): import("react").JSX.Element;
76
+ export {};
77
+ //# sourceMappingURL=dropdown-menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../src/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAI5D,eAAO,MAAM,2BAA2B;;IAEtC,0DAA0D;;CAElD,CAAC;AAEX,KAAK,uBAAuB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,OAAO,2BAA2B,CAAC,CAAC;AAQ9G,qFAAqF;AACrF,eAAO,MAAM,2BAA2B,gJACuG,CAAC;AAEhJ,4DAA4D;AAC5D,eAAO,MAAM,2BAA2B,iGACwD,CAAC;AAEjG,gEAAgE;AAChE,eAAO,MAAM,0BAA0B,+VACuT,CAAC;AAE/V;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,SAAiB,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,+BAErF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KA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AqB,CAAC,EACpC,SAAS,EACT,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,GAAG,UAAU,+BAiB5C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,CAAC,UAAU,CAAC,KAAK,+BAQxF;AAED,wBAAgB,qBAAqB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,+BAQ3F;AAED,gEAAgE;AAChE,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,MAAM,CAAC,+BAInF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,SAAiB,EAAE,gBAAuB,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,CAAC,WAAW,CAAC,KAAK,+BASxH;AAED,uEAAuE;AACvE,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,CAAC,cAAc,CAAC,KAAK,+BAWpC;AAED,8FAA8F;AAC9F,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,IAAc,EACd,UAAc,EACd,KAAe,EACf,WAAe,EACf,gBAAoB,EACpB,kBAAwC,EACxC,GAAG,KAAK,EACT,EAAE,wBAAwB,+BAoB1B"}
@@ -0,0 +1,112 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Children } from "react";
4
+ import { Menu as MenuPrimitive } from "@base-ui/react/menu";
5
+ import { Check, ChevronRight } from "lucide-react";
6
+ import { cn } from "../lib/cn.js";
7
+ export const DROPDOWN_MENU_ITEM_VARIANTS = {
8
+ DEFAULT: "default",
9
+ /** Danger text and icon. Goes last, after a separator. */
10
+ DESTRUCTIVE: "destructive",
11
+ };
12
+ /**
13
+ * Collision handling as before the move to Base UI: flip to the opposite side, slide along it to stay on screen,
14
+ * never flip the alignment or move to another axis.
15
+ */
16
+ const COLLISION_AVOIDANCE = { side: "flip", align: "shift", fallbackAxisSide: "none" };
17
+ /** The menu sheet, for a menu driven from outside Base UI (an editor's `@` list). */
18
+ export const DROPDOWN_MENU_SHEET_CLASSES = "z-50 flex flex-col overflow-y-auto rounded-xl border border-panel-edge bg-surface p-space-6 text-ink shadow-pop outline-none animate-pop-in";
19
+ /** A 30px section header in 12px `muted`, sentence case. */
20
+ export const DROPDOWN_MENU_LABEL_CLASSES = "flex min-h-7.5 items-center px-space-8 pt-space-2 pb-space-4 font-sans text-small text-muted";
21
+ /** A 32px menu row; `data-highlighted` marks the active one. */
22
+ export const DROPDOWN_MENU_ITEM_CLASSES = "relative flex min-h-8 w-full cursor-pointer select-none items-center gap-space-10 rounded-row px-space-8 text-left font-sans text-ui text-ink outline-none data-[highlighted]:bg-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&>svg]:text-ink-2";
23
+ /**
24
+ * Root. Controlled with `open` / `onOpenChange`, or uncontrolled. The arrow keys stop at the first and last rows
25
+ * (`loopFocus` wraps them).
26
+ */
27
+ export function DropdownMenu({ loopFocus = false, ...props }) {
28
+ return _jsx(MenuPrimitive.Root, { "data-slot": "dropdown-menu", loopFocus: loopFocus, ...props });
29
+ }
30
+ /**
31
+ * Pass the anchor as `render`: `<DropdownMenuTrigger render={<Button … />}>`. Overflow triggers are vertical dots
32
+ * (`EllipsisVertical`). While the menu is open the trigger carries `aria-expanded`; style the open state off it,
33
+ * since a Tooltip around the trigger sets `data-popup-open` too.
34
+ */
35
+ export function DropdownMenuTrigger(props) {
36
+ return _jsx(MenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
37
+ }
38
+ /** Rows under one `DropdownMenuLabel`: the label must sit inside a group. */
39
+ export function DropdownMenuGroup(props) {
40
+ return _jsx(MenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
41
+ }
42
+ /** Single choice (sort by): holds `DropdownMenuRadioItem`s, and can hold their `DropdownMenuLabel`. */
43
+ export function DropdownMenuRadioGroup(props) {
44
+ return _jsx(MenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props });
45
+ }
46
+ /**
47
+ * The sheet, 6px below its anchor and centred on it: 280px by default; `className="w-49"` (196px) for short action
48
+ * menus (Edit · Pin · Download · Delete). Scrolls when it runs out of room.
49
+ */
50
+ export function DropdownMenuContent({ className, side = "bottom", sideOffset = 6, align = "center", alignOffset = 0, collisionPadding = 0, collisionAvoidance = COLLISION_AVOIDANCE, children, ...props }) {
51
+ return (_jsx(MenuPrimitive.Portal, { children: _jsx(MenuPrimitive.Positioner, { side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset, collisionPadding: collisionPadding, collisionAvoidance: collisionAvoidance, className: "isolate z-50 outline-none", children: _jsx(MenuPrimitive.Popup, { "data-slot": "dropdown-menu-content", className: cn(DROPDOWN_MENU_SHEET_CLASSES, "max-h-(--available-height) w-70", className), ...props, children: _jsx(MenuPrimitive.List, { className: "flex flex-col outline-none", children: children }) }) }) }));
52
+ }
53
+ /** Leading icons stay beside the text block; the label and its description stack. */
54
+ function ItemBody({ children, description, meta }) {
55
+ if (!description && !meta) {
56
+ return children;
57
+ }
58
+ const nodes = Children.toArray(children);
59
+ const firstTextIndex = nodes.findIndex((node) => typeof node === "string" || typeof node === "number");
60
+ const lead = firstTextIndex > 0 ? nodes.slice(0, firstTextIndex) : [];
61
+ const label = firstTextIndex > 0 ? nodes.slice(firstTextIndex) : nodes;
62
+ return (_jsxs(_Fragment, { children: [lead, _jsxs("span", { className: "flex min-w-0 flex-1 flex-col py-space-4", children: [_jsx("span", { className: "truncate", children: label }), description && _jsx("span", { className: "text-small text-muted", children: description })] }), meta && _jsx("span", { className: "ml-auto text-small text-muted", children: meta })] }));
63
+ }
64
+ /**
65
+ * A row: a plain 16px icon (no tile) then the label, as children. `onClick` runs the action and closes the menu
66
+ * (`closeOnClick={false}` keeps it open). A link row passes the link as `render`:
67
+ * `<DropdownMenuItem render={<Link href="/settings" />}>Settings</DropdownMenuItem>`.
68
+ */
69
+ export function DropdownMenuItem({ className, variant = DROPDOWN_MENU_ITEM_VARIANTS.DEFAULT, description, meta, children, ...props }) {
70
+ return (_jsx(MenuPrimitive.Item, { "data-slot": "dropdown-menu-item", "data-variant": variant, className: cn(DROPDOWN_MENU_ITEM_CLASSES, "data-[variant=destructive]:text-danger data-[variant=destructive]:[&>svg]:text-danger", className), ...props, children: _jsx(ItemBody, { description: description, meta: meta, children: children }) }));
71
+ }
72
+ /** A toggle (filters). Checked, it shows a `link` check on the right. The menu stays open (`closeOnClick` closes it). */
73
+ export function DropdownMenuCheckboxItem({ className, children, description, meta, ...props }) {
74
+ return (_jsxs(MenuPrimitive.CheckboxItem, { "data-slot": "dropdown-menu-checkbox-item", className: cn(DROPDOWN_MENU_ITEM_CLASSES, "pr-space-32", className), ...props, children: [_jsx(ItemBody, { description: description, meta: meta, children: children }), _jsx("span", { className: "absolute right-2 flex", children: _jsx(MenuPrimitive.CheckboxItemIndicator, { children: _jsx(Check, { className: "text-link" }) }) })] }));
75
+ }
76
+ /**
77
+ * One option of a `DropdownMenuRadioGroup`. The current one shows a `link` check on the right. The menu stays open
78
+ * (`closeOnClick` closes it on a pick).
79
+ */
80
+ export function DropdownMenuRadioItem({ className, children, description, meta, ...props }) {
81
+ return (_jsxs(MenuPrimitive.RadioItem, { "data-slot": "dropdown-menu-radio-item", className: cn(DROPDOWN_MENU_ITEM_CLASSES, "pr-space-32", className), ...props, children: [_jsx(ItemBody, { description: description, meta: meta, children: children }), _jsx("span", { className: "absolute right-2 flex", children: _jsx(MenuPrimitive.RadioItemIndicator, { children: _jsx(Check, { className: "text-link" }) }) })] }));
82
+ }
83
+ /**
84
+ * Section header in 12px `muted`, sentence case ("Sort by"). It labels its group, so it goes inside a
85
+ * `DropdownMenuGroup` or `DropdownMenuRadioGroup` with the rows it heads.
86
+ */
87
+ export function DropdownMenuLabel({ className, ...props }) {
88
+ return (_jsx(MenuPrimitive.GroupLabel, { "data-slot": "dropdown-menu-label", className: cn(DROPDOWN_MENU_LABEL_CLASSES, className), ...props }));
89
+ }
90
+ export function DropdownMenuSeparator({ className, ...props }) {
91
+ return (_jsx(MenuPrimitive.Separator, { "data-slot": "dropdown-menu-separator", className: cn("mx-space-8 my-1.25 h-px shrink-0 bg-line", className), ...props }));
92
+ }
93
+ /** A keyboard shortcut at the end of a row, in 12px `muted`. */
94
+ export function DropdownMenuShortcut({ className, ...props }) {
95
+ return (_jsx("span", { "data-slot": "dropdown-menu-shortcut", className: cn("ml-auto text-small text-muted", className), ...props }));
96
+ }
97
+ /**
98
+ * One level of nesting: `DropdownMenuSubTrigger` and `DropdownMenuSubContent`. Escape closes the whole menu;
99
+ * `closeParentOnEsc={false}` closes only the submenu.
100
+ */
101
+ export function DropdownMenuSub({ loopFocus = false, closeParentOnEsc = true, ...props }) {
102
+ return (_jsx(MenuPrimitive.SubmenuRoot, { "data-slot": "dropdown-menu-sub", loopFocus: loopFocus, closeParentOnEsc: closeParentOnEsc, ...props }));
103
+ }
104
+ /** A row that opens a submenu, with a `muted` chevron on the right. */
105
+ export function DropdownMenuSubTrigger({ className, children, ...props }) {
106
+ return (_jsxs(MenuPrimitive.SubmenuTrigger, { "data-slot": "dropdown-menu-sub-trigger", className: cn(DROPDOWN_MENU_ITEM_CLASSES, "data-popup-open:bg-hover", className), ...props, children: [children, _jsx(ChevronRight, { className: "ml-auto text-muted" })] }));
107
+ }
108
+ /** The same sheet as the menu it opens from, 196px wide, beside its row and level with it. */
109
+ export function DropdownMenuSubContent({ className, side = "right", sideOffset = 0, align = "start", alignOffset = 0, collisionPadding = 0, collisionAvoidance = COLLISION_AVOIDANCE, ...props }) {
110
+ return (_jsx(MenuPrimitive.Portal, { children: _jsx(MenuPrimitive.Positioner, { side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset, collisionPadding: collisionPadding, collisionAvoidance: collisionAvoidance, className: "isolate z-50 outline-none", children: _jsx(MenuPrimitive.Popup, { "data-slot": "dropdown-menu-sub-content", className: cn(DROPDOWN_MENU_SHEET_CLASSES, "w-49", className), ...props }) }) }));
111
+ }
112
+ //# sourceMappingURL=dropdown-menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdown-menu.js","sourceRoot":"","sources":["../../src/components/dropdown-menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAuC,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,OAAO,EAAE,SAAS;IAClB,0DAA0D;IAC1D,WAAW,EAAE,aAAa;CAClB,CAAC;AAIX;;;GAGG;AACH,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAW,CAAC;AAEhG,qFAAqF;AACrF,MAAM,CAAC,MAAM,2BAA2B,GACtC,6IAA6I,CAAC;AAEhJ,4DAA4D;AAC5D,MAAM,CAAC,MAAM,2BAA2B,GACtC,8FAA8F,CAAC;AAEjG,gEAAgE;AAChE,MAAM,CAAC,MAAM,0BAA0B,GACrC,4VAA4V,CAAC;AAE/V;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,KAAK,EAA4B;IACpF,OAAO,KAAC,aAAa,CAAC,IAAI,iBAAW,eAAe,EAAC,SAAS,EAAE,SAAS,KAAM,KAA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,WAAW,GAAG,CAAC,EACf,gBAAgB,GAAG,CAAC,EACpB,kBAAkB,GAAG,mBAAmB,EACxC,GAAG,KAAK,EACiB;IACzB,OAAO,CACL,KAAC,aAAa,CAAC,MAAM,cACnB,KAAC,aAAa,CAAC,UAAU,IACvB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,SAAS,EAAC,2BAA2B,YAErC,KAAC,aAAa,CAAC,KAAK,iBACR,2BAA2B,EACrC,SAAS,EAAE,EAAE,CAAC,2BAA2B,EAAE,MAAM,EAAE,SAAS,CAAC,KACzD,KAAK,GACT,GACuB,GACN,CACxB,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport { Children, type ComponentProps, type ReactNode } from \"react\";\nimport { Menu as MenuPrimitive } from \"@base-ui/react/menu\";\nimport { Check, ChevronRight } from \"lucide-react\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const DROPDOWN_MENU_ITEM_VARIANTS = {\n DEFAULT: \"default\",\n /** Danger text and icon. Goes last, after a separator. */\n DESTRUCTIVE: \"destructive\",\n} as const;\n\ntype DropdownMenuItemVariant = (typeof DROPDOWN_MENU_ITEM_VARIANTS)[keyof typeof DROPDOWN_MENU_ITEM_VARIANTS];\n\n/**\n * Collision handling as before the move to Base UI: flip to the opposite side, slide along it to stay on screen,\n * never flip the alignment or move to another axis.\n */\nconst COLLISION_AVOIDANCE = { side: \"flip\", align: \"shift\", fallbackAxisSide: \"none\" } as const;\n\n/** The menu sheet, for a menu driven from outside Base UI (an editor's `@` list). */\nexport const DROPDOWN_MENU_SHEET_CLASSES =\n \"z-50 flex flex-col overflow-y-auto rounded-xl border border-panel-edge bg-surface p-space-6 text-ink shadow-pop outline-none animate-pop-in\";\n\n/** A 30px section header in 12px `muted`, sentence case. */\nexport const DROPDOWN_MENU_LABEL_CLASSES =\n \"flex min-h-7.5 items-center px-space-8 pt-space-2 pb-space-4 font-sans text-small text-muted\";\n\n/** A 32px menu row; `data-highlighted` marks the active one. */\nexport const DROPDOWN_MENU_ITEM_CLASSES =\n \"relative flex min-h-8 w-full cursor-pointer select-none items-center gap-space-10 rounded-row px-space-8 text-left font-sans text-ui text-ink outline-none data-[highlighted]:bg-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&>svg]:text-ink-2\";\n\n/**\n * Root. Controlled with `open` / `onOpenChange`, or uncontrolled. The arrow keys stop at the first and last rows\n * (`loopFocus` wraps them).\n */\nexport function DropdownMenu({ loopFocus = false, ...props }: MenuPrimitive.Root.Props) {\n return <MenuPrimitive.Root data-slot=\"dropdown-menu\" loopFocus={loopFocus} {...props} />;\n}\n\n/**\n * Pass the anchor as `render`: `<DropdownMenuTrigger render={<Button … />}>`. Overflow triggers are vertical dots\n * (`EllipsisVertical`). While the menu is open the trigger carries `aria-expanded`; style the open state off it,\n * since a Tooltip around the trigger sets `data-popup-open` too.\n */\nexport function DropdownMenuTrigger(props: MenuPrimitive.Trigger.Props) {\n return <MenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />;\n}\n\n/** Rows under one `DropdownMenuLabel`: the label must sit inside a group. */\nexport function DropdownMenuGroup(props: MenuPrimitive.Group.Props) {\n return <MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />;\n}\n\n/** Single choice (sort by): holds `DropdownMenuRadioItem`s, and can hold their `DropdownMenuLabel`. */\nexport function DropdownMenuRadioGroup(props: MenuPrimitive.RadioGroup.Props) {\n return <MenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\ntype DropdownMenuContentProps = MenuPrimitive.Popup.Props &\n Pick<\n MenuPrimitive.Positioner.Props,\n \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\" | \"collisionPadding\" | \"collisionAvoidance\"\n >;\n\n/**\n * The sheet, 6px below its anchor and centred on it: 280px by default; `className=\"w-49\"` (196px) for short action\n * menus (Edit · Pin · Download · Delete). Scrolls when it runs out of room.\n */\nexport function DropdownMenuContent({\n className,\n side = \"bottom\",\n sideOffset = 6,\n align = \"center\",\n alignOffset = 0,\n collisionPadding = 0,\n collisionAvoidance = COLLISION_AVOIDANCE,\n children,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal>\n <MenuPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n collisionPadding={collisionPadding}\n collisionAvoidance={collisionAvoidance}\n className=\"isolate z-50 outline-none\"\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={cn(DROPDOWN_MENU_SHEET_CLASSES, \"max-h-(--available-height) w-70\", className)}\n {...props}\n >\n {/* The list carries the menu role, so a pointer open focuses the menu itself, as before the move to Base UI,\n not the first control inside it (a switch or tabs, which a Space press would then flip). */}\n <MenuPrimitive.List className=\"flex flex-col outline-none\">{children}</MenuPrimitive.List>\n </MenuPrimitive.Popup>\n </MenuPrimitive.Positioner>\n </MenuPrimitive.Portal>\n );\n}\n\ninterface ItemExtras {\n /** A second line in 12px `muted`. */\n description?: ReactNode;\n /** Right-aligned meta text (\"Asks first\"). */\n meta?: ReactNode;\n}\n\n/** Leading icons stay beside the text block; the label and its description stack. */\nfunction ItemBody({ children, description, meta }: ItemExtras & { children?: ReactNode }) {\n if (!description && !meta) {\n return children;\n }\n\n const nodes = Children.toArray(children);\n const firstTextIndex = nodes.findIndex((node) => typeof node === \"string\" || typeof node === \"number\");\n const lead = firstTextIndex > 0 ? nodes.slice(0, firstTextIndex) : [];\n const label = firstTextIndex > 0 ? nodes.slice(firstTextIndex) : nodes;\n\n return (\n <>\n {lead}\n <span className=\"flex min-w-0 flex-1 flex-col py-space-4\">\n <span className=\"truncate\">{label}</span>\n {description && <span className=\"text-small text-muted\">{description}</span>}\n </span>\n {meta && <span className=\"ml-auto text-small text-muted\">{meta}</span>}\n </>\n );\n}\n\ntype DropdownMenuItemProps = MenuPrimitive.Item.Props &\n ItemExtras & {\n /** `destructive` for delete: danger text and icon, last, after a separator. */\n variant?: DropdownMenuItemVariant;\n };\n\n/**\n * A row: a plain 16px icon (no tile) then the label, as children. `onClick` runs the action and closes the menu\n * (`closeOnClick={false}` keeps it open). A link row passes the link as `render`:\n * `<DropdownMenuItem render={<Link href=\"/settings\" />}>Settings</DropdownMenuItem>`.\n */\nexport function DropdownMenuItem({\n className,\n variant = DROPDOWN_MENU_ITEM_VARIANTS.DEFAULT,\n description,\n meta,\n children,\n ...props\n}: DropdownMenuItemProps) {\n return (\n <MenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-variant={variant}\n className={cn(\n DROPDOWN_MENU_ITEM_CLASSES,\n \"data-[variant=destructive]:text-danger data-[variant=destructive]:[&>svg]:text-danger\",\n className\n )}\n {...props}\n >\n <ItemBody description={description} meta={meta}>\n {children}\n </ItemBody>\n </MenuPrimitive.Item>\n );\n}\n\n/** A toggle (filters). Checked, it shows a `link` check on the right. The menu stays open (`closeOnClick` closes it). */\nexport function DropdownMenuCheckboxItem({\n className,\n children,\n description,\n meta,\n ...props\n}: MenuPrimitive.CheckboxItem.Props & ItemExtras) {\n return (\n <MenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(DROPDOWN_MENU_ITEM_CLASSES, \"pr-space-32\", className)}\n {...props}\n >\n <ItemBody description={description} meta={meta}>\n {children}\n </ItemBody>\n <span className=\"absolute right-2 flex\">\n <MenuPrimitive.CheckboxItemIndicator>\n <Check className=\"text-link\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </span>\n </MenuPrimitive.CheckboxItem>\n );\n}\n\n/**\n * One option of a `DropdownMenuRadioGroup`. The current one shows a `link` check on the right. The menu stays open\n * (`closeOnClick` closes it on a pick).\n */\nexport function DropdownMenuRadioItem({\n className,\n children,\n description,\n meta,\n ...props\n}: MenuPrimitive.RadioItem.Props & ItemExtras) {\n return (\n <MenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(DROPDOWN_MENU_ITEM_CLASSES, \"pr-space-32\", className)}\n {...props}\n >\n <ItemBody description={description} meta={meta}>\n {children}\n </ItemBody>\n <span className=\"absolute right-2 flex\">\n <MenuPrimitive.RadioItemIndicator>\n <Check className=\"text-link\" />\n </MenuPrimitive.RadioItemIndicator>\n </span>\n </MenuPrimitive.RadioItem>\n );\n}\n\n/**\n * Section header in 12px `muted`, sentence case (\"Sort by\"). It labels its group, so it goes inside a\n * `DropdownMenuGroup` or `DropdownMenuRadioGroup` with the rows it heads.\n */\nexport function DropdownMenuLabel({ className, ...props }: MenuPrimitive.GroupLabel.Props) {\n return (\n <MenuPrimitive.GroupLabel\n data-slot=\"dropdown-menu-label\"\n className={cn(DROPDOWN_MENU_LABEL_CLASSES, className)}\n {...props}\n />\n );\n}\n\nexport function DropdownMenuSeparator({ className, ...props }: MenuPrimitive.Separator.Props) {\n return (\n <MenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\"mx-space-8 my-1.25 h-px shrink-0 bg-line\", className)}\n {...props}\n />\n );\n}\n\n/** A keyboard shortcut at the end of a row, in 12px `muted`. */\nexport function DropdownMenuShortcut({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span data-slot=\"dropdown-menu-shortcut\" className={cn(\"ml-auto text-small text-muted\", className)} {...props} />\n );\n}\n\n/**\n * One level of nesting: `DropdownMenuSubTrigger` and `DropdownMenuSubContent`. Escape closes the whole menu;\n * `closeParentOnEsc={false}` closes only the submenu.\n */\nexport function DropdownMenuSub({ loopFocus = false, closeParentOnEsc = true, ...props }: MenuPrimitive.SubmenuRoot.Props) {\n return (\n <MenuPrimitive.SubmenuRoot\n data-slot=\"dropdown-menu-sub\"\n loopFocus={loopFocus}\n closeParentOnEsc={closeParentOnEsc}\n {...props}\n />\n );\n}\n\n/** A row that opens a submenu, with a `muted` chevron on the right. */\nexport function DropdownMenuSubTrigger({\n className,\n children,\n ...props\n}: MenuPrimitive.SubmenuTrigger.Props) {\n return (\n <MenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n className={cn(DROPDOWN_MENU_ITEM_CLASSES, \"data-popup-open:bg-hover\", className)}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto text-muted\" />\n </MenuPrimitive.SubmenuTrigger>\n );\n}\n\n/** The same sheet as the menu it opens from, 196px wide, beside its row and level with it. */\nexport function DropdownMenuSubContent({\n className,\n side = \"right\",\n sideOffset = 0,\n align = \"start\",\n alignOffset = 0,\n collisionPadding = 0,\n collisionAvoidance = COLLISION_AVOIDANCE,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal>\n <MenuPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n collisionPadding={collisionPadding}\n collisionAvoidance={collisionAvoidance}\n className=\"isolate z-50 outline-none\"\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(DROPDOWN_MENU_SHEET_CLASSES, \"w-49\", className)}\n {...props}\n />\n </MenuPrimitive.Positioner>\n </MenuPrimitive.Portal>\n );\n}\n"]}
@@ -0,0 +1,49 @@
1
+ import { type ReactNode } from "react";
2
+ /** One tab of the strip: the agent (or skill) itself, an app opened from it, or a chat session. */
3
+ export interface EditorTab {
4
+ value: string;
5
+ /** Its name, truncated at 180px: text, or a node that looks the name up. */
6
+ label: ReactNode;
7
+ /** A 14px icon before the label. */
8
+ icon?: ReactNode;
9
+ /** Apps close with a ×; the agent's own tab never does. */
10
+ closable?: boolean;
11
+ /** The ×'s name. Defaults to “Close {label}” for a text label, “Close tab” otherwise. */
12
+ closeLabel?: string;
13
+ /** Shows the `warn` dot: this tab has unsaved changes. */
14
+ unsaved?: boolean;
15
+ /** A tab only looked into, not started yet (a session not running): its label in italics. */
16
+ preview?: boolean;
17
+ }
18
+ export interface EditorTabsProps {
19
+ tabs: EditorTab[];
20
+ /** The open tab (controlled). */
21
+ value?: string;
22
+ /** The tab open on first render (uncontrolled). Defaults to the first tab. */
23
+ defaultValue?: string;
24
+ onValueChange?: (value: string) => void;
25
+ /** Called with the value of the tab whose × was pressed. Pick the next tab and drop this one from `tabs`. */
26
+ onClose?: (value: string) => void;
27
+ /**
28
+ * Called with every tab's value in the new order while a tab is dragged, or moved with Alt+Shift+← / →. Put
29
+ * `tabs` in that order. Without it the tabs stay where they are.
30
+ */
31
+ onReorder?: (values: string[]) => void;
32
+ /** After the tabs and their arrows: the control that opens a new one (New chat). It keeps the strip with one tab. */
33
+ trailing?: ReactNode;
34
+ /** Keeps the strip while only one tab is open, where that tab says something (the chat's New chat). */
35
+ isSingleTabVisible?: boolean;
36
+ /** The tab list's name, where the page has more than one strip: “Chat sessions”. */
37
+ "aria-label"?: string;
38
+ /** The tabs' panels, as `TabsContent` from `@major-tech/ui/tabs`. They stay visible when the strip hides. */
39
+ children?: ReactNode;
40
+ className?: string;
41
+ }
42
+ /**
43
+ * The tab strip above the editor, built on Tabs: the agent (or skill) tab plus any apps opened from it, or a chat's
44
+ * sessions. Hidden while only one tab is open, unless it has a `trailing` control or `isSingleTabVisible`. The selected tab is `surface` with a `panel-edge` border, the others `muted`;
45
+ * labels truncate at 180px. With `onReorder` the tabs drag into a new order. When they don't fit, the strip scrolls,
46
+ * fades out on the side with more, and arrows appear at its end; the open tab is always scrolled into view.
47
+ */
48
+ export declare function EditorTabs({ tabs, value, defaultValue, onValueChange, onClose, onReorder, trailing, isSingleTabVisible, "aria-label": ariaLabel, children, className, }: EditorTabsProps): import("react").JSX.Element | null;
49
+ //# sourceMappingURL=editor-tabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-tabs.d.ts","sourceRoot":"","sources":["../../src/components/editor-tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAmD,KAAK,S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R,SAAS,GACV,EAAE,eAAe,sCAwPjB"}
@@ -0,0 +1,157 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { ChevronLeft, ChevronRight, X } from "lucide-react";
5
+ import { AnimatePresence, MotionConfig, Reorder, motion, useReducedMotion } from "motion/react";
6
+ import { cn } from "../lib/cn.js";
7
+ import { NO_SCROLL_FADE_EDGES, SCROLL_FADE_PX, buildScrollFadeStyle } from "../lib/scroll-fade.js";
8
+ import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "./button.js";
9
+ import { Tabs, TabsList, TabsTrigger } from "./tabs.js";
10
+ /** How much of the strip's visible width one press of an arrow scrolls. */
11
+ const SCROLL_STEP_RATIO = 0.6;
12
+ /** Sub-pixel slack, so fractional widths don't read as overflow when the tabs fit. */
13
+ const OVERFLOW_EPSILON_PX = 1;
14
+ /** A tab opening, closing, or making room for the one being dragged. */
15
+ const TAB_TRANSITION = { duration: 0.15, ease: "easeOut" };
16
+ /** With Alt and Shift held, the arrow keys move the focused tab one place. */
17
+ const MOVE_STEPS = { ArrowLeft: -1, ArrowRight: 1 };
18
+ const NO_OVERFLOW = { isOverflowing: false, canScrollBack: false, canScrollForward: false };
19
+ /** Whether the tabs overflow the strip, and which way the list can scroll. `reservedPx`: the trailing control's room. */
20
+ function measureStripScroll(strip, list, reservedPx) {
21
+ return {
22
+ // Against the whole strip, not the list: the arrows narrow the list, and that would keep them showing.
23
+ isOverflowing: list.scrollWidth > strip.clientWidth - reservedPx + OVERFLOW_EPSILON_PX,
24
+ canScrollBack: list.scrollLeft > OVERFLOW_EPSILON_PX,
25
+ canScrollForward: list.scrollLeft + list.clientWidth < list.scrollWidth - OVERFLOW_EPSILON_PX,
26
+ };
27
+ }
28
+ function isSameScroll(a, b) {
29
+ return (a.isOverflowing === b.isOverflowing &&
30
+ a.canScrollBack === b.canScrollBack &&
31
+ a.canScrollForward === b.canScrollForward);
32
+ }
33
+ function getCloseLabel(tab) {
34
+ return tab.closeLabel ?? (typeof tab.label === "string" ? `Close ${tab.label}` : "Close tab");
35
+ }
36
+ function findTabItem(list, value) {
37
+ return value === undefined ? null : (list?.querySelector(`[data-tab-value="${CSS.escape(value)}"]`) ?? null);
38
+ }
39
+ /**
40
+ * The tab strip above the editor, built on Tabs: the agent (or skill) tab plus any apps opened from it, or a chat's
41
+ * sessions. Hidden while only one tab is open, unless it has a `trailing` control or `isSingleTabVisible`. The selected tab is `surface` with a `panel-edge` border, the others `muted`;
42
+ * labels truncate at 180px. With `onReorder` the tabs drag into a new order. When they don't fit, the strip scrolls,
43
+ * fades out on the side with more, and arrows appear at its end; the open tab is always scrolled into view.
44
+ */
45
+ export function EditorTabs({ tabs, value, defaultValue, onValueChange, onClose, onReorder, trailing, isSingleTabVisible = false, "aria-label": ariaLabel, children, className, }) {
46
+ const stripRef = useRef(null);
47
+ const listRef = useRef(null);
48
+ const trailingRef = useRef(null);
49
+ // The tab just moved with the keyboard: moving its node in the DOM drops its focus, so it gets it back.
50
+ const movedTabRef = useRef(null);
51
+ const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue ?? tabs[0]?.value);
52
+ const [scroll, setScroll] = useState(NO_OVERFLOW);
53
+ const isReducedMotion = useReducedMotion();
54
+ const scrollBehavior = isReducedMotion ? "auto" : "smooth";
55
+ const hasTrailing = Boolean(trailing);
56
+ const isStripVisible = tabs.length > 1 || (tabs.length > 0 && (hasTrailing || isSingleTabVisible));
57
+ const isReorderable = onReorder !== undefined;
58
+ const values = tabs.map((tab) => tab.value);
59
+ const openValue = value ?? uncontrolledValue;
60
+ const measureScroll = () => {
61
+ const strip = stripRef.current;
62
+ const list = listRef.current;
63
+ const trailingElement = trailingRef.current;
64
+ const reservedPx = trailingElement && strip
65
+ ? trailingElement.offsetWidth + (Number.parseFloat(getComputedStyle(strip).columnGap) || 0)
66
+ : 0;
67
+ const next = strip && list ? measureStripScroll(strip, list, reservedPx) : NO_OVERFLOW;
68
+ setScroll((current) => (isSameScroll(current, next) ? current : next));
69
+ };
70
+ // Resizing the strip and scrolling the list change which arrows show; the strip mounts and unmounts with its
71
+ // second tab.
72
+ useEffect(() => {
73
+ const strip = stripRef.current;
74
+ const list = listRef.current;
75
+ if (!strip || !list) {
76
+ return;
77
+ }
78
+ const observer = new ResizeObserver(measureScroll);
79
+ observer.observe(strip);
80
+ observer.observe(list);
81
+ list.addEventListener("scroll", measureScroll, { passive: true });
82
+ return () => {
83
+ observer.disconnect();
84
+ list.removeEventListener("scroll", measureScroll);
85
+ };
86
+ // measureScroll reads only refs and the state setter, so the first one stays right.
87
+ }, [isStripVisible]);
88
+ // Tabs opening, closing or renamed change what there is to scroll without resizing anything.
89
+ useEffect(measureScroll);
90
+ // Bring the open tab into view, clear of the edge fade: one opened past the edge, or one clicked while half hidden
91
+ // or faded. At either end of the list the browser stops the scroll short, where there is no fade. Only the strip
92
+ // scrolls, never the page around it.
93
+ useEffect(() => {
94
+ const list = listRef.current;
95
+ const item = findTabItem(list, openValue);
96
+ if (!list || !item) {
97
+ return;
98
+ }
99
+ const start = item.offsetLeft;
100
+ const end = start + item.offsetWidth;
101
+ if (start < list.scrollLeft + SCROLL_FADE_PX) {
102
+ list.scrollTo({ left: start - SCROLL_FADE_PX, behavior: scrollBehavior });
103
+ }
104
+ else if (end > list.scrollLeft + list.clientWidth - SCROLL_FADE_PX) {
105
+ list.scrollTo({ left: end - list.clientWidth + SCROLL_FADE_PX, behavior: scrollBehavior });
106
+ }
107
+ }, [openValue, tabs.length, scrollBehavior]);
108
+ useEffect(() => {
109
+ const moved = movedTabRef.current;
110
+ movedTabRef.current = null;
111
+ if (moved && document.activeElement === document.body) {
112
+ findTabItem(listRef.current, moved)?.querySelector('[role="tab"]')?.focus();
113
+ }
114
+ });
115
+ if (!isStripVisible && !children) {
116
+ return null;
117
+ }
118
+ const handleValueChange = (next) => {
119
+ setUncontrolledValue(next);
120
+ onValueChange?.(next);
121
+ };
122
+ const handleTabKeyDown = (event, tabValue) => {
123
+ const step = MOVE_STEPS[event.key];
124
+ if (!onReorder || !step || !event.altKey || !event.shiftKey || event.ctrlKey || event.metaKey) {
125
+ return;
126
+ }
127
+ // Keep the tablist from also moving focus to the neighbour.
128
+ event.preventDefault();
129
+ event.stopPropagation();
130
+ const from = values.indexOf(tabValue);
131
+ const to = from + step;
132
+ if (to < 0 || to >= values.length) {
133
+ return;
134
+ }
135
+ const next = values.filter((current) => current !== tabValue);
136
+ next.splice(to, 0, tabValue);
137
+ movedTabRef.current = tabValue;
138
+ onReorder(next);
139
+ };
140
+ const stripFadeStyle = buildScrollFadeStyle({
141
+ ...NO_SCROLL_FADE_EDGES,
142
+ left: scroll.canScrollBack,
143
+ right: scroll.canScrollForward,
144
+ });
145
+ const scrollByStep = (direction) => {
146
+ const list = listRef.current;
147
+ list?.scrollBy({ left: direction * list.clientWidth * SCROLL_STEP_RATIO, behavior: scrollBehavior });
148
+ };
149
+ return (_jsxs(Tabs, { "data-slot": "editor-tabs", value: value, defaultValue: defaultValue ?? tabs[0]?.value, onValueChange: handleValueChange, className: className, children: [isStripVisible && (_jsx(MotionConfig, { reducedMotion: "user", children: _jsxs("div", { ref: stripRef, className: "flex min-w-0 items-center gap-space-4", children: [_jsx(TabsList, { ref: listRef, "aria-label": ariaLabel, render: _jsx(Reorder.Group, { as: "div", axis: "x", values: values, onReorder: (next) => onReorder?.(next),
150
+ // The list is the scroll container, so Motion measures the tabs with its scroll offset.
151
+ layoutScroll: true }), className: "relative min-w-0 gap-space-4 overflow-x-auto overscroll-x-contain rounded-none bg-transparent p-0 [scrollbar-width:none]", style: stripFadeStyle, children: _jsx(AnimatePresence, { initial: false, children: tabs.map((tab) => (_jsxs(Reorder.Item, { as: "span", value: tab.value, drag: isReorderable ? "x" : false, layout: "position", initial: { opacity: 0, scale: 0.85 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.85 }, transition: TAB_TRANSITION, "data-tab-value": tab.value,
152
+ // Positioned, so the dragged tab's raised z-index puts it over its neighbours.
153
+ className: "relative inline-flex shrink-0", children: [_jsxs(TabsTrigger, { value: tab.value, "aria-keyshortcuts": isReorderable ? "Alt+Shift+ArrowLeft Alt+Shift+ArrowRight" : undefined, onKeyDown: (event) => handleTabKeyDown(event, tab.value), className: cn("rounded-md border border-transparent px-space-10 text-ui-sm font-normal [&_svg]:size-3.5", "data-active:border-panel-edge data-active:shadow-none", "aria-selected:border-panel-edge aria-selected:shadow-none", isReorderable && "cursor-grab active:cursor-grabbing", tab.closable && "pr-8.5"), children: [tab.icon, _jsx("span", { className: cn("max-w-45 truncate", tab.preview && "italic"), children: tab.label }), tab.unsaved && (_jsx("span", { role: "img", "aria-label": "Unsaved changes", className: "size-1.5 shrink-0 rounded-full bg-warn" }))] }), tab.closable && (
154
+ // A sibling of the tab, not inside it: its own focus stop with its own name.
155
+ _jsx("button", { type: "button", "aria-label": getCloseLabel(tab), onClick: () => onClose?.(tab.value), className: "absolute top-1/2 right-2.5 grid size-4.5 -translate-y-1/2 cursor-pointer place-items-center rounded-sm text-faint outline-none hover:bg-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-faint", children: _jsx(X, { className: "size-3" }) }))] }, tab.value))) }) }), scroll.isOverflowing && (_jsxs(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, className: "flex shrink-0 items-center gap-space-2", children: [_jsx(Button, { variant: BUTTON_VARIANTS.GHOST, size: BUTTON_SIZES.ICON_SM, "aria-label": "Scroll tabs left", disabled: !scroll.canScrollBack, className: "disabled:opacity-40", onClick: () => scrollByStep(-1), children: _jsx(ChevronLeft, {}) }), _jsx(Button, { variant: BUTTON_VARIANTS.GHOST, size: BUTTON_SIZES.ICON_SM, "aria-label": "Scroll tabs right", disabled: !scroll.canScrollForward, className: "disabled:opacity-40", onClick: () => scrollByStep(1), children: _jsx(ChevronRight, {}) })] })), hasTrailing && (_jsx("div", { ref: trailingRef, className: "flex shrink-0 items-center", children: trailing }))] }) })), children]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C,EAAE,EACvB,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EACvB,SAAS,EAAC,wCAAwC,aAElD,KAAC,MAAM,IACL,OAAO,EAAE,eAAe,CAAC,KAAK,EAC9B,IAAI,EAAE,YAAY,CAAC,OAAO,gBACf,kBAAkB,EAC7B,QAAQ,EAAE,CAAC,MAAM,CAAC,aAAa,EAC/B,SAAS,EAAC,qBAAqB,EAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAE/B,KAAC,WAAW,KAAG,GACR,EACT,KAAC,MAAM,IACL,OAAO,EAAE,eAAe,CAAC,KAAK,EAC9B,IAAI,EAAE,YAAY,CAAC,OAAO,gBACf,mBAAmB,EAC9B,QAAQ,EAAE,CAAC,MAAM,CAAC,gBAAgB,EAClC,SAAS,EAAC,qBAAqB,EAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,YAE9B,KAAC,YAAY,KAAG,GACT,IACE,CACd,EACA,WAAW,IAAI,CACd,cAAK,GAAG,EAAE,WAAW,EAAE,SAAS,EAAC,4BAA4B,YAC1D,QAAQ,GACL,CACP,IACG,GACO,CAChB,EACA,QAAQ,IACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState, type KeyboardEvent, type ReactNode } from \"react\";\nimport { ChevronLeft, ChevronRight, X } from \"lucide-react\";\nimport { AnimatePresence, MotionConfig, Reorder, motion, useReducedMotion } from \"motion/react\";\nimport { cn } from \"../lib/cn.ts\";\nimport { NO_SCROLL_FADE_EDGES, SCROLL_FADE_PX, buildScrollFadeStyle } from \"../lib/scroll-fade.ts\";\nimport { BUTTON_SIZES, BUTTON_VARIANTS, Button } from \"./button.tsx\";\nimport { Tabs, TabsList, TabsTrigger } from \"./tabs.tsx\";\n\n/** How much of the strip's visible width one press of an arrow scrolls. */\nconst SCROLL_STEP_RATIO = 0.6;\n/** Sub-pixel slack, so fractional widths don't read as overflow when the tabs fit. */\nconst OVERFLOW_EPSILON_PX = 1;\n/** A tab opening, closing, or making room for the one being dragged. */\nconst TAB_TRANSITION = { duration: 0.15, ease: \"easeOut\" } as const;\n/** With Alt and Shift held, the arrow keys move the focused tab one place. */\nconst MOVE_STEPS: Record<string, number> = { ArrowLeft: -1, ArrowRight: 1 };\n\n/** One tab of the strip: the agent (or skill) itself, an app opened from it, or a chat session. */\nexport interface EditorTab {\n value: string;\n /** Its name, truncated at 180px: text, or a node that looks the name up. */\n label: ReactNode;\n /** A 14px icon before the label. */\n icon?: ReactNode;\n /** Apps close with a ×; the agent's own tab never does. */\n closable?: boolean;\n /** The ×'s name. Defaults to “Close {label}” for a text label, “Close tab” otherwise. */\n closeLabel?: string;\n /** Shows the `warn` dot: this tab has unsaved changes. */\n unsaved?: boolean;\n /** A tab only looked into, not started yet (a session not running): its label in italics. */\n preview?: boolean;\n}\n\nexport interface EditorTabsProps {\n tabs: EditorTab[];\n /** The open tab (controlled). */\n value?: string;\n /** The tab open on first render (uncontrolled). Defaults to the first tab. */\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Called with the value of the tab whose × was pressed. Pick the next tab and drop this one from `tabs`. */\n onClose?: (value: string) => void;\n /**\n * Called with every tab's value in the new order while a tab is dragged, or moved with Alt+Shift+← / →. Put\n * `tabs` in that order. Without it the tabs stay where they are.\n */\n onReorder?: (values: string[]) => void;\n /** After the tabs and their arrows: the control that opens a new one (New chat). It keeps the strip with one tab. */\n trailing?: ReactNode;\n /** Keeps the strip while only one tab is open, where that tab says something (the chat's New chat). */\n isSingleTabVisible?: boolean;\n /** The tab list's name, where the page has more than one strip: “Chat sessions”. */\n \"aria-label\"?: string;\n /** The tabs' panels, as `TabsContent` from `@major-tech/ui/tabs`. They stay visible when the strip hides. */\n children?: ReactNode;\n className?: string;\n}\n\ninterface StripScroll {\n isOverflowing: boolean;\n canScrollBack: boolean;\n canScrollForward: boolean;\n}\n\nconst NO_OVERFLOW: StripScroll = { isOverflowing: false, canScrollBack: false, canScrollForward: false };\n\n/** Whether the tabs overflow the strip, and which way the list can scroll. `reservedPx`: the trailing control's room. */\nfunction measureStripScroll(strip: HTMLElement, list: HTMLElement, reservedPx: number): StripScroll {\n return {\n // Against the whole strip, not the list: the arrows narrow the list, and that would keep them showing.\n isOverflowing: list.scrollWidth > strip.clientWidth - reservedPx + OVERFLOW_EPSILON_PX,\n canScrollBack: list.scrollLeft > OVERFLOW_EPSILON_PX,\n canScrollForward: list.scrollLeft + list.clientWidth < list.scrollWidth - OVERFLOW_EPSILON_PX,\n };\n}\n\nfunction isSameScroll(a: StripScroll, b: StripScroll) {\n return (\n a.isOverflowing === b.isOverflowing &&\n a.canScrollBack === b.canScrollBack &&\n a.canScrollForward === b.canScrollForward\n );\n}\n\nfunction getCloseLabel(tab: EditorTab) {\n return tab.closeLabel ?? (typeof tab.label === \"string\" ? `Close ${tab.label}` : \"Close tab\");\n}\n\nfunction findTabItem(list: HTMLElement | null, value: string | undefined) {\n return value === undefined ? null : (list?.querySelector<HTMLElement>(`[data-tab-value=\"${CSS.escape(value)}\"]`) ?? null);\n}\n\n/**\n * The tab strip above the editor, built on Tabs: the agent (or skill) tab plus any apps opened from it, or a chat's\n * sessions. Hidden while only one tab is open, unless it has a `trailing` control or `isSingleTabVisible`. The selected tab is `surface` with a `panel-edge` border, the others `muted`;\n * labels truncate at 180px. With `onReorder` the tabs drag into a new order. When they don't fit, the strip scrolls,\n * fades out on the side with more, and arrows appear at its end; the open tab is always scrolled into view.\n */\nexport function EditorTabs({\n tabs,\n value,\n defaultValue,\n onValueChange,\n onClose,\n onReorder,\n trailing,\n isSingleTabVisible = false,\n \"aria-label\": ariaLabel,\n children,\n className,\n}: EditorTabsProps) {\n const stripRef = useRef<HTMLDivElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n const trailingRef = useRef<HTMLDivElement>(null);\n // The tab just moved with the keyboard: moving its node in the DOM drops its focus, so it gets it back.\n const movedTabRef = useRef<string | null>(null);\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue ?? tabs[0]?.value);\n const [scroll, setScroll] = useState(NO_OVERFLOW);\n const isReducedMotion = useReducedMotion();\n const scrollBehavior = isReducedMotion ? \"auto\" : \"smooth\";\n\n const hasTrailing = Boolean(trailing);\n const isStripVisible = tabs.length > 1 || (tabs.length > 0 && (hasTrailing || isSingleTabVisible));\n const isReorderable = onReorder !== undefined;\n const values = tabs.map((tab) => tab.value);\n const openValue = value ?? uncontrolledValue;\n\n const measureScroll = () => {\n const strip = stripRef.current;\n const list = listRef.current;\n const trailingElement = trailingRef.current;\n const reservedPx =\n trailingElement && strip\n ? trailingElement.offsetWidth + (Number.parseFloat(getComputedStyle(strip).columnGap) || 0)\n : 0;\n const next = strip && list ? measureStripScroll(strip, list, reservedPx) : NO_OVERFLOW;\n\n setScroll((current) => (isSameScroll(current, next) ? current : next));\n };\n\n // Resizing the strip and scrolling the list change which arrows show; the strip mounts and unmounts with its\n // second tab.\n useEffect(() => {\n const strip = stripRef.current;\n const list = listRef.current;\n\n if (!strip || !list) {\n return;\n }\n\n const observer = new ResizeObserver(measureScroll);\n\n observer.observe(strip);\n observer.observe(list);\n list.addEventListener(\"scroll\", measureScroll, { passive: true });\n\n return () => {\n observer.disconnect();\n list.removeEventListener(\"scroll\", measureScroll);\n };\n // measureScroll reads only refs and the state setter, so the first one stays right.\n }, [isStripVisible]);\n\n // Tabs opening, closing or renamed change what there is to scroll without resizing anything.\n useEffect(measureScroll);\n\n // Bring the open tab into view, clear of the edge fade: one opened past the edge, or one clicked while half hidden\n // or faded. At either end of the list the browser stops the scroll short, where there is no fade. Only the strip\n // scrolls, never the page around it.\n useEffect(() => {\n const list = listRef.current;\n const item = findTabItem(list, openValue);\n\n if (!list || !item) {\n return;\n }\n\n const start = item.offsetLeft;\n const end = start + item.offsetWidth;\n\n if (start < list.scrollLeft + SCROLL_FADE_PX) {\n list.scrollTo({ left: start - SCROLL_FADE_PX, behavior: scrollBehavior });\n } else if (end > list.scrollLeft + list.clientWidth - SCROLL_FADE_PX) {\n list.scrollTo({ left: end - list.clientWidth + SCROLL_FADE_PX, behavior: scrollBehavior });\n }\n }, [openValue, tabs.length, scrollBehavior]);\n\n useEffect(() => {\n const moved = movedTabRef.current;\n\n movedTabRef.current = null;\n\n if (moved && document.activeElement === document.body) {\n findTabItem(listRef.current, moved)?.querySelector<HTMLElement>('[role=\"tab\"]')?.focus();\n }\n });\n\n if (!isStripVisible && !children) {\n return null;\n }\n\n const handleValueChange = (next: string) => {\n setUncontrolledValue(next);\n onValueChange?.(next);\n };\n\n const handleTabKeyDown = (event: KeyboardEvent<HTMLElement>, tabValue: string) => {\n const step = MOVE_STEPS[event.key];\n\n if (!onReorder || !step || !event.altKey || !event.shiftKey || event.ctrlKey || event.metaKey) {\n return;\n }\n\n // Keep the tablist from also moving focus to the neighbour.\n event.preventDefault();\n event.stopPropagation();\n\n const from = values.indexOf(tabValue);\n const to = from + step;\n\n if (to < 0 || to >= values.length) {\n return;\n }\n\n const next = values.filter((current) => current !== tabValue);\n\n next.splice(to, 0, tabValue);\n movedTabRef.current = tabValue;\n onReorder(next);\n };\n\n const stripFadeStyle = buildScrollFadeStyle({\n ...NO_SCROLL_FADE_EDGES,\n left: scroll.canScrollBack,\n right: scroll.canScrollForward,\n });\n\n const scrollByStep = (direction: -1 | 1) => {\n const list = listRef.current;\n\n list?.scrollBy({ left: direction * list.clientWidth * SCROLL_STEP_RATIO, behavior: scrollBehavior });\n };\n\n return (\n <Tabs\n data-slot=\"editor-tabs\"\n value={value}\n defaultValue={defaultValue ?? tabs[0]?.value}\n onValueChange={handleValueChange}\n className={className}\n >\n {isStripVisible && (\n <MotionConfig reducedMotion=\"user\">\n <div ref={stripRef} className=\"flex min-w-0 items-center gap-space-4\">\n <TabsList\n ref={listRef}\n aria-label={ariaLabel}\n render={\n <Reorder.Group\n as=\"div\"\n axis=\"x\"\n values={values}\n onReorder={(next: string[]) => onReorder?.(next)}\n // The list is the scroll container, so Motion measures the tabs with its scroll offset.\n layoutScroll\n />\n }\n className=\"relative min-w-0 gap-space-4 overflow-x-auto overscroll-x-contain rounded-none bg-transparent p-0 [scrollbar-width:none]\"\n style={stripFadeStyle}\n >\n <AnimatePresence initial={false}>\n {tabs.map((tab) => (\n <Reorder.Item\n key={tab.value}\n as=\"span\"\n value={tab.value}\n drag={isReorderable ? \"x\" : false}\n layout=\"position\"\n initial={{ opacity: 0, scale: 0.85 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.85 }}\n transition={TAB_TRANSITION}\n data-tab-value={tab.value}\n // Positioned, so the dragged tab's raised z-index puts it over its neighbours.\n className=\"relative inline-flex shrink-0\"\n >\n <TabsTrigger\n value={tab.value}\n aria-keyshortcuts={isReorderable ? \"Alt+Shift+ArrowLeft Alt+Shift+ArrowRight\" : undefined}\n onKeyDown={(event) => handleTabKeyDown(event, tab.value)}\n className={cn(\n \"rounded-md border border-transparent px-space-10 text-ui-sm font-normal [&_svg]:size-3.5\",\n \"data-active:border-panel-edge data-active:shadow-none\",\n \"aria-selected:border-panel-edge aria-selected:shadow-none\",\n isReorderable && \"cursor-grab active:cursor-grabbing\",\n tab.closable && \"pr-8.5\"\n )}\n >\n {tab.icon}\n <span className={cn(\"max-w-45 truncate\", tab.preview && \"italic\")}>{tab.label}</span>\n {tab.unsaved && (\n <span role=\"img\" aria-label=\"Unsaved changes\" className=\"size-1.5 shrink-0 rounded-full bg-warn\" />\n )}\n </TabsTrigger>\n {tab.closable && (\n // A sibling of the tab, not inside it: its own focus stop with its own name.\n <button\n type=\"button\"\n aria-label={getCloseLabel(tab)}\n onClick={() => onClose?.(tab.value)}\n className=\"absolute top-1/2 right-2.5 grid size-4.5 -translate-y-1/2 cursor-pointer place-items-center rounded-sm text-faint outline-none hover:bg-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-faint\"\n >\n <X className=\"size-3\" />\n </button>\n )}\n </Reorder.Item>\n ))}\n </AnimatePresence>\n </TabsList>\n {scroll.isOverflowing && (\n <motion.div\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n className=\"flex shrink-0 items-center gap-space-2\"\n >\n <Button\n variant={BUTTON_VARIANTS.GHOST}\n size={BUTTON_SIZES.ICON_SM}\n aria-label=\"Scroll tabs left\"\n disabled={!scroll.canScrollBack}\n className=\"disabled:opacity-40\"\n onClick={() => scrollByStep(-1)}\n >\n <ChevronLeft />\n </Button>\n <Button\n variant={BUTTON_VARIANTS.GHOST}\n size={BUTTON_SIZES.ICON_SM}\n aria-label=\"Scroll tabs right\"\n disabled={!scroll.canScrollForward}\n className=\"disabled:opacity-40\"\n onClick={() => scrollByStep(1)}\n >\n <ChevronRight />\n </Button>\n </motion.div>\n )}\n {hasTrailing && (\n <div ref={trailingRef} className=\"flex shrink-0 items-center\">\n {trailing}\n </div>\n )}\n </div>\n </MotionConfig>\n )}\n {children}\n </Tabs>\n );\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import type { ReactNode } from "react";
2
+ export interface EmptyStateProps {
3
+ /** A lucide icon, drawn 22px in a 44px `secondary` circle. */
4
+ icon?: ReactNode;
5
+ /** An illustration in place of the icon, above the title. */
6
+ illustration?: ReactNode;
7
+ /** 15px semibold: "Nothing to monitor yet", "No connectors match “zzz”". */
8
+ title: ReactNode;
9
+ /** One or two sentences: why it's empty and what happens next. */
10
+ description?: ReactNode;
11
+ /** One action. */
12
+ action?: ReactNode;
13
+ /** On a card of its own, as on a page. Off where it already sits in a surface: a card, dialog, popover or table. */
14
+ container?: boolean;
15
+ /** Styles the state itself, inside its card. */
16
+ className?: string;
17
+ }
18
+ /** What a page or list shows when there's nothing in it yet, or nothing matches: why, and the next step. */
19
+ declare function EmptyState({ icon, illustration, title, description, action, container, className }: EmptyStateProps): import("react").JSX.Element;
20
+ export { EmptyState };
21
+ //# sourceMappingURL=empty-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../src/components/empty-state.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,4EAA4E;IAC5E,KAAK,EAAE,SAAS,CAAC;IACjB,kEAAkE;IAClE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,kBAAkB;IAClB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,oHAAoH;IACpH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4GAA4G;AAC5G,iBAAS,UAAU,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAgB,EAAE,SAAS,EAAE,EAAE,eAAe,+BAuBnH;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}