@alepha/ui 0.28.0 → 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 (378) 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-mfa-dialog.js +1 -4
  12. package/dist/components/account/account-mfa-dialog.js.map +1 -1
  13. package/dist/components/account/account-password-dialog.d.ts.map +1 -1
  14. package/dist/components/account/account-password-dialog.js +11 -14
  15. package/dist/components/account/account-password-dialog.js.map +1 -1
  16. package/dist/components/account/account-profile.js +3 -2
  17. package/dist/components/account/account-profile.js.map +1 -1
  18. package/dist/components/account/account-router-options.d.ts +38 -0
  19. package/dist/components/account/account-router-options.d.ts.map +1 -1
  20. package/dist/components/account/account-router-options.js.map +1 -1
  21. package/dist/components/account/account-router-page.d.ts +11 -1
  22. package/dist/components/account/account-router-page.d.ts.map +1 -1
  23. package/dist/components/account/account-router-page.js +11 -1
  24. package/dist/components/account/account-router-page.js.map +1 -1
  25. package/dist/components/account/account-router.d.ts +11 -0
  26. package/dist/components/account/account-router.d.ts.map +1 -1
  27. package/dist/components/account/account-router.js +16 -5
  28. package/dist/components/account/account-router.js.map +1 -1
  29. package/dist/components/admin/admin-audits.d.ts.map +1 -1
  30. package/dist/components/admin/admin-audits.js +91 -34
  31. package/dist/components/admin/admin-audits.js.map +1 -1
  32. package/dist/components/admin/admin-files.d.ts.map +1 -1
  33. package/dist/components/admin/admin-files.js +6 -17
  34. package/dist/components/admin/admin-files.js.map +1 -1
  35. package/dist/components/admin/admin-jobs-executions-panel.d.ts.map +1 -1
  36. package/dist/components/admin/admin-jobs-executions-panel.js +39 -8
  37. package/dist/components/admin/admin-jobs-executions-panel.js.map +1 -1
  38. package/dist/components/admin/admin-jobs-payload-dialog.d.ts +19 -0
  39. package/dist/components/admin/admin-jobs-payload-dialog.d.ts.map +1 -0
  40. package/dist/components/admin/admin-jobs-payload-dialog.js +33 -0
  41. package/dist/components/admin/admin-jobs-payload-dialog.js.map +1 -0
  42. package/dist/components/admin/admin-keys.d.ts.map +1 -1
  43. package/dist/components/admin/admin-keys.js +5 -4
  44. package/dist/components/admin/admin-keys.js.map +1 -1
  45. package/dist/components/admin/admin-notifications-channel-label.d.ts +14 -0
  46. package/dist/components/admin/admin-notifications-channel-label.d.ts.map +1 -0
  47. package/dist/components/admin/admin-notifications-channel-label.js +26 -0
  48. package/dist/components/admin/admin-notifications-channel-label.js.map +1 -0
  49. package/dist/components/admin/admin-notifications-preview-body.d.ts.map +1 -1
  50. package/dist/components/admin/admin-notifications-preview-body.js +23 -13
  51. package/dist/components/admin/admin-notifications-preview-body.js.map +1 -1
  52. package/dist/components/admin/admin-notifications.d.ts.map +1 -1
  53. package/dist/components/admin/admin-notifications.js +11 -12
  54. package/dist/components/admin/admin-notifications.js.map +1 -1
  55. package/dist/components/admin/admin-payments.d.ts.map +1 -1
  56. package/dist/components/admin/admin-payments.js +9 -7
  57. package/dist/components/admin/admin-payments.js.map +1 -1
  58. package/dist/components/admin/admin-router-options.d.ts +12 -0
  59. package/dist/components/admin/admin-router-options.d.ts.map +1 -1
  60. package/dist/components/admin/admin-router-options.js.map +1 -1
  61. package/dist/components/admin/admin-router.d.ts +5 -8
  62. package/dist/components/admin/admin-router.d.ts.map +1 -1
  63. package/dist/components/admin/admin-router.js +6 -29
  64. package/dist/components/admin/admin-router.js.map +1 -1
  65. package/dist/components/admin/admin-sessions.d.ts.map +1 -1
  66. package/dist/components/admin/admin-sessions.js +9 -7
  67. package/dist/components/admin/admin-sessions.js.map +1 -1
  68. package/dist/components/admin/admin-user-detail-audits-tab.d.ts.map +1 -1
  69. package/dist/components/admin/admin-user-detail-audits-tab.js +5 -4
  70. package/dist/components/admin/admin-user-detail-audits-tab.js.map +1 -1
  71. package/dist/components/admin/admin-user-detail-sessions-tab.d.ts.map +1 -1
  72. package/dist/components/admin/admin-user-detail-sessions-tab.js +7 -5
  73. package/dist/components/admin/admin-user-detail-sessions-tab.js.map +1 -1
  74. package/dist/components/admin/admin-user-detail.js +3 -2
  75. package/dist/components/admin/admin-user-detail.js.map +1 -1
  76. package/dist/components/admin/admin-users-roles-picker.d.ts.map +1 -1
  77. package/dist/components/admin/admin-users-roles-picker.js.map +1 -1
  78. package/dist/components/admin/admin-users.d.ts.map +1 -1
  79. package/dist/components/admin/admin-users.js +6 -4
  80. package/dist/components/admin/admin-users.js.map +1 -1
  81. package/dist/components/admin/analytics/AnalyticsChartBars.js +2 -1
  82. package/dist/components/admin/analytics/AnalyticsChartBars.js.map +1 -1
  83. package/dist/components/admin/parameter-history-item.d.ts.map +1 -1
  84. package/dist/components/admin/parameter-history-item.js +3 -2
  85. package/dist/components/admin/parameter-history-item.js.map +1 -1
  86. package/dist/components/alepha-table/alepha-table-bulk-menu.js +2 -1
  87. package/dist/components/alepha-table/alepha-table-bulk-menu.js.map +1 -1
  88. package/dist/components/alepha-table/alepha-table-filter-dialog.d.ts +60 -0
  89. package/dist/components/alepha-table/alepha-table-filter-dialog.d.ts.map +1 -0
  90. package/dist/components/alepha-table/alepha-table-filter-dialog.js +88 -0
  91. package/dist/components/alepha-table/alepha-table-filter-dialog.js.map +1 -0
  92. package/dist/components/alepha-table/alepha-table-filter-menu.d.ts +35 -0
  93. package/dist/components/alepha-table/alepha-table-filter-menu.d.ts.map +1 -0
  94. package/dist/components/alepha-table/alepha-table-filter-menu.js +54 -0
  95. package/dist/components/alepha-table/alepha-table-filter-menu.js.map +1 -0
  96. package/dist/components/alepha-table/alepha-table.d.ts +188 -3
  97. package/dist/components/alepha-table/alepha-table.d.ts.map +1 -1
  98. package/dist/components/alepha-table/alepha-table.js +551 -162
  99. package/dist/components/alepha-table/alepha-table.js.map +1 -1
  100. package/dist/components/alepha-table/query-filters.d.ts +73 -0
  101. package/dist/components/alepha-table/query-filters.d.ts.map +1 -0
  102. package/dist/components/alepha-table/query-filters.js +118 -0
  103. package/dist/components/alepha-table/query-filters.js.map +1 -0
  104. package/dist/components/app-actions/app-actions.d.ts +21 -0
  105. package/dist/components/app-actions/app-actions.d.ts.map +1 -1
  106. package/dist/components/app-actions/app-actions.js +11 -5
  107. package/dist/components/app-actions/app-actions.js.map +1 -1
  108. package/dist/components/app-shell/app-shell.d.ts +45 -0
  109. package/dist/components/app-shell/app-shell.d.ts.map +1 -1
  110. package/dist/components/app-shell/app-shell.js +119 -16
  111. package/dist/components/app-shell/app-shell.js.map +1 -1
  112. package/dist/components/auth/auth-register.js +31 -30
  113. package/dist/components/auth/auth-register.js.map +1 -1
  114. package/dist/components/auto-form/auto-form.d.ts.map +1 -1
  115. package/dist/components/auto-form/auto-form.js +68 -30
  116. package/dist/components/auto-form/auto-form.js.map +1 -1
  117. package/dist/components/button-dark/button-dark.d.ts.map +1 -1
  118. package/dist/components/button-dark/button-dark.js +39 -8
  119. package/dist/components/button-dark/button-dark.js.map +1 -1
  120. package/dist/components/button-inbox/button-inbox.d.ts +66 -0
  121. package/dist/components/button-inbox/button-inbox.d.ts.map +1 -0
  122. package/dist/components/button-inbox/button-inbox.js +167 -0
  123. package/dist/components/button-inbox/button-inbox.js.map +1 -0
  124. package/dist/components/button-inbox/inbox-unread-atom.d.ts +22 -0
  125. package/dist/components/button-inbox/inbox-unread-atom.d.ts.map +1 -0
  126. package/dist/components/button-inbox/inbox-unread-atom.js +29 -0
  127. package/dist/components/button-inbox/inbox-unread-atom.js.map +1 -0
  128. package/dist/components/button-theme/button-theme.d.ts +4 -3
  129. package/dist/components/button-theme/button-theme.d.ts.map +1 -1
  130. package/dist/components/button-theme/button-theme.js +8 -25
  131. package/dist/components/button-theme/button-theme.js.map +1 -1
  132. package/dist/components/button-user/button-user.d.ts +19 -0
  133. package/dist/components/button-user/button-user.d.ts.map +1 -1
  134. package/dist/components/button-user/button-user.js +1 -1
  135. package/dist/components/button-user/button-user.js.map +1 -1
  136. package/dist/components/control/control.d.ts +51 -0
  137. package/dist/components/control/control.d.ts.map +1 -1
  138. package/dist/components/control/control.js +49 -5
  139. package/dist/components/control/control.js.map +1 -1
  140. package/dist/components/control-array/control-array.js +2 -1
  141. package/dist/components/control-array/control-array.js.map +1 -1
  142. package/dist/components/control-date/control-date.d.ts +27 -0
  143. package/dist/components/control-date/control-date.d.ts.map +1 -1
  144. package/dist/components/control-date/control-date.js +15 -19
  145. package/dist/components/control-date/control-date.js.map +1 -1
  146. package/dist/components/control-date/date-only.d.ts +18 -0
  147. package/dist/components/control-date/date-only.d.ts.map +1 -0
  148. package/dist/components/control-date/date-only.js +29 -0
  149. package/dist/components/control-date/date-only.js.map +1 -0
  150. package/dist/components/control-date-range/control-date-range.d.ts +56 -0
  151. package/dist/components/control-date-range/control-date-range.d.ts.map +1 -0
  152. package/dist/components/control-date-range/control-date-range.js +148 -0
  153. package/dist/components/control-date-range/control-date-range.js.map +1 -0
  154. package/dist/components/control-object/control-object.js +2 -1
  155. package/dist/components/control-object/control-object.js.map +1 -1
  156. package/dist/components/control-select/control-select.d.ts.map +1 -1
  157. package/dist/components/control-select/control-select.js +177 -37
  158. package/dist/components/control-select/control-select.js.map +1 -1
  159. package/dist/components/control-upload/control-upload.d.ts.map +1 -1
  160. package/dist/components/control-upload/control-upload.js +1 -11
  161. package/dist/components/control-upload/control-upload.js.map +1 -1
  162. package/dist/components/detail/detail-aside.d.ts.map +1 -1
  163. package/dist/components/detail/detail-aside.js +4 -3
  164. package/dist/components/detail/detail-aside.js.map +1 -1
  165. package/dist/components/file-image/file-image.js +2 -1
  166. package/dist/components/file-image/file-image.js.map +1 -1
  167. package/dist/components/markdown-view/SpoilerSpan.d.ts +28 -0
  168. package/dist/components/markdown-view/SpoilerSpan.d.ts.map +1 -0
  169. package/dist/components/markdown-view/SpoilerSpan.js +53 -0
  170. package/dist/components/markdown-view/SpoilerSpan.js.map +1 -0
  171. package/dist/components/markdown-view/diagram/layoutSequence.js +13 -23
  172. package/dist/components/markdown-view/diagram/layoutSequence.js.map +1 -1
  173. package/dist/components/markdown-view/diagram/textMetrics.js +2 -2
  174. package/dist/components/markdown-view/diagram/textMetrics.js.map +1 -1
  175. package/dist/components/markdown-view/markdown-view.css +44 -0
  176. package/dist/components/markdown-view/markdown-view.d.ts +12 -0
  177. package/dist/components/markdown-view/markdown-view.d.ts.map +1 -1
  178. package/dist/components/markdown-view/markdown-view.js +22 -1
  179. package/dist/components/markdown-view/markdown-view.js.map +1 -1
  180. package/dist/components/markdown-view/remarkSpoiler.d.ts +17 -0
  181. package/dist/components/markdown-view/remarkSpoiler.d.ts.map +1 -0
  182. package/dist/components/markdown-view/remarkSpoiler.js +117 -0
  183. package/dist/components/markdown-view/remarkSpoiler.js.map +1 -0
  184. package/dist/components/permission-matrix/permission-matrix-group-rows.d.ts +34 -0
  185. package/dist/components/permission-matrix/permission-matrix-group-rows.d.ts.map +1 -0
  186. package/dist/components/permission-matrix/permission-matrix-group-rows.js +109 -0
  187. package/dist/components/permission-matrix/permission-matrix-group-rows.js.map +1 -0
  188. package/dist/components/permission-matrix/permission-matrix.d.ts +145 -0
  189. package/dist/components/permission-matrix/permission-matrix.d.ts.map +1 -0
  190. package/dist/components/permission-matrix/permission-matrix.js +113 -0
  191. package/dist/components/permission-matrix/permission-matrix.js.map +1 -0
  192. package/dist/components/plate-layout/plate-layout.d.ts +5 -0
  193. package/dist/components/plate-layout/plate-layout.d.ts.map +1 -1
  194. package/dist/components/plate-layout/plate-layout.js +2 -1
  195. package/dist/components/plate-layout/plate-layout.js.map +1 -1
  196. package/dist/components/plate-layout/plate-tab-bar.d.ts +10 -0
  197. package/dist/components/plate-layout/plate-tab-bar.d.ts.map +1 -1
  198. package/dist/components/plate-layout/plate-tab-bar.js +1 -1
  199. package/dist/components/plate-layout/plate-tab-bar.js.map +1 -1
  200. package/dist/components/settings/settings-nav.js +2 -1
  201. package/dist/components/settings/settings-nav.js.map +1 -1
  202. package/dist/components/time-ago/time-ago.d.ts +57 -0
  203. package/dist/components/time-ago/time-ago.d.ts.map +1 -0
  204. package/dist/components/time-ago/time-ago.js +60 -0
  205. package/dist/components/time-ago/time-ago.js.map +1 -0
  206. package/dist/components/tree-view/tree-model.d.ts +128 -0
  207. package/dist/components/tree-view/tree-model.d.ts.map +1 -0
  208. package/dist/components/tree-view/tree-model.js +226 -0
  209. package/dist/components/tree-view/tree-model.js.map +1 -0
  210. package/dist/components/tree-view/tree-view-rename-input.d.ts +31 -0
  211. package/dist/components/tree-view/tree-view-rename-input.d.ts.map +1 -0
  212. package/dist/components/tree-view/tree-view-rename-input.js +68 -0
  213. package/dist/components/tree-view/tree-view-rename-input.js.map +1 -0
  214. package/dist/components/tree-view/tree-view-resizer.d.ts +38 -0
  215. package/dist/components/tree-view/tree-view-resizer.d.ts.map +1 -0
  216. package/dist/components/tree-view/tree-view-resizer.js +73 -0
  217. package/dist/components/tree-view/tree-view-resizer.js.map +1 -0
  218. package/dist/components/tree-view/tree-view-row.d.ts +177 -0
  219. package/dist/components/tree-view/tree-view-row.d.ts.map +1 -0
  220. package/dist/components/tree-view/tree-view-row.js +241 -0
  221. package/dist/components/tree-view/tree-view-row.js.map +1 -0
  222. package/dist/components/tree-view/tree-view.d.ts +186 -0
  223. package/dist/components/tree-view/tree-view.d.ts.map +1 -0
  224. package/dist/components/tree-view/tree-view.js +112 -0
  225. package/dist/components/tree-view/tree-view.js.map +1 -0
  226. package/dist/components/tree-view/use-tree-state.d.ts +79 -0
  227. package/dist/components/tree-view/use-tree-state.d.ts.map +1 -0
  228. package/dist/components/tree-view/use-tree-state.js +93 -0
  229. package/dist/components/tree-view/use-tree-state.js.map +1 -0
  230. package/dist/components/ui/button.d.ts.map +1 -1
  231. package/dist/components/ui/button.js +1 -1
  232. package/dist/components/ui/button.js.map +1 -1
  233. package/dist/components/ui/dropdown-menu.js.map +1 -1
  234. package/dist/components/ui/select.d.ts +7 -0
  235. package/dist/components/ui/select.d.ts.map +1 -1
  236. package/dist/components/ui/select.js +7 -0
  237. package/dist/components/ui/select.js.map +1 -1
  238. package/dist/components/ui/sidebar.js +1 -1
  239. package/dist/components/ui/sidebar.js.map +1 -1
  240. package/dist/components/ui/table.js.map +1 -1
  241. package/dist/components/ui/tooltip.js.map +1 -1
  242. package/dist/lib/i18n-fr.d.ts.map +1 -1
  243. package/dist/lib/i18n-fr.js +31 -47
  244. package/dist/lib/i18n-fr.js.map +1 -1
  245. package/dist/lib/utils.d.ts +22 -2
  246. package/dist/lib/utils.d.ts.map +1 -1
  247. package/dist/lib/utils.js +29 -5
  248. package/dist/lib/utils.js.map +1 -1
  249. package/dist/styles.css +255 -0
  250. package/package.json +13 -14
  251. package/src/components/account/__tests__/account-router.spec.ts +95 -0
  252. package/src/components/account/account-connections.tsx +14 -1
  253. package/src/components/account/account-delete-dialog.tsx +3 -2
  254. package/src/components/account/account-keys.tsx +11 -4
  255. package/src/components/account/account-mfa-dialog.tsx +1 -1
  256. package/src/components/account/account-password-dialog.tsx +3 -2
  257. package/src/components/account/account-profile.tsx +1 -1
  258. package/src/components/account/account-router-options.tsx +45 -0
  259. package/src/components/account/account-router-page.tsx +11 -1
  260. package/src/components/account/account-router.tsx +23 -6
  261. package/src/components/admin/__tests__/admin-jobs-payload-dialog.browser.spec.tsx +68 -0
  262. package/src/components/admin/__tests__/admin-notifications-preview-body.browser.spec.tsx +20 -4
  263. package/src/components/admin/__tests__/admin-status-labels.browser.spec.tsx +0 -31
  264. package/src/components/admin/admin-audits.tsx +99 -5
  265. package/src/components/admin/admin-files.tsx +7 -16
  266. package/src/components/admin/admin-jobs-executions-panel.tsx +152 -114
  267. package/src/components/admin/admin-jobs-payload-dialog.tsx +57 -0
  268. package/src/components/admin/admin-keys.tsx +7 -4
  269. package/src/components/admin/admin-notifications-channel-label.ts +18 -0
  270. package/src/components/admin/admin-notifications-preview-body.tsx +7 -2
  271. package/src/components/admin/admin-notifications.tsx +19 -8
  272. package/src/components/admin/admin-payments.tsx +7 -4
  273. package/src/components/admin/admin-router-options.tsx +12 -0
  274. package/src/components/admin/admin-router.tsx +5 -27
  275. package/src/components/admin/admin-sessions.tsx +10 -6
  276. package/src/components/admin/admin-user-detail-audits-tab.tsx +7 -4
  277. package/src/components/admin/admin-user-detail-sessions-tab.tsx +7 -4
  278. package/src/components/admin/admin-users-roles-picker.tsx +4 -0
  279. package/src/components/admin/admin-users.tsx +6 -3
  280. package/src/components/admin/parameter-history-item.tsx +4 -2
  281. package/src/components/alepha-table/__tests__/alepha-table-default-hidden.browser.spec.tsx +108 -0
  282. package/src/components/alepha-table/__tests__/alepha-table-empty-state.browser.spec.tsx +233 -0
  283. package/src/components/alepha-table/__tests__/alepha-table-persist-facets.browser.spec.tsx +177 -0
  284. package/src/components/alepha-table/__tests__/alepha-table-persisted-filters.browser.spec.tsx +182 -0
  285. package/src/components/alepha-table/__tests__/alepha-table-query-seed.browser.spec.tsx +170 -0
  286. package/src/components/alepha-table/__tests__/alepha-table-row-action-checked.browser.spec.tsx +210 -0
  287. package/src/components/alepha-table/__tests__/alepha-table-row-action-group.browser.spec.tsx +202 -0
  288. package/src/components/alepha-table/__tests__/alepha-table-scope.browser.spec.tsx +161 -0
  289. package/src/components/alepha-table/__tests__/alepha-table-share-filters.browser.spec.tsx +309 -0
  290. package/src/components/alepha-table/__tests__/query-filters.spec.ts +212 -0
  291. package/src/components/alepha-table/alepha-table-filter-dialog.tsx +162 -0
  292. package/src/components/alepha-table/alepha-table-filter-menu.tsx +77 -0
  293. package/src/components/alepha-table/alepha-table.tsx +1113 -207
  294. package/src/components/alepha-table/query-filters.ts +159 -0
  295. package/src/components/app-actions/app-actions.tsx +32 -3
  296. package/src/components/app-shell/__tests__/sidebar-nav-accordion.browser.spec.tsx +163 -0
  297. package/src/components/app-shell/app-shell.tsx +255 -12
  298. package/src/components/auto-form/__tests__/auto-form-settings-card.browser.spec.tsx +1 -1
  299. package/src/components/auto-form/auto-form.tsx +98 -30
  300. package/src/components/button-dark/button-dark.tsx +47 -8
  301. package/src/components/button-inbox/__tests__/button-inbox.browser.spec.tsx +247 -0
  302. package/src/components/button-inbox/button-inbox.tsx +303 -0
  303. package/src/components/button-inbox/inbox-unread-atom.ts +27 -0
  304. package/src/components/button-theme/button-theme.tsx +16 -29
  305. package/src/components/button-user/__tests__/button-user-avatar.browser.spec.tsx +88 -0
  306. package/src/components/button-user/button-user.tsx +24 -1
  307. package/src/components/control/__tests__/control-date-range.browser.spec.tsx +177 -0
  308. package/src/components/control/control.tsx +119 -12
  309. package/src/components/control-date/control-date.tsx +117 -22
  310. package/src/components/control-date/date-only.ts +26 -0
  311. package/src/components/control-date-range/control-date-range.tsx +250 -0
  312. package/src/components/control-select/__tests__/control-select-clear-label.browser.spec.tsx +129 -15
  313. package/src/components/control-select/__tests__/control-select-deselect.browser.spec.tsx +27 -6
  314. package/src/components/control-select/__tests__/control-select-multi.browser.spec.tsx +204 -1
  315. package/src/components/control-select/__tests__/control-select-size-minimal.browser.spec.tsx +77 -1
  316. package/src/components/control-select/control-select.tsx +317 -83
  317. package/src/components/control-upload/control-upload.tsx +1 -10
  318. package/src/components/detail/detail-aside.tsx +30 -6
  319. package/src/components/markdown-view/SpoilerSpan.tsx +66 -0
  320. package/src/components/markdown-view/__tests__/markdown-view-spoiler.browser.spec.tsx +165 -0
  321. package/src/components/markdown-view/diagram/textMetrics.spec.ts +1 -1
  322. package/src/components/markdown-view/diagram/textMetrics.ts +2 -2
  323. package/src/components/markdown-view/markdown-view.css +44 -0
  324. package/src/components/markdown-view/markdown-view.tsx +37 -1
  325. package/src/components/markdown-view/remarkSpoiler.ts +150 -0
  326. package/src/components/permission-matrix/__tests__/permission-matrix.browser.spec.tsx +237 -0
  327. package/src/components/permission-matrix/permission-matrix-group-rows.tsx +240 -0
  328. package/src/components/permission-matrix/permission-matrix.tsx +286 -0
  329. package/src/components/plate-layout/__tests__/plate-layout.browser.spec.tsx +22 -0
  330. package/src/components/plate-layout/plate-layout.tsx +6 -0
  331. package/src/components/plate-layout/plate-tab-bar.tsx +27 -1
  332. package/src/components/time-ago/time-ago.browser.spec.tsx +110 -0
  333. package/src/components/time-ago/time-ago.tsx +80 -0
  334. package/src/components/tree-view/__tests__/tree-model.spec.ts +441 -0
  335. package/src/components/tree-view/__tests__/tree-view-drag.browser.spec.tsx +295 -0
  336. package/src/components/tree-view/__tests__/tree-view-rename.browser.spec.tsx +278 -0
  337. package/src/components/tree-view/__tests__/tree-view-resizer.browser.spec.tsx +112 -0
  338. package/src/components/tree-view/__tests__/tree-view.browser.spec.tsx +260 -0
  339. package/src/components/tree-view/__tests__/use-tree-state.browser.spec.tsx +238 -0
  340. package/src/components/tree-view/tree-model.ts +369 -0
  341. package/src/components/tree-view/tree-view-rename-input.tsx +95 -0
  342. package/src/components/tree-view/tree-view-resizer.tsx +83 -0
  343. package/src/components/tree-view/tree-view-row.tsx +414 -0
  344. package/src/components/tree-view/tree-view.tsx +300 -0
  345. package/src/components/tree-view/use-tree-state.ts +184 -0
  346. package/src/components/ui/button.tsx +79 -1
  347. package/src/components/ui/dropdown-menu.tsx +1 -1
  348. package/src/components/ui/select.tsx +7 -0
  349. package/src/components/ui/table.tsx +1 -1
  350. package/src/components/ui/tooltip.tsx +1 -1
  351. package/src/lib/i18n-fr.ts +34 -51
  352. package/src/lib/utils.ts +32 -4
  353. package/src/styles.css +255 -0
  354. package/dist/components/admin/admin-workflows-execution-sheet.d.ts +0 -11
  355. package/dist/components/admin/admin-workflows-execution-sheet.d.ts.map +0 -1
  356. package/dist/components/admin/admin-workflows-execution-sheet.js +0 -190
  357. package/dist/components/admin/admin-workflows-execution-sheet.js.map +0 -1
  358. package/dist/components/admin/admin-workflows-executions-panel.d.ts +0 -9
  359. package/dist/components/admin/admin-workflows-executions-panel.d.ts.map +0 -1
  360. package/dist/components/admin/admin-workflows-executions-panel.js +0 -121
  361. package/dist/components/admin/admin-workflows-executions-panel.js.map +0 -1
  362. package/dist/components/admin/admin-workflows-status-badge.d.ts +0 -12
  363. package/dist/components/admin/admin-workflows-status-badge.d.ts.map +0 -1
  364. package/dist/components/admin/admin-workflows-status-badge.js +0 -30
  365. package/dist/components/admin/admin-workflows-status-badge.js.map +0 -1
  366. package/dist/components/admin/admin-workflows-status-labels.d.ts +0 -19
  367. package/dist/components/admin/admin-workflows-status-labels.d.ts.map +0 -1
  368. package/dist/components/admin/admin-workflows-status-labels.js +0 -48
  369. package/dist/components/admin/admin-workflows-status-labels.js.map +0 -1
  370. package/dist/components/admin/admin-workflows.d.ts +0 -4
  371. package/dist/components/admin/admin-workflows.d.ts.map +0 -1
  372. package/dist/components/admin/admin-workflows.js +0 -145
  373. package/dist/components/admin/admin-workflows.js.map +0 -1
  374. package/src/components/admin/admin-workflows-execution-sheet.tsx +0 -285
  375. package/src/components/admin/admin-workflows-executions-panel.tsx +0 -169
  376. package/src/components/admin/admin-workflows-status-badge.tsx +0 -41
  377. package/src/components/admin/admin-workflows-status-labels.ts +0 -51
  378. package/src/components/admin/admin-workflows.tsx +0 -209
