@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,167 @@
1
+ import { cn } from "../../lib/utils.js";
2
+ import { Button } from "../ui/button.js";
3
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
4
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "../ui/dropdown-menu.js";
5
+ import { inboxUnreadAtom } from "./inbox-unread-atom.js";
6
+ import { useCallback, useEffect, useState } from "react";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ import { Bell } from "lucide-react";
9
+ import { DateTimeProvider } from "alepha/datetime";
10
+ import { useClient, useInject, useStore } from "alepha/react";
11
+ //#region src/components/button-inbox/button-inbox.tsx
12
+ /**
13
+ * The bell: an unread count, and the most recent messages behind it.
14
+ *
15
+ * ## It decides for itself whether it has anything to offer
16
+ *
17
+ * `countInbox.can()` is the gate, and it is a **registry lookup, not a
18
+ * request**: `/api/_links` carries only the actions the server actually
19
+ * registered, and it prunes every `$secure()` one for an anonymous caller.
20
+ * So this renders nothing both when the app has not registered
21
+ * `alepha/api/notifications` and when nobody is signed in, with no 404 fired
22
+ * on every page load. `AccountRouter` gates its five pages the same way.
23
+ *
24
+ * ## ⚠️ The scope chip is a label the message carries, never a parsed scope
25
+ *
26
+ * `scope` is an app-owned opaque string (`project:65`) and this component has
27
+ * no way to turn one into a name - nor should it learn. The message carries
28
+ * `scopeLabel`, written by whoever pushed it and frozen at that moment. Null
29
+ * means no chip.
30
+ */
31
+ const ButtonInbox = (props) => {
32
+ const api = useClient();
33
+ const dt = useInject(DateTimeProvider);
34
+ const [unread, setUnread] = useStore(inboxUnreadAtom);
35
+ const [items, setItems] = useState([]);
36
+ const available = api.countInbox.can();
37
+ const limit = props.limit ?? 5;
38
+ const refreshCount = useCallback(async () => {
39
+ if (!available) return;
40
+ try {
41
+ const result = await api.countInbox({ query: {} });
42
+ setUnread({ count: result.unread });
43
+ } catch {
44
+ setUnread({ count: 0 });
45
+ }
46
+ }, [api, available]);
47
+ useEffect(() => {
48
+ if (!available) return;
49
+ if (unread.count === 0) refreshCount();
50
+ const onFocus = () => void refreshCount();
51
+ window.addEventListener("focus", onFocus);
52
+ return () => window.removeEventListener("focus", onFocus);
53
+ }, [available, refreshCount]);
54
+ const load = async () => {
55
+ if (!available) return;
56
+ try {
57
+ const page = await api.listInbox({ query: { limit } });
58
+ setItems(page.items);
59
+ setUnread({ count: page.unreadCount });
60
+ } catch {
61
+ setItems([]);
62
+ }
63
+ };
64
+ const open = async (row) => {
65
+ if (!row.readAt) try {
66
+ await api.markInboxRead({ params: { id: row.id } });
67
+ setUnread({ count: Math.max(0, unread.count - 1) });
68
+ } catch {}
69
+ navigate(props, row.href);
70
+ };
71
+ const markAllRead = async () => {
72
+ try {
73
+ await api.markAllInboxRead({ query: {} });
74
+ } finally {
75
+ setUnread({ count: 0 });
76
+ setItems((current) => current.map((it) => ({
77
+ ...it,
78
+ readAt: it.readAt ?? "read"
79
+ })));
80
+ }
81
+ };
82
+ if (!available) return null;
83
+ const label = props.labels?.inbox ?? "Notifications";
84
+ const count = unread.count;
85
+ return /* @__PURE__ */ jsxs(DropdownMenu, {
86
+ onOpenChange: (next) => next && void load(),
87
+ children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsxs(TooltipTrigger, {
88
+ render: /* @__PURE__ */ jsx(DropdownMenuTrigger, { render: /* @__PURE__ */ jsx(Button, {
89
+ variant: props.variant ?? "ghost",
90
+ size: "icon",
91
+ "aria-label": label,
92
+ className: "relative"
93
+ }) }),
94
+ children: [/* @__PURE__ */ jsx(Bell, { className: "size-4" }), count > 0 && /* @__PURE__ */ jsx("span", {
95
+ "data-testid": "inbox-badge",
96
+ className: "bg-destructive text-destructive-foreground absolute -top-0.5 -right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[10px] leading-none font-medium",
97
+ children: count > 99 ? "99+" : count
98
+ })]
99
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: label })] }), /* @__PURE__ */ jsx(DropdownMenuContent, {
100
+ align: "end",
101
+ className: "w-80",
102
+ children: /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [
103
+ /* @__PURE__ */ jsxs(DropdownMenuLabel, {
104
+ className: "flex items-center justify-between gap-2",
105
+ children: [/* @__PURE__ */ jsx("span", { children: props.labels?.heading ?? "Notifications" }), count > 0 && /* @__PURE__ */ jsx("button", {
106
+ type: "button",
107
+ className: "text-muted-foreground hover:text-foreground text-xs font-normal",
108
+ onClick: (event) => {
109
+ event.preventDefault();
110
+ event.stopPropagation();
111
+ markAllRead();
112
+ },
113
+ children: props.labels?.markAllRead ?? "Mark all read"
114
+ })]
115
+ }),
116
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
117
+ items.length === 0 ? /* @__PURE__ */ jsx("p", {
118
+ className: "text-muted-foreground px-2 py-6 text-center text-sm",
119
+ children: props.labels?.empty ?? "Nothing new"
120
+ }) : items.map((row) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
121
+ className: "flex flex-col items-start gap-0.5",
122
+ onClick: () => void open(row),
123
+ children: [/* @__PURE__ */ jsxs("span", {
124
+ className: "flex w-full items-center gap-2",
125
+ children: [!row.readAt && /* @__PURE__ */ jsx("span", {
126
+ "data-testid": "inbox-unread-dot",
127
+ className: "bg-primary size-1.5 shrink-0 rounded-full"
128
+ }), /* @__PURE__ */ jsx("span", {
129
+ className: cn("flex-1 truncate text-sm", !row.readAt && "font-medium"),
130
+ children: row.title
131
+ })]
132
+ }), /* @__PURE__ */ jsxs("span", {
133
+ className: "text-muted-foreground flex w-full items-center gap-2 text-xs",
134
+ children: [/* @__PURE__ */ jsx("span", { children: dt.of(row.createdAt).fromNow() }), row.scopeLabel && /* @__PURE__ */ jsx("span", {
135
+ className: "bg-muted ml-auto rounded px-1.5 py-0.5",
136
+ children: row.scopeLabel
137
+ })]
138
+ })]
139
+ }, row.id)),
140
+ props.seeAllHref && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DropdownMenuSeparator, {}), /* @__PURE__ */ jsx(DropdownMenuItem, {
141
+ onClick: () => navigate(props, props.seeAllHref),
142
+ className: "justify-center text-sm",
143
+ children: props.labels?.seeAll ?? "See all"
144
+ })] })
145
+ ] })
146
+ })]
147
+ });
148
+ };
149
+ /**
150
+ * Follow a message's destination.
151
+ *
152
+ * `onOpen` is what a router app passes; without one this is a full
153
+ * navigation, which is correct for a host that has no router in scope.
154
+ * `assign()` rather than writing `location.href`, because the href is not a
155
+ * variable this component owns.
156
+ */
157
+ const navigate = (props, href) => {
158
+ if (props.onOpen) {
159
+ props.onOpen(href);
160
+ return;
161
+ }
162
+ if (typeof window !== "undefined") window.location.assign(href);
163
+ };
164
+ //#endregion
165
+ export { ButtonInbox };
166
+
167
+ //# sourceMappingURL=button-inbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-inbox.js","names":[],"sources":["../../../src/components/button-inbox/button-inbox.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { inboxUnreadAtom } from \"@alepha/ui/components/button-inbox/inbox-unread-atom.ts\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport type { NotificationInboxController } from \"alepha/api/notifications\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { useClient, useInject, useStore } from \"alepha/react\";\nimport { Bell } from \"lucide-react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\nexport interface ButtonInboxProps {\n /**\n * Where \"See all\" goes. `@alepha/ui` cannot know an application's routes,\n * so the destination is the surface's to decide; the footer is hidden when\n * it is absent.\n *\n * ⚠️ It should point at the **unfiltered** list. This dropdown lists\n * messages from every scope, so a footer landing on a filtered view shows\n * fewer rows than the menu it was clicked out of.\n */\n seeAllHref?: string;\n /**\n * How many messages the dropdown lists. Five is the shape the design\n * settled on: enough to recognise what happened, short enough to read\n * without scrolling.\n */\n limit?: number;\n /**\n * Labels, for an application that localises its chrome. Each falls back to\n * its English default.\n *\n * They are this component's own props rather than entries in a shared\n * cluster's `labels` bag, because the surface that mounts the bell is the\n * one that has a translator in hand.\n */\n labels?: {\n /**\n * The trigger's `aria-label` and tooltip. Defaults to `\"Notifications\"`.\n */\n inbox?: string;\n heading?: string;\n empty?: string;\n markAllRead?: string;\n seeAll?: string;\n };\n variant?: \"ghost\" | \"outline\";\n /**\n * Called with the message's `href` when a row is clicked, after it has\n * been marked read. Defaults to a full navigation, which is correct for an\n * app with no router in scope and wrong for one that has it - so a router\n * app passes its own push.\n */\n onOpen?: (href: string) => void;\n}\n\ninterface InboxRow {\n id: string;\n title: string;\n href: string;\n createdAt: string;\n readAt?: string;\n scopeLabel?: string;\n}\n\n/**\n * The bell: an unread count, and the most recent messages behind it.\n *\n * ## It decides for itself whether it has anything to offer\n *\n * `countInbox.can()` is the gate, and it is a **registry lookup, not a\n * request**: `/api/_links` carries only the actions the server actually\n * registered, and it prunes every `$secure()` one for an anonymous caller.\n * So this renders nothing both when the app has not registered\n * `alepha/api/notifications` and when nobody is signed in, with no 404 fired\n * on every page load. `AccountRouter` gates its five pages the same way.\n *\n * ## ⚠️ The scope chip is a label the message carries, never a parsed scope\n *\n * `scope` is an app-owned opaque string (`project:65`) and this component has\n * no way to turn one into a name - nor should it learn. The message carries\n * `scopeLabel`, written by whoever pushed it and frozen at that moment. Null\n * means no chip.\n */\nexport const ButtonInbox = (props: ButtonInboxProps) => {\n const api = useClient<NotificationInboxController>();\n const dt = useInject(DateTimeProvider);\n const [unread, setUnread] = useStore(inboxUnreadAtom);\n const [items, setItems] = useState<InboxRow[]>([]);\n\n const available = api.countInbox.can();\n const limit = props.limit ?? 5;\n\n const refreshCount = useCallback(async () => {\n if (!available) return;\n try {\n const result = await api.countInbox({ query: {} });\n setUnread({ count: result.unread });\n } catch {\n // A bell that throws takes the header with it. A count nobody could\n // read is zero, and the badge disappears.\n setUnread({ count: 0 });\n }\n }, [api, available]);\n\n useEffect(() => {\n if (!available) return;\n // A fallback, not the primary read: a host whose route loader already\n // seeded the atom has a count before the first paint, and this only\n // covers the case where that call failed or never ran.\n if (unread.count === 0) {\n void refreshCount();\n }\n // Staleness, not coverage. A message arriving while somebody sits on one\n // page is invisible until they navigate, and this is the only thing that\n // changes that.\n const onFocus = () => void refreshCount();\n window.addEventListener(\"focus\", onFocus);\n return () => window.removeEventListener(\"focus\", onFocus);\n }, [available, refreshCount]);\n\n const load = async () => {\n if (!available) return;\n try {\n const page = await api.listInbox({ query: { limit } });\n setItems(page.items as InboxRow[]);\n setUnread({ count: page.unreadCount });\n } catch {\n setItems([]);\n }\n };\n\n const open = async (row: InboxRow) => {\n if (!row.readAt) {\n try {\n await api.markInboxRead({ params: { id: row.id } });\n setUnread({ count: Math.max(0, unread.count - 1) });\n } catch {\n // Opening the message matters more than recording that it was read.\n }\n }\n navigate(props, row.href);\n };\n\n const markAllRead = async () => {\n try {\n await api.markAllInboxRead({ query: {} });\n } finally {\n setUnread({ count: 0 });\n setItems((current) =>\n current.map((it) => ({ ...it, readAt: it.readAt ?? \"read\" })),\n );\n }\n };\n\n if (!available) {\n return null;\n }\n\n const label = props.labels?.inbox ?? \"Notifications\";\n const count = unread.count;\n\n return (\n <DropdownMenu onOpenChange={(next) => next && void load()}>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={label}\n className=\"relative\"\n />\n }\n />\n }\n >\n <Bell className=\"size-4\" />\n {count > 0 && (\n // Filled and in the destructive colour, not a subtle dot: the\n // whole point of the control is that an unread message is not\n // easy to miss.\n <span\n data-testid=\"inbox-badge\"\n className=\"bg-destructive text-destructive-foreground absolute -top-0.5 -right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[10px] leading-none font-medium\"\n >\n {count > 99 ? \"99+\" : count}\n </span>\n )}\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-80\">\n <DropdownMenuGroup>\n <DropdownMenuLabel className=\"flex items-center justify-between gap-2\">\n <span>{props.labels?.heading ?? \"Notifications\"}</span>\n {count > 0 && (\n <button\n type=\"button\"\n className=\"text-muted-foreground hover:text-foreground text-xs font-normal\"\n onClick={(event) => {\n // The menu must not close: marking read is a change to what\n // is on screen, and the reader is still reading it.\n event.preventDefault();\n event.stopPropagation();\n void markAllRead();\n }}\n >\n {props.labels?.markAllRead ?? \"Mark all read\"}\n </button>\n )}\n </DropdownMenuLabel>\n <DropdownMenuSeparator />\n {items.length === 0 ? (\n <p className=\"text-muted-foreground px-2 py-6 text-center text-sm\">\n {props.labels?.empty ?? \"Nothing new\"}\n </p>\n ) : (\n items.map((row) => (\n <DropdownMenuItem\n key={row.id}\n className=\"flex flex-col items-start gap-0.5\"\n onClick={() => void open(row)}\n >\n <span className=\"flex w-full items-center gap-2\">\n {!row.readAt && (\n <span\n data-testid=\"inbox-unread-dot\"\n className=\"bg-primary size-1.5 shrink-0 rounded-full\"\n />\n )}\n <span\n className={cn(\n \"flex-1 truncate text-sm\",\n !row.readAt && \"font-medium\",\n )}\n >\n {row.title}\n </span>\n </span>\n <span className=\"text-muted-foreground flex w-full items-center gap-2 text-xs\">\n <span>{dt.of(row.createdAt).fromNow()}</span>\n {row.scopeLabel && (\n <span className=\"bg-muted ml-auto rounded px-1.5 py-0.5\">\n {row.scopeLabel}\n </span>\n )}\n </span>\n </DropdownMenuItem>\n ))\n )}\n {props.seeAllHref && (\n <>\n <DropdownMenuSeparator />\n <DropdownMenuItem\n onClick={() => navigate(props, props.seeAllHref!)}\n className=\"justify-center text-sm\"\n >\n {props.labels?.seeAll ?? \"See all\"}\n </DropdownMenuItem>\n </>\n )}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\n/**\n * Follow a message's destination.\n *\n * `onOpen` is what a router app passes; without one this is a full\n * navigation, which is correct for a host that has no router in scope.\n * `assign()` rather than writing `location.href`, because the href is not a\n * variable this component owns.\n */\nconst navigate = (props: ButtonInboxProps, href: string): void => {\n if (props.onOpen) {\n props.onOpen(href);\n return;\n }\n if (typeof window !== \"undefined\") {\n window.location.assign(href);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoGA,MAAa,eAAe,U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AM,WAAW,IAChB,oBAAC,KAAD;KAAG,WAAU;KACV,UAAA,MAAM,QAAQ,SAAS;IACvB,CAAA,IAEH,MAAM,KAAK,QACT,qBAAC,kBAAD;KAEE,WAAU;KACV,eAAe,KAAK,KAAK,GAAG;KAH9B,UAAA,CAKE,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACG,CAAC,IAAI,UACJ,oBAAC,QAAD;OACE,eAAY;OACZ,WAAU;MACX,CAAA,GAEH,oBAAC,QAAD;OACE,WAAW,GACT,2BACA,CAAC,IAAI,UAAU,aACjB;OAEC,UAAA,IAAI;MACD,CAAA,CACF;KACN,CAAA,GAAA,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACE,oBAAC,QAAD,EAAA,UAAO,GAAG,GAAG,IAAI,SAAS,CAAC,CAAC,QAAQ,EAAQ,CAAA,GAC3C,IAAI,cACH,oBAAC,QAAD;OAAM,WAAU;OACb,UAAA,IAAI;MACD,CAAA,CAEJ;KACU,CAAA,CAAA;IA5BX,GAAA,IAAI,EA4BO,CACnB;IAEF,MAAM,cACL,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,uBAAD,CAAwB,CAAA,GACxB,oBAAC,kBAAD;KACE,eAAe,SAAS,OAAO,MAAM,UAAW;KAChD,WAAU;KAET,UAAA,MAAM,QAAQ,UAAU;IACT,CAAA,CAClB,EAAA,CAAA;GAEa,EAAA,CAAA;EACA,CAAA,CACT;;AAElB;;;;;;;;;AAUA,MAAM,YAAY,OAAyB,SAAuB;CAChE,IAAI,MAAM,QAAQ;EAChB,MAAM,OAAO,IAAI;EACjB;CACF;CACA,IAAI,OAAO,WAAW,aACpB,OAAO,SAAS,OAAO,IAAI;AAE/B"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * How many messages the signed-in viewer has not read, **across every
3
+ * scope**.
4
+ *
5
+ * ⚠️ **This is not the same number as a scope-filtered badge.** An app that
6
+ * also shows "unread in this project" holds that in an atom of its own, and
7
+ * the two legitimately disagree: a reader seeing 3 on the bell and 1 in a
8
+ * project rail is looking at two honest answers to two different questions.
9
+ * Names that cannot be confused are the whole defence, which is why this one
10
+ * says nothing about a current anything.
11
+ *
12
+ * Written by whatever runs first: a route loader that folds the count into a
13
+ * batch it was already sending, or the bell's own fetch on mount. Refreshed
14
+ * on window focus, because a message arriving while somebody sits on a page
15
+ * is otherwise invisible until they navigate.
16
+ *
17
+ * Wrapped in an object because `$atom` schemas must be object or array.
18
+ */
19
+ export declare const inboxUnreadAtom: import("alepha").Atom<import("zod").ZodObject<{
20
+ count: import("zod").ZodInt;
21
+ }, import("zod/v4/core").$strip>, "ui.inbox.unread">;
22
+ //# sourceMappingURL=inbox-unread-atom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbox-unread-atom.d.ts","sourceRoot":"","sources":["../../../src/components/button-inbox/inbox-unread-atom.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,eAAe;;oDAM1B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { $atom, z } from "alepha";
2
+ //#region src/components/button-inbox/inbox-unread-atom.ts
3
+ /**
4
+ * How many messages the signed-in viewer has not read, **across every
5
+ * scope**.
6
+ *
7
+ * ⚠️ **This is not the same number as a scope-filtered badge.** An app that
8
+ * also shows "unread in this project" holds that in an atom of its own, and
9
+ * the two legitimately disagree: a reader seeing 3 on the bell and 1 in a
10
+ * project rail is looking at two honest answers to two different questions.
11
+ * Names that cannot be confused are the whole defence, which is why this one
12
+ * says nothing about a current anything.
13
+ *
14
+ * Written by whatever runs first: a route loader that folds the count into a
15
+ * batch it was already sending, or the bell's own fetch on mount. Refreshed
16
+ * on window focus, because a message arriving while somebody sits on a page
17
+ * is otherwise invisible until they navigate.
18
+ *
19
+ * Wrapped in an object because `$atom` schemas must be object or array.
20
+ */
21
+ const inboxUnreadAtom = $atom({
22
+ name: "ui.inbox.unread",
23
+ schema: z.object({ count: z.integer() }),
24
+ default: { count: 0 }
25
+ });
26
+ //#endregion
27
+ export { inboxUnreadAtom };
28
+
29
+ //# sourceMappingURL=inbox-unread-atom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbox-unread-atom.js","names":[],"sources":["../../../src/components/button-inbox/inbox-unread-atom.ts"],"sourcesContent":["import { $atom, z } from \"alepha\";\n\n/**\n * How many messages the signed-in viewer has not read, **across every\n * scope**.\n *\n * ⚠️ **This is not the same number as a scope-filtered badge.** An app that\n * also shows \"unread in this project\" holds that in an atom of its own, and\n * the two legitimately disagree: a reader seeing 3 on the bell and 1 in a\n * project rail is looking at two honest answers to two different questions.\n * Names that cannot be confused are the whole defence, which is why this one\n * says nothing about a current anything.\n *\n * Written by whatever runs first: a route loader that folds the count into a\n * batch it was already sending, or the bell's own fetch on mount. Refreshed\n * on window focus, because a message arriving while somebody sits on a page\n * is otherwise invisible until they navigate.\n *\n * Wrapped in an object because `$atom` schemas must be object or array.\n */\nexport const inboxUnreadAtom = $atom({\n name: \"ui.inbox.unread\",\n schema: z.object({\n count: z.integer(),\n }),\n default: { count: 0 },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,kBAAkB,MAAM;CACnC,MAAM;CACN,QAAQ,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACnB,CAAC;CACD,SAAS,EAAE,OAAO,EAAE;AACtB,CAAC"}
@@ -25,9 +25,10 @@ export interface ButtonThemeProps {
25
25
  * ]);
