@alepha/ui 0.27.1 → 0.29.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 (630) hide show
  1. package/README.md +31 -2
  2. package/dist/components/account/account-connections.d.ts.map +1 -1
  3. package/dist/components/account/account-connections.js +4 -1
  4. package/dist/components/account/account-connections.js.map +1 -1
  5. package/dist/components/account/account-delete-dialog.d.ts.map +1 -1
  6. package/dist/components/account/account-delete-dialog.js +12 -15
  7. package/dist/components/account/account-delete-dialog.js.map +1 -1
  8. package/dist/components/account/account-keys.d.ts.map +1 -1
  9. package/dist/components/account/account-keys.js +22 -28
  10. package/dist/components/account/account-keys.js.map +1 -1
  11. package/dist/components/account/account-layout.d.ts.map +1 -1
  12. package/dist/components/account/account-layout.js +8 -2
  13. package/dist/components/account/account-layout.js.map +1 -1
  14. package/dist/components/account/account-mfa-dialog.js +1 -4
  15. package/dist/components/account/account-mfa-dialog.js.map +1 -1
  16. package/dist/components/account/account-password-dialog.d.ts.map +1 -1
  17. package/dist/components/account/account-password-dialog.js +11 -14
  18. package/dist/components/account/account-password-dialog.js.map +1 -1
  19. package/dist/components/account/account-profile.js +3 -2
  20. package/dist/components/account/account-profile.js.map +1 -1
  21. package/dist/components/account/account-router-options.d.ts +38 -0
  22. package/dist/components/account/account-router-options.d.ts.map +1 -1
  23. package/dist/components/account/account-router-options.js.map +1 -1
  24. package/dist/components/account/account-router-page.d.ts +11 -1
  25. package/dist/components/account/account-router-page.d.ts.map +1 -1
  26. package/dist/components/account/account-router-page.js +11 -1
  27. package/dist/components/account/account-router-page.js.map +1 -1
  28. package/dist/components/account/account-router.d.ts +11 -0
  29. package/dist/components/account/account-router.d.ts.map +1 -1
  30. package/dist/components/account/account-router.js +16 -5
  31. package/dist/components/account/account-router.js.map +1 -1
  32. package/dist/components/admin/admin-analytics.d.ts +34 -5
  33. package/dist/components/admin/admin-analytics.d.ts.map +1 -1
  34. package/dist/components/admin/admin-analytics.js +69 -51
  35. package/dist/components/admin/admin-analytics.js.map +1 -1
  36. package/dist/components/admin/admin-audits.d.ts +14 -0
  37. package/dist/components/admin/admin-audits.d.ts.map +1 -1
  38. package/dist/components/admin/admin-audits.js +121 -37
  39. package/dist/components/admin/admin-audits.js.map +1 -1
  40. package/dist/components/admin/admin-files.d.ts.map +1 -1
  41. package/dist/components/admin/admin-files.js +8 -18
  42. package/dist/components/admin/admin-files.js.map +1 -1
  43. package/dist/components/admin/admin-jobs-executions-panel.d.ts.map +1 -1
  44. package/dist/components/admin/admin-jobs-executions-panel.js +40 -9
  45. package/dist/components/admin/admin-jobs-executions-panel.js.map +1 -1
  46. package/dist/components/admin/admin-jobs-payload-dialog.d.ts +19 -0
  47. package/dist/components/admin/admin-jobs-payload-dialog.d.ts.map +1 -0
  48. package/dist/components/admin/admin-jobs-payload-dialog.js +33 -0
  49. package/dist/components/admin/admin-jobs-payload-dialog.js.map +1 -0
  50. package/dist/components/admin/admin-jobs.js +1 -1
  51. package/dist/components/admin/admin-keys.d.ts.map +1 -1
  52. package/dist/components/admin/admin-keys.js +7 -5
  53. package/dist/components/admin/admin-keys.js.map +1 -1
  54. package/dist/components/admin/admin-notifications-channel-label.d.ts +14 -0
  55. package/dist/components/admin/admin-notifications-channel-label.d.ts.map +1 -0
  56. package/dist/components/admin/admin-notifications-channel-label.js +26 -0
  57. package/dist/components/admin/admin-notifications-channel-label.js.map +1 -0
  58. package/dist/components/admin/admin-notifications-preview-body.d.ts.map +1 -1
  59. package/dist/components/admin/admin-notifications-preview-body.js +23 -13
  60. package/dist/components/admin/admin-notifications-preview-body.js.map +1 -1
  61. package/dist/components/admin/admin-notifications.d.ts.map +1 -1
  62. package/dist/components/admin/admin-notifications.js +12 -13
  63. package/dist/components/admin/admin-notifications.js.map +1 -1
  64. package/dist/components/admin/admin-parameters.d.ts.map +1 -1
  65. package/dist/components/admin/admin-parameters.js +108 -14
  66. package/dist/components/admin/admin-parameters.js.map +1 -1
  67. package/dist/components/admin/admin-payments.d.ts.map +1 -1
  68. package/dist/components/admin/admin-payments.js +10 -8
  69. package/dist/components/admin/admin-payments.js.map +1 -1
  70. package/dist/components/admin/admin-router-options.d.ts +12 -0
  71. package/dist/components/admin/admin-router-options.d.ts.map +1 -1
  72. package/dist/components/admin/admin-router-options.js.map +1 -1
  73. package/dist/components/admin/admin-router.d.ts +5 -8
  74. package/dist/components/admin/admin-router.d.ts.map +1 -1
  75. package/dist/components/admin/admin-router.js +6 -29
  76. package/dist/components/admin/admin-router.js.map +1 -1
  77. package/dist/components/admin/admin-sessions.d.ts.map +1 -1
  78. package/dist/components/admin/admin-sessions.js +135 -11
  79. package/dist/components/admin/admin-sessions.js.map +1 -1
  80. package/dist/components/admin/admin-user-avatar-control.d.ts +24 -0
  81. package/dist/components/admin/admin-user-avatar-control.d.ts.map +1 -0
  82. package/dist/components/admin/admin-user-avatar-control.js +84 -0
  83. package/dist/components/admin/admin-user-avatar-control.js.map +1 -0
  84. package/dist/components/admin/admin-user-detail-audits-tab.d.ts.map +1 -1
  85. package/dist/components/admin/admin-user-detail-audits-tab.js +5 -4
  86. package/dist/components/admin/admin-user-detail-audits-tab.js.map +1 -1
  87. package/dist/components/admin/admin-user-detail-sessions-tab.d.ts.map +1 -1
  88. package/dist/components/admin/admin-user-detail-sessions-tab.js +7 -5
  89. package/dist/components/admin/admin-user-detail-sessions-tab.js.map +1 -1
  90. package/dist/components/admin/admin-user-detail.d.ts.map +1 -1
  91. package/dist/components/admin/admin-user-detail.js +16 -4
  92. package/dist/components/admin/admin-user-detail.js.map +1 -1
  93. package/dist/components/admin/admin-users-roles-picker.d.ts.map +1 -1
  94. package/dist/components/admin/admin-users-roles-picker.js.map +1 -1
  95. package/dist/components/admin/admin-users.d.ts.map +1 -1
  96. package/dist/components/admin/admin-users.js +7 -5
  97. package/dist/components/admin/admin-users.js.map +1 -1
  98. package/dist/components/admin/analytics/AdvancedSection.d.ts +26 -0
  99. package/dist/components/admin/analytics/AdvancedSection.d.ts.map +1 -0
  100. package/dist/components/admin/analytics/AdvancedSection.js +143 -0
  101. package/dist/components/admin/analytics/AdvancedSection.js.map +1 -0
  102. package/dist/components/admin/analytics/AnalyticsChart.d.ts +20 -0
  103. package/dist/components/admin/analytics/AnalyticsChart.d.ts.map +1 -0
  104. package/dist/components/admin/analytics/AnalyticsChart.js +60 -0
  105. package/dist/components/admin/analytics/AnalyticsChart.js.map +1 -0
  106. package/dist/components/admin/analytics/AnalyticsChartBars.d.ts +19 -0
  107. package/dist/components/admin/analytics/AnalyticsChartBars.d.ts.map +1 -0
  108. package/dist/components/admin/analytics/AnalyticsChartBars.js +43 -0
  109. package/dist/components/admin/analytics/AnalyticsChartBars.js.map +1 -0
  110. package/dist/components/admin/analytics/AnalyticsChartDonut.d.ts +11 -0
  111. package/dist/components/admin/analytics/AnalyticsChartDonut.d.ts.map +1 -0
  112. package/dist/components/admin/analytics/AnalyticsChartDonut.js +78 -0
  113. package/dist/components/admin/analytics/AnalyticsChartDonut.js.map +1 -0
  114. package/dist/components/admin/analytics/AnalyticsChartHeader.d.ts +20 -0
  115. package/dist/components/admin/analytics/AnalyticsChartHeader.d.ts.map +1 -0
  116. package/dist/components/admin/analytics/AnalyticsChartHeader.js +105 -0
  117. package/dist/components/admin/analytics/AnalyticsChartHeader.js.map +1 -0
  118. package/dist/components/admin/analytics/AnalyticsChartHeat.d.ts +10 -0
  119. package/dist/components/admin/analytics/AnalyticsChartHeat.d.ts.map +1 -0
  120. package/dist/components/admin/analytics/AnalyticsChartHeat.js +58 -0
  121. package/dist/components/admin/analytics/AnalyticsChartHeat.js.map +1 -0
  122. package/dist/components/admin/analytics/AnalyticsChartLegend.d.ts +9 -0
  123. package/dist/components/admin/analytics/AnalyticsChartLegend.d.ts.map +1 -0
  124. package/dist/components/admin/analytics/AnalyticsChartLegend.js +21 -0
  125. package/dist/components/admin/analytics/AnalyticsChartLegend.js.map +1 -0
  126. package/dist/components/admin/analytics/AnalyticsChartLine.d.ts +13 -0
  127. package/dist/components/admin/analytics/AnalyticsChartLine.d.ts.map +1 -0
  128. package/dist/components/admin/analytics/AnalyticsChartLine.js +36 -0
  129. package/dist/components/admin/analytics/AnalyticsChartLine.js.map +1 -0
  130. package/dist/components/admin/analytics/AnalyticsChartRank.d.ts +13 -0
  131. package/dist/components/admin/analytics/AnalyticsChartRank.d.ts.map +1 -0
  132. package/dist/components/admin/analytics/AnalyticsChartRank.js +41 -0
  133. package/dist/components/admin/analytics/AnalyticsChartRank.js.map +1 -0
  134. package/dist/components/admin/analytics/AnalyticsChartTicks.d.ts +13 -0
  135. package/dist/components/admin/analytics/AnalyticsChartTicks.d.ts.map +1 -0
  136. package/dist/components/admin/analytics/AnalyticsChartTicks.js +26 -0
  137. package/dist/components/admin/analytics/AnalyticsChartTicks.js.map +1 -0
  138. package/dist/components/admin/analytics/AnalyticsEmpty.d.ts +16 -0
  139. package/dist/components/admin/analytics/AnalyticsEmpty.d.ts.map +1 -0
  140. package/dist/components/admin/analytics/AnalyticsEmpty.js +32 -0
  141. package/dist/components/admin/analytics/AnalyticsEmpty.js.map +1 -0
  142. package/dist/components/admin/analytics/ClauseLabel.d.ts +15 -0
  143. package/dist/components/admin/analytics/ClauseLabel.d.ts.map +1 -0
  144. package/dist/components/admin/analytics/ClauseLabel.js +19 -0
  145. package/dist/components/admin/analytics/ClauseLabel.js.map +1 -0
  146. package/dist/components/admin/analytics/CompareNote.d.ts +16 -0
  147. package/dist/components/admin/analytics/CompareNote.d.ts.map +1 -0
  148. package/dist/components/admin/analytics/CompareNote.js +33 -0
  149. package/dist/components/admin/analytics/CompareNote.js.map +1 -0
  150. package/dist/components/admin/analytics/DatasetSelect.d.ts +20 -0
  151. package/dist/components/admin/analytics/DatasetSelect.d.ts.map +1 -0
  152. package/dist/components/admin/analytics/DatasetSelect.js +63 -0
  153. package/dist/components/admin/analytics/DatasetSelect.js.map +1 -0
  154. package/dist/components/admin/analytics/FilterEditor.d.ts +24 -0
  155. package/dist/components/admin/analytics/FilterEditor.d.ts.map +1 -0
  156. package/dist/components/admin/analytics/FilterEditor.js +129 -0
  157. package/dist/components/admin/analytics/FilterEditor.js.map +1 -0
  158. package/dist/components/admin/analytics/FilterValuePicker.d.ts +19 -0
  159. package/dist/components/admin/analytics/FilterValuePicker.d.ts.map +1 -0
  160. package/dist/components/admin/analytics/FilterValuePicker.js +131 -0
  161. package/dist/components/admin/analytics/FilterValuePicker.js.map +1 -0
  162. package/dist/components/admin/analytics/GroupByChips.d.ts +26 -0
  163. package/dist/components/admin/analytics/GroupByChips.d.ts.map +1 -0
  164. package/dist/components/admin/analytics/GroupByChips.js +71 -0
  165. package/dist/components/admin/analytics/GroupByChips.js.map +1 -0
  166. package/dist/components/admin/analytics/MeasureChips.d.ts +18 -0
  167. package/dist/components/admin/analytics/MeasureChips.d.ts.map +1 -0
  168. package/dist/components/admin/analytics/MeasureChips.js +46 -0
  169. package/dist/components/admin/analytics/MeasureChips.js.map +1 -0
  170. package/dist/components/admin/analytics/QueryPanel.d.ts +27 -0
  171. package/dist/components/admin/analytics/QueryPanel.d.ts.map +1 -0
  172. package/dist/components/admin/analytics/QueryPanel.js +92 -0
  173. package/dist/components/admin/analytics/QueryPanel.js.map +1 -0
  174. package/dist/components/admin/analytics/RangeControl.d.ts +17 -0
  175. package/dist/components/admin/analytics/RangeControl.d.ts.map +1 -0
  176. package/dist/components/admin/analytics/RangeControl.js +43 -0
  177. package/dist/components/admin/analytics/RangeControl.js.map +1 -0
  178. package/dist/components/admin/analytics/RequestDialog.d.ts +24 -0
  179. package/dist/components/admin/analytics/RequestDialog.d.ts.map +1 -0
  180. package/dist/components/admin/analytics/RequestDialog.js +67 -0
  181. package/dist/components/admin/analytics/RequestDialog.js.map +1 -0
  182. package/dist/components/admin/analytics/ResultsPane.d.ts +15 -0
  183. package/dist/components/admin/analytics/ResultsPane.d.ts.map +1 -0
  184. package/dist/components/admin/analytics/ResultsPane.js +161 -0
  185. package/dist/components/admin/analytics/ResultsPane.js.map +1 -0
  186. package/dist/components/admin/analytics/ResultsTable.d.ts +17 -0
  187. package/dist/components/admin/analytics/ResultsTable.d.ts.map +1 -0
  188. package/dist/components/admin/analytics/ResultsTable.js +113 -0
  189. package/dist/components/admin/analytics/ResultsTable.js.map +1 -0
  190. package/dist/components/admin/analytics/RunFooter.d.ts +18 -0
  191. package/dist/components/admin/analytics/RunFooter.d.ts.map +1 -0
  192. package/dist/components/admin/analytics/RunFooter.js +78 -0
  193. package/dist/components/admin/analytics/RunFooter.js.map +1 -0
  194. package/dist/components/admin/analytics/SamplingBadge.d.ts +18 -0
  195. package/dist/components/admin/analytics/SamplingBadge.d.ts.map +1 -0
  196. package/dist/components/admin/analytics/SamplingBadge.js +35 -0
  197. package/dist/components/admin/analytics/SamplingBadge.js.map +1 -0
  198. package/dist/components/admin/analytics/ToggleChip.d.ts +28 -0
  199. package/dist/components/admin/analytics/ToggleChip.d.ts.map +1 -0
  200. package/dist/components/admin/analytics/ToggleChip.js +35 -0
  201. package/dist/components/admin/analytics/ToggleChip.js.map +1 -0
  202. package/dist/components/admin/analytics/TotalsCards.d.ts +19 -0
  203. package/dist/components/admin/analytics/TotalsCards.d.ts.map +1 -0
  204. package/dist/components/admin/analytics/TotalsCards.js +75 -0
  205. package/dist/components/admin/analytics/TotalsCards.js.map +1 -0
  206. package/dist/components/admin/analytics/TruncationBanner.d.ts +15 -0
  207. package/dist/components/admin/analytics/TruncationBanner.d.ts.map +1 -0
  208. package/dist/components/admin/analytics/TruncationBanner.js +52 -0
  209. package/dist/components/admin/analytics/TruncationBanner.js.map +1 -0
  210. package/dist/components/admin/analytics/analyticsModel.d.ts +98 -0
  211. package/dist/components/admin/analytics/analyticsModel.d.ts.map +1 -0
  212. package/dist/components/admin/analytics/analyticsModel.js +184 -0
  213. package/dist/components/admin/analytics/analyticsModel.js.map +1 -0
  214. package/dist/components/admin/analytics/analyticsTypes.d.ts +116 -0
  215. package/dist/components/admin/analytics/analyticsTypes.d.ts.map +1 -0
  216. package/dist/components/admin/analytics/analyticsTypes.js +0 -0
  217. package/dist/components/admin/analytics/chartModel.d.ts +149 -0
  218. package/dist/components/admin/analytics/chartModel.d.ts.map +1 -0
  219. package/dist/components/admin/analytics/chartModel.js +278 -0
  220. package/dist/components/admin/analytics/chartModel.js.map +1 -0
  221. package/dist/components/admin/analytics/useAnalyticsQuery.d.ts +62 -0
  222. package/dist/components/admin/analytics/useAnalyticsQuery.d.ts.map +1 -0
  223. package/dist/components/admin/analytics/useAnalyticsQuery.js +257 -0
  224. package/dist/components/admin/analytics/useAnalyticsQuery.js.map +1 -0
  225. package/dist/components/admin/analytics/useDismissable.d.ts +18 -0
  226. package/dist/components/admin/analytics/useDismissable.d.ts.map +1 -0
  227. package/dist/components/admin/analytics/useDismissable.js +37 -0
  228. package/dist/components/admin/analytics/useDismissable.js.map +1 -0
  229. package/dist/components/admin/analytics/useFilterValues.d.ts +37 -0
  230. package/dist/components/admin/analytics/useFilterValues.d.ts.map +1 -0
  231. package/dist/components/admin/analytics/useFilterValues.js +78 -0
  232. package/dist/components/admin/analytics/useFilterValues.js.map +1 -0
  233. package/dist/components/admin/analytics/usePanelWidth.d.ts +26 -0
  234. package/dist/components/admin/analytics/usePanelWidth.d.ts.map +1 -0
  235. package/dist/components/admin/analytics/usePanelWidth.js +61 -0
  236. package/dist/components/admin/analytics/usePanelWidth.js.map +1 -0
  237. package/dist/components/admin/analytics/useShapeLabels.d.ts +24 -0
  238. package/dist/components/admin/analytics/useShapeLabels.d.ts.map +1 -0
  239. package/dist/components/admin/analytics/useShapeLabels.js +41 -0
  240. package/dist/components/admin/analytics/useShapeLabels.js.map +1 -0
  241. package/dist/components/admin/parameter-history-item.d.ts.map +1 -1
  242. package/dist/components/admin/parameter-history-item.js +3 -2
  243. package/dist/components/admin/parameter-history-item.js.map +1 -1
  244. package/dist/components/alepha-table/alepha-table-bulk-menu.d.ts +22 -0
  245. package/dist/components/alepha-table/alepha-table-bulk-menu.d.ts.map +1 -0
  246. package/dist/components/alepha-table/alepha-table-bulk-menu.js +118 -0
  247. package/dist/components/alepha-table/alepha-table-bulk-menu.js.map +1 -0
  248. package/dist/components/alepha-table/alepha-table-filter-dialog.d.ts +60 -0
  249. package/dist/components/alepha-table/alepha-table-filter-dialog.d.ts.map +1 -0
  250. package/dist/components/alepha-table/alepha-table-filter-dialog.js +88 -0
  251. package/dist/components/alepha-table/alepha-table-filter-dialog.js.map +1 -0
  252. package/dist/components/alepha-table/alepha-table-filter-menu.d.ts +35 -0
  253. package/dist/components/alepha-table/alepha-table-filter-menu.d.ts.map +1 -0
  254. package/dist/components/alepha-table/alepha-table-filter-menu.js +54 -0
  255. package/dist/components/alepha-table/alepha-table-filter-menu.js.map +1 -0
  256. package/dist/components/alepha-table/alepha-table.d.ts +336 -16
  257. package/dist/components/alepha-table/alepha-table.d.ts.map +1 -1
  258. package/dist/components/alepha-table/alepha-table.js +630 -174
  259. package/dist/components/alepha-table/alepha-table.js.map +1 -1
  260. package/dist/components/alepha-table/query-filters.d.ts +73 -0
  261. package/dist/components/alepha-table/query-filters.d.ts.map +1 -0
  262. package/dist/components/alepha-table/query-filters.js +118 -0
  263. package/dist/components/alepha-table/query-filters.js.map +1 -0
  264. package/dist/components/app-actions/app-actions.d.ts +21 -0
  265. package/dist/components/app-actions/app-actions.d.ts.map +1 -1
  266. package/dist/components/app-actions/app-actions.js +11 -5
  267. package/dist/components/app-actions/app-actions.js.map +1 -1
  268. package/dist/components/app-shell/app-shell.d.ts +75 -11
  269. package/dist/components/app-shell/app-shell.d.ts.map +1 -1
  270. package/dist/components/app-shell/app-shell.js +194 -83
  271. package/dist/components/app-shell/app-shell.js.map +1 -1
  272. package/dist/components/app-shell/navigation-progress.d.ts +40 -0
  273. package/dist/components/app-shell/navigation-progress.d.ts.map +1 -0
  274. package/dist/components/app-shell/navigation-progress.js +86 -0
  275. package/dist/components/app-shell/navigation-progress.js.map +1 -0
  276. package/dist/components/auth/auth-register.d.ts +35 -0
  277. package/dist/components/auth/auth-register.d.ts.map +1 -1
  278. package/dist/components/auth/auth-register.js +43 -38
  279. package/dist/components/auth/auth-register.js.map +1 -1
  280. package/dist/components/auto-form/auto-form.d.ts.map +1 -1
  281. package/dist/components/auto-form/auto-form.js +69 -28
  282. package/dist/components/auto-form/auto-form.js.map +1 -1
  283. package/dist/components/button-dark/button-dark.d.ts.map +1 -1
  284. package/dist/components/button-dark/button-dark.js +39 -8
  285. package/dist/components/button-dark/button-dark.js.map +1 -1
  286. package/dist/components/button-inbox/button-inbox.d.ts +66 -0
  287. package/dist/components/button-inbox/button-inbox.d.ts.map +1 -0
  288. package/dist/components/button-inbox/button-inbox.js +167 -0
  289. package/dist/components/button-inbox/button-inbox.js.map +1 -0
  290. package/dist/components/button-inbox/inbox-unread-atom.d.ts +22 -0
  291. package/dist/components/button-inbox/inbox-unread-atom.d.ts.map +1 -0
  292. package/dist/components/button-inbox/inbox-unread-atom.js +29 -0
  293. package/dist/components/button-inbox/inbox-unread-atom.js.map +1 -0
  294. package/dist/components/button-theme/button-theme.d.ts +4 -3
  295. package/dist/components/button-theme/button-theme.d.ts.map +1 -1
  296. package/dist/components/button-theme/button-theme.js +8 -25
  297. package/dist/components/button-theme/button-theme.js.map +1 -1
  298. package/dist/components/button-user/button-user.d.ts +19 -0
  299. package/dist/components/button-user/button-user.d.ts.map +1 -1
  300. package/dist/components/button-user/button-user.js +1 -1
  301. package/dist/components/button-user/button-user.js.map +1 -1
  302. package/dist/components/control/control.d.ts +90 -10
  303. package/dist/components/control/control.d.ts.map +1 -1
  304. package/dist/components/control/control.js +58 -8
  305. package/dist/components/control/control.js.map +1 -1
  306. package/dist/components/control-array/control-array.js +2 -1
  307. package/dist/components/control-array/control-array.js.map +1 -1
  308. package/dist/components/control-date/control-date.d.ts +35 -0
  309. package/dist/components/control-date/control-date.d.ts.map +1 -1
  310. package/dist/components/control-date/control-date.js +38 -26
  311. package/dist/components/control-date/control-date.js.map +1 -1
  312. package/dist/components/control-date/date-only.d.ts +18 -0
  313. package/dist/components/control-date/date-only.d.ts.map +1 -0
  314. package/dist/components/control-date/date-only.js +29 -0
  315. package/dist/components/control-date/date-only.js.map +1 -0
  316. package/dist/components/control-date-range/control-date-range.d.ts +56 -0
  317. package/dist/components/control-date-range/control-date-range.d.ts.map +1 -0
  318. package/dist/components/control-date-range/control-date-range.js +148 -0
  319. package/dist/components/control-date-range/control-date-range.js.map +1 -0
  320. package/dist/components/control-object/control-object.js +2 -1
  321. package/dist/components/control-object/control-object.js.map +1 -1
  322. package/dist/components/control-select/control-select.d.ts +57 -6
  323. package/dist/components/control-select/control-select.d.ts.map +1 -1
  324. package/dist/components/control-select/control-select.js +275 -55
  325. package/dist/components/control-select/control-select.js.map +1 -1
  326. package/dist/components/control-upload/control-upload.d.ts.map +1 -1
  327. package/dist/components/control-upload/control-upload.js +1 -11
  328. package/dist/components/control-upload/control-upload.js.map +1 -1
  329. package/dist/components/detail/detail-aside.d.ts.map +1 -1
  330. package/dist/components/detail/detail-aside.js +4 -3
  331. package/dist/components/detail/detail-aside.js.map +1 -1
  332. package/dist/components/detail/detail-layout.d.ts.map +1 -1
  333. package/dist/components/detail/detail-layout.js +9 -6
  334. package/dist/components/detail/detail-layout.js.map +1 -1
  335. package/dist/components/file-image/file-image.js +2 -1
  336. package/dist/components/file-image/file-image.js.map +1 -1
  337. package/dist/components/markdown-view/SpoilerSpan.d.ts +28 -0
  338. package/dist/components/markdown-view/SpoilerSpan.d.ts.map +1 -0
  339. package/dist/components/markdown-view/SpoilerSpan.js +53 -0
  340. package/dist/components/markdown-view/SpoilerSpan.js.map +1 -0
  341. package/dist/components/markdown-view/diagram/MermaidFence.d.ts.map +1 -1
  342. package/dist/components/markdown-view/diagram/MermaidFence.js +1 -15
  343. package/dist/components/markdown-view/diagram/MermaidFence.js.map +1 -1
  344. package/dist/components/markdown-view/diagram/diagramKind.d.ts +18 -0
  345. package/dist/components/markdown-view/diagram/diagramKind.d.ts.map +1 -0
  346. package/dist/components/markdown-view/diagram/diagramKind.js +27 -0
  347. package/dist/components/markdown-view/diagram/diagramKind.js.map +1 -0
  348. package/dist/components/markdown-view/diagram/layoutSequence.js +13 -23
  349. package/dist/components/markdown-view/diagram/layoutSequence.js.map +1 -1
  350. package/dist/components/markdown-view/diagram/textMetrics.js +2 -2
  351. package/dist/components/markdown-view/diagram/textMetrics.js.map +1 -1
  352. package/dist/components/markdown-view/markdown-view.css +44 -0
  353. package/dist/components/markdown-view/markdown-view.d.ts +12 -0
  354. package/dist/components/markdown-view/markdown-view.d.ts.map +1 -1
  355. package/dist/components/markdown-view/markdown-view.js +22 -1
  356. package/dist/components/markdown-view/markdown-view.js.map +1 -1
  357. package/dist/components/markdown-view/remarkSpoiler.d.ts +17 -0
  358. package/dist/components/markdown-view/remarkSpoiler.d.ts.map +1 -0
  359. package/dist/components/markdown-view/remarkSpoiler.js +117 -0
  360. package/dist/components/markdown-view/remarkSpoiler.js.map +1 -0
  361. package/dist/components/permission-matrix/permission-matrix-group-rows.d.ts +34 -0
  362. package/dist/components/permission-matrix/permission-matrix-group-rows.d.ts.map +1 -0
  363. package/dist/components/permission-matrix/permission-matrix-group-rows.js +109 -0
  364. package/dist/components/permission-matrix/permission-matrix-group-rows.js.map +1 -0
  365. package/dist/components/permission-matrix/permission-matrix.d.ts +145 -0
  366. package/dist/components/permission-matrix/permission-matrix.d.ts.map +1 -0
  367. package/dist/components/permission-matrix/permission-matrix.js +113 -0
  368. package/dist/components/permission-matrix/permission-matrix.js.map +1 -0
  369. package/dist/components/plate-layout/plate-layout.d.ts +55 -0
  370. package/dist/components/plate-layout/plate-layout.d.ts.map +1 -0
  371. package/dist/components/plate-layout/plate-layout.js +38 -0
  372. package/dist/components/plate-layout/plate-layout.js.map +1 -0
  373. package/dist/components/plate-layout/plate-tab-bar.d.ts +65 -0
  374. package/dist/components/plate-layout/plate-tab-bar.d.ts.map +1 -0
  375. package/dist/components/plate-layout/plate-tab-bar.js +52 -0
  376. package/dist/components/plate-layout/plate-tab-bar.js.map +1 -0
  377. package/dist/components/settings/settings-nav.js +2 -1
  378. package/dist/components/settings/settings-nav.js.map +1 -1
  379. package/dist/components/time-ago/time-ago.d.ts +57 -0
  380. package/dist/components/time-ago/time-ago.d.ts.map +1 -0
  381. package/dist/components/time-ago/time-ago.js +60 -0
  382. package/dist/components/time-ago/time-ago.js.map +1 -0
  383. package/dist/components/tree-view/tree-model.d.ts +128 -0
  384. package/dist/components/tree-view/tree-model.d.ts.map +1 -0
  385. package/dist/components/tree-view/tree-model.js +226 -0
  386. package/dist/components/tree-view/tree-model.js.map +1 -0
  387. package/dist/components/tree-view/tree-view-rename-input.d.ts +31 -0
  388. package/dist/components/tree-view/tree-view-rename-input.d.ts.map +1 -0
  389. package/dist/components/tree-view/tree-view-rename-input.js +68 -0
  390. package/dist/components/tree-view/tree-view-rename-input.js.map +1 -0
  391. package/dist/components/tree-view/tree-view-resizer.d.ts +38 -0
  392. package/dist/components/tree-view/tree-view-resizer.d.ts.map +1 -0
  393. package/dist/components/tree-view/tree-view-resizer.js +73 -0
  394. package/dist/components/tree-view/tree-view-resizer.js.map +1 -0
  395. package/dist/components/tree-view/tree-view-row.d.ts +177 -0
  396. package/dist/components/tree-view/tree-view-row.d.ts.map +1 -0
  397. package/dist/components/tree-view/tree-view-row.js +241 -0
  398. package/dist/components/tree-view/tree-view-row.js.map +1 -0
  399. package/dist/components/tree-view/tree-view.d.ts +186 -0
  400. package/dist/components/tree-view/tree-view.d.ts.map +1 -0
  401. package/dist/components/tree-view/tree-view.js +112 -0
  402. package/dist/components/tree-view/tree-view.js.map +1 -0
  403. package/dist/components/tree-view/use-tree-state.d.ts +79 -0
  404. package/dist/components/tree-view/use-tree-state.d.ts.map +1 -0
  405. package/dist/components/tree-view/use-tree-state.js +93 -0
  406. package/dist/components/tree-view/use-tree-state.js.map +1 -0
  407. package/dist/components/ui/button.d.ts.map +1 -1
  408. package/dist/components/ui/button.js +2 -2
  409. package/dist/components/ui/button.js.map +1 -1
  410. package/dist/components/ui/dropdown-menu.js.map +1 -1
  411. package/dist/components/ui/select.d.ts +7 -0
  412. package/dist/components/ui/select.d.ts.map +1 -1
  413. package/dist/components/ui/select.js +7 -0
  414. package/dist/components/ui/select.js.map +1 -1
  415. package/dist/components/ui/sidebar.js +1 -1
  416. package/dist/components/ui/sidebar.js.map +1 -1
  417. package/dist/components/ui/table.js.map +1 -1
  418. package/dist/components/ui/tooltip.js.map +1 -1
  419. package/dist/components/use-dialog/use-dialog.d.ts +7 -0
  420. package/dist/components/use-dialog/use-dialog.d.ts.map +1 -1
  421. package/dist/components/use-dialog/use-dialog.js +10 -1
  422. package/dist/components/use-dialog/use-dialog.js.map +1 -1
  423. package/dist/lib/i18n-fr.d.ts.map +1 -1
  424. package/dist/lib/i18n-fr.js +141 -54
  425. package/dist/lib/i18n-fr.js.map +1 -1
  426. package/dist/lib/utils.d.ts +22 -2
  427. package/dist/lib/utils.d.ts.map +1 -1
  428. package/dist/lib/utils.js +29 -5
  429. package/dist/lib/utils.js.map +1 -1
  430. package/dist/styles.css +300 -21
  431. package/package.json +16 -16
  432. package/src/components/account/__tests__/account-layout.browser.spec.tsx +127 -0
  433. package/src/components/account/__tests__/account-router.spec.ts +95 -0
  434. package/src/components/account/account-connections.tsx +14 -1
  435. package/src/components/account/account-delete-dialog.tsx +3 -2
  436. package/src/components/account/account-keys.tsx +11 -4
  437. package/src/components/account/account-layout.tsx +32 -2
  438. package/src/components/account/account-mfa-dialog.tsx +1 -1
  439. package/src/components/account/account-password-dialog.tsx +3 -2
  440. package/src/components/account/account-profile.tsx +1 -1
  441. package/src/components/account/account-router-options.tsx +45 -0
  442. package/src/components/account/account-router-page.tsx +11 -1
  443. package/src/components/account/account-router.tsx +23 -6
  444. package/src/components/admin/__tests__/admin-audits-action-filter.browser.spec.tsx +53 -0
  445. package/src/components/admin/__tests__/admin-jobs-payload-dialog.browser.spec.tsx +68 -0
  446. package/src/components/admin/__tests__/admin-notifications-preview-body.browser.spec.tsx +20 -4
  447. package/src/components/admin/__tests__/admin-status-labels.browser.spec.tsx +0 -31
  448. package/src/components/admin/admin-analytics.tsx +97 -83
  449. package/src/components/admin/admin-audits.tsx +149 -13
  450. package/src/components/admin/admin-files.tsx +10 -16
  451. package/src/components/admin/admin-jobs-executions-panel.tsx +152 -114
  452. package/src/components/admin/admin-jobs-payload-dialog.tsx +57 -0
  453. package/src/components/admin/admin-keys.tsx +9 -4
  454. package/src/components/admin/admin-notifications-channel-label.ts +18 -0
  455. package/src/components/admin/admin-notifications-preview-body.tsx +7 -2
  456. package/src/components/admin/admin-notifications.tsx +19 -8
  457. package/src/components/admin/admin-parameters.tsx +165 -12
  458. package/src/components/admin/admin-payments.tsx +7 -4
  459. package/src/components/admin/admin-router-options.tsx +12 -0
  460. package/src/components/admin/admin-router.tsx +5 -27
  461. package/src/components/admin/admin-sessions.tsx +174 -10
  462. package/src/components/admin/admin-user-avatar-control.tsx +130 -0
  463. package/src/components/admin/admin-user-detail-audits-tab.tsx +7 -4
  464. package/src/components/admin/admin-user-detail-sessions-tab.tsx +7 -4
  465. package/src/components/admin/admin-user-detail.tsx +25 -3
  466. package/src/components/admin/admin-users-roles-picker.tsx +4 -0
  467. package/src/components/admin/admin-users.tsx +6 -3
  468. package/src/components/admin/analytics/AdvancedSection.tsx +162 -0
  469. package/src/components/admin/analytics/AnalyticsChart.tsx +69 -0
  470. package/src/components/admin/analytics/AnalyticsChartBars.tsx +86 -0
  471. package/src/components/admin/analytics/AnalyticsChartDonut.tsx +78 -0
  472. package/src/components/admin/analytics/AnalyticsChartHeader.tsx +135 -0
  473. package/src/components/admin/analytics/AnalyticsChartHeat.tsx +57 -0
  474. package/src/components/admin/analytics/AnalyticsChartLegend.tsx +26 -0
  475. package/src/components/admin/analytics/AnalyticsChartLine.tsx +37 -0
  476. package/src/components/admin/analytics/AnalyticsChartRank.tsx +43 -0
  477. package/src/components/admin/analytics/AnalyticsChartTicks.tsx +38 -0
  478. package/src/components/admin/analytics/AnalyticsEmpty.tsx +37 -0
  479. package/src/components/admin/analytics/ClauseLabel.tsx +26 -0
  480. package/src/components/admin/analytics/CompareNote.tsx +50 -0
  481. package/src/components/admin/analytics/DatasetSelect.tsx +79 -0
  482. package/src/components/admin/analytics/FilterEditor.tsx +173 -0
  483. package/src/components/admin/analytics/FilterValuePicker.tsx +154 -0
  484. package/src/components/admin/analytics/GroupByChips.tsx +82 -0
  485. package/src/components/admin/analytics/MeasureChips.tsx +53 -0
  486. package/src/components/admin/analytics/QueryPanel.tsx +113 -0
  487. package/src/components/admin/analytics/RangeControl.tsx +42 -0
  488. package/src/components/admin/analytics/RequestDialog.tsx +91 -0
  489. package/src/components/admin/analytics/ResultsPane.tsx +224 -0
  490. package/src/components/admin/analytics/ResultsTable.tsx +176 -0
  491. package/src/components/admin/analytics/RunFooter.tsx +90 -0
  492. package/src/components/admin/analytics/SamplingBadge.tsx +46 -0
  493. package/src/components/admin/analytics/ToggleChip.tsx +57 -0
  494. package/src/components/admin/analytics/TotalsCards.tsx +79 -0
  495. package/src/components/admin/analytics/TruncationBanner.tsx +60 -0
  496. package/src/components/admin/analytics/analyticsModel.spec.ts +266 -0
  497. package/src/components/admin/analytics/analyticsModel.ts +263 -0
  498. package/src/components/admin/analytics/analyticsTypes.ts +139 -0
  499. package/src/components/admin/analytics/chartModel.spec.ts +240 -0
  500. package/src/components/admin/analytics/chartModel.ts +427 -0
  501. package/src/components/admin/analytics/useAnalyticsQuery.ts +401 -0
  502. package/src/components/admin/analytics/useDismissable.ts +48 -0
  503. package/src/components/admin/analytics/useFilterValues.ts +113 -0
  504. package/src/components/admin/analytics/usePanelWidth.ts +85 -0
  505. package/src/components/admin/analytics/useShapeLabels.ts +73 -0
  506. package/src/components/admin/parameter-history-item.tsx +4 -2
  507. package/src/components/alepha-table/__tests__/alepha-table-actions.browser.spec.tsx +117 -0
  508. package/src/components/alepha-table/__tests__/alepha-table-bulk-menu.browser.spec.tsx +177 -0
  509. package/src/components/alepha-table/__tests__/alepha-table-bulk-visible.browser.spec.tsx +125 -0
  510. package/src/components/alepha-table/__tests__/alepha-table-default-hidden.browser.spec.tsx +108 -0
  511. package/src/components/alepha-table/__tests__/alepha-table-empty-state.browser.spec.tsx +233 -0
  512. package/src/components/alepha-table/__tests__/alepha-table-persist-facets.browser.spec.tsx +177 -0
  513. package/src/components/alepha-table/__tests__/alepha-table-persisted-filters.browser.spec.tsx +182 -0
  514. package/src/components/alepha-table/__tests__/alepha-table-query-seed.browser.spec.tsx +170 -0
  515. package/src/components/alepha-table/__tests__/alepha-table-row-action-checked.browser.spec.tsx +210 -0
  516. package/src/components/alepha-table/__tests__/alepha-table-row-action-group.browser.spec.tsx +202 -0
  517. package/src/components/alepha-table/__tests__/alepha-table-scope.browser.spec.tsx +161 -0
  518. package/src/components/alepha-table/__tests__/alepha-table-share-filters.browser.spec.tsx +309 -0
  519. package/src/components/alepha-table/__tests__/query-filters.spec.ts +212 -0
  520. package/src/components/alepha-table/alepha-table-bulk-menu.tsx +170 -0
  521. package/src/components/alepha-table/alepha-table-filter-dialog.tsx +162 -0
  522. package/src/components/alepha-table/alepha-table-filter-menu.tsx +77 -0
  523. package/src/components/alepha-table/alepha-table.tsx +1375 -230
  524. package/src/components/alepha-table/query-filters.ts +159 -0
  525. package/src/components/app-actions/app-actions.tsx +32 -3
  526. package/src/components/app-shell/__tests__/navigation-progress.browser.spec.tsx +122 -0
  527. package/src/components/app-shell/__tests__/sidebar-nav-accordion.browser.spec.tsx +163 -0
  528. package/src/components/app-shell/__tests__/sidebar-nav-auto-close.browser.spec.tsx +170 -0
  529. package/src/components/app-shell/app-shell.tsx +390 -122
  530. package/src/components/app-shell/navigation-progress.tsx +110 -0
  531. package/src/components/auth/auth-register.tsx +72 -9
  532. package/src/components/auto-form/__tests__/auto-form-fill-groups.browser.spec.tsx +104 -0
  533. package/src/components/auto-form/__tests__/auto-form-settings-card.browser.spec.tsx +1 -1
  534. package/src/components/auto-form/auto-form.tsx +111 -33
  535. package/src/components/button-dark/button-dark.tsx +47 -8
  536. package/src/components/button-inbox/__tests__/button-inbox.browser.spec.tsx +247 -0
  537. package/src/components/button-inbox/button-inbox.tsx +303 -0
  538. package/src/components/button-inbox/inbox-unread-atom.ts +27 -0
  539. package/src/components/button-theme/button-theme.tsx +16 -29
  540. package/src/components/button-user/__tests__/button-user-avatar.browser.spec.tsx +88 -0
  541. package/src/components/button-user/button-user.tsx +24 -1
  542. package/src/components/control/__tests__/control-date-range.browser.spec.tsx +177 -0
  543. package/src/components/control/control.tsx +182 -26
  544. package/src/components/control-date/control-date.tsx +170 -36
  545. package/src/components/control-date/date-only.ts +26 -0
  546. package/src/components/control-date-range/control-date-range.tsx +250 -0
  547. package/src/components/control-select/__tests__/control-select-clear-label.browser.spec.tsx +129 -15
  548. package/src/components/control-select/__tests__/control-select-deselect.browser.spec.tsx +27 -6
  549. package/src/components/control-select/__tests__/control-select-multi.browser.spec.tsx +399 -0
  550. package/src/components/control-select/__tests__/control-select-searchable.browser.spec.tsx +5 -1
  551. package/src/components/control-select/__tests__/control-select-size-minimal.browser.spec.tsx +195 -0
  552. package/src/components/control-select/__tests__/control-select-trigger-props.browser.spec.tsx +89 -0
  553. package/src/components/control-select/control-select.tsx +554 -123
  554. package/src/components/control-upload/control-upload.tsx +1 -10
  555. package/src/components/detail/__tests__/detail-layout.browser.spec.tsx +46 -0
  556. package/src/components/detail/detail-aside.tsx +30 -6
  557. package/src/components/detail/detail-layout.tsx +37 -7
  558. package/src/components/markdown-view/SpoilerSpan.tsx +66 -0
  559. package/src/components/markdown-view/__tests__/markdown-view-spoiler.browser.spec.tsx +165 -0
  560. package/src/components/markdown-view/diagram/MermaidFence.tsx +1 -23
  561. package/src/components/markdown-view/diagram/diagramKind.ts +31 -0
  562. package/src/components/markdown-view/diagram/textMetrics.spec.ts +1 -1
  563. package/src/components/markdown-view/diagram/textMetrics.ts +2 -2
  564. package/src/components/markdown-view/markdown-view.css +44 -0
  565. package/src/components/markdown-view/markdown-view.tsx +37 -1
  566. package/src/components/markdown-view/remarkSpoiler.ts +150 -0
  567. package/src/components/permission-matrix/__tests__/permission-matrix.browser.spec.tsx +237 -0
  568. package/src/components/permission-matrix/permission-matrix-group-rows.tsx +240 -0
  569. package/src/components/permission-matrix/permission-matrix.tsx +286 -0
  570. package/src/components/plate-layout/__tests__/plate-layout.browser.spec.tsx +189 -0
  571. package/src/components/plate-layout/plate-layout.tsx +84 -0
  572. package/src/components/plate-layout/plate-tab-bar.tsx +148 -0
  573. package/src/components/time-ago/time-ago.browser.spec.tsx +110 -0
  574. package/src/components/time-ago/time-ago.tsx +80 -0
  575. package/src/components/tree-view/__tests__/tree-model.spec.ts +441 -0
  576. package/src/components/tree-view/__tests__/tree-view-drag.browser.spec.tsx +295 -0
  577. package/src/components/tree-view/__tests__/tree-view-rename.browser.spec.tsx +278 -0
  578. package/src/components/tree-view/__tests__/tree-view-resizer.browser.spec.tsx +112 -0
  579. package/src/components/tree-view/__tests__/tree-view.browser.spec.tsx +260 -0
  580. package/src/components/tree-view/__tests__/use-tree-state.browser.spec.tsx +238 -0
  581. package/src/components/tree-view/tree-model.ts +369 -0
  582. package/src/components/tree-view/tree-view-rename-input.tsx +95 -0
  583. package/src/components/tree-view/tree-view-resizer.tsx +83 -0
  584. package/src/components/tree-view/tree-view-row.tsx +414 -0
  585. package/src/components/tree-view/tree-view.tsx +300 -0
  586. package/src/components/tree-view/use-tree-state.ts +184 -0
  587. package/src/components/ui/button.tsx +80 -2
  588. package/src/components/ui/dropdown-menu.tsx +1 -1
  589. package/src/components/ui/select.tsx +7 -0
  590. package/src/components/ui/table.tsx +1 -1
  591. package/src/components/ui/tooltip.tsx +1 -1
  592. package/src/components/use-dialog/use-dialog.tsx +10 -0
  593. package/src/lib/i18n-fr.ts +155 -58
  594. package/src/lib/utils.ts +32 -4
  595. package/src/styles.css +300 -21
  596. package/dist/components/admin/admin-analytics-query-panel.d.ts +0 -16
  597. package/dist/components/admin/admin-analytics-query-panel.d.ts.map +0 -1
  598. package/dist/components/admin/admin-analytics-query-panel.js +0 -117
  599. package/dist/components/admin/admin-analytics-query-panel.js.map +0 -1
  600. package/dist/components/admin/admin-analytics-results.d.ts +0 -15
  601. package/dist/components/admin/admin-analytics-results.d.ts.map +0 -1
  602. package/dist/components/admin/admin-analytics-results.js +0 -56
  603. package/dist/components/admin/admin-analytics-results.js.map +0 -1
  604. package/dist/components/admin/admin-workflows-execution-sheet.d.ts +0 -11
  605. package/dist/components/admin/admin-workflows-execution-sheet.d.ts.map +0 -1
  606. package/dist/components/admin/admin-workflows-execution-sheet.js +0 -190
  607. package/dist/components/admin/admin-workflows-execution-sheet.js.map +0 -1
  608. package/dist/components/admin/admin-workflows-executions-panel.d.ts +0 -9
  609. package/dist/components/admin/admin-workflows-executions-panel.d.ts.map +0 -1
  610. package/dist/components/admin/admin-workflows-executions-panel.js +0 -121
  611. package/dist/components/admin/admin-workflows-executions-panel.js.map +0 -1
  612. package/dist/components/admin/admin-workflows-status-badge.d.ts +0 -12
  613. package/dist/components/admin/admin-workflows-status-badge.d.ts.map +0 -1
  614. package/dist/components/admin/admin-workflows-status-badge.js +0 -30
  615. package/dist/components/admin/admin-workflows-status-badge.js.map +0 -1
  616. package/dist/components/admin/admin-workflows-status-labels.d.ts +0 -19
  617. package/dist/components/admin/admin-workflows-status-labels.d.ts.map +0 -1
  618. package/dist/components/admin/admin-workflows-status-labels.js +0 -48
  619. package/dist/components/admin/admin-workflows-status-labels.js.map +0 -1
  620. package/dist/components/admin/admin-workflows.d.ts +0 -4
  621. package/dist/components/admin/admin-workflows.d.ts.map +0 -1
  622. package/dist/components/admin/admin-workflows.js +0 -145
  623. package/dist/components/admin/admin-workflows.js.map +0 -1
  624. package/src/components/admin/admin-analytics-query-panel.tsx +0 -150
  625. package/src/components/admin/admin-analytics-results.tsx +0 -95
  626. package/src/components/admin/admin-workflows-execution-sheet.tsx +0 -285
  627. package/src/components/admin/admin-workflows-executions-panel.tsx +0 -169
  628. package/src/components/admin/admin-workflows-status-badge.tsx +0 -41
  629. package/src/components/admin/admin-workflows-status-labels.ts +0 -51
  630. package/src/components/admin/admin-workflows.tsx +0 -209