@@ -0,0 +1,286 @@
1
+ import type { IconComponent } from "@alepha/ui/components/control-base/icon-hint";
2
+ import {
3
+ Table,
4
+ TableBody,
5
+ TableHead,
6
+ TableHeader,
7
+ TableRow,
8
+ } from "@alepha/ui/components/ui/table";
9
+ import { cn } from "@alepha/ui/lib/utils";
10
+ import type { ReactNode } from "react";
11
+
12
+ import {
13
+ PermissionMatrixGroupRows,
14
+ permissionChecked,
15
+ } from "./permission-matrix-group-rows.tsx";
16
+
17
+ export interface PermissionMatrixProps {
18
+ /**
19
+ * The rows, already grouped and already filtered.
20
+ *
21
+ * ⚠️ **Filtering is the caller's job.** Lore hides the permissions of a
22
+ * capability that is switched off; Alepha Club has no capability concept and
23
+ * shows all of its groups. A `capabilities` prop here would be a
24
+ * Lore-shaped idea that every other consumer passes `undefined` to forever,
25
+ * so this component renders the groups it is handed and asks nothing about
26
+ * where they came from.
27
+ */
28
+ groups: PermissionMatrixGroup[];
29
+
30
+ /**
31
+ * The columns, left to right. One per rank.
32
+ */
33
+ columns: PermissionMatrixColumn[];
34
+
35
+ /**
36
+ * What each column currently grants, keyed by {@link PermissionMatrixColumn.key}.
37
+ *
38
+ * A column missing from the record grants nothing, which is the same thing
39
+ * as an empty array - a caller building this from a server response does not
40
+ * have to fill in the ranks that hold no permission.
41
+ */
42
+ value: Record<string, readonly string[]>;
43
+
44
+ /**
45
+ * Called with the WHOLE record on every tick, not with a delta.
46
+ *
47
+ * The caller owns the save, so the module's refusals ("that set is wider
48
+ * than your own") arrive as ordinary form errors on the page rather than as
49
+ * a state this component would have to model.
50
+ */
51
+ onChange: (next: Record<string, string[]>) => void;
52
+
53
+ /**
54
+ * Header above the permission column. A label, not a placeholder: the
55
+ * component carries no copy of its own.
56
+ */
57
+ header?: ReactNode;
58
+
59
+ /**
60
+ * Shown in place of the table when {@link groups} is empty - every
61
+ * capability off, or a filter that matched nothing.
62
+ */
63
+ empty?: ReactNode;
64
+
65
+ /**
66
+ * Turns every cell off, on top of whatever the columns and rows say.
67
+ * A save in flight, or a reader who may look and not edit.
68
+ */
69
+ disabled?: boolean;
70
+
71
+ className?: string;
72
+ }
73
+
74
+ /**
75
+ * Who may do what, as a table: permissions down the left, one column per rank,
76
+ * a checkbox at each crossing.
77
+ *
78
+ * It lives here rather than in either application because two of them need the
79
+ * same table. Lore renders it for a project's ranks; Alepha Club renders it for
80
+ * the club's. What differs between them is entirely in the props.
81
+ *
82
+ * ## What the component deliberately does not know
83
+ *
84
+ * **It does not know what an owner is.** A column that must read all-on and
85
+ * refuse edits is marked `readOnly` by the caller. Teaching the table about
86
+ * ownership would put an application's model inside a component that two
87
+ * applications with different models both use.
88
+ *
89
+ * **It does not know what a capability is.** See {@link PermissionMatrixProps.groups}.
90
+ *
91
+ * **It carries no copy.** Every label is a `ReactNode` the caller supplies,
92
+ * already translated, so an application whose only locale is French renders a
93
+ * French matrix without this package shipping a catalogue.
94
+ *
95
+ * ## The two kinds of locked row
96
+ *
97
+ * A permission can be non-negotiable in either direction, and both are common
98
+ * enough to be data rather than a caller's own rendering:
99
+ *
100
+ * - `lock: "on"` is a **floor** - the permission every rank holds, so the row
101
+ * is checked everywhere and cannot be unticked (Lore's `project:read`: a
102
+ * member who cannot read the project is not a member).
103
+ * - `lock: "off"` is a **ceiling** - the permission no rank may be granted, so
104
+ * the row is unchecked everywhere and cannot be ticked (Lore's
105
+ * `project:delete`, which belongs to ownership and is transferred rather
106
+ * than granted).
107
+ *
108
+ * A `readOnly` column beats both: an owner column reads all-on including the
109
+ * ceiling rows, because the ceiling describes what may be GRANTED, not what
110
+ * the owner has.
111
+ */
112
+ export const PermissionMatrix = (props: PermissionMatrixProps) => {
113
+ const granted = (columnKey: string, permission: string): boolean =>
114
+ (props.value[columnKey] ?? []).includes(permission);
115
+
116
+ const toggle = (
117
+ columnKey: string,
118
+ permission: string,
119
+ next: boolean,
120
+ ): void => {
121
+ const held = props.value[columnKey] ?? [];
122
+ const without = held.filter((it) => it !== permission);
123
+
124
+ props.onChange({
125
+ // Every column, not only the one that moved: the caller saves a record
126
+ // and a partial one would silently drop the ranks nobody touched.
127
+ ...Object.fromEntries(
128
+ Object.entries(props.value).map(([key, list]) => [key, [...list]]),
129
+ ),
130
+ [columnKey]: next ? [...without, permission] : without,
131
+ });
132
+ };
133
+
134
+ if (props.groups.length === 0) {
135
+ return (
136
+ <div className="text-muted-foreground p-6 text-center text-sm">
137
+ {props.empty}
138
+ </div>
139
+ );
140
+ }
141
+
142
+ // Every row in the table, in order, so a column's coverage is counted over
143
+ // the same set the reader can see. Filtering is the caller's job, so a group
144
+ // that is switched off is not in `groups` and correctly does not count
145
+ // against the ratio.
146
+ const rows = props.groups.flatMap((group) => group.permissions);
147
+
148
+ const coverageOf = (column: PermissionMatrixColumn): number =>
149
+ rows.filter((row) => permissionChecked(column, row, granted)).length;
150
+
151
+ return (
152
+ <div className={cn("w-full overflow-x-auto", props.className)}>
153
+ <Table>
154
+ {/* The chrome surface, sticky, so a long matrix keeps its rank names
155
+ while it scrolls. `bg-muted` fully opaque and the two inset lines
156
+ are the same pair `AlephaTable`'s header wears, and for the same
157
+ reasons: a translucent header lets rows scroll through the labels,
158
+ and a border on a sticky `<thead>` is dropped by the collapsed
159
+ border model. */}
160
+ <TableHeader className="bg-muted sticky top-0 z-10 shadow-[inset_0_1px_0_0_var(--bevel),inset_0_-1px_0_0_var(--border)]">
161
+ <TableRow className="hover:bg-transparent">
162
+ <TableHead className="min-w-56 align-bottom">
163
+ {props.header}
164
+ </TableHead>
165
+ {props.columns.map((column) => {
166
+ const held = coverageOf(column);
167
+
168
+ return (
169
+ <TableHead
170
+ key={column.key}
171
+ className="border-border/60 h-auto min-w-36 border-l py-2 text-center align-bottom"
172
+ >
173
+ <div className="flex flex-col items-center gap-1">
174
+ <span className="font-medium">{column.label}</span>
175
+ {/* The caller's own line and the ratio share one row.
176
+ The ratio is a count, not copy, which is what lets this
177
+ component print it while still shipping no strings:
178
+ `description` carries whatever the application wants
179
+ said ("1 membre"), and the separator is punctuation. */}
180
+ <span className="text-muted-foreground text-xs font-normal">
181
+ {column.description ? <>{column.description} · </> : null}
182
+ {held}/{rows.length}
183
+ </span>
184
+ {/* Decorative, and `aria-hidden` for it: the ratio above
185
+ is the same fact in text, and four `role="progressbar"`
186
+ elements announcing a number already read out is noise,
187
+ not access. */}
188
+ <div
189
+ aria-hidden
190
+ className="bg-foreground/10 h-1 w-16 overflow-hidden rounded-full"
191
+ >
192
+ <div
193
+ className="bg-primary h-full rounded-full transition-[width]"
194
+ style={{
195
+ width: `${rows.length === 0 ? 0 : (held / rows.length) * 100}%`,
196
+ }}
197
+ />
198
+ </div>
199
+ </div>
200
+ </TableHead>
201
+ );
202
+ })}
203
+ </TableRow>
204
+ </TableHeader>
205
+ <TableBody>
206
+ {props.groups.map((group) => (
207
+ <PermissionMatrixGroupRows
208
+ key={group.key}
209
+ group={group}
210
+ columns={props.columns}
211
+ disabled={props.disabled === true}
212
+ granted={granted}
213
+ toggle={toggle}
214
+ />
215
+ ))}
216
+ </TableBody>
217
+ </Table>
218
+ </div>
219
+ );
220
+ };
221
+
222
+ export interface PermissionMatrixGroup {
223
+ /**
224
+ * Stable identity for the group. Never rendered: {@link label} is.
225
+ */
226
+ key: string;
227
+
228
+ label: ReactNode;
229
+
230
+ /**
231
+ * Shown before the label on the heading row. A subject is quicker to find
232
+ * again by its mark than by re-reading four uppercase words, and the heading
233
+ * row is the only thing a reader scans past on the way down a long matrix.
234
+ *
235
+ * Optional, and a group without one simply starts at its label - the heading
236
+ * does not reserve the space, so a matrix that gives icons to none of its
237
+ * groups looks deliberate rather than short of something.
238
+ */
239
+ icon?: IconComponent;
240
+
241
+ permissions: PermissionMatrixRow[];
242
+ }
243
+
244
+ export interface PermissionMatrixRow {
245
+ /**
246
+ * The permission as it is stored and sent, e.g. `quest:create`. This is the
247
+ * value that lands in {@link PermissionMatrixProps.value}.
248
+ */
249
+ name: string;
250
+
251
+ label: ReactNode;
252
+
253
+ /**
254
+ * Supplementary prose, shown as a tooltip on the label rather than as a
255
+ * line of its own: the line under the label is the permission's stored name,
256
+ * which every row has, and a third line would loosen the whole table for the
257
+ * few rows that carry one.
258
+ */
259
+ description?: ReactNode;
260
+
261
+ /**
262
+ * Pins this row in one state on every column. See the component's doc for
263
+ * why a floor and a ceiling are both worth expressing.
264
+ */
265
+ lock?: "on" | "off";
266
+ }
267
+
268
+ export interface PermissionMatrixColumn {
269
+ /**
270
+ * The key this column's grants are stored under in
271
+ * {@link PermissionMatrixProps.value}. A rank key, for both consumers.
272
+ */
273
+ key: string;
274
+
275
+ label: ReactNode;
276
+
277
+ description?: ReactNode;
278
+
279
+ /**
280
+ * All-on and not editable.
281
+ *
282
+ * The caller marks it; the component does not know what an owner is, or that
283
+ * such a column exists at all until it is handed one.
284
+ */
285
+ readOnly?: boolean;
286
+ }
@@ -57,6 +57,28 @@ describe("PlateLayout", () => {
57
57
  expect(view.getByRole("heading", { name: "0.28.0" })).toBeTruthy();
58
58
  expect(view.getByText("body")).toBeTruthy();
59
59
  expect(view.getByTestId("probe-tabs")).toBeTruthy();
60
+ // The rule that separates the tabs from the plate above them.
61
+ expect(view.getByTestId("probe-tabs").className).toContain("border-t");
62
+ });
63
+
64
+ /**
65
+ * `plate` has always been optional and had never been exercised, which is
66
+ * how the tab bar's top rule came to be unconditional: with no plate it
67
+ * drew a stray line immediately under the container's own top edge
68
+ * (feedback #2095, found by Reports dropping a plate that only reprinted
69
+ * its breadcrumb leaf).
70
+ */
71
+ it("drops the tab bar's top rule when there is no plate", async () => {
72
+ const view = await mount(
73
+ <PlateLayout tabs={stateTabs} active="overview" tabsTestId="probe-tabs">
74
+ <p>body</p>
75
+ </PlateLayout>,
76
+ );
77
+
78
+ expect(view.getByTestId("probe-tabs").className).not.toContain("border-t");
79
+ // The tabs themselves are unchanged: still there, still the right height.
80
+ expect(view.getByRole("tab", { name: "Overview" })).toBeTruthy();
81
+ expect(view.getByText("body")).toBeTruthy();
60
82
  });