26
26
  * ```
27
27
  *
28
- * Selecting a theme with a `fontHref` lazily injects a single `<link>` into
29
- * `<head>` (id `alepha-theme-fonts`); switching themes swaps it. No effect
30
- * when the list has 0 or 1 entries.
28
+ * Renders nothing when the list has 0 or 1 entries. Loading a theme's
29
+ * `fontHref` is `<ColorScheme/>`'s job, not this one's: a picker is absent
30
+ * from most pages, so an injection done here reached only the pages that
31
+ * happen to show a toolbar.
31
32
  */
32
33
  export declare const ButtonTheme: (props: ButtonThemeProps) => React.JSX.Element | null;
33
34
  //# sourceMappingURL=button-theme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button-theme.d.ts","sourceRoot":"","sources":["../../../src/components/button-theme/button-theme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA0B/B,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,UAAW,gBAAgB,6BAwElD,CAAC"}
1
+ {"version":3,"file":"button-theme.d.ts","sourceRoot":"","sources":["../../../src/components/button-theme/button-theme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwB/B,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,UAAW,gBAAgB,6BA4DlD,CAAC"}
@@ -1,14 +1,13 @@
1
1
  import { cn } from "../../lib/utils.js";
2
2
  import { Button } from "../ui/button.js";
3
3
  import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
4
- import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "../ui/dropdown-menu.js";
5
- import { useEffect } from "react";
4
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "../ui/dropdown-menu.js";
5
+ import "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { Check, Palette } from "lucide-react";
8
8
  import { useStore } from "alepha/react";
9
9
  import { uiThemeListAtom, useTheme } from "alepha/react/ui";
10
10
  //#region src/components/button-theme/button-theme.tsx
11
- const FONT_LINK_ID = "alepha-theme-fonts";
12
11
  /**
13
12
  * Theme picker reading the available list from `uiThemeListAtom` and the
14
13
  * selected id from `useTheme()`. Apps register their themes once at boot:
@@ -20,30 +19,15 @@ const FONT_LINK_ID = "alepha-theme-fonts";
20
19
  * ]);
21
20
  * ```
