@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 +1 @@
1
- {"version":3,"file":"useDataTableRefresh.js","names":[],"sources":["../../src/table/useDataTableRefresh.ts"],"sourcesContent":["import type { Alepha, ZObject } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport type { I18nProvider } from \"alepha/react/i18n\";\nimport {\n type Dispatch,\n type SetStateAction,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\n\nimport type { Toast } from \"../core/useToast.tsx\";\nimport type { DataTableBaseProps } from \"./dataTableBaseProps.ts\";\nimport { writePersisted } from \"./dataTablePersistence.ts\";\nimport type {\n DataTableFilterFields,\n DataTableSource,\n} from \"./dataTableTypes.ts\";\nimport { cleanFilterValues, shareFiltersUrl } from \"./queryFilters.ts\";\n\nexport interface UseDataTableRefreshOptions<T> {\n props: DataTableBaseProps<T, DataTableFilterFields> &\n DataTableSource<T, DataTableFilterFields>;\n form: FormModel<ZObject> | undefined;\n /**\n * Every filter key, operator keys included, as read at mount. Reset clears\n * each of them and Share rewrites each of them.\n */\n filterKeys: readonly string[];\n /**\n * Put the bar back to its declaration. Reset filters is one act: the\n * values empty and the bar returns to what the table declares, together.\n */\n resetShownFilters: () => void;\n /**\n * The key the filter values are persisted under, or `undefined` when the\n * table does not store them.\n */\n filtersKey: string | undefined;\n alepha: Alepha;\n toast: Toast;\n tr: I18nProvider<any, any>[\"tr\"];\n setPage: Dispatch<SetStateAction<number>>;\n setRefreshKey: Dispatch<SetStateAction<number>>;\n setIsRefreshing: Dispatch<SetStateAction<boolean>>;\n}\n\n/**\n * What makes `DataTable` fetch again, and the filter actions that sit\n * beside it: the refresh button and `refreshSignal`, filter reset and share,\n * the filter form's submit and change events (with the filter persistence\n * they drive), and polling.\n *\n * It owns no row state. The page and the refresh key it writes belong to\n * `useDataTableData`.\n */\nexport const useDataTableRefresh = <T>(\n options: UseDataTableRefreshOptions<T>,\n) => {\n const {\n props,\n form,\n filterKeys,\n resetShownFilters,\n filtersKey,\n alepha,\n toast,\n tr,\n setPage,\n setRefreshKey,\n setIsRefreshing,\n } = options;\n\n // -- Refresh + reset wiring -----------------------------------------------\n\n const refresh = useCallback(() => {\n setPage(0);\n setRefreshKey((k) => k + 1);\n }, []);\n\n /**\n * Fetch the page again where the reader is: no jump to page one, no\n * skeleton (the rows stay until the new ones land). What a row action\n * wants after a write, where `refresh` is what a filter change wants.\n */\n const reload = useCallback(() => {\n setRefreshKey((k) => k + 1);\n }, []);\n\n // The spinner's one-second timer, cleared on unmount: a table that is gone\n // must not take a state update (in a jsdom spec, it lands after teardown).\n const spinTimer = useRef<ReturnType<typeof setTimeout> | undefined>(\n undefined,\n );\n useEffect(() => () => clearTimeout(spinTimer.current), []);\n\n const handleRefreshClick = useCallback(() => {\n setIsRefreshing(true);\n refresh();\n clearTimeout(spinTimer.current);\n spinTimer.current = setTimeout(() => setIsRefreshing(false), 1000);\n }, [refresh]);\n\n // React to the external `refreshSignal` prop. The first render seeds the\n // ref without refetching (the mount effect already loads); every later\n // change triggers a refresh. Kept separate from `load`'s deps so an inline\n // `fetch` closure can't self-trigger a loop (see `fetchRef` above).\n const refreshSignalRef = useRef(props.refreshSignal);\n useEffect(() => {\n if (refreshSignalRef.current === props.refreshSignal) return;\n refreshSignalRef.current = props.refreshSignal;\n refresh();\n }, [props.refreshSignal, refresh]);\n\n const resetFilters = useCallback(() => {\n if (!form || !props.filters) return;\n // Per-field `.set(undefined)` is necessary: `setInitialValues({})`\n // doesn't emit `form:changed` for deleted keys, so inputs stay\n // visually populated and subscribers don't refetch. Explicit set\n // keeps everyone in sync.\n for (const key of filterKeys) {\n const input = (form.input as Record<string, { set?: (v: any) => void }>)[\n key\n ];\n input?.set?.(undefined);\n }\n resetShownFilters();\n }, [form, props.filters, filterKeys, resetShownFilters]);\n\n /**\n * Copy a link that opens this table with these filters.\n *\n * The write half of `fromQuery`, and the only one: nothing puts the\n * filters in the address bar as the reader types, so a link out of a\n * filtered table has to be asked for. Built on the page's own URL, so the\n * params the page owns travel with it.\n */\n /**\n * Whether a link out of this table would do anything on arrival.\n *\n * A table that does not read the query back would copy a URL whose params\n * are inert, which is worse than no Share at all: it looks like it worked.\n */\n const canShare = Boolean(props.filters?.fromQuery);\n\n const shareFilters = useCallback(async () => {\n if (!props.filters || !form) return;\n const url = shareFiltersUrl(\n window.location.href,\n filterKeys,\n cleanFilterValues(form.currentValues ?? {}),\n );\n try {\n await navigator.clipboard.writeText(url);\n toast.success(\n tr(\"dataTable.shareFiltersCopied\", { default: \"Link copied\" }),\n );\n } catch {\n // A denied clipboard permission, or an insecure origin. Nothing here\n // is worth an error toast the reader cannot act on.\n }\n }, [form, props.filters, filterKeys, toast, tr]);\n\n // -- Form event subscriptions ---------------------------------------------\n\n // Refetch on explicit submit (manual Apply, programmatic submit, etc.).\n useEffect(() => {\n if (!form) return;\n return alepha.events.on(\"form:submit:success\", (event) => {\n if (event.id !== form.id) return;\n setPage(0);\n setRefreshKey((k) => k + 1);\n });\n }, [alepha, form]);\n\n // Refetch on change (debounced) when autoApplyFilters is on. Default\n // is on whenever DataTable owns the form (`filters` prop).\n const autoApply = props.autoApplyFilters ?? Boolean(props.filters);\n useEffect(() => {\n if (!form || !autoApply) return;\n let timeout: ReturnType<typeof setTimeout> | undefined;\n const unsub = alepha.events.on(\"form:changed\", (event) => {\n if (event.id !== form.id) return;\n if (timeout) clearTimeout(timeout);\n timeout = setTimeout(() => {\n setPage(0);\n setRefreshKey((k) => k + 1);\n }, 250);\n });\n return () => {\n if (timeout) clearTimeout(timeout);\n unsub();\n };\n }, [alepha, form, autoApply]);\n\n // Persist filter values to localStorage on change.\n useEffect(() => {\n if (!filtersKey || !form || !props.filters) return;\n const writeFilters = () => {\n writePersisted(\n filtersKey,\n \"filters\",\n cleanFilterValues(form.currentValues ?? {}),\n );\n };\n const unsubs = [\n alepha.events.on(\"form:changed\", (event) => {\n if (event.id !== form.id) return;\n writeFilters();\n }),\n alepha.events.on(\"form:submit:success\", (event) => {\n if (event.id !== form.id) return;\n writeFilters();\n }),\n ];\n return () => {\n for (const u of unsubs) u();\n };\n }, [alepha, form, props.filters, filtersKey]);\n\n // -- Polling ---------------------------------------------------------------\n\n useEffect(() => {\n if (!props.pollMs) return;\n const id = setInterval(() => {\n if (document.visibilityState === \"visible\") setRefreshKey((k) => k + 1);\n }, props.pollMs);\n return () => clearInterval(id);\n }, [props.pollMs]);\n\n return {\n refresh,\n reload,\n handleRefreshClick,\n resetFilters,\n canShare,\n shareFilters,\n };\n};\n"],"mappings":";;;;;;;;;;;;;AAwDA,MAAa,uBACX,YACG;CACH,MAAM,EACJ,OACA,MACA,YACA,mBACA,YACA,QACA,OACA,IACA,SACA,eACA,oBACE;CAIJ,MAAM,UAAU,kBAAkB;EAChC,QAAQ,CAAC;EACT,eAAe,MAAM,IAAI,CAAC;CAC5B,GAAG,CAAC,CAAC;;;;;;CAOL,MAAM,SAAS,kBAAkB;EAC/B,eAAe,MAAM,IAAI,CAAC;CAC5B,GAAG,CAAC,CAAC;CAIL,MAAM,YAAY,OAChB,KAAA,CACF;CACA,sBAAsB,aAAa,UAAU,OAAO,GAAG,CAAC,CAAC;CAEzD,MAAM,qBAAqB,kBAAkB;EAC3C,gBAAgB,IAAI;EACpB,QAAQ;EACR,aAAa,UAAU,OAAO;EAC9B,UAAU,UAAU,iBAAiB,gBAAgB,KAAK,GAAG,GAAI;CACnE,GAAG,CAAC,OAAO,CAAC;CAMZ,MAAM,mBAAmB,OAAO,MAAM,aAAa;CACnD,gBAAgB;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AC;IACT,eAAe,MAAM,IAAI,CAAC;GAC5B,GAAG,GAAG;EACR,CAAC;EACD,aAAa;GACX,IAAI,SAAS,aAAa,OAAO;GACjC,MAAM;EACR;CACF,GAAG;EAAC;EAAQ;EAAM;CAAS,CAAC;CAG5B,gBAAgB;EACd,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,SAAS;EAC5C,MAAM,qBAAqB;GACzB,eACE,YACA,WACA,kBAAkB,KAAK,iBAAiB,CAAC,CAAC,CAC5C;EACF;EACA,MAAM,SAAS,CACb,OAAO,OAAO,GAAG,iBAAiB,UAAU;GAC1C,IAAI,MAAM,OAAO,KAAK,IAAI;GAC1B,aAAa;EACf,CAAC,GACD,OAAO,OAAO,GAAG,wBAAwB,UAAU;GACjD,IAAI,MAAM,OAAO,KAAK,IAAI;GAC1B,aAAa;EACf,CAAC,CACH;EACA,aAAa;GACX,KAAK,MAAM,KAAK,QAAQ,EAAE;EAC5B;CACF,GAAG;EAAC;EAAQ;EAAM,MAAM;EAAS;CAAU,CAAC;CAI5C,gBAAgB;EACd,IAAI,CAAC,MAAM,QAAQ;EACnB,MAAM,KAAK,kBAAkB;GAC3B,IAAI,SAAS,oBAAoB,WAAW,eAAe,MAAM,IAAI,CAAC;EACxE,GAAG,MAAM,MAAM;EACf,aAAa,cAAc,EAAE;CAC/B,GAAG,CAAC,MAAM,MAAM,CAAC;CAEjB,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"useDataTableRefresh.js","names":[],"sources":["../../src/table/useDataTableRefresh.ts"],"sourcesContent":["import type { Alepha, ZObject } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport type { I18nProvider } from \"alepha/react/i18n\";\nimport {\n type Dispatch,\n type SetStateAction,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\n\nimport type { Toast } from \"../core/useToast.tsx\";\nimport type { DataTableBaseProps } from \"./dataTableBaseProps.ts\";\nimport { writePersisted } from \"./dataTablePersistence.ts\";\nimport type {\n DataTableFilterFields,\n DataTableSource,\n} from \"./dataTableTypes.ts\";\nimport { cleanFilterValues, shareFiltersUrl } from \"./queryFilters.ts\";\n\nexport interface UseDataTableRefreshOptions<T> {\n props: DataTableBaseProps<T, DataTableFilterFields> &\n DataTableSource<T, DataTableFilterFields>;\n form: FormModel<ZObject> | undefined;\n /**\n * Every filter key, operator keys included, as read at mount. Reset clears\n * each of them and Share rewrites each of them.\n */\n filterKeys: readonly string[];\n /**\n * Put the bar back to its declaration. Reset filters is one act: the\n * values empty and the bar returns to what the table declares, together.\n */\n resetShownFilters: () => void;\n /**\n * The key the filter values are persisted under, or `undefined` when the\n * table does not store them.\n */\n filtersKey: string | undefined;\n alepha: Alepha;\n toast: Toast;\n tr: I18nProvider<any, any>[\"tr\"];\n setPage: Dispatch<SetStateAction<number>>;\n setRefreshKey: Dispatch<SetStateAction<number>>;\n setIsRefreshing: Dispatch<SetStateAction<boolean>>;\n}\n\n/**\n * What makes `DataTable` fetch again, and the filter actions that sit\n * beside it: the refresh button and `refreshSignal`, filter reset and share,\n * the filter form's submit and change events (with the filter persistence\n * they drive), and polling.\n *\n * It owns no row state. The page and the refresh key it writes belong to\n * `useDataTableData`.\n */\nexport const useDataTableRefresh = <T>(\n options: UseDataTableRefreshOptions<T>,\n) => {\n const {\n props,\n form,\n filterKeys,\n resetShownFilters,\n filtersKey,\n alepha,\n toast,\n tr,\n setPage,\n setRefreshKey,\n setIsRefreshing,\n } = options;\n\n // -- Refresh + reset wiring -----------------------------------------------\n\n const refresh = useCallback(() => {\n setPage(0);\n setRefreshKey((k) => k + 1);\n }, []);\n\n /**\n * Fetch the page again where the reader is: no jump to page one, no\n * skeleton (the rows stay until the new ones land). What a row action\n * wants after a write, where `refresh` is what a filter change wants.\n */\n const reload = useCallback(() => {\n setRefreshKey((k) => k + 1);\n }, []);\n\n // The spinner's one-second timer, cleared on unmount: a table that is gone\n // must not take a state update (in a jsdom spec, it lands after teardown).\n const spinTimer = useRef<ReturnType<typeof setTimeout> | undefined>(\n undefined,\n );\n useEffect(() => () => clearTimeout(spinTimer.current), []);\n\n const handleRefreshClick = useCallback(() => {\n setIsRefreshing(true);\n refresh();\n clearTimeout(spinTimer.current);\n spinTimer.current = setTimeout(() => setIsRefreshing(false), 1000);\n }, [refresh]);\n\n // React to the external `refreshSignal` prop. The first render seeds the\n // ref without refetching (the mount effect already loads); every later\n // change triggers a refresh. Kept separate from `load`'s deps so an inline\n // `fetch` closure can't self-trigger a loop (see `fetchRef` above).\n const refreshSignalRef = useRef(props.refreshSignal);\n useEffect(() => {\n if (refreshSignalRef.current === props.refreshSignal) return;\n refreshSignalRef.current = props.refreshSignal;\n refresh();\n }, [props.refreshSignal, refresh]);\n\n const resetFilters = useCallback(() => {\n if (!form || !props.filters) return;\n // Per-field `.set(undefined)` is necessary: `setInitialValues({})`\n // doesn't emit `form:changed` for deleted keys, so inputs stay\n // visually populated and subscribers don't refetch. Explicit set\n // keeps everyone in sync.\n for (const key of filterKeys) {\n const input = (form.input as Record<string, { set?: (v: any) => void }>)[\n key\n ];\n input?.set?.(undefined);\n }\n resetShownFilters();\n }, [form, props.filters, filterKeys, resetShownFilters]);\n\n /**\n * Copy a link that opens this table with these filters.\n *\n * The write half of `fromQuery`, and the only one: nothing puts the\n * filters in the address bar as the reader types, so a link out of a\n * filtered table has to be asked for. Built on the page's own URL, so the\n * params the page owns travel with it.\n */\n /**\n * Whether a link out of this table would do anything on arrival.\n *\n * A table that does not read the query back would copy a URL whose params\n * are inert, which is worse than no Share at all: it looks like it worked.\n */\n const canShare = Boolean(props.filters?.fromQuery);\n\n const shareFilters = useCallback(async () => {\n if (!props.filters || !form) return;\n const url = shareFiltersUrl(\n window.location.href,\n filterKeys,\n cleanFilterValues(form.currentValues ?? {}),\n );\n try {\n await navigator.clipboard.writeText(url);\n toast.success(\n tr(\"dataTable.shareFiltersCopied\", { default: \"Link copied\" }),\n );\n } catch {\n // A denied clipboard permission, or an insecure origin. Nothing here\n // is worth an error toast the reader cannot act on.\n }\n }, [form, props.filters, filterKeys, toast, tr]);\n\n // -- Form event subscriptions ---------------------------------------------\n\n // Refetch on explicit submit (manual Apply, programmatic submit, etc.).\n useEffect(() => {\n if (!form) return;\n return alepha.events.on(\"form:submit:success\", (event) => {\n if (event.id !== form.id) return;\n setPage(0);\n setRefreshKey((k) => k + 1);\n });\n }, [alepha, form]);\n\n // Refetch on change (debounced) when autoApplyFilters is on. Default\n // is on whenever DataTable owns the form (`filters` prop).\n const autoApply = props.autoApplyFilters ?? Boolean(props.filters);\n useEffect(() => {\n if (!form || !autoApply) return;\n let timeout: ReturnType<typeof setTimeout> | undefined;\n const unsub = alepha.events.on(\"form:changed\", (event) => {\n if (event.id !== form.id) return;\n if (timeout) clearTimeout(timeout);\n timeout = setTimeout(() => {\n setPage(0);\n setRefreshKey((k) => k + 1);\n }, 250);\n });\n return () => {\n if (timeout) clearTimeout(timeout);\n unsub();\n };\n }, [alepha, form, autoApply]);\n\n // Persist filter values on change, to `persistenceStorage` (localStorage\n // by default).\n useEffect(() => {\n if (!filtersKey || !form || !props.filters) return;\n const writeFilters = () => {\n writePersisted(\n filtersKey,\n \"filters\",\n cleanFilterValues(form.currentValues ?? {}),\n props.persistenceStorage,\n );\n };\n const unsubs = [\n alepha.events.on(\"form:changed\", (event) => {\n if (event.id !== form.id) return;\n writeFilters();\n }),\n alepha.events.on(\"form:submit:success\", (event) => {\n if (event.id !== form.id) return;\n writeFilters();\n }),\n ];\n return () => {\n for (const u of unsubs) u();\n };\n }, [alepha, form, props.filters, filtersKey, props.persistenceStorage]);\n\n // -- Polling ---------------------------------------------------------------\n\n useEffect(() => {\n if (!props.pollMs) return;\n const id = setInterval(() => {\n if (document.visibilityState === \"visible\") setRefreshKey((k) => k + 1);\n }, props.pollMs);\n return () => clearInterval(id);\n }, [props.pollMs]);\n\n return {\n refresh,\n reload,\n handleRefreshClick,\n resetFilters,\n canShare,\n shareFilters,\n };\n};\n"],"mappings":";;;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AQ;EAAM,MAAM;EAAS;EAAY,MAAM;CAAkB,CAAC;CAItE,gBAAgB;EACd,IAAI,CAAC,MAAM,QAAQ;EACnB,MAAM,KAAK,kBAAkB;GAC3B,IAAI,SAAS,oBAAoB,WAAW,eAAe,MAAM,IAAI,CAAC;EACxE,GAAG,MAAM,MAAM;EACf,aAAa,cAAc,EAAE;CAC/B,GAAG,CAAC,MAAM,MAAM,CAAC;CAEjB,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -1,5 +1,6 @@
1
1
  import type { Alepha, ZObject } from "alepha";
