@alepha/ui 0.39.0 → 0.41.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 (761) hide show
  1. package/README.md +4 -2
  2. package/dist/account/AccountConnections.js +1 -1
  3. package/dist/account/AccountConnectionsView.js +4 -4
  4. package/dist/account/AccountDeleteDialog.d.ts.map +1 -1
  5. package/dist/account/AccountDeleteDialog.js +5 -4
  6. package/dist/account/AccountDeleteDialog.js.map +1 -1
  7. package/dist/account/AccountDialog.js +4 -4
  8. package/dist/account/AccountDisplay.js +4 -4
  9. package/dist/account/AccountKeys.js +1 -1
  10. package/dist/account/AccountKeysView.js +5 -5
  11. package/dist/account/AccountMfaDialog.js +4 -4
  12. package/dist/account/AccountPasskeyProofDialog.js +2 -2
  13. package/dist/account/AccountPasskeyRow.js +3 -3
  14. package/dist/account/AccountPasskeys.js +4 -4
  15. package/dist/account/AccountPasswordDialog.js +4 -4
  16. package/dist/account/AccountPasswordDialog.js.map +1 -1
  17. package/dist/account/AccountPasswordGuard.js +2 -2
  18. package/dist/account/AccountProfile.js +1 -1
  19. package/dist/account/AccountProfileView.d.ts.map +1 -1
  20. package/dist/account/AccountProfileView.js +8 -7
  21. package/dist/account/AccountProfileView.js.map +1 -1
  22. package/dist/account/AccountRecoveryCodes.js +2 -2
  23. package/dist/account/AccountRecoveryCodesDialog.js +1 -1
  24. package/dist/account/AccountSecurity.js +1 -1
  25. package/dist/account/AccountSecurityView.js +5 -5
  26. package/dist/account/AccountSessions.js +1 -1
  27. package/dist/account/AccountSessionsView.js +4 -4
  28. package/dist/account/ApiKeyCreateDialog.js +7 -6
  29. package/dist/account/ApiKeyCreateDialog.js.map +1 -1
  30. package/dist/account/ApiKeyScopeMatrix.js +2 -2
  31. package/dist/account/ApiKeyStatusBadge.js +1 -1
  32. package/dist/admin/$pageAdmin.js +1 -1
  33. package/dist/admin/AdminAi.d.ts +12 -0
  34. package/dist/admin/AdminAi.d.ts.map +1 -0
  35. package/dist/admin/AdminAi.js +173 -0
  36. package/dist/admin/AdminAi.js.map +1 -0
  37. package/dist/admin/AdminAiDailyChart.d.ts +16 -0
  38. package/dist/admin/AdminAiDailyChart.d.ts.map +1 -0
  39. package/dist/admin/AdminAiDailyChart.js +87 -0
  40. package/dist/admin/AdminAiDailyChart.js.map +1 -0
  41. package/dist/admin/AdminAiUsageTable.d.ts +33 -0
  42. package/dist/admin/AdminAiUsageTable.d.ts.map +1 -0
  43. package/dist/admin/AdminAiUsageTable.js +77 -0
  44. package/dist/admin/AdminAiUsageTable.js.map +1 -0
  45. package/dist/admin/AdminAnalytics.js +3 -3
  46. package/dist/admin/AdminAudits.js +7 -7
  47. package/dist/admin/AdminBrand.js +2 -2
  48. package/dist/admin/AdminConnectedTile.js +1 -1
  49. package/dist/admin/AdminDashboard.js +3 -3
  50. package/dist/admin/AdminFailedAuditsTile.js +3 -3
  51. package/dist/admin/AdminFiles.d.ts.map +1 -1
  52. package/dist/admin/AdminFiles.js +8 -8
  53. package/dist/admin/AdminFiles.js.map +1 -1
  54. package/dist/admin/AdminFilesUsage.js +2 -2
  55. package/dist/admin/AdminFilesUsageCard.js +2 -2
  56. package/dist/admin/AdminJobDetail.js +7 -7
  57. package/dist/admin/AdminJobDetailAside.js +3 -3
  58. package/dist/admin/AdminJobDetailExecutions.js +6 -6
  59. package/dist/admin/AdminJobExecutionLogs.js +1 -1
  60. package/dist/admin/AdminJobExecutionSheet.d.ts.map +1 -1
  61. package/dist/admin/AdminJobExecutionSheet.js +12 -5
  62. package/dist/admin/AdminJobExecutionSheet.js.map +1 -1
  63. package/dist/admin/AdminJobExecutionSteps.js +1 -1
  64. package/dist/admin/AdminJobs.js +7 -7
  65. package/dist/admin/AdminJobsTypeIcon.js +1 -1
  66. package/dist/admin/AdminKeys.js +6 -6
  67. package/dist/admin/AdminKeysTokenDialog.js +4 -4
  68. package/dist/admin/AdminLayout.js +5 -5
  69. package/dist/admin/AdminNotifications.js +6 -6
  70. package/dist/admin/AdminNotificationsDetail.js +2 -2
  71. package/dist/admin/AdminNotificationsDetailTabs.js +3 -3
  72. package/dist/admin/AdminNotificationsPreviewBody.js +1 -1
  73. package/dist/admin/AdminNotificationsPreviewTab.js +1 -1
  74. package/dist/admin/AdminParameters.d.ts.map +1 -1
  75. package/dist/admin/AdminParameters.js +10 -8
  76. package/dist/admin/AdminParameters.js.map +1 -1
  77. package/dist/admin/AdminParametersEditorForm.d.ts +5 -0
  78. package/dist/admin/AdminParametersEditorForm.d.ts.map +1 -1
  79. package/dist/admin/AdminParametersEditorForm.js +8 -6
  80. package/dist/admin/AdminParametersEditorForm.js.map +1 -1
  81. package/dist/admin/AdminParametersEditorPane.d.ts +5 -0
  82. package/dist/admin/AdminParametersEditorPane.d.ts.map +1 -1
  83. package/dist/admin/AdminParametersEditorPane.js +7 -6
  84. package/dist/admin/AdminParametersEditorPane.js.map +1 -1
  85. package/dist/admin/AdminParametersHistoryPane.js +5 -5
  86. package/dist/admin/AdminParametersTreeFooterActions.js +3 -3
  87. package/dist/admin/AdminParametersTreeNodeView.js +5 -5
  88. package/dist/admin/AdminParametersTreeNodeView.js.map +1 -1
  89. package/dist/admin/AdminParametersTreePane.js +4 -4
  90. package/dist/admin/AdminPayments.js +4 -4
  91. package/dist/admin/AdminRouter.d.ts +12 -5
  92. package/dist/admin/AdminRouter.d.ts.map +1 -1
  93. package/dist/admin/AdminRouter.js +39 -10
  94. package/dist/admin/AdminRouter.js.map +1 -1
  95. package/dist/admin/AdminRouterOptions.js +1 -1
  96. package/dist/admin/AdminSessions.js +6 -6
  97. package/dist/admin/AdminStatTile.js +6 -6
  98. package/dist/admin/AdminStatTile.js.map +1 -1
  99. package/dist/admin/AdminStatTileDeltaChip.js +1 -1
  100. package/dist/admin/AdminUserAvatarControl.js +5 -5
  101. package/dist/admin/AdminUserCell.js +3 -3
  102. package/dist/admin/AdminUserDetail.js +10 -10
  103. package/dist/admin/AdminUserDetailAuditsTab.js +3 -3
  104. package/dist/admin/AdminUserDetailIdentityAside.js +4 -4
  105. package/dist/admin/AdminUserDetailOverviewTab.js +3 -3
  106. package/dist/admin/AdminUserDetailPasskeys.js +3 -3
  107. package/dist/admin/AdminUserDetailPasswordDialog.js +4 -4
  108. package/dist/admin/AdminUserDetailSecurityTab.js +4 -4
  109. package/dist/admin/AdminUserDetailSessionsTab.js +3 -3
  110. package/dist/admin/AdminUsers.js +10 -10
  111. package/dist/admin/AdminUsers.js.map +1 -1
  112. package/dist/admin/AdminUsersCreateDialog.js +5 -5
  113. package/dist/admin/AdminUsersRolesPicker.js +2 -2
  114. package/dist/admin/AdminUsersStatusBadge.js +1 -1
  115. package/dist/admin/AdminUsersTile.js +2 -2
  116. package/dist/admin/AdminWebhookDeliveries.js +6 -6
  117. package/dist/admin/AdminWebhookDeliveryDialog.js +5 -5
  118. package/dist/admin/AdminWebhookDetail.js +6 -6
  119. package/dist/admin/AdminWebhookDetailAside.js +3 -3
  120. package/dist/admin/AdminWebhookDetailOverview.js +6 -6
  121. package/dist/admin/AdminWebhooks.js +7 -7
  122. package/dist/admin/AdminWebhooksCreateDialog.js +6 -6
  123. package/dist/admin/AdminWebhooksSecretDialog.js +4 -4
  124. package/dist/admin/AdminWebhooksStatusBadge.js +3 -3
  125. package/dist/admin/ParameterDiffDialog.js +3 -3
  126. package/dist/admin/ParameterHistoryItem.js +5 -5
  127. package/dist/admin/ParameterJsonDialog.js +4 -4
  128. package/dist/admin/ParameterSaveDialog.js +5 -5
  129. package/dist/admin/adminAiMoney.d.ts +10 -0
  130. package/dist/admin/adminAiMoney.d.ts.map +1 -0
  131. package/dist/admin/adminAiMoney.js +21 -0
  132. package/dist/admin/adminAiMoney.js.map +1 -0
  133. package/dist/admin/adminParametersTree.d.ts +23 -2
  134. package/dist/admin/adminParametersTree.d.ts.map +1 -1
  135. package/dist/admin/adminParametersTree.js +36 -3
  136. package/dist/admin/adminParametersTree.js.map +1 -1
  137. package/dist/admin/analytics/AdvancedSection.js +3 -3
  138. package/dist/admin/analytics/AnalyticsChartBars.js +1 -1
  139. package/dist/admin/analytics/AnalyticsChartDonut.js +1 -1
  140. package/dist/admin/analytics/AnalyticsChartHeader.js +1 -1
  141. package/dist/admin/analytics/CoarsenedBadge.js +1 -1
  142. package/dist/admin/analytics/CompareNote.js +1 -1
  143. package/dist/admin/analytics/DatasetSelect.js +4 -4
  144. package/dist/admin/analytics/FilterEditor.js +3 -3
  145. package/dist/admin/analytics/FilterValuePicker.js +3 -3
  146. package/dist/admin/analytics/GroupByChips.js +1 -1
  147. package/dist/admin/analytics/MeasureChips.js +1 -1
  148. package/dist/admin/analytics/QueryPanel.js +1 -1
  149. package/dist/admin/analytics/RangeControl.js +3 -3
  150. package/dist/admin/analytics/RequestDialog.js +3 -3
  151. package/dist/admin/analytics/RequestDialog.js.map +1 -1
  152. package/dist/admin/analytics/ResultsPane.js +3 -3
  153. package/dist/admin/analytics/ResultsTable.d.ts.map +1 -1
  154. package/dist/admin/analytics/ResultsTable.js +3 -3
  155. package/dist/admin/analytics/ResultsTable.js.map +1 -1
  156. package/dist/admin/analytics/RunFooter.js +2 -2
  157. package/dist/admin/analytics/SamplingBadge.js +1 -1
  158. package/dist/admin/analytics/ToggleChip.js +1 -1
  159. package/dist/admin/analytics/TotalsCards.js +1 -1
  160. package/dist/admin/analytics/TruncationBanner.js +2 -2
  161. package/dist/admin/analytics/analyticsModel.d.ts +3 -1
  162. package/dist/admin/analytics/analyticsModel.d.ts.map +1 -1
  163. package/dist/admin/analytics/analyticsModel.js +13 -5
  164. package/dist/admin/analytics/analyticsModel.js.map +1 -1
  165. package/dist/admin/analytics/analyticsTypes.d.ts +1 -1
  166. package/dist/admin/analytics/analyticsTypes.d.ts.map +1 -1
  167. package/dist/admin/analytics/chartModel.d.ts.map +1 -1
  168. package/dist/admin/analytics/chartModel.js +2 -2
  169. package/dist/admin/analytics/chartModel.js.map +1 -1
  170. package/dist/admin/analytics/useAnalyticsQuery.js +2 -2
  171. package/dist/admin/analytics/useFilterValues.js +1 -1
  172. package/dist/admin/useAdminDetailTrail.js +2 -2
  173. package/dist/admin/useConfirmedAction.js +2 -2
  174. package/dist/ai/AiChat.d.ts +37 -5
  175. package/dist/ai/AiChat.d.ts.map +1 -1
  176. package/dist/ai/AiChat.js +107 -18
  177. package/dist/ai/AiChat.js.map +1 -1
  178. package/dist/ai/AiChatComposer.d.ts +9 -0
  179. package/dist/ai/AiChatComposer.d.ts.map +1 -1
  180. package/dist/ai/AiChatComposer.js +9 -4
  181. package/dist/ai/AiChatComposer.js.map +1 -1
  182. package/dist/ai/AiChatConfirmCard.d.ts +2 -2
  183. package/dist/ai/AiChatConfirmCard.d.ts.map +1 -1
  184. package/dist/ai/AiChatConfirmCard.js +20 -6
  185. package/dist/ai/AiChatConfirmCard.js.map +1 -1
  186. package/dist/ai/AiChatDock.js +3 -3
  187. package/dist/ai/AiChatEmpty.d.ts +5 -0
  188. package/dist/ai/AiChatEmpty.d.ts.map +1 -1
  189. package/dist/ai/AiChatEmpty.js +26 -30
  190. package/dist/ai/AiChatEmpty.js.map +1 -1
  191. package/dist/ai/AiChatFloat.d.ts +43 -0
  192. package/dist/ai/AiChatFloat.d.ts.map +1 -0
  193. package/dist/ai/AiChatFloat.js +66 -0
  194. package/dist/ai/AiChatFloat.js.map +1 -0
  195. package/dist/ai/AiChatHeaderButton.d.ts +14 -0
  196. package/dist/ai/AiChatHeaderButton.d.ts.map +1 -0
  197. package/dist/ai/AiChatHeaderButton.js +21 -0
  198. package/dist/ai/AiChatHeaderButton.js.map +1 -0
  199. package/dist/ai/AiChatHistory.d.ts.map +1 -1
  200. package/dist/ai/AiChatHistory.js +8 -6
  201. package/dist/ai/AiChatHistory.js.map +1 -1
  202. package/dist/ai/AiChatLauncher.d.ts +5 -0
  203. package/dist/ai/AiChatLauncher.d.ts.map +1 -1
  204. package/dist/ai/AiChatLauncher.js +3 -3
  205. package/dist/ai/AiChatLauncher.js.map +1 -1
  206. package/dist/ai/AiChatMessage.d.ts +6 -0
  207. package/dist/ai/AiChatMessage.d.ts.map +1 -1
  208. package/dist/ai/AiChatMessage.js +5 -5
  209. package/dist/ai/AiChatMessage.js.map +1 -1
  210. package/dist/ai/AiChatPanel.d.ts +65 -5
  211. package/dist/ai/AiChatPanel.d.ts.map +1 -1
  212. package/dist/ai/AiChatPanel.js +87 -41
  213. package/dist/ai/AiChatPanel.js.map +1 -1
  214. package/dist/ai/AiChatToolStepDetails.d.ts +14 -0
  215. package/dist/ai/AiChatToolStepDetails.d.ts.map +1 -0
  216. package/dist/ai/AiChatToolStepDetails.js +34 -0
  217. package/dist/ai/AiChatToolStepDetails.js.map +1 -0
  218. package/dist/ai/AiChatToolTrace.d.ts +63 -0
  219. package/dist/ai/AiChatToolTrace.d.ts.map +1 -0
  220. package/dist/ai/AiChatToolTrace.js +118 -0
  221. package/dist/ai/AiChatToolTrace.js.map +1 -0
  222. package/dist/ai/aiChatMotion.d.ts +24 -0
  223. package/dist/ai/aiChatMotion.d.ts.map +1 -0
  224. package/dist/ai/aiChatMotion.js +67 -0
  225. package/dist/ai/aiChatMotion.js.map +1 -0
  226. package/dist/ai/index.d.ts +6 -2
  227. package/dist/ai/index.d.ts.map +1 -1
  228. package/dist/ai/index.js +5 -1
  229. package/dist/ai/useAiChat.d.ts +11 -0
  230. package/dist/ai/useAiChat.d.ts.map +1 -1
  231. package/dist/ai/useAiChat.js +6 -4
  232. package/dist/ai/useAiChat.js.map +1 -1
  233. package/dist/ai/useAiChatFloatDrag.d.ts +23 -0
  234. package/dist/ai/useAiChatFloatDrag.d.ts.map +1 -0
  235. package/dist/ai/useAiChatFloatDrag.js +87 -0
  236. package/dist/ai/useAiChatFloatDrag.js.map +1 -0
  237. package/dist/ai/useAiContext.js +2 -2
  238. package/dist/auth/AuthLogin.d.ts.map +1 -1
  239. package/dist/auth/AuthLogin.js +18 -10
  240. package/dist/auth/AuthLogin.js.map +1 -1
  241. package/dist/auth/AuthLoginSlots.d.ts +53 -0
  242. package/dist/auth/AuthLoginSlots.d.ts.map +1 -0
  243. package/dist/auth/AuthLoginSlots.js +39 -0
  244. package/dist/auth/AuthLoginSlots.js.map +1 -0
  245. package/dist/auth/AuthMfaStep.js +7 -7
  246. package/dist/auth/AuthPasskeyAutofill.js +1 -1
  247. package/dist/auth/AuthRegister.js +9 -9
  248. package/dist/auth/AuthRegisterFormPhase.js +4 -4
  249. package/dist/auth/AuthRegisterPasswordRules.js +2 -2
  250. package/dist/auth/AuthResetPassword.js +10 -10
  251. package/dist/auth/AuthRouter.js +2 -2
  252. package/dist/auth/AuthVerifyEmail.js +2 -2
  253. package/dist/auth/AuthVerifyEmailStateful.js +3 -3
  254. package/dist/auth/AuthVerifyEmailView.js +4 -4
  255. package/dist/auth/TurnstileWidget.js +1 -1
  256. package/dist/auth/index.d.ts +1 -0
  257. package/dist/auth/index.d.ts.map +1 -1
  258. package/dist/auth/index.js +2 -1
  259. package/dist/auth/usePasskey.js +1 -1
  260. package/dist/calendar/Calendar.js +4 -4
  261. package/dist/chart/Chart.js +2 -2
  262. package/dist/command/Command.js +4 -4
  263. package/dist/core/Alert.js +2 -2
  264. package/dist/core/AlertDialog.js +2 -2
  265. package/dist/core/Avatar.js +2 -2
  266. package/dist/core/Badge.js +2 -2
  267. package/dist/core/BrandIcon.js +1 -1
  268. package/dist/core/Breadcrumb.js +3 -3
  269. package/dist/core/Button.d.ts.map +1 -1
  270. package/dist/core/Button.js +22 -6
  271. package/dist/core/Button.js.map +1 -1
  272. package/dist/core/ButtonGroup.js +2 -2
  273. package/dist/core/Card.js +1 -1
  274. package/dist/core/Checkbox.js +2 -2
  275. package/dist/core/Collapsible.js +2 -2
  276. package/dist/core/Combobox.d.ts.map +1 -1
  277. package/dist/core/Combobox.js +4 -4
  278. package/dist/core/Combobox.js.map +1 -1
  279. package/dist/core/ContextMenu.js +2 -2
  280. package/dist/core/Dialog.d.ts.map +1 -1
  281. package/dist/core/Dialog.js +4 -4
  282. package/dist/core/Dialog.js.map +1 -1
  283. package/dist/core/DirectionProvider.js +1 -1
  284. package/dist/core/Drawer.js +3 -3
  285. package/dist/core/DropdownMenu.js +2 -2
  286. package/dist/core/Empty.js +1 -1
  287. package/dist/core/HoverCard.js +1 -1
  288. package/dist/core/Input.js +2 -2
  289. package/dist/core/InputGroup.js +2 -2
  290. package/dist/core/Label.js +1 -1
  291. package/dist/core/Menubar.js +4 -4
  292. package/dist/core/PageOutline.d.ts +9 -1
  293. package/dist/core/PageOutline.d.ts.map +1 -1
  294. package/dist/core/PageOutline.js +25 -6
  295. package/dist/core/PageOutline.js.map +1 -1
  296. package/dist/core/Pagination.js +2 -2
  297. package/dist/core/PaneRail.js +1 -1
  298. package/dist/core/Popover.js +2 -2
  299. package/dist/core/Progress.js +1 -1
  300. package/dist/core/Segmented.d.ts +11 -1
  301. package/dist/core/Segmented.d.ts.map +1 -1
  302. package/dist/core/Segmented.js +8 -5
  303. package/dist/core/Segmented.js.map +1 -1
  304. package/dist/core/Separator.js +1 -1
  305. package/dist/core/Sheet.js +3 -3
  306. package/dist/core/Sidebar.js +7 -7
  307. package/dist/core/Slider.js +3 -3
  308. package/dist/core/Spinner.js +1 -1
  309. package/dist/core/Stepper.js +1 -1
  310. package/dist/core/Switch.js +1 -1
  311. package/dist/core/Table.js +1 -1
  312. package/dist/core/Textarea.js +1 -1
  313. package/dist/core/TimeAgo.d.ts +12 -5
  314. package/dist/core/TimeAgo.d.ts.map +1 -1
  315. package/dist/core/TimeAgo.js +18 -7
  316. package/dist/core/TimeAgo.js.map +1 -1
  317. package/dist/core/Toaster.js +2 -2
  318. package/dist/core/Tooltip.js +1 -1
  319. package/dist/core/UserAvatar.js +3 -3
  320. package/dist/core/index.d.ts +0 -1
  321. package/dist/core/index.d.ts.map +1 -1
  322. package/dist/core/index.js +1 -2
  323. package/dist/core/useDialog.js +5 -5
  324. package/dist/core/useUndoable.js +1 -1
  325. package/dist/form/AutoForm.js +6 -6
  326. package/dist/form/AutoFormBottomBar.js +4 -4
  327. package/dist/form/AutoFormErrorPopover.js +4 -4
  328. package/dist/form/AutoFormGroupBlock.js +3 -3
  329. package/dist/form/AutoFormGroupGridField.js +2 -2
  330. package/dist/form/Control.d.ts +4 -0
  331. package/dist/form/Control.d.ts.map +1 -1
  332. package/dist/form/Control.js +9 -8
  333. package/dist/form/Control.js.map +1 -1
  334. package/dist/form/ControlArray.js +7 -7
  335. package/dist/form/ControlDate.js +6 -6
  336. package/dist/form/ControlDatePopover.js +4 -4
  337. package/dist/form/ControlDateRange.js +5 -5
  338. package/dist/form/ControlMonthPopover.js +4 -4
  339. package/dist/form/ControlNumber.js +3 -3
  340. package/dist/form/ControlObject.js +7 -7
  341. package/dist/form/ControlPassword.js +3 -3
  342. package/dist/form/ControlSelect.d.ts +12 -0
  343. package/dist/form/ControlSelect.d.ts.map +1 -1
  344. package/dist/form/ControlSelect.js +13 -7
  345. package/dist/form/ControlSelect.js.map +1 -1
  346. package/dist/form/ControlSelectCombobox.js +4 -4
  347. package/dist/form/ControlUpload.d.ts.map +1 -1
  348. package/dist/form/ControlUpload.js +11 -10
  349. package/dist/form/ControlUpload.js.map +1 -1
  350. package/dist/form/ControlUploadItemThumb.js +1 -1
  351. package/dist/form/FormField.js +2 -2
  352. package/dist/form/FormFieldDescriptionTip.js +1 -1
  353. package/dist/form/fieldTrigger.js +3 -3
  354. package/dist/form/iconHint.js +1 -1
  355. package/dist/form/useFieldErrorText.js +1 -1
  356. package/dist/i18n/en/index.d.ts +22 -0
  357. package/dist/i18n/en/index.d.ts.map +1 -0
  358. package/dist/i18n/en/index.js +1 -0
  359. package/dist/i18n/en/uiEn.d.ts +37 -0
  360. package/dist/i18n/en/uiEn.d.ts.map +1 -0
  361. package/dist/i18n/en/uiEn.js +1497 -0
  362. package/dist/i18n/en/uiEn.js.map +1 -0
  363. package/dist/i18n/fr/uiFr.d.ts +3 -2
  364. package/dist/i18n/fr/uiFr.d.ts.map +1 -1
  365. package/dist/i18n/fr/uiFr.js +38 -4
  366. package/dist/i18n/fr/uiFr.js.map +1 -1
  367. package/dist/markdown/MarkdownView.d.ts +23 -0
  368. package/dist/markdown/MarkdownView.d.ts.map +1 -1
  369. package/dist/markdown/MarkdownView.js +29 -10
  370. package/dist/markdown/MarkdownView.js.map +1 -1
  371. package/dist/markdown/diagram/DiagramLabel.js +1 -1
  372. package/dist/markdown/diagram/FlowchartDiagram.js +2 -2
  373. package/dist/markdown/diagram/FlowchartDiagramCluster.js +2 -2
  374. package/dist/markdown/diagram/FlowchartDiagramEdge.js +1 -1
  375. package/dist/markdown/diagram/FlowchartDiagramNode.js +1 -1
  376. package/dist/markdown/diagram/MermaidFence.js +2 -2
  377. package/dist/markdown/diagram/SequenceDiagram.js +2 -2
  378. package/dist/markdown/diagram/SequenceDiagramFragment.js +2 -2
  379. package/dist/markdown/diagram/SequenceDiagramMessage.js +1 -1
  380. package/dist/markdown/diagram/SequenceDiagramNote.js +1 -1
  381. package/dist/markdown/diagram/SequenceDiagramParticipant.js +2 -2
  382. package/dist/markdown/diagram/SequenceDiagramParticipantActor.js +2 -2
  383. package/dist/markdown/diagram/layoutFlowchart.js +1 -1
  384. package/dist/markdown/highlightLines.d.ts +27 -0
  385. package/dist/markdown/highlightLines.d.ts.map +1 -0
  386. package/dist/markdown/highlightLines.js +91 -0
  387. package/dist/markdown/highlightLines.js.map +1 -0
  388. package/dist/markdown/index.d.ts +5 -2
  389. package/dist/markdown/index.d.ts.map +1 -1
  390. package/dist/markdown/index.js +2 -1
  391. package/dist/organizations/MyOrganizationInvitations.d.ts.map +1 -1
  392. package/dist/organizations/MyOrganizationInvitations.js +13 -5
  393. package/dist/organizations/MyOrganizationInvitations.js.map +1 -1
  394. package/dist/organizations/MyOrganizations.d.ts.map +1 -1
  395. package/dist/organizations/MyOrganizations.js +15 -5
  396. package/dist/organizations/MyOrganizations.js.map +1 -1
  397. package/dist/organizations/OrganizationInviteDialog.js +6 -6
  398. package/dist/organizations/OrganizationInviteDialog.js.map +1 -1
  399. package/dist/organizations/OrganizationMemberRankPicker.js +5 -5
  400. package/dist/organizations/OrganizationMembers.d.ts.map +1 -1
  401. package/dist/organizations/OrganizationMembers.js +12 -6
  402. package/dist/organizations/OrganizationMembers.js.map +1 -1
  403. package/dist/organizations/OrganizationPendingInvitations.d.ts.map +1 -1
  404. package/dist/organizations/OrganizationPendingInvitations.js +9 -4
  405. package/dist/organizations/OrganizationPendingInvitations.js.map +1 -1
  406. package/dist/organizations/OrganizationRankColumnHeader.js +2 -2
  407. package/dist/organizations/OrganizationRanks.d.ts.map +1 -1
  408. package/dist/organizations/OrganizationRanks.js +7 -5
  409. package/dist/organizations/OrganizationRanks.js.map +1 -1
  410. package/dist/organizations/OrganizationTransferOwnershipDialog.js +5 -5
  411. package/dist/organizations/OrganizationTransferOwnershipDialog.js.map +1 -1
  412. package/dist/organizations/useInviteOrganizationMember.js +1 -1
  413. package/dist/organizations/useRevokeOrganizationInvitation.js +2 -2
  414. package/dist/otp/InputOTP.js +2 -2
  415. package/dist/resizable/Resizable.js +1 -1
  416. package/dist/settings/$settingsDialog.js +1 -1
  417. package/dist/settings/$settingsSection.js +1 -1
  418. package/dist/settings/SettingsDangerSection.js +1 -1
  419. package/dist/settings/SettingsDialog.js +6 -6
  420. package/dist/settings/SettingsDialogHost.js +3 -3
  421. package/dist/settings/SettingsDialogs.js +2 -2
  422. package/dist/settings/useSettingsDialog.js +2 -2
  423. package/dist/shell/ActionErrorToaster.js +2 -2
  424. package/dist/shell/AppActions.js +1 -1
  425. package/dist/shell/AppShell.js +4 -4
  426. package/dist/shell/AppShellNavCollapse.js +1 -1
  427. package/dist/shell/AppShellNavDropdownItems.js +5 -5
  428. package/dist/shell/AppShellNavDropdownItems.js.map +1 -1
  429. package/dist/shell/AppShellSidebarNavItem.js +7 -7
  430. package/dist/shell/AppShellSidebarNavItem.js.map +1 -1
  431. package/dist/shell/AppShellStatefulSidebarTrigger.js +4 -4
  432. package/dist/shell/ButtonDark.js +3 -3
  433. package/dist/shell/ButtonInbox.d.ts +8 -0
  434. package/dist/shell/ButtonInbox.d.ts.map +1 -1
  435. package/dist/shell/ButtonInbox.js +8 -6
  436. package/dist/shell/ButtonInbox.js.map +1 -1
  437. package/dist/shell/ButtonLanguage.js +4 -4
  438. package/dist/shell/ButtonSettings.js +5 -5
  439. package/dist/shell/ButtonSettingsColorModeMenu.js +2 -2
  440. package/dist/shell/ButtonSettingsLanguageMenu.js +3 -3
  441. package/dist/shell/ButtonSettingsThemeMenu.js +4 -4
  442. package/dist/shell/ButtonSettingsVisionMenuItem.js +2 -2
  443. package/dist/shell/ButtonTheme.js +5 -5
  444. package/dist/shell/ButtonUser.js +1 -1
  445. package/dist/shell/ButtonUserAccountMenuItem.js +3 -3
  446. package/dist/shell/ButtonUserAdminMenuItem.js +4 -4
  447. package/dist/shell/ButtonUserAdminMenuItem.js.map +1 -1
  448. package/dist/shell/ButtonUserContent.js +5 -5
  449. package/dist/shell/ButtonUserDefaultMenu.js +2 -2
  450. package/dist/shell/ButtonUserLogoutMenuItem.js +2 -2
  451. package/dist/shell/ButtonVision.js +3 -3
  452. package/dist/shell/DetailAside.js +4 -4
  453. package/dist/shell/DetailLayout.d.ts +3 -1
  454. package/dist/shell/DetailLayout.d.ts.map +1 -1
  455. package/dist/shell/DetailLayout.js +29 -17
  456. package/dist/shell/DetailLayout.js.map +1 -1
  457. package/dist/shell/DetailLayoutTabMenu.d.ts +19 -0
  458. package/dist/shell/DetailLayoutTabMenu.d.ts.map +1 -0
  459. package/dist/shell/DetailLayoutTabMenu.js +65 -0
  460. package/dist/shell/DetailLayoutTabMenu.js.map +1 -0
  461. package/dist/shell/NavShell.js +2 -2
  462. package/dist/shell/PlateFolderTabs.js +1 -1
  463. package/dist/shell/PlateLayout.d.ts.map +1 -1
  464. package/dist/shell/PlateLayout.js +2 -2
  465. package/dist/shell/PlateLayout.js.map +1 -1
  466. package/dist/shell/PlateTabBar.js +1 -1
  467. package/dist/shell/SidebarBackHeader.js +3 -3
  468. package/dist/shell/SidebarBackHeader.js.map +1 -1
  469. package/dist/shell/SidebarNavAutoClose.js +1 -1
  470. package/dist/shell/Spotlight.js +3 -3
  471. package/dist/shell/useDetailTab.js +1 -1
  472. package/dist/shell/useNavBreadcrumbs.js +3 -3
  473. package/dist/shell/useNavCrumbs.js +1 -1
  474. package/dist/shell/useNavEntries.js +3 -3
  475. package/dist/shell/useNavTree.js +1 -1
  476. package/dist/sortable/index.d.ts +17 -0
  477. package/dist/sortable/index.d.ts.map +1 -0
  478. package/dist/sortable/index.js +4 -0
  479. package/dist/sortable/useSortableItem.d.ts +32 -0
  480. package/dist/sortable/useSortableItem.d.ts.map +1 -0
  481. package/dist/sortable/useSortableItem.js +35 -0
  482. package/dist/sortable/useSortableItem.js.map +1 -0
  483. package/dist/sortable/useSortableList.d.ts +85 -0
  484. package/dist/sortable/useSortableList.d.ts.map +1 -0
  485. package/dist/sortable/useSortableList.js +125 -0
  486. package/dist/sortable/useSortableList.js.map +1 -0
  487. package/dist/styles.css +43 -0
  488. package/dist/swagger/SwaggerAccessBadge.js +1 -1
  489. package/dist/swagger/SwaggerAlephaMeta.js +1 -1
  490. package/dist/swagger/SwaggerCredentials.js +3 -3
  491. package/dist/swagger/SwaggerExplorer.js +5 -5
  492. package/dist/swagger/SwaggerNav.js +2 -2
  493. package/dist/swagger/SwaggerOperationView.js +2 -2
  494. package/dist/swagger/SwaggerResponseView.js +2 -2
  495. package/dist/swagger/SwaggerResponses.js +1 -1
  496. package/dist/swagger/SwaggerSchemaView.js +1 -1
  497. package/dist/swagger/SwaggerTryIt.js +2 -2
  498. package/dist/swagger/SwaggerTryItForm.js +3 -3
  499. package/dist/swagger/useSwaggerAccess.js +2 -2
  500. package/dist/table/DataTable.d.ts.map +1 -1
  501. package/dist/table/DataTable.js +53 -15
  502. package/dist/table/DataTable.js.map +1 -1
  503. package/dist/table/DataTableBody.d.ts +10 -0
  504. package/dist/table/DataTableBody.d.ts.map +1 -1
  505. package/dist/table/DataTableBody.js +32 -10
  506. package/dist/table/DataTableBody.js.map +1 -1
  507. package/dist/table/DataTableBulkBar.d.ts.map +1 -1
  508. package/dist/table/DataTableBulkBar.js +5 -4
  509. package/dist/table/DataTableBulkBar.js.map +1 -1
  510. package/dist/table/DataTableBulkMenu.js +2 -2
  511. package/dist/table/DataTableColumnPicker.js +3 -3
  512. package/dist/table/DataTableCompactPager.js +2 -2
  513. package/dist/table/DataTableFilterAdd.js +2 -2
  514. package/dist/table/DataTableFilterBar.js +2 -2
  515. package/dist/table/DataTableFilterControl.js +2 -2
  516. package/dist/table/DataTableFilterDialog.js +3 -3
  517. package/dist/table/DataTableFilterMenu.js +2 -2
  518. package/dist/table/DataTableFooter.d.ts +5 -1
  519. package/dist/table/DataTableFooter.d.ts.map +1 -1
  520. package/dist/table/DataTableFooter.js +27 -23
  521. package/dist/table/DataTableFooter.js.map +1 -1
  522. package/dist/table/DataTableGroupRow.js +1 -1
  523. package/dist/table/DataTableHeaderFilter.js +3 -3
  524. package/dist/table/DataTableHeaderPopup.js +3 -3
  525. package/dist/table/DataTableHeaderPopupChevron.js +1 -1
  526. package/dist/table/DataTableHeaderPopupFilter.js +1 -1
  527. package/dist/table/DataTableHeaderPopupList.js +1 -1
  528. package/dist/table/DataTableHeaderPopupRange.js +3 -3
  529. package/dist/table/DataTableHeaderRow.js +3 -3
  530. package/dist/table/DataTableHelpButton.js +2 -2
  531. package/dist/table/DataTableKeyHints.d.ts +11 -0
  532. package/dist/table/DataTableKeyHints.d.ts.map +1 -0
  533. package/dist/table/DataTableKeyHints.js +23 -0
  534. package/dist/table/DataTableKeyHints.js.map +1 -0
  535. package/dist/table/DataTablePresetRail.js +4 -4
  536. package/dist/table/DataTableRowActionGroupItem.d.ts +23 -0
  537. package/dist/table/DataTableRowActionGroupItem.d.ts.map +1 -0
  538. package/dist/table/DataTableRowActionGroupItem.js +38 -0
  539. package/dist/table/DataTableRowActionGroupItem.js.map +1 -0
  540. package/dist/table/DataTableRowActionItem.d.ts.map +1 -1
  541. package/dist/table/DataTableRowActionItem.js +15 -2
  542. package/dist/table/DataTableRowActionItem.js.map +1 -1
  543. package/dist/table/DataTableRowActionPrimary.d.ts +20 -0
  544. package/dist/table/DataTableRowActionPrimary.d.ts.map +1 -0
  545. package/dist/table/DataTableRowActionPrimary.js +42 -0
  546. package/dist/table/DataTableRowActionPrimary.js.map +1 -0
  547. package/dist/table/DataTableRowActionsInline.d.ts +3 -2
  548. package/dist/table/DataTableRowActionsInline.d.ts.map +1 -1
  549. package/dist/table/DataTableRowActionsInline.js +35 -23
  550. package/dist/table/DataTableRowActionsInline.js.map +1 -1
  551. package/dist/table/DataTableRowActionsMenu.d.ts +3 -2
  552. package/dist/table/DataTableRowActionsMenu.d.ts.map +1 -1
  553. package/dist/table/DataTableRowActionsMenu.js +14 -16
  554. package/dist/table/DataTableRowActionsMenu.js.map +1 -1
  555. package/dist/table/DataTableSortMenuButton.d.ts +15 -0
  556. package/dist/table/DataTableSortMenuButton.d.ts.map +1 -0
  557. package/dist/table/DataTableSortMenuButton.js +62 -0
  558. package/dist/table/DataTableSortMenuButton.js.map +1 -0
  559. package/dist/table/DataTableSummaryPanel.js +2 -2
  560. package/dist/table/DataTableToolbar.d.ts +4 -0
  561. package/dist/table/DataTableToolbar.d.ts.map +1 -1
  562. package/dist/table/DataTableToolbar.js +8 -2
  563. package/dist/table/DataTableToolbar.js.map +1 -1
  564. package/dist/table/PermissionMatrixGroupRows.js +1 -1
  565. package/dist/table/dataTableBaseProps.d.ts +93 -3
  566. package/dist/table/dataTableBaseProps.d.ts.map +1 -1
  567. package/dist/table/dataTableFilterFields.js +1 -1
  568. package/dist/table/dataTablePersistence.d.ts +53 -11
  569. package/dist/table/dataTablePersistence.d.ts.map +1 -1
  570. package/dist/table/dataTablePersistence.js +66 -29
  571. package/dist/table/dataTablePersistence.js.map +1 -1
  572. package/dist/table/dataTablePriority.d.ts +16 -0
  573. package/dist/table/dataTablePriority.d.ts.map +1 -0
  574. package/dist/table/dataTablePriority.js +31 -0
  575. package/dist/table/dataTablePriority.js.map +1 -0
  576. package/dist/table/dataTableTypes.d.ts +155 -3
  577. package/dist/table/dataTableTypes.d.ts.map +1 -1
  578. package/dist/table/index.d.ts +10 -2
  579. package/dist/table/index.d.ts.map +1 -1
  580. package/dist/table/index.js +3 -1
  581. package/dist/table/useDataTableColumns.d.ts.map +1 -1
  582. package/dist/table/useDataTableColumns.js +5 -5
  583. package/dist/table/useDataTableColumns.js.map +1 -1
  584. package/dist/table/useDataTableData.d.ts +1 -0
  585. package/dist/table/useDataTableData.d.ts.map +1 -1
  586. package/dist/table/useDataTableData.js +10 -9
  587. package/dist/table/useDataTableData.js.map +1 -1
  588. package/dist/table/useDataTableFilterForm.d.ts.map +1 -1
  589. package/dist/table/useDataTableFilterForm.js +9 -5
  590. package/dist/table/useDataTableFilterForm.js.map +1 -1
  591. package/dist/table/useDataTableFilterModel.d.ts +1 -0
  592. package/dist/table/useDataTableFilterModel.d.ts.map +1 -1
  593. package/dist/table/useDataTableFilterModel.js +4 -4
  594. package/dist/table/useDataTableFilterVisibility.d.ts +5 -0
  595. package/dist/table/useDataTableFilterVisibility.d.ts.map +1 -1
  596. package/dist/table/useDataTableFilterVisibility.js +17 -9
  597. package/dist/table/useDataTableFilterVisibility.js.map +1 -1
  598. package/dist/table/useDataTableKeyboard.d.ts +58 -0
  599. package/dist/table/useDataTableKeyboard.d.ts.map +1 -0
  600. package/dist/table/useDataTableKeyboard.js +157 -0
  601. package/dist/table/useDataTableKeyboard.js.map +1 -0
  602. package/dist/table/useDataTableRefresh.d.ts.map +1 -1
  603. package/dist/table/useDataTableRefresh.js +4 -3
  604. package/dist/table/useDataTableRefresh.js.map +1 -1
  605. package/dist/table/useDataTableSummary.d.ts +5 -0
  606. package/dist/table/useDataTableSummary.d.ts.map +1 -1
  607. package/dist/table/useDataTableSummary.js +7 -7
  608. package/dist/table/useDataTableSummary.js.map +1 -1
  609. package/dist/table/useDataTableWake.js +1 -1
  610. package/dist/table/useElementWidth.d.ts +10 -0
  611. package/dist/table/useElementWidth.d.ts.map +1 -0
  612. package/dist/table/useElementWidth.js +29 -0
  613. package/dist/table/useElementWidth.js.map +1 -0
  614. package/dist/tree/TreeView.js +1 -1
  615. package/dist/tree/TreeViewRow.d.ts.map +1 -1
  616. package/dist/tree/TreeViewRow.js +3 -3
  617. package/dist/tree/TreeViewRow.js.map +1 -1
  618. package/docs/packages-alepha-ui-ai.md +4 -3
  619. package/docs/packages-alepha-ui-i18n-en.md +35 -0
  620. package/docs/packages-alepha-ui-markdown.md +3 -1
  621. package/docs/packages-alepha-ui-overview.md +4 -2
  622. package/docs/packages-alepha-ui-sortable.md +34 -0
  623. package/docs/packages-alepha-ui-table.md +7 -1
  624. package/package.json +28 -10
  625. package/src/account/AccountDeleteDialog.tsx +2 -1
  626. package/src/account/AccountPasswordDialog.tsx +1 -1
  627. package/src/account/AccountProfileView.tsx +2 -1
  628. package/src/account/ApiKeyCreateDialog.tsx +1 -1
  629. package/src/account/__tests__/AccountProfile.browser.spec.tsx +21 -5
  630. package/src/admin/AdminAi.tsx +231 -0
  631. package/src/admin/AdminAiDailyChart.tsx +93 -0
  632. package/src/admin/AdminAiUsageTable.tsx +115 -0
  633. package/src/admin/AdminFiles.tsx +4 -6
  634. package/src/admin/AdminJobExecutionSheet.tsx +9 -0
  635. package/src/admin/AdminParameters.tsx +13 -2
  636. package/src/admin/AdminParametersEditorForm.tsx +9 -4
  637. package/src/admin/AdminParametersEditorPane.tsx +6 -0
  638. package/src/admin/AdminParametersTreeNodeView.tsx +1 -1
  639. package/src/admin/AdminRouter.tsx +31 -5
  640. package/src/admin/__tests__/AdminAiDailyChart.browser.spec.tsx +57 -0
  641. package/src/admin/__tests__/AdminRouter.spec.ts +5 -2
  642. package/src/admin/adminAiMoney.ts +20 -0
  643. package/src/admin/adminParametersTree.spec.ts +132 -0
  644. package/src/admin/adminParametersTree.ts +54 -2
  645. package/src/admin/analytics/RequestDialog.tsx +1 -1
  646. package/src/admin/analytics/ResultsTable.tsx +3 -1
  647. package/src/admin/analytics/analyticsModel.spec.ts +61 -2
  648. package/src/admin/analytics/analyticsModel.ts +29 -14
  649. package/src/admin/analytics/analyticsTypes.ts +1 -1
  650. package/src/admin/analytics/chartModel.ts +6 -2
  651. package/src/ai/AiChat.tsx +182 -20
  652. package/src/ai/AiChatComposer.tsx +26 -2
  653. package/src/ai/AiChatConfirmCard.tsx +22 -5
  654. package/src/ai/AiChatEmpty.tsx +24 -11
  655. package/src/ai/AiChatFloat.tsx +136 -0
  656. package/src/ai/AiChatHeaderButton.tsx +36 -0
  657. package/src/ai/AiChatHistory.tsx +22 -12
  658. package/src/ai/AiChatLauncher.tsx +6 -1
  659. package/src/ai/AiChatMessage.tsx +18 -3
  660. package/src/ai/AiChatPanel.tsx +236 -74
  661. package/src/ai/AiChatToolStepDetails.tsx +42 -0
  662. package/src/ai/AiChatToolTrace.tsx +213 -0
  663. package/src/ai/__tests__/AiChat.browser.spec.tsx +771 -4
  664. package/src/ai/aiChatMotion.ts +86 -0
  665. package/src/ai/index.ts +6 -2
  666. package/src/ai/useAiChat.ts +13 -0
  667. package/src/ai/useAiChatFloatDrag.ts +131 -0
  668. package/src/auth/AuthLogin.tsx +26 -1
  669. package/src/auth/AuthLoginSlots.ts +55 -0
  670. package/src/auth/__tests__/AuthLoginSlots.browser.spec.tsx +93 -0
  671. package/src/auth/index.ts +1 -0
  672. package/src/core/Button.tsx +26 -1
  673. package/src/core/Combobox.tsx +3 -1
  674. package/src/core/Dialog.tsx +13 -2
  675. package/src/core/PageOutline.tsx +28 -4
  676. package/src/core/Segmented.tsx +27 -5
  677. package/src/core/TimeAgo.browser.spec.tsx +49 -4
  678. package/src/core/TimeAgo.tsx +19 -8
  679. package/src/core/__tests__/Button.browser.spec.tsx +57 -0
  680. package/src/core/__tests__/CoreA11y.browser.spec.tsx +1 -10
  681. package/src/core/__tests__/PageOutline.browser.spec.tsx +20 -0
  682. package/src/core/__tests__/Segmented.browser.spec.tsx +59 -1
  683. package/src/core/__tests__/Textarea.browser.spec.tsx +1 -0
  684. package/src/core/__tests__/primitiveSlots.spec.ts +0 -1
  685. package/src/core/index.ts +0 -11
  686. package/src/form/Control.tsx +5 -0
  687. package/src/form/ControlSelect.tsx +31 -3
  688. package/src/form/ControlUpload.tsx +11 -16
  689. package/src/form/__tests__/ControlChoices.browser.spec.tsx +42 -0
  690. package/src/form/__tests__/ControlSelectLongLabelDialog.browser.spec.tsx +105 -0
  691. package/src/form/__tests__/ControlUpload.browser.spec.tsx +24 -0
  692. package/src/i18n/en/__tests__/uiEn.spec.ts +110 -0
  693. package/src/i18n/en/index.ts +22 -0
  694. package/src/i18n/en/uiEn.ts +1678 -0
  695. package/src/i18n/fr/uiFr.ts +40 -4
  696. package/src/markdown/MarkdownView.tsx +51 -6
  697. package/src/markdown/__tests__/MarkdownViewLink.browser.spec.tsx +33 -0
  698. package/src/markdown/__tests__/highlightLines.spec.ts +45 -0
  699. package/src/markdown/highlightLines.ts +120 -0
  700. package/src/markdown/index.ts +14 -2
  701. package/src/organizations/MyOrganizationInvitations.tsx +11 -2
  702. package/src/organizations/MyOrganizations.tsx +24 -3
  703. package/src/organizations/OrganizationInviteDialog.tsx +1 -1
  704. package/src/organizations/OrganizationMembers.tsx +10 -1
  705. package/src/organizations/OrganizationPendingInvitations.tsx +6 -0
  706. package/src/organizations/OrganizationRanks.tsx +2 -0
  707. package/src/organizations/OrganizationTransferOwnershipDialog.tsx +1 -1
  708. package/src/organizations/__tests__/MyOrganizations.browser.spec.tsx +2 -1
  709. package/src/shell/ButtonInbox.tsx +11 -1
  710. package/src/shell/DetailLayout.tsx +27 -5
  711. package/src/shell/DetailLayoutTabMenu.tsx +89 -0
  712. package/src/shell/PlateLayout.tsx +18 -9
  713. package/src/shell/__tests__/ButtonInbox.browser.spec.tsx +40 -0
  714. package/src/shell/__tests__/DetailLayout.browser.spec.tsx +36 -1
  715. package/src/shell/__tests__/PlateLayout.browser.spec.tsx +19 -2
  716. package/src/sortable/__tests__/useSortableList.browser.spec.tsx +157 -0
  717. package/src/sortable/index.ts +22 -0
  718. package/src/sortable/useSortableItem.ts +65 -0
  719. package/src/sortable/useSortableList.ts +231 -0
  720. package/src/styles.css +43 -0
  721. package/src/table/DataTable.tsx +73 -7
  722. package/src/table/DataTableBody.tsx +48 -6
  723. package/src/table/DataTableBulkBar.tsx +3 -6
  724. package/src/table/DataTableFooter.tsx +6 -1
  725. package/src/table/DataTableKeyHints.tsx +40 -0
  726. package/src/table/DataTableRowActionGroupItem.tsx +75 -0
  727. package/src/table/DataTableRowActionItem.tsx +6 -0
  728. package/src/table/DataTableRowActionPrimary.tsx +52 -0
  729. package/src/table/DataTableRowActionsInline.tsx +19 -3
  730. package/src/table/DataTableRowActionsMenu.tsx +33 -49
  731. package/src/table/DataTableSortMenuButton.tsx +105 -0
  732. package/src/table/DataTableToolbar.tsx +9 -0
  733. package/src/table/__tests__/DataTableColumnPriority.browser.spec.tsx +147 -0
  734. package/src/table/__tests__/DataTableDenseHeader.browser.spec.tsx +92 -0
  735. package/src/table/__tests__/DataTableKeyboard.browser.spec.tsx +216 -0
  736. package/src/table/__tests__/DataTablePersistenceStorage.browser.spec.tsx +204 -0
  737. package/src/table/__tests__/DataTableRowActionGroup.browser.spec.tsx +118 -1
  738. package/src/table/__tests__/DataTableRowActionPrimary.browser.spec.tsx +126 -0
  739. package/src/table/__tests__/DataTableSortMenu.browser.spec.tsx +126 -0
  740. package/src/table/__tests__/DataTableStaticLoading.browser.spec.tsx +80 -0
  741. package/src/table/dataTableBaseProps.ts +94 -2
  742. package/src/table/dataTablePersistence.ts +118 -32
  743. package/src/table/dataTablePriority.ts +34 -0
  744. package/src/table/dataTableTypes.ts +159 -3
  745. package/src/table/index.ts +19 -1
  746. package/src/table/useDataTableColumns.ts +9 -4
  747. package/src/table/useDataTableData.ts +13 -4
  748. package/src/table/useDataTableFilterForm.ts +6 -2
  749. package/src/table/useDataTableFilterVisibility.ts +20 -7
  750. package/src/table/useDataTableKeyboard.ts +231 -0
  751. package/src/table/useDataTableRefresh.ts +4 -2
  752. package/src/table/useDataTableSummary.ts +25 -8
  753. package/src/table/useElementWidth.ts +35 -0
  754. package/src/tree/TreeViewRow.tsx +4 -12
  755. package/src/tree/__tests__/TreeView.browser.spec.tsx +27 -12
  756. package/dist/core/Tabs.d.ts +0 -15
  757. package/dist/core/Tabs.d.ts.map +0 -1
  758. package/dist/core/Tabs.js +0 -50
  759. package/dist/core/Tabs.js.map +0 -1
  760. package/src/core/Tabs.tsx +0 -86
  761. package/src/core/__tests__/Tabs.browser.spec.tsx +0 -23