22
21
  *
23
- * Selecting a theme with a `fontHref` lazily injects a single `<link>` into
24
- * `<head>` (id `alepha-theme-fonts`); switching themes swaps it. No effect
25
- * when the list has 0 or 1 entries.
22
+ * Renders nothing when the list has 0 or 1 entries. Loading a theme's
23
+ * `fontHref` is `<ColorScheme/>`'s job, not this one's: a picker is absent
24
+ * from most pages, so an injection done here reached only the pages that
25
+ * happen to show a toolbar.
26
26
  */
27
27
  const ButtonTheme = (props) => {
28
28
  const { theme, setTheme } = useTheme();
29
29
  const [list] = useStore(uiThemeListAtom);
30
30
  const themes = list ?? [];
31
- useEffect(() => {
32
- if (typeof document === "undefined") return;
33
- const def = themes.find((t) => t.id === theme) ?? themes[0];
34
- const existing = document.getElementById(FONT_LINK_ID);
35
- if (!def?.fontHref) {
36
- existing?.remove();
37
- return;
38
- }
39
- if (existing && existing.getAttribute("href") === def.fontHref) return;
40
- existing?.remove();
41
- const link = document.createElement("link");
42
- link.id = FONT_LINK_ID;
43
- link.rel = "stylesheet";
44
- link.href = def.fontHref;
45
- document.head.appendChild(link);
46
- }, [theme, themes]);
47
31
  if (themes.length <= 1) return null;
48
32
  const label = props.label ?? "Pick theme";
49
33
  return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
@@ -59,10 +43,9 @@ const ButtonTheme = (props) => {
59
43
  children: /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [
60
44
  /* @__PURE__ */ jsx(DropdownMenuLabel, { children: props.heading ?? "Themes" }),
61
45
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
62
- themes.map((t) => /* @__PURE__ */ jsxs("button", {
63
- type: "button",
46
+ themes.map((t) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
64
47
  onClick: () => setTheme(t.id),
65
- className: cn("hover:bg-accent flex w-full items-center gap-2.5 rounded-sm px-2 py-1.5 text-sm", theme === t.id && "bg-accent"),
48
+ className: cn("flex w-full items-center gap-2.5 px-2 py-1.5 text-sm", theme === t.id && "bg-accent"),
66
49
  children: [
67
50
  t.swatch && /* @__PURE__ */ jsx(ThemeSwatch, { colors: t.swatch }),
68
51
  /* @__PURE__ */ jsx("span", {
@@ -1 +1 @@
1
- {"version":3,"file":"button-theme.js","names":[],"sources":["../../../src/components/button-theme/button-theme.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { useStore } from \"alepha/react\";\nimport { uiThemeListAtom, useTheme } from \"alepha/react/ui\";\nimport { Check, Palette } from \"lucide-react\";\nimport { useEffect } from \"react\";\n\nconst FONT_LINK_ID = \"alepha-theme-fonts\";\n\nexport interface ButtonThemeProps {\n /**\n * Optional aria-label override. Defaults to `\"Pick theme\"`.\n */\n label?: string;\n /**\n * Optional dropdown header. Defaults to `\"Themes\"`.\n */\n heading?: string;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\n/**\n * Theme picker reading the available list from `uiThemeListAtom` and the\n * selected id from `useTheme()`. Apps register their themes once at boot:\n *\n * ```ts\n * alepha.store.set(uiThemeListAtom, [\n * { id: \"default\", label: \"Default\" },\n * { id: \"claude\", label: \"Claude\", swatch: [...], fontHref: \"https://...\" },\n * ]);\n * ```\n *\n * Selecting a theme with a `fontHref` lazily injects a single `<link>` into\n * `<head>` (id `alepha-theme-fonts`); switching themes swaps it. No effect\n * when the list has 0 or 1 entries.\n */\nexport const ButtonTheme = (props: ButtonThemeProps) => {\n const { theme, setTheme } = useTheme();\n const [list] = useStore(uiThemeListAtom);\n const themes = list ?? [];\n\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n const def = themes.find((t) => t.id === theme) ?? themes[0];\n const existing = document.getElementById(FONT_LINK_ID);\n if (!def?.fontHref) {\n existing?.remove();\n return;\n }\n if (existing && existing.getAttribute(\"href\") === def.fontHref) {\n return;\n }\n existing?.remove();\n const link = document.createElement(\"link\");\n link.id = FONT_LINK_ID;\n link.rel = \"stylesheet\";\n link.href = def.fontHref;\n document.head.appendChild(link);\n }, [theme, themes]);\n\n if (themes.length <= 1) {\n return null;\n }\n\n const label = props.label ?? \"Pick theme\";\n return (\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={label}\n />\n }\n />\n }\n >\n <Palette className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-56\">\n <DropdownMenuGroup>\n <DropdownMenuLabel>{props.heading ?? \"Themes\"}</DropdownMenuLabel>\n <DropdownMenuSeparator />\n {themes.map((t) => (\n <button\n key={t.id}\n type=\"button\"\n onClick={() => setTheme(t.id)}\n className={cn(\n \"hover:bg-accent flex w-full items-center gap-2.5 rounded-sm px-2 py-1.5 text-sm\",\n theme === t.id && \"bg-accent\",\n )}\n >\n {t.swatch && <ThemeSwatch colors={t.swatch} />}\n <span className=\"flex-1 text-left\">{t.label}</span>\n {theme === t.id && <Check className=\"size-3.5\" />}\n </button>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\ninterface ThemeSwatchProps {\n colors: string[];\n}\n\nconst ThemeSwatch = (props: ThemeSwatchProps) => {\n return (\n <div className=\"border-border grid size-6 shrink-0 grid-cols-2 grid-rows-2 gap-px overflow-hidden rounded-sm border bg-white p-px\">\n {props.colors.slice(0, 4).map((c, i) => (\n <span\n key={i}\n className=\"block rounded-[1px]\"\n style={{ background: c }}\n />\n ))}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,eAAe;;;;;;;;;;;;;;;;AAiCrB,MAAa,eAAe,UAA4B;CACtD,MAAM,EAAE,OAAO,aAAa,SAAS;CACrC,MAAM,CAAC,QAAQ,SAAS,eAAe;CACvC,MAAM,SAAS,QAAQ,CAAC;CAExB,gBAAgB;EACd,IAAI,OAAO,aAAa,aAAa;EACrC,MAAM,MAAM,OAAO,MAAM,MAAM,EAAE,OAAO,KAAK,KAAK,OAAO;EACzD,MAAM,WAAW,SAAS,eAAe,YAAY;EACrD,IAAI,CAAC,KAAK,UAAU;GAClB,UAAU,OAAO;GACjB;EACF;EACA,IAAI,YAAY,SAAS,aAAa,MAAM,MAAM,IAAI,UACpD;EAEF,UAAU,OAAO;EACjB,MAAM,OAAO,SAAS,cAAc,MAAM;EAC1C,KAAK,KAAK;EACV,KAAK,MAAM;EACX,KAAK,OAAO,IAAI;EAChB,SAAS,KAAK,YAAY,IAAI;CAChC,GAAG,CAAC,OAAO,MAAM,CAAC;CAElB,IAAI,OAAO,UAAU,GACnB,OAAO;CAGT,MAAM,QAAQ,MAAM,SAAS;CAC7B,OACE,qBAAC,cAAD,EAAA,UAAA,CACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,QACE,oBAAC,qBAAD,EACE,QACE,oBAAC,QAAD;GACE,SAAS,MAAM,WAAW;GAC1B,MAAK;GACL,cAAY;EACb,CAAA,EAEJ,CAAA;EAGH,UAAA,oBAAC,SAAD,EAAS,WAAU,SAAU,CAAA;CACf,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,MAAsB,CAAA,CAChC,EAAA,CAAA,GACT,oBAAC,qBAAD;EAAqB,OAAM;EAAM,WAAU;EACzC,UAAA,qBAAC,mBAAD,EAAA,UAAA;GACE,oBAAC,mBAAD,EAAA,UAAoB,MAAM,WAAW,SAA4B,CAAA;GACjE,oBAAC,uBAAD,CAAwB,CAAA;GACvB,OAAO,KAAK,MACX,qBAAC,UAAD;IAEE,MAAK;IACL,eAAe,SAAS,EAAE,EAAE;IAC5B,WAAW,GACT,mFACA,UAAU,EAAE,MAAM,WACpB;IAPF,UAAA;KASG,EAAE,UAAU,oBAAC,aAAD,EAAa,QAAQ,EAAE,OAAS,CAAA;KAC7C,oBAAC,QAAD;MAAM,WAAU;MAAoB,UAAA,EAAE;KAAY,CAAA;KACjD,UAAU,EAAE,MAAM,oBAAC,OAAD,EAAO,WAAU,WAAY,CAAA;IAC1C;GAXD,GAAA,EAAE,EAWD,CACT;EACgB,EAAA,CAAA;CACA,CAAA,CACT,EAAA,CAAA;AAElB;AAMA,MAAM,eAAe,UAA4B;CAC/C,OACE,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA,MAAM,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,MAChC,oBAAC,QAAD;GAEE,WAAU;GACV,OAAO,EAAE,YAAY,EAAE;EACxB,GAHM,CAGN,CACF;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"button-theme.js","names":[],"sources":["../../../src/components/button-theme/button-theme.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { useStore } from \"alepha/react\";\nimport { uiThemeListAtom, useTheme } from \"alepha/react/ui\";\nimport { Check, Palette } from \"lucide-react\";\n\nexport interface ButtonThemeProps {\n /**\n * Optional aria-label override. Defaults to `\"Pick theme\"`.\n */\n label?: string;\n /**\n * Optional dropdown header. Defaults to `\"Themes\"`.\n */\n heading?: string;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\n/**\n * Theme picker reading the available list from `uiThemeListAtom` and the\n * selected id from `useTheme()`. Apps register their themes once at boot:\n *\n * ```ts\n * alepha.store.set(uiThemeListAtom, [\n * { id: \"default\", label: \"Default\" },\n * { id: \"claude\", label: \"Claude\", swatch: [...], fontHref: \"https://...\" },\n * ]);\n * ```\n *\n * Renders nothing when the list has 0 or 1 entries. Loading a theme's\n * `fontHref` is `<ColorScheme/>`'s job, not this one's: a picker is absent\n * from most pages, so an injection done here reached only the pages that\n * happen to show a toolbar.\n */\nexport const ButtonTheme = (props: ButtonThemeProps) => {\n const { theme, setTheme } = useTheme();\n const [list] = useStore(uiThemeListAtom);\n const themes = list ?? [];\n\n if (themes.length <= 1) {\n return null;\n }\n\n const label = props.label ?? \"Pick theme\";\n return (\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={label}\n />\n }\n />\n }\n >\n <Palette className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-56\">\n <DropdownMenuGroup>\n <DropdownMenuLabel>{props.heading ?? \"Themes\"}</DropdownMenuLabel>\n <DropdownMenuSeparator />\n {/*\n `DropdownMenuItem`, not a raw `<button>`. These were plain buttons\n inside a `role=\"menu\"`, which cost two things that are the menu\n primitive's whole job: the container announced itself as a menu\n with NO items to assistive technology, and picking a theme left the\n menu open - alone among every dropdown in the app - because only an\n Item tells the root to close on select.\n */}\n {themes.map((t) => (\n <DropdownMenuItem\n key={t.id}\n onClick={() => setTheme(t.id)}\n className={cn(\n \"flex w-full items-center gap-2.5 px-2 py-1.5 text-sm\",\n theme === t.id && \"bg-accent\",\n )}\n >\n {t.swatch && <ThemeSwatch colors={t.swatch} />}\n <span className=\"flex-1 text-left\">{t.label}</span>\n {theme === t.id && <Check className=\"size-3.5\" />}\n </DropdownMenuItem>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\ninterface ThemeSwatchProps {\n colors: string[];\n}\n\nconst ThemeSwatch = (props: ThemeSwatchProps) => {\n return (\n <div className=\"border-border grid size-6 shrink-0 grid-cols-2 grid-rows-2 gap-px overflow-hidden rounded-sm border bg-white p-px\">\n {props.colors.slice(0, 4).map((c, i) => (\n <span\n key={i}\n className=\"block rounded-[1px]\"\n style={{ background: c }}\n />\n ))}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAa,eAAe,UAA4B;CACtD,MAAM,EAAE,OAAO,aAAa,SAAS;CACrC,MAAM,CAAC,QAAQ,SAAS,eAAe;CACvC,MAAM,SAAS,QAAQ,CAAC;CAExB,IAAI,OAAO,UAAU,GACnB,OAAO;CAGT,MAAM,QAAQ,MAAM,SAAS;CAC7B,OACE,qBAAC,cAAD,EAAA,UAAA,CACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,QACE,oBAAC,qBAAD,EACE,QACE,oBAAC,QAAD;GACE,SAAS,MAAM,WAAW;GAC1B,MAAK;GACL,cAAY;EACb,CAAA,EAEJ,CAAA;EAGH,UAAA,oBAAC,SAAD,EAAS,WAAU,SAAU,CAAA;CACf,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,MAAsB,CAAA,CAChC,EAAA,CAAA,GACT,oBAAC,qBAAD;EAAqB,OAAM;EAAM,WAAU;EACzC,UAAA,qBAAC,mBAAD,EAAA,UAAA;GACE,oBAAC,mBAAD,EAAA,UAAoB,MAAM,WAAW,SAA4B,CAAA;GACjE,oBAAC,uBAAD,CAAwB,CAAA;GASvB,OAAO,KAAK,MACX,qBAAC,kBAAD;IAEE,eAAe,SAAS,EAAE,EAAE;IAC5B,WAAW,GACT,wDACA,UAAU,EAAE,MAAM,WACpB;IANF,UAAA;KAQG,EAAE,UAAU,oBAAC,aAAD,EAAa,QAAQ,EAAE,OAAS,CAAA;KAC7C,oBAAC,QAAD;MAAM,WAAU;MAAoB,UAAA,EAAE;KAAY,CAAA;KACjD,UAAU,EAAE,MAAM,oBAAC,OAAD,EAAO,WAAU,WAAY,CAAA;IAChC;GAVX,GAAA,EAAE,EAUS,CACnB;EACgB,EAAA,CAAA;CACA,CAAA,CACT,EAAA,CAAA;AAElB;AAMA,MAAM,eAAe,UAA4B;CAC/C,OACE,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA,MAAM,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,MAChC,oBAAC,QAAD;GAEE,WAAU;GACV,OAAO,EAAE,YAAY,EAAE;EACxB,GAHM,CAGN,CACF;CACE,CAAA;AAET"}
@@ -35,6 +35,25 @@ export interface ButtonUserProps {
35
35
  * bordered toolbar look.
36
36
  */
37
37
  variant?: "ghost" | "outline";
38
+ /**
39
+ * What the signed-in button shows instead of the generic `User` glyph:
40
+ * the viewer's own avatar (feedback #P2138).
41
+ *
42
+ * ⚠️ **A slot, and it has to be one.** This package can read
43
+ * `useAuth().user` and so can see `user.picture` - but that is a file id,
44
+ * and turning one into a URL is the consuming application's routing, not
45
+ * this component's. Building the URL here would hard-code one app's file
46
+ * route into a shared package, and the next consumer serves avatars from
47
+ * somewhere else entirely.
48
+ *
49
+ * Absent, the `User` glyph is rendered exactly as before, so a consumer
50
+ * that passes nothing and a viewer with no picture look identical. The
51
+ * node sizes ITSELF: the button is `size="icon"` around a `size-4` glyph,
52
+ * and an avatar wants to be round and fill more of it than that.
53
+ *
54
+ * Only reached when signed in - the signed-out branch returns above.
55
+ */
56
+ avatar?: ReactNode;
38
57
  }
39
58
  export declare function ButtonUser(props: ButtonUserProps): React.JSX.Element;
40
59
  export declare namespace ButtonUser {
@@ -1 +1 @@
1
- {"version":3,"file":"button-user.d.ts","sourceRoot":"","sources":["../../../src/components/button-user/button-user.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAoB/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;mCAoB0B,KAAK,EAAE,eAAe;;;;;;;AA4EjD,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,KAAK,UAAW,oBAAoB,6BAazC,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,aAAa,UAAW,4BAA4B,6BA4BzD,CAAC;AAEF,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,QAAA,MAAM,eAAe,UAAW,8BAA8B,6BA8B7D,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,cAAc,UAAW,6BAA6B,sBAQ3D,CAAC"}
1
+ {"version":3,"file":"button-user.d.ts","sourceRoot":"","sources":["../../../src/components/button-user/button-user.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAoB/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE9B;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;mCAoB0B,KAAK,EAAE,eAAe;;;;;;;AA+EjD,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,KAAK,UAAW,oBAAoB,6BAazC,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,aAAa,UAAW,4BAA4B,6BA4BzD,CAAC;AAEF,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,QAAA,MAAM,eAAe,UAAW,8BAA8B,6BA8B7D,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,cAAc,UAAW,6BAA6B,sBAQ3D,CAAC"}
@@ -46,7 +46,7 @@ const ButtonUser = (props) => {
46
46
  size: "icon",
47
47
  "aria-label": menuLabel
48
48
  }) }),
49
- children: /* @__PURE__ */ jsx(User, { className: "size-4" })
49
+ children: props.avatar ?? /* @__PURE__ */ jsx(User, { className: "size-4" })
50
50
  }), /* @__PURE__ */ jsx(TooltipContent, { children: menuLabel })] }), /* @__PURE__ */ jsx(DropdownMenuContent, {
51
51
  align: "end",
52
52
  className: "w-56",
@@ -1 +1 @@
1
- {"version":3,"file":"button-user.js","names":["Link"],"sources":["../../../src/components/button-user/button-user.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { useAuth } from \"alepha/react/auth\";\nimport { Link, useRouter } from \"alepha/react/router\";\nimport { CircleUser, LogIn, LogOut, Shield, User } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nexport interface ButtonUserProps {\n /**\n * Custom menu items rendered between the email header and the logout\n * footer. When omitted, a default menu is rendered: email + account + admin\n * (when permitted) + logout. When provided, the consumer is responsible for the\n * full layout — use `ButtonUser.Email`, `ButtonUser.AdminMenuItem`,\n * `ButtonUser.LogoutMenuItem` as building blocks.\n */\n children?: ReactNode;\n /**\n * Called when the user clicks the sign-in icon (logged-out state). When\n * absent, the icon button is disabled.\n */\n onSignIn?: () => void;\n /**\n * Called when the user clicks the default \"Admin Panel\" menu item. Has no\n * effect when `children` are provided. When absent, the admin item is\n * hidden even if the user has the permission.\n */\n onAdminClick?: () => void;\n /**\n * Aria-label and tooltip text for the logged-out (sign-in) state.\n * Defaults to `\"Sign in\"`.\n */\n signInLabel?: string;\n /**\n * Aria-label and tooltip text for the logged-in (account menu) state.\n * Defaults to `\"Account menu\"`.\n */\n menuLabel?: string;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\n/**\n * Account button: shows a sign-in icon when logged out, a user icon with a\n * dropdown menu when logged in. Reads auth state via `useAuth()`.\n *\n * @example\n * // Default menu\n * <ButtonUser onSignIn={() => router.push(\"login\")} onAdminClick={() => router.push(\"admin\")} />\n *\n * @example\n * // Custom menu\n * <ButtonUser onSignIn={() => router.push(\"login\")}>\n * <ButtonUser.Email />\n * <ButtonUser.AdminMenuItem onClick={() => router.push(\"admin\")} />\n * <DropdownMenuItem onClick={() => router.push(\"me\")}>Profile</DropdownMenuItem>\n * <DropdownMenuSeparator />\n * <ButtonUser.LogoutMenuItem />\n * </ButtonUser>\n */\nexport const ButtonUser = (props: ButtonUserProps) => {\n const auth = useAuth();\n\n if (!auth.user) {\n const signInLabel = props.signInLabel ?? \"Sign in\";\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={signInLabel}\n disabled={!props.onSignIn}\n onClick={props.onSignIn}\n />\n }\n >\n <LogIn className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{signInLabel}</TooltipContent>\n </Tooltip>\n );\n }\n\n const menuLabel = props.menuLabel ?? \"Account menu\";\n return (\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={menuLabel}\n />\n }\n />\n }\n >\n <User className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{menuLabel}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-56\">\n {props.children ?? <DefaultMenu onAdminClick={props.onAdminClick} />}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\ninterface DefaultMenuProps {\n onAdminClick?: () => void;\n}\n\nconst DefaultMenu = (props: DefaultMenuProps) => {\n return (\n <>\n <Email />\n {/*\n Account first, admin second: the account page is where every signed-in\n user has something to do, and the admin panel is a destination a\n minority of them can even see. Keep the two in this order everywhere\n the pair is composed (see `AppActions`) so the menu does not reshuffle\n between surfaces.\n */}\n <AccountMenuItem />\n {props.onAdminClick && <AdminMenuItem onClick={props.onAdminClick} />}\n <DropdownMenuSeparator />\n <LogoutMenuItem />\n </>\n );\n};\n\nexport interface ButtonUserEmailProps {\n /**\n * Optional fallback when the user has no email. Defaults to username, then id.\n */\n fallback?: string;\n}\n\nconst Email = (props: ButtonUserEmailProps) => {\n const auth = useAuth();\n const user = auth.user as\n | { email?: string; username?: string; id?: string }\n | undefined;\n if (!user) return null;\n const text = user.email ?? user.username ?? props.fallback ?? user.id ?? null;\n if (!text) return null;\n return (\n <div className=\"text-muted-foreground truncate px-2 py-1.5 text-xs\">\n {text}\n </div>\n );\n};\n\nexport interface ButtonUserAdminMenuItemProps {\n /**\n * Route name to link to. Defaults to `\"admin\"`, which is what `AdminRouter`\n * registers. Prefer this over {@link onClick}: it is what makes the item a\n * real anchor.\n */\n routeName?: string;\n\n /**\n * Escape hatch for a destination no route name can express. Supplying it\n * turns the item back into a click handler on a `div`, so the entry loses\n * ⌘-click, middle-click and \"open in new tab\" — see {@link AccountMenuItem}.\n */\n onClick?: () => void;\n\n /**\n * Item label. Defaults to `\"Admin Panel\"`.\n */\n label?: string;\n /**\n * Permission name checked via `useAuth().has(...)`. Defaults to\n * `\"admin:ui\"`. The item is hidden when the check returns false.\n */\n permission?: string;\n}\n\nconst AdminMenuItem = (props: ButtonUserAdminMenuItemProps) => {\n const auth = useAuth();\n const router = useRouter<any>();\n const permission = props.permission ?? \"admin:ui\";\n if (!auth.has(permission)) return null;\n\n const label = (\n <>\n <Shield className=\"size-4\" />\n {props.label ?? \"Admin Panel\"}\n </>\n );\n\n if (props.onClick) {\n return <DropdownMenuItem onClick={props.onClick}>{label}</DropdownMenuItem>;\n }\n\n const routeName = props.routeName ?? \"admin\";\n // Same \"is the module actually mounted\" question `AccountMenuItem` asks. An\n // unregistered name would resolve to a literal `/admin`-shaped string and\n // give the user a link to a 404.\n if (!router.pages?.some((page: any) => page.name === routeName)) return null;\n\n return (\n <DropdownMenuItem render={<Link href={router.path(routeName)} />}>\n {label}\n </DropdownMenuItem>\n );\n};\n\nexport interface ButtonUserAccountMenuItemProps {\n /**\n * Route name to link to. Defaults to `\"account\"`, which is what\n * `AccountRouter` registers — set it only if you mounted the account area\n * under a different name.\n */\n routeName?: string;\n\n /**\n * Escape hatch for a destination no route name can express. Supplying it\n * turns the item back into a click handler on a `div`, giving up everything\n * an anchor provides.\n */\n onClick?: () => void;\n\n /**\n * Item label. Defaults to `\"User Account\"`.\n */\n label?: string;\n}\n\n/**\n * Link to the signed-in user's own account area.\n *\n * ⚠️ **It owns its destination, unlike {@link ButtonUser.AdminMenuItem}.**\n * That asymmetry is deliberate. Every caller that hard-coded this navigation\n * got it wrong the moment the account area moved — `router.push(\"me\")` kept\n * compiling after the `me` route ceased to exist, because `router.push` falls\n * back to a plain `string` overload, and threw only when someone clicked it.\n * Defaulting to the route `AccountRouter` actually registers removes the whole\n * class of bug; `onClick` stays available for an application that mounted the\n * area itself under another name.\n *\n * **It hides itself when no `account` route is registered**, so an application\n * that never mounts `AccountRouter` gets no dead entry — the same \"is the\n * module actually there\" question the router's own `can` gates answer, asked\n * the only way a menu item can ask it.\n *\n * ⚠️ **It renders an `<a href>`, not a click handler**, because it is a\n * destination rather than an action. `DropdownMenuItem` is a Base UI\n * `Menu.Item`, which defaults to a `div` — correct for Logout, wrong here: a\n * div navigating from `onClick` cannot be ⌘-clicked, middle-clicked or opened\n * in a new tab, shows no target on hover, and offers no \"copy link address\".\n * `render` swaps the element while Base UI keeps `role=\"menuitem\"` and its\n * keyboard handling, so the menu semantics are unchanged.\n */\nconst AccountMenuItem = (props: ButtonUserAccountMenuItemProps) => {\n const auth = useAuth();\n const router = useRouter<any>();\n\n if (!auth.user) {\n return null;\n }\n\n const label = (\n <>\n <CircleUser className=\"size-4\" />\n {props.label ?? \"User Account\"}\n </>\n );\n\n if (props.onClick) {\n return <DropdownMenuItem onClick={props.onClick}>{label}</DropdownMenuItem>;\n }\n\n // No account area mounted → no entry, rather than one that 404s on click.\n const routeName = props.routeName ?? \"account\";\n if (!router.pages?.some((page: any) => page.name === routeName)) {\n return null;\n }\n\n return (\n <DropdownMenuItem render={<Link href={router.path(routeName)} />}>\n {label}\n </DropdownMenuItem>\n );\n};\n\nexport interface ButtonUserLogoutMenuItemProps {\n /**\n * Item label. Defaults to `\"Logout\"`.\n */\n label?: string;\n}\n\nconst LogoutMenuItem = (props: ButtonUserLogoutMenuItemProps) => {\n const auth = useAuth();\n return (\n <DropdownMenuItem onClick={() => auth.logout()}>\n <LogOut className=\"size-4\" />\n {props.label ?? \"Logout\"}\n </DropdownMenuItem>\n );\n};\n\nButtonUser.Email = Email;\nButtonUser.AdminMenuItem = AdminMenuItem;\nButtonUser.AccountMenuItem = AccountMenuItem;\nButtonUser.LogoutMenuItem = LogoutMenuItem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,MAAa,cAAc,UAA2B;CAGpD,IAAI,CAFS,QAEL,CAAC,CAAC,MAAM;EACd,MAAM,cAAc,MAAM,eAAe;EACzC,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;GACE,QACE,oBAAC,QAAD;IACE,SAAS,MAAM,WAAW;IAC1B,MAAK;IACL,cAAY;IACZ,UAAU,CAAC,MAAM;IACjB,SAAS,MAAM;GAChB,CAAA;GAGH,UAAA,oBAAC,OAAD,EAAO,WAAU,SAAU,CAAA;EACb,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,YAA4B,CAAA,CACtC,EAAA,CAAA;CAEb;CAEA,MAAM,YAAY,MAAM,aAAa;CACrC,OACE,qBAAC,cAAD,EAAA,UAAA,CACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,QACE,oBAAC,qBAAD,EACE,QACE,oBAAC,QAAD;GACE,SAAS,MAAM,WAAW;GAC1B,MAAK;GACL,cAAY;EACb,CAAA,EAEJ,CAAA;EAGH,UAAA,oBAAC,MAAD,EAAM,WAAU,SAAU,CAAA;CACZ,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,UAA0B,CAAA,CACpC,EAAA,CAAA,GACT,oBAAC,qBAAD;EAAqB,OAAM;EAAM,WAAU;EACxC,UAAA,MAAM,YAAY,oBAAC,aAAD,EAAa,cAAc,MAAM,aAAe,CAAA;CAChD,CAAA,CACT,EAAA,CAAA;AAElB;AAMA,MAAM,eAAe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B,IAAI,CAAC,KAAK,MACR,OAAO;CAGT,MAAM,QACJ,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,YAAD,EAAY,WAAU,SAAU,CAAA,GAC/B,MAAM,SAAS,cAChB,EAAA,CAAA;CAGJ,IAAI,MAAM,SACR,OAAO,oBAAC,kBAAD;EAAkB,SAAS,MAAM;EAAU,UAAA;CAAwB,CAAA;CAI5E,MAAM,YAAY,MAAM,aAAa;CACrC,IAAI,CAAC,OAAO,OAAO,MAAM,SAAc,KAAK,SAAS,SAAS,GAC5D,OAAO;CAGT,OACE,oBAAC,kBAAD;EAAkB,QAAQ,oBAACA,QAAD,EAAM,MAAM,OAAO,KAAK,SAAS,EAAI,CAAA;EAC5D,UAAA;CACe,CAAA;AAEtB;AASA,MAAM,kBAAkB,UAAyC;CAC/D,MAAM,OAAO,QAAQ;CACrB,OACE,qBAAC,kBAAD;EAAkB,eAAe,KAAK,OAAO;EAA7C,UAAA,CACE,oBAAC,QAAD,EAAQ,WAAU,SAAU,CAAA,GAC3B,MAAM,SAAS,QACA;;AAEtB;AAEA,WAAW,QAAQ;AACnB,WAAW,gBAAgB;AAC3B,WAAW,kBAAkB;AAC7B,WAAW,iBAAiB"}
1
+ {"version":3,"file":"button-user.js","names":["Link"],"sources":["../../../src/components/button-user/button-user.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { useAuth } from \"alepha/react/auth\";\nimport { Link, useRouter } from \"alepha/react/router\";\nimport { CircleUser, LogIn, LogOut, Shield, User } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nexport interface ButtonUserProps {\n /**\n * Custom menu items rendered between the email header and the logout\n * footer. When omitted, a default menu is rendered: email + account + admin\n * (when permitted) + logout. When provided, the consumer is responsible for the\n * full layout — use `ButtonUser.Email`, `ButtonUser.AdminMenuItem`,\n * `ButtonUser.LogoutMenuItem` as building blocks.\n */\n children?: ReactNode;\n /**\n * Called when the user clicks the sign-in icon (logged-out state). When\n * absent, the icon button is disabled.\n */\n onSignIn?: () => void;\n /**\n * Called when the user clicks the default \"Admin Panel\" menu item. Has no\n * effect when `children` are provided. When absent, the admin item is\n * hidden even if the user has the permission.\n */\n onAdminClick?: () => void;\n /**\n * Aria-label and tooltip text for the logged-out (sign-in) state.\n * Defaults to `\"Sign in\"`.\n */\n signInLabel?: string;\n /**\n * Aria-label and tooltip text for the logged-in (account menu) state.\n * Defaults to `\"Account menu\"`.\n */\n menuLabel?: string;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n\n /**\n * What the signed-in button shows instead of the generic `User` glyph:\n * the viewer's own avatar (feedback #P2138).\n *\n * ⚠️ **A slot, and it has to be one.** This package can read\n * `useAuth().user` and so can see `user.picture` - but that is a file id,\n * and turning one into a URL is the consuming application's routing, not\n * this component's. Building the URL here would hard-code one app's file\n * route into a shared package, and the next consumer serves avatars from\n * somewhere else entirely.\n *\n * Absent, the `User` glyph is rendered exactly as before, so a consumer\n * that passes nothing and a viewer with no picture look identical. The\n * node sizes ITSELF: the button is `size=\"icon\"` around a `size-4` glyph,\n * and an avatar wants to be round and fill more of it than that.\n *\n * Only reached when signed in - the signed-out branch returns above.\n */\n avatar?: ReactNode;\n}\n\n/**\n * Account button: shows a sign-in icon when logged out, a user icon with a\n * dropdown menu when logged in. Reads auth state via `useAuth()`.\n *\n * @example\n * // Default menu\n * <ButtonUser onSignIn={() => router.push(\"login\")} onAdminClick={() => router.push(\"admin\")} />\n *\n * @example\n * // Custom menu\n * <ButtonUser onSignIn={() => router.push(\"login\")}>\n * <ButtonUser.Email />\n * <ButtonUser.AdminMenuItem onClick={() => router.push(\"admin\")} />\n * <DropdownMenuItem onClick={() => router.push(\"me\")}>Profile</DropdownMenuItem>\n * <DropdownMenuSeparator />\n * <ButtonUser.LogoutMenuItem />\n * </ButtonUser>\n */\nexport const ButtonUser = (props: ButtonUserProps) => {\n const auth = useAuth();\n\n if (!auth.user) {\n const signInLabel = props.signInLabel ?? \"Sign in\";\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={signInLabel}\n disabled={!props.onSignIn}\n onClick={props.onSignIn}\n />\n }\n >\n <LogIn className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{signInLabel}</TooltipContent>\n </Tooltip>\n );\n }\n\n const menuLabel = props.menuLabel ?? \"Account menu\";\n return (\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={menuLabel}\n />\n }\n />\n }\n >\n {/* The tooltip and `aria-label` are untouched by the avatar: a\n face is not a label, and \"Account menu\" is still the accessible\n name of the button. */}\n {props.avatar ?? <User className=\"size-4\" />}\n </TooltipTrigger>\n <TooltipContent>{menuLabel}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-56\">\n {props.children ?? <DefaultMenu onAdminClick={props.onAdminClick} />}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\ninterface DefaultMenuProps {\n onAdminClick?: () => void;\n}\n\nconst DefaultMenu = (props: DefaultMenuProps) => {\n return (\n <>\n <Email />\n {/*\n Account first, admin second: the account page is where every signed-in\n user has something to do, and the admin panel is a destination a\n minority of them can even see. Keep the two in this order everywhere\n the pair is composed (see `AppActions`) so the menu does not reshuffle\n between surfaces.\n */}\n <AccountMenuItem />\n {props.onAdminClick && <AdminMenuItem onClick={props.onAdminClick} />}\n <DropdownMenuSeparator />\n <LogoutMenuItem />\n </>\n );\n};\n\nexport interface ButtonUserEmailProps {\n /**\n * Optional fallback when the user has no email. Defaults to username, then id.\n */\n fallback?: string;\n}\n\nconst Email = (props: ButtonUserEmailProps) => {\n const auth = useAuth();\n const user = auth.user as\n | { email?: string; username?: string; id?: string }\n | undefined;\n if (!user) return null;\n const text = user.email ?? user.username ?? props.fallback ?? user.id ?? null;\n if (!text) return null;\n return (\n <div className=\"text-muted-foreground truncate px-2 py-1.5 text-xs\">\n {text}\n </div>\n );\n};\n\nexport interface ButtonUserAdminMenuItemProps {\n /**\n * Route name to link to. Defaults to `\"admin\"`, which is what `AdminRouter`\n * registers. Prefer this over {@link onClick}: it is what makes the item a\n * real anchor.\n */\n routeName?: string;\n\n /**\n * Escape hatch for a destination no route name can express. Supplying it\n * turns the item back into a click handler on a `div`, so the entry loses\n * ⌘-click, middle-click and \"open in new tab\" — see {@link AccountMenuItem}.\n */\n onClick?: () => void;\n\n /**\n * Item label. Defaults to `\"Admin Panel\"`.\n */\n label?: string;\n /**\n * Permission name checked via `useAuth().has(...)`. Defaults to\n * `\"admin:ui\"`. The item is hidden when the check returns false.\n */\n permission?: string;\n}\n\nconst AdminMenuItem = (props: ButtonUserAdminMenuItemProps) => {\n const auth = useAuth();\n const router = useRouter<any>();\n const permission = props.permission ?? \"admin:ui\";\n if (!auth.has(permission)) return null;\n\n const label = (\n <>\n <Shield className=\"size-4\" />\n {props.label ?? \"Admin Panel\"}\n </>\n );\n\n if (props.onClick) {\n return <DropdownMenuItem onClick={props.onClick}>{label}</DropdownMenuItem>;\n }\n\n const routeName = props.routeName ?? \"admin\";\n // Same \"is the module actually mounted\" question `AccountMenuItem` asks. An\n // unregistered name would resolve to a literal `/admin`-shaped string and\n // give the user a link to a 404.\n if (!router.pages?.some((page: any) => page.name === routeName)) return null;\n\n return (\n <DropdownMenuItem render={<Link href={router.path(routeName)} />}>\n {label}\n </DropdownMenuItem>\n );\n};\n\nexport interface ButtonUserAccountMenuItemProps {\n /**\n * Route name to link to. Defaults to `\"account\"`, which is what\n * `AccountRouter` registers — set it only if you mounted the account area\n * under a different name.\n */\n routeName?: string;\n\n /**\n * Escape hatch for a destination no route name can express. Supplying it\n * turns the item back into a click handler on a `div`, giving up everything\n * an anchor provides.\n */\n onClick?: () => void;\n\n /**\n * Item label. Defaults to `\"User Account\"`.\n */\n label?: string;\n}\n\n/**\n * Link to the signed-in user's own account area.\n *\n * ⚠️ **It owns its destination, unlike {@link ButtonUser.AdminMenuItem}.**\n * That asymmetry is deliberate. Every caller that hard-coded this navigation\n * got it wrong the moment the account area moved — `router.push(\"me\")` kept\n * compiling after the `me` route ceased to exist, because `router.push` falls\n * back to a plain `string` overload, and threw only when someone clicked it.\n * Defaulting to the route `AccountRouter` actually registers removes the whole\n * class of bug; `onClick` stays available for an application that mounted the\n * area itself under another name.\n *\n * **It hides itself when no `account` route is registered**, so an application\n * that never mounts `AccountRouter` gets no dead entry — the same \"is the\n * module actually there\" question the router's own `can` gates answer, asked\n * the only way a menu item can ask it.\n *\n * ⚠️ **It renders an `<a href>`, not a click handler**, because it is a\n * destination rather than an action. `DropdownMenuItem` is a Base UI\n * `Menu.Item`, which defaults to a `div` — correct for Logout, wrong here: a\n * div navigating from `onClick` cannot be ⌘-clicked, middle-clicked or opened\n * in a new tab, shows no target on hover, and offers no \"copy link address\".\n * `render` swaps the element while Base UI keeps `role=\"menuitem\"` and its\n * keyboard handling, so the menu semantics are unchanged.\n */\nconst AccountMenuItem = (props: ButtonUserAccountMenuItemProps) => {\n const auth = useAuth();\n const router = useRouter<any>();\n\n if (!auth.user) {\n return null;\n }\n\n const label = (\n <>\n <CircleUser className=\"size-4\" />\n {props.label ?? \"User Account\"}\n </>\n );\n\n if (props.onClick) {\n return <DropdownMenuItem onClick={props.onClick}>{label}</DropdownMenuItem>;\n }\n\n // No account area mounted → no entry, rather than one that 404s on click.\n const routeName = props.routeName ?? \"account\";\n if (!router.pages?.some((page: any) => page.name === routeName)) {\n return null;\n }\n\n return (\n <DropdownMenuItem render={<Link href={router.path(routeName)} />}>\n {label}\n </DropdownMenuItem>\n );\n};\n\nexport interface ButtonUserLogoutMenuItemProps {\n /**\n * Item label. Defaults to `\"Logout\"`.\n */\n label?: string;\n}\n\nconst LogoutMenuItem = (props: ButtonUserLogoutMenuItemProps) => {\n const auth = useAuth();\n return (\n <DropdownMenuItem onClick={() => auth.logout()}>\n <LogOut className=\"size-4\" />\n {props.label ?? \"Logout\"}\n </DropdownMenuItem>\n );\n};\n\nButtonUser.Email = Email;\nButtonUser.AdminMenuItem = AdminMenuItem;\nButtonUser.AccountMenuItem = AccountMenuItem;\nButtonUser.LogoutMenuItem = LogoutMenuItem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGA,MAAa,cAAc,UAA2B;CAGpD,IAAI,CAFS,QAEL,CAAC,CAAC,MAAM;EACd,MAAM,cAAc,MAAM,eAAe;EACzC,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;GACE,QACE,oBAAC,QAAD;IACE,SAAS,MAAM,WAAW;IAC1B,MAAK;IACL,cAAY;IACZ,UAAU,CAAC,MAAM;IACjB,SAAS,MAAM;GAChB,CAAA;GAGH,UAAA,oBAAC,OAAD,EAAO,WAAU,SAAU,CAAA;EACb,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,YAA4B,CAAA,CACtC,EAAA,CAAA;CAEb;CAEA,MAAM,YAAY,MAAM,aAAa;CACrC,OACE,qBAAC,cAAD,EAAA,UAAA,CACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,QACE,oBAAC,qBAAD,EACE,QACE,oBAAC,QAAD;GACE,SAAS,MAAM,WAAW;GAC1B,MAAK;GACL,cAAY;EACb,CAAA,EAEJ,CAAA;EAMF,UAAA,MAAM,UAAU,oBAAC,MAAD,EAAM,WAAU,SAAU,CAAA;CAC7B,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,UAA0B,CAAA,CACpC,E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OAAO,KAAK,SAAS,EAAI,CAAA;EAC5D,UAAA;CACe,CAAA;AAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAM,mBAAmB,UAA0C;CACjE,MAAM,OAAO,QAAQ;CACrB,MAAM,SAAS,UAAe;CAE9B,IAAI,CAAC,KAAK,MACR,OAAO;CAGT,MAAM,QACJ,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,YAAD,EAAY,WAAU,SAAU,CAAA,GAC/B,MAAM,SAAS,cAChB,EAAA,CAAA;CAGJ,IAAI,MAAM,SACR,OAAO,oBAAC,kBAAD;EAAkB,SAAS,MAAM;EAAU,UAAA;CAAwB,CAAA;CAI5E,MAAM,YAAY,MAAM,aAAa;CACrC,IAAI,CAAC,OAAO,OAAO,MAAM,SAAc,KAAK,SAAS,SAAS,GAC5D,OAAO;CAGT,OACE,oBAAC,kBAAD;EAAkB,QAAQ,oBAACA,QAAD,EAAM,MAAM,OAAO,KAAK,SAAS,EAAI,CAAA;EAC5D,UAAA;CACe,CAAA;AAEtB;AASA,MAAM,kBAAkB,UAAyC;CAC/D,MAAM,OAAO,QAAQ;CACrB,OACE,qBAAC,kBAAD;EAAkB,eAAe,KAAK,OAAO;EAA7C,UAAA,CACE,oBAAC,QAAD,EAAQ,WAAU,SAAU,CAAA,GAC3B,MAAM,SAAS,QACA;;AAEtB;AAEA,WAAW,QAAQ;AACnB,WAAW,gBAAgB;AAC3B,WAAW,kBAAkB;AAC7B,WAAW,iBAAiB"}
@@ -1,4 +1,5 @@
1
1
  import { type IconComponent } from "@alepha/ui/components/control-base/icon-hint";
2
+ import { type ControlDateProps } from "@alepha/ui/components/control-date/control-date";
2
3
  import { type ControlSelectSize, type SelectOption } from "@alepha/ui/components/control-select/control-select";
3
4
  import { type ControlUploadProps } from "@alepha/ui/components/control-upload/control-upload";
4
5
  import { type BaseInputField } from "alepha/react/form";
@@ -48,10 +49,32 @@ export interface ControlProps {
48
49
  * Force a date-time picker.
49
50
  */
50
51
  datetime?: boolean;
52
+ /**
53
+ * Force a date-range picker, regardless of the schema's format.
54
+ *
55
+ * Rarely needed: `z.dateRange()` tags the array itself, so the control
56
+ * selects itself. Here for the same reason `date` and `datetime` are - a
57
+ * field whose schema is a plain pair of strings can still ask for it.
58
+ */
59
+ dateRange?: boolean;
51
60
  /**
52
61
  * Force a time picker.
53
62
  */
54
63
  time?: boolean;
64
+ /**
65
+ * Date picker caption style — `"dropdown"` swaps the month arrows for
66
+ * month/year selects. See {@link ControlDateProps.captionLayout}.
67
+ */
68
+ captionLayout?: ControlDateProps["captionLayout"];
69
+ /** First selectable month of a date picker. */
70
+ startMonth?: Date;
71
+ /** Last selectable month of a date picker. */
72
+ endMonth?: Date;
73
+ /**
74
+ * Date-of-birth shorthand: a year dropdown covering the last 120 years.
75
+ * See {@link ControlDateProps.birthdate}.
76
+ */
77
+ birthdate?: boolean;
55
78
  /**
56
79
  * Force a `<Select>`.
57
80
  */
@@ -168,6 +191,12 @@ export interface ControlProps {
168
191
  * compile. Without this a control cannot carry a test hook, which meant a
169
192
  * surface with an e2e had to keep a raw `<input>` rather than adopt the
170
193
  * shared control.
194
+ *
195
+ * ⚠️ **`autoComplete` does not go here.** `Control` takes it as a
196
+ * first-class prop, and `ControlPassword` writes its own after spreading
197
+ * this object - so a value passed through `inputProps` is silently
198
+ * replaced by `"current-password"`, which on a field holding a deploy
199
+ * token is the password-manager prompt the masking exists to avoid.
171
200
  */
172
201
  inputProps?: HTMLAttributes<HTMLElement> & {
173
202
  [attribute: `data-${string}`]: string | number | boolean | undefined;
@@ -235,4 +264,26 @@ export interface ControlProps {
235
264
  * result with explicit props, and dispatches to the right sub-control.
236
265
  */
237
266
  export declare const Control: (props: ControlProps) => ReactNode;
267
+ /**
268
+ * The raw `$control` a field declares, object form or function form.
269
+ *
270
+ * It rides on zod's `.meta()` registry rather than being a plain schema
271
+ * property, and the field may be wrapped (optional / nullable / default), so
272
+ * the wrapper has to be peeled before the meta is readable.
273
+ *
274
+ * Exported because the LAYOUT needs it too: `AutoForm` sizes a grid cell from
275
+ * the width `$control` asks for, and a function-form `$control` has no `.width`
276
+ * to read off the function itself. Pair it with {@link resolveSchemaControl}.
277
+ */
278
+ export declare const readSchemaControl: (input: BaseInputField | undefined) => unknown;
279
+ /**
280
+ * Re-render when a function-form `$control` may have changed its mind, which
281
+ * is on any change to a field OTHER than this one. An object-form `$control`
282
+ * is static and needs no subscription.
283
+ *
284
+ * Exported alongside {@link readSchemaControl}, and for the same reason: a
285
+ * consumer that resolves `$control` itself has to re-resolve on the same
286
+ * events, or it renders a stale answer.
287
+ */
288
+ export declare const useDynamicControlRefresh: (input: BaseInputField | undefined) => void;
238
289
  //# sourceMappingURL=control.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../../src/components/control/control.tsx"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,8CAA8C,CAAC;AAKtD,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,qDAAqD,CAAC;AAO7D,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAC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,QAAQ,GAAG,OAAO,CACpD,CAAC;CACP;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,UAAW,YAAY,cA+a1C,CAAC"}
1
+ {"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../../src/components/control/control.tsx"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,iDAAiD,CAAC;AAIzD,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,qDAAqD,CAAC;AAO7D,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;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