@@ -1 +1 @@
1
- {"version":3,"file":"alepha-table.js","names":[],"sources":["../../../src/components/alepha-table/alepha-table.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { Checkbox } from \"@alepha/ui/components/ui/checkbox\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Pagination,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious,\n} from \"@alepha/ui/components/ui/pagination\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@alepha/ui/components/ui/select\";\nimport { Skeleton } from \"@alepha/ui/components/ui/skeleton\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"@alepha/ui/components/ui/table\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { type Page, type ZObject, z } from \"alepha\";\nimport { ClientOnly, useAlepha } from \"alepha/react\";\nimport { type FormModel, useForm } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport {\n ArrowDown,\n ArrowUp,\n ChevronsUpDown,\n Columns3,\n FunnelX,\n Inbox,\n MoreVertical,\n RefreshCw,\n X,\n} from \"lucide-react\";\nimport {\n type ComponentType,\n type ReactNode,\n type SVGProps,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport { paginateLocal } from \"./paginate-local.ts\";\nimport { useTableSelection } from \"./use-table-selection.ts\";\n\ntype IconType = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport interface ColumnDef<T> {\n label: string;\n cell: (item: T) => ReactNode;\n sortable?: boolean;\n /**\n * Sort key sent to the API. Defaults to the column key.\n */\n sortKey?: string;\n /**\n * Static-data mode only: the value this column sorts on, for a column\n * whose sort key is not a plain property of the row (a derived total, a\n * joined label). Defaults to `item[sortKey]`.\n *\n * Ignored when the table fetches: there the server owns the ordering.\n */\n sortValue?: (item: T) => unknown;\n /**\n * When true, the column starts hidden. The user can still toggle it\n * on via the built-in column picker. Pass `hideColumnPicker` on the\n * table to forbid toggling entirely.\n */\n defaultHidden?: boolean;\n className?: string;\n align?: \"left\" | \"right\" | \"center\";\n}\n\n/**\n * Context passed to every row-action `onClick`. `refresh()` re-fires the\n * current fetch with the current filters/sort — call it after a mutation\n * so the table reflects the new state without a manual reload.\n *\n * ⚠️ In static-data mode there is no fetch to re-fire, so `refresh()` only\n * returns to page 0: the rows belong to the caller, and a mutation has to\n * be written back into the array passed as `data`. The table renders the\n * new array on the same render, without it.\n */\nexport interface RowActionContext {\n refresh: () => void;\n}\n\nexport interface RowAction<T> {\n label: string;\n icon?: IconType;\n onClick: (item: T, ctx: RowActionContext) => void | Promise<void>;\n destructive?: boolean;\n disabled?: (item: T) => boolean;\n}\n\n/**\n * Context passed to every bulk-action `onClick`. `clearSelection()`\n * empties the checkbox set; `refresh()` re-fires the current fetch.\n */\nexport interface BulkActionContext {\n refresh: () => void;\n clearSelection: () => void;\n}\n\nexport interface BulkAction<T> {\n label: string;\n icon?: IconType;\n onClick: (selected: T[], ctx: BulkActionContext) => void | Promise<void>;\n destructive?: boolean;\n}\n\n/**\n * A standalone toolbar icon-button, rendered in the right-hand icon group\n * next to the column picker and separated from the filter area by a divider.\n * Use for table-scoped actions (e.g. \"Upload\", \"New\") that aren't tied to a\n * row or a selection. The table renders the ghost icon button + tooltip so it\n * matches the built-in column-picker / refresh controls.\n */\nexport interface TableAction {\n icon: IconType;\n label: string;\n onClick: () => void;\n disabled?: boolean;\n}\n\n/**\n * High-level filter slot. AlephaTable creates the `useForm` internally,\n * wraps `render`'s output in a `<form>` element, persists values under\n * `persistenceKey` when set, and refetches on submit (and on every\n * change, debounced, by default).\n *\n * The render function receives the typed form so callers wire inputs\n * with `form.input.<field>` exactly like a hand-rolled `useForm`.\n */\nexport interface AlephaTableFilters {\n schema: ZObject;\n initialValues?: Record<string, any>;\n /**\n * Filter values that outrank the persisted ones on mount.\n *\n * `initialValues` is what the table starts from when the reader has never\n * chosen anything; a persisted choice wins over it, which is the right\n * default for a preference. This is the opposite case: values the caller\n * derived from *how the reader got here* — typically a URL param on a\n * drill-through link — where landing on last week's stored filter instead\n * would ignore the link that was just clicked.\n *\n * Read once, at mount, exactly like `initialValues`. Change the\n * component's `key` to re-seed on a later arrival.\n *\n * **Transient, and by construction.** Persistence is written from\n * `form:change` / `form:submit:success` only, never on mount — so a seed\n * shows in the toolbar and narrows the fetch without overwriting the\n * filter the reader chose for themselves last time. Touch any control and\n * the resulting values (seed included) become the stored choice, which is\n * the right moment for it: that is the reader choosing.\n */\n seedValues?: Record<string, any>;\n render: (form: FormModel<ZObject>) => ReactNode;\n}\n\ninterface SortState {\n field: string;\n direction: \"asc\" | \"desc\";\n}\n\nexport type TableFetcher<T> = (params: {\n page: number;\n size: number;\n sort?: string;\n filters?: Record<string, any>;\n}) => Promise<Page<T>>;\n\n/**\n * Where the rows come from. Exactly one of the two.\n *\n * `data` is not sugar over `fetch`: a fetcher closing over an in-memory\n * array cannot work, because the table holds `fetch` in a ref that is\n * deliberately excluded from its load effect (see `fetchRef`), so the\n * closure goes stale the moment the caller's array changes. Static rows\n * therefore bypass the fetch path entirely and are derived synchronously.\n */\nexport type AlephaTableSource<T> =\n | {\n /**\n * Fetcher invoked with paging + sort + filters. Should return an\n * Alepha `Page<T>`.\n */\n fetch: TableFetcher<T>;\n data?: never;\n filter?: never;\n }\n | {\n /**\n * Rows the caller already holds. The table filters, sorts and pages\n * them in memory and never issues a request.\n *\n * Use it when the array is the page's data rather than the table's —\n * shared with a chart, a count, an aside — so that one array stays\n * the single source of truth. For anything the reader can outgrow,\n * pass `fetch` and let the server page it.\n */\n data: T[];\n /**\n * Static-data mode only: predicate replacing the built-in field\n * matching, which pairs each filter value with the same-named\n * property (strings as a case-insensitive substring, arrays by\n * membership, everything else strictly).\n *\n * Reach for it as soon as a filter is not a field: a `search` box\n * spanning several columns, a range, a joined label. Only ever\n * called with filter values that are actually set.\n */\n filter?: (item: T, filters: Record<string, any>) => boolean;\n fetch?: never;\n };\n\nexport type AlephaTableProps<T> = AlephaTableBaseProps<T> &\n AlephaTableSource<T>;\n\nexport interface AlephaTableBaseProps<T> {\n /**\n * Column definitions, keyed by the property name they read from.\n */\n columns: Record<string, ColumnDef<T>>;\n /**\n * Per-row action menu builder. Return an array of `RowAction` per\n * item. Each `onClick` receives `(item, { refresh })`.\n */\n rowActions?: (item: T) => RowAction<T>[];\n /**\n * Actions applied to selected rows (enables checkbox column). Each\n * `onClick` receives `(items, { refresh, clearSelection })`.\n */\n bulkActions?: BulkAction<T>[];\n /**\n * Page size the table opens on. The reader can change it from the footer;\n * with `persistenceKey` set, their choice is remembered and wins over this.\n */\n defaultSize?: number;\n /**\n * Sizes offered in the footer picker. Defaults to {@link PAGE_SIZES}.\n *\n * Pass `[]` to hide the picker entirely, for a table whose page size is\n * not the reader's business.\n */\n pageSizes?: number[];\n /**\n * Stable row identifier. Defaults to `item.id`.\n *\n * Rows with neither fall back to their position in the current page, which\n * is stable across renders but NOT across sorting or paging - the same row\n * sorted into a different slot becomes a different row as far as React and\n * the selection are concerned. Pass this whenever rows can be selected or\n * hold an inline input and the data has no `id`.\n */\n rowKey?: (item: T) => string;\n /**\n * Click handler invoked when a row is clicked (excluding action\n * buttons).\n */\n onRowClick?: (item: T) => void;\n /**\n * Auto-refresh interval in ms (only when document is visible).\n *\n * Meaningless in static-data mode — there is no request to repeat, and a\n * changed `data` array is already on screen the render it changes.\n */\n pollMs?: number;\n /**\n * External refetch trigger. Bump this value (e.g. from a `useState`\n * counter) after a mutation performed *outside* the table — such as a\n * toolbar upload action — to make the table reload. Row/bulk actions\n * already get `ctx.refresh()`; this is the escape hatch for everything\n * else. Changing it resets to page 0 and refetches; the initial value\n * is ignored (the table fetches on mount regardless).\n *\n * Not needed in static-data mode: a new `data` array is picked up on its\n * own. Bumping this there only resets to page 0.\n */\n refreshSignal?: number | string;\n /**\n * High-level filter form. AlephaTable owns the `useForm`, renders the\n * inputs inside a `<form>` in the toolbar, and refetches on\n * submit/change.\n *\n * Mutually exclusive with `form` (legacy: caller-owned form). When\n * both are passed, `filters` wins.\n */\n filters?: AlephaTableFilters;\n /**\n * When set, filter values, column visibility, and sort state are\n * persisted to `localStorage` under this key. Pick a key that's\n * unique per page and per scope (e.g. `\"admin.users\"`,\n * `\\`lor.board.${campaignId}\\``).\n */\n persistenceKey?: string;\n /**\n * Hide the built-in column visibility dropdown in the toolbar.\n */\n hideColumnPicker?: boolean;\n /**\n * Hide the built-in actions menu (Refresh, Reset filters).\n */\n hideActionsMenu?: boolean;\n /**\n * Extra slot rendered to the right of the filter inputs in the\n * toolbar — typically a \"New\" / \"Create\" button.\n *\n * Vertically centred in the bar (`self-center`) regardless of its own\n * height, so it no longer has to match the filter inputs. It used to inherit\n * the bar's `items-end`, which meant anything shorter than h-9 hung off the\n * bottom edge and a labelled filter dragged the button down with it.\n */\n toolbar?: ReactNode;\n /**\n * Standalone icon-button actions rendered in the toolbar's right-hand\n * icon group, before the column picker and separated from the filter\n * area by a divider. The table renders the ghost icon button + tooltip\n * itself, so callers only supply the icon/label/handler.\n */\n actions?: TableAction[];\n /**\n * Extra classes applied to the outer wrapper.\n */\n className?: string;\n /**\n * Message shown when the page is empty. Defaults to \"No results\".\n */\n emptyMessage?: string;\n /**\n * Rich empty-state node rendered when the page is empty — e.g. an icon +\n * message + optional call-to-action. Overrides `emptyMessage` when set.\n */\n empty?: ReactNode;\n /**\n * Free-form content rendered above the toolbar (e.g. a page title).\n */\n header?: ReactNode;\n /**\n * Initial sort state. When `persistenceKey` is set, a persisted sort\n * takes precedence over this.\n */\n defaultSort?: SortState | null;\n /**\n * Called whenever the user toggles a column header. Receives the new\n * sort state (`null` when sort is cleared). Use this if you need a\n * persistence layer beyond `persistenceKey` (e.g. URL state).\n */\n onSortChange?: (sort: SortState | null) => void;\n /**\n * Legacy: caller-owned filter form. Prefer `filters` (which has\n * AlephaTable own the form). When `filters` is set, this prop is\n * ignored.\n */\n form?: FormModel<ZObject>;\n /**\n * When true (default when `filters` is set), the table refetches on\n * every `form:change` event, debounced by 250ms. Set to `false` to\n * require an explicit submit.\n */\n autoApplyFilters?: boolean;\n}\n\nconst EMPTY_FILTERS_SCHEMA = z.object({}) as ZObject;\n\n/**\n * Synchronous localStorage read. Returns undefined on miss or error.\n */\nconst readPersisted = <V,>(key: string, suffix: string): V | undefined => {\n if (typeof window === \"undefined\") return undefined;\n try {\n const raw = window.localStorage.getItem(`${key}.${suffix}`);\n return raw == null ? undefined : (JSON.parse(raw) as V);\n } catch {\n return undefined;\n }\n};\n\n/**\n * Synchronous localStorage write. Empty objects/null delete the key.\n */\nconst writePersisted = (key: string, suffix: string, value: unknown): void => {\n if (typeof window === \"undefined\") return;\n const fullKey = `${key}.${suffix}`;\n try {\n const isEmptyObject =\n value !== null &&\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n Object.keys(value as object).length === 0;\n const isEmptyArray = Array.isArray(value) && value.length === 0;\n if (\n value === undefined ||\n value === null ||\n isEmptyObject ||\n isEmptyArray\n ) {\n window.localStorage.removeItem(fullKey);\n return;\n }\n window.localStorage.setItem(fullKey, JSON.stringify(value));\n } catch {\n // localStorage may be unavailable (private mode, quota). Skip.\n }\n};\n\n/**\n * Page sizes the footer offers.\n *\n * No \"all\". Pagination here is server-side, so an unbounded fetch is a query\n * whose cost grows with the biggest table in the product and is paid by the\n * reader who can least afford it. 100 covers \"let me scan the lot\" without\n * that.\n */\nexport const PAGE_SIZES = [10, 20, 50, 100];\n\nexport function AlephaTable<T>(props: AlephaTableProps<T>) {\n // State, not a constant. It was `props.defaultSize ?? 20` read once, so a\n // reader had no way to see more rows than the call site had decided for\n // them. Already in `load`'s dependency array, so changing it refetches.\n const [size, setSize] = useState<number>(\n () =>\n (props.persistenceKey\n ? readPersisted<number>(props.persistenceKey, \"size\")\n : undefined) ??\n props.defaultSize ??\n 20,\n );\n const pageSizes = props.pageSizes ?? PAGE_SIZES;\n const alepha = useAlepha();\n const { tr } = useI18n();\n\n // -- Filter form (internal when `filters` is set, else legacy `form`) -----\n\n // Read persisted filter values synchronously so they reach useForm's\n // first invocation. Reading inside an effect would be too late —\n // useForm captures `initialValues` only once via useMemo.\n const persistedFilterValues = useMemo(() => {\n if (!props.persistenceKey || !props.filters) return undefined;\n return readPersisted<Record<string, any>>(props.persistenceKey, \"filters\");\n }, [props.persistenceKey, props.filters]);\n\n const mergedFilterInitialValues = useMemo<Record<string, any>>(\n () => ({\n ...props.filters?.initialValues,\n ...persistedFilterValues,\n // Last, so it beats the stored choice — see `seedValues`. A drill-through\n // link that lost to a filter the reader set last week would be a link\n // that does nothing.\n ...props.filters?.seedValues,\n }),\n [],\n );\n\n // Always call useForm to keep hook order stable. When the caller\n // doesn't pass `filters`, the internal form has an empty schema and\n // is simply unused.\n const internalForm = useForm({\n schema: props.filters?.schema ?? EMPTY_FILTERS_SCHEMA,\n initialValues: mergedFilterInitialValues,\n handler: async () => {\n // No-op — the table subscribes to `form:submit:success` to refetch.\n },\n });\n\n const form = props.filters ? internalForm : props.form;\n\n // -- Paging / sort / data --------------------------------------------------\n\n const [page, setPage] = useState(0);\n\n /**\n * Change the page size and go back to the first page.\n *\n * The reset is the whole point: raising the size while on page 5 can put\n * the reader past the last page, which renders an empty table with no\n * visible cause. Persisted so the choice survives a reload, alongside the\n * filters, sort and columns this table already remembers.\n */\n const changeSize = (next: number) => {\n setSize(next);\n setPage(0);\n if (props.persistenceKey) {\n writePersisted(props.persistenceKey, \"size\", next);\n }\n };\n const [sort, setSort] = useState<SortState | null>(() => {\n if (props.persistenceKey) {\n const persisted = readPersisted<SortState>(props.persistenceKey, \"sort\");\n if (persisted) return persisted;\n }\n return props.defaultSort ?? null;\n });\n const [fetchedData, setData] = useState<T[]>([]);\n const [fetchedMeta, setMeta] = useState<Page<T>[\"page\"] | null>(null);\n const [loading, setLoading] = useState(false);\n const [refreshKey, setRefreshKey] = useState(0);\n const [isRefreshing, setIsRefreshing] = useState(false);\n\n // Alepha's pagination parser reads \"field\" as asc and \"-field\" as desc.\n // Multiple comma-separated entries are multi-column sort, so we must\n // NOT use `field,direction` syntax — that would treat \"asc\"/\"desc\" as\n // a second column name and 500 on the backend.\n const sortParam = sort\n ? sort.direction === \"desc\"\n ? `-${sort.field}`\n : sort.field\n : undefined;\n\n // Hold the latest `fetch` in a ref so it is NOT a dependency of `load`.\n // Callers pass `fetch` inline (a new function every render), and a fetcher\n // that writes a store atom the caller also subscribes to would otherwise\n // self-trigger: load → atom write → caller re-render → new `fetch` → new\n // `load` → effect re-runs → infinite loop. The ref keeps the newest closure\n // available while `load` only re-runs on actual inputs (page/size/sort/…).\n const fetchRef = useRef(props.fetch);\n fetchRef.current = props.fetch;\n\n const load = useCallback(async () => {\n // Static mode owns no request. Bail before touching `loading` too, so a\n // table fed an array never flashes the skeleton over rows it already has.\n const fetcher = fetchRef.current;\n if (!fetcher) return;\n setLoading(true);\n try {\n const res = await fetcher({\n page,\n size,\n sort: sortParam,\n filters: form?.currentValues,\n });\n setData(res.content);\n setMeta(res.page);\n } catch (error) {\n // Surface read failures through the same `react:action:error` channel\n // that useAction/useQuery use, so a mounted <ActionErrorToaster /> toasts\n // them. Keep the previous rows on screen rather than blanking the table.\n void alepha.events.emit(\"react:action:error\", {\n type: \"custom\",\n id: \"alepha-table:load\",\n error: error as Error,\n });\n } finally {\n setLoading(false);\n }\n }, [page, size, sortParam, refreshKey, form, alepha]);\n\n useEffect(() => {\n void load();\n }, [load]);\n\n /**\n * Static mode's equivalent of `load` — derived, not stored.\n *\n * Deliberately NOT routed through `load`: putting `props.data` in that\n * effect's dependencies reproduces the exact loop `fetchRef` exists to\n * prevent (load → setData → re-render → new inline array → new load).\n * Computed synchronously there is no state to go stale, an inline\n * `data={rows.filter(…)}` is safe, and a changed array is on screen in\n * the same render.\n */\n const staticPage = useMemo(() => {\n if (!props.data) return null;\n const sortValues: Record<string, (item: T) => unknown> = {};\n for (const [key, column] of Object.entries(props.columns)) {\n if (column.sortValue) {\n sortValues[column.sortKey ?? key] = column.sortValue;\n }\n }\n return paginateLocal(props.data, {\n page,\n size,\n sort: sortParam,\n sortValues,\n filters: form?.currentValues,\n filter: props.filter,\n });\n // `refreshKey` is what the filter-form subscriptions bump, so it is how\n // a filter change reaches this memo — `form.currentValues` is mutated in\n // place and its identity never changes.\n }, [\n props.data,\n props.columns,\n props.filter,\n page,\n size,\n sortParam,\n refreshKey,\n form,\n ]);\n\n const data = staticPage ? staticPage.content : fetchedData;\n const meta = staticPage ? staticPage.page : fetchedMeta;\n\n /**\n * Rows vanish under the reader in static mode: the caller detaches one and\n * the page they are on stops existing. Nothing fetches, so nothing else\n * would notice — the table would sit on an empty page with no visible\n * cause. Fetch mode has the same hole, but there the server round-trip\n * needed to see it makes this the wrong place to close it.\n */\n if (staticPage) {\n const totalPages = staticPage.page.totalPages ?? 0;\n if (page > 0 && page > totalPages - 1) {\n // Guarded on `page`, so it settles in one pass and does not need an\n // effect: the clamp lands before the rows render against a page that no\n // longer exists.\n setPage(Math.max(0, totalPages - 1));\n }\n }\n\n // Persist sort to localStorage on every change.\n useEffect(() => {\n if (!props.persistenceKey) return;\n writePersisted(props.persistenceKey, \"sort\", sort);\n }, [props.persistenceKey, sort]);\n\n // -- Refresh + reset wiring -----------------------------------------------\n\n const refresh = useCallback(() => {\n setPage(0);\n setRefreshKey((k) => k + 1);\n }, []);\n\n const handleRefreshClick = useCallback(() => {\n setIsRefreshing(true);\n refresh();\n 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:change` for deleted keys, so inputs stay\n // visually populated and subscribers don't refetch. Explicit set\n // keeps everyone in sync.\n const keys = Object.keys(z.schema.shape(props.filters.schema));\n for (const key of keys) {\n const input = (form.input as Record<string, { set?: (v: any) => void }>)[\n key\n ];\n input?.set?.(undefined);\n }\n }, [form, props.filters]);\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 AlephaTable 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:change\", (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 (!props.persistenceKey || !form || !props.filters) return;\n const persist = () => {\n const clean: Record<string, any> = {};\n const values = form.currentValues ?? {};\n for (const [k, v] of Object.entries(values)) {\n if (v === undefined || v === null || v === \"\") continue;\n if (Array.isArray(v) && v.length === 0) continue;\n clean[k] = v;\n }\n writePersisted(props.persistenceKey!, \"filters\", clean);\n };\n const unsubs = [\n alepha.events.on(\"form:change\", (event) => {\n if (event.id !== form.id) return;\n persist();\n }),\n alepha.events.on(\"form:submit:success\", (event) => {\n if (event.id !== form.id) return;\n persist();\n }),\n ];\n return () => {\n for (const u of unsubs) u();\n };\n }, [alepha, form, props.filters, props.persistenceKey]);\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 // -- Row identity ----------------------------------------------------------\n\n /**\n * A row's key, in order of preference: the caller's `rowKey`, the row's own\n * `id`, then where the row sits.\n *\n * The last one used to be `Math.random()`, which is not an identity at all.\n * Every render produced a new key, so React saw every id-less row as a new\n * row and remounted it: focus in an inline input was lost the moment\n * anything else re-rendered, and the list re-animated on every keystroke.\n * Selection was broken by the same thing - `selection.has(rowKey(item))`\n * compared against a key generated one render earlier, so it never matched.\n */\n const rowKeys = useMemo(\n () =>\n data.map((item, index) => {\n if (props.rowKey) return props.rowKey(item);\n const id = (item as { id?: unknown })?.id;\n // Coercion at a boundary: the value is a form/route/chart primitive\n // whose declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string\n return id != null ? String(id) : `page-${page}-row-${index}`;\n }),\n [data, page, props.rowKey],\n );\n\n /**\n * Selection asks for a key by item, not by index. Every item it can ask\n * about is one of `data`'s, so a lookup keyed on identity covers it without\n * an O(n) scan per call.\n */\n const rowKeyByItem = useMemo(() => {\n const map = new Map<T, string>();\n data.forEach((item, index) => map.set(item, rowKeys[index]));\n return map;\n }, [data, rowKeys]);\n\n const rowKey = useCallback(\n (item: T): string => rowKeyByItem.get(item) ?? \"\",\n [rowKeyByItem],\n );\n\n // -- Selection -------------------------------------------------------------\n\n const {\n selection,\n selectedItems,\n allSelected,\n someSelected,\n toggleRow,\n toggleAll,\n clearSelection,\n } = useTableSelection(data, rowKey);\n\n // -- Sort ------------------------------------------------------------------\n\n const toggleSort = (col: string, def: ColumnDef<T>) => {\n if (!def.sortable) return;\n const field = def.sortKey ?? col;\n setSort((s) => {\n const next: SortState | null =\n !s || s.field !== field\n ? { field, direction: \"asc\" }\n : s.direction === \"asc\"\n ? { field, direction: \"desc\" }\n : null;\n props.onSortChange?.(next);\n return next;\n });\n };\n\n // -- Column visibility -----------------------------------------------------\n\n const allColumnKeys = useMemo(\n () => Object.keys(props.columns),\n [props.columns],\n );\n\n const [visibleColumns, setVisibleColumns] = useState<Set<string>>(() => {\n if (props.persistenceKey) {\n const persisted = readPersisted<string[]>(\n props.persistenceKey,\n \"columns\",\n );\n if (persisted) {\n return new Set(persisted.filter((k) => k in props.columns));\n }\n }\n return new Set(\n allColumnKeys.filter((k) => !props.columns[k].defaultHidden),\n );\n });\n\n useEffect(() => {\n if (!props.persistenceKey) return;\n writePersisted(props.persistenceKey, \"columns\", [...visibleColumns]);\n }, [props.persistenceKey, visibleColumns]);\n\n const toggleColumn = (id: string) => {\n setVisibleColumns((prev) => {\n const next = new Set(prev);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n });\n };\n\n // -- Render ---------------------------------------------------------------\n\n const cols = Object.entries(props.columns) as Array<[string, ColumnDef<T>]>;\n const visibleCols = cols.filter(([key]) => visibleColumns.has(key));\n const hasCheckbox = Boolean(props.bulkActions?.length);\n const hasRowActions = Boolean(props.rowActions);\n\n const rowCtx: RowActionContext = useMemo(() => ({ refresh }), [refresh]);\n const bulkCtx: BulkActionContext = useMemo(\n () => ({ refresh, clearSelection }),\n [refresh, clearSelection],\n );\n\n const hasActiveFilters = useMemo(() => {\n if (!props.filters || !form) return false;\n const values = form.currentValues ?? {};\n for (const v of Object.values(values)) {\n if (v === undefined || v === null || v === \"\") continue;\n if (Array.isArray(v) && v.length === 0) continue;\n return true;\n }\n return false;\n }, [props.filters, form, refreshKey]);\n\n const showToolbar =\n Boolean(props.filters) ||\n Boolean(props.toolbar) ||\n Boolean(props.actions?.length) ||\n !props.hideColumnPicker ||\n !props.hideActionsMenu;\n const showColumnPicker = !props.hideColumnPicker && allColumnKeys.length > 0;\n const showActionsMenu = !props.hideActionsMenu;\n\n return (\n <ClientOnly>\n <div className={cn(\"flex flex-col gap-2\", props.className)}>\n {props.header && (\n <div className=\"flex items-center gap-2\">\n <div className=\"min-w-0 flex-1\">{props.header}</div>\n </div>\n )}\n\n {showToolbar && (\n // `bg-muted`, paired with the pagination footer below: the filter bar\n // and the footer are the table's chrome and bracket it top and\n // bottom, so they sit one step off the page while the table itself\n // (header included) stays on it. They were `bg-card` — pure white in\n // light, the same colour as the page, so neither had an edge.\n //\n // The controls need an explicit fill because of that. shadcn ships\n // inputs and select triggers `bg-transparent` in light and only fills\n // them in dark (`dark:bg-input/30`) — the light case assumes a white\n // page, where transparent already reads as a white field. On this bar\n // it does not: they would take the muted grey and the border alone\n // would have to say \"input\". Scoped here rather than to the\n // primitives, which `yarn w @alepha/ui sync` overwrites.\n //\n // `bg-background` suits both modes: white against the muted bar in\n // light, near-black in dark, so the control reads as a well sunk\n // into the chrome either way. The `dark:` copy is not redundant —\n // the primitives ship `dark:bg-input/30` at (0,2,0), a translucent\n // WHITE wash that leaves the field lighter than the bar. Only the\n // dark-scoped rule (0,3,0) outranks it, and without it the two\n // controls disagreed: the trigger went dark, the input stayed light.\n <div className=\"bg-muted [&_:is(input,[role=combobox])]:bg-background dark:[&_:is(input,[role=combobox])]:bg-background flex flex-wrap items-end gap-2 rounded-md rounded-b-none border p-2\">\n {props.filters && form ? (\n <form\n {...form.props}\n className=\"flex flex-1 flex-wrap items-end gap-2\"\n >\n {props.filters.render(form)}\n </form>\n ) : (\n <div className=\"flex flex-1\" />\n )}\n {/*\n `self-center`, against the bar's own `items-end`.\n\n The bar bottom-aligns because a filter Control may carry a label,\n and a row of labelled controls has to line up on the inputs rather\n than on the top of the tallest label. Everything to the right of\n the filters is a bare control with no label of its own, so\n inheriting that baseline pinned it to the bottom of whatever the\n filter area happened to measure — a \"New\" button sitting low\n against a labelled select, moving as soon as a filter gained or\n lost its label.\n\n Centring only the trailing content keeps the filter row's own\n alignment intact and makes the actions independent of it.\n */}\n {props.toolbar && (\n <div className=\"self-center\">{props.toolbar}</div>\n )}\n <TooltipProvider>\n <div className=\"flex items-center gap-1 self-center\">\n {props.actions?.length ? (\n <>\n {props.actions.map((action) => {\n const ActionIcon = action.icon;\n return (\n <Tooltip key={action.label}>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-9 w-9 p-0\"\n aria-label={action.label}\n disabled={action.disabled}\n onClick={action.onClick}\n />\n }\n >\n <ActionIcon className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{action.label}</TooltipContent>\n </Tooltip>\n );\n })}\n {(showColumnPicker || showActionsMenu) && (\n <span\n aria-hidden\n className=\"bg-border mx-1 h-5 w-px self-center\"\n />\n )}\n </>\n ) : null}\n {showColumnPicker && (\n <ColumnPicker<T>\n columns={props.columns}\n visible={visibleColumns}\n onToggle={toggleColumn}\n />\n )}\n {showActionsMenu && props.filters && (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-9 w-9 p-0\"\n aria-label={tr(\"alephaTable.resetFilters\", {\n default: \"Reset filters\",\n })}\n disabled={!hasActiveFilters}\n onClick={resetFilters}\n />\n }\n >\n <FunnelX className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>\n {tr(\"alephaTable.resetFilters\", {\n default: \"Reset filters\",\n })}\n </TooltipContent>\n </Tooltip>\n )}\n {showActionsMenu && (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-9 w-9 p-0\"\n aria-label={tr(\"alephaTable.refresh\", {\n default: \"Refresh\",\n })}\n disabled={isRefreshing}\n onClick={handleRefreshClick}\n />\n }\n >\n <RefreshCw\n className={cn(\"size-4\", isRefreshing && \"animate-spin\")}\n />\n </TooltipTrigger>\n <TooltipContent>\n {tr(\"alephaTable.refresh\", { default: \"Refresh\" })}\n </TooltipContent>\n </Tooltip>\n )}\n </div>\n </TooltipProvider>\n </div>\n )}\n\n {hasCheckbox &&\n selection.size > 0 && (\n // Linear-style floating action pill: fixed at the bottom-center of\n // the viewport, dark surface that stays readable in both themes\n // because the colors are hard-coded (theme-relative `bg-foreground`\n // inverts awkwardly against a white container in dark mode).\n <div className=\"pointer-events-none fixed inset-x-0 bottom-6 z-40 flex justify-center\">\n <div className=\"animate-in fade-in-0 slide-in-from-bottom-2 pointer-events-auto flex items-center gap-2 rounded-full bg-zinc-900 px-3 py-1.5 text-zinc-100 shadow-lg ring-1 ring-white/10 duration-150\">\n <span className=\"pl-2 text-sm\">\n {tr(\"alephaTable.selected\", {\n default: `${selection.size} selected`,\n args: [String(selection.size)],\n })}\n </span>\n <span className=\"mx-1 h-4 w-px bg-white/20\" />\n {props.bulkActions?.map((action) => {\n const ActionIcon = action.icon;\n return (\n <Button\n key={action.label}\n size=\"sm\"\n className={\n action.destructive\n ? \"h-8 bg-red-600 text-white hover:bg-red-500\"\n : \"h-8 bg-transparent text-zinc-100 hover:bg-white/10 hover:text-zinc-100\"\n }\n onClick={() => action.onClick(selectedItems, bulkCtx)}\n >\n {ActionIcon && <ActionIcon className=\"size-4\" />}\n {action.label}\n </Button>\n );\n })}\n <span className=\"mx-1 h-4 w-px bg-white/20\" />\n <Button\n size=\"icon\"\n className=\"size-8 bg-transparent text-zinc-300 hover:bg-white/10 hover:text-zinc-100\"\n onClick={clearSelection}\n aria-label={tr(\"alephaTable.clearSelection\", {\n default: \"Clear selection\",\n })}\n >\n <X className=\"size-4\" />\n </Button>\n </div>\n </div>\n )}\n\n {/*\n The toolbar, the rows and the footer are one panel: each facing edge\n is flattened and its border dropped so no double line appears, and\n `-mt-2` cancels the wrapper's `gap-2`. The footer half is\n unconditional because the page row below already renders\n unconditionally — gating it on `meta` would pop the bar in and flip\n this bottom border on every load, since `meta` starts null and only\n fills after the fetch.\n */}\n <div\n className={cn(\n \"flex min-h-0 flex-1 flex-col overflow-auto rounded-md border\",\n showToolbar && \"-mt-2 rounded-t-none border-t-0\",\n \"rounded-b-none border-b-0\",\n )}\n >\n <Table>\n {/* `bg-muted`, fully opaque, NOT the base header's `bg-muted/50`:\n this header is sticky, so anything translucent lets the rows\n scroll visibly through the column labels. Same tint, no\n transparency. */}\n <TableHeader className=\"bg-muted sticky top-0 z-10 shadow-[inset_0_-1px_0_0_var(--border)]\">\n <TableRow>\n {hasCheckbox && (\n <TableHead className=\"w-10\">\n <Checkbox\n checked={allSelected}\n indeterminate={!allSelected && someSelected}\n onCheckedChange={() => toggleAll()}\n aria-label={tr(\"alephaTable.selectAll\", {\n default: \"Select all rows\",\n })}\n />\n </TableHead>\n )}\n {visibleCols.map(([key, def]) => {\n const sorted =\n def.sortable && sort?.field === (def.sortKey ?? key);\n return (\n <TableHead\n key={key}\n className={cn(\n def.className,\n def.align === \"right\" && \"text-right\",\n def.align === \"center\" && \"text-center\",\n )}\n aria-sort={\n sorted\n ? sort?.direction === \"asc\"\n ? \"ascending\"\n : \"descending\"\n : undefined\n }\n >\n {def.sortable ? (\n // A real button so keyboard and assistive-tech\n // users can sort — a th onClick is mouse-only.\n <button\n type=\"button\"\n onClick={() => toggleSort(key, def)}\n className=\"group/sort hover:text-foreground inline-flex cursor-pointer items-center gap-1 select-none\"\n >\n {def.label}\n {/* A sortable column says so at rest. The arrow\n used to appear only once a column WAS sorted,\n so an unsorted sortable header and a dead one\n were indistinguishable until you happened to\n hover one. The neutral glyph is dimmed so a row\n of them does not shout, and brightens under the\n cursor.\n\n Lucide, not the `↑` / `↓` characters this\n replaced: those render in the text font at text\n weight and sat visibly apart from every other\n icon in the table.\n\n `aria-hidden` throughout: `aria-sort` on the\n `th` already states this to assistive tech. */}\n {sorted ? (\n sort?.direction === \"asc\" ? (\n <ArrowUp className=\"size-3.5\" aria-hidden />\n ) : (\n <ArrowDown className=\"size-3.5\" aria-hidden />\n )\n ) : (\n <ChevronsUpDown\n className=\"size-3.5 opacity-40 transition-opacity group-hover/sort:opacity-100\"\n aria-hidden\n />\n )}\n </button>\n ) : (\n <span className=\"inline-flex items-center gap-1\">\n {def.label}\n </span>\n )}\n </TableHead>\n );\n })}\n {hasRowActions && <TableHead className=\"w-10\" />}\n </TableRow>\n </TableHeader>\n <TableBody>\n {loading && data.length === 0 ? (\n <SkeletonRows\n rows={5}\n cols={\n visibleCols.length +\n (hasCheckbox ? 1 : 0) +\n (hasRowActions ? 1 : 0)\n }\n />\n ) : data.length === 0 ? (\n <TableRow className=\"hover:bg-transparent\">\n <TableCell\n colSpan={\n visibleCols.length +\n (hasCheckbox ? 1 : 0) +\n (hasRowActions ? 1 : 0)\n }\n className=\"p-0\"\n >\n {props.empty ?? (\n <div className=\"text-muted-foreground flex flex-col items-center justify-center gap-2 py-12 text-center\">\n <Inbox className=\"size-8 opacity-40\" />\n <p className=\"text-sm\">\n {props.emptyMessage ??\n String(\n tr(\"alephaTable.empty\", {\n default: \"No results.\",\n }),\n )}\n </p>\n </div>\n )}\n </TableCell>\n </TableRow>\n ) : (\n data.map((item, rowIndex) => {\n const key = rowKeys[rowIndex];\n const isSelected = selection.has(key);\n return (\n <TableRow\n key={key}\n onClick={() => props.onRowClick?.(item)}\n className={cn(\n props.onRowClick && \"cursor-pointer\",\n isSelected && \"bg-muted/30\",\n )}\n >\n {hasCheckbox && (\n <TableCell onClick={(e) => e.stopPropagation()}>\n <Checkbox\n checked={isSelected}\n onCheckedChange={() => toggleRow(item)}\n aria-label={tr(\"alephaTable.selectRow\", {\n default: \"Select row\",\n })}\n />\n </TableCell>\n )}\n {visibleCols.map(([key, def]) => (\n <TableCell\n key={key}\n className={cn(\n def.className,\n def.align === \"right\" && \"text-right\",\n def.align === \"center\" && \"text-center\",\n )}\n >\n {def.cell(item)}\n </TableCell>\n ))}\n {hasRowActions && (\n <TableCell\n className=\"text-right\"\n onClick={(e) => e.stopPropagation()}\n >\n <RowActionsMenu\n actions={props.rowActions!(item)}\n item={item}\n ctx={rowCtx}\n />\n </TableCell>\n )}\n </TableRow>\n );\n })\n )}\n </TableBody>\n </Table>\n </div>\n\n {/* `bg-muted`, paired with the filter bar above — see the note there. */}\n <div className=\"bg-muted -mt-2 flex flex-wrap items-center justify-between gap-2 rounded-md rounded-t-none border p-2\">\n {/* The size picker sits with the count, not in the toolbar above:\n this line already answers \"how many, where am I\", while the\n toolbar answers \"which rows\". Mixing the two turns the toolbar\n into a junk drawer. */}\n <div className=\"flex items-center gap-2\">\n {pageSizes.length > 0 && (\n // The same Select the filter bar's controls are built on, not\n // a bare `<select>`: a native control renders in the OS widget\n // set and sat visibly apart from every other trigger in this\n // table. `Control` itself is form-bound, so the picker uses the\n // component underneath it.\n <Select\n value={String(size)}\n onValueChange={(value) => changeSize(Number(value))}\n >\n <SelectTrigger\n // `bg-background`, because this bar is `bg-muted` and the\n // trigger is `bg-transparent` by default: on a plain form\n // surface that blending is right, on a tinted bar it made\n // the picker read as part of the bar while the pagination\n // buttons beside it sat on their own plane. Overridden here\n // rather than in `SelectTrigger`, which every form still\n // wants transparent.\n className=\"bg-background h-7 w-auto gap-1 text-xs\"\n aria-label={String(\n tr(\"table.pageSize\", { default: \"Rows per page\" }),\n )}\n >\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {pageSizes.map((n) => (\n <SelectItem key={n} value={String(n)}>\n {n}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n <p className=\"text-muted-foreground text-xs\">\n {meta\n ? `Page ${meta.number + 1}${meta.totalPages ? ` of ${meta.totalPages}` : \"\"} · ${meta.numberOfElements} of ${meta.totalElements ?? \"?\"}`\n : \"—\"}\n </p>\n </div>\n {meta && meta.totalPages && meta.totalPages > 1 ? (\n <Pagination className=\"mx-0 w-auto justify-end\">\n <PaginationContent>\n <PaginationItem>\n <PaginationPrevious\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n if (!meta.isFirst) setPage((p) => Math.max(0, p - 1));\n }}\n aria-disabled={meta.isFirst}\n className={cn(\n meta.isFirst && \"pointer-events-none opacity-50\",\n )}\n />\n </PaginationItem>\n {computePageItems(meta.number + 1, meta.totalPages).map(\n (item, idx) =>\n item === \"ellipsis\" ? (\n <PaginationItem key={`e-${idx}`}>\n <PaginationEllipsis />\n </PaginationItem>\n ) : (\n <PaginationItem key={item}>\n <PaginationLink\n href=\"#\"\n isActive={item === meta.number + 1}\n onClick={(e) => {\n e.preventDefault();\n setPage(item - 1);\n }}\n >\n {item}\n </PaginationLink>\n </PaginationItem>\n ),\n )}\n <PaginationItem>\n <PaginationNext\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n if (!meta.isLast) setPage((p) => p + 1);\n }}\n aria-disabled={meta.isLast}\n className={cn(\n meta.isLast && \"pointer-events-none opacity-50\",\n )}\n />\n </PaginationItem>\n </PaginationContent>\n </Pagination>\n ) : null}\n </div>\n </div>\n </ClientOnly>\n );\n}\n\nfunction ColumnPicker<T>(props: {\n columns: Record<string, ColumnDef<T>>;\n visible: Set<string>;\n onToggle: (key: string) => void;\n}) {\n const { tr } = useI18n();\n const entries = Object.entries(props.columns);\n const label = tr(\"alephaTable.toggleColumns\", {\n default: \"Toggle columns\",\n });\n return (\n <DropdownMenu>\n {/*\n * The trigger is composed rather than plain: it has to be the dropdown\n * trigger AND the tooltip trigger at once, or this button is the only\n * icon-only control in the toolbar with no tooltip (reset-filters and\n * refresh sit right next to it and both have one).\n *\n * `TooltipTrigger` wraps the rendered element rather than the other way\n * round, matching how `sidebar.tsx` composes the same two primitives.\n * `TooltipProvider` is supplied by the toolbar that renders this.\n */}\n <Tooltip>\n <DropdownMenuTrigger\n render={\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-9 w-9 p-0\"\n aria-label={label}\n />\n }\n />\n }\n >\n <Columns3 className=\"size-4\" />\n </DropdownMenuTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuGroup>\n <DropdownMenuLabel>\n {tr(\"alephaTable.columns\", { default: \"Columns\" })}\n </DropdownMenuLabel>\n <DropdownMenuSeparator />\n {entries.map(([key, def]) => (\n <DropdownMenuCheckboxItem\n key={key}\n checked={props.visible.has(key)}\n closeOnClick={false}\n onCheckedChange={() => props.onToggle(key)}\n >\n {def.label}\n </DropdownMenuCheckboxItem>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/**\n * Build the visible page-number sequence with ellipses. Always shows\n * first + last, ±1 around current. Gaps collapse into a single ellipsis.\n * `current` and `total` are 1-indexed.\n */\nfunction computePageItems(\n current: number,\n total: number,\n): Array<number | \"ellipsis\"> {\n if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);\n const items: Array<number | \"ellipsis\"> = [1];\n if (current > 3) items.push(\"ellipsis\");\n const start = Math.max(2, current - 1);\n const end = Math.min(total - 1, current + 1);\n for (let i = start; i <= end; i++) items.push(i);\n if (current < total - 2) items.push(\"ellipsis\");\n items.push(total);\n return items;\n}\n\nconst SkeletonRows = (props: { rows: number; cols: number }) => {\n return (\n <>\n {Array.from({ length: props.rows }).map((_, i) => (\n <TableRow key={i}>\n {Array.from({ length: props.cols }).map((_, j) => (\n <TableCell key={j}>\n <Skeleton className=\"h-4 w-full\" />\n </TableCell>\n ))}\n </TableRow>\n ))}\n </>\n );\n};\n\nfunction RowActionsMenu<T>(props: {\n actions: RowAction<T>[];\n item: T;\n ctx: RowActionContext;\n}) {\n const { tr } = useI18n();\n if (props.actions.length === 0) return null;\n return (\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={tr(\"alephaTable.openRowActions\", {\n default: \"Open row actions\",\n })}\n />\n }\n >\n <MoreVertical className=\"size-4\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {props.actions.map((action, idx) => {\n const Icon = action.icon;\n const disabled = action.disabled?.(props.item);\n const sep =\n idx > 0 &&\n action.destructive &&\n !props.actions[idx - 1].destructive;\n return (\n <span key={action.label}>\n {sep && <DropdownMenuSeparator />}\n <DropdownMenuItem\n disabled={disabled}\n onClick={() => action.onClick(props.item, props.ctx)}\n className={action.destructive ? \"text-destructive\" : undefined}\n >\n {Icon && <Icon className=\"mr-2 size-4\" />}\n {action.label}\n </DropdownMenuItem>\n </span>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4YA,MAAM,uBAAuB,EAAE,OAAO,CAAC,CAAC;;;;AAKxC,MAAM,iBAAqB,KAAa,WAAkC;CACxE,IAAI,OAAO,WAAW,aAAa,OAAO,KAAA;CAC1C,IAAI;EACF,MAAM,MAAM,OAAO,aAAa,QAAQ,GAAG,IAAI,GAAG,QAAQ;EAC1D,OAAO,OAAO,OAAO,KAAA,IAAa,KAAK,MAAM,GAAG;CAClD,QAAQ;EACN;CACF;AACF;;;;AAKA,MAAM,kBAAkB,KAAa,QAAgB,UAAyB;CAC5E,IAAI,OAAO,WAAW,aAAa;CACnC,MAAM,UAAU,GAAG,IAAI,GAAG;CAC1B,IAAI;EACF,MAAM,gBACJ,UAAU,QACV,OAAO,UAAU,YACjB,CAAC,MAAM,QAAQ,KAAK,KACpB,OAAO,KAAK,KAAe,CAAC,CAAC,WAAW;EAC1C,MAAM,eAAe,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW;EAC9D,IACE,UAAU,KAAA,KACV,UAAU,QACV,iBACA,cACA;GACA,OAAO,aAAa,WAAW,OAAO;GACtC;EACF;EACA,OAAO,aAAa,QAAQ,SAAS,KAAK,UAAU,KAAK,CAAC;CAC5D,QAAQ,CAER;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Z,EACO,GANK,CAML,CACX,EACD,CAAA;AAEN;AAEA,SAAS,eAAkB,OAIxB;CACD,MAAM,EAAE,OAAO,QAAQ;CACvB,IAAI,MAAM,QAAQ,WAAW,GAAG,OAAO;CACvC,OACE,qBAAC,cAAD,EAAA,UAAA,CACE,oBAAC,qBAAD;EACE,QACE,oBAAC,QAAD;GACE,SAAQ;GACR,MAAK;GACL,cAAY,GAAG,8BAA8B,EAC3C,SAAS,mBACX,CAAC;EACF,CAAA;EAGH,UAAA,oBAAC,cAAD,EAAc,WAAU,SAAU,CAAA;CACf,CAAA,GACrB,oBAAC,qBAAD;EAAqB,OAAM;EACxB,UAAA,MAAM,QAAQ,KAAK,QAAQ,QAAQ;GAClC,MAAM,OAAO,OAAO;GACpB,MAAM,WAAW,OAAO,WAAW,MAAM,IAAI;GAK7C,OACE,qBAAC,QAAD,EAAA,UAAA,CAJA,MAAM,KACN,OAAO,eACP,CAAC,MAAM,QAAQ,MAAM,EAAE,CAAC,eAGd,oBAAC,uBAAD,CAAwB,CAAA,GAChC,qBAAC,kBAAD;IACY;IACV,eAAe,OAAO,QAAQ,MAAM,MAAM,MAAM,GAAG;IACnD,WAAW,OAAO,cAAc,qBAAqB,KAAA;IAHvD,UAAA,CAKG,QAAQ,oBAAC,MAAD,EAAM,WAAU,cAAe,CAAA,GACvC,OAAO,KACQ;GACd,CAAA,CAAA,EAAA,GAVK,OAAO,KAUZ;EAEV,CAAC;CACkB,CAAA,CACT,EAAA,CAAA;AAElB"}
1
+ {"version":3,"file":"alepha-table.js","names":["Table"],"sources":["../../../src/components/alepha-table/alepha-table.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Control } from \"@alepha/ui/components/control/control\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { Checkbox } from \"@alepha/ui/components/ui/checkbox\";\nimport {\n ContextMenu,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuSeparator,\n ContextMenuTrigger,\n} from \"@alepha/ui/components/ui/context-menu\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Pagination,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious,\n} from \"@alepha/ui/components/ui/pagination\";\nimport { Skeleton } from \"@alepha/ui/components/ui/skeleton\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"@alepha/ui/components/ui/table\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { type Page, type ZObject, z } from \"alepha\";\nimport { ClientOnly, useAlepha } from \"alepha/react\";\nimport { type FormModel, useForm } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport {\n ArrowDown,\n ArrowUp,\n ChevronsUpDown,\n ArrowDownAZ,\n ArrowUpAZ,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n ChevronUp,\n Columns3,\n EyeOff,\n FunnelX,\n GripVertical,\n Inbox,\n SearchX,\n MoreVertical,\n RefreshCw,\n X,\n} from \"lucide-react\";\nimport {\n type ComponentType,\n type ReactNode,\n type SVGProps,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport { useIsMobile } from \"../../hooks/use-mobile.ts\";\nimport { AlephaTableBulkMenu } from \"./alepha-table-bulk-menu.tsx\";\nimport { AlephaTableFilterDialog } from \"./alepha-table-filter-dialog.tsx\";\nimport { AlephaTableFilterMenu } from \"./alepha-table-filter-menu.tsx\";\nimport { paginateLocal } from \"./paginate-local.ts\";\nimport {\n cleanFilterValues,\n queryToFilters,\n shareFiltersUrl,\n} from \"./query-filters.ts\";\nimport { useTableSelection } from \"./use-table-selection.ts\";\n\ntype IconType = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport interface ColumnDef<T> {\n label: string;\n cell: (item: T) => ReactNode;\n sortable?: boolean;\n /**\n * Sort key sent to the API. Defaults to the column key.\n */\n sortKey?: string;\n /**\n * Static-data mode only: the value this column sorts on, for a column\n * whose sort key is not a plain property of the row (a derived total, a\n * joined label). Defaults to `item[sortKey]`.\n *\n * Ignored when the table fetches: there the server owns the ordering.\n */\n sortValue?: (item: T) => unknown;\n /**\n * When true, the column starts hidden. The user can still toggle it\n * on via the built-in column picker. Pass `hideColumnPicker` on the\n * table to forbid toggling entirely.\n */\n defaultHidden?: boolean;\n className?: string;\n align?: \"left\" | \"right\" | \"center\";\n}\n\n/**\n * Context passed to every row-action `onClick`. `refresh()` re-fires the\n * current fetch with the current filters/sort — call it after a mutation\n * so the table reflects the new state without a manual reload.\n *\n * ⚠️ In static-data mode there is no fetch to re-fire, so `refresh()` only\n * returns to page 0: the rows belong to the caller, and a mutation has to\n * be written back into the array passed as `data`. The table renders the\n * new array on the same render, without it.\n */\nexport interface RowActionContext {\n refresh: () => void;\n}\n\nexport interface RowAction<T> {\n label: string;\n icon?: IconType;\n onClick: (item: T, ctx: RowActionContext) => void | Promise<void>;\n destructive?: boolean;\n disabled?: (item: T) => boolean;\n /**\n * Whether this entry is the row's current value, for a group that picks\n * one of several - which release the row ships in, which area it sits in.\n * Declaring it renders the entry as a checkbox item, so the check mark and\n * the `aria-checked` both come from the primitive rather than from a\n * marker glued into the label.\n *\n * ⚠️ Omitting it is not the same as returning false. An entry with no\n * `checked` stays an ordinary `menuitem`; one that returns false is a\n * `menuitemcheckbox` that happens to be unchecked, which is what a query\n * by role has to account for.\n *\n * `destructive` is ignored on a checked entry: nothing that picks a value\n * out of a list is also a delete.\n */\n checked?: (item: T) => boolean;\n}\n\n/**\n * A row action that is a submenu: a label, an icon, and the actions it\n * holds. One level only: a group's children are actions, never groups.\n *\n * The discriminant is the presence of `children`, so every caller that\n * returns a plain `RowAction[]` keeps compiling unchanged.\n *\n * ⚠️ A group with no children renders nothing, and does not count towards\n * the row menu existing at all: a row whose only entry is an empty group\n * gets no three-dots trigger. That lets a caller build `children`\n * conditionally without checking whether anything survived.\n */\nexport interface RowActionGroup<T> {\n label: string;\n icon?: IconType;\n children: RowAction<T>[];\n}\n\nexport type RowActionEntry<T> = RowAction<T> | RowActionGroup<T>;\n\n/**\n * Context passed to every bulk-action `onClick`. `clearSelection()`\n * empties the checkbox set; `refresh()` re-fires the current fetch.\n */\nexport interface BulkActionContext {\n refresh: () => void;\n clearSelection: () => void;\n}\n\n/**\n * A bulk action that is a button: one click, one handler over the selection.\n */\nexport interface BulkAction<T> {\n label: string;\n icon?: IconType;\n onClick: (selected: T[], ctx: BulkActionContext) => void | Promise<void>;\n destructive?: boolean;\n /**\n * Whether the action is offered for this selection. Absent means always.\n *\n * Hide, not disable: a disabled button in a three-item pill is a question\n * (\"why can't I?\"), a missing one is an answer. An action that applies to\n * some of the rows and not others should stay visible and act on the rows\n * it fits, which is what its `onClick` receives the whole selection for.\n */\n visible?: (selected: T[]) => boolean;\n}\n\n/**\n * A bulk action that is a MENU: the trigger opens a list of choices, each of\n * them a {@link BulkAction} in its own right, and picking one runs its\n * `onClick` over the selection. For \"add to release\", \"move to column\",\n * \"assign to\": one button cannot carry N targets, and the targets are not\n * known when the table renders.\n *\n * `items` produces the choices, synchronously or not. It is called on open\n * intent (pointer enter, focus, or the menu opening, so keyboard and touch\n * are covered) and its result is kept for the life of the selection: a new\n * selection asks again. Both the pending and the failed state are shown\n * inside the menu, and an empty result renders a disabled \"nothing to pick\"\n * row rather than an empty popup.\n *\n * A union with {@link BulkAction} rather than an optional `items` on it, so\n * a button cannot also be a menu and a menu cannot also be clicked: the two\n * are told apart by `items` being present.\n *\n * ```tsx\n * const addToRelease: BulkMenuAction<Quest> = {\n * label: \"Add to release\",\n * icon: Flag,\n * // The closure carries the target, so no item type needs a payload.\n * items: () =>\n * releases\n * .filter((release) => !release.releasedAt)\n * .map((release) => ({\n * label: release.tag,\n * onClick: async (quests, ctx) => {\n * await Promise.all(\n * quests.map((quest) => attach(quest.id, release.id)),\n * );\n * ctx.refresh();\n * ctx.clearSelection();\n * },\n * })),\n * };\n *\n * <AlephaTable<Quest> bulkActions={[shelve, addToRelease]} />\n * ```\n */\nexport interface BulkMenuAction<T> {\n label: string;\n icon?: IconType;\n /**\n * Same contract as {@link BulkAction.visible}.\n */\n visible?: (selected: T[]) => boolean;\n /**\n * The choices, produced when the menu is about to open. An async producer\n * shows a loading row until it settles; a rejection shows a failure row and\n * the next open tries again.\n */\n items: () => BulkAction<T>[] | Promise<BulkAction<T>[]>;\n}\n\n/**\n * A standalone toolbar action, rendered in the right-hand icon group next to\n * the column picker and separated from the filter area by a divider. Use for\n * table-scoped actions (e.g. \"Upload\", \"New\") that aren't tied to a row or a\n * selection.\n *\n * Two forms, chosen per action:\n *\n * - **secondary** (the default): a ghost icon button with the label as its\n * tooltip, matching the built-in column-picker / refresh controls.\n * - **primary** (`primary: true`): a solid `default` button carrying the icon\n * AND the visible label. For the page's one main action, typically its\n * create control: a bare `+` at the same weight as two utility toggles\n * disappears, and the create button is what a reader looks for first.\n * No tooltip, since the label is already on screen. Below the `sm`\n * breakpoint the label collapses to the icon and the button keeps its\n * primary colour, so it still reads as the action.\n */\nexport interface TableAction {\n icon: IconType;\n label: string;\n onClick: () => void;\n disabled?: boolean;\n /**\n * Render as the table's primary action: a solid labelled button rather\n * than a ghost icon. One per table is the intent; a toolbar with two\n * primary buttons has no primary action.\n */\n primary?: boolean;\n}\n\n/**\n * One of the table's two empty states: an icon, a title and a description,\n * centred in the body.\n *\n * Which one is shown is decided by the table, not the caller: a page that\n * came back empty with no filter set means \"there is nothing here\", and the\n * same page with a filter set means \"nothing matched\". Those ask the reader\n * for opposite things - create something, or widen the filter - so one\n * sentence for both sends half of them the wrong way. Override the wording\n * per mode, never the choice between them.\n */\nexport interface AlephaTableEmptyState {\n icon?: IconType;\n title?: ReactNode;\n description?: ReactNode;\n /**\n * A call to action under the description, typically one `<Button>`.\n *\n * A slot rather than a `{ label, onClick }` pair, because the button an\n * empty state wants is rarely just a button: it opens a dialog, it is a\n * `<Link>`, it is disabled while a permission is loading. The table owns the\n * layout and centring and nothing else.\n *\n * Most useful on {@link AlephaTableBaseProps.emptyState}, where \"there is\n * nothing here\" has an obvious answer - create the first one. The no-match\n * side takes it too, for a \"Clear filters\" button.\n */\n action?: ReactNode;\n}\n\n/**\n * Which of the preferences {@link AlephaTableBaseProps.persistenceKey} stores\n * are actually stored.\n *\n * Every facet defaults to ON, so a table that sets a key and nothing else\n * behaves exactly as it always has. Only name the ones you want OFF.\n *\n * The facets are genuinely different kinds of preference, which is why one\n * switch over all three was the wrong shape. Column layout and sort are what\n * a reader arranged and expects to find again; a filter is what they were\n * looking for last time, and restoring it opens the page narrowed by a\n * question they have already answered - the hazard\n * {@link AlephaTableFilters.seedValues} names as \"landing on last week's\n * stored filter\".\n *\n * ⚠️ The footer's page SIZE is not one of these and is always stored with the\n * key. It is a fourth thing, nothing has asked to separate it, and leaving it\n * alone is what keeps this addition invisible to every existing caller.\n *\n * ⚠️ Read where `persistenceKey` is, so treat it as static per call site.\n * Turning a facet off does not delete what it previously wrote: the stored\n * value is simply never read again, because writing on mount is the bug the\n * column and filter effects exist to avoid.\n */\nexport interface AlephaTablePersistedFacets {\n /**\n * The filter form's values. Off means the table opens unfiltered every\n * time, whatever the reader last typed.\n */\n filters?: boolean;\n /**\n * Which columns are visible, and in what order.\n */\n columns?: boolean;\n /**\n * The sorted column and its direction.\n */\n sort?: boolean;\n}\n\n/**\n * High-level filter slot. AlephaTable creates the `useForm` internally,\n * wraps `render`'s output in a `<form>` element, persists values under\n * `persistenceKey` when set, and refetches on submit (and on every\n * change, debounced, by default).\n *\n * The render function receives the typed form so callers wire inputs\n * with `form.input.<field>` exactly like a hand-rolled `useForm`.\n */\nexport interface AlephaTableFilters {\n schema: ZObject;\n initialValues?: Record<string, any>;\n /**\n * Filter values that outrank the persisted ones on mount.\n *\n * `initialValues` is what the table starts from when the reader has never\n * chosen anything; a persisted choice wins over it, which is the right\n * default for a preference. This is the opposite case: values the caller\n * derived from *how the reader got here* — typically a URL param on a\n * drill-through link — where landing on last week's stored filter instead\n * would ignore the link that was just clicked.\n *\n * Read once, at mount, exactly like `initialValues`. Change the\n * component's `key` to re-seed on a later arrival.\n *\n * **Transient, and by construction.** Persistence is written from\n * `form:change` / `form:submit:success` only, never on mount — so a seed\n * shows in the toolbar and narrows the fetch without overwriting the\n * filter the reader chose for themselves last time. Touch any control and\n * the resulting values (seed included) become the stored choice, which is\n * the right moment for it: that is the reader choosing.\n */\n seedValues?: Record<string, any>;\n /**\n * Fill the filters from the URL query on arrival.\n *\n * `true` reads every param whose name matches a key of `schema`; an array\n * narrows that to the keys it names. Params the schema does not declare are\n * ignored, so the page keeps owning its own (`?tab=`, a locale, a tracking\n * param). Multi-value filters are comma-joined: `?status=new,triaged`.\n *\n * Read once, at mount, and landed in the same slot as {@link seedValues} —\n * above the reader's stored filters, below an explicit `seedValues` the\n * caller passes for a case of its own.\n *\n * ⚠️ **One-directional, and it has to stay that way.** The URL seeds the\n * filters; the filters NEVER write back. Lore's `?view=kanban` was removed\n * for exactly this (#156): an effect that restored a missing param keyed on\n * the router state, which is a global store, so the render on the way *out*\n * of the page saw the next route's query and bounced the reader straight\n * back. A page cannot tell \"nobody has chosen yet\" from \"we are leaving\"\n * while the state lives in the URL. The toolbar's Share item is the write\n * side, and it writes to the clipboard on a click, never to the address bar\n * on a keystroke.\n *\n * Off by default. A page's query params are not its table's filters until\n * the page says so.\n */\n fromQuery?: boolean | readonly string[];\n render: (form: FormModel<ZObject>) => ReactNode;\n}\n\ninterface SortState {\n field: string;\n direction: \"asc\" | \"desc\";\n}\n\nexport type TableFetcher<T> = (params: {\n page: number;\n size: number;\n sort?: string;\n filters?: Record<string, any>;\n}) => Promise<Page<T>>;\n\n/**\n * Where the rows come from. Exactly one of the two.\n *\n * `data` is not sugar over `fetch`: a fetcher closing over an in-memory\n * array cannot work, because the table holds `fetch` in a ref that is\n * deliberately excluded from its load effect (see `fetchRef`), so the\n * closure goes stale the moment the caller's array changes. Static rows\n * therefore bypass the fetch path entirely and are derived synchronously.\n */\nexport type AlephaTableSource<T> =\n | {\n /**\n * Fetcher invoked with paging + sort + filters. Should return an\n * Alepha `Page<T>`.\n */\n fetch: TableFetcher<T>;\n data?: never;\n filter?: never;\n }\n | {\n /**\n * Rows the caller already holds. The table filters, sorts and pages\n * them in memory and never issues a request.\n *\n * Use it when the array is the page's data rather than the table's —\n * shared with a chart, a count, an aside — so that one array stays\n * the single source of truth. For anything the reader can outgrow,\n * pass `fetch` and let the server page it.\n */\n data: T[];\n /**\n * Static-data mode only: predicate replacing the built-in field\n * matching, which pairs each filter value with the same-named\n * property (strings as a case-insensitive substring, arrays by\n * membership, everything else strictly).\n *\n * Reach for it as soon as a filter is not a field: a `search` box\n * spanning several columns, a range, a joined label. Only ever\n * called with filter values that are actually set.\n */\n filter?: (item: T, filters: Record<string, any>) => boolean;\n fetch?: never;\n };\n\nexport type AlephaTableProps<T> = AlephaTableBaseProps<T> &\n AlephaTableSource<T>;\n\n/**\n * ⚠️ **A page-level action goes INSIDE the table, not above it.**\n *\n * AlephaTable owns a toolbar, and that toolbar is the page's action bar. A\n * \"New\" button, a picker, an import, an export all belong in it. Putting one\n * in a `CardHeader` above the table produces two stacked bars saying one\n * thing - which is exactly what the epic page's Quests tab looked like until\n * feedback #2006, a hand-rolled header holding a title and an \"Attach Quest\"\n * button, sitting directly on top of a toolbar holding the column picker and\n * refresh.\n *\n * The rule is written here rather than only on the props because this is\n * where a reader - human or agent - looks first, and the drift comes from\n * not knowing the slot exists rather than from choosing against it.\n *\n * Three slots, and which one is a question about the control, not the action:\n *\n * - `actions` - a button that does something on click. Rendered in the\n * right-hand icon group beside the column picker: a ghost icon with a\n * tooltip from its own `label`, or, with `primary: true`, a solid button\n * showing the label. The page's create action is the `primary` one.\n * - `toolbar` - anything else: a labelled button, a popover trigger, a\n * segmented control, a group of them. Rendered to the right of the filter\n * inputs and vertically centred, so it does not have to match their height.\n * - `bulkActions` - operates on the checkbox selection, and only appears\n * while something is selected. A button, or a menu of them resolved on\n * demand (`BulkMenuAction`, for \"add to release\" and its kind).\n *\n * ```tsx\n * <AlephaTable<Quest>\n * data={quests}\n * columns={columns}\n * // A popover trigger: `toolbar`, because it is not an icon button.\n * toolbar={<QuestPicker onAttach={attach} />}\n * // Buttons that act on click: `actions`. The create control is `primary`.\n * actions={[\n * { icon: Plus, label: \"New quest\", primary: true, onClick: create },\n * { icon: Download, label: \"Export\", onClick: exportAll },\n * ]}\n * />\n * ```\n *\n * The exception is a control that LEAVES the page - a back link, a tab bar,\n * breadcrumbs. Those are navigation, not actions on this table, and belong\n * where the page's other navigation is.\n */\n\nexport interface AlephaTableBaseProps<T> {\n /**\n * Column definitions, keyed by the property name they read from.\n */\n columns: Record<string, ColumnDef<T>>;\n /**\n * Per-row action menu builder. Return an array of `RowAction` per\n * item. Each `onClick` receives `(item, { refresh })`.\n *\n * An entry may also be a {@link RowActionGroup}: a label, an icon and\n * the actions it holds, rendered as a submenu one level deep.\n */\n rowActions?: (item: T) => RowActionEntry<T>[];\n /**\n * Actions applied to selected rows (enables checkbox column). A\n * {@link BulkAction} is a button whose `onClick` receives\n * `(items, { refresh, clearSelection })`; a {@link BulkMenuAction} is a\n * button that opens a menu of such actions, produced on demand.\n */\n bulkActions?: Array<BulkAction<T> | BulkMenuAction<T>>;\n /**\n * Page size the table opens on. The reader can change it from the footer;\n * with `persistenceKey` set, their choice is remembered and wins over this.\n */\n defaultSize?: number;\n /**\n * Sizes offered in the footer picker. Defaults to {@link PAGE_SIZES}.\n *\n * Pass `[]` to hide the picker entirely, for a table whose page size is\n * not the reader's business.\n */\n pageSizes?: number[];\n /**\n * Stable row identifier. Defaults to `item.id`.\n *\n * Rows with neither fall back to their position in the current page, which\n * is stable across renders but NOT across sorting or paging - the same row\n * sorted into a different slot becomes a different row as far as React and\n * the selection are concerned. Pass this whenever rows can be selected or\n * hold an inline input and the data has no `id`.\n */\n rowKey?: (item: T) => string;\n /**\n * Click handler invoked when a row is clicked (excluding action\n * buttons).\n */\n onRowClick?: (item: T) => void;\n /**\n * Auto-refresh interval in ms (only when document is visible).\n *\n * Meaningless in static-data mode — there is no request to repeat, and a\n * changed `data` array is already on screen the render it changes.\n */\n pollMs?: number;\n /**\n * External refetch trigger. Bump this value (e.g. from a `useState`\n * counter) after a mutation performed *outside* the table — such as a\n * toolbar upload action — to make the table reload. Row/bulk actions\n * already get `ctx.refresh()`; this is the escape hatch for everything\n * else. Changing it resets to page 0 and refetches; the initial value\n * is ignored (the table fetches on mount regardless).\n *\n * Not needed in static-data mode: a new `data` array is picked up on its\n * own. Bumping this there only resets to page 0.\n */\n refreshSignal?: number | string;\n /**\n * High-level filter form. AlephaTable owns the `useForm`, renders the\n * inputs inside a `<form>` in the toolbar, and refetches on\n * submit/change.\n *\n * Mutually exclusive with `form` (legacy: caller-owned form). When\n * both are passed, `filters` wins.\n */\n filters?: AlephaTableFilters;\n /**\n * When set, filter values, column visibility, and sort state are\n * persisted to `localStorage` under this key. Pick a key that's\n * unique per page and per scope (e.g. `\"admin.users\"`,\n * `\\`lor.board.${campaignId}\\``).\n *\n * Narrow what it stores with {@link persist}.\n */\n persistenceKey?: string;\n /**\n * Which facets {@link persistenceKey} stores. All three by default, so this\n * is only ever worth passing to turn one OFF.\n *\n * The case it exists for: a list whose column layout is worth remembering\n * and whose filters are not. Lore's Apps page had to give up persistence\n * entirely to avoid opening narrowed by last week's search, because the\n * three were one switch.\n *\n * Ignored without a `persistenceKey`, which stores nothing either way.\n */\n persist?: AlephaTablePersistedFacets;\n /**\n * Hide the built-in column visibility dropdown in the toolbar.\n */\n hideColumnPicker?: boolean;\n /**\n * Hide the built-in actions menu (Refresh, Reset filters).\n */\n hideActionsMenu?: boolean;\n /**\n * Extra slot rendered to the right of the filter inputs in the\n * toolbar — typically a \"New\" / \"Create\" button, or any page-level action\n * that is not a bare icon button (see the note on `AlephaTableProps`: it\n * belongs here rather than in a header above the table).\n *\n * Vertically centred in the bar (`self-center`) regardless of its own\n * height, so it no longer has to match the filter inputs. It used to inherit\n * the bar's `items-end`, which meant anything shorter than h-9 hung off the\n * bottom edge and a labelled filter dragged the button down with it.\n */\n toolbar?: ReactNode;\n /**\n * Standalone actions rendered in the toolbar's right-hand icon group,\n * before the column picker and separated from the filter area by a\n * divider. The table renders the button itself, so callers only supply\n * the icon/label/handler: a ghost icon with a tooltip by default, or a\n * solid labelled button when the action is marked `primary`.\n */\n actions?: TableAction[];\n /**\n * Extra classes applied to the outer wrapper.\n */\n className?: string;\n /**\n * Title shown in both empty states, replacing their defaults.\n *\n * Kept as the one-line escape hatch it has always been, so it also\n * suppresses the default description: a caller who wrote the whole message\n * in here does not want \"Nothing here yet.\" underneath it. For a title AND\n * a description, or for wording that differs between the two states, use\n * {@link emptyState} and {@link noMatchState}.\n */\n emptyMessage?: string;\n /**\n * The empty state shown when the page came back empty and NO filter is set.\n * Defaults to an inbox icon, \"No items\" and \"Nothing here yet.\".\n */\n emptyState?: AlephaTableEmptyState;\n /**\n * The empty state shown when the page came back empty and at least one\n * filter IS set. Defaults to a struck-through search icon, \"No match\" and\n * \"Try adjusting or clearing the filters.\".\n *\n * Only reachable when `filters` is set: with no filter form there is\n * nothing to be filtered by, so an empty page can only mean {@link\n * emptyState}.\n */\n noMatchState?: AlephaTableEmptyState;\n /**\n * Rich empty-state node rendered when the page is empty — e.g. an icon +\n * message + optional call-to-action. Replaces the whole thing, both states\n * included, so it outranks every prop above.\n *\n * ⚠️ **Only for a table with no {@link filters}.** Replacing both states\n * with one node makes the table structurally incapable of telling them\n * apart, whatever the node says: a filter that matched nothing renders the\n * \"there is nothing here\" message, with the filter that produced it still\n * sitting in the toolbar above. Lore's Apps page shipped exactly that and\n * offered to create the first app to a reader who had just searched for\n * one (feedback #P2160); its Releases page had the same defect, unreported\n * only because nobody had filtered it to zero.\n *\n * With `filters` set, reach for {@link emptyState} and {@link noMatchState}\n * instead. They take the same three pieces - `icon`, `title`,\n * `description` - plus an `action` slot for the button, and the table keeps\n * the choice between the two, which is the part a caller cannot get right\n * from the outside.\n *\n * Not type-enforced: the combination is a live one downstream, so the rule\n * is stated here rather than made uncompilable.\n */\n empty?: ReactNode;\n /**\n * Free-form content rendered above the toolbar (e.g. a page title).\n */\n header?: ReactNode;\n /**\n * Initial sort state. When `persistenceKey` is set, a persisted sort\n * takes precedence over this.\n */\n defaultSort?: SortState | null;\n /**\n * Called whenever the user toggles a column header. Receives the new\n * sort state (`null` when sort is cleared). Use this if you need a\n * persistence layer beyond `persistenceKey` (e.g. URL state).\n */\n onSortChange?: (sort: SortState | null) => void;\n /**\n * Legacy: caller-owned filter form. Prefer `filters` (which has\n * AlephaTable own the form). When `filters` is set, this prop is\n * ignored.\n */\n form?: FormModel<ZObject>;\n /**\n * When true (default when `filters` is set), the table refetches on\n * every `form:change` event, debounced by 250ms. Set to `false` to\n * require an explicit submit.\n */\n autoApplyFilters?: boolean;\n}\n\nconst EMPTY_FILTERS_SCHEMA = z.object({}) as ZObject;\n\n/**\n * Synchronous localStorage read. Returns undefined on miss or error.\n */\nconst readPersisted = <V,>(key: string, suffix: string): V | undefined => {\n if (typeof window === \"undefined\") return undefined;\n try {\n const raw = window.localStorage.getItem(`${key}.${suffix}`);\n return raw == null ? undefined : (JSON.parse(raw) as V);\n } catch {\n return undefined;\n }\n};\n\n/**\n * Reshape persisted filter values that no longer match the schema.\n *\n * Filters are stored in localStorage per `persistenceKey`, so a filter whose\n * shape changes meets values written by the previous shape - on the machine\n * of anyone who has used the page, and only there, which is precisely the\n * class of bug no test environment contains. The first case was the Quests\n * table going from one value per filter to many (quest #1644): a stored\n * `area: \"lore/feedback\"` reaching an array field.\n *\n * A scalar where the schema now wants an array is WRAPPED, not dropped: the\n * reader's filter survives the change, which is what makes the migration\n * invisible. The reverse takes the first element, since there is no honest\n * way to keep the rest. Anything else is left alone - this reconciles a\n * container, not a value, and the form's own validation still has the last\n * word.\n */\nconst reconcilePersistedFilters = (\n schema: ZObject | undefined,\n values: Record<string, any> | undefined,\n): Record<string, any> | undefined => {\n if (!schema || !values) return values;\n const shape = z.schema.shape(schema);\n const out: Record<string, any> = {};\n for (const [key, value] of Object.entries(values)) {\n const field = shape[key];\n if (!field) {\n // A filter that no longer exists. Dropped rather than passed through,\n // so a removed field cannot reappear in the fetch payload.\n continue;\n }\n const wantsArray = z.schema.isArray(z.schema.unwrap(field));\n const isArray = Array.isArray(value);\n if (wantsArray && !isArray) {\n out[key] = value === undefined || value === \"\" ? [] : [value];\n } else if (!wantsArray && isArray) {\n out[key] = value[0];\n } else {\n out[key] = value;\n }\n }\n return out;\n};\n\n/**\n * Synchronous localStorage write. Empty objects/null delete the key.\n */\nconst writePersisted = (key: string, suffix: string, value: unknown): void => {\n if (typeof window === \"undefined\") return;\n const fullKey = `${key}.${suffix}`;\n try {\n const isEmptyObject =\n value !== null &&\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n Object.keys(value as object).length === 0;\n const isEmptyArray = Array.isArray(value) && value.length === 0;\n if (\n value === undefined ||\n value === null ||\n isEmptyObject ||\n isEmptyArray\n ) {\n window.localStorage.removeItem(fullKey);\n return;\n }\n window.localStorage.setItem(fullKey, JSON.stringify(value));\n } catch {\n // localStorage may be unavailable (private mode, quota). Skip.\n }\n};\n\n/**\n * Page sizes the footer offers.\n *\n * No \"all\". Pagination here is server-side, so an unbounded fetch is a query\n * whose cost grows with the biggest table in the product and is paid by the\n * reader who can least afford it. 100 covers \"let me scan the lot\" without\n * that.\n */\nexport const PAGE_SIZES = [10, 20, 50, 100];\n\n/**\n * The three persisted preferences, read for one `persistenceKey`.\n *\n * Factored out because they are read from TWO places now: once at mount, and\n * again whenever the key changes under a mounted table. Inline in `useState`\n * they could only be read once, and a second copy of each rule is how the\n * scope-change path would come to disagree with the mount path about what a\n * stored value means.\n */\nconst persistedSort = (\n key: string | undefined,\n fallback: SortState | null | undefined,\n): SortState | null => {\n const stored = key ? readPersisted<SortState>(key, \"sort\") : undefined;\n return stored ?? fallback ?? null;\n};\n\nconst persistedSize = (\n key: string | undefined,\n fallback: number | undefined,\n): number => {\n const stored = key ? readPersisted<number>(key, \"size\") : undefined;\n return stored ?? fallback ?? 20;\n};\n\nconst persistedColumns = <T,>(\n key: string | undefined,\n columns: Record<string, ColumnDef<T>>,\n): Set<string> => {\n const stored = key ? readPersisted<string[]>(key, \"columns\") : undefined;\n if (stored) {\n return new Set(stored.filter((k) => k in columns));\n }\n return new Set(\n Object.keys(columns).filter((k) => !columns[k]!.defaultHidden),\n );\n};\n\n/**\n * The reader's column order, reconciled against what the table actually\n * declares.\n *\n * Reconciliation is the whole of this function and the reason it is not just\n * `readPersisted`. A stored array is a snapshot of the columns as they were\n * when somebody last dragged one, and the code has moved since: a column\n * added in a later release is missing from it, one removed is still in it.\n * Trusting it verbatim would drop the new column from the table entirely and\n * try to render a dead one.\n *\n * New keys go to the END rather than at their declared index. That is the\n * rule with the least surprise: the reader's layout is left exactly as they\n * arranged it, and the new column turns up somewhere predictable where the\n * picker can find it. Splicing it in by declaration index would put it at a\n * position matching neither the author's intent (the rest of the order is not\n * the declared one any more) nor the reader's.\n */\nconst reconcileOrder = (\n stored: string[] | undefined,\n declared: string[],\n): string[] => {\n if (!stored) return declared;\n const known = new Set(declared);\n const kept = stored.filter((key) => known.has(key));\n const seen = new Set(kept);\n return [...kept, ...declared.filter((key) => !seen.has(key))];\n};\n\nconst persistedOrder = <T,>(\n key: string | undefined,\n columns: Record<string, ColumnDef<T>>,\n): string[] =>\n reconcileOrder(\n key ? readPersisted<string[]>(key, \"columnOrder\") : undefined,\n Object.keys(columns),\n );\n\nexport function AlephaTable<T>(props: AlephaTableProps<T>) {\n /**\n * `persistenceKey`, once per facet.\n *\n * A facet that is off gets `undefined`, which is the same value every\n * persistence helper here already treats as \"do not store\" - so turning one\n * off takes the branch a table with no key has always taken, rather than a\n * new one. That is what keeps the default behaviour of `persistenceKey`\n * exactly as it was: with `persist` absent, all three of these ARE\n * `props.persistenceKey`.\n *\n * Primitives, so they go straight into the dependency arrays and `useState`\n * initializers below without giving any of them a new identity per render.\n */\n const filtersKey =\n props.persist?.filters === false ? undefined : props.persistenceKey;\n const columnsKey =\n props.persist?.columns === false ? undefined : props.persistenceKey;\n const sortKey =\n props.persist?.sort === false ? undefined : props.persistenceKey;\n\n // State, not a constant. It was `props.defaultSize ?? 20` read once, so a\n // reader had no way to see more rows than the call site had decided for\n // them. Already in `load`'s dependency array, so changing it refetches.\n const [size, setSize] = useState<number>(() =>\n persistedSize(props.persistenceKey, props.defaultSize),\n );\n const pageSizes = props.pageSizes ?? PAGE_SIZES;\n const alepha = useAlepha();\n const { tr } = useI18n();\n const toast = useToast();\n /**\n * The whole of the phone layout, and deliberately one switch rather than a\n * scattering of `max-md:` classes: the filter controls have to be rendered\n * in exactly ONE of the two places (see `AlephaTableFilterDialog`), which\n * CSS cannot express. Everything else below the breakpoint follows the same\n * flag so the two halves of the layout cannot disagree.\n *\n * Safe against hydration because the whole table sits inside `ClientOnly`,\n * and `useIsMobile` reads the same `MediaQueryList` it subscribes to.\n */\n const isMobile = useIsMobile();\n\n // -- Filter form (internal when `filters` is set, else legacy `form`) -----\n\n // Read persisted filter values synchronously so they reach useForm's\n // first invocation. Reading inside an effect would be too late —\n // useForm captures `initialValues` only once via useMemo.\n const persistedFilterValues = useMemo(() => {\n if (!filtersKey || !props.filters) return undefined;\n return reconcilePersistedFilters(\n props.filters.schema,\n readPersisted<Record<string, any>>(filtersKey, \"filters\"),\n );\n }, [filtersKey, props.filters]);\n\n /**\n * Filter values the URL carries, when the caller opted in with `fromQuery`.\n *\n * Read from the store rather than through `useRouterState`, on purpose:\n * this is a one-shot read at mount, so the subscription would only buy a\n * re-render of the whole table on navigations it must not react to anyway.\n * A missing store (a table mounted with no router at all) reads as no\n * query, not as a crash.\n */\n const queryFilterValues = useMemo(() => {\n const fromQuery = props.filters?.fromQuery;\n if (!fromQuery || !props.filters) return undefined;\n const query = (\n alepha.store.get(\"alepha.react.router.state\") as\n | { query?: Record<string, any> }\n | undefined\n )?.query;\n if (!query) return undefined;\n return queryToFilters(\n alepha,\n props.filters.schema,\n query,\n Array.isArray(fromQuery) ? fromQuery : undefined,\n );\n }, []);\n\n const mergedFilterInitialValues = useMemo<Record<string, any>>(\n () => ({\n ...props.filters?.initialValues,\n ...persistedFilterValues,\n // Above the stored choice — see `seedValues`. A drill-through link that\n // lost to a filter the reader set last week would be a link that does\n // nothing.\n ...queryFilterValues,\n // Last: an explicit `seedValues` is the caller deciding for a case of\n // its own, and outranks what the URL happened to carry.\n ...props.filters?.seedValues,\n }),\n [],\n );\n\n // Always call useForm to keep hook order stable. When the caller\n // doesn't pass `filters`, the internal form has an empty schema and\n // is simply unused.\n const internalForm = useForm({\n schema: props.filters?.schema ?? EMPTY_FILTERS_SCHEMA,\n initialValues: mergedFilterInitialValues,\n handler: async () => {\n // No-op — the table subscribes to `form:submit:success` to refetch.\n },\n });\n\n const form = props.filters ? internalForm : props.form;\n\n // -- Paging / sort / data --------------------------------------------------\n\n const [page, setPage] = useState(0);\n\n /**\n * Change the page size and go back to the first page.\n *\n * The reset is the whole point: raising the size while on page 5 can put\n * the reader past the last page, which renders an empty table with no\n * visible cause. Persisted so the choice survives a reload, alongside the\n * filters, sort and columns this table already remembers.\n */\n const changeSize = (next: number) => {\n setSize(next);\n setPage(0);\n if (props.persistenceKey) {\n writePersisted(props.persistenceKey, \"size\", next);\n }\n };\n\n /**\n * The footer's page-size picker, as a form of one field.\n *\n * `Control` is form-bound and this picker is not part of any form, which is\n * why the footer stayed on a raw `<Select>` long after everything else here\n * moved. One field is the whole cost of joining, and it buys the picker the\n * same trigger, popup and keyboard handling as every other select in the\n * table. `keepDirty: false` so the re-seed below actually re-seeds: `size`\n * can move without the picker (a persisted value on mount), and a kept\n * \"edit\" would pin the trigger to a page size the table is not using.\n */\n const sizeForm = useForm({\n schema: z.object({ size: z.number() }),\n initialValues: { size },\n keepDirty: false,\n handler: async () => {},\n onChange: (_key, next) => changeSize(next as number),\n });\n\n const [sort, setSort] = useState<SortState | null>(() =>\n persistedSort(sortKey, props.defaultSort),\n );\n const [fetchedData, setData] = useState<T[]>([]);\n const [fetchedMeta, setMeta] = useState<Page<T>[\"page\"] | null>(null);\n const [loading, setLoading] = useState(false);\n const [refreshKey, setRefreshKey] = useState(0);\n const [isRefreshing, setIsRefreshing] = useState(false);\n\n // Alepha's pagination parser reads \"field\" as asc and \"-field\" as desc.\n // Multiple comma-separated entries are multi-column sort, so we must\n // NOT use `field,direction` syntax — that would treat \"asc\"/\"desc\" as\n // a second column name and 500 on the backend.\n const sortParam = sort\n ? sort.direction === \"desc\"\n ? `-${sort.field}`\n : sort.field\n : undefined;\n\n // Hold the latest `fetch` in a ref so it is NOT a dependency of `load`.\n // Callers pass `fetch` inline (a new function every render), and a fetcher\n // that writes a store atom the caller also subscribes to would otherwise\n // self-trigger: load → atom write → caller re-render → new `fetch` → new\n // `load` → effect re-runs → infinite loop. The ref keeps the newest closure\n // available while `load` only re-runs on actual inputs (page/size/sort/…).\n const fetchRef = useRef(props.fetch);\n fetchRef.current = props.fetch;\n\n const load = useCallback(async () => {\n // Static mode owns no request. Bail before touching `loading` too, so a\n // table fed an array never flashes the skeleton over rows it already has.\n const fetcher = fetchRef.current;\n if (!fetcher) return;\n setLoading(true);\n try {\n const res = await fetcher({\n page,\n size,\n sort: sortParam,\n filters: form?.currentValues,\n });\n setData(res.content);\n setMeta(res.page);\n } catch (error) {\n // Surface read failures through the same `react:action:error` channel\n // that useAction/useQuery use, so a mounted <ActionErrorToaster /> toasts\n // them. Keep the previous rows on screen rather than blanking the table.\n void alepha.events.emit(\"react:action:error\", {\n type: \"custom\",\n id: \"alepha-table:load\",\n error: error as Error,\n });\n } finally {\n setLoading(false);\n }\n }, [page, size, sortParam, refreshKey, form, alepha]);\n\n useEffect(() => {\n void load();\n }, [load]);\n\n /**\n * Static mode's equivalent of `load` — derived, not stored.\n *\n * Deliberately NOT routed through `load`: putting `props.data` in that\n * effect's dependencies reproduces the exact loop `fetchRef` exists to\n * prevent (load → setData → re-render → new inline array → new load).\n * Computed synchronously there is no state to go stale, an inline\n * `data={rows.filter(…)}` is safe, and a changed array is on screen in\n * the same render.\n */\n const staticPage = useMemo(() => {\n if (!props.data) return null;\n const sortValues: Record<string, (item: T) => unknown> = {};\n for (const [key, column] of Object.entries(props.columns)) {\n if (column.sortValue) {\n sortValues[column.sortKey ?? key] = column.sortValue;\n }\n }\n return paginateLocal(props.data, {\n page,\n size,\n sort: sortParam,\n sortValues,\n filters: form?.currentValues,\n filter: props.filter,\n });\n // `refreshKey` is what the filter-form subscriptions bump, so it is how\n // a filter change reaches this memo — `form.currentValues` is mutated in\n // place and its identity never changes.\n }, [\n props.data,\n props.columns,\n props.filter,\n page,\n size,\n sortParam,\n refreshKey,\n form,\n ]);\n\n const data = staticPage ? staticPage.content : fetchedData;\n const meta = staticPage ? staticPage.page : fetchedMeta;\n\n /**\n * Rows vanish under the reader in static mode: the caller detaches one and\n * the page they are on stops existing. Nothing fetches, so nothing else\n * would notice — the table would sit on an empty page with no visible\n * cause. Fetch mode has the same hole, but there the server round-trip\n * needed to see it makes this the wrong place to close it.\n */\n if (staticPage) {\n const totalPages = staticPage.page.totalPages ?? 0;\n if (page > 0 && page > totalPages - 1) {\n // Guarded on `page`, so it settles in one pass and does not need an\n // effect: the clamp lands before the rows render against a page that no\n // longer exists.\n setPage(Math.max(0, totalPages - 1));\n }\n }\n\n // Persist sort to localStorage on every change.\n useEffect(() => {\n if (!sortKey) return;\n writePersisted(sortKey, \"sort\", sort);\n }, [sortKey, sort]);\n\n // -- Refresh + reset wiring -----------------------------------------------\n\n const refresh = useCallback(() => {\n setPage(0);\n setRefreshKey((k) => k + 1);\n }, []);\n\n const handleRefreshClick = useCallback(() => {\n setIsRefreshing(true);\n refresh();\n 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:change` for deleted keys, so inputs stay\n // visually populated and subscribers don't refetch. Explicit set\n // keeps everyone in sync.\n const keys = Object.keys(z.schema.shape(props.filters.schema));\n for (const key of keys) {\n const input = (form.input as Record<string, { set?: (v: any) => void }>)[\n key\n ];\n input?.set?.(undefined);\n }\n }, [form, props.filters]);\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 Object.keys(z.schema.shape(props.filters.schema)),\n cleanFilterValues(form.currentValues ?? {}),\n );\n try {\n await navigator.clipboard.writeText(url);\n toast.success(\n tr(\"alephaTable.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, 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 AlephaTable 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:change\", (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:change\", (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 // -- Row identity ----------------------------------------------------------\n\n /**\n * A row's key, in order of preference: the caller's `rowKey`, the row's own\n * `id`, then where the row sits.\n *\n * The last one used to be `Math.random()`, which is not an identity at all.\n * Every render produced a new key, so React saw every id-less row as a new\n * row and remounted it: focus in an inline input was lost the moment\n * anything else re-rendered, and the list re-animated on every keystroke.\n * Selection was broken by the same thing - `selection.has(rowKey(item))`\n * compared against a key generated one render earlier, so it never matched.\n */\n const rowKeys = useMemo(\n () =>\n data.map((item, index) => {\n if (props.rowKey) return props.rowKey(item);\n const id = (item as { id?: unknown })?.id;\n // Coercion at a boundary: the value is a form/route/chart primitive\n // whose declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string\n return id != null ? String(id) : `page-${page}-row-${index}`;\n }),\n [data, page, props.rowKey],\n );\n\n /**\n * Selection asks for a key by item, not by index. Every item it can ask\n * about is one of `data`'s, so a lookup keyed on identity covers it without\n * an O(n) scan per call.\n */\n const rowKeyByItem = useMemo(() => {\n const map = new Map<T, string>();\n data.forEach((item, index) => map.set(item, rowKeys[index]));\n return map;\n }, [data, rowKeys]);\n\n const rowKey = useCallback(\n (item: T): string => rowKeyByItem.get(item) ?? \"\",\n [rowKeyByItem],\n );\n\n // -- Selection -------------------------------------------------------------\n\n const {\n selection,\n selectedItems,\n allSelected,\n someSelected,\n toggleRow,\n toggleAll,\n clearSelection,\n } = useTableSelection(data, rowKey);\n\n // The bulk actions offered for THIS selection: an action's `visible`\n // predicate reads the selected rows. Computed once, here, so the pill's\n // contents and the pill's own presence come from the same list.\n const visibleBulkActions = useMemo(\n () =>\n (props.bulkActions ?? []).filter(\n (action) => action.visible?.(selectedItems) ?? true,\n ),\n [props.bulkActions, selectedItems],\n );\n\n // -- Sort ------------------------------------------------------------------\n\n const toggleSort = (col: string, def: ColumnDef<T>) => {\n if (!def.sortable) return;\n const field = def.sortKey ?? col;\n setSort((s) => {\n const next: SortState | null =\n !s || s.field !== field\n ? { field, direction: \"asc\" }\n : s.direction === \"asc\"\n ? { field, direction: \"desc\" }\n : null;\n props.onSortChange?.(next);\n return next;\n });\n };\n\n /**\n * Sort in a named direction, or clear it.\n *\n * The header cycles; the menu states. Both write the same state, so a\n * column sorted from the menu shows the header's own arrow.\n */\n const setSortTo = (\n col: string,\n def: ColumnDef<T>,\n direction: \"asc\" | \"desc\" | null,\n ) => {\n if (!def.sortable) return;\n const field = def.sortKey ?? col;\n const next: SortState | null = direction ? { field, direction } : null;\n setSort(next);\n props.onSortChange?.(next);\n };\n\n // -- Column visibility -----------------------------------------------------\n\n const allColumnKeys = useMemo(\n () => Object.keys(props.columns),\n [props.columns],\n );\n\n const [visibleColumns, setVisibleColumns] = useState<Set<string>>(() =>\n persistedColumns(columnsKey, props.columns),\n );\n\n /**\n * The reader's column order. Held as the raw preference and reconciled on\n * every read below, so a caller adding a column at runtime is handled by\n * the same code path as a stale stored array.\n */\n const [columnOrder, setColumnOrder] = useState<string[]>(() =>\n persistedOrder(columnsKey, props.columns),\n );\n\n const orderedKeys = useMemo(\n () => reconcileOrder(columnOrder, allColumnKeys),\n [columnOrder, allColumnKeys],\n );\n\n /**\n * Move one column one slot, within the VISIBLE sequence.\n *\n * Over the visible columns and not the full order, because nudging a column\n * past a hidden one would look like nothing happened - the reader would\n * press \"move left\" and see the table unchanged. A swap rather than a\n * splice, so the hidden columns between the two keep their places.\n */\n const moveColumn = (key: string, delta: -1 | 1) => {\n const visible = orderedKeys.filter((k) => visibleColumns.has(k));\n const at = visible.indexOf(key);\n const target = visible[at + delta];\n if (at < 0 || target === undefined) return;\n const next = [...orderedKeys];\n const from = next.indexOf(key);\n const to = next.indexOf(target);\n next[from] = target;\n next[to] = key;\n commitOrder(next);\n // Announced, or the change is silent for a screen reader: nothing else\n // about a reordered table is spoken.\n setOrderAnnouncement(\n String(\n tr(\"alephaTable.columnMoved\", {\n default: `${String(props.columns[key]?.label ?? key)} moved to position ${at + delta + 1} of ${visible.length}`,\n args: [\n String(props.columns[key]?.label ?? key),\n String(at + delta + 1),\n String(visible.length),\n ],\n }),\n ),\n );\n };\n\n /**\n * Drop `key` onto `target`'s slot, which is what a drag in the column\n * picker means. Unlike {@link moveColumn} this walks the FULL order: the\n * picker lists hidden columns too, so a drag there can legitimately cross\n * one.\n */\n const reorderColumn = (key: string, target: string) => {\n if (key === target) return;\n const next = orderedKeys.filter((k) => k !== key);\n next.splice(next.indexOf(target), 0, key);\n commitOrder(next);\n };\n\n const commitOrder = (next: string[]) => {\n setColumnOrder(next);\n if (columnsKey) {\n writePersisted(columnsKey, \"columnOrder\", next);\n }\n };\n\n /**\n * What the live region says after a move. Cleared and re-set on each one,\n * so two moves in a row are both announced.\n */\n const [orderAnnouncement, setOrderAnnouncement] = useState(\"\");\n\n /**\n * ⚠️ A changed `persistenceKey` is a changed SCOPE, and this is where that\n * is handled.\n *\n * Every caller encodes its scope in that key - `lor.activity.${project.id}`,\n * `lor.epics.${project.id}` - so switching project changes it. Nothing acted\n * on that before, and `load` re-runs only on `[page, size, sortParam,\n * refreshKey, form, alepha]`, none of which a project switch touches. The\n * router does not remount on a param-only navigation either, so the table\n * kept serving the PREVIOUS project's rows under the new project's name\n * (feedback #2096).\n *\n * `refreshKey` is bumped rather than relying on the re-read: two projects\n * can share a stored sort and size, and then no dependency of `load` would\n * change and nothing would refetch. That equality is the bug's whole\n * mechanism, so the refetch cannot be a side effect of the values moving.\n *\n * ⚠️ Adjusted during RENDER, not in an effect, and that is load-bearing.\n * The sort and columns effects below are keyed on `persistenceKey` too, so\n * on the render where it changes they would fire in the same flush and\n * write the OUTGOING scope's state under the INCOMING key - silently\n * overwriting the project you just opened with the one you just left. React\n * re-renders before committing this, so by the time those effects run the\n * state is already the new scope's and they write back what was just read.\n *\n * ⚠️ `props.fetch` is still NOT a dependency of `load`. That is the loop\n * `fetchRef` exists to prevent, and several callers write a store atom from\n * inside their fetcher.\n *\n * Filter VALUES are deliberately not reset here: `useForm` captures its\n * `initialValues` once, so resetting them is form surgery rather than a\n * state assignment. They are also not clobbered - the filter-persist effect\n * writes only on `form:change` / `form:submit:success`, never on mount - so\n * the stored filters of the project you left stay its own.\n */\n const scopeRef = useRef(props.persistenceKey);\n if (scopeRef.current !== props.persistenceKey) {\n scopeRef.current = props.persistenceKey;\n setPage(0);\n setSize(persistedSize(props.persistenceKey, props.defaultSize));\n setSort(persistedSort(sortKey, props.defaultSort));\n setVisibleColumns(persistedColumns(columnsKey, props.columns));\n // Same render pass as the rest, and for the identical reason: the effects\n // keyed on `persistenceKey` fire in one flush, so an order left behind\n // here would be written back under the INCOMING key.\n setColumnOrder(persistedOrder(columnsKey, props.columns));\n setRefreshKey((k) => k + 1);\n }\n\n /**\n * Written on a TOGGLE, never on mount - the same rule the filter-persist\n * effect follows above, and for the same reason.\n *\n * As a mount effect this stamped the current set into storage on first\n * paint, which froze the column layout of every reader who had merely\n * OPENED the table. A `defaultHidden` added to a column afterwards then did\n * nothing for them, permanently and with no way to notice: the stored set\n * had no `defaultHidden` in it to be out of date. It also made\n * `defaultHidden` unusable as a controlled prop, since a remount read back\n * what the previous mount had written rather than the new default.\n */\n const toggleColumn = (id: string) => {\n const next = new Set(visibleColumns);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n setVisibleColumns(next);\n if (columnsKey) {\n writePersisted(columnsKey, \"columns\", [...next]);\n }\n };\n\n // -- Render ---------------------------------------------------------------\n\n // The reader's order, not the declaration's.\n const cols = orderedKeys.map((key) => [key, props.columns[key]!]) as Array<\n [string, ColumnDef<T>]\n >;\n const visibleCols = cols.filter(([key]) => visibleColumns.has(key));\n const hasCheckbox = Boolean(props.bulkActions?.length);\n const hasRowActions = Boolean(props.rowActions);\n\n const rowCtx: RowActionContext = useMemo(() => ({ refresh }), [refresh]);\n const bulkCtx: BulkActionContext = useMemo(\n () => ({ refresh, clearSelection }),\n [refresh, clearSelection],\n );\n\n /**\n * How many filters currently narrow the list — a count rather than the\n * boolean this used to be, because on a phone the bar is behind a button\n * and the trigger's badge is the only thing that says the table is\n * filtered at all.\n */\n const activeFilterCount = useMemo(() => {\n if (!props.filters || !form) return 0;\n return Object.keys(cleanFilterValues(form.currentValues ?? {})).length;\n }, [props.filters, form, refreshKey]);\n const hasActiveFilters = activeFilterCount > 0;\n\n // Which empty state applies, resolved here rather than in the JSX because\n // the answer is one boolean and the branch is four values deep.\n //\n // `hasActiveFilters` is already false whenever `props.filters` is unset, so\n // a table with no filter form can only ever reach the \"no items\" side.\n const emptyOverride =\n (hasActiveFilters ? props.noMatchState : props.emptyState) ?? {};\n const EmptyIcon = emptyOverride.icon ?? (hasActiveFilters ? SearchX : Inbox);\n const emptyTitle =\n emptyOverride.title ??\n props.emptyMessage ??\n String(\n hasActiveFilters\n ? tr(\"alephaTable.noMatchTitle\", { default: \"No match\" })\n : tr(\"alephaTable.emptyTitle\", { default: \"No items\" }),\n );\n // Suppressed by a bare `emptyMessage`: that prop is the whole message, and\n // pairing someone's \"No artifacts yet\" with a stock second line reads as a\n // component talking over its caller.\n // The empty state is showing, as opposed to the skeleton that also renders\n // on `data.length === 0`. Read by the `<Table>` height as well as the body,\n // so the two cannot disagree.\n const isEmptyState = !loading && data.length === 0;\n const emptyAction = emptyOverride.action;\n const emptyDescription =\n emptyOverride.description ??\n (props.emptyMessage\n ? undefined\n : String(\n hasActiveFilters\n ? tr(\"alephaTable.noMatchDescription\", {\n default: \"Try adjusting or clearing the filters.\",\n })\n : tr(\"alephaTable.emptyDescription\", {\n default: \"Nothing here yet.\",\n }),\n ));\n\n const showToolbar =\n Boolean(props.filters) ||\n Boolean(props.toolbar) ||\n Boolean(props.actions?.length) ||\n !props.hideColumnPicker ||\n !props.hideActionsMenu;\n const showColumnPicker = !props.hideColumnPicker && allColumnKeys.length > 0;\n const showActionsMenu = !props.hideActionsMenu;\n\n return (\n <ClientOnly>\n <div className={cn(\"flex flex-col gap-2\", props.className)}>\n {props.header && (\n <div className=\"flex items-center gap-2\">\n <div className=\"min-w-0 flex-1\">{props.header}</div>\n </div>\n )}\n\n {showToolbar && (\n // `bg-muted`, paired with the pagination footer below: the filter bar\n // and the footer are the table's chrome and bracket it top and\n // bottom, so they sit one step off the page while the table itself\n // (header included) stays on it. They were `bg-card` — pure white in\n // light, the same colour as the page, so neither had an edge.\n //\n // The controls need an explicit fill because of that. shadcn ships\n // inputs and select triggers `bg-transparent` in light and only fills\n // them in dark (`dark:bg-input/30`) — the light case assumes a white\n // page, where transparent already reads as a white field. On this bar\n // it does not: they would take the muted grey and the border alone\n // would have to say \"input\". Scoped here rather than to the\n // primitives, which `yarn w @alepha/ui sync` overwrites.\n //\n // `bg-background` suits both modes: white against the muted bar in\n // light, near-black in dark, so the control reads as a well sunk\n // into the chrome either way. The `dark:` copy is not redundant —\n // the primitives ship `dark:bg-input/30` at (0,2,0), a translucent\n // WHITE wash that leaves the field lighter than the bar. Only the\n // dark-scoped rule (0,3,0) outranks it, and without it the two\n // controls disagreed: the trigger went dark, the input stayed light.\n // The `--bevel` line, laid just inside the bar's own top border,\n // the same fold the header and the footer carry. This one is the\n // top edge of the whole table block, so it is the one that decides\n // whether the block sits ON the page or IN it.\n <div className=\"bg-muted [&_:is(input,[role=combobox])]:bg-background dark:[&_:is(input,[role=combobox])]:bg-background flex flex-wrap items-end gap-2 rounded-md rounded-b-none border p-2 shadow-[inset_0_1px_0_0_var(--bevel)]\">\n {props.filters && form && !isMobile ? (\n <form\n {...form.props}\n className=\"flex flex-1 flex-wrap items-end gap-2\"\n >\n {props.filters.render(form)}\n </form>\n ) : (\n <div className=\"flex flex-1\" />\n )}\n {/*\n `self-center`, against the bar's own `items-end`.\n\n The bar bottom-aligns because a filter Control may carry a label,\n and a row of labelled controls has to line up on the inputs rather\n than on the top of the tallest label. Everything to the right of\n the filters is a bare control with no label of its own, so\n inheriting that baseline pinned it to the bottom of whatever the\n filter area happened to measure — a \"New\" button sitting low\n against a labelled select, moving as soon as a filter gained or\n lost its label.\n\n Centring only the trailing content keeps the filter row's own\n alignment intact and makes the actions independent of it.\n */}\n {props.toolbar && (\n <div className=\"self-center\">{props.toolbar}</div>\n )}\n <TooltipProvider>\n <div className=\"flex items-center gap-1 self-center\">\n {props.actions?.length ? (\n <>\n {props.actions.map((action) => {\n const ActionIcon = action.icon;\n if (action.primary) {\n // The visible label is the tooltip, so there is\n // none. `aria-label` keeps the accessible name once\n // the label collapses below `sm`; `h-9` lines the\n // button up with the ghost icons beside it.\n return (\n <Button\n key={action.label}\n type=\"button\"\n size=\"sm\"\n className=\"h-9 px-3\"\n aria-label={action.label}\n disabled={action.disabled}\n onClick={action.onClick}\n >\n <ActionIcon className=\"size-4\" />\n <span className=\"hidden sm:inline\">\n {action.label}\n </span>\n </Button>\n );\n }\n return (\n <Tooltip key={action.label}>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-9 w-9 p-0\"\n aria-label={action.label}\n disabled={action.disabled}\n onClick={action.onClick}\n />\n }\n >\n <ActionIcon className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{action.label}</TooltipContent>\n </Tooltip>\n );\n })}\n {(showColumnPicker || showActionsMenu) && (\n <span\n aria-hidden\n className=\"bg-border mx-1 h-5 w-px self-center\"\n />\n )}\n </>\n ) : null}\n {isMobile && props.filters && form && (\n <AlephaTableFilterDialog\n form={form}\n activeCount={activeFilterCount}\n onReset={resetFilters}\n onShare={canShare ? shareFilters : undefined}\n >\n {props.filters.render(form)}\n </AlephaTableFilterDialog>\n )}\n {showColumnPicker && (\n <ColumnPicker<T>\n columns={props.columns}\n order={orderedKeys}\n visible={visibleColumns}\n onToggle={toggleColumn}\n onReorder={reorderColumn}\n />\n )}\n {/*\n Desktop only. On a phone the same two actions live in the\n filter dialog, beside the controls they act on, and a second\n copy out here would spend a slot of the very row that dialog\n exists to shorten.\n */}\n {showActionsMenu && props.filters && !isMobile && canShare && (\n <AlephaTableFilterMenu\n activeCount={activeFilterCount}\n onShare={shareFilters}\n onReset={resetFilters}\n />\n )}\n {/*\n Not linkable: no Share, so no menu either. A menu of one\n item would cost a click to reach the button that is already\n here.\n */}\n {showActionsMenu && props.filters && !isMobile && !canShare && (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-9 w-9 p-0\"\n aria-label={tr(\"alephaTable.resetFilters\", {\n default: \"Reset filters\",\n })}\n disabled={!hasActiveFilters}\n onClick={resetFilters}\n />\n }\n >\n <FunnelX className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>\n {tr(\"alephaTable.resetFilters\", {\n default: \"Reset filters\",\n })}\n </TooltipContent>\n </Tooltip>\n )}\n {showActionsMenu && (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-9 w-9 p-0\"\n aria-label={tr(\"alephaTable.refresh\", {\n default: \"Refresh\",\n })}\n disabled={isRefreshing}\n onClick={handleRefreshClick}\n />\n }\n >\n <RefreshCw\n className={cn(\"size-4\", isRefreshing && \"animate-spin\")}\n />\n </TooltipTrigger>\n <TooltipContent>\n {tr(\"alephaTable.refresh\", { default: \"Refresh\" })}\n </TooltipContent>\n </Tooltip>\n )}\n </div>\n </TooltipProvider>\n </div>\n )}\n\n {hasCheckbox &&\n selection.size > 0 &&\n visibleBulkActions.length > 0 && (\n // Linear-style floating action pill: fixed at the bottom-center of\n // the viewport, dark surface that stays readable in both themes\n // because the colors are hard-coded (theme-relative `bg-foreground`\n // inverts awkwardly against a white container in dark mode).\n <div className=\"pointer-events-none fixed inset-x-0 bottom-6 z-40 flex justify-center\">\n <div className=\"animate-in fade-in-0 slide-in-from-bottom-2 pointer-events-auto flex items-center gap-2 rounded-full bg-zinc-900 px-3 py-1.5 text-zinc-100 shadow-lg ring-1 ring-white/10 duration-150\">\n <span className=\"pl-2 text-sm\">\n {tr(\"alephaTable.selected\", {\n default: `${selection.size} selected`,\n args: [String(selection.size)],\n })}\n </span>\n <span className=\"mx-1 h-4 w-px bg-white/20\" />\n {visibleBulkActions.map((action) => {\n if (\"items\" in action) {\n return (\n <AlephaTableBulkMenu<T>\n key={action.label}\n action={action}\n selected={selectedItems}\n ctx={bulkCtx}\n />\n );\n }\n const ActionIcon = action.icon;\n return (\n <Button\n key={action.label}\n size=\"sm\"\n className={\n action.destructive\n ? \"h-8 bg-red-600 text-white hover:bg-red-500\"\n : \"h-8 bg-transparent text-zinc-100 hover:bg-white/10 hover:text-zinc-100\"\n }\n onClick={() => action.onClick(selectedItems, bulkCtx)}\n >\n {ActionIcon && <ActionIcon className=\"size-4\" />}\n {action.label}\n </Button>\n );\n })}\n <span className=\"mx-1 h-4 w-px bg-white/20\" />\n <Button\n size=\"icon\"\n className=\"size-8 bg-transparent text-zinc-300 hover:bg-white/10 hover:text-zinc-100\"\n onClick={clearSelection}\n aria-label={tr(\"alephaTable.clearSelection\", {\n default: \"Clear selection\",\n })}\n >\n <X className=\"size-4\" />\n </Button>\n </div>\n </div>\n )}\n\n {/*\n The toolbar, the rows and the footer are one panel: each facing edge\n is flattened and its border dropped so no double line appears, and\n `-mt-2` cancels the wrapper's `gap-2`. The footer half is\n unconditional because the page row below already renders\n unconditionally — gating it on `meta` would pop the bar in and flip\n this bottom border on every load, since `meta` starts null and only\n fills after the fetch.\n */}\n <div\n className={cn(\n \"flex min-h-0 flex-1 flex-col overflow-auto rounded-md border\",\n showToolbar && \"-mt-2 rounded-t-none border-t-0\",\n \"rounded-b-none border-b-0\",\n // shadcn's `<Table>` wraps the table in a container div whose\n // classes it hardcodes, and `scripts/sync.ts` overwrites that file\n // wholesale - so the one class it needs is set from out here\n // instead, where sync cannot reach.\n //\n // `grow`, NOT `flex-1`: `flex-1` sets the basis to 0, and in the\n // ordinary case this wrapper has no height of its own, so a 0\n // basis with nothing to grow into collapses the table to nothing.\n // `grow` keeps the content basis and only spends space that is\n // actually free, which is the full-height case.\n \"[&>[data-slot=table-container]]:grow\",\n )}\n >\n {/* `h-full` ONLY while the empty state is what is in the body.\n It is what lets that one row take the height the scroller grew\n into, so `align-middle` can centre the state in it.\n\n ⚠️ Never unconditionally. A CSS table given a height larger\n than its content does not leave the surplus at the bottom, it\n DISTRIBUTES IT ACROSS THE ROWS - so an unconditional `h-full`\n silently turns a short table into a tall one: Lore's Apps page,\n two rows in a full-height pane, rendered them 239px each. No\n unit test sees it (jsdom computes no layout) and it is invisible\n on a table long enough to fill its own container, which is why\n it reached e2e rather than review. */}\n <Table className={cn(isEmptyState && \"h-full\")}>\n {/* `bg-muted`, fully opaque, NOT the base header's `bg-muted/50`:\n this header is sticky, so anything translucent lets the rows\n scroll visibly through the column labels. Same tint, no\n transparency.\n\n Two inset lines, not one. The bottom is the divider against the\n first row; the top is the `--bevel` highlight, which is what\n gives the band its thickness. Inset shadows rather than borders\n because a border on a sticky `<thead>` is dropped by the\n collapsed table border model, and because the two lines have to\n sit INSIDE the header's own height: it is pinned at `top-0`\n against a scrolling body, so anything painted outside it is\n painted over. */}\n <TableHeader className=\"bg-muted sticky top-0 z-10 shadow-[inset_0_1px_0_0_var(--bevel),inset_0_-1px_0_0_var(--border)]\">\n <TableRow>\n {hasCheckbox && (\n <TableHead className=\"w-10\">\n <Checkbox\n checked={allSelected}\n indeterminate={!allSelected && someSelected}\n onCheckedChange={() => toggleAll()}\n aria-label={tr(\"alephaTable.selectAll\", {\n default: \"Select all rows\",\n })}\n />\n </TableHead>\n )}\n {visibleCols.map(([key, def], index) => {\n const sorted =\n def.sortable && sort?.field === (def.sortKey ?? key);\n return (\n // ⚠️ The menu is on the HEADER and never on a body cell.\n // Overriding the browser's own menu is acceptable on\n // chrome; on a data cell it breaks copy, and people copy\n // cell values constantly.\n <ContextMenu key={key}>\n <ContextMenuTrigger\n render={\n <TableHead\n // Focusable so Shift+F10 reaches the menu.\n // Without it the menu is mouse-only, and\n // right-click is already invisible and absent on\n // touch - which is exactly why the column picker\n // and not this is the primary path.\n tabIndex={0}\n className={cn(\n def.className,\n \"focus-visible:ring-ring/50 outline-none focus-visible:ring-2\",\n def.align === \"right\" && \"text-right\",\n def.align === \"center\" && \"text-center\",\n )}\n aria-sort={\n sorted\n ? sort?.direction === \"asc\"\n ? \"ascending\"\n : \"descending\"\n : undefined\n }\n />\n }\n >\n {def.sortable ? (\n // A real button so keyboard and assistive-tech\n // users can sort — a th onClick is mouse-only.\n <button\n type=\"button\"\n onClick={() => toggleSort(key, def)}\n className=\"group/sort hover:text-foreground inline-flex items-center gap-1 select-none\"\n >\n {def.label}\n {/* A sortable column says so at rest. The arrow\n used to appear only once a column WAS sorted,\n so an unsorted sortable header and a dead one\n were indistinguishable until you happened to\n hover one. The neutral glyph is dimmed so a row\n of them does not shout, and brightens under the\n cursor.\n\n Lucide, not the `↑` / `↓` characters this\n replaced: those render in the text font at text\n weight and sat visibly apart from every other\n icon in the table.\n\n `aria-hidden` throughout: `aria-sort` on the\n `th` already states this to assistive tech. */}\n {sorted ? (\n sort?.direction === \"asc\" ? (\n <ArrowUp className=\"size-3.5\" aria-hidden />\n ) : (\n <ArrowDown className=\"size-3.5\" aria-hidden />\n )\n ) : (\n <ChevronsUpDown\n className=\"size-3.5 opacity-40 transition-opacity group-hover/sort:opacity-100\"\n aria-hidden\n />\n )}\n </button>\n ) : (\n <span className=\"inline-flex items-center gap-1\">\n {def.label}\n </span>\n )}\n </ContextMenuTrigger>\n <ContextMenuContent>\n {/* Explicit directions rather than the header's\n click-cycling, which is the one item here that\n beats the affordance it duplicates: cycling makes\n you guess which of three states you are in.\n Hidden entirely on a column that cannot sort,\n rather than shown disabled - a permanently dead\n entry on half the columns is noise. */}\n {def.sortable && (\n <>\n <ContextMenuItem\n onClick={() => setSortTo(key, def, \"asc\")}\n >\n <ArrowUpAZ className=\"size-4\" />\n {tr(\"alephaTable.sortAsc\", {\n default: \"Sort ascending\",\n })}\n </ContextMenuItem>\n <ContextMenuItem\n onClick={() => setSortTo(key, def, \"desc\")}\n >\n <ArrowDownAZ className=\"size-4\" />\n {tr(\"alephaTable.sortDesc\", {\n default: \"Sort descending\",\n })}\n </ContextMenuItem>\n <ContextMenuItem\n disabled={!sorted}\n onClick={() => setSortTo(key, def, null)}\n >\n {tr(\"alephaTable.sortClear\", {\n default: \"Clear sort\",\n })}\n </ContextMenuItem>\n <ContextMenuSeparator />\n </>\n )}\n {/* Disabled at the ends rather than hidden: the pair\n is a fixed landmark, and an entry that appears\n and disappears as you move a column is harder to\n aim at than one that greys out. */}\n <ContextMenuItem\n disabled={index === 0}\n onClick={() => moveColumn(key, -1)}\n >\n <ChevronLeft className=\"size-4\" />\n {tr(\"alephaTable.moveLeft\", { default: \"Move left\" })}\n </ContextMenuItem>\n <ContextMenuItem\n disabled={index === visibleCols.length - 1}\n onClick={() => moveColumn(key, 1)}\n >\n <ChevronRight className=\"size-4\" />\n {tr(\"alephaTable.moveRight\", {\n default: \"Move right\",\n })}\n </ContextMenuItem>\n <ContextMenuSeparator />\n {/* Never the last one: a table with no columns has\n no way back to this menu. */}\n <ContextMenuItem\n disabled={visibleCols.length <= 1}\n onClick={() => toggleColumn(key)}\n >\n <EyeOff className=\"size-4\" />\n {tr(\"alephaTable.hideColumn\", {\n default: \"Hide column\",\n })}\n </ContextMenuItem>\n </ContextMenuContent>\n </ContextMenu>\n );\n })}\n {hasRowActions && <TableHead className=\"w-10\" />}\n </TableRow>\n </TableHeader>\n <TableBody>\n {loading && data.length === 0 ? (\n <SkeletonRows\n rows={5}\n cols={\n visibleCols.length +\n (hasCheckbox ? 1 : 0) +\n (hasRowActions ? 1 : 0)\n }\n />\n ) : data.length === 0 ? (\n <TableRow className=\"hover:bg-transparent\">\n <TableCell\n colSpan={\n visibleCols.length +\n (hasCheckbox ? 1 : 0) +\n (hasRowActions ? 1 : 0)\n }\n // `h-full` and the cell's inherited `align-middle` are\n // what centre the state vertically. The chain is three\n // links long and every one is load-bearing: the scroller\n // above grows to the container, the `<table>` takes its\n // height, and this - the only body row - takes what the\n // header leaves. Break any of them and the state sits\n // tucked under the header instead of in the middle.\n //\n // `whitespace-normal` undoes the `whitespace-nowrap` every\n // cell carries, which is right for a data cell and wrong\n // for a sentence: the description would run off the side\n // and widen the table's own horizontal scroller.\n className=\"h-full p-0 whitespace-normal\"\n >\n {props.empty ?? (\n <div className=\"flex flex-col items-center justify-center gap-2 px-6 py-12 text-center\">\n <EmptyIcon className=\"text-muted-foreground size-8 opacity-40\" />\n <p className=\"text-foreground text-sm font-medium\">\n {emptyTitle}\n </p>\n {emptyDescription ? (\n <p className=\"text-muted-foreground max-w-xs text-sm text-balance\">\n {emptyDescription}\n </p>\n ) : null}\n {/* `pt-2` on top of the block's `gap-2`: the action is\n a separate beat from the sentence explaining it,\n and at one gap it reads as a third line of text. */}\n {emptyAction ? (\n <div className=\"pt-2\">{emptyAction}</div>\n ) : null}\n </div>\n )}\n </TableCell>\n </TableRow>\n ) : (\n data.map((item, rowIndex) => {\n const key = rowKeys[rowIndex];\n const isSelected = selection.has(key);\n return (\n <TableRow\n key={key}\n onClick={() => props.onRowClick?.(item)}\n className={cn(\n // Stays: the global cursor rule in `styles.css` covers\n // controls and menu items, and a `<tr>` is neither. It\n // is also conditional, which no blanket rule could be -\n // a row is only clickable when a handler was given.\n props.onRowClick && \"cursor-pointer\",\n isSelected && \"bg-muted/30\",\n )}\n >\n {hasCheckbox && (\n <TableCell onClick={(e) => e.stopPropagation()}>\n <Checkbox\n checked={isSelected}\n onCheckedChange={() => toggleRow(item)}\n aria-label={tr(\"alephaTable.selectRow\", {\n default: \"Select row\",\n })}\n />\n </TableCell>\n )}\n {visibleCols.map(([key, def]) => (\n <TableCell\n key={key}\n className={cn(\n def.className,\n def.align === \"right\" && \"text-right\",\n def.align === \"center\" && \"text-center\",\n )}\n >\n {def.cell(item)}\n </TableCell>\n ))}\n {hasRowActions && (\n <TableCell\n className=\"text-right\"\n onClick={(e) => e.stopPropagation()}\n >\n <RowActionsMenu\n actions={props.rowActions!(item)}\n item={item}\n ctx={rowCtx}\n />\n </TableCell>\n )}\n </TableRow>\n );\n })\n )}\n </TableBody>\n </Table>\n </div>\n\n {/* A move is otherwise silent: nothing about a reordered table is\n spoken, and the visual change is the only feedback. Outside the\n table so it is not read as a cell. */}\n <span aria-live=\"polite\" className=\"sr-only\">\n {orderAnnouncement}\n </span>\n\n {/* `bg-muted`, paired with the filter bar above, see the note there.\n Carries the same `--bevel` fold under its top border: the three\n chrome bands (filter bar, header, footer) are lit from one side, so\n they read as the same material at three different heights. */}\n <div className=\"bg-muted -mt-2 flex flex-wrap items-center justify-between gap-2 rounded-md rounded-t-none border p-2 shadow-[inset_0_1px_0_0_var(--bevel)]\">\n {/* The size picker sits with the count, not in the toolbar above:\n this line already answers \"how many, where am I\", while the\n toolbar answers \"which rows\". Mixing the two turns the toolbar\n into a junk drawer. */}\n <div className=\"flex items-center gap-2\">\n {/*\n Hidden on a phone, and the size itself is untouched: `size` is\n persisted per table, so a reader who chose 50 on a desktop keeps\n 50 here — this drops the CONTROL, not the setting. Nobody picks\n 100 rows on a 412px screen, and the picker plus the range text\n plus the numbered pages is exactly what made this bar wrap onto\n three lines (feedback #2106).\n */}\n {pageSizes.length > 0 &&\n !isMobile && (\n // The same `Control` the filter bar is built on, so the picker\n // is one component with every other select in this table. It\n // used to be the raw `Select` underneath it, because `Control`\n // is form-bound and this is not a form — `sizeForm` above is\n // what closes that gap.\n <Control\n input={sizeForm.input.size}\n // The count line beside it is not a label, so the trigger has\n // to name itself.\n label=\"\"\n inputProps={{\n \"aria-label\": String(\n tr(\"table.pageSize\", { default: \"Rows per page\" }),\n ),\n }}\n // `bg-background`, because this bar is `bg-muted` and the\n // trigger is `bg-transparent` by default: on a plain form\n // surface that blending is right, on a tinted bar it made the\n // picker read as part of the bar while the pagination buttons\n // beside it sat on their own plane. Set here rather than on\n // the trigger itself, which every form still wants\n // transparent.\n triggerClassName=\"bg-background h-7 w-auto gap-1 text-xs\"\n items={pageSizes.map((n) => ({\n value: String(n),\n label: String(n),\n }))}\n />\n )}\n <p className=\"text-muted-foreground text-xs\">\n {meta\n ? // The row range is the half that goes on a phone: \"where am\n // I\" survives, \"how many of how many\" does not, and the two\n // together are what pushed this past one line.\n `Page ${meta.number + 1}${meta.totalPages ? ` of ${meta.totalPages}` : \"\"}${\n isMobile\n ? \"\"\n : ` · ${meta.numberOfElements} of ${meta.totalElements ?? \"?\"}`\n }`\n : \"—\"}\n </p>\n </div>\n {meta && meta.totalPages && meta.totalPages > 1 ? (\n <Pagination className=\"mx-0 w-auto justify-end\">\n <PaginationContent>\n <PaginationItem>\n <PaginationPrevious\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n if (!meta.isFirst) setPage((p) => Math.max(0, p - 1));\n }}\n aria-disabled={meta.isFirst}\n className={cn(\n meta.isFirst && \"pointer-events-none opacity-50\",\n )}\n />\n </PaginationItem>\n {/*\n Previous/next only on a phone. The numbered sequence is up\n to seven tap targets plus two ellipses, which is the widest\n thing in this bar, and \"Page 1 of 3\" beside it already says\n where the reader is. Their labels are `hidden sm:block` in\n the primitive, so the two that remain are bare chevrons.\n */}\n {!isMobile &&\n computePageItems(meta.number + 1, meta.totalPages).map(\n (item, idx) =>\n item === \"ellipsis\" ? (\n <PaginationItem key={`e-${idx}`}>\n <PaginationEllipsis />\n </PaginationItem>\n ) : (\n <PaginationItem key={item}>\n <PaginationLink\n href=\"#\"\n isActive={item === meta.number + 1}\n onClick={(e) => {\n e.preventDefault();\n setPage(item - 1);\n }}\n >\n {item}\n </PaginationLink>\n </PaginationItem>\n ),\n )}\n <PaginationItem>\n <PaginationNext\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n if (!meta.isLast) setPage((p) => p + 1);\n }}\n aria-disabled={meta.isLast}\n className={cn(\n meta.isLast && \"pointer-events-none opacity-50\",\n )}\n />\n </PaginationItem>\n </PaginationContent>\n </Pagination>\n ) : null}\n </div>\n </div>\n </ClientOnly>\n );\n}\n\n/**\n * The single home for column state: what is shown, and in what order.\n *\n * Both live here rather than order being reachable only from the header's\n * context menu, and that is the shape decision. Right-click advertises\n * nothing and does not exist on touch, so a feature reachable only that way\n * is one most people never find. The menu is a fast path into this.\n *\n * Reordering is native HTML5 drag, the way Lore's folio tree does it: this\n * package has no drag-and-drop dependency and a column list is not worth\n * adding one. The arrows beside each row are not a fallback for a broken\n * drag - they are the keyboard and touch path, where drag does not exist.\n */\nfunction ColumnPicker<T>(props: {\n columns: Record<string, ColumnDef<T>>;\n order: string[];\n visible: Set<string>;\n onToggle: (key: string) => void;\n onReorder: (key: string, target: string) => void;\n}) {\n const { tr } = useI18n();\n const [dragging, setDragging] = useState<string | null>(null);\n // The reader's order, so the list reads like the table it controls.\n const entries = props.order.map(\n (key) => [key, props.columns[key]!] as [string, ColumnDef<T>],\n );\n const label = tr(\"alephaTable.toggleColumns\", {\n default: \"Toggle columns\",\n });\n return (\n <DropdownMenu>\n {/*\n * The trigger is composed rather than plain: it has to be the dropdown\n * trigger AND the tooltip trigger at once, or this button is the only\n * icon-only control in the toolbar with no tooltip (reset-filters and\n * refresh sit right next to it and both have one).\n *\n * `TooltipTrigger` wraps the rendered element rather than the other way\n * round, matching how `sidebar.tsx` composes the same two primitives.\n * `TooltipProvider` is supplied by the toolbar that renders this.\n */}\n <Tooltip>\n <DropdownMenuTrigger\n render={\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-9 w-9 p-0\"\n aria-label={label}\n />\n }\n />\n }\n >\n <Columns3 className=\"size-4\" />\n </DropdownMenuTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuGroup>\n <DropdownMenuLabel>\n {tr(\"alephaTable.columns\", { default: \"Columns\" })}\n </DropdownMenuLabel>\n <DropdownMenuSeparator />\n {entries.map(([key, def], index) => (\n <div\n key={key}\n draggable\n onDragStart={() => setDragging(key)}\n onDragEnd={() => setDragging(null)}\n onDragOver={(event) => {\n // Required, or the drop never fires.\n event.preventDefault();\n }}\n onDrop={(event) => {\n event.preventDefault();\n if (dragging && dragging !== key)\n props.onReorder(dragging, key);\n setDragging(null);\n }}\n className={cn(\n \"flex items-center gap-1 pr-1\",\n dragging === key && \"opacity-45\",\n )}\n >\n <GripVertical\n className=\"text-muted-foreground/60 size-3.5 shrink-0 cursor-grab\"\n aria-hidden\n />\n <DropdownMenuCheckboxItem\n checked={props.visible.has(key)}\n closeOnClick={false}\n onCheckedChange={() => props.onToggle(key)}\n className=\"flex-1\"\n >\n {def.label}\n </DropdownMenuCheckboxItem>\n {/* Keyboard and touch reach the order here. A drag handle alone\n would put reordering out of reach for both. */}\n <button\n type=\"button\"\n disabled={index === 0}\n aria-label={String(\n tr(\"alephaTable.moveUp\", { default: \"Move up\" }),\n )}\n onClick={() => props.onReorder(key, entries[index - 1]![0])}\n className=\"text-muted-foreground/60 hover:text-foreground rounded p-0.5 disabled:opacity-30\"\n >\n <ChevronUp className=\"size-3.5\" />\n </button>\n <button\n type=\"button\"\n disabled={index === entries.length - 1}\n aria-label={String(\n tr(\"alephaTable.moveDown\", { default: \"Move down\" }),\n )}\n onClick={() => props.onReorder(entries[index + 1]![0], key)}\n className=\"text-muted-foreground/60 hover:text-foreground rounded p-0.5 disabled:opacity-30\"\n >\n <ChevronDown className=\"size-3.5\" />\n </button>\n </div>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/**\n * Build the visible page-number sequence with ellipses. Always shows\n * first + last, ±1 around current. Gaps collapse into a single ellipsis.\n * `current` and `total` are 1-indexed.\n */\nfunction computePageItems(\n current: number,\n total: number,\n): Array<number | \"ellipsis\"> {\n if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);\n const items: Array<number | \"ellipsis\"> = [1];\n if (current > 3) items.push(\"ellipsis\");\n const start = Math.max(2, current - 1);\n const end = Math.min(total - 1, current + 1);\n for (let i = start; i <= end; i++) items.push(i);\n if (current < total - 2) items.push(\"ellipsis\");\n items.push(total);\n return items;\n}\n\nconst SkeletonRows = (props: { rows: number; cols: number }) => {\n return (\n <>\n {Array.from({ length: props.rows }).map((_, i) => (\n <TableRow key={i}>\n {Array.from({ length: props.cols }).map((_, j) => (\n <TableCell key={j}>\n <Skeleton className=\"h-4 w-full\" />\n </TableCell>\n ))}\n </TableRow>\n ))}\n </>\n );\n};\n\nfunction isRowActionGroup<T>(\n entry: RowActionEntry<T>,\n): entry is RowActionGroup<T> {\n return \"children\" in entry;\n}\n\nfunction RowActionsMenu<T>(props: {\n actions: RowActionEntry<T>[];\n item: T;\n ctx: RowActionContext;\n}) {\n const { tr } = useI18n();\n // ⚠️ Effective entries, not entries: a group is one entry however many\n // children it has, so a lone empty group would otherwise render the\n // three-dots trigger over an empty menu.\n const effective = props.actions.filter((action) =>\n isRowActionGroup(action) ? action.children.length > 0 : true,\n );\n if (effective.length === 0) return null;\n return (\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={tr(\"alephaTable.openRowActions\", {\n default: \"Open row actions\",\n })}\n />\n }\n >\n <MoreVertical className=\"size-4\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {effective.map((action, idx) => {\n const Icon = action.icon;\n if (isRowActionGroup(action)) {\n return (\n <DropdownMenuSub key={action.label}>\n <DropdownMenuSubTrigger>\n {Icon && <Icon className=\"mr-2 size-4\" />}\n {action.label}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n {action.children.map((child) => (\n <RowActionItem\n key={child.label}\n action={child}\n item={props.item}\n ctx={props.ctx}\n />\n ))}\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n }\n // A group is never destructive, so the previous entry being one\n // reads as falsy here and the separator rule needs no case for it.\n const previous = effective[idx - 1];\n const sep =\n idx > 0 &&\n action.destructive &&\n !(previous && !isRowActionGroup(previous) && previous.destructive);\n return (\n <span key={action.label}>\n {sep && <DropdownMenuSeparator />}\n <RowActionItem\n action={action}\n item={props.item}\n ctx={props.ctx}\n />\n </span>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/**\n * One menu entry, wherever it sits: at the top level of the row menu or\n * inside a group's submenu. Both render the same way, which is what keeps a\n * `checked` entry from behaving differently depending on where it was put.\n */\nfunction RowActionItem<T>(props: {\n action: RowAction<T>;\n item: T;\n ctx: RowActionContext;\n}) {\n const { action, item, ctx } = props;\n const Icon = action.icon;\n const disabled = action.disabled?.(item);\n if (action.checked) {\n return (\n <DropdownMenuCheckboxItem\n // Controlled with no `onCheckedChange`: the write is `onClick`, and\n // the state comes back from the row on the next render. Letting the\n // primitive toggle itself would show a check for a write that has\n // not landed, and would uncheck the current value when it is picked\n // again.\n checked={action.checked(item)}\n disabled={disabled}\n onClick={() => action.onClick(item, ctx)}\n >\n {Icon && <Icon className=\"mr-2 size-4\" />}\n {action.label}\n </DropdownMenuCheckboxItem>\n );\n }\n return (\n <DropdownMenuItem\n disabled={disabled}\n onClick={() => action.onClick(item, ctx)}\n variant={action.destructive ? \"destructive\" : undefined}\n >\n {Icon && <Icon className=\"mr-2 size-4\" />}\n {action.label}\n </DropdownMenuItem>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyuBA,MAAM,uBAAuB,EAAE,OAAO,CAAC,CAAC;;;;AAKxC,MAAM,iBAAqB,KAAa,WAAkC;CACxE,IAAI,OAAO,WAAW,aAAa,OAAO,KAAA;CAC1C,IAAI;EACF,MAAM,MAAM,OAAO,aAAa,QAAQ,GAAG,IAAI,GAAG,QAAQ;EAC1D,OAAO,OAAO,OAAO,KAAA,IAAa,KAAK,MAAM,GAAG;CAClD,QAAQ;EACN;CACF;AACF;;;;;;;;;;;;;;;;;;AAmBA,MAAM,6BACJ,QACA,WACoC;CACpC,IAAI,CAAC,UAAU,CAAC,QAAQ,OAAO;CAC/B,MAAM,QAAQ,EAAE,OAAO,MAAM,MAAM;CACnC,MAAM,MAA2B,CAAC;CAClC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;EACjD,MAAM,QAAQ,MAAM;EACpB,IAAI,CAAC,OAGH;EAEF,MAAM,aAAa,EAAE,OAAO,QAAQ,EAAE,OAAO,OAAO,KAAK,CAAC;EAC1D,MAAM,UAAU,MAAM,QAAQ,KAAK;EACnC,IAAI,cAAc,CAAC,SACjB,IAAI,OAAO,UAAU,KAAA,KAAa,UAA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AAA;AAElB;;;;;;AAOA,SAAS,cAAiB,OAIvB;CACD,MAAM,EAAE,QAAQ,MAAM,QAAQ;CAC9B,MAAM,OAAO,OAAO;CACpB,MAAM,WAAW,OAAO,WAAW,IAAI;CACvC,IAAI,OAAO,SACT,OACE,qBAAC,0BAAD;EAME,SAAS,OAAO,QAAQ,IAAI;EAClB;EACV,eAAe,OAAO,QAAQ,MAAM,GAAG;EARzC,UAAA,CAUG,QAAQ,oBAAC,MAAD,EAAM,WAAU,cAAe,CAAA,GACvC,OAAO,KACgB;;CAG9B,OACE,qBAAC,kBAAD;EACY;EACV,eAAe,OAAO,QAAQ,MAAM,GAAG;EACvC,SAAS,OAAO,cAAc,gBAAgB,KAAA;EAHhD,UAAA,CAKG,QAAQ,oBAAC,MAAD,EAAM,WAAU,cAAe,CAAA,GACvC,OAAO,KACQ;;AAEtB"}
@@ -0,0 +1,73 @@
1
+ import { type Alepha, type ZObject } from "alepha";
2
+ /**
3
+ * The two halves of a shareable filter link.
4
+ *
5
+ * `queryToFilters` reads the URL into filter values on arrival;
6
+ * `filtersToQuery` writes the current values back out when the reader asks
7
+ * for a link. Nothing here runs on its own: the table seeds from the query
8
+ * once, at mount, and only ever writes on an explicit Share.
9
+ *
10
+ * ⚠️ The pair is deliberately NOT a two-way binding. An effect that keeps
11
+ * the address bar in step with the filters is the shape Lore incident #156
12
+ * was about (see `AppRouter.projectQuests`): the router state is a global
13
+ * store, so the render on the way OUT of a page sees the next route's query
14
+ * and writes against it.
15
+ */
16
+ /**
17
+ * Read the filter values a URL carries.
18
+ *
19
+ * Only keys declared by the filter `schema` are read, so query params the
20
+ * page owns (a tab, a locale, a tracking param) never reach the fetch
21
+ * payload. `keys` narrows that further when a table wants only some of its
22
+ * filters to be linkable.
23
+ *
24
+ * Values arrive as strings and are coerced then decoded per field, the same
25
+ * pair the server applies to its own query strings, which is what turns
26
+ * `?limit=25` into a number and `?archived=true` into a boolean. A value the
27
+ * schema refuses is DROPPED rather than thrown: a stale bookmark has to
28
+ * degrade to the unfiltered list, never to an error page.
29
+ *
30
+ * Multi-value filters are comma-joined (`?status=new,triaged`). Repeated
31
+ * params are not an option: `ReactBrowserRouterProvider` builds its query
32
+ * from `URLSearchParams.entries()` into a flat record, so `?status=new&status=triaged`
33
+ * arrives as `triaged` alone.
34
+ *
35
+ * Returns `undefined` rather than `{}` when nothing matches, because the
36
+ * caller hands this to the table's seed slot, and an empty seed still
37
+ * outranks the filters the reader chose last time.
38
+ */
39
+ export declare const queryToFilters: (alepha: Alepha, schema: ZObject, query: Record<string, any>, keys?: readonly string[]) => Record<string, any> | undefined;
40
+ /**
41
+ * Serialize filter values into query params for a shareable link.
42
+ *
43
+ * Strings, numbers, booleans and arrays of those. Anything else is dropped:
44
+ * a link carrying some of the filters is honest, and one carrying
45
+ * `[object Object]` is not.
46
+ */
47
+ export declare const filtersToQuery: (values: Record<string, any>) => Record<string, string>;
48
+ /**
49
+ * The link the toolbar's Share item copies.
50
+ *
51
+ * Built on the page's own URL, so query params the table knows nothing about
52
+ * (a tab, a locale, a campaign) survive into the shared link. Every filter
53
+ * key is cleared first, which is what makes a filter the reader has since
54
+ * removed disappear from the link rather than linger from the URL they
55
+ * arrived on.
56
+ *
57
+ * Commas are written literally. `URLSearchParams` percent-encodes them, and
58
+ * `?status=new%2Ctriaged` defeats the point of a link somebody reads before
59
+ * clicking it. A comma is a legal sub-delimiter in a query, and it round-trips
60
+ * back through `queryToFilters` either way.
61
+ */
62
+ export declare const shareFiltersUrl: (href: string, keys: readonly string[], values: Record<string, any>) => string;
63
+ /**
64
+ * The filter values that are actually narrowing the list.
65
+ *
66
+ * Empty is not a filter: an untouched text input holds `""` and a
67
+ * multi-select the reader emptied holds `[]`, and neither should be stored,
68
+ * counted on the toolbar badge, or written into a shared link. One
69
+ * definition rather than three, because the three used to disagree on
70
+ * nothing at all and that is exactly how they would drift.
71
+ */
72
+ export declare const cleanFilterValues: (values: Record<string, any>) => Record<string, any>;
73
+ //# sourceMappingURL=query-filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-filters.d.ts","sourceRoot":"","sources":["../../../src/components/alepha-table/query-filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAmB,MAAM,QAAQ,CAAC;AAEpE;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,cAAc,WACjB,MAAM,UACN,OAAO,SACR,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,SACnB,SAAS,MAAM,EAAE,KACvB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SA0BxB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,WACjB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC1B,MAAM,CAAC,MAAM,EAAE,MAAM,CAgBvB,CAAC;AAOF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,SACpB,MAAM,QACN,SAAS,MAAM,EAAE,UACf,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC1B,MAYF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,WACpB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC1B,MAAM,CAAC,MAAM,EAAE,GAAG,CAUpB,CAAC"}