2
2
  import type { FormModel } from "alepha/react/form";
3
+ import { type DataTablePersistenceStorage } from "./dataTablePersistence.ts";
3
4
  import type { DataTableFilterFields, DataTableStatCard, DataTableSummary } from "./dataTableTypes.ts";
4
5
  export interface UseDataTableSummaryOptions {
5
6
  summary: DataTableSummary<DataTableFilterFields> | undefined;
@@ -8,6 +9,10 @@ export interface UseDataTableSummaryOptions {
8
9
  * table stores nothing.
9
10
  */
10
11
  persistenceKey: string | undefined;
12
+ /**
13
+ * Where `persistenceKey` is stored, `localStorage` when absent.
14
+ */
15
+ persistenceStorage?: DataTablePersistenceStorage;
11
16
  /**
12
17
  * The table's reload counter. Every reload of the SET bumps it (a filter
13
18
  * change, Refresh, `refreshSignal`, a poll, an action's `refresh()`), and a
@@ -1 +1 @@
1
- {"version":3,"file":"useDataTableSummary.d.ts","sourceRoot":"","sources":["../../src/table/useDataTableSummary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOnD,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC;IAC7D;;;OAGG;IACH,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,YAAa,0BAA0B;;oBAqB5D,OAAO;sBAaqB,MAAM,GAAG,SAAS;;;CAwDxD,CAAC"}
1
+ {"version":3,"file":"useDataTableSummary.d.ts","sourceRoot":"","sources":["../../src/table/useDataTableSummary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EACL,KAAK,2BAA2B,EAGjC,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC;IAC7D;;;OAGG;IACH,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;OAEG;IACH,kBAAkB,CAAC,EAAE,2BAA2B,CAAC;IACjD;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,YAAa,0BAA0B;;oBA4B5D,OAAO;sBAgBR,MAAM,GAAG,SAAS;;;CA0D3B,CAAC"}
@@ -1,14 +1,14 @@
1
- import { persistedSummaryOpen, writePersisted } from "./dataTablePersistence.js";
2
1
  import { ActionErrorPolicy } from "alepha/react";
3
2
  import { useCallback, useEffect, useRef, useState } from "react";
3
+ import { persistedSummaryOpen, writePersisted } from "./dataTablePersistence.js";
4
4
  // src/table/useDataTableSummary.ts
5
5
  /**
6
6
  * The state of `DataTable`'s summary panel: whether it is open, and the cards
7
7
  * it shows, fetched with the table's filters when the caller gave a `fetch`.
8
8
  */
9
9
  const useDataTableSummary = (options) => {
10
- const { summary, persistenceKey, refreshKey, form, alepha } = options;
11
- const [open, setOpenState] = useState(() => persistedSummaryOpen(persistenceKey));
10
+ const { summary, persistenceKey, persistenceStorage, refreshKey, form, alepha } = options;
11
+ const [open, setOpenState] = useState(() => persistedSummaryOpen(persistenceKey, persistenceStorage));
12
12
  const [fetched, setFetched] = useState();
13
13
  const [loading, setLoading] = useState(false);
14
14
  const fetchRef = useRef(summary?.fetch);
@@ -18,8 +18,8 @@ const useDataTableSummary = (options) => {
18
18
  const fetches = Boolean(summary?.fetch);
19
19
  const setOpen = useCallback((next) => {
20
20
  setOpenState(next);
21
- if (persistenceKey) writePersisted(persistenceKey, "summaryOpen", next);
22
- }, [persistenceKey]);
21
+ if (persistenceKey) writePersisted(persistenceKey, "summaryOpen", next, persistenceStorage);
22
+ }, [persistenceKey, persistenceStorage]);
23
23
  /**
24
24
  * Read the open state of another scope, and forget the cards of this one.
25
25
  * Called by `DataTable` during the render where `persistenceKey` changes,
@@ -27,9 +27,9 @@ const useDataTableSummary = (options) => {
27
27
  * must not sit under the name of the one just opened while it loads.
28
28
  */
29
29
  const resetScope = useCallback((key) => {
30
- setOpenState(persistedSummaryOpen(key));
30
+ setOpenState(persistedSummaryOpen(key, persistenceStorage));
31
31
  setFetched(void 0);
32
- }, []);
32
+ }, [persistenceStorage]);
33
33
  useEffect(() => {
34
34
  const fetcher = fetchRef.current;
35
35
  if (!fetcher || !open) return;
@@ -1 +1 @@
1
- {"version":3,"file":"useDataTableSummary.js","names":[],"sources":["../../src/table/useDataTableSummary.ts"],"sourcesContent":["import type { Alepha, ZObject } from \"alepha\";\nimport { ActionErrorPolicy } from \"alepha/react\";\nimport type { FormModel } from \"alepha/react/form\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport {\n persistedSummaryOpen,\n writePersisted,\n} from \"./dataTablePersistence.ts\";\nimport type {\n DataTableFilterFields,\n DataTableStatCard,\n DataTableSummary,\n} from \"./dataTableTypes.ts\";\n\nexport interface UseDataTableSummaryOptions {\n summary: DataTableSummary<DataTableFilterFields> | undefined;\n /**\n * The key the panel's open state is stored under, or `undefined` when the\n * table stores nothing.\n */\n persistenceKey: string | undefined;\n /**\n * The table's reload counter. Every reload of the SET bumps it (a filter\n * change, Refresh, `refreshSignal`, a poll, an action's `refresh()`), and a\n * page or a sort does not, which is exactly when the figures change.\n */\n refreshKey: number;\n form: FormModel<ZObject> | undefined;\n alepha: Alepha;\n}\n\n/**\n * The state of `DataTable`'s summary panel: whether it is open, and the cards\n * it shows, fetched with the table's filters when the caller gave a `fetch`.\n */\nexport const useDataTableSummary = (options: UseDataTableSummaryOptions) => {\n const { summary, persistenceKey, refreshKey, form, alepha } = options;\n\n const [open, setOpenState] = useState(() =>\n persistedSummaryOpen(persistenceKey),\n );\n // `undefined` until the first fetch lands, which is what tells the panel\n // to draw its placeholder tiles rather than nothing.\n const [fetched, setFetched] = useState<DataTableStatCard[] | undefined>();\n const [loading, setLoading] = useState(false);\n\n // Held in a ref and out of the effect's dependencies, for the reason\n // `useDataTableData` gives for `fetch`: callers write it inline, so it is a\n // new function every render, and a dependency on it refetches forever.\n const fetchRef = useRef(summary?.fetch);\n fetchRef.current = summary?.fetch;\n const onErrorRef = useRef(summary?.onError);\n onErrorRef.current = summary?.onError;\n const fetches = Boolean(summary?.fetch);\n\n const setOpen = useCallback(\n (next: boolean) => {\n setOpenState(next);\n if (persistenceKey) writePersisted(persistenceKey, \"summaryOpen\", next);\n },\n [persistenceKey],\n );\n\n /**\n * Read the open state of another scope, and forget the cards of this one.\n * Called by `DataTable` during the render where `persistenceKey` changes,\n * like the rest of the scope's state: the figures of the project just left\n * must not sit under the name of the one just opened while it loads.\n */\n const resetScope = useCallback((key: string | undefined) => {\n setOpenState(persistedSummaryOpen(key));\n setFetched(undefined);\n }, []);\n\n useEffect(() => {\n const fetcher = fetchRef.current;\n // Collapsed, nothing is on screen to be right about: opening fetches.\n if (!fetcher || !open) return;\n const controller = new AbortController();\n setLoading(true);\n fetcher({\n // The values as the request leaves; the form moves on as the reader\n // types.\n filters: form ? { ...form.currentValues } : undefined,\n signal: controller.signal,\n })\n .then((cards) => {\n if (!controller.signal.aborted) setFetched(cards);\n })\n .catch((error: unknown) => {\n if (controller.signal.aborted) return;\n // The last cards stay up, like the table's rows. With none yet, the\n // placeholders go: tiles pulsing over a read that failed would say\n // it is still coming. No card is no panel, until a reload succeeds.\n setFetched((cards) => cards ?? []);\n // The table's own channel for a failed read, so a mounted\n // `ActionErrorToaster` reports it, unless the caller handles it: the\n // `onError` convention of `useQuery`, where the event still fires for\n // error reporting and the toaster skips it.\n const onError = onErrorRef.current;\n void alepha.events.emit(\"react:action:error\", {\n type: \"custom\",\n id: \"data-table:summary\",\n error: error as Error,\n handled: ActionErrorPolicy.isHandled(error, onError),\n });\n onError?.(error as Error);\n })\n .finally(() => {\n if (!controller.signal.aborted) setLoading(false);\n });\n // A newer load, a collapse or an unmount supersedes this one. Aborted\n // rather than ignored, so a fetcher that forwards the signal cancels the\n // request itself. `loading` is cleared here because the aborted load's\n // own `finally` leaves it alone, and a collapse starts no load to take\n // it over.\n return () => {\n controller.abort();\n setLoading(false);\n };\n }, [fetches, open, refreshKey, form, alepha]);\n\n const cards = summary?.fetch ? fetched : (summary?.cards ?? []);\n\n return { open, setOpen, resetScope, cards, loading };\n};\n"],"mappings":";;;;;;;;AAoCA,MAAa,uBAAuB,YAAwC;CAC1E,MAAM,EAAE,SAAS,gBAAgB,YAAY,MAAM,WAAW;CAE9D,MAAM,CAAC,MAAM,gBAAgB,eAC3B,qBAAqB,cAAc,CACrC;CAGA,MAAM,CAAC,SAAS,cAAc,SA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AAY,OAFtB,SAAS,QAAQ,UAAW,SAAS,SAAS,CAAC;EAElB;CAAQ;AACrD"}
1
+ {"version":3,"file":"useDataTableSummary.js","names":[],"sources":["../../src/table/useDataTableSummary.ts"],"sourcesContent":["import type { Alepha, ZObject } from \"alepha\";\nimport { ActionErrorPolicy } from \"alepha/react\";\nimport type { FormModel } from \"alepha/react/form\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport {\n type DataTablePersistenceStorage,\n persistedSummaryOpen,\n writePersisted,\n} from \"./dataTablePersistence.ts\";\nimport type {\n DataTableFilterFields,\n DataTableStatCard,\n DataTableSummary,\n} from \"./dataTableTypes.ts\";\n\nexport interface UseDataTableSummaryOptions {\n summary: DataTableSummary<DataTableFilterFields> | undefined;\n /**\n * The key the panel's open state is stored under, or `undefined` when the\n * table stores nothing.\n */\n persistenceKey: string | undefined;\n /**\n * Where `persistenceKey` is stored, `localStorage` when absent.\n */\n persistenceStorage?: DataTablePersistenceStorage;\n /**\n * The table's reload counter. Every reload of the SET bumps it (a filter\n * change, Refresh, `refreshSignal`, a poll, an action's `refresh()`), and a\n * page or a sort does not, which is exactly when the figures change.\n */\n refreshKey: number;\n form: FormModel<ZObject> | undefined;\n alepha: Alepha;\n}\n\n/**\n * The state of `DataTable`'s summary panel: whether it is open, and the cards\n * it shows, fetched with the table's filters when the caller gave a `fetch`.\n */\nexport const useDataTableSummary = (options: UseDataTableSummaryOptions) => {\n const {\n summary,\n persistenceKey,\n persistenceStorage,\n refreshKey,\n form,\n alepha,\n } = options;\n\n const [open, setOpenState] = useState(() =>\n persistedSummaryOpen(persistenceKey, persistenceStorage),\n );\n // `undefined` until the first fetch lands, which is what tells the panel\n // to draw its placeholder tiles rather than nothing.\n const [fetched, setFetched] = useState<DataTableStatCard[] | undefined>();\n const [loading, setLoading] = useState(false);\n\n // Held in a ref and out of the effect's dependencies, for the reason\n // `useDataTableData` gives for `fetch`: callers write it inline, so it is a\n // new function every render, and a dependency on it refetches forever.\n const fetchRef = useRef(summary?.fetch);\n fetchRef.current = summary?.fetch;\n const onErrorRef = useRef(summary?.onError);\n onErrorRef.current = summary?.onError;\n const fetches = Boolean(summary?.fetch);\n\n const setOpen = useCallback(\n (next: boolean) => {\n setOpenState(next);\n if (persistenceKey) {\n writePersisted(persistenceKey, \"summaryOpen\", next, persistenceStorage);\n }\n },\n [persistenceKey, persistenceStorage],\n );\n\n /**\n * Read the open state of another scope, and forget the cards of this one.\n * Called by `DataTable` during the render where `persistenceKey` changes,\n * like the rest of the scope's state: the figures of the project just left\n * must not sit under the name of the one just opened while it loads.\n */\n const resetScope = useCallback(\n (key: string | undefined) => {\n setOpenState(persistedSummaryOpen(key, persistenceStorage));\n setFetched(undefined);\n },\n [persistenceStorage],\n );\n\n useEffect(() => {\n const fetcher = fetchRef.current;\n // Collapsed, nothing is on screen to be right about: opening fetches.\n if (!fetcher || !open) return;\n const controller = new AbortController();\n setLoading(true);\n fetcher({\n // The values as the request leaves; the form moves on as the reader\n // types.\n filters: form ? { ...form.currentValues } : undefined,\n signal: controller.signal,\n })\n .then((cards) => {\n if (!controller.signal.aborted) setFetched(cards);\n })\n .catch((error: unknown) => {\n if (controller.signal.aborted) return;\n // The last cards stay up, like the table's rows. With none yet, the\n // placeholders go: tiles pulsing over a read that failed would say\n // it is still coming. No card is no panel, until a reload succeeds.\n setFetched((cards) => cards ?? []);\n // The table's own channel for a failed read, so a mounted\n // `ActionErrorToaster` reports it, unless the caller handles it: the\n // `onError` convention of `useQuery`, where the event still fires for\n // error reporting and the toaster skips it.\n const onError = onErrorRef.current;\n void alepha.events.emit(\"react:action:error\", {\n type: \"custom\",\n id: \"data-table:summary\",\n error: error as Error,\n handled: ActionErrorPolicy.isHandled(error, onError),\n });\n onError?.(error as Error);\n })\n .finally(() => {\n if (!controller.signal.aborted) setLoading(false);\n });\n // A newer load, a collapse or an unmount supersedes this one. Aborted\n // rather than ignored, so a fetcher that forwards the signal cancels the\n // request itself. `loading` is cleared here because the aborted load's\n // own `finally` leaves it alone, and a collapse starts no load to take\n // it over.\n return () => {\n controller.abort();\n setLoading(false);\n };\n }, [fetches, open, refreshKey, form, alepha]);\n\n const cards = summary?.fetch ? fetched : (summary?.cards ?? []);\n\n return { open, setOpen, resetScope, cards, loading };\n};\n"],"mappings":";;;;;;;;AAyCA,MAAa,uBAAuB,YAAwC;CAC1E,MAAM,EACJ,SACA,gBACA,oBACA,YACA,MACA,WACE;CAEJ,MAAM,CAAC,MAAM,gBAAgB,eAC3B,qBAAqB,gBAAgB,kBAAkB,CACzD;CAGA,MAAM,CAAC,SAAS,cAAc,SAA0C;CACxE,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAK5C,MAAM,WAAW,OAAO,SAAS,KAAK;CACtC,SAAS,UAAU,SAAS;CAC5B,MAAM,aAAa,OAAO,SAAS,OAAO;CAC1C,WAAW,UAAU,SAAS;CAC9B,MAAM,UAAU,QAAQ,SAAS,KAAK;CAEtC,MAAM,UAAU,aACb,SAAkB;EACjB,aAAa,IAAI;EACjB,IAAI,gBACF,eAAe,gBAAgB,eAAe,MAAM,kBAAkB;CAE1E,GACA,CAAC,gBAAgB,kBAAkB,CACrC;;;;;;;CAQA,MAAM,aAAa,aAChB,QAA4B;EAC3B,aAAa,qBAAqB,KAAK,kBAAkB,CAAC;EAC1D,WAAW,KAAA,CAAS;CACtB,GACA,CAAC,kBAAkB,CACrB;CAEA,gBAAgB;EACd,MAAM,UAAU,SAAS;EAEzB,IAAI,CAAC,WAAW,CAAC,MAAM;EACvB,MAAM,aAAa,IAAI,gBAAgB;EACvC,WAAW,IAAI;EACf,QAAQ;GAGN,SAAS,OAAO,EAAE,GAAG,KAAK,cAAc,IAAI,KAAA;GAC5C,QAAQ,WAAW;EACrB,CAAC,CAAC,CACC,MAAM,UAAU;GACf,IAAI,CAAC,WAAW,OAAO,SAAS,WAAW,KAAK;EAClD,CAAC,CAAC,CACD,OAAO,UAAmB;GACzB,IAAI,WAAW,OAAO,SAAS;GAI/B,YAAY,UAAU,SAAS,CAAC,CAAC;GAKjC,MAAM,UAAU,WAAW;GACtB,OAAO,OAAO,KAAK,sBAAsB;IAC5C,MAAM;IACN,IAAI;IACG;IACP,SAAS,kBAAkB,UAAU,OAAO,OAAO;GACrD,CAAC;GACD,UAAU,KAAc;EAC1B,CAAC,CAAC,CACD,cAAc;GACb,IAAI,CAAC,WAAW,OAAO,SAAS,WAAW,KAAK;EAClD,CAAC;EAMH,aAAa;GACX,WAAW,MAAM;GACjB,WAAW,KAAK;EAClB;CACF,GAAG;EAAC;EAAS;EAAM;EAAY;EAAM;CAAM,CAAC;CAI5C,OAAO;EAAE;EAAM;EAAS;EAAY,OAFtB,SAAS,QAAQ,UAAW,SAAS,SAAS,CAAC;EAElB;CAAQ;AACrD"}
@@ -1,6 +1,6 @@
1
+ import { DateTimeProvider } from "alepha/datetime";
1
2
  import { useInject } from "alepha/react";
2
3
  import { useEffect, useRef } from "react";
3
- import { DateTimeProvider } from "alepha/datetime";
4
4
  // src/table/useDataTableWake.ts
5
5
  /**
6
6
  * `DataTable`'s tab-return refresh (#Q4069): reload in the background when
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The width of an element, in pixels, kept current by a `ResizeObserver`.
3
+ * `undefined` until it is measured, while `enabled` is false, and where the
4
+ * browser has no `ResizeObserver`.
5
+ *
6
+ * Takes the element rather than a ref, so an element mounted after the hook
7
+ * (under `ClientOnly`) is observed once it exists.
8
+ */
9
+ export declare const useElementWidth: (element: HTMLElement | null, enabled: boolean) => number | undefined;
10
+ //# sourceMappingURL=useElementWidth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useElementWidth.d.ts","sourceRoot":"","sources":["../../src/table/useElementWidth.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,YACjB,WAAW,GAAG,IAAI,WAClB,OAAO,KACf,MAAM,GAAG,SAqBX,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { useEffect, useState } from "react";
2
+ // src/table/useElementWidth.ts
3
+ /**
4
+ * The width of an element, in pixels, kept current by a `ResizeObserver`.
5
+ * `undefined` until it is measured, while `enabled` is false, and where the
6
+ * browser has no `ResizeObserver`.
7
+ *
8
+ * Takes the element rather than a ref, so an element mounted after the hook
9
+ * (under `ClientOnly`) is observed once it exists.
10
+ */
11
+ const useElementWidth = (element, enabled) => {
12
+ const [measured, setMeasured] = useState();
13
+ useEffect(() => {
14
+ if (!enabled || !element || typeof ResizeObserver === "undefined") return;
15
+ const observer = new ResizeObserver((entries) => {
16
+ const entry = entries[entries.length - 1];
17
+ if (entry) setMeasured({
18
+ element,
19
+ width: Math.round(entry.contentRect.width)
20
+ });
21
+ });
22
+ observer.observe(element);
23
+ return () => observer.disconnect();
24
+ }, [element, enabled]);
25
+ return enabled && measured && measured.element === element ? measured.width : void 0;
26
+ };
27
+ export { useElementWidth };
28
+
29
+ //# sourceMappingURL=useElementWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useElementWidth.js","names":[],"sources":["../../src/table/useElementWidth.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\n/**\n * The width of an element, in pixels, kept current by a `ResizeObserver`.\n * `undefined` until it is measured, while `enabled` is false, and where the\n * browser has no `ResizeObserver`.\n *\n * Takes the element rather than a ref, so an element mounted after the hook\n * (under `ClientOnly`) is observed once it exists.\n */\nexport const useElementWidth = (\n element: HTMLElement | null,\n enabled: boolean,\n): number | undefined => {\n // The width with the element it was measured on, so a width read off an\n // element since replaced is never returned for the new one.\n const [measured, setMeasured] = useState<{\n element: HTMLElement;\n width: number;\n }>();\n useEffect(() => {\n if (!enabled || !element || typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver((entries) => {\n const entry = entries[entries.length - 1];\n if (entry) {\n setMeasured({ element, width: Math.round(entry.contentRect.width) });\n }\n });\n observer.observe(element);\n return () => observer.disconnect();\n }, [element, enabled]);\n return enabled && measured && measured.element === element\n ? measured.width\n : undefined;\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAa,mBACX,SACA,YACuB;CAGvB,MAAM,CAAC,UAAU,eAAe,SAG7B;CACH,gBAAgB;EACd,IAAI,CAAC,WAAW,CAAC,WAAW,OAAO,mBAAmB,aAAa;EACnE,MAAM,WAAW,IAAI,gBAAgB,YAAY;GAC/C,MAAM,QAAQ,QAAQ,QAAQ,SAAS;GACvC,IAAI,OACF,YAAY;IAAE;IAAS,OAAO,KAAK,MAAM,MAAM,YAAY,KAAK;GAAE,CAAC;EAEvE,CAAC;EACD,SAAS,QAAQ,OAAO;EACxB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,SAAS,OAAO,CAAC;CACrB,OAAO,WAAW,YAAY,SAAS,YAAY,UAC/C,SAAS,QACT,KAAA;AACN"}
@@ -1,7 +1,7 @@
1
+ import { useEffect, useMemo, useRef, useState } from "react";
1
2
  import { inlineArrowKey } from "../core/inlineArrowKey.js";
2
3
  import "./treeModel.js";
3
4
  import { TreeViewRow } from "./TreeViewRow.js";
4
- import { useEffect, useMemo, useRef, useState } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  // src/tree/TreeView.tsx
7
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"TreeViewRow.d.ts","sourceRoot":"","sources":["../../src/tree/TreeViewRow.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,YAAY,EAEjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;;;;;;;GAQG;AACH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,SAAS;IAC3C,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,O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,KAAK,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,SAAS;IAC7C,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1B;;;;;OAKG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,QAAA,MAAM,eAAe,GAAI,CAAC,SAAU,gBAAgB,CAAC,CAAC,CAAC,KAAG,YAwMzD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,sBAAsB,QAAyC,CAAC;AAe7E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,EAA4B,OAAO,eAAe,CAAC"}
@@ -1,8 +1,8 @@
1
+ import { ChevronDown, ChevronRight } from "lucide-react";
2
+ import { memo } from "react";
1
3
  import { ContextMenu, ContextMenuTrigger } from "../core/ContextMenu.js";
2
4
  import { cn } from "../core/utils.js";
3
5
  import { TreeViewRenameInput } from "./TreeViewRenameInput.js";
4
- import { ChevronDown, ChevronRight } from "lucide-react";
5
- import { memo } from "react";
6
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  // src/tree/TreeViewRow.tsx
8
8
  /**
@@ -117,7 +117,7 @@ const TreeViewRowImpl = (props) => {
117
117
  onDragEnd: props.isDraggable ? facade.onDragEnd : void 0,
118
118
  onClick: handleClick,
119
119
  onKeyDown: handleKeyDown,
120
- className: cn("group/tree-row hover:bg-hover-weak relative flex cursor-default items-center gap-1 py-1 pe-2 text-sm outline-none select-none", "transition-[background-color,transform] duration-150", !props.isDragging && !props.isRenaming && "active:translate-y-px", "focus-visible:bg-muted/60", depth > 0 && "[background-image:repeating-linear-gradient(to_right,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] [background-position:var(--tree-guide-origin)_0] rtl:[background-image:repeating-linear-gradient(to_left,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] rtl:[background-position:right_var(--tree-guide-origin)_top_0]", isSelected && "bg-hover font-medium", props.isDragging && "opacity-45", props.inDropBlock && "bg-primary/15"),
120
+ className: cn("group/tree-row", !props.isDragging && !props.isRenaming && "active:translate-y-px", props.isDragging && "opacity-45", props.inDropBlock && "bg-primary/15"),
121
121
  style: {
122
122
  paddingInlineStart: `${8 + depth * 13}px`,
123
123
  ...depth > 0 && {
@@ -1 +1 @@
1
- {"version":3,"file":"TreeViewRow.js","names":[],"sources":["../../src/tree/TreeViewRow.tsx"],"sourcesContent":["import { ChevronDown, ChevronRight } from \"lucide-react\";\nimport {\n type DragEvent,\n type FocusEvent,\n type KeyboardEvent,\n memo,\n type MouseEvent,\n type ReactElement,\n type CSSProperties,\n type ReactNode,\n} from \"react\";\n\nimport { ContextMenu, ContextMenuTrigger } from \"../core/ContextMenu.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport type { TreeDropPosition, TreeNode } from \"./treeModel.ts\";\nimport type { TreeRowState } from \"./TreeView.tsx\";\nimport { TreeViewRenameInput } from \"./TreeViewRenameInput.tsx\";\n\n/**\n * The slots and callbacks a row reads, behind an object whose identity never\n * changes for the life of the tree.\n *\n * ⚠️ Rows never receive a raw consumer callback. `TreeView` builds this once\n * (see its `implRef` block) so a consumer passing inline arrows still gets a\n * memo that holds. Every method here reads through that ref, so it can be\n * held forever and still call the current implementation.\n */\n/**\n * How a row was activated, for a tree that selects a range (#Q3654).\n */\nexport interface TreeSelectOptions {\n /**\n * Shift was held: extend the selection from its anchor to this row.\n */\n shift: boolean;\n}\n\nexport interface TreeViewFacade<T = undefined> {\n select: (node: TreeNode<T>, options?: TreeSelectOptions) => void;\n toggle: (id: string) => void;\n renderIcon: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n renderLabel: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n renderTrailing: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n onDragStart: (id: string) => void;\n onDragOver: (id: string, position: TreeDropPosition) => void;\n onDrop: (id: string) => void;\n /**\n * Whether the tree takes OS files dropped on a row (`onFilesDrop`).\n */\n acceptsFiles: () => boolean;\n onFilesDrop: (id: string, files: File[]) => void;\n onDragEnd: () => void;\n commitRename: (id: string, name: string) => void;\n cancelRename: () => void;\n renderMenu: (node: TreeNode<T>) => ReactNode;\n /**\n * Reports that a row took the focus, so the tree moves its one tab stop\n * there.\n */\n focus: (id: string) => void;\n}\n\nexport interface TreeViewRowProps<T = undefined> {\n node: TreeNode<T>;\n depth: number;\n /**\n * Stable for the life of the tree, which is what lets this component be\n * memoised at all. See {@link TreeViewFacade}.\n */\n facade: TreeViewFacade<T>;\n /**\n * The state flags are passed as PRIMITIVES rather than derived from the\n * tree state here. That is the whole reason the memo below holds: a toggle\n * changes `rows` and `collapsed`, so any prop carrying the state object\n * would change identity on every row.\n */\n isCollapsed: boolean;\n isSelected: boolean;\n isRenaming: boolean;\n isDragging: boolean;\n /**\n * Whether this tree has drag and drop turned on. Off, the row attaches no\n * drag handler at all: a read-only tree must not pay for a capability it\n * never uses.\n */\n isDraggable: boolean;\n /**\n * Whether ANY row of this tree is being dragged, which is not the same\n * question as {@link TreeViewRowProps.isDragging}. `handleDragOver` needs it\n * to tell an internal drag from an external one that carries no files.\n */\n isDragActive: boolean;\n /**\n * Whether a drop over this row would move anything: its folder (the\n * branch, or a leaf's parent) is neither the dragged node's own folder nor\n * inside the dragged branch. Refused, the row still REPORTS the hover, so\n * the highlight leaves the last folder, but the cursor says \"no drop\".\n */\n dropAllowed: boolean;\n /**\n * This row belongs to the folder the drop targets (the folder's row and\n * everything shown beneath it), highlighted as one block.\n */\n inDropBlock: boolean;\n /**\n * Whether the consumer supplied a `renderMenu` slot. A primitive rather than\n * the slot itself, so the memo still holds: the slot travels on the facade.\n */\n hasMenu: boolean;\n /**\n * Whether this row is the tree's one tab stop (`tabIndex` 0). Every other\n * row is `-1` and is reached with the arrow keys, as `role=\"tree\"` asks.\n */\n isTabStop: boolean;\n}\n\n/**\n * One row of a `TreeView`: the disclosure column (a chevron on a branch, a\n * spacer on a leaf), the icon slot, the label, and the trailing slot, over the\n * indent geometry.\n *\n * ## Drag and drop, and why it is native rather than @dnd-kit\n *\n * `@dnd-kit` is the house drag library in the applications that consume this\n * package (kanban boards, file browsers), and it is the wrong tool **here\n * specifically**. Three drop zones per row is about forty lines of\n * `onDragOver` arithmetic natively, against writing custom collision detection\n * for a library built around a single drop target per area. Recorded so it is\n * not re-litigated.\n *\n * A drop names a FOLDER, as in a file manager: over a branch, that branch;\n * over a leaf, the folder that holds it. The tree is sorted by its\n * comparator, so it draws no line between two rows (the 28/44/28 zones did,\n * and promised a place the sort then ignored): it lights the target folder's\n * rows as one block, refuses with the \"no drop\" cursor a drop that would\n * change nothing, and the dragged image is a compact label of the name.\n *\n * The row reports gestures and resolves nothing: `resolveDrop` is the\n * consumer's to call, because only it knows whether the resulting parent\n * change is legal in its own domain.\n *\n * ## Inline rename, and the context menu as a SLOT\n *\n * A row in rename mode swaps its label for {@link TreeViewRenameInput}. The\n * verbs of the context menu are never this component's business: it takes a\n * `renderMenu` slot and wraps the row in `ContextMenu` only when one is\n * given, so a consumer keeps its own menu with its own routes.\n */\nconst TreeViewRowImpl = <T,>(props: TreeViewRowProps<T>): ReactElement => {\n const { node, depth, facade, isCollapsed, isSelected } = props;\n const state: TreeRowState = {\n collapsed: isCollapsed,\n selected: isSelected,\n renaming: props.isRenaming,\n dragging: props.isDragging,\n };\n\n /**\n * One gesture, one meaning: a click opens the row it is on.\n *\n * ⚠️ The `e.detail > 1` guard is not optional. A real double click fires\n * click, click, then dblclick, so without it the two clicks toggle a\n * branch twice and it ends collapsed: a different outcome from the single\n * click that shares its first half, reached by doing the same thing\n * faster. It costs no timer and no latency, since `detail` is the\n * browser's own counter for the burst and is already on the event.\n */\n const handleClick = (e: MouseEvent): void => {\n if (props.isRenaming) return;\n if (e.detail > 1) return;\n facade.select(node, { shift: e.shiftKey });\n };\n\n const handleKeyDown = (e: KeyboardEvent): void => {\n if (props.isRenaming) return;\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n e.preventDefault();\n facade.select(node, { shift: e.shiftKey });\n };\n\n const handleToggle = (e: MouseEvent): void => {\n e.stopPropagation();\n facade.toggle(node.id);\n };\n\n const handleDragStart = (e: DragEvent<HTMLDivElement>): void => {\n e.stopPropagation();\n e.dataTransfer.effectAllowed = \"move\";\n e.dataTransfer.setData(\"text/plain\", node.id);\n setDragLabel(e);\n facade.onDragStart(node.id);\n };\n\n const handleDragOver = (e: DragEvent<HTMLDivElement>): void => {\n e.preventDefault();\n e.stopPropagation();\n if (isFileDrag(e)) {\n // An OS file drag lands only where the consumer said files may, and is\n // never treated as a re-parent.\n e.dataTransfer.dropEffect = facade.acceptsFiles() ? \"copy\" : \"none\";\n return;\n }\n if (!props.isDragActive) return;\n // One zone per row: a drop names a folder, never a place between rows,\n // which a sorted tree could not keep. A branch is the folder; a leaf\n // stands for the folder that holds it (`resolveDrop` reads `before` so).\n e.dataTransfer.dropEffect = props.dropAllowed ? \"move\" : \"none\";\n const position: TreeDropPosition = node.branch ? \"inside\" : \"before\";\n facade.onDragOver(node.id, position);\n };\n\n const handleDrop = (e: DragEvent<HTMLDivElement>): void => {\n e.preventDefault();\n e.stopPropagation();\n if (isFileDrag(e)) {\n if (facade.acceptsFiles()) {\n facade.onFilesDrop(node.id, [...e.dataTransfer.files]);\n }\n return;\n }\n facade.onDrop(node.id);\n };\n\n // The row's own attributes, built once: the same element is rendered\n // directly, or handed to `ContextMenuTrigger`'s `render` prop when the\n // consumer supplied a menu. Duplicating the list for the two branches is\n // exactly how the two would drift.\n const rowProps = {\n \"data-slot\": \"tree-view-row\",\n role: \"treeitem\",\n // The rows are a flat list rather than nested `role=\"group\"` elements,\n // so depth is spoken through `aria-level`, which is the flat\n // equivalent.\n \"aria-level\": depth + 1,\n \"aria-expanded\": node.branch ? !isCollapsed : undefined,\n \"aria-selected\": isSelected || undefined,\n tabIndex: props.isTabStop ? 0 : -1,\n onFocus: (e: FocusEvent) => {\n if (e.target === e.currentTarget) facade.focus(node.id);\n },\n // Selection is otherwise only a background class, which is not\n // something a test (or a future stylesheet) can address.\n \"data-selected\": isSelected || undefined,\n // The target folder's block, addressable as the selection is.\n \"data-drop-block\": props.inDropBlock || undefined,\n draggable: props.isDraggable && !props.isRenaming,\n onDragStart: props.isDraggable ? handleDragStart : undefined,\n onDragOver: props.isDraggable ? handleDragOver : undefined,\n onDrop: props.isDraggable ? handleDrop : undefined,\n onDragEnd: props.isDraggable ? facade.onDragEnd : undefined,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n className: cn(\n // `group/tree-row` is NAMED, not a bare `group`: a consumer's icon\n // slot tracks this row's hover and selected background through it,\n // and a bare group here would also be captured by any `group-*`\n // utility inside the parts nested below.\n \"group/tree-row hover:bg-hover-weak relative flex cursor-default items-center gap-1 py-1 pe-2 text-sm outline-none select-none\",\n // ⚠️ Named properties, never `transition-all`. This element is\n // also an HTML5 drag SOURCE that animates `opacity` while dragging\n // and carries the drop markers; a blanket transition puts all\n // three on a timer, so the drop indicator lags the pointer it is\n // supposed to track.\n \"transition-[background-color,transform] duration-150\",\n // The press. Suppressed while dragging, because a transform on a\n // drag source moves the browser's own drag image with it.\n !props.isDragging && !props.isRenaming && \"active:translate-y-px\",\n \"focus-visible:bg-muted/60\",\n depth > 0 &&\n \"[background-image:repeating-linear-gradient(to_right,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] [background-position:var(--tree-guide-origin)_0] rtl:[background-image:repeating-linear-gradient(to_left,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] rtl:[background-position:right_var(--tree-guide-origin)_top_0]\",\n isSelected && \"bg-hover font-medium\",\n props.isDragging && \"opacity-45\",\n // The folder the drop targets, as one block: its row and all of its\n // shown rows, the way a file manager lights the folder a file goes in.\n props.inDropBlock && \"bg-primary/15\",\n ),\n style: {\n paddingInlineStart: `${INDENT_BASE_PX + depth * INDENT_STEP_PX}px`,\n // Indent guides, as pure CSS: one hairline per ancestor level,\n // painted as a repeating gradient clipped to the indent area so it\n // can never run under the label. A background IMAGE, so the row's\n // background COLOUR (hover, selection) still shows through\n // underneath. A background has no logical side, so the gradient and\n // its origin are custom properties the `rtl:` classes in `className` flip.\n ...(depth > 0 && {\n \"--tree-guide-origin\": `${INDENT_GUIDE_ORIGIN_PX}px`,\n \"--tree-guide-step\": `${INDENT_STEP_PX}px`,\n backgroundSize: `${depth * INDENT_STEP_PX}px 100%`,\n backgroundRepeat: \"no-repeat\",\n }),\n } as CSSProperties,\n };\n\n const content = (\n <>\n {isSelected && (\n // The accent bar. A selected row used to differ from its\n // neighbours by a background tint alone, which several themes\n // render almost invisibly.\n <span\n aria-hidden\n className=\"bg-primary pointer-events-none absolute inset-y-0 start-0 w-0.5\"\n />\n )}\n {node.branch ? (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden\n onClick={handleToggle}\n className=\"flex h-3.5 shrink-0 items-center justify-center\"\n style={{ width: DISCLOSURE_BOX_PX }}\n >\n {isCollapsed ? (\n <ChevronRight className=\"size-3 opacity-60 rtl:-scale-x-100\" />\n ) : (\n <ChevronDown className=\"size-3 opacity-60\" />\n )}\n </button>\n ) : (\n <span\n className=\"inline-block shrink-0\"\n style={{ width: DISCLOSURE_BOX_PX }}\n />\n )}\n {facade.renderIcon(node, state)}\n {props.isRenaming ? (\n <TreeViewRenameInput\n name={node.name}\n onCommit={(name) => facade.commitRename(node.id, name)}\n onCancel={facade.cancelRename}\n />\n ) : (\n /*\n * The label is its OWN element, separate from the row's click\n * handler and from the disclosure button, so a consumer that needs\n * an anchor here one day changes this line rather than the row.\n */\n <span data-slot=\"tree-view-label\" className=\"min-w-0 flex-1 truncate\">\n {facade.renderLabel(node, state)}\n </span>\n )}\n {!props.isRenaming && facade.renderTrailing(node, state)}\n </>\n );\n\n if (!props.hasMenu) return <div {...rowProps}>{content}</div>;\n\n return (\n <ContextMenu>\n <ContextMenuTrigger render={<div {...rowProps} />}>\n {content}\n </ContextMenuTrigger>\n {facade.renderMenu(node)}\n </ContextMenu>\n );\n};\n\n/**\n * How far one level of nesting indents a row, in pixels.\n *\n * Shared by the row's own left padding and by the indent guides drawn behind\n * it, so the two cannot drift: a guide that does not line up with the column\n * it belongs to is worse than no guide.\n */\nexport const INDENT_STEP_PX = 13;\n\n/**\n * The row's own base padding: where a depth-0 row's content starts.\n */\nexport const INDENT_BASE_PX = 8;\n\n/**\n * The width of the disclosure column: the chevron button on a branch, and the\n * spacer that stands in for it on a leaf.\n *\n * Applied as a style rather than a `w-3.5` class **on purpose**: it is also\n * half of {@link INDENT_GUIDE_ORIGIN_PX}, so a class here would let the box be\n * resized while the guides stayed where they were. One number, two consumers,\n * no way to move one without the other.\n */\nexport const DISCLOSURE_BOX_PX = 14;\n\n/**\n * Where the first level's guide is painted.\n *\n * ⚠️ **Not the same as {@link INDENT_BASE_PX}, and it used to be.** The rule\n * is not \"the same number twice\" but \"a guide is centred on the disclosure\n * column of the level it marks\", which is what a reader perceives as aligned.\n * Sharing the row's base padding put every guide 7px to the LEFT of its own\n * chevron, at every depth.\n *\n * Derived rather than typed, because the correction is exactly half the\n * disclosure box: the eyeballed 14 and the computed 15 are both within a pixel\n * of right, and only one of them survives the chevron changing size.\n *\n * ⚠️ The gradient paints its hairline from this x, so the 1px line occupies\n * `[15, 16)` and its own centre is half a pixel right of the chevron's.\n * Deliberate: `14.5` would centre the line exactly and cost the hairline its\n * crispness on a 1x display, which is a worse trade for a 1px rule than half a\n * pixel of offset. Known, not overlooked.\n */\nexport const INDENT_GUIDE_ORIGIN_PX = INDENT_BASE_PX + DISCLOSURE_BOX_PX / 2;\n\n/**\n * Whether a drag carries OS files rather than one of this tree's own rows.\n *\n * `dataTransfer.types` is the only readable signal during `dragover`:\n * `dataTransfer.files` is empty until `drop`, because the browser withholds\n * the bytes so a page cannot read a file merely by being dragged across it.\n * Checking the tree's drag id instead would be wrong in the other direction:\n * it is unset for an external drag, but also unset in the frame before an\n * internal drag's `dragstart` state lands.\n */\nconst isFileDrag = (e: DragEvent<HTMLElement>): boolean =>\n [...e.dataTransfer.types].includes(\"Files\");\n\n/**\n * Memoised, and the props above are shaped so that the DEFAULT shallow\n * comparison is enough: every one of them is a primitive, a node the tree\n * model memoises, or the facade that never changes identity.\n *\n * Before this discipline existed, one toggle re-rendered every visible row\n * along with its handlers: `rows` was already memoised, but each row received\n * the whole tree-state object, which is rebuilt on every render along with all\n * of its callbacks. Now a toggle re-renders only the rows whose own props\n * changed: the branch that opened, plus the rows that appeared or disappeared\n * beneath it.\n *\n * ⚠️ A prop added here must be shallow-comparable, or the memo silently stops\n * holding and nothing goes red. Anything that is not a primitive belongs on\n * the facade.\n */\nexport const TreeViewRow = memo(TreeViewRowImpl) as typeof TreeViewRowImpl;\n\n/**\n * The image dragged under the pointer: a compact label of the row's name,\n * not the browser's snapshot of the whole row with its indent and trailing\n * icons. Built off-screen, handed to the browser, and removed on the next\n * frame, once the browser has rendered it.\n */\nconst setDragLabel = (e: DragEvent<HTMLDivElement>): void => {\n if (typeof e.dataTransfer.setDragImage !== \"function\") return;\n const text = e.currentTarget.textContent?.trim() ?? \"\";\n if (!text) return;\n const label = document.createElement(\"div\");\n label.textContent = text;\n const style = getComputedStyle(e.currentTarget);\n Object.assign(label.style, {\n position: \"fixed\",\n top: \"-1000px\",\n left: \"-1000px\",\n maxWidth: \"240px\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n padding: \"2px 8px\",\n borderRadius: \"6px\",\n font: style.font,\n color: style.color,\n background: \"var(--popover, white)\",\n boxShadow: \"0 1px 3px rgb(0 0 0 / 0.2)\",\n });\n document.body.appendChild(label);\n e.dataTransfer.setDragImage(label, -12, -8);\n requestAnimationFrame(() => label.remove());\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoJA,MAAM,mBAAuB,UAA6C;CACxE,MAAM,EAAE,MAAM,OAAO,QAAQ,aAAa,eAAe;CACzD,MAAM,QAAsB;EAC1B,WAAW;EACX,UAAU;EACV,UAAU,MAAM;EAChB,UAAU,MAAM;CAClB;;;;;;;;;;;CAYA,MAAM,eAAe,MAAwB;EAC3C,IAAI,MAAM,YAAY;EACtB,IAAI,EAAE,SAAS,GAAG;EAClB,OAAO,OAAO,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC;CAC3C;CAEA,MAAM,iBAAiB,MAA2B;EAChD,IAAI,MAAM,YAAY;EACtB,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;EACxC,EAAE,eAAe;EACjB,OAAO,OAAO,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC;CAC3C;CAEA,MAAM,gBAAgB,MAAwB;EAC5C,EAAE,gBAAgB;EAClB,OAAO,OAAO,KAAK,EAAE;CACvB;CAEA,MAAM,mBAAmB,MAAuC;EAC9D,EAAE,gBAAgB;EAClB,EAAE,aAAa,gBAAgB;EAC/B,EAAE,aAAa,QAAQ,cAAc,KAAK,EAAE;EAC5C,aAAa,CAA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iB;;;;;;;;;;AAW9B,MAAa,oBAAoB;;;;;;;;;;;;;;;;;;;;AAqBjC,MAAa,yBAAyB;;;;;;;;;;;AAYtC,MAAM,cAAc,MAClB,CAAC,GAAG,EAAE,aAAa,KAAK,CAAC,CAAC,SAAS,OAAO;;;;;;;;;;;;;;;;;AAkB5C,MAAa,cAAc,KAAK,eAAe;;;;;;;AAQ/C,MAAM,gBAAgB,MAAuC;CAC3D,IAAI,OAAO,EAAE,aAAa,iBAAiB,YAAY;CACvD,MAAM,OAAO,EAAE,cAAc,aAAa,KAAK,KAAK;CACpD,IAAI,CAAC,MAAM;CACX,MAAM,QAAQ,SAAS,cAAc,KAAK;CAC1C,MAAM,cAAc;CACpB,MAAM,QAAQ,iBAAiB,EAAE,aAAa;CAC9C,OAAO,OAAO,MAAM,OAAO;EACzB,UAAU;EACV,KAAK;EACL,MAAM;EACN,UAAU;EACV,UAAU;EACV,cAAc;EACd,YAAY;EACZ,SAAS;EACT,cAAc;EACd,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,YAAY;EACZ,WAAW;CACb,CAAC;CACD,SAAS,KAAK,YAAY,KAAK;CAC/B,EAAE,aAAa,aAAa,OAAO,KAAK,EAAE;CAC1C,4BAA4B,MAAM,OAAO,CAAC;AAC5C"}
1
+ {"version":3,"file":"TreeViewRow.js","names":[],"sources":["../../src/tree/TreeViewRow.tsx"],"sourcesContent":["import { ChevronDown, ChevronRight } from \"lucide-react\";\nimport {\n type DragEvent,\n type FocusEvent,\n type KeyboardEvent,\n memo,\n type MouseEvent,\n type ReactElement,\n type CSSProperties,\n type ReactNode,\n} from \"react\";\n\nimport { ContextMenu, ContextMenuTrigger } from \"../core/ContextMenu.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport type { TreeDropPosition, TreeNode } from \"./treeModel.ts\";\nimport type { TreeRowState } from \"./TreeView.tsx\";\nimport { TreeViewRenameInput } from \"./TreeViewRenameInput.tsx\";\n\n/**\n * The slots and callbacks a row reads, behind an object whose identity never\n * changes for the life of the tree.\n *\n * ⚠️ Rows never receive a raw consumer callback. `TreeView` builds this once\n * (see its `implRef` block) so a consumer passing inline arrows still gets a\n * memo that holds. Every method here reads through that ref, so it can be\n * held forever and still call the current implementation.\n */\n/**\n * How a row was activated, for a tree that selects a range (#Q3654).\n */\nexport interface TreeSelectOptions {\n /**\n * Shift was held: extend the selection from its anchor to this row.\n */\n shift: boolean;\n}\n\nexport interface TreeViewFacade<T = undefined> {\n select: (node: TreeNode<T>, options?: TreeSelectOptions) => void;\n toggle: (id: string) => void;\n renderIcon: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n renderLabel: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n renderTrailing: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n onDragStart: (id: string) => void;\n onDragOver: (id: string, position: TreeDropPosition) => void;\n onDrop: (id: string) => void;\n /**\n * Whether the tree takes OS files dropped on a row (`onFilesDrop`).\n */\n acceptsFiles: () => boolean;\n onFilesDrop: (id: string, files: File[]) => void;\n onDragEnd: () => void;\n commitRename: (id: string, name: string) => void;\n cancelRename: () => void;\n renderMenu: (node: TreeNode<T>) => ReactNode;\n /**\n * Reports that a row took the focus, so the tree moves its one tab stop\n * there.\n */\n focus: (id: string) => void;\n}\n\nexport interface TreeViewRowProps<T = undefined> {\n node: TreeNode<T>;\n depth: number;\n /**\n * Stable for the life of the tree, which is what lets this component be\n * memoised at all. See {@link TreeViewFacade}.\n */\n facade: TreeViewFacade<T>;\n /**\n * The state flags are passed as PRIMITIVES rather than derived from the\n * tree state here. That is the whole reason the memo below holds: a toggle\n * changes `rows` and `collapsed`, so any prop carrying the state object\n * would change identity on every row.\n */\n isCollapsed: boolean;\n isSelected: boolean;\n isRenaming: boolean;\n isDragging: boolean;\n /**\n * Whether this tree has drag and drop turned on. Off, the row attaches no\n * drag handler at all: a read-only tree must not pay for a capability it\n * never uses.\n */\n isDraggable: boolean;\n /**\n * Whether ANY row of this tree is being dragged, which is not the same\n * question as {@link TreeViewRowProps.isDragging}. `handleDragOver` needs it\n * to tell an internal drag from an external one that carries no files.\n */\n isDragActive: boolean;\n /**\n * Whether a drop over this row would move anything: its folder (the\n * branch, or a leaf's parent) is neither the dragged node's own folder nor\n * inside the dragged branch. Refused, the row still REPORTS the hover, so\n * the highlight leaves the last folder, but the cursor says \"no drop\".\n */\n dropAllowed: boolean;\n /**\n * This row belongs to the folder the drop targets (the folder's row and\n * everything shown beneath it), highlighted as one block.\n */\n inDropBlock: boolean;\n /**\n * Whether the consumer supplied a `renderMenu` slot. A primitive rather than\n * the slot itself, so the memo still holds: the slot travels on the facade.\n */\n hasMenu: boolean;\n /**\n * Whether this row is the tree's one tab stop (`tabIndex` 0). Every other\n * row is `-1` and is reached with the arrow keys, as `role=\"tree\"` asks.\n */\n isTabStop: boolean;\n}\n\n/**\n * One row of a `TreeView`: the disclosure column (a chevron on a branch, a\n * spacer on a leaf), the icon slot, the label, and the trailing slot, over the\n * indent geometry.\n *\n * ## Drag and drop, and why it is native rather than @dnd-kit\n *\n * `@dnd-kit` is the house drag library in the applications that consume this\n * package (kanban boards, file browsers), and it is the wrong tool **here\n * specifically**. Three drop zones per row is about forty lines of\n * `onDragOver` arithmetic natively, against writing custom collision detection\n * for a library built around a single drop target per area. Recorded so it is\n * not re-litigated.\n *\n * A drop names a FOLDER, as in a file manager: over a branch, that branch;\n * over a leaf, the folder that holds it. The tree is sorted by its\n * comparator, so it draws no line between two rows (the 28/44/28 zones did,\n * and promised a place the sort then ignored): it lights the target folder's\n * rows as one block, refuses with the \"no drop\" cursor a drop that would\n * change nothing, and the dragged image is a compact label of the name.\n *\n * The row reports gestures and resolves nothing: `resolveDrop` is the\n * consumer's to call, because only it knows whether the resulting parent\n * change is legal in its own domain.\n *\n * ## Inline rename, and the context menu as a SLOT\n *\n * A row in rename mode swaps its label for {@link TreeViewRenameInput}. The\n * verbs of the context menu are never this component's business: it takes a\n * `renderMenu` slot and wraps the row in `ContextMenu` only when one is\n * given, so a consumer keeps its own menu with its own routes.\n */\nconst TreeViewRowImpl = <T,>(props: TreeViewRowProps<T>): ReactElement => {\n const { node, depth, facade, isCollapsed, isSelected } = props;\n const state: TreeRowState = {\n collapsed: isCollapsed,\n selected: isSelected,\n renaming: props.isRenaming,\n dragging: props.isDragging,\n };\n\n /**\n * One gesture, one meaning: a click opens the row it is on.\n *\n * ⚠️ The `e.detail > 1` guard is not optional. A real double click fires\n * click, click, then dblclick, so without it the two clicks toggle a\n * branch twice and it ends collapsed: a different outcome from the single\n * click that shares its first half, reached by doing the same thing\n * faster. It costs no timer and no latency, since `detail` is the\n * browser's own counter for the burst and is already on the event.\n */\n const handleClick = (e: MouseEvent): void => {\n if (props.isRenaming) return;\n if (e.detail > 1) return;\n facade.select(node, { shift: e.shiftKey });\n };\n\n const handleKeyDown = (e: KeyboardEvent): void => {\n if (props.isRenaming) return;\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n e.preventDefault();\n facade.select(node, { shift: e.shiftKey });\n };\n\n const handleToggle = (e: MouseEvent): void => {\n e.stopPropagation();\n facade.toggle(node.id);\n };\n\n const handleDragStart = (e: DragEvent<HTMLDivElement>): void => {\n e.stopPropagation();\n e.dataTransfer.effectAllowed = \"move\";\n e.dataTransfer.setData(\"text/plain\", node.id);\n setDragLabel(e);\n facade.onDragStart(node.id);\n };\n\n const handleDragOver = (e: DragEvent<HTMLDivElement>): void => {\n e.preventDefault();\n e.stopPropagation();\n if (isFileDrag(e)) {\n // An OS file drag lands only where the consumer said files may, and is\n // never treated as a re-parent.\n e.dataTransfer.dropEffect = facade.acceptsFiles() ? \"copy\" : \"none\";\n return;\n }\n if (!props.isDragActive) return;\n // One zone per row: a drop names a folder, never a place between rows,\n // which a sorted tree could not keep. A branch is the folder; a leaf\n // stands for the folder that holds it (`resolveDrop` reads `before` so).\n e.dataTransfer.dropEffect = props.dropAllowed ? \"move\" : \"none\";\n const position: TreeDropPosition = node.branch ? \"inside\" : \"before\";\n facade.onDragOver(node.id, position);\n };\n\n const handleDrop = (e: DragEvent<HTMLDivElement>): void => {\n e.preventDefault();\n e.stopPropagation();\n if (isFileDrag(e)) {\n if (facade.acceptsFiles()) {\n facade.onFilesDrop(node.id, [...e.dataTransfer.files]);\n }\n return;\n }\n facade.onDrop(node.id);\n };\n\n // The row's own attributes, built once: the same element is rendered\n // directly, or handed to `ContextMenuTrigger`'s `render` prop when the\n // consumer supplied a menu. Duplicating the list for the two branches is\n // exactly how the two would drift.\n const rowProps = {\n \"data-slot\": \"tree-view-row\",\n role: \"treeitem\",\n // The rows are a flat list rather than nested `role=\"group\"` elements,\n // so depth is spoken through `aria-level`, which is the flat\n // equivalent.\n \"aria-level\": depth + 1,\n \"aria-expanded\": node.branch ? !isCollapsed : undefined,\n \"aria-selected\": isSelected || undefined,\n tabIndex: props.isTabStop ? 0 : -1,\n onFocus: (e: FocusEvent) => {\n if (e.target === e.currentTarget) facade.focus(node.id);\n },\n // Selection is otherwise only a background class, which is not\n // something a test (or a future stylesheet) can address.\n \"data-selected\": isSelected || undefined,\n // The target folder's block, addressable as the selection is.\n \"data-drop-block\": props.inDropBlock || undefined,\n draggable: props.isDraggable && !props.isRenaming,\n onDragStart: props.isDraggable ? handleDragStart : undefined,\n onDragOver: props.isDraggable ? handleDragOver : undefined,\n onDrop: props.isDraggable ? handleDrop : undefined,\n onDragEnd: props.isDraggable ? facade.onDragEnd : undefined,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n className: cn(\n // `group/tree-row` is NAMED, not a bare `group`: a consumer's icon\n // slot tracks this row's hover and selected background through it,\n // and a bare group here would also be captured by any `group-*`\n // utility inside the parts nested below. The row's fixed look, its\n // selected state and its indent guides live in `styles.css`\n // (`[data-slot=\"tree-view-row\"]`): only what varies stays here.\n \"group/tree-row\",\n // The press. Suppressed while dragging, because a transform on a\n // drag source moves the browser's own drag image with it.\n !props.isDragging && !props.isRenaming && \"active:translate-y-px\",\n props.isDragging && \"opacity-45\",\n // The folder the drop targets, as one block: its row and all of its\n // shown rows, the way a file manager lights the folder a file goes in.\n props.inDropBlock && \"bg-primary/15\",\n ),\n style: {\n paddingInlineStart: `${INDENT_BASE_PX + depth * INDENT_STEP_PX}px`,\n // Indent guides, as pure CSS: one hairline per ancestor level,\n // painted as a repeating gradient clipped to the indent area so it\n // can never run under the label. A background IMAGE, so the row's\n // background COLOUR (hover, selection) still shows through\n // underneath. A background has no logical side, so the gradient and\n // its origin are custom properties the `rtl:` classes in `className` flip.\n ...(depth > 0 && {\n \"--tree-guide-origin\": `${INDENT_GUIDE_ORIGIN_PX}px`,\n \"--tree-guide-step\": `${INDENT_STEP_PX}px`,\n backgroundSize: `${depth * INDENT_STEP_PX}px 100%`,\n backgroundRepeat: \"no-repeat\",\n }),\n } as CSSProperties,\n };\n\n const content = (\n <>\n {isSelected && (\n // The accent bar. A selected row used to differ from its\n // neighbours by a background tint alone, which several themes\n // render almost invisibly.\n <span\n aria-hidden\n className=\"bg-primary pointer-events-none absolute inset-y-0 start-0 w-0.5\"\n />\n )}\n {node.branch ? (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden\n onClick={handleToggle}\n className=\"flex h-3.5 shrink-0 items-center justify-center\"\n style={{ width: DISCLOSURE_BOX_PX }}\n >\n {isCollapsed ? (\n <ChevronRight className=\"size-3 opacity-60 rtl:-scale-x-100\" />\n ) : (\n <ChevronDown className=\"size-3 opacity-60\" />\n )}\n </button>\n ) : (\n <span\n className=\"inline-block shrink-0\"\n style={{ width: DISCLOSURE_BOX_PX }}\n />\n )}\n {facade.renderIcon(node, state)}\n {props.isRenaming ? (\n <TreeViewRenameInput\n name={node.name}\n onCommit={(name) => facade.commitRename(node.id, name)}\n onCancel={facade.cancelRename}\n />\n ) : (\n /*\n * The label is its OWN element, separate from the row's click\n * handler and from the disclosure button, so a consumer that needs\n * an anchor here one day changes this line rather than the row.\n */\n <span data-slot=\"tree-view-label\" className=\"min-w-0 flex-1 truncate\">\n {facade.renderLabel(node, state)}\n </span>\n )}\n {!props.isRenaming && facade.renderTrailing(node, state)}\n </>\n );\n\n if (!props.hasMenu) return <div {...rowProps}>{content}</div>;\n\n return (\n <ContextMenu>\n <ContextMenuTrigger render={<div {...rowProps} />}>\n {content}\n </ContextMenuTrigger>\n {facade.renderMenu(node)}\n </ContextMenu>\n );\n};\n\n/**\n * How far one level of nesting indents a row, in pixels.\n *\n * Shared by the row's own left padding and by the indent guides drawn behind\n * it, so the two cannot drift: a guide that does not line up with the column\n * it belongs to is worse than no guide.\n */\nexport const INDENT_STEP_PX = 13;\n\n/**\n * The row's own base padding: where a depth-0 row's content starts.\n */\nexport const INDENT_BASE_PX = 8;\n\n/**\n * The width of the disclosure column: the chevron button on a branch, and the\n * spacer that stands in for it on a leaf.\n *\n * Applied as a style rather than a `w-3.5` class **on purpose**: it is also\n * half of {@link INDENT_GUIDE_ORIGIN_PX}, so a class here would let the box be\n * resized while the guides stayed where they were. One number, two consumers,\n * no way to move one without the other.\n */\nexport const DISCLOSURE_BOX_PX = 14;\n\n/**\n * Where the first level's guide is painted.\n *\n * ⚠️ **Not the same as {@link INDENT_BASE_PX}, and it used to be.** The rule\n * is not \"the same number twice\" but \"a guide is centred on the disclosure\n * column of the level it marks\", which is what a reader perceives as aligned.\n * Sharing the row's base padding put every guide 7px to the LEFT of its own\n * chevron, at every depth.\n *\n * Derived rather than typed, because the correction is exactly half the\n * disclosure box: the eyeballed 14 and the computed 15 are both within a pixel\n * of right, and only one of them survives the chevron changing size.\n *\n * ⚠️ The gradient paints its hairline from this x, so the 1px line occupies\n * `[15, 16)` and its own centre is half a pixel right of the chevron's.\n * Deliberate: `14.5` would centre the line exactly and cost the hairline its\n * crispness on a 1x display, which is a worse trade for a 1px rule than half a\n * pixel of offset. Known, not overlooked.\n */\nexport const INDENT_GUIDE_ORIGIN_PX = INDENT_BASE_PX + DISCLOSURE_BOX_PX / 2;\n\n/**\n * Whether a drag carries OS files rather than one of this tree's own rows.\n *\n * `dataTransfer.types` is the only readable signal during `dragover`:\n * `dataTransfer.files` is empty until `drop`, because the browser withholds\n * the bytes so a page cannot read a file merely by being dragged across it.\n * Checking the tree's drag id instead would be wrong in the other direction:\n * it is unset for an external drag, but also unset in the frame before an\n * internal drag's `dragstart` state lands.\n */\nconst isFileDrag = (e: DragEvent<HTMLElement>): boolean =>\n [...e.dataTransfer.types].includes(\"Files\");\n\n/**\n * Memoised, and the props above are shaped so that the DEFAULT shallow\n * comparison is enough: every one of them is a primitive, a node the tree\n * model memoises, or the facade that never changes identity.\n *\n * Before this discipline existed, one toggle re-rendered every visible row\n * along with its handlers: `rows` was already memoised, but each row received\n * the whole tree-state object, which is rebuilt on every render along with all\n * of its callbacks. Now a toggle re-renders only the rows whose own props\n * changed: the branch that opened, plus the rows that appeared or disappeared\n * beneath it.\n *\n * ⚠️ A prop added here must be shallow-comparable, or the memo silently stops\n * holding and nothing goes red. Anything that is not a primitive belongs on\n * the facade.\n */\nexport const TreeViewRow = memo(TreeViewRowImpl) as typeof TreeViewRowImpl;\n\n/**\n * The image dragged under the pointer: a compact label of the row's name,\n * not the browser's snapshot of the whole row with its indent and trailing\n * icons. Built off-screen, handed to the browser, and removed on the next\n * frame, once the browser has rendered it.\n */\nconst setDragLabel = (e: DragEvent<HTMLDivElement>): void => {\n if (typeof e.dataTransfer.setDragImage !== \"function\") return;\n const text = e.currentTarget.textContent?.trim() ?? \"\";\n if (!text) return;\n const label = document.createElement(\"div\");\n label.textContent = text;\n const style = getComputedStyle(e.currentTarget);\n Object.assign(label.style, {\n position: \"fixed\",\n top: \"-1000px\",\n left: \"-1000px\",\n maxWidth: \"240px\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n padding: \"2px 8px\",\n borderRadius: \"6px\",\n font: style.font,\n color: style.color,\n background: \"var(--popover, white)\",\n boxShadow: \"0 1px 3px rgb(0 0 0 / 0.2)\",\n });\n document.body.appendChild(label);\n e.dataTransfer.setDragImage(label, -12, -8);\n requestAnimationFrame(() => label.remove());\n};\n"],"mappings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EACzB,UAAU;EACV,KAAK;EACL,MAAM;EACN,UAAU;EACV,UAAU;EACV,cAAc;EACd,YAAY;EACZ,SAAS;EACT,cAAc;EACd,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,YAAY;EACZ,WAAW;CACb,CAAC;CACD,SAAS,KAAK,YAAY,KAAK;CAC/B,EAAE,aAAa,aAAa,OAAO,KAAK,EAAE;CAC1C,4BAA4B,MAAM,OAAO,CAAC;AAC5C"}
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  slug: "packages-alepha-ui-ai"
3
3
  title: "@alepha/ui - Ai"
4
- summary: "The in-app assistant on the client: a chat in a drawer or docked beside the page, with streamed replies, history and a confirmation card per mutation, the headless `useAiChat`, and `useAiContext` f..."
4
+ summary: "The in-app assistant on the client: a chat in a drawer, docked beside the page or floating over its corner, with streamed replies, history and a confirmation card per mutation, the headless `useAiC..."
5
5
  package: "@alepha/ui"
6
6
  section: "packages"
7
7
  ---
@@ -16,8 +16,8 @@ npm install @alepha/ui
16
16
 
17
17
  ## Overview
18
18
 
19
- The in-app assistant on the client: a chat in a drawer or docked beside
20
- the page, with streamed replies, history and a confirmation card per
19
+ The in-app assistant on the client: a chat in a drawer, docked beside
20
+ the page or floating over its corner, with streamed replies, history and a confirmation card per
21
21
  mutation, the headless `useAiChat`, and `useAiContext` for a page to
22
22
  declare what it shows. Talks to `alepha/api/ai`.
23
23
 
@@ -26,4 +26,5 @@ declare what it shows. Talks to `alepha/api/ai`.
26
26
  ### React Hooks
27
27
 
28
28
  - [`useAiChat`](../../../alepha/docs/reference-react-hooks-useaichat.md) - The state and actions of an assistant conversation, without any UI: what
29
+ - [`useAiChatFloatDrag`](../../../alepha/docs/reference-react-hooks-useaichatfloatdrag.md) - Moves the floating assistant by its header, the way a chat
29
30
  - [`useAiContext`](../../../alepha/docs/reference-react-hooks-useaicontext.md) - Declare what the current page shows the assistant: a short `page` name,
@@ -0,0 +1,35 @@
1
+ ---
2
+ slug: "packages-alepha-ui-i18n-en"
3
+ title: "@alepha/ui - I18n En"
4
+ summary: "The English catalogue for every key `@alepha/ui` asks for."
5
+ package: "@alepha/ui"
6
+ section: "packages"
7
+ ---
8
+
9
+ # @alepha/ui - I18n En
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @alepha/ui
15
+ ```
16
+
17
+ ## Overview
18
+
19
+ The English catalogue for every key `@alepha/ui` asks for.
20
+
21
+ The components default to English already; this record is for an application
22
+ whose fallback language is not English, where a key missing from the `en`
23
+ catalogue would otherwise be read in the fallback language. A plain record
24
+ the application spreads into its own catalogue, and a subpath of its own so
25
+ that catalogue can load it lazily:
26
+
27
+ ```ts
28
+ en = $dictionary({
29
+ lazy: async () => {
30
+ const { uiEn } = await import("@alepha/ui/i18n/en");
31
+ return { default: { ...uiEn, "nav.home": "Home" } };
32
+ },
33
+ });
34
+ ```
35
+
@@ -19,7 +19,9 @@ npm install @alepha/ui
19
19
  Markdown rendered as prose, with diagrams.
20
20
 
21
21
  `MarkdownView` renders GitHub-flavoured markdown with highlighted code, and
22
- draws `flowchart` and `sequenceDiagram` fences as SVG. `diagramKind`,
22
+ draws `flowchart` and `sequenceDiagram` fences as SVG. `highlightLines`
23
+ highlights a whole file line by line with the same grammars, for a code
24
+ view that numbers its lines. `diagramKind`,
23
25
  `parseFlowchart` and `parseSequence` expose the parsers, so an editor can
24
26
  validate a diagram before it is saved.
25
27
 
@@ -70,10 +70,12 @@ the module map and that `@alepha/ui` (the root) imports no other module.
70
70
  | `@alepha/ui/calendar` | The react-day-picker wrapper (`Calendar`). Opt-in |
71
71
  | `@alepha/ui/otp` | The input-otp wrapper (`InputOTP`). Opt-in |
72
72
  | `@alepha/ui/resizable` | The react-resizable-panels wrapper. Opt-in |
73
+ | `@alepha/ui/sortable` | `useSortableList` and `useSortableItem`: a vertical list reordered by dragging or from the keyboard, on `@dnd-kit`. Opt-in |
74
+ | `@alepha/ui/i18n/en` | `uiEn`, the English catalogue, for an app whose fallback language is not English |
73
75
  | `@alepha/ui/i18n/fr` | `uiFr`, the French catalogue for every key the package asks for |
74
76
 
75
- The five opt-in wrappers import only the root, so a heavy dependency (recharts,
76
- react-day-picker, input-otp, react-resizable-panels) is loaded by the app
77
+ The six opt-in wrappers import only the root, so a heavy dependency (recharts,
78
+ react-day-picker, input-otp, react-resizable-panels, `@dnd-kit`) is loaded by the app
77
79
  that imports its subpath and by nothing else.
78
80
 
79
81
  > `useDialog()` throws without a `<DialogProvider>` above it, and toasts need a
@@ -0,0 +1,34 @@
1
+ ---
2
+ slug: "packages-alepha-ui-sortable"
3
+ title: "@alepha/ui - Sortable"
4
+ summary: "Sortable lists, on `@dnd-kit`."
5
+ package: "@alepha/ui"
6
+ section: "packages"
7
+ ---
8
+
9
+ # @alepha/ui - Sortable
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @alepha/ui
15
+ ```
16
+
17
+ ## Overview
18
+
19
+ Sortable lists, on `@dnd-kit`.
20
+
21
+ `useSortableList` holds a vertical list reordered by dragging (pointer or
22
+ touch) or from the keyboard: the order shown between a drop and the
23
+ server's answer, the drop index, a vertical-only modifier, and the keyboard
24
+ move (Space picks up, the arrows move, Space or Enter drops, Escape puts
25
+ back) with its screen-reader announcements. `useSortableItem` is one item
26
+ of it. The look and the save stay the app's. Opt-in: nothing else in
27
+ `@alepha/ui` imports it, so `@dnd-kit` loads only with it.
28
+
29
+ ## API Reference
30
+
31
+ ### React Hooks
32
+
33
+ - [`useSortableItem`](../../../alepha/docs/reference-react-hooks-usesortableitem.md) - One item of a `useSortableList`: the element both dragged and dropped
34
+ - [`useSortableList`](../../../alepha/docs/reference-react-hooks-usesortablelist.md) - A vertical list reordered by dragging or from the keyboard, on `@dnd-kit`
@@ -29,7 +29,13 @@ node beside them. A `help` node sits behind a `?` at the end of the
29
29
  toolbar's icons. A page with views of one table is a `PlateLayout`, whose
30
30
  folder tabs sit above it.
31
31
  `DataTableFilterMenu`, `DataTableFilterDialog` and `DataTableBulkMenu`
32
- are its parts, and `useTableSelection` its selection state. `PermissionMatrix` is the grid of
32
+ are its parts, and `useTableSelection` its selection state.
33
+ `readPersisted` and `writePersisted` are where a table keeps what it
34
+ remembers under its `persistenceKey`, for a page control beside the table
35
+ (a grouping, a view) to be remembered the same way; they go to
36
+ `localStorage` unless a `DataTablePersistenceStorage` is passed, which is
37
+ what a table's `persistenceStorage` prop takes to keep its state elsewhere,
38
+ such as the user's preferences on a server. `PermissionMatrix` is the grid of
33
39
  roles against permissions the admin and account kits draw.
34
40
 
35
41
  ## API Reference