61
83
 
62
84
  it("calls back with the tab key when a stateful tab is pressed", async () => {
@@ -13,6 +13,11 @@ export interface PlateLayoutProps {
13
13
  * A slot rather than props, because there is no shape common to a release's
14
14
  * tag and progress bar, a project's reporting period and an enrolled app's
15
15
  * address. What the layout owns is the band, not its contents.
16
+ *
17
+ * Optional, and genuinely so since feedback #2095: a page whose plate would
18
+ * only reprint what the breadcrumb leaf already says is better without one.
19
+ * Omitting it also drops the tab bar's top rule, which exists to separate
20
+ * the tabs from the plate and has nothing to separate them from otherwise.
16
21
  */
17
22
  plate?: ReactNode;
18
23
  tabs: PlateTab[];
@@ -66,6 +71,7 @@ export const PlateLayout = (props: PlateLayoutProps) => (
66
71
  active={props.active}
67
72
  onSelect={props.onSelect}
68
73
  testId={props.tabsTestId}
74
+ divided={props.plate !== undefined}
69
75
  />
70
76
  </div>
71
77
 
@@ -46,6 +46,16 @@ export interface PlateTabBarProps {
46
46
  * BODIES too, and "Settings" is also a project-level nav entry.
47
47
  */
48
48
  testId?: string;
49
+ /**
50
+ * Whether to rule off the top edge. Default `true`.
51
+ *
52
+ * The line separates the tabs from the plate above them, so it is only
53
+ * right when there IS one. `PlateLayout` derives this from its own `plate`
54
+ * slot; a bar with no plate above it would otherwise draw a stray line
55
+ * immediately under the container's top edge, which is what a caller
56
+ * omitting the plate for the first time discovered (feedback #2095).
57
+ */
58
+ divided?: boolean;
49
59
  }
50
60
 
51
61
  /**
@@ -67,7 +77,23 @@ export const PlateTabBar = (props: PlateTabBarProps) => {
67
77
  return (
68
78
  <div
69
79
  data-testid={props.testId}
70
- className="border-border/60 flex gap-5 border-t px-6"
80
+ className={cn(
81
+ // The table header's surface, and for the same reason: this strip is
82
+ // chrome, not body. `bg-muted` under a `--bevel` line laid just inside
83
+ // the top edge - two adjacent lines of opposite polarity read as a
84
+ // fold - so the band looks raised out of the page rather than painted
85
+ // onto it. Opaque like the sticky table header, not the base header's
86
+ // `bg-muted/50`: the plate above is already translucent over the page,
87
+ // and stacking a second wash on it makes the two bands differ by a
88
+ // couple of percent instead of reading as one raised object.
89
+ //
90
+ // The border above the bevel is whichever line closes the top edge:
91
+ // the bar's own `border-t` when there is a plate, and the shell
92
+ // header's bottom border when there is not. Both are `--border`, so
93
+ // the fold reads the same either way.
94
+ "bg-muted border-border flex gap-5 px-6 shadow-[inset_0_1px_0_0_var(--bevel)]",
95
+ props.divided !== false && "border-t",
96
+ )}
71
97
  role={navigates ? "navigation" : "tablist"}
72
98
  >
73
99
  {props.tabs.map((tab) => {
@@ -0,0 +1,110 @@
1
+ import { render, screen } from "@testing-library/react";
2
+ import { Alepha } from "alepha";
3
+ import { DateTimeProvider } from "alepha/datetime";
4
+ import { AlephaContext, AlephaReact } from "alepha/react";
5
+ import { AlephaReactI18n, I18nProvider } from "alepha/react/i18n";
6
+ import { renderToString } from "react-dom/server";
7
+ import { afterEach, describe, expect, it } from "vitest";
8
+
9
+ import TimeAgo from "./time-ago.tsx";
10
+
11
+ /**
12
+ * The two halves of what this component exists for: a relative label a reader
13
+ * can act on, and a server render that does not depend on the clock.
14
+ *
15
+ * The second is the one that cannot be checked by looking. A `fromNow()`
16
+ * string is computed from the current time, so a component that renders it on
17
+ * the server produces different HTML on each side of hydration and React
18
+ * throws #418 - a mismatch that surfaces as a console error on a page that
19
+ * otherwise looks correct. Asserting it here is how the guard stays inside the
20
+ * component instead of being remembered at each call site, which is what the
21
+ * 11-guards-against-42-call-sites count showed does not happen.
22
+ */
23
+ describe("TimeAgo", () => {
24
+ let alepha: Alepha | undefined;
25
+
26
+ afterEach(async () => {
27
+ await alepha?.stop();
28
+ alepha = undefined;
29
+ });
30
+
31
+ const setup = async () => {
32
+ alepha = Alepha.create().with(AlephaReact).with(AlephaReactI18n);
33
+ await alepha.start();
34
+ await alepha.inject(I18nProvider).setLang("en");
35
+ // Pinned, so "an hour ago" cannot become "2 hours ago" between the arrange
36
+ // and the assert.
37
+ const dateTime = alepha.inject(DateTimeProvider);
38
+ dateTime.pause();
39
+
40
+ return { alepha, dateTime };
41
+ };
42
+
43
+ it("renders the exact datetime on the server, never the relative one", async () => {
44
+ const { alepha, dateTime } = await setup();
45
+ const anHourAgo = dateTime.of(dateTime.now()).subtract(1, "hour").toDate();
46
+
47
+ const html = renderToString(
48
+ <AlephaContext value={alepha}>
49
+ <TimeAgo value={anHourAgo} />
50
+ </AlephaContext>,
51
+ );
52
+
53
+ // The server has no business guessing what "now" will be when this
54
+ // hydrates. It renders the instant.
55
+ expect(html).not.toContain("ago");
56
+ expect(html).toContain(String(dateTime.of(anHourAgo).format("lll")));
57
+ });
58
+
59
+ it("carries the exact datetime as its title, on both sides", async () => {
60
+ const { alepha, dateTime } = await setup();
61
+ const anHourAgo = dateTime.of(dateTime.now()).subtract(1, "hour").toDate();
62
+ const exact = String(dateTime.of(anHourAgo).format("lll"));
63
+
64
+ expect(
65
+ renderToString(
66
+ <AlephaContext value={alepha}>
67
+ <TimeAgo value={anHourAgo} />
68
+ </AlephaContext>,
69
+ ),
70
+ ).toContain(`title="${exact}"`);
71
+
72
+ render(
73
+ <AlephaContext value={alepha}>
74
+ <TimeAgo value={anHourAgo} />
75
+ </AlephaContext>,
76
+ );
77
+ expect(screen.getByTitle(exact)).toBeDefined();
78
+ });
79
+
80
+ it("reads as time ago once mounted", async () => {
81
+ const { alepha, dateTime } = await setup();
82
+ const anHourAgo = dateTime.of(dateTime.now()).subtract(1, "hour").toDate();
83
+
84
+ render(
85
+ <AlephaContext value={alepha}>
86
+ <TimeAgo value={anHourAgo} />
87
+ </AlephaContext>,
88
+ );
89
+
90
+ expect(screen.getByText(/ago$/)).toBeDefined();
91
+ });
92
+
93
+ it("puts the caller's className on the element that carries the title", async () => {
94
+ const { alepha, dateTime } = await setup();
95
+ const exact = String(dateTime.of(dateTime.now()).format("lll"));
96
+
97
+ render(
98
+ <AlephaContext value={alepha}>
99
+ <TimeAgo value={dateTime.now()} className="text-muted-foreground" />
100
+ </AlephaContext>,
101
+ );
102
+
103
+ // One element, not a class on a wrapper around a titled child: the sweep
104
+ // collapsed the span that used to carry the class, so a caller that passes
105
+ // one must get it on the thing it wraps.
106
+ expect(screen.getByTitle(exact).className).toContain(
107
+ "text-muted-foreground",
108
+ );
109
+ });
110
+ });
@@ -0,0 +1,80 @@
1
+ import type { DateTime } from "alepha/datetime";
2
+ import { ClientOnly } from "alepha/react";
3
+ import { useI18n } from "alepha/react/i18n";
4
+
5
+ export interface TimeAgoProps {
6
+ /**
7
+ * The instant. The same set `useI18n().l()` takes, `DateTime` included -
8
+ * `DateTimeProvider.now()` returns one, so a narrower type here would make
9
+ * the component unusable from exactly the place that owns the clock.
10
+ */
11
+ value: string | number | Date | DateTime;
12
+
13
+ /**
14
+ * The exact form, shown on hover and rendered on the server.
15
+ *
16
+ * ⚠️ A dayjs format string, not an `Intl` options bag.
17
+ * `I18nLocalizeOptions` has `date` and `number` only - there is no `time` -
18
+ * so `lll` is how a date AND a time are asked for.
19
+ */
20
+ format?: string;
21
+
22
+ className?: string;
23
+ }
24
+
25
+ /**
26
+ * An instant, read as "2 hours ago", with the exact datetime on hover.
27
+ *
28
+ * ## Why a component and not a fifth spelling
29
+ *
30
+ * There were four ways to write this - `dt.of(x).fromNow()`,
31
+ * `dateFormatter.of(x).fromNow()`, `l(x, { date: "fromNow" })` and
32
+ * `<Localize value={x} date="fromNow" />` - and **none of them carried the
33
+ * exact date**. A tooltip added by hand is a tooltip added to some call sites
34
+ * and forgotten on the rest, which is what the Apps table's Last seen column
35
+ * demonstrated by rendering four rows of `Sep 9, 2026 7:00 PM` and making the
36
+ * reader subtract dates to see whether a copy was alive (feedback #P2174).
37
+ *
38
+ * ## ⚠️ The SSR guard is built in, and that is the point
39
+ *
40
+ * A `fromNow()` string is computed from the clock, so it differs between the
41
+ * server render and hydration and trips React #418. Before this component
42
+ * there were 11 `ClientOnly` guards against 42 relative-time call sites: most
43
+ * were simply unguarded. Putting the guard inside means the next call site
44
+ * cannot forget it.
45
+ *
46
+ * The server renders the EXACT datetime rather than nothing. A crawler, a
47
+ * reader with no JavaScript and the first paint all get a true answer instead
48
+ * of a blank, which matters on `/:projectSlug/roadmap` - the one page Lore
49
+ * server-renders for an audience that may never run the client. The visible
50
+ * swap on hydration is the price, and it is a swap from correct to more
51
+ * readable.
52
+ *
53
+ * ## Where NOT to use it
54
+ *
55
+ * A date somebody CHOSE, rather than one that happened: a release target
56
+ * date, a quest due date. "in 3 months" is not a deadline anyone can plan
57
+ * against, and the relative form actively destroys the information. Relative
58
+ * time is for events - created, updated, last seen, last reported - where the
59
+ * question is "how stale is this" and the answer is the gap, not the date.
60
+ */
61
+ const TimeAgo = (props: TimeAgoProps) => {
62
+ const { l } = useI18n();
63
+ const exact = String(l(props.value, { date: props.format ?? "lll" }));
64
+
65
+ return (
66
+ <ClientOnly
67
+ fallback={
68
+ <span className={props.className} title={exact}>
69
+ {exact}
70
+ </span>
71
+ }
72
+ >
73
+ <span className={props.className} title={exact}>
74
+ {String(l(props.value, { date: "fromNow" }))}
75
+ </span>
76
+ </ClientOnly>
77
+ );
78
+ };
79
+
80
+ export default TimeAgo;