@@ -1,5 +1,5 @@
1
- import { cn } from "./utils.js";
2
1
  import { useEffect, useRef, useState } from "react";
2
+ import { cn } from "./utils.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  // src/core/PageOutline.tsx
5
5
  /**
@@ -10,8 +10,16 @@ import { jsx, jsxs } from "react/jsx-runtime";
10
10
  * is the label; leave it empty and the outline reads the text of the first
11
11
  * descendant marked `data-outline-label` instead, which is how a section whose
12
12
  * title is a ReactNode still gets a plain-text entry.
13
+ *
14
+ * `level` nests the entry under the one above it, for a page whose sections
15
+ * have subsections: 1 (the default) is flush with the rail, 2 is indented
16
+ * once, 3 twice. A Markdown page passes its heading depth minus one, so an
17
+ * `h2` sits at 1 and an `h3` under it at 2.
13
18
  */
14
- const outlineEntry = (label) => ({ "data-outline": label ?? "" });
19
+ const outlineEntry = (label, options) => ({
20
+ "data-outline": label ?? "",
21
+ ...options?.level && options.level > 1 ? { "data-outline-level": String(options.level) } : {}
22
+ });
15
23
  /**
16
24
  * Brings `target` to the top of the box that actually scrolls it, and moves
17
25
  * nothing else.
@@ -40,6 +48,12 @@ const scrollToEntry = (target, behavior) => {
40
48
  behavior
41
49
  });
42
50
  };
51
+ /** The indent of a nested entry, one step per level below the first. */
52
+ const levelIndent = {
53
+ 1: "pl-3",
54
+ 2: "pl-6",
55
+ 3: "pl-9"
56
+ };
43
57
  /**
44
58
  * A page with an "on this page" rail floating to the right of its content.
45
59
  *
@@ -99,9 +113,10 @@ const PageOutline = (props) => {
99
113
  const collect = () => {
100
114
  const next = Array.from(root.querySelectorAll("[data-outline][id]")).map((el) => ({
101
115
  id: el.id,
102
- label: el.dataset.outline || el.querySelector("[data-outline-label]")?.textContent?.trim() || el.id
116
+ label: el.dataset.outline || el.querySelector("[data-outline-label]")?.textContent?.trim() || el.id,
117
+ level: Math.min(3, Math.max(1, Number(el.dataset.outlineLevel) || 1))
103
118
  }));
104
- setItems((prev) => prev.length === next.length && prev.every((p, i) => p.id === next[i].id && p.label === next[i].label) ? prev : next);
119
+ setItems((prev) => prev.length === next.length && prev.every((p, i) => p.id === next[i].id && p.label === next[i].label && p.level === next[i].level) ? prev : next);
105
120
  settleHash();
106
121
  };
107
122
  collect();
@@ -110,7 +125,11 @@ const PageOutline = (props) => {
110
125
  childList: true,
111
126
  subtree: true,
112
127
  characterData: true,
113
- attributeFilter: ["id", "data-outline"]
128
+ attributeFilter: [
129
+ "id",
130
+ "data-outline",
131
+ "data-outline-level"
132
+ ]
114
133
  });
115
134
  const resizes = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(settleHash);
116
135
  resizes?.observe(root);
@@ -202,7 +221,7 @@ const PageOutline = (props) => {
202
221
  href: `#${item.id}`,
203
222
  onClick: (event) => onClick(event, item.id),
204
223
  "aria-current": active ? "location" : void 0,
205
- className: cn("-ml-px block border-l py-1 pl-3 text-sm transition-colors", active ? "border-primary text-foreground" : "text-muted-foreground hover:text-foreground border-transparent"),
224
+ className: cn("-ml-px block border-l py-1 text-sm transition-colors", levelIndent[item.level], item.level > 1 && "text-xs", active ? "border-primary text-foreground" : "text-muted-foreground hover:text-foreground border-transparent"),
206
225
  children: item.label
207
226
  }) }, item.id);
208
227
  })
@@ -1 +1 @@
1
- {"version":3,"file":"PageOutline.js","names":[],"sources":["../../src/core/PageOutline.tsx"],"sourcesContent":["import {\n type MouseEvent,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport { cn } from \"./utils.ts\";\n\n/**\n * Marks an element as an entry of the nearest {@link PageOutline}.\n *\n * Spread it on any element that carries an `id`: the outline lists it, links\n * `#id` to it, and highlights it while it is the section being read. The value\n * is the label; leave it empty and the outline reads the text of the first\n * descendant marked `data-outline-label` instead, which is how a section whose\n * title is a ReactNode still gets a plain-text entry.\n */\nexport const outlineEntry = (label?: string) => ({\n \"data-outline\": label ?? \"\",\n});\n\n/**\n * Brings `target` to the top of the box that actually scrolls it, and moves\n * nothing else.\n *\n * ⚠️ Not `scrollIntoView`: that scrolls EVERY ancestor it can, `overflow:\n * hidden` ones included. An app shell is full of those (a column clipped so\n * its child scrolls instead), and once one of them had been pushed up by a few\n * pixels the page stayed cut under its own header, since nothing a reader\n * does scrolls a hidden box back.\n */\nconst scrollToEntry = (target: HTMLElement, behavior?: ScrollBehavior) => {\n let scroller = target.parentElement;\n while (scroller) {\n const overflow = getComputedStyle(scroller).overflowY;\n if (\n (overflow === \"auto\" || overflow === \"scroll\") &&\n scroller.scrollHeight > scroller.clientHeight\n ) {\n break;\n }\n scroller = scroller.parentElement;\n }\n const margin =\n Number.parseFloat(getComputedStyle(target).scrollMarginTop) || 0;\n const top = target.getBoundingClientRect().top - margin;\n if (scroller) {\n scroller.scrollTo?.({\n top: scroller.scrollTop + top - scroller.getBoundingClientRect().top,\n behavior,\n });\n } else {\n window.scrollTo?.({ top: window.scrollY + top, behavior });\n }\n};\n\ninterface OutlineItem {\n id: string;\n label: string;\n}\n\nexport interface PageOutlineProps {\n /**\n * The page itself. Every descendant with an `id` and a `data-outline`\n * attribute (see {@link outlineEntry}) becomes an entry, in document order.\n */\n children: ReactNode;\n\n /**\n * Heading above the entries.\n *\n * @default \"On this page\"\n */\n title?: ReactNode;\n\n /**\n * Classes for the content column, which is where a page sets its measure\n * (`max-w-3xl`) and its padding.\n */\n contentClassName?: string;\n\n className?: string;\n}\n\n/**\n * A page with an \"on this page\" rail floating to the right of its content.\n *\n * The rail is sticky, highlights the entry being read, and puts the entry's\n * `#id` in the address bar on click, so the link a reader copies opens the\n * page on that section. It only shows when the page has room for it: the\n * width is measured on the outline's own box (a container query, `@5xl`, i.e.\n * 64rem), not on the viewport, because a page inside an app shell with a\n * sidebar is much narrower than the screen. On a tablet or a phone the rail\n * is gone and the content takes the whole width.\n *\n * Entries are read from the DOM rather than passed in, so a section that\n * renders conditionally (a credential that does not exist yet, a block the\n * reader has no rank for) appears and disappears from the rail on its own.\n * Fewer than two entries draw no rail: a single section needs no index.\n *\n * ## Deep links\n *\n * The router already scrolls to `#id` after a navigation, but only once the\n * target exists, and that is too early on a page whose sections load their own\n * data: at hydration the page is a few hundred pixels tall, the scroll lands\n * short, and the content then grows underneath it. The outline keeps the\n * target at the top while the content resizes, for up to three seconds after\n * mount, and lets go at the first wheel, touch, key or pointer press, so it\n * never fights the reader.\n */\nexport const PageOutline = (props: PageOutlineProps) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const [items, setItems] = useState<OutlineItem[]>([]);\n const [activeId, setActiveId] = useState<string>();\n // While a click's smooth scroll runs, the spy would walk the highlight\n // through every section in between; hold it on the clicked entry instead.\n const pinnedRef = useRef<string | null>(null);\n\n // Collect entries, and keep collecting as the page renders more of itself.\n useEffect(() => {\n const root = contentRef.current;\n if (!root) return;\n\n // The hash this page was opened on, held until it is reached for good.\n // A hash that is not valid percent-encoding (`#100%`) is kept raw.\n const rawHash = window.location.hash.slice(1);\n let pendingHash: string | null = rawHash || null;\n try {\n pendingHash = decodeURIComponent(rawHash) || null;\n } catch {}\n const deadline = performance.now() + 3000;\n\n const settleHash = () => {\n if (!pendingHash) return;\n if (performance.now() > deadline) {\n release();\n return;\n }\n const target = document.getElementById(pendingHash);\n if (!target?.hasAttribute(\"data-outline\") || !root.contains(target)) {\n return;\n }\n pinnedRef.current = pendingHash;\n setActiveId(pendingHash);\n scrollToEntry(target);\n };\n\n const release = () => {\n if (pendingHash && pinnedRef.current === pendingHash) {\n pinnedRef.current = null;\n }\n pendingHash = null;\n };\n\n const collect = () => {\n const next = Array.from(\n root.querySelectorAll<HTMLElement>(\"[data-outline][id]\"),\n ).map((el) => ({\n id: el.id,\n label:\n el.dataset.outline ||\n el.querySelector(\"[data-outline-label]\")?.textContent?.trim() ||\n el.id,\n }));\n setItems((prev) =>\n prev.length === next.length &&\n prev.every((p, i) => p.id === next[i].id && p.label === next[i].label)\n ? prev\n : next,\n );\n settleHash();\n };\n\n collect();\n const observer = new MutationObserver(collect);\n observer.observe(root, {\n childList: true,\n subtree: true,\n characterData: true,\n attributeFilter: [\"id\", \"data-outline\"],\n });\n // A section above the target growing (its data arrived) pushes the target\n // down without any mutation inside the outline's own subtree.\n const resizes =\n typeof ResizeObserver === \"undefined\"\n ? undefined\n : new ResizeObserver(settleHash);\n resizes?.observe(root);\n\n const inputs = [\"wheel\", \"touchstart\", \"keydown\", \"pointerdown\"] as const;\n for (const type of inputs) {\n window.addEventListener(type, release, { capture: true, passive: true });\n }\n const timer = setTimeout(release, 3000);\n\n return () => {\n observer.disconnect();\n resizes?.disconnect();\n clearTimeout(timer);\n for (const type of inputs) {\n window.removeEventListener(type, release, { capture: true });\n }\n };\n }, []);\n\n // Scroll spy: the active entry is the last one whose top has crossed the\n // upper third of the viewport.\n useEffect(() => {\n if (items.length === 0) return;\n\n const elements = items\n .map((item) => document.getElementById(item.id))\n .filter((el): el is HTMLElement => el !== null);\n\n const update = () => {\n if (pinnedRef.current) return;\n const line = window.innerHeight / 3;\n let current = elements[0]?.id;\n for (const el of elements) {\n if (el.getBoundingClientRect().top <= line) current = el.id;\n }\n setActiveId(current);\n };\n\n update();\n // Capture phase: the page may scroll inside an app shell's container,\n // not the window, and `scroll` does not bubble.\n document.addEventListener(\"scroll\", update, {\n capture: true,\n passive: true,\n });\n window.addEventListener(\"resize\", update, { passive: true });\n return () => {\n document.removeEventListener(\"scroll\", update, { capture: true });\n window.removeEventListener(\"resize\", update);\n };\n }, [items]);\n\n const onClick = (event: MouseEvent<HTMLAnchorElement>, id: string) => {\n const target = document.getElementById(id);\n if (!target) return;\n // A plain `#id` link would go through the router as a navigation; this is\n // only a scroll, so it stays out of history as one.\n event.preventDefault();\n history.replaceState(history.state, \"\", `#${id}`);\n setActiveId(id);\n pinnedRef.current = id;\n scrollToEntry(target, \"smooth\");\n\n let last = Number.NaN;\n let still = 0;\n const settle = () => {\n if (pinnedRef.current !== id) return;\n const top = target.getBoundingClientRect().top;\n still = Math.abs(top - last) < 1 ? still + 1 : 0;\n last = top;\n if (still >= 5) {\n pinnedRef.current = null;\n return;\n }\n requestAnimationFrame(settle);\n };\n requestAnimationFrame(settle);\n };\n\n const showRail = items.length > 1;\n\n return (\n <div\n data-slot=\"page-outline\"\n className={cn(\"@container w-full\", props.className)}\n >\n <div className=\"mx-auto flex w-full justify-center gap-8\">\n <div\n ref={contentRef}\n className={cn(\"min-w-0 flex-1\", props.contentClassName)}\n >\n {props.children}\n </div>\n {showRail ? (\n <nav\n aria-label={\n typeof props.title === \"string\" ? props.title : \"On this page\"\n }\n className=\"hidden w-48 shrink-0 @5xl:block\"\n >\n <div className=\"sticky top-4 flex flex-col gap-2 py-4\">\n <span className=\"text-muted-foreground text-xs\">\n {props.title ?? \"On this page\"}\n </span>\n <ul className=\"border-border flex flex-col border-l\">\n {items.map((item) => {\n const active = item.id === activeId;\n return (\n <li key={item.id}>\n <a\n href={`#${item.id}`}\n onClick={(event) => onClick(event, item.id)}\n aria-current={active ? \"location\" : undefined}\n className={cn(\n \"-ml-px block border-l py-1 pl-3 text-sm transition-colors\",\n active\n ? \"border-primary text-foreground\"\n : \"text-muted-foreground hover:text-foreground border-transparent\",\n )}\n >\n {item.label}\n </a>\n </li>\n );\n })}\n </ul>\n </div>\n </nav>\n ) : null}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAmBA,MAAa,gBAAgB,WAAoB,EAC/C,gBAAgB,SAAS,GAC3B;;;;;;;;;;;AAYA,MAAM,iBAAiB,QAAqB,aAA8B;CACxE,IAAI,WAAW,OAAO;CACtB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,MAAM,UAAU,WAAW,MAAM,QAAQ;IAElD,WAAU;IAEV,UAAA,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,MAAM,SAAS;KACZ,CAAA,GACN,oBAAC,MAAD;MAAI,WAAU;MACX,UAAA,MAAM,KAAK,SAAS;OACnB,MAAM,SAAS,KAAK,OAAO;OAC3B,OACE,oBAAC,MAAD,EAAA,UACE,oBAAC,KAAD;QACE,MAAM,IAAI,KAAK;QACf,UAAU,UAAU,QAAQ,OAAO,KAAK,EAAE;QAC1C,gBAAc,SAAS,aAAa,KAAA;QACpC,WAAW,GACT,6DACA,SACI,mCACA,gEACN;QAEC,UAAA,KAAK;OACL,CAAA,EACD,GAdK,KAAK,EAcV;MAER,CAAC;KACC,CAAA,CACD;;GACF,CAAA,IACH,IACD;;CACF,CAAA;AAET"}
1
+ {"version":3,"file":"PageOutline.js","names":[],"sources":["../../src/core/PageOutline.tsx"],"sourcesContent":["import {\n type MouseEvent,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport { cn } from \"./utils.ts\";\n\n/**\n * Marks an element as an entry of the nearest {@link PageOutline}.\n *\n * Spread it on any element that carries an `id`: the outline lists it, links\n * `#id` to it, and highlights it while it is the section being read. The value\n * is the label; leave it empty and the outline reads the text of the first\n * descendant marked `data-outline-label` instead, which is how a section whose\n * title is a ReactNode still gets a plain-text entry.\n *\n * `level` nests the entry under the one above it, for a page whose sections\n * have subsections: 1 (the default) is flush with the rail, 2 is indented\n * once, 3 twice. A Markdown page passes its heading depth minus one, so an\n * `h2` sits at 1 and an `h3` under it at 2.\n */\nexport const outlineEntry = (label?: string, options?: { level?: number }) => ({\n \"data-outline\": label ?? \"\",\n ...(options?.level && options.level > 1\n ? { \"data-outline-level\": String(options.level) }\n : {}),\n});\n\n/**\n * Brings `target` to the top of the box that actually scrolls it, and moves\n * nothing else.\n *\n * ⚠️ Not `scrollIntoView`: that scrolls EVERY ancestor it can, `overflow:\n * hidden` ones included. An app shell is full of those (a column clipped so\n * its child scrolls instead), and once one of them had been pushed up by a few\n * pixels the page stayed cut under its own header, since nothing a reader\n * does scrolls a hidden box back.\n */\nconst scrollToEntry = (target: HTMLElement, behavior?: ScrollBehavior) => {\n let scroller = target.parentElement;\n while (scroller) {\n const overflow = getComputedStyle(scroller).overflowY;\n if (\n (overflow === \"auto\" || overflow === \"scroll\") &&\n scroller.scrollHeight > scroller.clientHeight\n ) {\n break;\n }\n scroller = scroller.parentElement;\n }\n const margin =\n Number.parseFloat(getComputedStyle(target).scrollMarginTop) || 0;\n const top = target.getBoundingClientRect().top - margin;\n if (scroller) {\n scroller.scrollTo?.({\n top: scroller.scrollTop + top - scroller.getBoundingClientRect().top,\n behavior,\n });\n } else {\n window.scrollTo?.({ top: window.scrollY + top, behavior });\n }\n};\n\ninterface OutlineItem {\n id: string;\n label: string;\n level: number;\n}\n\n/** The indent of a nested entry, one step per level below the first. */\nconst levelIndent: Record<number, string> = {\n 1: \"pl-3\",\n 2: \"pl-6\",\n 3: \"pl-9\",\n};\n\nexport interface PageOutlineProps {\n /**\n * The page itself. Every descendant with an `id` and a `data-outline`\n * attribute (see {@link outlineEntry}) becomes an entry, in document order.\n */\n children: ReactNode;\n\n /**\n * Heading above the entries.\n *\n * @default \"On this page\"\n */\n title?: ReactNode;\n\n /**\n * Classes for the content column, which is where a page sets its measure\n * (`max-w-3xl`) and its padding.\n */\n contentClassName?: string;\n\n className?: string;\n}\n\n/**\n * A page with an \"on this page\" rail floating to the right of its content.\n *\n * The rail is sticky, highlights the entry being read, and puts the entry's\n * `#id` in the address bar on click, so the link a reader copies opens the\n * page on that section. It only shows when the page has room for it: the\n * width is measured on the outline's own box (a container query, `@5xl`, i.e.\n * 64rem), not on the viewport, because a page inside an app shell with a\n * sidebar is much narrower than the screen. On a tablet or a phone the rail\n * is gone and the content takes the whole width.\n *\n * Entries are read from the DOM rather than passed in, so a section that\n * renders conditionally (a credential that does not exist yet, a block the\n * reader has no rank for) appears and disappears from the rail on its own.\n * Fewer than two entries draw no rail: a single section needs no index.\n *\n * ## Deep links\n *\n * The router already scrolls to `#id` after a navigation, but only once the\n * target exists, and that is too early on a page whose sections load their own\n * data: at hydration the page is a few hundred pixels tall, the scroll lands\n * short, and the content then grows underneath it. The outline keeps the\n * target at the top while the content resizes, for up to three seconds after\n * mount, and lets go at the first wheel, touch, key or pointer press, so it\n * never fights the reader.\n */\nexport const PageOutline = (props: PageOutlineProps) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const [items, setItems] = useState<OutlineItem[]>([]);\n const [activeId, setActiveId] = useState<string>();\n // While a click's smooth scroll runs, the spy would walk the highlight\n // through every section in between; hold it on the clicked entry instead.\n const pinnedRef = useRef<string | null>(null);\n\n // Collect entries, and keep collecting as the page renders more of itself.\n useEffect(() => {\n const root = contentRef.current;\n if (!root) return;\n\n // The hash this page was opened on, held until it is reached for good.\n // A hash that is not valid percent-encoding (`#100%`) is kept raw.\n const rawHash = window.location.hash.slice(1);\n let pendingHash: string | null = rawHash || null;\n try {\n pendingHash = decodeURIComponent(rawHash) || null;\n } catch {}\n const deadline = performance.now() + 3000;\n\n const settleHash = () => {\n if (!pendingHash) return;\n if (performance.now() > deadline) {\n release();\n return;\n }\n const target = document.getElementById(pendingHash);\n if (!target?.hasAttribute(\"data-outline\") || !root.contains(target)) {\n return;\n }\n pinnedRef.current = pendingHash;\n setActiveId(pendingHash);\n scrollToEntry(target);\n };\n\n const release = () => {\n if (pendingHash && pinnedRef.current === pendingHash) {\n pinnedRef.current = null;\n }\n pendingHash = null;\n };\n\n const collect = () => {\n const next = Array.from(\n root.querySelectorAll<HTMLElement>(\"[data-outline][id]\"),\n ).map((el) => ({\n id: el.id,\n label:\n el.dataset.outline ||\n el.querySelector(\"[data-outline-label]\")?.textContent?.trim() ||\n el.id,\n level: Math.min(3, Math.max(1, Number(el.dataset.outlineLevel) || 1)),\n }));\n setItems((prev) =>\n prev.length === next.length &&\n prev.every(\n (p, i) =>\n p.id === next[i].id &&\n p.label === next[i].label &&\n p.level === next[i].level,\n )\n ? prev\n : next,\n );\n settleHash();\n };\n\n collect();\n const observer = new MutationObserver(collect);\n observer.observe(root, {\n childList: true,\n subtree: true,\n characterData: true,\n attributeFilter: [\"id\", \"data-outline\", \"data-outline-level\"],\n });\n // A section above the target growing (its data arrived) pushes the target\n // down without any mutation inside the outline's own subtree.\n const resizes =\n typeof ResizeObserver === \"undefined\"\n ? undefined\n : new ResizeObserver(settleHash);\n resizes?.observe(root);\n\n const inputs = [\"wheel\", \"touchstart\", \"keydown\", \"pointerdown\"] as const;\n for (const type of inputs) {\n window.addEventListener(type, release, { capture: true, passive: true });\n }\n const timer = setTimeout(release, 3000);\n\n return () => {\n observer.disconnect();\n resizes?.disconnect();\n clearTimeout(timer);\n for (const type of inputs) {\n window.removeEventListener(type, release, { capture: true });\n }\n };\n }, []);\n\n // Scroll spy: the active entry is the last one whose top has crossed the\n // upper third of the viewport.\n useEffect(() => {\n if (items.length === 0) return;\n\n const elements = items\n .map((item) => document.getElementById(item.id))\n .filter((el): el is HTMLElement => el !== null);\n\n const update = () => {\n if (pinnedRef.current) return;\n const line = window.innerHeight / 3;\n let current = elements[0]?.id;\n for (const el of elements) {\n if (el.getBoundingClientRect().top <= line) current = el.id;\n }\n setActiveId(current);\n };\n\n update();\n // Capture phase: the page may scroll inside an app shell's container,\n // not the window, and `scroll` does not bubble.\n document.addEventListener(\"scroll\", update, {\n capture: true,\n passive: true,\n });\n window.addEventListener(\"resize\", update, { passive: true });\n return () => {\n document.removeEventListener(\"scroll\", update, { capture: true });\n window.removeEventListener(\"resize\", update);\n };\n }, [items]);\n\n const onClick = (event: MouseEvent<HTMLAnchorElement>, id: string) => {\n const target = document.getElementById(id);\n if (!target) return;\n // A plain `#id` link would go through the router as a navigation; this is\n // only a scroll, so it stays out of history as one.\n event.preventDefault();\n history.replaceState(history.state, \"\", `#${id}`);\n setActiveId(id);\n pinnedRef.current = id;\n scrollToEntry(target, \"smooth\");\n\n let last = Number.NaN;\n let still = 0;\n const settle = () => {\n if (pinnedRef.current !== id) return;\n const top = target.getBoundingClientRect().top;\n still = Math.abs(top - last) < 1 ? still + 1 : 0;\n last = top;\n if (still >= 5) {\n pinnedRef.current = null;\n return;\n }\n requestAnimationFrame(settle);\n };\n requestAnimationFrame(settle);\n };\n\n const showRail = items.length > 1;\n\n return (\n <div\n data-slot=\"page-outline\"\n className={cn(\"@container w-full\", props.className)}\n >\n <div className=\"mx-auto flex w-full justify-center gap-8\">\n <div\n ref={contentRef}\n className={cn(\"min-w-0 flex-1\", props.contentClassName)}\n >\n {props.children}\n </div>\n {showRail ? (\n <nav\n aria-label={\n typeof props.title === \"string\" ? props.title : \"On this page\"\n }\n className=\"hidden w-48 shrink-0 @5xl:block\"\n >\n <div className=\"sticky top-4 flex flex-col gap-2 py-4\">\n <span className=\"text-muted-foreground text-xs\">\n {props.title ?? \"On this page\"}\n </span>\n <ul className=\"border-border flex flex-col border-l\">\n {items.map((item) => {\n const active = item.id === activeId;\n return (\n <li key={item.id}>\n <a\n href={`#${item.id}`}\n onClick={(event) => onClick(event, item.id)}\n aria-current={active ? \"location\" : undefined}\n className={cn(\n \"-ml-px block border-l py-1 text-sm transition-colors\",\n levelIndent[item.level],\n item.level > 1 && \"text-xs\",\n active\n ? \"border-primary text-foreground\"\n : \"text-muted-foreground hover:text-foreground border-transparent\",\n )}\n >\n {item.label}\n </a>\n </li>\n );\n })}\n </ul>\n </div>\n </nav>\n ) : null}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,MAAa,gBAAgB,OAAgB,aAAkC;CAC7E,gBAAgB,SAAS;CACzB,GAAI,SAAS,SAAS,QAAQ,QAAQ,IAClC,EAAE,sBAAsB,OAAO,QAAQ,KAAK,EAAE,IAC9C,CAAC;AACP;;;;;;;;;;;AAYA,MAAM,iBAAiB,QAAqB,aAA8B;CACxE,IAAI,WAAW,OAAO;CACtB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SAAS;EAElD,UAAA,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,OAAD;IACE,KAAK;IACL,WAAW,GAAG,kBAAkB,MAAM,gBAAgB;IAErD,UAAA,MAAM;GACJ,CAAA,GACJ,WACC,oBAAC,OAAD;IACE,cACE,OAAO,MAAM,UAAU,WAAW,MAAM,QAAQ;IAElD,WAAU;IAEV,UAAA,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,MAAM,SAAS;KACZ,CAAA,GACN,oBAAC,MAAD;MAAI,WAAU;MACX,UAAA,MAAM,KAAK,SAAS;OACnB,MAAM,SAAS,KAAK,OAAO;OAC3B,OACE,oBAAC,MAAD,EAAA,UACE,oBAAC,KAAD;QACE,MAAM,IAAI,KAAK;QACf,UAAU,UAAU,QAAQ,OAAO,KAAK,EAAE;QAC1C,gBAAc,SAAS,aAAa,KAAA;QACpC,WAAW,GACT,wDACA,YAAY,KAAK,QACjB,KAAK,QAAQ,KAAK,WAClB,SACI,mCACA,gEACN;QAEC,UAAA,KAAK;OACL,CAAA,EACD,GAhBK,KAAK,EAgBV;MAER,CAAC;KACC,CAAA,CACD;;GACF,CAAA,IACH,IACD;;CACF,CAAA;AAET"}
@@ -1,7 +1,7 @@
1
- import { Button } from "./Button.js";
2
- import { cn } from "./utils.js";
3
1
  import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
4
2
  import "react";
3
+ import { Button } from "./Button.js";
4
+ import { cn } from "./utils.js";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  // src/core/Pagination.tsx
7
7
  const Pagination = (props) => {
@@ -1,5 +1,5 @@
1
- import { cn } from "./utils.js";
2
1
  import { PanelLeftOpen, PanelRightOpen } from "lucide-react";
2
+ import { cn } from "./utils.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  // src/core/PaneRail.tsx
5
5
  /**
@@ -1,7 +1,7 @@
1
- import { cn } from "./utils.js";
1
+ import { Popover as Popover$1 } from "@base-ui/react/popover";
2
2
  import "react";
3
+ import { cn } from "./utils.js";
3
4
  import { jsx } from "react/jsx-runtime";
4
- import { Popover as Popover$1 } from "@base-ui/react/popover";
5
5
  // src/core/Popover.tsx
6
6
  const Popover = (props) => {
7
7
  return /* @__PURE__ */ jsx(Popover$1.Root, {
@@ -1,6 +1,6 @@
1
+ import { Progress as Progress$1 } from "@base-ui/react/progress";
1
2
  import { cn } from "./utils.js";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Progress as Progress$1 } from "@base-ui/react/progress";
4
4
  // src/core/Progress.tsx
5
5
  const Progress = (props) => {
6
6
  const { className, children, value, ...rest } = props;
@@ -19,6 +19,13 @@ export interface SegmentedOption {
19
19
  * `label` is an icon alone: without it an icon segment names nothing.
20
20
  */
21
21
  title?: string;
22
+ /**
23
+ * The segment's accessible name and a tooltip, drawn as an icon button's
24
+ * (`Tooltip`) rather than the browser's native one: for an icon-only
25
+ * segment in a toolbar beside icon buttons that carry theirs. Takes the
26
+ * place of `title`.
27
+ */
28
+ tooltip?: string;
22
29
  }
23
30
  export interface SegmentedProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
24
31
  /**
@@ -49,7 +56,10 @@ export interface SegmentedProps extends Omit<React.HTMLAttributes<HTMLDivElement
49
56
  */
50
57
  variant?: "subtle" | "solid";
51
58
  /**
52
- * Stretch segments to fill the available width.
59
+ * Fill the available width, the segments sharing it equally. Off by
60
+ * default: the control is as wide as its labels, even as the child of a
61
+ * flex column, whose default `align-items: stretch` used to widen it to
62
+ * the whole column without anyone asking.
53
63
  */
54
64
  fullWidth?: boolean;
55
65
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Segmented.d.ts","sourceRoot":"","sources":["../../src/core/Segmented.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,WAAW,eAAe;IAC9B,KAA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AS,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,UAAU,CACX;IACC;;OAEG;IACH,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACxC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA0CD,eAAO,MAAM,SAAS,UAAW,cAAc,sBA2R9C,CAAC"}
@@ -1,6 +1,7 @@
1
+ import * as React from "react";
1
2
  import { inlineArrowKey } from "./inlineArrowKey.js";
3
+ import { Tooltip, TooltipContent, TooltipTrigger } from "./Tooltip.js";
2
4
  import { cn } from "./utils.js";
3
- import * as React from "react";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  // src/core/Segmented.tsx
6
7
  const sizeClass = {
@@ -117,7 +118,7 @@ const Segmented = (props) => {
117
118
  role: "radiogroup",
118
119
  "aria-disabled": disabled || void 0,
119
120
  "data-slot": "segmented",
120
- className: cn("border-border relative box-border inline-flex items-stretch overflow-hidden rounded-md border p-0.5", variant === "solid" ? "bg-background" : "bg-muted/40", sizeClass[size], fullWidth && "flex w-full", disabled && "opacity-50", className),
121
+ className: cn("border-border relative box-border inline-flex items-stretch overflow-hidden rounded-md border p-0.5", fullWidth ? "flex w-full" : "w-fit max-w-full", variant === "solid" ? "bg-background" : "bg-muted/40", sizeClass[size], disabled && "opacity-50", className),
121
122
  ...rest,
122
123
  children: [thumb && /* @__PURE__ */ jsx("span", {
123
124
  "aria-hidden": true,
@@ -135,7 +136,7 @@ const Segmented = (props) => {
135
136
  const active = opt.value === value;
136
137
  const itemDisabled = disabled || opt.disabled;
137
138
  const showDivider = dividers && index > 0 && !active && index - 1 !== activeIndex;
138
- return /* @__PURE__ */ jsxs("button", {
139
+ const button = /* @__PURE__ */ jsxs("button", {
139
140
  ref: (el) => {
140
141
  itemRefs.current[index] = el;
141
142
  },
@@ -147,8 +148,8 @@ const Segmented = (props) => {
147
148
  disabled: itemDisabled,
148
149
  "data-state": active ? "active" : "inactive",
149
150
  "data-slot": "segmented-item",
150
- "aria-label": opt.title,
151
- title: opt.title,
151
+ "aria-label": opt.tooltip ?? opt.title,
152
+ title: opt.tooltip ? void 0 : opt.title,
152
153
  name,
153
154
  value: opt.value,
154
155
  onClick: () => !itemDisabled && handleSelect(opt.value),
@@ -160,6 +161,8 @@ const Segmented = (props) => {
160
161
  children: opt.count
161
162
  })]
162
163
  }, opt.value);
164
+ if (!opt.tooltip) return button;
165
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: button }), /* @__PURE__ */ jsx(TooltipContent, { children: opt.tooltip })] }, opt.value);
163
166
  })]
164
167
  });
165
168
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Segmented.js","names":[],"sources":["../../src/core/Segmented.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { inlineArrowKey } from \"./inlineArrowKey.ts\";\nimport { cn } from \"./utils.ts\";\n\nexport interface SegmentedOption {\n value: string;\n label: React.ReactNode;\n /**\n * A trailing count, rendered after the label.\n *\n * A field rather than something the caller folds into `label`, because the\n * colour has to follow the segment's state and only this component knows\n * it. A count written into the label carries its own class, usually\n * `text-muted-foreground`, which is right on the three inactive segments\n * and nearly invisible on the active one, where the thumb paints\n * `bg-primary` underneath it.\n */\n count?: React.ReactNode;\n disabled?: boolean;\n /**\n * The segment's accessible name and hover tooltip, for a segment whose\n * `label` is an icon alone: without it an icon segment names nothing.\n */\n title?: string;\n}\n\nexport interface SegmentedProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n \"onChange\"\n> {\n /**\n * Selectable options. Each one renders as a segment.\n */\n options: SegmentedOption[];\n /**\n * Controlled value. Pair with `onChange` for full control.\n */\n value?: string;\n /**\n * Initial value when uncontrolled.\n */\n defaultValue?: string;\n /**\n * Called when the active segment changes.\n */\n onChange?: (value: string) => void;\n /**\n * Visual size: `xs`, `sm`, `md` (default), `lg`, or `xl`.\n */\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n /**\n * The box behind the segments. `subtle` (the default) is a translucent\n * muted wash that lets the surface show through; `solid` is the page's\n * own background, the fill of an input or an outlined button, for a\n * control sitting in a toolbar beside them.\n */\n variant?: \"subtle\" | \"solid\";\n /**\n * Stretch segments to fill the available width.\n */\n fullWidth?: boolean;\n /**\n * Disable all segments.\n */\n disabled?: boolean;\n /**\n * Render 1px separators between inactive segments. Defaults to `true`.\n */\n dividers?: boolean;\n /**\n * Optional form name (used when rendered inside a form).\n */\n name?: string;\n}\n\n// Outer-box height + text per size, picked so the control lines up\n// pixel-for-pixel with a `<Button>` of the same size token (xs h-6, sm h-7,\n// md=Button-default h-8, lg h-9). The box owns the height (border-box, so the\n// `p-0.5` + 1px border are included) and the segments stretch to fill it.\nconst sizeClass: Record<NonNullable<SegmentedProps[\"size\"]>, string> = {\n xs: \"h-6 text-xs\",\n sm: \"h-7 text-[0.8rem]\",\n md: \"h-8 text-sm\",\n lg: \"h-9 text-sm\",\n xl: \"h-11 text-base\",\n};\n\n// Horizontal padding per size, applied to each segment (height comes from the\n// stretched box, not the segment).\nconst itemPadClass: Record<NonNullable<SegmentedProps[\"size\"]>, string> = {\n xs: \"px-2\",\n sm: \"px-2.5\",\n md: \"px-3\",\n lg: \"px-4\",\n xl: \"px-5\",\n};\n\ninterface ThumbRect {\n left: number;\n top: number;\n width: number;\n height: number;\n /**\n * The segment this rect was measured for.\n */\n index: number;\n /**\n * Whether reaching this rect should SLIDE. Only a change of segment does:\n * a re-measure of the same segment (a resize, a popup settling its open\n * animation, the first paint) snaps, or the thumb glides in from wherever\n * the previous measurement put it every time the control appears.\n */\n slide: boolean;\n}\n\nexport const Segmented = (props: SegmentedProps) => {\n const {\n options,\n value: controlled,\n defaultValue,\n onChange,\n size = \"md\",\n variant = \"subtle\",\n fullWidth,\n disabled,\n dividers = true,\n name,\n className,\n ...rest\n } = props;\n\n const [uncontrolled, setUncontrolled] = React.useState<string | undefined>(\n defaultValue,\n );\n const value = controlled !== undefined ? controlled : uncontrolled;\n\n const containerRef = React.useRef<HTMLDivElement | null>(null);\n const itemRefs = React.useRef<Array<HTMLButtonElement | null>>([]);\n const [thumb, setThumb] = React.useState<ThumbRect | null>(null);\n\n const activeIndex = options.findIndex((opt) => opt.value === value);\n\n const measureThumb = React.useCallback(() => {\n if (activeIndex < 0) {\n setThumb(null);\n return;\n }\n const el = itemRefs.current[activeIndex];\n const container = containerRef.current;\n if (!el || !container) return;\n const elRect = el.getBoundingClientRect();\n const parentRect = container.getBoundingClientRect();\n // ⚠️ Subtract the container's border, or it is counted twice and the thumb\n // sits one border-width down and to the right of the segment it covers.\n //\n // `getBoundingClientRect()` measures the BORDER box, so this delta includes\n // the border. The thumb is `position: absolute`, whose containing block is\n // the padding box, an origin that already starts inside that same border.\n // Applying a border-box delta from a padding-box origin adds it a second\n // time.\n //\n // At the default 1px border it is a 1px drift on both axes, which reads as\n // the active surface being off-centre: 4px of gap above it and 2px below.\n // Visible, and easy to misdiagnose as missing padding, but padding cannot\n // be the fix, because the drift is equal on the horizontal axis where the\n // box is not symmetric to begin with.\n const parentStyle = getComputedStyle(container);\n const borderLeft = Number.parseFloat(parentStyle.borderLeftWidth) || 0;\n const borderTop = Number.parseFloat(parentStyle.borderTopWidth) || 0;\n // ⚠️ Undo any transform an ANCESTOR is applying while this measures.\n //\n // `getBoundingClientRect()` answers in on-screen pixels, after transforms;\n // the thumb is positioned in layout pixels, before them. Mounted inside a\n // popup that opens with `zoom-in-95`, the first measurement lands while\n // the popup is still at 95%: every offset and width comes back 5% short,\n // and the thumb stays that way, because the transform settling changes no\n // layout and so never wakes the ResizeObserver below. Seen as the \"is\n // not\" pill of a filter's operator switch sitting 5px left of its label\n // and 5px too narrow, on every reopen.\n //\n // `offsetWidth` is a layout measure of the same border box, so the ratio\n // is exactly the scale in force. Guarded for a detached or hidden node,\n // where both are zero.\n const scale =\n container.offsetWidth > 0 ? parentRect.width / container.offsetWidth : 1;\n // Physical on purpose: the thumb is placed from measured rects, which are\n // the same in either reading direction.\n setThumb((previous) => ({\n left: (elRect.left - parentRect.left) / scale - borderLeft,\n top: (elRect.top - parentRect.top) / scale - borderTop,\n width: elRect.width / scale,\n height: elRect.height / scale,\n index: activeIndex,\n slide: previous !== null && previous.index !== activeIndex,\n }));\n }, [activeIndex]);\n\n React.useLayoutEffect(() => {\n // Measures the DOM after it has been committed: there is nothing to\n // derive during render, the geometry does not exist yet.\n // oxlint-disable-next-line react/set-state-in-effect -- measures committed DOM, nothing to derive during render\n measureThumb();\n }, [measureThumb, options.length, size, fullWidth]);\n\n React.useEffect(() => {\n if (!containerRef.current) return;\n const observer = new ResizeObserver(() => measureThumb());\n observer.observe(containerRef.current);\n return () => observer.disconnect();\n }, [measureThumb]);\n\n // One Tab stop per group (WAI-ARIA radio group): the checked option, or\n // the first enabled one when none is checked. The arrow keys move inside.\n const tabStop =\n activeIndex >= 0 && !options[activeIndex]?.disabled\n ? activeIndex\n : options.findIndex((opt) => !opt.disabled);\n\n const handleSelect = (next: string) => {\n if (controlled === undefined) setUncontrolled(next);\n onChange?.(next);\n };\n\n /**\n * Arrow-key navigation, which `role=\"radiogroup\"` promises and this did not\n * deliver: a radio group moves between its options with the arrow keys, and\n * moving the selection moves the focus with it. Home and End jump to the\n * ends, and the walk wraps.\n *\n * Disabled options are stepped OVER rather than landed on, so a group whose\n * neighbour is disabled still reaches the one past it. A group with nothing\n * enabled to move to leaves the selection alone rather than looping forever.\n */\n const moveSelection = (from: number, step: number) => {\n for (let i = 1; i <= options.length; i++) {\n const next =\n (from + step * i + options.length * options.length) % options.length;\n const opt = options[next];\n if (!opt || opt.disabled) continue;\n handleSelect(opt.value);\n itemRefs.current[next]?.focus();\n return;\n }\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (disabled) return;\n const current = options.findIndex((o) => o.value === value);\n const from = current === -1 ? 0 : current;\n switch (inlineArrowKey(event)) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n event.preventDefault();\n moveSelection(from, 1);\n return;\n case \"ArrowLeft\":\n case \"ArrowUp\":\n event.preventDefault();\n moveSelection(from, -1);\n return;\n case \"Home\":\n event.preventDefault();\n moveSelection(-1, 1);\n return;\n case \"End\":\n event.preventDefault();\n moveSelection(options.length, -1);\n return;\n default:\n }\n };\n\n return (\n <div\n ref={containerRef}\n role=\"radiogroup\"\n aria-disabled={disabled || undefined}\n data-slot=\"segmented\"\n className={cn(\n // `overflow-hidden`: the thumb is placed from measured, fractional\n // rects, and a sub-pixel of it past the box made a scroll container\n // around the control (a detail page's tab strip) show a scrollbar\n // for some selections only. Clipped here, nothing of it reaches the\n // ancestor, so the segments' focus ring is drawn inset below.\n \"border-border relative box-border inline-flex items-stretch overflow-hidden rounded-md border p-0.5\",\n variant === \"solid\" ? \"bg-background\" : \"bg-muted/40\",\n sizeClass[size],\n fullWidth && \"flex w-full\",\n disabled && \"opacity-50\",\n className,\n )}\n {...rest}\n >\n {thumb && (\n <span\n aria-hidden\n data-slot=\"segmented-thumb\"\n className={cn(\n \"bg-primary pointer-events-none absolute rounded-[calc(var(--radius)-2px)] shadow-sm\",\n // Animate only `transform`: it's GPU-composited in both browsers.\n // Transitioning width/height forces a per-frame reflow + box-shadow\n // repaint on the main thread, which Firefox handles poorly (visible\n // jank); Chrome's fast-paths hide it. Width/height still update, but\n // instantly; for equal-width segments they never change anyway, so\n // only the slide animates.\n //\n // Only while `slide` is set - see `ThumbRect.slide`. This replaces\n // a flag switched on one frame after the first measurement, which\n // kept the first paint still and then animated EVERY later\n // re-measure, including the ones that only correct a position.\n thumb.slide && \"transition-transform duration-200 ease-out\",\n )}\n style={{\n transform: `translate(${thumb.left}px, ${thumb.top}px)`,\n width: thumb.width,\n height: thumb.height,\n top: 0,\n left: 0,\n willChange: \"transform\",\n }}\n />\n )}\n {options.map((opt, index) => {\n const active = opt.value === value;\n const itemDisabled = disabled || opt.disabled;\n const showDivider =\n dividers && index > 0 && !active && index - 1 !== activeIndex;\n\n return (\n <button\n key={opt.value}\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={active}\n tabIndex={index === tabStop ? 0 : -1}\n aria-disabled={itemDisabled || undefined}\n disabled={itemDisabled}\n data-state={active ? \"active\" : \"inactive\"}\n data-slot=\"segmented-item\"\n aria-label={opt.title}\n title={opt.title}\n name={name}\n value={opt.value}\n onClick={() => !itemDisabled && handleSelect(opt.value)}\n onKeyDown={onKeyDown}\n className={cn(\n \"relative z-10 inline-flex min-w-0 items-center justify-center rounded-[calc(var(--radius)-2px)] font-medium whitespace-nowrap\",\n \"transition-colors duration-150 ease-in-out\",\n \"focus-visible:ring-ring/50 focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset\",\n itemPadClass[size],\n active\n ? \"text-primary-foreground\"\n : \"text-muted-foreground hover:text-foreground\",\n itemDisabled && \"cursor-not-allowed opacity-50\",\n fullWidth && \"flex-1\",\n showDivider &&\n \"before:bg-border before:absolute before:inset-y-1.5 before:start-0 before:w-px before:content-['']\",\n )}\n >\n {opt.label}\n {opt.count !== undefined && opt.count !== null && (\n <span\n data-slot=\"segmented-count\"\n className={cn(\n \"ms-1.5 tabular-nums\",\n // Derived from the segment's own foreground rather than\n // from the resting muted token, which is chosen for a\n // different background. At FULL strength: white at `/70`\n // over the Blueprint blue primary measured 3.2:1, under\n // the 4.5 the Epics e2e holds it to, and at `/85` it is\n // still 4.0. `font-normal` keeps it secondary to the label.\n active\n ? \"text-primary-foreground font-normal\"\n : \"text-muted-foreground\",\n )}\n >\n {opt.count}\n </span>\n )}\n </button>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;;AAgFA,MAAM,YAAiE;CACrE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAIA,MAAM,eAAoE;CACxE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAoBA,MAAa,aAAa,UAA0B;CAClD,MAAM,EACJ,SACA,OAAO,YACP,cACA,UACA,OAAO,MACP,UAAU,UACV,WACA,UACA,WAAW,MACX,MACA,WACA,GAAG,SACD;CAEJ,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAC5C,YACF;CACA,MAAM,QAAQ,eAAe,KAAA,IAAY,aAAa;CAEtD,MAAM,eAAe,MAAM,OAA8B,IAAI;CAC7D,MAAM,WAAW,MAAM,OAAwC,CAAC,CAAC;CACjE,MAAM,CAAC,OAAO,YAAY,MAAM,SAA2B,IAAI;CAE/D,MAAM,cAAc,QAAQ,WAAW,QAAQ,IAAI,UAAU,KAAK;CAElE,MAAM,eAAe,MAAM,kBAAkB;EAC3C,IAAI,cAAc,GAAG;GACnB,SAAS,IAAI;GACb;EACF;EACA,MAAM,KAAK,SAAS,QAAQ;EAC5B,MAAM,YAAY,aAAa;EAC/B,IAAI,CAAC,MAAM,CAAC,WAAW;EACvB,MAAM,SAAS,GAAG,sBAAsB;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V,cAAY,SAAS,WAAW;IAChC,aAAU;IACV,cAAY,IAAI;IAChB,OAAO,IAAI;IACL;IACN,OAAO,IAAI;IACX,eAAe,CAAC,gBAAgB,aAAa,IAAI,KAAK;IAC3C;IACX,WAAW,GACT,iIACA,8CACA,uGACA,aAAa,OACb,SACI,4BACA,+CACJ,gBAAgB,iCAChB,aAAa,UACb,eACE,oGACJ;IA/BF,UAAA,CAiCG,IAAI,OACJ,IAAI,UAAU,KAAA,KAAa,IAAI,UAAU,QACxC,oBAAC,QAAD;KACE,aAAU;KACV,WAAW,GACT,uBAOA,SACI,wCACA,uBACN;KAEC,UAAA,IAAI;IACD,CAAA,CAEF;GApDD,GAAA,IAAI,KAoDH;EAEZ,CAAC,CACE;;AAET"}
1
+ {"version":3,"file":"Segmented.js","names":[],"sources":["../../src/core/Segmented.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { inlineArrowKey } from \"./inlineArrowKey.ts\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./Tooltip.tsx\";\nimport { cn } from \"./utils.ts\";\n\nexport interface SegmentedOption {\n value: string;\n label: React.ReactNode;\n /**\n * A trailing count, rendered after the label.\n *\n * A field rather than something the caller folds into `label`, because the\n * colour has to follow the segment's state and only this component knows\n * it. A count written into the label carries its own class, usually\n * `text-muted-foreground`, which is right on the three inactive segments\n * and nearly invisible on the active one, where the thumb paints\n * `bg-primary` underneath it.\n */\n count?: React.ReactNode;\n disabled?: boolean;\n /**\n * The segment's accessible name and hover tooltip, for a segment whose\n * `label` is an icon alone: without it an icon segment names nothing.\n */\n title?: string;\n /**\n * The segment's accessible name and a tooltip, drawn as an icon button's\n * (`Tooltip`) rather than the browser's native one: for an icon-only\n * segment in a toolbar beside icon buttons that carry theirs. Takes the\n * place of `title`.\n */\n tooltip?: string;\n}\n\nexport interface SegmentedProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n \"onChange\"\n> {\n /**\n * Selectable options. Each one renders as a segment.\n */\n options: SegmentedOption[];\n /**\n * Controlled value. Pair with `onChange` for full control.\n */\n value?: string;\n /**\n * Initial value when uncontrolled.\n */\n defaultValue?: string;\n /**\n * Called when the active segment changes.\n */\n onChange?: (value: string) => void;\n /**\n * Visual size: `xs`, `sm`, `md` (default), `lg`, or `xl`.\n */\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n /**\n * The box behind the segments. `subtle` (the default) is a translucent\n * muted wash that lets the surface show through; `solid` is the page's\n * own background, the fill of an input or an outlined button, for a\n * control sitting in a toolbar beside them.\n */\n variant?: \"subtle\" | \"solid\";\n /**\n * Fill the available width, the segments sharing it equally. Off by\n * default: the control is as wide as its labels, even as the child of a\n * flex column, whose default `align-items: stretch` used to widen it to\n * the whole column without anyone asking.\n */\n fullWidth?: boolean;\n /**\n * Disable all segments.\n */\n disabled?: boolean;\n /**\n * Render 1px separators between inactive segments. Defaults to `true`.\n */\n dividers?: boolean;\n /**\n * Optional form name (used when rendered inside a form).\n */\n name?: string;\n}\n\n// Outer-box height + text per size, picked so the control lines up\n// pixel-for-pixel with a `<Button>` of the same size token (xs h-6, sm h-7,\n// md=Button-default h-8, lg h-9). The box owns the height (border-box, so the\n// `p-0.5` + 1px border are included) and the segments stretch to fill it.\nconst sizeClass: Record<NonNullable<SegmentedProps[\"size\"]>, string> = {\n xs: \"h-6 text-xs\",\n sm: \"h-7 text-[0.8rem]\",\n md: \"h-8 text-sm\",\n lg: \"h-9 text-sm\",\n xl: \"h-11 text-base\",\n};\n\n// Horizontal padding per size, applied to each segment (height comes from the\n// stretched box, not the segment).\nconst itemPadClass: Record<NonNullable<SegmentedProps[\"size\"]>, string> = {\n xs: \"px-2\",\n sm: \"px-2.5\",\n md: \"px-3\",\n lg: \"px-4\",\n xl: \"px-5\",\n};\n\ninterface ThumbRect {\n left: number;\n top: number;\n width: number;\n height: number;\n /**\n * The segment this rect was measured for.\n */\n index: number;\n /**\n * Whether reaching this rect should SLIDE. Only a change of segment does:\n * a re-measure of the same segment (a resize, a popup settling its open\n * animation, the first paint) snaps, or the thumb glides in from wherever\n * the previous measurement put it every time the control appears.\n */\n slide: boolean;\n}\n\nexport const Segmented = (props: SegmentedProps) => {\n const {\n options,\n value: controlled,\n defaultValue,\n onChange,\n size = \"md\",\n variant = \"subtle\",\n fullWidth,\n disabled,\n dividers = true,\n name,\n className,\n ...rest\n } = props;\n\n const [uncontrolled, setUncontrolled] = React.useState<string | undefined>(\n defaultValue,\n );\n const value = controlled !== undefined ? controlled : uncontrolled;\n\n const containerRef = React.useRef<HTMLDivElement | null>(null);\n const itemRefs = React.useRef<Array<HTMLButtonElement | null>>([]);\n const [thumb, setThumb] = React.useState<ThumbRect | null>(null);\n\n const activeIndex = options.findIndex((opt) => opt.value === value);\n\n const measureThumb = React.useCallback(() => {\n if (activeIndex < 0) {\n setThumb(null);\n return;\n }\n const el = itemRefs.current[activeIndex];\n const container = containerRef.current;\n if (!el || !container) return;\n const elRect = el.getBoundingClientRect();\n const parentRect = container.getBoundingClientRect();\n // ⚠️ Subtract the container's border, or it is counted twice and the thumb\n // sits one border-width down and to the right of the segment it covers.\n //\n // `getBoundingClientRect()` measures the BORDER box, so this delta includes\n // the border. The thumb is `position: absolute`, whose containing block is\n // the padding box, an origin that already starts inside that same border.\n // Applying a border-box delta from a padding-box origin adds it a second\n // time.\n //\n // At the default 1px border it is a 1px drift on both axes, which reads as\n // the active surface being off-centre: 4px of gap above it and 2px below.\n // Visible, and easy to misdiagnose as missing padding, but padding cannot\n // be the fix, because the drift is equal on the horizontal axis where the\n // box is not symmetric to begin with.\n const parentStyle = getComputedStyle(container);\n const borderLeft = Number.parseFloat(parentStyle.borderLeftWidth) || 0;\n const borderTop = Number.parseFloat(parentStyle.borderTopWidth) || 0;\n // ⚠️ Undo any transform an ANCESTOR is applying while this measures.\n //\n // `getBoundingClientRect()` answers in on-screen pixels, after transforms;\n // the thumb is positioned in layout pixels, before them. Mounted inside a\n // popup that opens with `zoom-in-95`, the first measurement lands while\n // the popup is still at 95%: every offset and width comes back 5% short,\n // and the thumb stays that way, because the transform settling changes no\n // layout and so never wakes the ResizeObserver below. Seen as the \"is\n // not\" pill of a filter's operator switch sitting 5px left of its label\n // and 5px too narrow, on every reopen.\n //\n // `offsetWidth` is a layout measure of the same border box, so the ratio\n // is exactly the scale in force. Guarded for a detached or hidden node,\n // where both are zero.\n const scale =\n container.offsetWidth > 0 ? parentRect.width / container.offsetWidth : 1;\n // Physical on purpose: the thumb is placed from measured rects, which are\n // the same in either reading direction.\n setThumb((previous) => ({\n left: (elRect.left - parentRect.left) / scale - borderLeft,\n top: (elRect.top - parentRect.top) / scale - borderTop,\n width: elRect.width / scale,\n height: elRect.height / scale,\n index: activeIndex,\n slide: previous !== null && previous.index !== activeIndex,\n }));\n }, [activeIndex]);\n\n React.useLayoutEffect(() => {\n // Measures the DOM after it has been committed: there is nothing to\n // derive during render, the geometry does not exist yet.\n // oxlint-disable-next-line react/set-state-in-effect -- measures committed DOM, nothing to derive during render\n measureThumb();\n }, [measureThumb, options.length, size, fullWidth]);\n\n React.useEffect(() => {\n if (!containerRef.current) return;\n const observer = new ResizeObserver(() => measureThumb());\n observer.observe(containerRef.current);\n return () => observer.disconnect();\n }, [measureThumb]);\n\n // One Tab stop per group (WAI-ARIA radio group): the checked option, or\n // the first enabled one when none is checked. The arrow keys move inside.\n const tabStop =\n activeIndex >= 0 && !options[activeIndex]?.disabled\n ? activeIndex\n : options.findIndex((opt) => !opt.disabled);\n\n const handleSelect = (next: string) => {\n if (controlled === undefined) setUncontrolled(next);\n onChange?.(next);\n };\n\n /**\n * Arrow-key navigation, which `role=\"radiogroup\"` promises and this did not\n * deliver: a radio group moves between its options with the arrow keys, and\n * moving the selection moves the focus with it. Home and End jump to the\n * ends, and the walk wraps.\n *\n * Disabled options are stepped OVER rather than landed on, so a group whose\n * neighbour is disabled still reaches the one past it. A group with nothing\n * enabled to move to leaves the selection alone rather than looping forever.\n */\n const moveSelection = (from: number, step: number) => {\n for (let i = 1; i <= options.length; i++) {\n const next =\n (from + step * i + options.length * options.length) % options.length;\n const opt = options[next];\n if (!opt || opt.disabled) continue;\n handleSelect(opt.value);\n itemRefs.current[next]?.focus();\n return;\n }\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (disabled) return;\n const current = options.findIndex((o) => o.value === value);\n const from = current === -1 ? 0 : current;\n switch (inlineArrowKey(event)) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n event.preventDefault();\n moveSelection(from, 1);\n return;\n case \"ArrowLeft\":\n case \"ArrowUp\":\n event.preventDefault();\n moveSelection(from, -1);\n return;\n case \"Home\":\n event.preventDefault();\n moveSelection(-1, 1);\n return;\n case \"End\":\n event.preventDefault();\n moveSelection(options.length, -1);\n return;\n default:\n }\n };\n\n return (\n <div\n ref={containerRef}\n role=\"radiogroup\"\n aria-disabled={disabled || undefined}\n data-slot=\"segmented\"\n className={cn(\n // `overflow-hidden`: the thumb is placed from measured, fractional\n // rects, and a sub-pixel of it past the box made a scroll container\n // around the control (a detail page's tab strip) show a scrollbar\n // for some selections only. Clipped here, nothing of it reaches the\n // ancestor, so the segments' focus ring is drawn inset below.\n \"border-border relative box-border inline-flex items-stretch overflow-hidden rounded-md border p-0.5\",\n // `w-fit` rather than nothing: a flex item with an `auto` width is\n // stretched by a column parent, so only an explicit width keeps the\n // control the size of its labels. `max-w-full` lets a long one wrap\n // or shrink instead of overflowing.\n fullWidth ? \"flex w-full\" : \"w-fit max-w-full\",\n variant === \"solid\" ? \"bg-background\" : \"bg-muted/40\",\n sizeClass[size],\n disabled && \"opacity-50\",\n className,\n )}\n {...rest}\n >\n {thumb && (\n <span\n aria-hidden\n data-slot=\"segmented-thumb\"\n className={cn(\n \"bg-primary pointer-events-none absolute rounded-[calc(var(--radius)-2px)] shadow-sm\",\n // Animate only `transform`: it's GPU-composited in both browsers.\n // Transitioning width/height forces a per-frame reflow + box-shadow\n // repaint on the main thread, which Firefox handles poorly (visible\n // jank); Chrome's fast-paths hide it. Width/height still update, but\n // instantly; for equal-width segments they never change anyway, so\n // only the slide animates.\n //\n // Only while `slide` is set - see `ThumbRect.slide`. This replaces\n // a flag switched on one frame after the first measurement, which\n // kept the first paint still and then animated EVERY later\n // re-measure, including the ones that only correct a position.\n thumb.slide && \"transition-transform duration-200 ease-out\",\n )}\n style={{\n transform: `translate(${thumb.left}px, ${thumb.top}px)`,\n width: thumb.width,\n height: thumb.height,\n top: 0,\n left: 0,\n willChange: \"transform\",\n }}\n />\n )}\n {options.map((opt, index) => {\n const active = opt.value === value;\n const itemDisabled = disabled || opt.disabled;\n const showDivider =\n dividers && index > 0 && !active && index - 1 !== activeIndex;\n\n const button = (\n <button\n key={opt.value}\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={active}\n tabIndex={index === tabStop ? 0 : -1}\n aria-disabled={itemDisabled || undefined}\n disabled={itemDisabled}\n data-state={active ? \"active\" : \"inactive\"}\n data-slot=\"segmented-item\"\n aria-label={opt.tooltip ?? opt.title}\n title={opt.tooltip ? undefined : opt.title}\n name={name}\n value={opt.value}\n onClick={() => !itemDisabled && handleSelect(opt.value)}\n onKeyDown={onKeyDown}\n className={cn(\n \"relative z-10 inline-flex min-w-0 items-center justify-center rounded-[calc(var(--radius)-2px)] font-medium whitespace-nowrap\",\n \"transition-colors duration-150 ease-in-out\",\n \"focus-visible:ring-ring/50 focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset\",\n itemPadClass[size],\n active\n ? \"text-primary-foreground\"\n : \"text-muted-foreground hover:text-foreground\",\n itemDisabled && \"cursor-not-allowed opacity-50\",\n fullWidth && \"flex-1\",\n showDivider &&\n \"before:bg-border before:absolute before:inset-y-1.5 before:start-0 before:w-px before:content-['']\",\n )}\n >\n {opt.label}\n {opt.count !== undefined && opt.count !== null && (\n <span\n data-slot=\"segmented-count\"\n className={cn(\n \"ms-1.5 tabular-nums\",\n // Derived from the segment's own foreground rather than\n // from the resting muted token, which is chosen for a\n // different background. At FULL strength: white at `/70`\n // over the Blueprint blue primary measured 3.2:1, under\n // the 4.5 the Epics e2e holds it to, and at `/85` it is\n // still 4.0. `font-normal` keeps it secondary to the label.\n active\n ? \"text-primary-foreground font-normal\"\n : \"text-muted-foreground\",\n )}\n >\n {opt.count}\n </span>\n )}\n </button>\n );\n if (!opt.tooltip) return button;\n return (\n <Tooltip key={opt.value}>\n <TooltipTrigger render={button} />\n <TooltipContent>{opt.tooltip}</TooltipContent>\n </Tooltip>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;;;AA2FA,MAAM,YAAiE;CACrE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAIA,MAAM,eAAoE;CACxE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAoBA,MAAa,aAAa,UAA0B;CAClD,MAAM,EACJ,SACA,OAAO,YACP,cACA,UACA,OAAO,MACP,UAAU,UACV,WACA,UACA,WAAW,MACX,MACA,WACA,GAAG,SACD;CAEJ,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAC5C,YACF;CACA,MAAM,QAAQ,eAAe,KAAA,IAAY,aAAa;CAEtD,MAAM,eAAe,MAAM,OAA8B,IAAI;CAC7D,MAAM,WAAW,MAAM,OAAwC,CAAC,CAAC;CACjE,MAAM,CAAC,OAAO,YAAY,MAAM,SAA2B,IAAI;CAE/D,MAAM,cAAc,QAAQ,WAAW,QAAQ,IAAI,UAAU,KAAK;CAElE,MAAM,eAAe,MAAM,kBAAkB;EAC3C,IAAI,cAAc,GAAG;GACnB,SAAS,IAAI;GACb;EACF;EACA,MAAM,KAAK,SAAS,QAAQ;EAC5B,MAAM,YAAY,aAAa;EAC/B,IAAI,CAAC,MAAM,CAAC,WAAW;EACvB,MAAM,SAAS,GAAG,sBAAsB;EACxC,MAAM,aAAa,UAAU,sBAAsB;EAenD,MAAM,cAAc,iBAAiB,SAAS;EAC9C,MAAM,aAAa,OAAO,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AAO,IAAI,UAAU,KAAA,IAAY,IAAI;IAC/B;IACN,OAAO,IAAI;IACX,eAAe,CAAC,gBAAgB,aAAa,IAAI,KAAK;IAC3C;IACX,WAAW,GACT,iIACA,8CACA,uGACA,aAAa,OACb,SACI,4BACA,+CACJ,gBAAgB,iCAChB,aAAa,UACb,eACE,oGACJ;IA/BF,UAAA,CAiCG,IAAI,OACJ,IAAI,UAAU,KAAA,KAAa,IAAI,UAAU,QACxC,oBAAC,QAAD;KACE,aAAU;KACV,WAAW,GACT,uBAOA,SACI,wCACA,uBACN;KAEC,UAAA,IAAI;IACD,CAAA,CAEF;GApDD,GAAA,IAAI,KAoDH;GAEV,IAAI,CAAC,IAAI,SAAS,OAAO;GACzB,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD,EAAgB,QAAQ,OAAS,CAAA,GACjC,oBAAC,gBAAD,EAAA,UAAiB,IAAI,QAAwB,CAAA,CACtC,EAAA,GAHK,IAAI,KAGT;EAEb,CAAC,CACE;;AAET"}
@@ -1,6 +1,6 @@
1
+ import { Separator as Separator$1 } from "@base-ui/react/separator";
1
2
  import { cn } from "./utils.js";
2
3
  import { jsx } from "react/jsx-runtime";
3
- import { Separator as Separator$1 } from "@base-ui/react/separator";
4
4
  // src/core/Separator.tsx
5
5
  const Separator = (props) => {
6
6
  const { className, orientation = "horizontal", ...rest } = props;
@@ -1,9 +1,9 @@
1
- import { Button } from "./Button.js";
2
- import { cn } from "./utils.js";
1
+ import { Dialog } from "@base-ui/react/dialog";
3
2
  import { XIcon } from "lucide-react";
4
3
  import "react";
4
+ import { Button } from "./Button.js";
5
+ import { cn } from "./utils.js";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
- import { Dialog } from "@base-ui/react/dialog";
7
7
  // src/core/Sheet.tsx
8
8
  const Sheet = (props) => {
9
9
  return /* @__PURE__ */ jsx(Dialog.Root, {
@@ -1,3 +1,10 @@
1
+ import { mergeProps } from "@base-ui/react/merge-props";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+ import { AlephaError } from "alepha";
4
+ import { useI18n } from "alepha/react/i18n";
5
+ import { cva } from "class-variance-authority";
6
+ import { PanelLeftIcon } from "lucide-react";
7
+ import * as React from "react";
1
8
  import { Button } from "./Button.js";
2
9
  import { Input } from "./Input.js";
3
10
  import { Separator } from "./Separator.js";
@@ -6,14 +13,7 @@ import { Skeleton } from "./Skeleton.js";
6
13
  import { Tooltip, TooltipContent, TooltipTrigger } from "./Tooltip.js";
7
14
  import { useIsMobile } from "./useIsMobile.js";
8
15
  import { cn } from "./utils.js";
9
- import { useI18n } from "alepha/react/i18n";
10
- import { PanelLeftIcon } from "lucide-react";
11
- import * as React from "react";
12
- import { mergeProps } from "@base-ui/react/merge-props";
13
- import { useRender } from "@base-ui/react/use-render";
14
- import { cva } from "class-variance-authority";
15
16
  import { jsx, jsxs } from "react/jsx-runtime";
16
- import { AlephaError } from "alepha";
17
17
  // src/core/Sidebar.tsx
18
18
  const SIDEBAR_COOKIE_NAME = "sidebar_state";
19
19
  const SIDEBAR_COOKIE_MAX_AGE = 604800;
@@ -1,8 +1,8 @@
1
- import { cn } from "./utils.js";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useCspNonce } from "alepha/react/router";
4
1
  import { CSPProvider } from "@base-ui/react/csp-provider";
5
2
  import { Slider as Slider$1 } from "@base-ui/react/slider";
3
+ import { useCspNonce } from "alepha/react/router";
4
+ import { cn } from "./utils.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
6
  // src/core/Slider.tsx
7
7
  const Slider = (props) => {
8
8
  const { className, defaultValue, value, min = 0, max = 100, ...rest } = props;
@@ -1,5 +1,5 @@
1
- import { cn } from "./utils.js";
2
1
  import { Loader2Icon } from "lucide-react";
2
+ import { cn } from "./utils.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  // src/core/Spinner.tsx
5
5
  const Spinner = (props) => {
@@ -1,5 +1,5 @@
1
- import { cn } from "./utils.js";
2
1
  import { Check } from "lucide-react";
2
+ import { cn } from "./utils.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  // src/core/Stepper.tsx
5
5
  /** The state of the step at `index` when `current` is on screen. */
@@ -1,6 +1,6 @@
1
+ import { Switch as Switch$1 } from "@base-ui/react/switch";
1
2
  import { cn } from "./utils.js";
2
3
  import { jsx } from "react/jsx-runtime";
3
- import { Switch as Switch$1 } from "@base-ui/react/switch";
4
4
  // src/core/Switch.tsx
5
5
  const Switch = (props) => {
6
6
  const { className, size = "default", ...rest } = props;
@@ -1,5 +1,5 @@
1
- import { cn } from "./utils.js";
2
1
  import "react";
2
+ import { cn } from "./utils.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  // src/core/Table.tsx
5
5
  const Table = (props) => {
@@ -1,5 +1,5 @@
1
- import { cn } from "./utils.js";
2
1
  import "react";
2
+ import { cn } from "./utils.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  // src/core/Textarea.tsx
5
5
  const Textarea = (props) => {
@@ -7,7 +7,8 @@ export interface TimeAgoProps {
7
7
  */
8
8
  value: string | number | Date | DateTime;
9
9
  /**
10
- * The exact form, shown on hover and rendered on the server.
10
+ * The exact form, shown on hover and rendered on the server (there in
11
+ * UTC, so that hydration renders the same text in any timezone).
11
12
  *
12
13
  * ⚠️ A dayjs format string, not an `Intl` options bag.
13
14
  * `I18nLocalizeOptions` has `date` and `number` only - there is no `time` -
@@ -39,10 +40,16 @@ export interface TimeAgoProps {
39
40
  *
40
41
  * The server renders the EXACT datetime rather than nothing. A crawler, a
41
42
  * reader with no JavaScript and the first paint all get a true answer instead
42
- * of a blank, which matters on `/:projectSlug/roadmap` - the one page Lore
43
- * server-renders for an audience that may never run the client. The visible
44
- * swap on hydration is the price, and it is a swap from correct to more
45
- * readable.
43
+ * of a blank, which matters on a page server-rendered for an audience that
44
+ * may never run the client. The visible swap on hydration is the price, and
45
+ * it is a swap from correct to more readable.
46
+ *
47
+ * ⚠️ That exact datetime is written in UTC, and says so. The hydration pass
48
+ * renders the same fallback in the browser, whose timezone is the reader's,
49
+ * not the server's: formatted in the local zone, a prerender made in UTC and
50
+ * hydrated in Paris near midnight disagree on the day, and React throws #418
51
+ * (alepha.dev's docs pages did, on their "Last commit" date). Once mounted,
52
+ * the title carries the reader's local time.
46
53
  *
47
54
  * ## Where NOT to use it
48
55
  *
@@ -1 +1 @@
1
- {"version":3,"file":"TimeAgo.d.ts","sourceRoot":"","sources":["../../src/core/TimeAgo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC;IAEzC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,QAAA,MAAM,OAAO,UAAW,YAAY,gCAiBnC,CAAC;eAEa,OAAO"}
1
+ {"version":3,"file":"TimeAgo.d.ts","sourceRoot":"","sources":["../../src/core/TimeAgo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC;IAEzC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,QAAA,MAAM,OAAO,UAAW,YAAY,gCAqBnC,CAAC;eAEa,OAAO"}
@@ -25,10 +25,16 @@ import { jsx } from "react/jsx-runtime";
25
25
  *
26
26
  * The server renders the EXACT datetime rather than nothing. A crawler, a
27
27
  * reader with no JavaScript and the first paint all get a true answer instead
28
- * of a blank, which matters on `/:projectSlug/roadmap` - the one page Lore
29
- * server-renders for an audience that may never run the client. The visible
30
- * swap on hydration is the price, and it is a swap from correct to more
31
- * readable.
28
+ * of a blank, which matters on a page server-rendered for an audience that
29
+ * may never run the client. The visible swap on hydration is the price, and
30
+ * it is a swap from correct to more readable.
31
+ *
32
+ * ⚠️ That exact datetime is written in UTC, and says so. The hydration pass
33
+ * renders the same fallback in the browser, whose timezone is the reader's,
34
+ * not the server's: formatted in the local zone, a prerender made in UTC and
35
+ * hydrated in Paris near midnight disagree on the day, and React throws #418
36
+ * (alepha.dev's docs pages did, on their "Last commit" date). Once mounted,
37
+ * the title carries the reader's local time.
32
38
  *
33
39
  * ## Where NOT to use it
34
40
  *
@@ -40,12 +46,17 @@ import { jsx } from "react/jsx-runtime";
40
46
  */
41
47
  const TimeAgo = (props) => {
42
48
  const { l } = useI18n();
43
- const exact = l(props.value, { date: props.format ?? "lll" });
49
+ const format = props.format ?? "lll";
50
+ const utc = `${l(props.value, {
51
+ date: format,
52
+ timezone: "UTC"
53
+ })} UTC`;
54
+ const exact = l(props.value, { date: format });
44
55
  return /* @__PURE__ */ jsx(ClientOnly, {
45
56
  fallback: /* @__PURE__ */ jsx("span", {
46
57
  className: props.className,
47
- title: exact,
48
- children: exact
58
+ title: utc,
59
+ children: utc
49
60
  }),
50
61
  children: /* @__PURE__ */ jsx("span", {
51
62
  className: props.className,
@@ -1 +1 @@
1
- {"version":3,"file":"TimeAgo.js","names":[],"sources":["../../src/core/TimeAgo.tsx"],"sourcesContent":["import type { DateTime } from \"alepha/datetime\";\nimport { ClientOnly } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\n\nexport interface TimeAgoProps {\n /**\n * The instant. The same set `useI18n().l()` takes, `DateTime` included -\n * `DateTimeProvider.now()` returns one, so a narrower type here would make\n * the component unusable from exactly the place that owns the clock.\n */\n value: string | number | Date | DateTime;\n\n /**\n * The exact form, shown on hover and rendered on the server.\n *\n * ⚠️ A dayjs format string, not an `Intl` options bag.\n * `I18nLocalizeOptions` has `date` and `number` only - there is no `time` -\n * so `lll` is how a date AND a time are asked for.\n */\n format?: string;\n\n className?: string;\n}\n\n/**\n * An instant, read as \"2 hours ago\", with the exact datetime on hover.\n *\n * ## Why a component and not a fifth spelling\n *\n * There were four ways to write this - `dt.of(x).fromNow()`,\n * `dateFormatter.of(x).fromNow()`, `l(x, { date: \"fromNow\" })` and\n * `<Localize value={x} date=\"fromNow\" />` - and **none of them carried the\n * exact date**. A tooltip added by hand is a tooltip added to some call sites\n * and forgotten on the rest, which is what the Apps table's Last seen column\n * demonstrated by rendering four rows of `Sep 9, 2026 7:00 PM` and making the\n * reader subtract dates to see whether a copy was alive (feedback #P2174).\n *\n * ## ⚠️ The SSR guard is built in, and that is the point\n *\n * A `fromNow()` string is computed from the clock, so it differs between the\n * server render and hydration and trips React #418. Before this component\n * there were 11 `ClientOnly` guards against 42 relative-time call sites: most\n * were simply unguarded. Putting the guard inside means the next call site\n * cannot forget it.\n *\n * The server renders the EXACT datetime rather than nothing. A crawler, a\n * reader with no JavaScript and the first paint all get a true answer instead\n * of a blank, which matters on `/:projectSlug/roadmap` - the one page Lore\n * server-renders for an audience that may never run the client. The visible\n * swap on hydration is the price, and it is a swap from correct to more\n * readable.\n *\n * ## Where NOT to use it\n *\n * A date somebody CHOSE, rather than one that happened: a release target\n * date, a quest due date. \"in 3 months\" is not a deadline anyone can plan\n * against, and the relative form actively destroys the information. Relative\n * time is for events - created, updated, last seen, last reported - where the\n * question is \"how stale is this\" and the answer is the gap, not the date.\n */\nconst TimeAgo = (props: TimeAgoProps) => {\n const { l } = useI18n();\n const exact = l(props.value, { date: props.format ?? \"lll\" });\n\n return (\n <ClientOnly\n fallback={\n <span className={props.className} title={exact}>\n {exact}\n </span>\n }\n >\n <span className={props.className} title={exact}>\n {l(props.value, { date: \"fromNow\" })}\n </span>\n </ClientOnly>\n );\n};\n\nexport default TimeAgo;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,WAAW,UAAwB;CACvC,MAAM,EAAE,MAAM,QAAQ;CACtB,MAAM,QAAQ,EAAE,MAAM,OAAO,EAAE,MAAM,MAAM,UAAU,MAAM,CAAC;CAE5D,OACE,oBAAC,YAAD;EACE,UACE,oBAAC,QAAD;GAAM,WAAW,MAAM;GAAW,OAAO;GACtC,UAAA;EACG,CAAA;EAGR,UAAA,oBAAC,QAAD;GAAM,WAAW,MAAM;GAAW,OAAO;GACtC,UAAA,EAAE,MAAM,OAAO,EAAE,MAAM,UAAU,CAAC;EAC/B,CAAA;CACI,CAAA;AAEhB"}
1
+ {"version":3,"file":"TimeAgo.js","names":[],"sources":["../../src/core/TimeAgo.tsx"],"sourcesContent":["import type { DateTime } from \"alepha/datetime\";\nimport { ClientOnly } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\n\nexport interface TimeAgoProps {\n /**\n * The instant. The same set `useI18n().l()` takes, `DateTime` included -\n * `DateTimeProvider.now()` returns one, so a narrower type here would make\n * the component unusable from exactly the place that owns the clock.\n */\n value: string | number | Date | DateTime;\n\n /**\n * The exact form, shown on hover and rendered on the server (there in\n * UTC, so that hydration renders the same text in any timezone).\n *\n * ⚠️ A dayjs format string, not an `Intl` options bag.\n * `I18nLocalizeOptions` has `date` and `number` only - there is no `time` -\n * so `lll` is how a date AND a time are asked for.\n */\n format?: string;\n\n className?: string;\n}\n\n/**\n * An instant, read as \"2 hours ago\", with the exact datetime on hover.\n *\n * ## Why a component and not a fifth spelling\n *\n * There were four ways to write this - `dt.of(x).fromNow()`,\n * `dateFormatter.of(x).fromNow()`, `l(x, { date: \"fromNow\" })` and\n * `<Localize value={x} date=\"fromNow\" />` - and **none of them carried the\n * exact date**. A tooltip added by hand is a tooltip added to some call sites\n * and forgotten on the rest, which is what the Apps table's Last seen column\n * demonstrated by rendering four rows of `Sep 9, 2026 7:00 PM` and making the\n * reader subtract dates to see whether a copy was alive (feedback #P2174).\n *\n * ## ⚠️ The SSR guard is built in, and that is the point\n *\n * A `fromNow()` string is computed from the clock, so it differs between the\n * server render and hydration and trips React #418. Before this component\n * there were 11 `ClientOnly` guards against 42 relative-time call sites: most\n * were simply unguarded. Putting the guard inside means the next call site\n * cannot forget it.\n *\n * The server renders the EXACT datetime rather than nothing. A crawler, a\n * reader with no JavaScript and the first paint all get a true answer instead\n * of a blank, which matters on a page server-rendered for an audience that\n * may never run the client. The visible swap on hydration is the price, and\n * it is a swap from correct to more readable.\n *\n * ⚠️ That exact datetime is written in UTC, and says so. The hydration pass\n * renders the same fallback in the browser, whose timezone is the reader's,\n * not the server's: formatted in the local zone, a prerender made in UTC and\n * hydrated in Paris near midnight disagree on the day, and React throws #418\n * (alepha.dev's docs pages did, on their \"Last commit\" date). Once mounted,\n * the title carries the reader's local time.\n *\n * ## Where NOT to use it\n *\n * A date somebody CHOSE, rather than one that happened: a release target\n * date, a quest due date. \"in 3 months\" is not a deadline anyone can plan\n * against, and the relative form actively destroys the information. Relative\n * time is for events - created, updated, last seen, last reported - where the\n * question is \"how stale is this\" and the answer is the gap, not the date.\n */\nconst TimeAgo = (props: TimeAgoProps) => {\n const { l } = useI18n();\n const format = props.format ?? \"lll\";\n // The same text on the server and in the hydration pass, whatever zone\n // either runs in.\n const utc = `${l(props.value, { date: format, timezone: \"UTC\" })} UTC`;\n const exact = l(props.value, { date: format });\n\n return (\n <ClientOnly\n fallback={\n <span className={props.className} title={utc}>\n {utc}\n </span>\n }\n >\n <span className={props.className} title={exact}>\n {l(props.value, { date: \"fromNow\" })}\n </span>\n </ClientOnly>\n );\n};\n\nexport default TimeAgo;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,MAAM,WAAW,UAAwB;CACvC,MAAM,EAAE,MAAM,QAAQ;CACtB,MAAM,SAAS,MAAM,UAAU;CAG/B,MAAM,MAAM,GAAG,EAAE,MAAM,OAAO;EAAE,MAAM;EAAQ,UAAU;CAAM,CAAC,EAAE;CACjE,MAAM,QAAQ,EAAE,MAAM,OAAO,EAAE,MAAM,OAAO,CAAC;CAE7C,OACE,oBAAC,YAAD;EACE,UACE,oBAAC,QAAD;GAAM,WAAW,MAAM;GAAW,OAAO;GACtC,UAAA;EACG,CAAA;EAGR,UAAA,oBAAC,QAAD;GAAM,WAAW,MAAM;GAAW,OAAO;GACtC,UAAA,EAAE,MAAM,OAAO,EAAE,MAAM,UAAU,CAAC;EAC/B,CAAA;CACI,CAAA;AAEhB"}
@@ -1,8 +1,8 @@
1
1
  import { useI18n } from "alepha/react/i18n";
2
+ import { useColorMode } from "alepha/react/ui";
2
3
  import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon } from "lucide-react";
3
- import { jsx } from "react/jsx-runtime";
4
4
  import { Toaster as Toaster$1 } from "sonner";
5
- import { useColorMode } from "alepha/react/ui";
5
+ import { jsx } from "react/jsx-runtime";
6
6
  // src/core/Toaster.tsx
7
7
  const Toaster = (props) => {
8
8
  const { mode } = useColorMode();
@@ -1,6 +1,6 @@
1
+ import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
1
2
  import { cn } from "./utils.js";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
4
4
  // src/core/Tooltip.tsx
5
5
  const TooltipProvider = (props) => {
6
6
  const { delay = 600, ...rest } = props;
@@ -1,9 +1,9 @@
1
- import { FileImage } from "./FileImage.js";
2
- import { userAvatarTone, userDisplayName, userInitials } from "./userInitials.js";
3
- import { cn } from "./utils.js";
4
1
  import { AlephaContext } from "alepha/react";
5
2
  import { User } from "lucide-react";
6
3
  import { useContext } from "react";
4
+ import { FileImage } from "./FileImage.js";
5
+ import { userAvatarTone, userDisplayName, userInitials } from "./userInitials.js";
6
+ import { cn } from "./utils.js";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  // src/core/UserAvatar.tsx
9
9
  /**