@eifi1/ui-kit 0.51.6 → 0.52.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 (805) hide show
  1. package/README.md +146 -26
  2. package/dist/account/account-parts.d.ts +10 -8
  3. package/dist/account/account-parts.js +1 -18
  4. package/dist/account/account-parts.js.map +1 -1
  5. package/dist/account/data-export-setting-labels.js +1 -1
  6. package/dist/account/data-export-setting-labels.js.map +1 -1
  7. package/dist/account/delete-account-setting-labels.js +1 -1
  8. package/dist/account/delete-account-setting-labels.js.map +1 -1
  9. package/dist/account/email-change-setting-labels.js +1 -1
  10. package/dist/account/email-change-setting-labels.js.map +1 -1
  11. package/dist/account/passkeys-setting.d.ts +9 -2
  12. package/dist/account/passkeys-setting.js +41 -29
  13. package/dist/account/passkeys-setting.js.map +1 -1
  14. package/dist/account/sessions-setting.d.ts +3 -2
  15. package/dist/account/sessions-setting.js +10 -8
  16. package/dist/account/sessions-setting.js.map +1 -1
  17. package/dist/admin/admin-action-confirm.js +3 -7
  18. package/dist/admin/admin-action-confirm.js.map +1 -1
  19. package/dist/admin/admin-parts.d.ts +6 -3
  20. package/dist/admin/admin-parts.js +6 -21
  21. package/dist/admin/admin-parts.js.map +1 -1
  22. package/dist/admin/mail-test-card-labels.js +1 -1
  23. package/dist/admin/mail-test-card-labels.js.map +1 -1
  24. package/dist/admin/plan-change-labels.d.ts +2 -2
  25. package/dist/admin/plan-change-labels.js +1 -17
  26. package/dist/admin/plan-change-labels.js.map +1 -1
  27. package/dist/admin/plan-change.d.ts +3 -42
  28. package/dist/admin/plan-change.js +1 -1
  29. package/dist/admin/plan-change.js.map +1 -1
  30. package/dist/admin/reviewer-scope-editor.js +3 -3
  31. package/dist/admin/reviewer-scope-editor.js.map +1 -1
  32. package/dist/auth/auth-errors-labels.d.ts +11 -0
  33. package/dist/auth/auth-errors-labels.js +13 -0
  34. package/dist/auth/auth-errors-labels.js.map +1 -0
  35. package/dist/auth/auth-errors.d.ts +7 -23
  36. package/dist/auth/auth-errors.js +2 -15
  37. package/dist/auth/auth-errors.js.map +1 -1
  38. package/dist/auth/complete-name-dialog.d.ts +3 -2
  39. package/dist/auth/complete-name-dialog.js +3 -5
  40. package/dist/auth/complete-name-dialog.js.map +1 -1
  41. package/dist/auth/forgot-password-form-labels.js +1 -1
  42. package/dist/auth/forgot-password-form-labels.js.map +1 -1
  43. package/dist/auth/forgot-password-form.js +7 -2
  44. package/dist/auth/forgot-password-form.js.map +1 -1
  45. package/dist/auth/register-form-labels.js +1 -1
  46. package/dist/auth/register-form-labels.js.map +1 -1
  47. package/dist/auth/reset-password-form-labels.js +1 -1
  48. package/dist/auth/reset-password-form-labels.js.map +1 -1
  49. package/dist/auth/reset-password-form.js +5 -1
  50. package/dist/auth/reset-password-form.js.map +1 -1
  51. package/dist/auth/sign-in-form-labels.js +1 -1
  52. package/dist/auth/sign-in-form-labels.js.map +1 -1
  53. package/dist/auth/status-parts.d.ts +0 -3
  54. package/dist/auth/status-parts.js +0 -4
  55. package/dist/auth/status-parts.js.map +1 -1
  56. package/dist/auth/verify-email-labels.js +1 -1
  57. package/dist/auth/verify-email-labels.js.map +1 -1
  58. package/dist/auth/verify-email.js +7 -2
  59. package/dist/auth/verify-email.js.map +1 -1
  60. package/dist/billing/cancel-request.d.ts +11 -2
  61. package/dist/billing/cancel-request.js +15 -3
  62. package/dist/billing/cancel-request.js.map +1 -1
  63. package/dist/billing/cancel-subscription.d.ts +22 -10
  64. package/dist/billing/cancel-subscription.js +8 -11
  65. package/dist/billing/cancel-subscription.js.map +1 -1
  66. package/dist/billing/dialog-close.d.ts +29 -0
  67. package/dist/billing/dialog-close.js +8 -0
  68. package/dist/billing/dialog-close.js.map +1 -0
  69. package/dist/billing/plan-card.d.ts +14 -4
  70. package/dist/billing/plan-card.js +15 -8
  71. package/dist/billing/plan-card.js.map +1 -1
  72. package/dist/billing/plan-change-labels.d.ts +42 -0
  73. package/dist/billing/plan-change-labels.js +22 -0
  74. package/dist/billing/plan-change-labels.js.map +1 -0
  75. package/dist/billing/plan-switch.d.ts +21 -9
  76. package/dist/billing/plan-switch.js +10 -8
  77. package/dist/billing/plan-switch.js.map +1 -1
  78. package/dist/chart.d.ts +12 -0
  79. package/dist/chart.js +16 -1
  80. package/dist/chart.js.map +1 -1
  81. package/dist/components/account-chips.d.ts +5 -5
  82. package/dist/components/account-chips.js +11 -13
  83. package/dist/components/account-chips.js.map +1 -1
  84. package/dist/components/alert-banner.d.ts +16 -5
  85. package/dist/components/alert-banner.js +46 -1
  86. package/dist/components/alert-banner.js.map +1 -1
  87. package/dist/components/amount-input.d.ts +22 -4
  88. package/dist/components/amount-input.js +3 -3
  89. package/dist/components/amount-input.js.map +1 -1
  90. package/dist/components/autocomplete.js +57 -65
  91. package/dist/components/autocomplete.js.map +1 -1
  92. package/dist/components/bulk-action-bar.d.ts +12 -2
  93. package/dist/components/bulk-action-bar.js +65 -21
  94. package/dist/components/bulk-action-bar.js.map +1 -1
  95. package/dist/components/button-look.d.ts +5 -5
  96. package/dist/components/button-look.js.map +1 -1
  97. package/dist/components/button.d.ts +2 -2
  98. package/dist/components/button.js.map +1 -1
  99. package/dist/components/calculator.d.ts +21 -2
  100. package/dist/components/calculator.js +53 -14
  101. package/dist/components/calculator.js.map +1 -1
  102. package/dist/components/chart-edge.d.ts +16 -0
  103. package/dist/components/chart-edge.js +14 -1
  104. package/dist/components/chart-edge.js.map +1 -1
  105. package/dist/components/chart-figure.d.ts +13 -0
  106. package/dist/components/chart-figure.js +15 -0
  107. package/dist/components/chart-figure.js.map +1 -0
  108. package/dist/components/chart-zoom-core.js +1 -4
  109. package/dist/components/chart-zoom-core.js.map +1 -1
  110. package/dist/components/chart.d.ts +8 -1
  111. package/dist/components/chart.js +19 -10
  112. package/dist/components/chart.js.map +1 -1
  113. package/dist/components/combobox-core.d.ts +119 -7
  114. package/dist/components/combobox-core.js +151 -46
  115. package/dist/components/combobox-core.js.map +1 -1
  116. package/dist/components/combobox.d.ts +1 -1
  117. package/dist/components/combobox.js +142 -131
  118. package/dist/components/combobox.js.map +1 -1
  119. package/dist/components/copy-button.d.ts +6 -5
  120. package/dist/components/copy-button.js +5 -3
  121. package/dist/components/copy-button.js.map +1 -1
  122. package/dist/components/country-select.js +2 -2
  123. package/dist/components/country-select.js.map +1 -1
  124. package/dist/components/data-table-column-settings.d.ts +1 -1
  125. package/dist/components/data-table-column-settings.js +33 -7
  126. package/dist/components/data-table-column-settings.js.map +1 -1
  127. package/dist/components/data-table-filters.d.ts +4 -2
  128. package/dist/components/data-table-filters.js +2 -2
  129. package/dist/components/data-table-filters.js.map +1 -1
  130. package/dist/components/data-table-fit.d.ts +6 -4
  131. package/dist/components/data-table-fit.js +4 -1
  132. package/dist/components/data-table-fit.js.map +1 -1
  133. package/dist/components/data-table-groups.d.ts +1 -1
  134. package/dist/components/data-table-groups.js.map +1 -1
  135. package/dist/components/data-table-head.d.ts +1 -1
  136. package/dist/components/data-table-head.js +15 -12
  137. package/dist/components/data-table-head.js.map +1 -1
  138. package/dist/components/data-table-mobile.d.ts +36 -7
  139. package/dist/components/data-table-mobile.js +63 -31
  140. package/dist/components/data-table-mobile.js.map +1 -1
  141. package/dist/components/data-table-pagination.js +11 -6
  142. package/dist/components/data-table-pagination.js.map +1 -1
  143. package/dist/components/data-table-resize.d.ts +1 -1
  144. package/dist/components/data-table-resize.js.map +1 -1
  145. package/dist/components/data-table-row-actions.d.ts +2 -2
  146. package/dist/components/data-table-row-actions.js.map +1 -1
  147. package/dist/components/data-table-row.d.ts +6 -2
  148. package/dist/components/data-table-row.js +17 -10
  149. package/dist/components/data-table-row.js.map +1 -1
  150. package/dist/components/data-table-selection.d.ts +1 -1
  151. package/dist/components/data-table-selection.js.map +1 -1
  152. package/dist/components/data-table-shared.d.ts +10 -2
  153. package/dist/components/data-table-shared.js +18 -0
  154. package/dist/components/data-table-shared.js.map +1 -1
  155. package/dist/components/data-table-sort.d.ts +21 -2
  156. package/dist/components/data-table-sort.js +24 -0
  157. package/dist/components/data-table-sort.js.map +1 -1
  158. package/dist/components/data-table-virtual.d.ts +1 -1
  159. package/dist/components/data-table-virtual.js +18 -6
  160. package/dist/components/data-table-virtual.js.map +1 -1
  161. package/dist/components/data-table.d.ts +25 -8
  162. package/dist/components/data-table.js +154 -25
  163. package/dist/components/data-table.js.map +1 -1
  164. package/dist/components/date-field.d.ts +24 -2
  165. package/dist/components/date-field.js +33 -8
  166. package/dist/components/date-field.js.map +1 -1
  167. package/dist/components/date-picker.d.ts +15 -2
  168. package/dist/components/date-picker.js +55 -26
  169. package/dist/components/date-picker.js.map +1 -1
  170. package/dist/components/date-range-picker.d.ts +47 -20
  171. package/dist/components/date-range-picker.js +23 -7
  172. package/dist/components/date-range-picker.js.map +1 -1
  173. package/dist/components/dialog-frame.d.ts +2 -1
  174. package/dist/components/dialog-frame.js.map +1 -1
  175. package/dist/components/entity-combobox.js +4 -2
  176. package/dist/components/entity-combobox.js.map +1 -1
  177. package/dist/components/error-boundary.js +37 -30
  178. package/dist/components/error-boundary.js.map +1 -1
  179. package/dist/components/{ui-labels.d.ts → field-base-labels.d.ts} +0 -2
  180. package/dist/components/{ui-labels.js → field-base-labels.js} +2 -9
  181. package/dist/components/field-base-labels.js.map +1 -0
  182. package/dist/components/field-base.d.ts +4 -3
  183. package/dist/components/field-base.js +3 -3
  184. package/dist/components/field-base.js.map +1 -1
  185. package/dist/components/field-sync-labels.d.ts +1 -0
  186. package/dist/components/field-sync-labels.js.map +1 -1
  187. package/dist/components/field-sync.d.ts +23 -1
  188. package/dist/components/field-sync.js.map +1 -1
  189. package/dist/components/form-actions.js +11 -5
  190. package/dist/components/form-actions.js.map +1 -1
  191. package/dist/components/hover-menu.d.ts +3 -0
  192. package/dist/components/hover-menu.js +5 -3
  193. package/dist/components/hover-menu.js.map +1 -1
  194. package/dist/components/icon-button.js +14 -9
  195. package/dist/components/icon-button.js.map +1 -1
  196. package/dist/components/inline-confirm.d.ts +43 -0
  197. package/dist/components/inline-confirm.js +67 -0
  198. package/dist/components/inline-confirm.js.map +1 -0
  199. package/dist/components/inline-entity-combobox.d.ts +4 -3
  200. package/dist/components/inline-entity-combobox.js +150 -141
  201. package/dist/components/inline-entity-combobox.js.map +1 -1
  202. package/dist/components/input.js +1 -1
  203. package/dist/components/input.js.map +1 -1
  204. package/dist/components/jump-calendar.js +28 -112
  205. package/dist/components/jump-calendar.js.map +1 -1
  206. package/dist/components/legal-page.d.ts +3 -1
  207. package/dist/components/legal-page.js +3 -2
  208. package/dist/components/legal-page.js.map +1 -1
  209. package/dist/components/legal.d.ts +4 -2
  210. package/dist/components/legal.js.map +1 -1
  211. package/dist/components/lightbox.d.ts +2 -2
  212. package/dist/components/lightbox.js +17 -6
  213. package/dist/components/lightbox.js.map +1 -1
  214. package/dist/components/list.d.ts +6 -2
  215. package/dist/components/list.js +4 -3
  216. package/dist/components/list.js.map +1 -1
  217. package/dist/components/measured-grid.d.ts +1 -1
  218. package/dist/components/measured-grid.js +2 -1
  219. package/dist/components/measured-grid.js.map +1 -1
  220. package/dist/components/mini-calendar.js +3 -5
  221. package/dist/components/mini-calendar.js.map +1 -1
  222. package/dist/components/modal.d.ts +24 -0
  223. package/dist/components/modal.js +12 -4
  224. package/dist/components/modal.js.map +1 -1
  225. package/dist/components/money-draft.js +7 -5
  226. package/dist/components/money-draft.js.map +1 -1
  227. package/dist/components/money-field.d.ts +2 -2
  228. package/dist/components/money-field.js.map +1 -1
  229. package/dist/components/month-grid.d.ts +55 -0
  230. package/dist/components/month-grid.js +148 -0
  231. package/dist/components/month-grid.js.map +1 -0
  232. package/dist/components/month-picker.d.ts +36 -4
  233. package/dist/components/month-picker.js +123 -146
  234. package/dist/components/month-picker.js.map +1 -1
  235. package/dist/components/multi-entity-combobox.js +2 -1
  236. package/dist/components/multi-entity-combobox.js.map +1 -1
  237. package/dist/components/multi-select.d.ts +2 -2
  238. package/dist/components/multi-select.js +11 -6
  239. package/dist/components/multi-select.js.map +1 -1
  240. package/dist/components/number-field.d.ts +6 -4
  241. package/dist/components/number-field.js +3 -2
  242. package/dist/components/number-field.js.map +1 -1
  243. package/dist/components/number-input.d.ts +4 -1
  244. package/dist/components/number-input.js +3 -2
  245. package/dist/components/number-input.js.map +1 -1
  246. package/dist/components/numpad-sheet.js.map +1 -1
  247. package/dist/components/picker-sheet.js +2 -1
  248. package/dist/components/picker-sheet.js.map +1 -1
  249. package/dist/components/pie-chart-labels.d.ts +7 -0
  250. package/dist/components/pie-chart-labels.js +1 -0
  251. package/dist/components/pie-chart-labels.js.map +1 -1
  252. package/dist/components/pie-chart.d.ts +5 -3
  253. package/dist/components/pie-chart.js +7 -22
  254. package/dist/components/pie-chart.js.map +1 -1
  255. package/dist/components/popover.d.ts +3 -0
  256. package/dist/components/popover.js +7 -1
  257. package/dist/components/popover.js.map +1 -1
  258. package/dist/components/reauth-dialog.d.ts +4 -5
  259. package/dist/components/reauth-dialog.js +1 -4
  260. package/dist/components/reauth-dialog.js.map +1 -1
  261. package/dist/components/row-actions.js +2 -1
  262. package/dist/components/row-actions.js.map +1 -1
  263. package/dist/components/section-nav.d.ts +7 -0
  264. package/dist/components/section-nav.js.map +1 -1
  265. package/dist/components/series-chart-axes.d.ts +10 -3
  266. package/dist/components/series-chart-axes.js +1 -0
  267. package/dist/components/series-chart-axes.js.map +1 -1
  268. package/dist/components/series-chart-labels.d.ts +7 -4
  269. package/dist/components/series-chart-labels.js.map +1 -1
  270. package/dist/components/series-chart.d.ts +31 -7
  271. package/dist/components/series-chart.js +72 -29
  272. package/dist/components/series-chart.js.map +1 -1
  273. package/dist/components/share-card.js +3 -3
  274. package/dist/components/share-card.js.map +1 -1
  275. package/dist/components/sign-chip-labels.d.ts +1 -0
  276. package/dist/components/sign-chip-labels.js.map +1 -1
  277. package/dist/components/sign-chip.d.ts +10 -1
  278. package/dist/components/sign-chip.js.map +1 -1
  279. package/dist/components/tabs-labels.d.ts +2 -0
  280. package/dist/components/tabs-labels.js +11 -0
  281. package/dist/components/tabs-labels.js.map +1 -0
  282. package/dist/components/tabs.d.ts +1 -1
  283. package/dist/components/tabs.js +13 -11
  284. package/dist/components/tabs.js.map +1 -1
  285. package/dist/components/toggle-legend.d.ts +2 -2
  286. package/dist/components/toggle-legend.js +6 -6
  287. package/dist/components/toggle-legend.js.map +1 -1
  288. package/dist/components/translation-review-editor.d.ts +4 -2
  289. package/dist/components/translation-review-editor.js +2 -3
  290. package/dist/components/translation-review-editor.js.map +1 -1
  291. package/dist/components/translation-review.d.ts +2 -1
  292. package/dist/components/translation-review.js +2 -2
  293. package/dist/components/translation-review.js.map +1 -1
  294. package/dist/components/treemap-labels.d.ts +26 -0
  295. package/dist/components/treemap-labels.js +10 -0
  296. package/dist/components/treemap-labels.js.map +1 -0
  297. package/dist/components/treemap-layout.d.ts +62 -0
  298. package/dist/components/treemap-layout.js +126 -0
  299. package/dist/components/treemap-layout.js.map +1 -0
  300. package/dist/components/treemap.d.ts +140 -17
  301. package/dist/components/treemap.js +324 -97
  302. package/dist/components/treemap.js.map +1 -1
  303. package/dist/components/use-table-state.d.ts +5 -5
  304. package/dist/components/use-table-state.js +4 -1
  305. package/dist/components/use-table-state.js.map +1 -1
  306. package/dist/data-table.d.ts +6 -2
  307. package/dist/data-table.js +7 -2
  308. package/dist/data-table.js.map +1 -1
  309. package/dist/eslint/index.js +1 -1
  310. package/dist/eslint/role-utilities.d.ts +36 -7
  311. package/dist/eslint/role-utilities.js +42 -9
  312. package/dist/eslint/role-utilities.js.map +1 -1
  313. package/dist/feedback/feedback-dialog.d.ts +25 -16
  314. package/dist/feedback/feedback-dialog.js +6 -2
  315. package/dist/feedback/feedback-dialog.js.map +1 -1
  316. package/dist/feedback/feedback-mutation.d.ts +30 -0
  317. package/dist/feedback/feedback-mutation.js +16 -0
  318. package/dist/feedback/feedback-mutation.js.map +1 -0
  319. package/dist/feedback/feedback-page-link.d.ts +53 -0
  320. package/dist/feedback/feedback-page-link.js +37 -0
  321. package/dist/feedback/feedback-page-link.js.map +1 -0
  322. package/dist/feedback/feedback-public-list.d.ts +12 -3
  323. package/dist/feedback/feedback-public-list.js +2 -1
  324. package/dist/feedback/feedback-public-list.js.map +1 -1
  325. package/dist/feedback/feedback-replies.d.ts +3 -1
  326. package/dist/feedback/feedback-replies.js +5 -4
  327. package/dist/feedback/feedback-replies.js.map +1 -1
  328. package/dist/feedback/feedback-row-detail-labels.js +5 -0
  329. package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
  330. package/dist/feedback/feedback-row-detail.d.ts +64 -28
  331. package/dist/feedback/feedback-row-detail.js +30 -28
  332. package/dist/feedback/feedback-row-detail.js.map +1 -1
  333. package/dist/feedback/feedback-status-undo.d.ts +30 -11
  334. package/dist/feedback/feedback-status-undo.js +10 -15
  335. package/dist/feedback/feedback-status-undo.js.map +1 -1
  336. package/dist/feedback/feedback-submit-dialog.d.ts +1 -1
  337. package/dist/feedback/feedback-submit-dialog.js +1 -1
  338. package/dist/feedback/feedback-submit-dialog.js.map +1 -1
  339. package/dist/feedback/feedback-submit.js +9 -3
  340. package/dist/feedback/feedback-submit.js.map +1 -1
  341. package/dist/feedback/feedback-swipe.d.ts +1 -1
  342. package/dist/feedback/feedback-swipe.js.map +1 -1
  343. package/dist/feedback/feedback-table.d.ts +21 -9
  344. package/dist/feedback/feedback-table.js +45 -25
  345. package/dist/feedback/feedback-table.js.map +1 -1
  346. package/dist/feedback/feedback-thread-labels.d.ts +2 -2
  347. package/dist/feedback/feedback-thread-labels.js.map +1 -1
  348. package/dist/feedback/feedback-thread.d.ts +24 -23
  349. package/dist/feedback/feedback-thread.js +2 -1
  350. package/dist/feedback/feedback-thread.js.map +1 -1
  351. package/dist/feedback.d.ts +34 -0
  352. package/dist/feedback.js +42 -0
  353. package/dist/feedback.js.map +1 -1
  354. package/dist/hooks/use-dismiss.js.map +1 -1
  355. package/dist/hooks/use-focus-trap.d.ts +35 -0
  356. package/dist/hooks/use-focus-trap.js +6 -4
  357. package/dist/hooks/use-focus-trap.js.map +1 -1
  358. package/dist/hooks/use-hotkey.d.ts +5 -2
  359. package/dist/hooks/use-hotkey.js +5 -4
  360. package/dist/hooks/use-hotkey.js.map +1 -1
  361. package/dist/hooks/use-long-press.d.ts +7 -4
  362. package/dist/hooks/use-long-press.js +3 -0
  363. package/dist/hooks/use-long-press.js.map +1 -1
  364. package/dist/hooks/use-media-query.js +12 -4
  365. package/dist/hooks/use-media-query.js.map +1 -1
  366. package/dist/hooks/use-mounted.d.ts +22 -0
  367. package/dist/hooks/use-mounted.js +24 -0
  368. package/dist/hooks/use-mounted.js.map +1 -0
  369. package/dist/hooks/use-overlay-history.d.ts +7 -1
  370. package/dist/hooks/use-overlay-history.js +35 -5
  371. package/dist/hooks/use-overlay-history.js.map +1 -1
  372. package/dist/i18n/defaults.js +4 -5
  373. package/dist/i18n/defaults.js.map +1 -1
  374. package/dist/i18n/german.js +7 -1
  375. package/dist/i18n/german.js.map +1 -1
  376. package/dist/i18n/kit-labels.d.ts +9 -2
  377. package/dist/i18n/kit-labels.js.map +1 -1
  378. package/dist/i18n/locales/en.js +20 -41
  379. package/dist/i18n/locales/en.js.map +3 -3
  380. package/dist/i18n/locales/es.js +7 -1
  381. package/dist/i18n/locales/es.js.map +1 -1
  382. package/dist/i18n/locales/fr.js +20 -10
  383. package/dist/i18n/locales/fr.js.map +1 -1
  384. package/dist/i18n/locales/hu.js +9 -1
  385. package/dist/i18n/locales/hu.js.map +1 -1
  386. package/dist/i18n/locales/it.js +7 -1
  387. package/dist/i18n/locales/it.js.map +1 -1
  388. package/dist/i18n/locales/zh.js +8 -1
  389. package/dist/i18n/locales/zh.js.map +1 -1
  390. package/dist/i18n/review.js +5 -0
  391. package/dist/i18n/review.js.map +1 -1
  392. package/dist/index.d.ts +64 -17
  393. package/dist/index.js +77 -12
  394. package/dist/index.js.map +1 -1
  395. package/dist/landing/routing.d.ts +3 -1
  396. package/dist/landing/routing.js +4 -7
  397. package/dist/landing/routing.js.map +1 -1
  398. package/dist/lib/broadcast.d.ts +17 -0
  399. package/dist/lib/broadcast.js +30 -0
  400. package/dist/lib/broadcast.js.map +1 -0
  401. package/dist/lib/calc.d.ts +7 -1
  402. package/dist/lib/calc.js +3 -1
  403. package/dist/lib/calc.js.map +1 -1
  404. package/dist/lib/clipboard-minus.d.ts +2 -2
  405. package/dist/lib/clipboard-minus.js +1 -1
  406. package/dist/lib/clipboard-minus.js.map +1 -1
  407. package/dist/lib/date-format.d.ts +37 -2
  408. package/dist/lib/date-format.js +34 -8
  409. package/dist/lib/date-format.js.map +1 -1
  410. package/dist/lib/day-format.d.ts +46 -0
  411. package/dist/lib/day-format.js +46 -0
  412. package/dist/lib/day-format.js.map +1 -0
  413. package/dist/lib/decimal-marks.d.ts +7 -1
  414. package/dist/lib/decimal-marks.js +5 -2
  415. package/dist/lib/decimal-marks.js.map +1 -1
  416. package/dist/lib/describe-failure.d.ts +14 -0
  417. package/dist/lib/describe-failure.js +9 -0
  418. package/dist/lib/describe-failure.js.map +1 -0
  419. package/dist/lib/direction.d.ts +16 -0
  420. package/dist/lib/direction.js +9 -1
  421. package/dist/lib/direction.js.map +1 -1
  422. package/dist/lib/focus-left.d.ts +63 -0
  423. package/dist/lib/focus-left.js +67 -0
  424. package/dist/lib/focus-left.js.map +1 -0
  425. package/dist/lib/format.d.ts +5 -3
  426. package/dist/lib/format.js +16 -13
  427. package/dist/lib/format.js.map +1 -1
  428. package/dist/lib/http-status.d.ts +24 -0
  429. package/dist/lib/http-status.js +14 -0
  430. package/dist/lib/http-status.js.map +1 -0
  431. package/dist/lib/intl-cache.d.ts +14 -0
  432. package/dist/lib/intl-cache.js +15 -0
  433. package/dist/lib/intl-cache.js.map +1 -0
  434. package/dist/lib/isin.d.ts +10 -0
  435. package/dist/lib/isin.js.map +1 -1
  436. package/dist/lib/iso-day.d.ts +11 -0
  437. package/dist/lib/iso-day.js +8 -0
  438. package/dist/lib/iso-day.js.map +1 -0
  439. package/dist/lib/lazy-with-fallback.d.ts +31 -0
  440. package/dist/lib/lazy-with-fallback.js +40 -0
  441. package/dist/lib/lazy-with-fallback.js.map +1 -0
  442. package/dist/lib/path-pattern.d.ts +34 -0
  443. package/dist/lib/path-pattern.js +24 -0
  444. package/dist/lib/path-pattern.js.map +1 -0
  445. package/dist/lib/reduced-motion.d.ts +2 -1
  446. package/dist/lib/reduced-motion.js.map +1 -1
  447. package/dist/lib/round.d.ts +2 -1
  448. package/dist/lib/round.js +2 -1
  449. package/dist/lib/round.js.map +1 -1
  450. package/dist/lib/safe-storage.d.ts +24 -5
  451. package/dist/lib/safe-storage.js +27 -2
  452. package/dist/lib/safe-storage.js.map +1 -1
  453. package/dist/lib/session-refresh.js +1 -1
  454. package/dist/lib/session-refresh.js.map +1 -1
  455. package/dist/lib/share-format.d.ts +13 -0
  456. package/dist/lib/share-format.js +10 -0
  457. package/dist/lib/share-format.js.map +1 -0
  458. package/dist/lib/text-case.d.ts +17 -0
  459. package/dist/lib/text-case.js +8 -0
  460. package/dist/lib/text-case.js.map +1 -0
  461. package/dist/lib/text-match.d.ts +38 -0
  462. package/dist/lib/text-match.js +24 -2
  463. package/dist/lib/text-match.js.map +1 -1
  464. package/dist/lib/thenable.d.ts +13 -0
  465. package/dist/lib/thenable.js +8 -0
  466. package/dist/lib/thenable.js.map +1 -0
  467. package/dist/lib/translation-review.d.ts +7 -2
  468. package/dist/lib/translation-review.js +4 -4
  469. package/dist/lib/translation-review.js.map +1 -1
  470. package/dist/notifications/device-zone-report.js +1 -1
  471. package/dist/notifications/device-zone-report.js.map +1 -1
  472. package/dist/notifications/notification-bell.d.ts +2 -1
  473. package/dist/notifications/notification-bell.js +3 -3
  474. package/dist/notifications/notification-bell.js.map +1 -1
  475. package/dist/notifications/notification-inbox.d.ts +10 -6
  476. package/dist/notifications/notification-inbox.js +26 -48
  477. package/dist/notifications/notification-inbox.js.map +1 -1
  478. package/dist/notifications/notification-parts.d.ts +3 -2
  479. package/dist/notifications/notification-parts.js +1 -3
  480. package/dist/notifications/notification-parts.js.map +1 -1
  481. package/dist/notifications/notification-types-setting.js +1 -1
  482. package/dist/notifications/notification-types-setting.js.map +1 -1
  483. package/dist/notifications/notifications-labels.d.ts +6 -0
  484. package/dist/notifications/notifications-labels.js +1 -0
  485. package/dist/notifications/notifications-labels.js.map +1 -1
  486. package/dist/notifications/push-device-setting.js +1 -1
  487. package/dist/notifications/push-device-setting.js.map +1 -1
  488. package/dist/notifications/push-devices-setting.d.ts +2 -1
  489. package/dist/notifications/push-devices-setting.js +27 -49
  490. package/dist/notifications/push-devices-setting.js.map +1 -1
  491. package/dist/notifications/quiet-hours-setting.d.ts +10 -3
  492. package/dist/notifications/quiet-hours-setting.js +65 -26
  493. package/dist/notifications/quiet-hours-setting.js.map +1 -1
  494. package/dist/notifications/unsubscribe-panel.js +4 -7
  495. package/dist/notifications/unsubscribe-panel.js.map +1 -1
  496. package/dist/notifications/use-push-device.d.ts +39 -1
  497. package/dist/notifications/use-push-device.js +28 -7
  498. package/dist/notifications/use-push-device.js.map +1 -1
  499. package/dist/offline/query-persistence.d.ts +3 -1
  500. package/dist/offline/query-persistence.js +19 -2
  501. package/dist/offline/query-persistence.js.map +1 -1
  502. package/dist/rhf/fields.d.ts +11 -4
  503. package/dist/rhf/fields.js.map +1 -1
  504. package/dist/search/command-palette.js +1 -1
  505. package/dist/search/command-palette.js.map +1 -1
  506. package/dist/search/global-search.js +19 -9
  507. package/dist/search/global-search.js.map +1 -1
  508. package/dist/search/use-command-key.d.ts +12 -1
  509. package/dist/search/use-command-key.js +3 -12
  510. package/dist/search/use-command-key.js.map +1 -1
  511. package/dist/search.d.ts +7 -0
  512. package/dist/search.js +10 -0
  513. package/dist/search.js.map +1 -1
  514. package/dist/settings/use-settings-focus.js +1 -0
  515. package/dist/settings/use-settings-focus.js.map +1 -1
  516. package/dist/shell/account-menu-language.d.ts +21 -5
  517. package/dist/shell/account-menu-language.js +3 -1
  518. package/dist/shell/account-menu-language.js.map +1 -1
  519. package/dist/shell/account-menu-text-size.d.ts +26 -9
  520. package/dist/shell/account-menu-text-size.js +3 -2
  521. package/dist/shell/account-menu-text-size.js.map +1 -1
  522. package/dist/shell/dev-menu.js +5 -18
  523. package/dist/shell/dev-menu.js.map +1 -1
  524. package/dist/shell/role-switcher.d.ts +7 -0
  525. package/dist/shell/role-switcher.js.map +1 -1
  526. package/dist/shell/top-bar-actions.d.ts +1 -1
  527. package/dist/shell/top-bar-actions.js.map +1 -1
  528. package/dist/shell/top-bar-parts-labels.d.ts +0 -2
  529. package/dist/shell/top-bar-parts-labels.js +0 -1
  530. package/dist/shell/top-bar-parts-labels.js.map +1 -1
  531. package/dist/shell.d.ts +27 -8
  532. package/dist/shell.js +28 -7
  533. package/dist/shell.js.map +1 -1
  534. package/dist/sync/engine.d.ts +30 -4
  535. package/dist/sync/engine.js +172 -52
  536. package/dist/sync/engine.js.map +1 -1
  537. package/dist/sync.d.ts +6 -2
  538. package/dist/sync.js +6 -1
  539. package/dist/sync.js.map +1 -1
  540. package/dist/testing/css-variables.js +3 -8
  541. package/dist/testing/css-variables.js.map +1 -1
  542. package/dist/theme/contrast.d.ts +2 -1
  543. package/dist/theme/contrast.js +3 -8
  544. package/dist/theme/contrast.js.map +1 -1
  545. package/dist/theme/palette-store.js +6 -6
  546. package/dist/theme/palette-store.js.map +1 -1
  547. package/dist/theme/text-size.js +3 -8
  548. package/dist/theme/text-size.js.map +1 -1
  549. package/dist/theme/theme-store.js +3 -6
  550. package/dist/theme/theme-store.js.map +1 -1
  551. package/dist/tour/tour-catalogue.d.ts +7 -4
  552. package/dist/tour/tour-catalogue.js +12 -10
  553. package/dist/tour/tour-catalogue.js.map +1 -1
  554. package/dist/tour/tour-dock.d.ts +0 -2
  555. package/dist/tour/tour-dock.js +0 -2
  556. package/dist/tour/tour-dock.js.map +1 -1
  557. package/dist/tour/tour-gates.d.ts +4 -0
  558. package/dist/tour/tour-gates.js +14 -0
  559. package/dist/tour/tour-gates.js.map +1 -1
  560. package/dist/tour/tour-overlay.d.ts +27 -0
  561. package/dist/tour/tour-overlay.js +741 -0
  562. package/dist/tour/tour-overlay.js.map +1 -0
  563. package/dist/tour/tour.d.ts +16 -4
  564. package/dist/tour/tour.js +62 -778
  565. package/dist/tour/tour.js.map +1 -1
  566. package/dist/tour/use-tour-progress.js +1 -1
  567. package/dist/tour/use-tour-progress.js.map +1 -1
  568. package/dist/tour/use-tour-url-sync.js +2 -2
  569. package/dist/tour/use-tour-url-sync.js.map +1 -1
  570. package/dist/wizard/stepper-nav.d.ts +5 -1
  571. package/dist/wizard/stepper-nav.js.map +1 -1
  572. package/dist/wizard/types.d.ts +6 -2
  573. package/dist/wizard/types.js.map +1 -1
  574. package/dist/wizard/use-wizard.d.ts +3 -1
  575. package/dist/wizard/use-wizard.js.map +1 -1
  576. package/dist/wizard/validation.d.ts +3 -1
  577. package/dist/wizard/validation.js.map +1 -1
  578. package/package.json +12 -8
  579. package/src/account/account-parts.ts +5 -25
  580. package/src/account/data-export-setting-labels.ts +1 -1
  581. package/src/account/delete-account-setting-labels.ts +1 -1
  582. package/src/account/email-change-setting-labels.ts +1 -1
  583. package/src/account/passkeys-setting.tsx +60 -38
  584. package/src/account/sessions-setting.tsx +18 -12
  585. package/src/admin/admin-action-confirm.tsx +5 -10
  586. package/src/admin/admin-parts.ts +11 -25
  587. package/src/admin/mail-test-card-labels.ts +1 -1
  588. package/src/admin/plan-change-labels.ts +5 -23
  589. package/src/admin/plan-change.tsx +7 -44
  590. package/src/admin/reviewer-scope-editor.tsx +3 -3
  591. package/src/auth/auth-errors-labels.ts +23 -0
  592. package/src/auth/auth-errors.ts +11 -38
  593. package/src/auth/complete-name-dialog.tsx +9 -8
  594. package/src/auth/forgot-password-form-labels.ts +1 -1
  595. package/src/auth/forgot-password-form.tsx +11 -6
  596. package/src/auth/register-form-labels.ts +1 -1
  597. package/src/auth/reset-password-form-labels.ts +1 -1
  598. package/src/auth/reset-password-form.tsx +8 -4
  599. package/src/auth/sign-in-form-labels.ts +1 -1
  600. package/src/auth/status-parts.tsx +0 -6
  601. package/src/auth/verify-email-labels.ts +1 -1
  602. package/src/auth/verify-email.tsx +11 -6
  603. package/src/billing/cancel-request.ts +28 -6
  604. package/src/billing/cancel-subscription.tsx +29 -22
  605. package/src/billing/dialog-close.ts +34 -0
  606. package/src/billing/plan-card.tsx +36 -11
  607. package/src/billing/plan-change-labels.ts +66 -0
  608. package/src/billing/plan-switch.tsx +31 -20
  609. package/src/chart.ts +21 -3
  610. package/src/components/account-chips.tsx +20 -23
  611. package/src/components/alert-banner.tsx +82 -5
  612. package/src/components/amount-input.tsx +32 -14
  613. package/src/components/autocomplete.tsx +64 -70
  614. package/src/components/bulk-action-bar.tsx +70 -2
  615. package/src/components/button-look.ts +5 -5
  616. package/src/components/button.tsx +2 -2
  617. package/src/components/calculator.tsx +98 -17
  618. package/src/components/chart-edge.ts +34 -1
  619. package/src/components/chart-figure.tsx +35 -0
  620. package/src/components/chart-zoom-core.tsx +6 -5
  621. package/src/components/chart.tsx +26 -5
  622. package/src/components/combobox-core.tsx +303 -69
  623. package/src/components/combobox.tsx +184 -155
  624. package/src/components/copy-button.tsx +34 -23
  625. package/src/components/country-select.tsx +16 -11
  626. package/src/components/data-table-column-settings.tsx +52 -10
  627. package/src/components/data-table-filters.ts +6 -4
  628. package/src/components/data-table-fit.ts +19 -5
  629. package/src/components/data-table-groups.tsx +1 -1
  630. package/src/components/data-table-head.tsx +32 -22
  631. package/src/components/data-table-mobile.tsx +110 -27
  632. package/src/components/data-table-pagination.tsx +21 -6
  633. package/src/components/data-table-resize.ts +1 -1
  634. package/src/components/data-table-row-actions.tsx +3 -3
  635. package/src/components/data-table-row.tsx +25 -14
  636. package/src/components/data-table-selection.ts +1 -1
  637. package/src/components/data-table-shared.tsx +33 -1
  638. package/src/components/data-table-sort.ts +57 -2
  639. package/src/components/data-table-virtual.ts +32 -8
  640. package/src/components/data-table.tsx +267 -41
  641. package/src/components/date-field.tsx +65 -8
  642. package/src/components/date-picker.tsx +125 -48
  643. package/src/components/date-range-picker.tsx +82 -31
  644. package/src/components/dialog-frame.tsx +2 -1
  645. package/src/components/entity-combobox.tsx +4 -1
  646. package/src/components/error-boundary.tsx +53 -39
  647. package/src/components/field-base-labels.ts +20 -0
  648. package/src/components/field-base.tsx +13 -7
  649. package/src/components/field-sync-labels.ts +1 -0
  650. package/src/components/field-sync.tsx +23 -1
  651. package/src/components/form-actions.tsx +20 -5
  652. package/src/components/hover-menu.tsx +18 -8
  653. package/src/components/icon-button.tsx +14 -9
  654. package/src/components/inline-confirm.tsx +116 -0
  655. package/src/components/inline-entity-combobox.tsx +198 -152
  656. package/src/components/input.tsx +1 -1
  657. package/src/components/jump-calendar.tsx +30 -146
  658. package/src/components/legal-page.tsx +10 -7
  659. package/src/components/legal.tsx +4 -2
  660. package/src/components/lightbox.tsx +21 -8
  661. package/src/components/list.tsx +14 -5
  662. package/src/components/measured-grid.tsx +8 -4
  663. package/src/components/mini-calendar.tsx +6 -5
  664. package/src/components/modal.tsx +45 -4
  665. package/src/components/money-draft.ts +16 -5
  666. package/src/components/money-field.tsx +2 -2
  667. package/src/components/month-grid.tsx +229 -0
  668. package/src/components/month-picker.tsx +192 -200
  669. package/src/components/multi-entity-combobox.tsx +1 -0
  670. package/src/components/multi-select.tsx +21 -9
  671. package/src/components/number-field.tsx +14 -7
  672. package/src/components/number-input.tsx +9 -3
  673. package/src/components/numpad-sheet.tsx +4 -3
  674. package/src/components/picker-sheet.tsx +12 -9
  675. package/src/components/pie-chart-labels.ts +8 -0
  676. package/src/components/pie-chart.tsx +22 -28
  677. package/src/components/popover.tsx +18 -1
  678. package/src/components/reauth-dialog.tsx +6 -10
  679. package/src/components/row-actions.tsx +2 -1
  680. package/src/components/section-nav.tsx +7 -0
  681. package/src/components/series-chart-axes.ts +11 -3
  682. package/src/components/series-chart-labels.ts +7 -4
  683. package/src/components/series-chart.tsx +178 -69
  684. package/src/components/share-card.tsx +6 -6
  685. package/src/components/sign-chip-labels.ts +1 -0
  686. package/src/components/sign-chip.tsx +10 -1
  687. package/src/components/tabs-labels.ts +13 -0
  688. package/src/components/tabs.tsx +35 -19
  689. package/src/components/toggle-legend.tsx +16 -11
  690. package/src/components/translation-review-editor.tsx +6 -5
  691. package/src/components/translation-review.tsx +4 -3
  692. package/src/components/treemap-labels.ts +39 -0
  693. package/src/components/treemap-layout.ts +210 -0
  694. package/src/components/treemap.tsx +722 -133
  695. package/src/components/use-table-state.ts +12 -9
  696. package/src/data-table.ts +9 -2
  697. package/src/eslint/role-utilities.ts +97 -19
  698. package/src/feedback/feedback-dialog.tsx +30 -19
  699. package/src/feedback/feedback-mutation.ts +41 -0
  700. package/src/feedback/feedback-page-link.ts +90 -0
  701. package/src/feedback/feedback-public-list.tsx +17 -5
  702. package/src/feedback/feedback-replies.tsx +13 -6
  703. package/src/feedback/feedback-row-detail-labels.ts +5 -0
  704. package/src/feedback/feedback-row-detail.tsx +103 -67
  705. package/src/feedback/feedback-status-undo.ts +41 -27
  706. package/src/feedback/feedback-submit-dialog.tsx +2 -2
  707. package/src/feedback/feedback-submit.tsx +21 -7
  708. package/src/feedback/feedback-swipe.tsx +1 -1
  709. package/src/feedback/feedback-table.tsx +86 -38
  710. package/src/feedback/feedback-thread-labels.ts +2 -2
  711. package/src/feedback/feedback-thread.tsx +27 -25
  712. package/src/feedback.ts +42 -0
  713. package/src/hooks/use-dismiss.ts +3 -2
  714. package/src/hooks/use-focus-trap.ts +8 -24
  715. package/src/hooks/use-hotkey.ts +24 -7
  716. package/src/hooks/use-long-press.ts +16 -2
  717. package/src/hooks/use-media-query.ts +20 -4
  718. package/src/hooks/use-mounted.ts +39 -0
  719. package/src/hooks/use-overlay-history.ts +70 -5
  720. package/src/i18n/defaults.ts +4 -5
  721. package/src/i18n/german.ts +8 -2
  722. package/src/i18n/kit-labels.tsx +9 -2
  723. package/src/i18n/locales/es.ts +8 -2
  724. package/src/i18n/locales/fr.ts +21 -13
  725. package/src/i18n/locales/hu.ts +10 -2
  726. package/src/i18n/locales/it.ts +8 -2
  727. package/src/i18n/locales/zh.ts +9 -2
  728. package/src/i18n/review.ts +5 -0
  729. package/src/index.ts +103 -13
  730. package/src/landing/routing.tsx +14 -10
  731. package/src/lib/broadcast.ts +52 -0
  732. package/src/lib/calc.ts +13 -2
  733. package/src/lib/clipboard-minus.ts +14 -4
  734. package/src/lib/date-format.ts +89 -13
  735. package/src/lib/day-format.ts +96 -0
  736. package/src/lib/decimal-marks.ts +12 -3
  737. package/src/lib/describe-failure.ts +18 -0
  738. package/src/lib/direction.ts +39 -0
  739. package/src/lib/focus-left.ts +156 -0
  740. package/src/lib/format.ts +34 -19
  741. package/src/lib/http-status.ts +38 -0
  742. package/src/lib/intl-cache.ts +25 -0
  743. package/src/lib/isin.ts +10 -0
  744. package/src/lib/iso-day.ts +13 -0
  745. package/src/lib/lazy-with-fallback.ts +82 -0
  746. package/src/lib/path-pattern.ts +55 -0
  747. package/src/lib/reduced-motion.ts +2 -1
  748. package/src/lib/round.ts +7 -2
  749. package/src/lib/safe-storage.ts +48 -6
  750. package/src/lib/session-refresh.ts +1 -1
  751. package/src/lib/share-format.ts +18 -0
  752. package/src/lib/text-case.ts +19 -0
  753. package/src/lib/text-match.ts +69 -2
  754. package/src/lib/thenable.ts +19 -0
  755. package/src/lib/translation-review.ts +13 -5
  756. package/src/notifications/device-zone-report.ts +1 -1
  757. package/src/notifications/notification-bell.tsx +7 -4
  758. package/src/notifications/notification-inbox.tsx +40 -58
  759. package/src/notifications/notification-parts.tsx +3 -4
  760. package/src/notifications/notification-types-setting.tsx +1 -1
  761. package/src/notifications/notifications-labels.ts +7 -0
  762. package/src/notifications/push-device-setting.tsx +1 -1
  763. package/src/notifications/push-devices-setting.tsx +30 -55
  764. package/src/notifications/quiet-hours-setting.tsx +93 -31
  765. package/src/notifications/unsubscribe-panel.tsx +4 -7
  766. package/src/notifications/use-push-device.ts +76 -10
  767. package/src/offline/query-persistence.ts +35 -3
  768. package/src/rhf/fields.tsx +11 -4
  769. package/src/search/command-palette.tsx +2 -4
  770. package/src/search/global-search.tsx +36 -15
  771. package/src/search/use-command-key.ts +13 -12
  772. package/src/search.ts +9 -0
  773. package/src/settings/use-settings-focus.ts +3 -0
  774. package/src/shell/account-menu-language.tsx +27 -5
  775. package/src/shell/account-menu-text-size.tsx +32 -10
  776. package/src/shell/dev-menu.tsx +7 -21
  777. package/src/shell/role-switcher.tsx +7 -0
  778. package/src/shell/top-bar-actions.tsx +1 -1
  779. package/src/shell/top-bar-parts-labels.ts +0 -3
  780. package/src/shell.ts +40 -9
  781. package/src/sync/engine.ts +339 -61
  782. package/src/sync.ts +8 -1
  783. package/src/testing/css-variables.ts +8 -9
  784. package/src/theme/contrast.ts +8 -9
  785. package/src/theme/palette-store.ts +9 -9
  786. package/src/theme/text-size.ts +6 -8
  787. package/src/theme/theme-store.ts +7 -9
  788. package/src/tour/tour-catalogue.tsx +26 -15
  789. package/src/tour/tour-dock.ts +0 -2
  790. package/src/tour/tour-gates.ts +23 -0
  791. package/src/tour/tour-overlay.tsx +1170 -0
  792. package/src/tour/tour.tsx +116 -1193
  793. package/src/tour/use-tour-progress.ts +1 -1
  794. package/src/tour/use-tour-url-sync.ts +7 -3
  795. package/src/wizard/stepper-nav.tsx +3 -1
  796. package/src/wizard/types.ts +11 -2
  797. package/src/wizard/use-wizard.ts +2 -1
  798. package/src/wizard/validation.ts +8 -2
  799. package/tokens.css +2 -1
  800. package/dist/components/ui-labels.js.map +0 -1
  801. package/dist/shell/dev-switchers.d.ts +0 -6
  802. package/dist/shell/dev-switchers.js +0 -12
  803. package/dist/shell/dev-switchers.js.map +0 -1
  804. package/src/components/ui-labels.ts +0 -24
  805. package/src/shell/dev-switchers.tsx +0 -18
@@ -1,14 +1,17 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState } from "react";
3
+ import { useEffect, useMemo, useRef, useState } from "react";
4
4
  import { KeyRound } from "lucide-react";
5
5
  import { cn } from "../lib/cn.js";
6
- import { useKitLocale } from "../i18n/kit-labels.js";
6
+ import { useDayFormatter } from "../lib/day-format.js";
7
+ import { toDate } from "../lib/format.js";
7
8
  import { Button } from "../components/button.js";
8
9
  import { Card } from "../components/card.js";
9
10
  import { EmptyState } from "../components/empty-state.js";
11
+ import { InlineConfirm } from "../components/inline-confirm.js";
10
12
  import { Input } from "../components/input.js";
11
13
  import { Skeleton } from "../components/skeleton.js";
14
+ import { COMMIT_EXCEPT_BILLING, useWriteLock } from "../components/write-lock.js";
12
15
  import { useAccountSettingsLabels } from "./account-settings-labels.js";
13
16
  import { SettingsCardTitle } from "../settings/settings-heading.js";
14
17
  function PasskeysSetting({
@@ -31,18 +34,23 @@ function PasskeysSetting({
31
34
  ...rest
32
35
  }) {
33
36
  const labels = useAccountSettingsLabels("passkeys", labelsProp);
34
- const locale = useKitLocale(localeProp);
37
+ const own = useMemo(
38
+ () => formatDate && ((value) => {
39
+ const date2 = toDate(value);
40
+ return date2 ? formatDate(date2) : "";
41
+ }),
42
+ [formatDate]
43
+ );
44
+ const day = useDayFormatter(own, localeProp);
45
+ const lock = useWriteLock(COMMIT_EXCEPT_BILLING);
35
46
  const [name, setName] = useState("");
36
47
  const [checking, setChecking] = useState(false);
37
48
  const checkingRef = useRef(false);
38
49
  const date = (value) => {
39
- if (value === null || value === void 0 || value === "") return null;
40
- const d = value instanceof Date ? value : new Date(value);
41
- if (Number.isNaN(d.getTime())) return null;
42
- return formatDate ? formatDate(d) : new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(d);
50
+ return toDate(value) ? day(value) : null;
43
51
  };
44
52
  const add = () => {
45
- if (adding || checkingRef.current) return;
53
+ if (adding || checkingRef.current || lock.locked) return;
46
54
  const typed = name;
47
55
  const value = typed.trim();
48
56
  const send = () => Promise.resolve(onAdd(value)).then(() => setName((current) => current === typed ? "" : current));
@@ -84,6 +92,7 @@ function PasskeysSetting({
84
92
  lastUsed: date(item.lastUsedAt),
85
93
  attributes: rowProps?.(item),
86
94
  busy: busyId !== void 0 && busyId !== null && busyId === item.id,
95
+ locked: lock.locked,
87
96
  onRename,
88
97
  onDelete,
89
98
  labels
@@ -107,7 +116,7 @@ function PasskeysSetting({
107
116
  }
108
117
  }
109
118
  ),
110
- /* @__PURE__ */ jsxs(Button, { onClick: add, disabled: busy, "aria-busy": busy || void 0, children: [
119
+ /* @__PURE__ */ jsxs(Button, { onClick: add, commit: COMMIT_EXCEPT_BILLING, disabled: busy, "aria-busy": busy || void 0, children: [
111
120
  /* @__PURE__ */ jsx(KeyRound, { className: "size-4", "aria-hidden": true }),
112
121
  adding ? labels.adding : labels.add
113
122
  ] })
@@ -131,6 +140,7 @@ function PasskeyRow({
131
140
  lastUsed,
132
141
  attributes,
133
142
  busy,
143
+ locked,
134
144
  onRename,
135
145
  onDelete,
136
146
  labels
@@ -138,14 +148,12 @@ function PasskeyRow({
138
148
  const [mode, setMode] = useState("view");
139
149
  const [draft, setDraft] = useState(item.name);
140
150
  const [returnTo, setReturnTo] = useState(null);
141
- const cancelDeleteRef = useRef(null);
142
151
  const renameRef = useRef(null);
143
152
  const renameButtonRef = useRef(null);
144
153
  const deleteButtonRef = useRef(null);
145
154
  useEffect(() => {
146
- if (mode === "delete") cancelDeleteRef.current?.focus();
147
- else if (mode === "rename") renameRef.current?.select();
148
- else if (returnTo) (returnTo === "rename" ? renameButtonRef : deleteButtonRef).current?.focus();
155
+ if (mode === "rename") renameRef.current?.select();
156
+ else if (mode === "view" && returnTo) (returnTo === "rename" ? renameButtonRef : deleteButtonRef).current?.focus();
149
157
  }, [mode, returnTo]);
150
158
  const open = (next) => {
151
159
  setReturnTo(next);
@@ -153,16 +161,9 @@ function PasskeyRow({
153
161
  setMode(next);
154
162
  };
155
163
  const leave = () => setMode("view");
156
- const escapeLeaves = (e) => {
157
- if (e.key === "Escape") {
158
- e.preventDefault();
159
- e.stopPropagation();
160
- leave();
161
- }
162
- };
163
164
  const saveRename = () => {
164
165
  const next = draft.trim();
165
- if (!onRename || !next || busy) return;
166
+ if (!onRename || !next || busy || locked) return;
166
167
  if (next === item.name) {
167
168
  leave();
168
169
  return;
@@ -200,18 +201,27 @@ function PasskeyRow({
200
201
  }
201
202
  }
202
203
  ),
203
- /* @__PURE__ */ jsx(Button, { size: "sm", onClick: saveRename, disabled: busy || !draft.trim(), children: labels.save }),
204
+ /* @__PURE__ */ jsx(Button, { size: "sm", onClick: saveRename, commit: COMMIT_EXCEPT_BILLING, disabled: busy || !draft.trim(), children: labels.save }),
204
205
  /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: leave, children: labels.cancel })
205
206
  ] });
206
207
  }
207
208
  if (mode === "delete") {
208
- return /* @__PURE__ */ jsxs("li", { ...li, className: "space-y-2 py-2", children: [
209
- /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm", children: labels.deleteConfirm(item.name) }),
210
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
211
- /* @__PURE__ */ jsx(Button, { size: "sm", variant: "danger", onClick: confirmDelete, onKeyDown: escapeLeaves, disabled: busy, children: labels.confirmDelete }),
212
- /* @__PURE__ */ jsx(Button, { ref: cancelDeleteRef, size: "sm", variant: "ghost", onClick: leave, onKeyDown: escapeLeaves, children: labels.cancel })
213
- ] })
214
- ] });
209
+ return /* @__PURE__ */ jsx(
210
+ InlineConfirm,
211
+ {
212
+ as: "li",
213
+ ...li,
214
+ className: "py-2",
215
+ prompt: labels.deleteConfirm(item.name),
216
+ confirmLabel: labels.confirmDelete,
217
+ cancelLabel: labels.cancel,
218
+ onConfirm: confirmDelete,
219
+ onLeave: leave,
220
+ busy,
221
+ commit: COMMIT_EXCEPT_BILLING,
222
+ returnFocusRef: deleteButtonRef
223
+ }
224
+ );
215
225
  }
216
226
  return /* @__PURE__ */ jsxs("li", { ...li, className: "flex items-center gap-3 py-2", children: [
217
227
  /* @__PURE__ */ jsx(KeyRound, { className: "size-4 shrink-0 text-muted", "aria-hidden": true }),
@@ -225,6 +235,7 @@ function PasskeyRow({
225
235
  ref: renameButtonRef,
226
236
  size: "sm",
227
237
  variant: "ghost",
238
+ commit: COMMIT_EXCEPT_BILLING,
228
239
  disabled: busy,
229
240
  onClick: () => open("rename"),
230
241
  "aria-label": labels.renameItem(item.name),
@@ -238,6 +249,7 @@ function PasskeyRow({
238
249
  size: "sm",
239
250
  variant: "ghost",
240
251
  tone: "danger",
252
+ commit: COMMIT_EXCEPT_BILLING,
241
253
  disabled: busy,
242
254
  onClick: () => open("delete"),
243
255
  "aria-label": labels.deleteItem(item.name),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/account/passkeys-setting.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport { KeyRound } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { Button } from \"../components/button\";\nimport { Card } from \"../components/card\";\nimport { EmptyState } from \"../components/empty-state\";\nimport { Input } from \"../components/input\";\nimport { Skeleton } from \"../components/skeleton\";\nimport { useAccountSettingsLabels } from \"./account-settings-labels\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport type { PasskeysSettingLabels } from \"./account-settings-labels\";\n\n/** What a passkey's `id` may be: the app's own key type, string or numeric. */\nexport type PasskeyId = string | number;\n\n/**\n * One registered passkey, as the app's API lists it.\n *\n * Generic in its `id` (0.16.0): `PasskeysSetting` infers `Id` from `passkeys`, so an\n * app whose ids are numbers gets numbers back in `onRename` / `onDelete` — keksdose\n * cast `id as number` in both. Left unparameterised it is the old `string | number`.\n */\nexport interface PasskeyItem<Id extends PasskeyId = PasskeyId> {\n id: Id;\n name: string;\n /** A `Date`, an ISO string or epoch ms. */\n createdAt?: Date | string | number | null;\n /** Null (or left out) reads as \"Never used\". */\n lastUsedAt?: Date | string | number | null;\n}\n\n/** `data-*` attributes, passed through to the element they are given for. */\nexport type PasskeyDataAttributes = { [key: `data-${string}`]: string | number | boolean | undefined };\n\nexport interface PasskeysSettingProps<Id extends PasskeyId = PasskeyId> extends PasskeyDataAttributes {\n /** `undefined` while the first load is in flight (or pass `loading`). */\n passkeys: readonly PasskeyItem<Id>[] | undefined;\n loading?: boolean;\n /**\n * Run the WebAuthn ceremony and register the passkey — app-side, since the options\n * and the attestation are the app's server's business. Called with the trimmed name\n * field, which may be EMPTY: pick your own default (\"Passkey\", the device name).\n * Return the promise and the field clears when it resolves; a rejection (including\n * the user cancelling the OS prompt) keeps what was typed.\n */\n onAdd: (name: string) => void | Promise<unknown>;\n /**\n * A step the app runs BEFORE `onAdd` (0.18.0) — re-asking for the current password,\n * a policy notice, anything that may stop the add. Called with the same trimmed name;\n * resolve `true` to go on to `onAdd`, `false` to stop quietly (nothing is said, the\n * typed name stays). A rejection, or a throw, stops the same way: the app reports\n * its own errors. While it runs the add button is disabled and busy, so a second\n * click cannot start a second check.\n *\n * Kurvenschmiede asked for the password in its own dialog by handing `onAdd` a\n * promise it kept open across that dialog (passkeys-card.tsx) — which still works.\n * This is the documented place for it: open the dialog here, resolve with whether it\n * was confirmed, and keep what it produced (the server's registration options) for\n * `onAdd` in a ref. The ceremony then starts from the dialog's click rather than the\n * card's, which is the user activation `navigator.credentials.create` wants.\n *\n * Left out, `onAdd` is called synchronously in the click, exactly as before.\n */\n beforeAdd?: (name: string) => boolean | Promise<boolean>;\n /**\n * What a passkey does to the password, which picks the line under the title (0.18.0).\n * `\"instead\"` (default): it replaces it — `labels.description`, kastlan's promise.\n * `\"alongside\"`: the password stays and the passkey is a second way in —\n * `labels.descriptionAlongside`. Kurvenschmiede overrode `description` for exactly\n * this; an app that sets `mode` needs no override.\n */\n mode?: \"instead\" | \"alongside\";\n /** The ceremony is running. The add button says so and does not start a second one. */\n adding?: boolean;\n /** Offer \"Rename\" on each row. Return a promise to leave edit mode only on success. */\n onRename?: (id: Id, name: string) => void | Promise<unknown>;\n /** Offer \"Delete\" on each row — always behind an inline confirmation. */\n onDelete?: (id: Id) => void | Promise<unknown>;\n /** A row whose rename or delete is in flight; its buttons are disabled. */\n busyId?: Id | null;\n /** Show the name field above the add button. Default true. */\n nameField?: boolean;\n /**\n * Shown INSTEAD of the list and the add button — passkeys are not supported by this\n * browser, or the page is not a secure context. Its wording is the app's: only the\n * app knows which of those it detected.\n */\n unavailable?: ReactNode;\n /** A date for the \"Added …\" / \"Last used …\" lines. Default: the locale's medium date. */\n formatDate?: (date: Date) => string;\n /** Overrides the provider's locale for the default date format. */\n locale?: string;\n /** Prop > `<UiKitProvider labels={{ accountSettings: { passkeys } }}>` > English. */\n labels?: LabelOverride<PasskeysSettingLabels>;\n className?: string;\n /** On the card (0.16.0), for an in-page link (`#passkeys`) or a test hook. `data-*`\n * attributes go there too. */\n id?: string;\n /** Extra attributes for one row's `<li>` (0.16.0) — an `id` to scroll a just-added\n * key into view, `data-*` for a test. Every row also carries `data-passkey-id`. */\n rowProps?: (item: PasskeyItem<Id>) => ({ id?: string } & PasskeyDataAttributes) | undefined;\n}\n\n/**\n * The passkeys section of an account page: what is registered, when it was last used,\n * rename and delete, and \"Add passkey\" — the fourth card beside `ProfileSetting`,\n * `PasswordSetting` and `TwoFactorSetting`, and built the same way (a self-contained\n * `<Card>` owning its transient form state; the app owns the data and the API).\n *\n * Lifted from kastlan's passkeys-card. **The WebAuthn ceremony stays app-side**:\n * `navigator.credentials.create` needs options minted by the app's server and hands\n * back an attestation only that server can verify, so the kit calls `onAdd` and waits.\n *\n * **Delete confirms inline**, in the row, rather than through `useConfirm`: this card\n * must work in an app without a `ConfirmProvider`, and the question belongs next to\n * the passkey it names. Focus moves to Cancel, as in every destructive confirm in the\n * kit, so the Enter that pressed Delete cannot also answer it.\n */\nexport function PasskeysSetting<Id extends PasskeyId = PasskeyId>({\n passkeys,\n loading,\n onAdd,\n beforeAdd,\n mode = \"instead\",\n adding = false,\n onRename,\n onDelete,\n busyId,\n nameField = true,\n unavailable,\n formatDate,\n locale: localeProp,\n labels: labelsProp,\n className,\n rowProps,\n ...rest\n}: PasskeysSettingProps<Id>) {\n const labels = useAccountSettingsLabels(\"passkeys\", labelsProp);\n const locale = useKitLocale(localeProp);\n const [name, setName] = useState(\"\");\n // `beforeAdd` is running. State for the button, and a ref for the guard: two clicks\n // in one frame both read the state from before either set it.\n const [checking, setChecking] = useState(false);\n const checkingRef = useRef(false);\n\n const date = (value: PasskeyItem[\"createdAt\"]): string | null => {\n if (value === null || value === undefined || value === \"\") return null;\n const d = value instanceof Date ? value : new Date(value);\n if (Number.isNaN(d.getTime())) return null;\n return formatDate ? formatDate(d) : new Intl.DateTimeFormat(locale, { dateStyle: \"medium\" }).format(d);\n };\n\n const add = () => {\n if (adding || checkingRef.current) return;\n const typed = name;\n const value = typed.trim();\n const send = () =>\n Promise.resolve(onAdd(value))\n // Clear only what was sent: the field stays editable while the OS prompt is up.\n .then(() => setName((current) => (current === typed ? \"\" : current)));\n if (!beforeAdd) {\n send().catch(() => {});\n return;\n }\n const done = () => {\n checkingRef.current = false;\n setChecking(false);\n };\n checkingRef.current = true;\n setChecking(true);\n let gate: Promise<boolean>;\n // Called in the click, not a microtask later, so a step that itself needs the\n // user's activation (a popup, the clipboard) still has it; a throw is a \"no\".\n try {\n gate = Promise.resolve(beforeAdd(value));\n } catch (error) {\n gate = Promise.reject(error);\n }\n gate\n .then((go) => {\n done();\n // Strictly `true`: an app whose step resolves `undefined` meant nothing.\n if (go === true) return send();\n })\n .catch(done);\n };\n const busy = adding || checking;\n\n const isLoading = loading || passkeys === undefined;\n const items = passkeys ?? [];\n\n const body = (() => {\n if (unavailable != null && unavailable !== false) {\n return <EmptyState variant=\"inline\" size=\"sm\" icon={<KeyRound />} title={unavailable} />;\n }\n return (\n <>\n {isLoading ? (\n <Skeleton lines={2} label={labels.loading} />\n ) : items.length === 0 ? (\n <EmptyState variant=\"inline\" size=\"sm\" icon={<KeyRound />} title={labels.empty} />\n ) : (\n <ul aria-label={labels.list} className=\"divide-y divide-subtle\">\n {items.map((item) => (\n <PasskeyRow\n key={item.id}\n item={item}\n created={date(item.createdAt)}\n lastUsed={date(item.lastUsedAt)}\n attributes={rowProps?.(item)}\n busy={busyId !== undefined && busyId !== null && busyId === item.id}\n onRename={onRename}\n onDelete={onDelete}\n labels={labels}\n />\n ))}\n </ul>\n )}\n <div className=\"space-y-2 pt-1\">\n {nameField && (\n <Input\n label={labels.nameLabel}\n placeholder={labels.namePlaceholder}\n value={name}\n maxLength={120}\n onChange={(e) => setName(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n add();\n }\n }}\n />\n )}\n <Button onClick={add} disabled={busy} aria-busy={busy || undefined}>\n <KeyRound className=\"size-4\" aria-hidden />\n {adding ? labels.adding : labels.add}\n </Button>\n </div>\n </>\n );\n })();\n\n return (\n // `rest` is only `id` and `data-*`: everything else the props name is destructured.\n <Card {...rest} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className=\"text-xs text-muted\">\n {mode === \"alongside\" ? labels.descriptionAlongside : labels.description}\n </div>\n </div>\n {body}\n </Card>\n );\n}\n\ntype RowMode = \"view\" | \"rename\" | \"delete\";\n\nfunction PasskeyRow<Id extends PasskeyId>({\n item,\n created,\n lastUsed,\n attributes,\n busy,\n onRename,\n onDelete,\n labels,\n}: {\n item: PasskeyItem<Id>;\n created: string | null;\n lastUsed: string | null;\n attributes?: { id?: string } & PasskeyDataAttributes;\n busy: boolean;\n onRename?: PasskeysSettingProps<Id>[\"onRename\"];\n onDelete?: PasskeysSettingProps<Id>[\"onDelete\"];\n labels: PasskeysSettingLabels;\n}) {\n const [mode, setMode] = useState<RowMode>(\"view\");\n const [draft, setDraft] = useState(item.name);\n // Which button opened the sub-mode, so leaving it puts focus back there — the\n // confirm or the field unmounts under the focus, which otherwise falls to <body>.\n const [returnTo, setReturnTo] = useState<\"rename\" | \"delete\" | null>(null);\n const cancelDeleteRef = useRef<HTMLButtonElement>(null);\n const renameRef = useRef<HTMLInputElement>(null);\n const renameButtonRef = useRef<HTMLButtonElement>(null);\n const deleteButtonRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (mode === \"delete\") cancelDeleteRef.current?.focus();\n else if (mode === \"rename\") renameRef.current?.select();\n else if (returnTo) (returnTo === \"rename\" ? renameButtonRef : deleteButtonRef).current?.focus();\n }, [mode, returnTo]);\n\n const open = (next: \"rename\" | \"delete\") => {\n setReturnTo(next);\n setDraft(item.name);\n setMode(next);\n };\n const leave = () => setMode(\"view\");\n const escapeLeaves = (e: KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n leave();\n }\n };\n\n const saveRename = () => {\n const next = draft.trim();\n if (!onRename || !next || busy) return;\n if (next === item.name) {\n leave();\n return;\n }\n Promise.resolve(onRename(item.id, next))\n .then(leave)\n .catch(() => {});\n };\n\n const confirmDelete = () => {\n if (!onDelete || busy) return;\n // The row unmounts once the list refreshes; on a failure it stays, confirm open.\n Promise.resolve(onDelete(item.id))\n .then(() => setMode(\"view\"))\n .catch(() => {});\n };\n\n // On every mode's <li>, so an id the app scrolls to survives a rename or a confirm.\n const li = { ...attributes, \"data-passkey-id\": String(item.id) };\n\n const meta = [created && labels.created(created), lastUsed ? labels.lastUsed(lastUsed) : labels.neverUsed]\n .filter(Boolean)\n .join(\" · \");\n\n if (mode === \"rename\") {\n return (\n <li {...li} className=\"flex flex-wrap items-center gap-2 py-2\">\n <Input\n ref={renameRef}\n aria-label={labels.renameField(item.name)}\n className=\"min-w-0 flex-1\"\n value={draft}\n maxLength={120}\n onChange={(e) => setDraft(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n saveRename();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n leave();\n }\n }}\n />\n <Button size=\"sm\" onClick={saveRename} disabled={busy || !draft.trim()}>\n {labels.save}\n </Button>\n <Button size=\"sm\" variant=\"ghost\" onClick={leave}>\n {labels.cancel}\n </Button>\n </li>\n );\n }\n\n if (mode === \"delete\") {\n return (\n <li {...li} className=\"space-y-2 py-2\">\n <p role=\"alert\" className=\"text-sm\">\n {labels.deleteConfirm(item.name)}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n <Button size=\"sm\" variant=\"danger\" onClick={confirmDelete} onKeyDown={escapeLeaves} disabled={busy}>\n {labels.confirmDelete}\n </Button>\n <Button ref={cancelDeleteRef} size=\"sm\" variant=\"ghost\" onClick={leave} onKeyDown={escapeLeaves}>\n {labels.cancel}\n </Button>\n </div>\n </li>\n );\n }\n\n return (\n <li {...li} className=\"flex items-center gap-3 py-2\">\n <KeyRound className=\"size-4 shrink-0 text-muted\" aria-hidden />\n <div className=\"min-w-0 flex-1\">\n {/* The passkey's own name, which its owner typed: cut at Normal, wrapped from\n Large up (text size §10.17; round 0.34 T1: the sweep read \"MacBook To…\"). */}\n <div className=\"truncate-until-large text-sm font-medium\">{item.name}</div>\n <div className=\"text-xs text-muted\">{meta}</div>\n </div>\n {onRename && (\n <Button\n ref={renameButtonRef}\n size=\"sm\"\n variant=\"ghost\"\n disabled={busy}\n onClick={() => open(\"rename\")}\n aria-label={labels.renameItem(item.name)}\n >\n {labels.rename}\n </Button>\n )}\n {onDelete && (\n <Button\n ref={deleteButtonRef}\n size=\"sm\"\n variant=\"ghost\"\n tone=\"danger\"\n disabled={busy}\n onClick={() => open(\"delete\")}\n aria-label={labels.deleteItem(item.name)}\n >\n {labels.delete}\n </Button>\n )}\n </li>\n );\n}\n"],"mappings":";AAmM0D,SAGpD,UAHoD,KAyChD,YAzCgD;AAnM1D,SAAS,WAAW,QAAQ,gBAAgB;AAE5C,SAAS,gBAAgB;AACzB,SAAS,UAAU;AACnB,SAAS,oBAAwC;AACjD,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,g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,iBAAO;AAAA;AAAA,IACV;AAAA,IAED,YACC;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,UAAU;AAAA,QACV,SAAS,MAAM,KAAK,QAAQ;AAAA,QAC5B,cAAY,OAAO,WAAW,KAAK,IAAI;AAAA,QAEtC,iBAAO;AAAA;AAAA,IACV;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/account/passkeys-setting.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport { KeyRound } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { useDayFormatter } from \"../lib/day-format\";\nimport { toDate } from \"../lib/format\";\nimport type { LabelOverride } from \"../i18n/kit-labels\";\nimport { Button } from \"../components/button\";\nimport { Card } from \"../components/card\";\nimport { EmptyState } from \"../components/empty-state\";\nimport { InlineConfirm } from \"../components/inline-confirm\";\nimport { Input } from \"../components/input\";\nimport { Skeleton } from \"../components/skeleton\";\nimport { COMMIT_EXCEPT_BILLING, useWriteLock } from \"../components/write-lock\";\nimport { useAccountSettingsLabels } from \"./account-settings-labels\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport type { PasskeysSettingLabels } from \"./account-settings-labels\";\n\n/** What a passkey's `id` may be: the app's own key type, string or numeric. */\nexport type PasskeyId = string | number;\n\n/**\n * One registered passkey, as the app's API lists it.\n *\n * Generic in its `id` (0.16.0): `PasskeysSetting` infers `Id` from `passkeys`, so an\n * app whose ids are numbers gets numbers back in `onRename` / `onDelete` — keksdose\n * cast `id as number` in both. Left unparameterised it is the old `string | number`.\n */\nexport interface PasskeyItem<Id extends PasskeyId = PasskeyId> {\n id: Id;\n name: string;\n /** A `Date`, an ISO string or epoch ms. */\n createdAt?: Date | string | number | null;\n /** Null (or left out) reads as \"Never used\". */\n lastUsedAt?: Date | string | number | null;\n}\n\n/** `data-*` attributes, passed through to the element they are given for. */\nexport type PasskeyDataAttributes = { [key: `data-${string}`]: string | number | boolean | undefined };\n\nexport interface PasskeysSettingProps<Id extends PasskeyId = PasskeyId> extends PasskeyDataAttributes {\n /** `undefined` while the first load is in flight (or pass `loading`). */\n passkeys: readonly PasskeyItem<Id>[] | undefined;\n loading?: boolean;\n /**\n * Run the WebAuthn ceremony and register the passkey — app-side, since the options\n * and the attestation are the app's server's business. Called with the trimmed name\n * field, which may be EMPTY: pick your own default (\"Passkey\", the device name).\n * Return the promise and the field clears when it resolves; a rejection (including\n * the user cancelling the OS prompt) keeps what was typed.\n */\n onAdd: (name: string) => void | Promise<unknown>;\n /**\n * A step the app runs BEFORE `onAdd` (0.18.0) — re-asking for the current password,\n * a policy notice, anything that may stop the add. Called with the same trimmed name;\n * resolve `true` to go on to `onAdd`, `false` to stop quietly (nothing is said, the\n * typed name stays). A rejection, or a throw, stops the same way: the app reports\n * its own errors. While it runs the add button is disabled and busy, so a second\n * click cannot start a second check.\n *\n * Kurvenschmiede asked for the password in its own dialog by handing `onAdd` a\n * promise it kept open across that dialog (passkeys-card.tsx) — which still works.\n * This is the documented place for it: open the dialog here, resolve with whether it\n * was confirmed, and keep what it produced (the server's registration options) for\n * `onAdd` in a ref. The ceremony then starts from the dialog's click rather than the\n * card's, which is the user activation `navigator.credentials.create` wants.\n *\n * Left out, `onAdd` is called synchronously in the click, exactly as before.\n */\n beforeAdd?: (name: string) => boolean | Promise<boolean>;\n /**\n * What a passkey does to the password, which picks the line under the title (0.18.0).\n * `\"instead\"` (default): it replaces it — `labels.description`, kastlan's promise.\n * `\"alongside\"`: the password stays and the passkey is a second way in —\n * `labels.descriptionAlongside`. Kurvenschmiede overrode `description` for exactly\n * this; an app that sets `mode` needs no override.\n */\n mode?: \"instead\" | \"alongside\";\n /** The ceremony is running. The add button says so and does not start a second one. */\n adding?: boolean;\n /** Offer \"Rename\" on each row. Return a promise to leave edit mode only on success. */\n onRename?: (id: Id, name: string) => void | Promise<unknown>;\n /** Offer \"Delete\" on each row — always behind an inline confirmation. */\n onDelete?: (id: Id) => void | Promise<unknown>;\n /** A row whose rename or delete is in flight; its buttons are disabled. */\n busyId?: Id | null;\n /** Show the name field above the add button. Default true. */\n nameField?: boolean;\n /**\n * Shown INSTEAD of the list and the add button — passkeys are not supported by this\n * browser, or the page is not a secure context. Its wording is the app's: only the\n * app knows which of those it detected.\n */\n unavailable?: ReactNode;\n /** A date for the \"Added …\" / \"Last used …\" lines. Default: the provider's `formatDate`\n * (the app's date preference), else a medium date in the provider's locale and\n * `timeZone`. */\n formatDate?: (date: Date) => string;\n /** Overrides the provider's locale for the default date format. */\n locale?: string;\n /** Prop > `<UiKitProvider labels={{ accountSettings: { passkeys } }}>` > English. */\n labels?: LabelOverride<PasskeysSettingLabels>;\n className?: string;\n /** On the card (0.16.0), for an in-page link (`#passkeys`) or a test hook. `data-*`\n * attributes go there too. */\n id?: string;\n /** Extra attributes for one row's `<li>` (0.16.0) — an `id` to scroll a just-added\n * key into view, `data-*` for a test. Every row also carries `data-passkey-id`. */\n rowProps?: (item: PasskeyItem<Id>) => ({ id?: string } & PasskeyDataAttributes) | undefined;\n}\n\n/**\n * The passkeys section of an account page: what is registered, when it was last used,\n * rename and delete, and \"Add passkey\" — the fourth card beside `ProfileSetting`,\n * `PasswordSetting` and `TwoFactorSetting`, and built the same way (a self-contained\n * `<Card>` owning its transient form state; the app owns the data and the API).\n *\n * Lifted from kastlan's passkeys-card. **The WebAuthn ceremony stays app-side**:\n * `navigator.credentials.create` needs options minted by the app's server and hands\n * back an attestation only that server can verify, so the kit calls `onAdd` and waits.\n *\n * **Delete confirms inline**, in the row, rather than through `useConfirm`: this card\n * must work in an app without a `ConfirmProvider`, and the question belongs next to\n * the passkey it names. Focus moves to Cancel, as in every destructive confirm in the\n * kit, so the Enter that pressed Delete cannot also answer it.\n *\n * **Under a write lock** (0.52) Add, Rename, Delete and the confirm are `commit` controls\n * exempt from billing — a lapsed plan still lets the account manage how it signs in, the\n * demo does not. Until 0.52 the passkeys' confirm was the one inline confirm without it,\n * so the demo could delete, rename and add (refactor audit 2026-10-30, DUP-10).\n */\nexport function PasskeysSetting<Id extends PasskeyId = PasskeyId>({\n passkeys,\n loading,\n onAdd,\n beforeAdd,\n mode = \"instead\",\n adding = false,\n onRename,\n onDelete,\n busyId,\n nameField = true,\n unavailable,\n formatDate,\n locale: localeProp,\n labels: labelsProp,\n className,\n rowProps,\n ...rest\n}: PasskeysSettingProps<Id>) {\n const labels = useAccountSettingsLabels(\"passkeys\", labelsProp);\n // The prop, else the provider's `formatDate`, else the kit's in the provider's locale and\n // `timeZone`; a bare \"YYYY-MM-DD\" is read on its calendar (refactor audit 2026-10-30,\n // DUP-2: this card parsed with `new Date` and built its own `Intl` formatter).\n // The raw value goes in, so a bare day keeps its calendar; the prop still gets a Date.\n const own = useMemo(\n () =>\n formatDate &&\n ((value: PasskeyItem[\"createdAt\"]) => {\n const date = toDate(value);\n return date ? formatDate(date) : \"\";\n }),\n [formatDate],\n );\n const day = useDayFormatter(own, localeProp);\n const lock = useWriteLock(COMMIT_EXCEPT_BILLING);\n const [name, setName] = useState(\"\");\n // `beforeAdd` is running. State for the button, and a ref for the guard: two clicks\n // in one frame both read the state from before either set it.\n const [checking, setChecking] = useState(false);\n const checkingRef = useRef(false);\n\n const date = (value: PasskeyItem[\"createdAt\"]): string | null => {\n return toDate(value) ? day(value) : null;\n };\n\n const add = () => {\n // The name field's Enter reaches here too, past the locked button.\n if (adding || checkingRef.current || lock.locked) return;\n const typed = name;\n const value = typed.trim();\n const send = () =>\n Promise.resolve(onAdd(value))\n // Clear only what was sent: the field stays editable while the OS prompt is up.\n .then(() => setName((current) => (current === typed ? \"\" : current)));\n if (!beforeAdd) {\n send().catch(() => {});\n return;\n }\n const done = () => {\n checkingRef.current = false;\n setChecking(false);\n };\n checkingRef.current = true;\n setChecking(true);\n let gate: Promise<boolean>;\n // Called in the click, not a microtask later, so a step that itself needs the\n // user's activation (a popup, the clipboard) still has it; a throw is a \"no\".\n try {\n gate = Promise.resolve(beforeAdd(value));\n } catch (error) {\n gate = Promise.reject(error);\n }\n gate\n .then((go) => {\n done();\n // Strictly `true`: an app whose step resolves `undefined` meant nothing.\n if (go === true) return send();\n })\n .catch(done);\n };\n const busy = adding || checking;\n\n const isLoading = loading || passkeys === undefined;\n const items = passkeys ?? [];\n\n const body = (() => {\n if (unavailable != null && unavailable !== false) {\n return <EmptyState variant=\"inline\" size=\"sm\" icon={<KeyRound />} title={unavailable} />;\n }\n return (\n <>\n {isLoading ? (\n <Skeleton lines={2} label={labels.loading} />\n ) : items.length === 0 ? (\n <EmptyState variant=\"inline\" size=\"sm\" icon={<KeyRound />} title={labels.empty} />\n ) : (\n <ul aria-label={labels.list} className=\"divide-y divide-subtle\">\n {items.map((item) => (\n <PasskeyRow\n key={item.id}\n item={item}\n created={date(item.createdAt)}\n lastUsed={date(item.lastUsedAt)}\n attributes={rowProps?.(item)}\n busy={busyId !== undefined && busyId !== null && busyId === item.id}\n locked={lock.locked}\n onRename={onRename}\n onDelete={onDelete}\n labels={labels}\n />\n ))}\n </ul>\n )}\n <div className=\"space-y-2 pt-1\">\n {nameField && (\n <Input\n label={labels.nameLabel}\n placeholder={labels.namePlaceholder}\n value={name}\n maxLength={120}\n onChange={(e) => setName(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n add();\n }\n }}\n />\n )}\n <Button onClick={add} commit={COMMIT_EXCEPT_BILLING} disabled={busy} aria-busy={busy || undefined}>\n <KeyRound className=\"size-4\" aria-hidden />\n {adding ? labels.adding : labels.add}\n </Button>\n </div>\n </>\n );\n })();\n\n return (\n // `rest` is only `id` and `data-*`: everything else the props name is destructured.\n <Card {...rest} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className=\"text-xs text-muted\">\n {mode === \"alongside\" ? labels.descriptionAlongside : labels.description}\n </div>\n </div>\n {body}\n </Card>\n );\n}\n\ntype RowMode = \"view\" | \"rename\" | \"delete\";\n\nfunction PasskeyRow<Id extends PasskeyId>({\n item,\n created,\n lastUsed,\n attributes,\n busy,\n locked,\n onRename,\n onDelete,\n labels,\n}: {\n item: PasskeyItem<Id>;\n created: string | null;\n lastUsed: string | null;\n attributes?: { id?: string } & PasskeyDataAttributes;\n busy: boolean;\n /** A write lock holds: the rename field's Enter saves nothing. */\n locked: boolean;\n onRename?: PasskeysSettingProps<Id>[\"onRename\"];\n onDelete?: PasskeysSettingProps<Id>[\"onDelete\"];\n labels: PasskeysSettingLabels;\n}) {\n const [mode, setMode] = useState<RowMode>(\"view\");\n const [draft, setDraft] = useState(item.name);\n // Which button opened the sub-mode, so leaving it puts focus back there — the field or\n // the confirm unmounts under the focus, which otherwise falls to <body>. InlineConfirm\n // returns it on Cancel and Escape; this also covers a delete that succeeded while the\n // row stayed (the list not refreshed yet) and a rename.\n const [returnTo, setReturnTo] = useState<\"rename\" | \"delete\" | null>(null);\n const renameRef = useRef<HTMLInputElement>(null);\n const renameButtonRef = useRef<HTMLButtonElement>(null);\n const deleteButtonRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (mode === \"rename\") renameRef.current?.select();\n else if (mode === \"view\" && returnTo) (returnTo === \"rename\" ? renameButtonRef : deleteButtonRef).current?.focus();\n }, [mode, returnTo]);\n\n const open = (next: \"rename\" | \"delete\") => {\n setReturnTo(next);\n setDraft(item.name);\n setMode(next);\n };\n const leave = () => setMode(\"view\");\n\n const saveRename = () => {\n const next = draft.trim();\n if (!onRename || !next || busy || locked) return;\n if (next === item.name) {\n leave();\n return;\n }\n Promise.resolve(onRename(item.id, next))\n .then(leave)\n .catch(() => {});\n };\n\n const confirmDelete = () => {\n if (!onDelete || busy) return;\n // The row unmounts once the list refreshes; on a failure it stays, confirm open.\n Promise.resolve(onDelete(item.id))\n .then(() => setMode(\"view\"))\n .catch(() => {});\n };\n\n // On every mode's <li>, so an id the app scrolls to survives a rename or a confirm.\n const li = { ...attributes, \"data-passkey-id\": String(item.id) };\n\n const meta = [created && labels.created(created), lastUsed ? labels.lastUsed(lastUsed) : labels.neverUsed]\n .filter(Boolean)\n .join(\" · \");\n\n if (mode === \"rename\") {\n return (\n <li {...li} className=\"flex flex-wrap items-center gap-2 py-2\">\n <Input\n ref={renameRef}\n aria-label={labels.renameField(item.name)}\n className=\"min-w-0 flex-1\"\n value={draft}\n maxLength={120}\n onChange={(e) => setDraft(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n saveRename();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n leave();\n }\n }}\n />\n <Button size=\"sm\" onClick={saveRename} commit={COMMIT_EXCEPT_BILLING} disabled={busy || !draft.trim()}>\n {labels.save}\n </Button>\n <Button size=\"sm\" variant=\"ghost\" onClick={leave}>\n {labels.cancel}\n </Button>\n </li>\n );\n }\n\n if (mode === \"delete\") {\n return (\n <InlineConfirm\n as=\"li\"\n {...li}\n className=\"py-2\"\n prompt={labels.deleteConfirm(item.name)}\n confirmLabel={labels.confirmDelete}\n cancelLabel={labels.cancel}\n onConfirm={confirmDelete}\n onLeave={leave}\n busy={busy}\n commit={COMMIT_EXCEPT_BILLING}\n returnFocusRef={deleteButtonRef}\n />\n );\n }\n\n return (\n <li {...li} className=\"flex items-center gap-3 py-2\">\n <KeyRound className=\"size-4 shrink-0 text-muted\" aria-hidden />\n <div className=\"min-w-0 flex-1\">\n {/* The passkey's own name, which its owner typed: cut at Normal, wrapped from\n Large up (text size §10.17; round 0.34 T1: the sweep read \"MacBook To…\"). */}\n <div className=\"truncate-until-large text-sm font-medium\">{item.name}</div>\n <div className=\"text-xs text-muted\">{meta}</div>\n </div>\n {onRename && (\n <Button\n ref={renameButtonRef}\n size=\"sm\"\n variant=\"ghost\"\n commit={COMMIT_EXCEPT_BILLING}\n disabled={busy}\n onClick={() => open(\"rename\")}\n aria-label={labels.renameItem(item.name)}\n >\n {labels.rename}\n </Button>\n )}\n {onDelete && (\n <Button\n ref={deleteButtonRef}\n size=\"sm\"\n variant=\"ghost\"\n tone=\"danger\"\n commit={COMMIT_EXCEPT_BILLING}\n disabled={busy}\n onClick={() => open(\"delete\")}\n aria-label={labels.deleteItem(item.name)}\n >\n {labels.delete}\n </Button>\n )}\n </li>\n );\n}\n"],"mappings":";AA0N0D,SAGpD,UAHoD,KA0ChD,YA1CgD;AA1N1D,SAAS,WAAW,SAAS,QAAQ,gBAAgB;AAErD,SAAS,gBAAgB;AACzB,SAAS,UAAU;AACnB,SAAS,uBAAuB;AAChC,SAAS,cAAc;AAEvB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB,oBAAoB;AACpD,SAAS,gCAAgC;AACzC,SAAS,yBAAyB;AAoH3B,SAAS,gBAAkD;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA6B;AAC3B,QAAM,SAAS,yBAAyB,YAAY,UAAU;AAK9D,QAAM,MAAM;AAAA,IACV,MACE,eACC,CAAC,UAAoC;AACpC,YAAMA,QAAO,OAAO,KAAK;AACzB,aAAOA,QAAO,WAAWA,KAAI,IAAI;AAAA,IACnC;AAAA,IACF,CAAC,UAAU;AAAA,EACb;AACA,QAAM,MAAM,gBAAgB,KAAK,UAAU;AAC3C,QAAM,OAAO,aAAa,qBAAqB;AAC/C,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE;AAGnC,QAA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,YAAS,WAAU,8BAA6B,eAAW,MAAC;AAAA,IAC7D,qBAAC,SAAI,WAAU,kBAGb;AAAA,0BAAC,SAAI,WAAU,4CAA4C,eAAK,MAAK;AAAA,MACrE,oBAAC,SAAI,WAAU,sBAAsB,gBAAK;AAAA,OAC5C;AAAA,IACC,YACC;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,SAAS,MAAM,KAAK,QAAQ;AAAA,QAC5B,cAAY,OAAO,WAAW,KAAK,IAAI;AAAA,QAEtC,iBAAO;AAAA;AAAA,IACV;AAAA,IAED,YACC;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,SAAS,MAAM,KAAK,QAAQ;AAAA,QAC5B,cAAY,OAAO,WAAW,KAAK,IAAI;AAAA,QAEtC,iBAAO;AAAA;AAAA,IACV;AAAA,KAEJ;AAEJ;","names":["date"]}
@@ -78,8 +78,9 @@ export interface SessionsSettingProps<Id extends SessionId = SessionId> extends
78
78
  onRevoke?: (id: Id) => Promise<unknown> | void;
79
79
  /** The app's own words for a failure, or `undefined` for the kit's `failed`. */
80
80
  describeError?: (error: unknown, action: SessionsAction) => ReactNode | undefined;
81
- /** The "Last active" text. Default: how long ago, in the provider's locale, and the
82
- * date once it is more than a week back. */
81
+ /** The "Last active" text. Default: how long ago, in the provider's locale and
82
+ * `timeZone`, and the date once it is more than a week back — through the provider's
83
+ * `formatDate` (the app's date preference) when it has one. */
83
84
  formatLastActive?: (date: Date) => string;
84
85
  /** Overrides the provider's locale for the default format. */
85
86
  locale?: string;
@@ -2,9 +2,11 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { MonitorSmartphone } from "lucide-react";
5
- import { useKitLabels, useKitLocale } from "../i18n/kit-labels.js";
5
+ import { useKitLabels } from "../i18n/kit-labels.js";
6
6
  import { cn } from "../lib/cn.js";
7
- import { formatRelativeTime, toDate } from "../lib/format.js";
7
+ import { useDayFormatter } from "../lib/day-format.js";
8
+ import { describeFailure } from "../lib/describe-failure.js";
9
+ import { toDate, useKitFormat } from "../lib/format.js";
8
10
  import { AlertBanner } from "../components/alert-banner.js";
9
11
  import { Chip } from "../components/chip.js";
10
12
  import { hasContent } from "../lib/presence.js";
@@ -29,18 +31,18 @@ function SessionsSetting({
29
31
  ...rest
30
32
  }) {
31
33
  const labels = useKitLabels("sessions", DEFAULT_SESSIONS_LABELS, labelsProp);
32
- const locale = useKitLocale(localeProp);
34
+ const { formatDate, formatRelativeTime } = useKitFormat(localeProp);
35
+ const day = useDayFormatter(null, localeProp);
33
36
  const [busyId, setBusyId] = useState(null);
34
37
  const [failure, setFailure] = useState(null);
35
38
  const mounted = useMounted();
36
- const describe = (error, action) => {
37
- const own = describeError?.(error, action);
38
- return hasContent(own) ? own : labels.failed;
39
- };
39
+ const describe = (error, action) => describeFailure(describeError?.(error, action), labels.failed);
40
40
  const lastActive = (value) => {
41
41
  const date = toDate(value);
42
42
  if (!date) return null;
43
- return formatLastActive ? formatLastActive(date) : formatRelativeTime(date, { locale, absoluteAfterDays: 7, absoluteStyle: "medium" });
43
+ if (formatLastActive) return formatLastActive(date);
44
+ const words = formatRelativeTime(date, { absoluteAfterDays: 7, absoluteStyle: "medium" });
45
+ return words === formatDate(date, "medium") ? day(date) : words;
44
46
  };
45
47
  const signOutEverywhere = () => {
46
48
  setFailure(null);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/account/sessions-setting.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { MonitorSmartphone } from \"lucide-react\";\n\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { formatRelativeTime, toDate } from \"../lib/format\";\nimport type { DateInput } from \"../lib/format\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { Chip } from \"../components/chip\";\nimport { hasContent } from \"../lib/presence\";\nimport { DangerConfirm } from \"../components/danger-confirm\";\nimport { Skeleton } from \"../components/skeleton\";\nimport { Button } from \"../components/button\";\nimport { Card } from \"../components/card\";\nimport { CARD_DESCRIPTION_CLASS, settle, useMounted } from \"./account-parts\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\nimport { DEFAULT_SESSIONS_LABELS } from \"./sessions-setting-labels\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** Every string {@link SessionsSetting} renders — the `sessions` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. The confirm's\n * Cancel is `dangerConfirm.cancel`. */\nexport interface SessionsLabels {\n /** The card's title. */\n title: string;\n /** The line under it: what \"sign out everywhere\" is for. */\n description: string;\n /** The button that asks first. */\n signOutEverywhere: string;\n /** The question it asks: every session ends, this one too. */\n signOutEverywherePrompt: string;\n /** The button that answers it. */\n confirmSignOutEverywhere: string;\n /** The device list's accessible name. */\n list: string;\n /** While the list loads. */\n loading: string;\n /** A list with no rows. */\n empty: string;\n /** The chip on the session this page runs in. */\n current: string;\n /** A session whose device the server could not name. */\n unknownDevice: string;\n /** Given the last activity, formatted (\"3 hours ago\", \"5 Oct 2026\"). */\n lastActive: (when: string) => string;\n /** Given the address the session was last seen from. */\n ip: (address: string) => string;\n /** A row's button, visible text. */\n revoke: string;\n /** The same button's accessible name, given the device — it starts with `revoke`,\n * the visible text, so voice control finds it by what it says. */\n revokeItem: (device: string) => string;\n /** A request failed. */\n failed: string;\n}\n\n// Defined in ./sessions-setting-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_SESSIONS_LABELS };\n\n/* ── Props ───────────────────────────────────────────────────────────────── */\n\n/** What a session's `id` may be: the app's own key type. */\nexport type SessionId = string | number;\n\n/** One stored session (kastlan's `GET /auth/sessions`). */\nexport interface SessionItem<Id extends SessionId = SessionId> {\n id: Id;\n /** The browser and system, as the server reads them (\"Firefox on Windows\"). Blank\n * reads as `labels.unknownDevice`. */\n device?: string | null;\n /** The address it was last seen from. */\n ip?: string | null;\n /** A `Date`, an ISO string or epoch ms. */\n lastActiveAt?: DateInput;\n /** The session this page runs in: marked, and offered no \"Sign out\" of its own — the\n * app's sign-out does that, and \"Sign out everywhere\" below. */\n current?: boolean;\n}\n\n/** Which request failed — {@link SessionsSettingProps.describeError}'s second argument. */\nexport type SessionsAction = \"sign-out-everywhere\" | \"revoke\";\n\nexport interface SessionsSettingProps<Id extends SessionId = SessionId> extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"children\"\n> {\n /**\n * End every session (`POST /auth/logout`, auth §6.3) — this one included. Asked\n * first; resolve once the server answered, then sign this page out: the card says\n * that the device signs out too, and its own session is gone.\n */\n onSignOutEverywhere: () => Promise<unknown> | void;\n /**\n * The stored sessions, where the app keeps them (kastlan's `user_sessions`, §6.3).\n * Left out, the card is \"Sign out everywhere\" alone — keksdose and Kurvenschmiede keep\n * a cut-off (`sessions_invalid_before`), not rows. `undefined` with `loading` while the\n * first load runs.\n */\n sessions?: readonly SessionItem<Id>[];\n /** The list is loading. */\n loading?: boolean;\n /** End one other session (`DELETE /auth/sessions/{id}`). Left out, no row buttons.\n * The row is busy until it settles; refresh `sessions` then. */\n onRevoke?: (id: Id) => Promise<unknown> | void;\n /** The app's own words for a failure, or `undefined` for the kit's `failed`. */\n describeError?: (error: unknown, action: SessionsAction) => ReactNode | undefined;\n /** The \"Last active\" text. Default: how long ago, in the provider's locale, and the\n * date once it is more than a week back. */\n formatLastActive?: (date: Date) => string;\n /** Overrides the provider's locale for the default format. */\n locale?: string;\n labels?: LabelOverride<SessionsLabels>;\n}\n\n/**\n * Where the account is signed in, and the way out of all of it\n * (docs/user-admin-harmonization.md §6.3, §2.6).\n *\n * **\"Sign out everywhere\", in every app.** It ends every session, THIS one included —\n * the server stamps a cut-off (`sessions_invalid_before`) that the page's own token is\n * older than — so the confirm says so before it is pressed, and the app signs out once it\n * resolves. A {@link DangerConfirm} in the warning tone: nothing is lost, but the person\n * has to sign in again on every device. keksdose kept its ordinary sign-out device-only\n * (its offline mirror is wiped on an explicit sign-out), which is why this is an action\n * of its own, not a mode of that one.\n *\n * **The device list, where sessions are stored** (kastlan): device, address, last\n * active, and \"This device\" on the current one, with \"Sign out\" on each other row — no\n * confirm, since a session ended is a sign-in away from coming back, not data lost.\n * Without `sessions` there is no list: the other apps keep a cut-off, not rows.\n *\n * Both requests are the app's; a failure is said under the card's action, in the app's\n * words if `describeError` has them.\n *\n * **Under a write lock** both are `commit` controls exempt from billing\n * (`COMMIT_EXCEPT_BILLING`, 0.33): a lapsed plan never keeps a person from ending their\n * own sessions (docs/billing-harmonization.md §12.13, §12.36); a demo's lock still does.\n */\nexport function SessionsSetting<Id extends SessionId = SessionId>({\n onSignOutEverywhere,\n sessions,\n loading,\n onRevoke,\n describeError,\n formatLastActive,\n locale: localeProp,\n labels: labelsProp,\n className,\n ...rest\n}: SessionsSettingProps<Id>) {\n const labels = useKitLabels(\"sessions\", DEFAULT_SESSIONS_LABELS, labelsProp);\n const locale = useKitLocale(localeProp);\n const [busyId, setBusyId] = useState<Id | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const mounted = useMounted();\n\n const describe = (error: unknown, action: SessionsAction): ReactNode => {\n const own = describeError?.(error, action);\n return hasContent(own) ? own : labels.failed;\n };\n\n const lastActive = (value: DateInput): string | null => {\n const date = toDate(value);\n if (!date) return null;\n return formatLastActive\n ? formatLastActive(date)\n : formatRelativeTime(date, { locale, absoluteAfterDays: 7, absoluteStyle: \"medium\" });\n };\n\n const signOutEverywhere = () => {\n setFailure(null);\n // Rejected again after it is said, so the tile stays armed for a retry.\n return settle(onSignOutEverywhere).catch((error: unknown) => {\n if (mounted.current) setFailure(describe(error, \"sign-out-everywhere\"));\n throw error;\n });\n };\n\n const revoke = (id: Id) => {\n if (!onRevoke || busyId !== null) return;\n setBusyId(id);\n setFailure(null);\n settle(() => onRevoke(id)).then(\n () => {\n if (mounted.current) setBusyId(null);\n },\n (error: unknown) => {\n if (!mounted.current) return;\n setBusyId(null);\n setFailure(describe(error, \"revoke\"));\n },\n );\n };\n\n const showList = sessions !== undefined || loading;\n\n return (\n <Card {...rest} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{labels.description}</div>\n </div>\n {showList &&\n (loading || sessions === undefined ? (\n <Skeleton lines={2} label={labels.loading} />\n ) : sessions.length === 0 ? (\n <p className={CARD_DESCRIPTION_CLASS}>{labels.empty}</p>\n ) : (\n <ul aria-label={labels.list} className=\"divide-y divide-subtle\">\n {sessions.map((session) => {\n const device = session.device?.trim() || labels.unknownDevice;\n const when = lastActive(session.lastActiveAt);\n const ip = session.ip?.trim();\n return (\n <li\n key={session.id}\n data-session-id={String(session.id)}\n data-current={session.current || undefined}\n className=\"flex items-center gap-3 py-2\"\n >\n <MonitorSmartphone aria-hidden className=\"size-4 shrink-0 text-muted\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1\">\n <span className=\"min-w-0 break-words text-sm font-medium\">{device}</span>\n {session.current && (\n <Chip size=\"sm\" tone=\"brand\">\n {labels.current}\n </Chip>\n )}\n </div>\n {(when || ip) && (\n <div className={CARD_DESCRIPTION_CLASS}>\n {when && labels.lastActive(when)}\n {when && ip && \" · \"}\n {/* An address reads left to right in any page direction. */}\n {ip && <span dir=\"ltr\">{labels.ip(ip)}</span>}\n </div>\n )}\n </div>\n {onRevoke && !session.current && (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={busyId === session.id}\n disabled={busyId !== null && busyId !== session.id}\n aria-label={labels.revokeItem(device)}\n onClick={() => revoke(session.id)}\n >\n {labels.revoke}\n </Button>\n )}\n </li>\n );\n })}\n </ul>\n ))}\n <DangerConfirm\n tone=\"warning\"\n commit={COMMIT_EXCEPT_BILLING}\n armLabel={labels.signOutEverywhere}\n prompt={labels.signOutEverywherePrompt}\n confirmLabel={labels.confirmSignOutEverywhere}\n onConfirm={signOutEverywhere}\n />\n {hasContent(failure) && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure}\n </AlertBanner>\n )}\n </Card>\n );\n}\n"],"mappings":";AAyMM,SACE,KADF;AAzMN,SAAS,gBAAgB;AAEzB,SAAS,yBAAyB;AAElC,SAAS,cAAc,oBAAwC;AAC/D,SAAS,UAAU;AACnB,SAAS,oBAAoB,cAAc;AAE3C,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,wBAAwB,QAAQ,kBAAkB;AAC3D,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AA2HjC,SAAS,gBAAkD;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAA6B;AAC3B,QAAM,SAAS,aAAa,YAAY,yBAAyB,UAAU;AAC3E,QAAM,SAAS,aAAa,UAAU;AACtC,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAoB,IAAI;AACpD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAoB,IAAI;AACtD,QAAM,UAAU,WAAW;AAE3B,QAAM,WAAW,CAAC,OAAgB,WAAsC;AACtE,UAAM,MAAM,gBAAgB,OAAO,MAAM;AACzC,WAAO,WAAW,GAAG,IAAI,MAAM,OAAO;AAAA,EACxC;AAEA,QAAM,aAAa,CAAC,U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AO,KACjB,oBAAC,eAAY,MAAK,UAAS,MAAK,MAAK,MAAK,SACvC,mBACH;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/account/sessions-setting.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { MonitorSmartphone } from \"lucide-react\";\n\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { useDayFormatter } from \"../lib/day-format\";\nimport { describeFailure } from \"../lib/describe-failure\";\nimport { toDate, useKitFormat } from \"../lib/format\";\nimport type { DateInput } from \"../lib/format\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { Chip } from \"../components/chip\";\nimport { hasContent } from \"../lib/presence\";\nimport { DangerConfirm } from \"../components/danger-confirm\";\nimport { Skeleton } from \"../components/skeleton\";\nimport { Button } from \"../components/button\";\nimport { Card } from \"../components/card\";\nimport { CARD_DESCRIPTION_CLASS, settle, useMounted } from \"./account-parts\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\nimport { DEFAULT_SESSIONS_LABELS } from \"./sessions-setting-labels\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** Every string {@link SessionsSetting} renders — the `sessions` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. The confirm's\n * Cancel is `dangerConfirm.cancel`. */\nexport interface SessionsLabels {\n /** The card's title. */\n title: string;\n /** The line under it: what \"sign out everywhere\" is for. */\n description: string;\n /** The button that asks first. */\n signOutEverywhere: string;\n /** The question it asks: every session ends, this one too. */\n signOutEverywherePrompt: string;\n /** The button that answers it. */\n confirmSignOutEverywhere: string;\n /** The device list's accessible name. */\n list: string;\n /** While the list loads. */\n loading: string;\n /** A list with no rows. */\n empty: string;\n /** The chip on the session this page runs in. */\n current: string;\n /** A session whose device the server could not name. */\n unknownDevice: string;\n /** Given the last activity, formatted (\"3 hours ago\", \"5 Oct 2026\"). */\n lastActive: (when: string) => string;\n /** Given the address the session was last seen from. */\n ip: (address: string) => string;\n /** A row's button, visible text. */\n revoke: string;\n /** The same button's accessible name, given the device — it starts with `revoke`,\n * the visible text, so voice control finds it by what it says. */\n revokeItem: (device: string) => string;\n /** A request failed. */\n failed: string;\n}\n\n// Defined in ./sessions-setting-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_SESSIONS_LABELS };\n\n/* ── Props ───────────────────────────────────────────────────────────────── */\n\n/** What a session's `id` may be: the app's own key type. */\nexport type SessionId = string | number;\n\n/** One stored session (kastlan's `GET /auth/sessions`). */\nexport interface SessionItem<Id extends SessionId = SessionId> {\n id: Id;\n /** The browser and system, as the server reads them (\"Firefox on Windows\"). Blank\n * reads as `labels.unknownDevice`. */\n device?: string | null;\n /** The address it was last seen from. */\n ip?: string | null;\n /** A `Date`, an ISO string or epoch ms. */\n lastActiveAt?: DateInput;\n /** The session this page runs in: marked, and offered no \"Sign out\" of its own — the\n * app's sign-out does that, and \"Sign out everywhere\" below. */\n current?: boolean;\n}\n\n/** Which request failed — {@link SessionsSettingProps.describeError}'s second argument. */\nexport type SessionsAction = \"sign-out-everywhere\" | \"revoke\";\n\nexport interface SessionsSettingProps<Id extends SessionId = SessionId> extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"children\"\n> {\n /**\n * End every session (`POST /auth/logout`, auth §6.3) — this one included. Asked\n * first; resolve once the server answered, then sign this page out: the card says\n * that the device signs out too, and its own session is gone.\n */\n onSignOutEverywhere: () => Promise<unknown> | void;\n /**\n * The stored sessions, where the app keeps them (kastlan's `user_sessions`, §6.3).\n * Left out, the card is \"Sign out everywhere\" alone — keksdose and Kurvenschmiede keep\n * a cut-off (`sessions_invalid_before`), not rows. `undefined` with `loading` while the\n * first load runs.\n */\n sessions?: readonly SessionItem<Id>[];\n /** The list is loading. */\n loading?: boolean;\n /** End one other session (`DELETE /auth/sessions/{id}`). Left out, no row buttons.\n * The row is busy until it settles; refresh `sessions` then. */\n onRevoke?: (id: Id) => Promise<unknown> | void;\n /** The app's own words for a failure, or `undefined` for the kit's `failed`. */\n describeError?: (error: unknown, action: SessionsAction) => ReactNode | undefined;\n /** The \"Last active\" text. Default: how long ago, in the provider's locale and\n * `timeZone`, and the date once it is more than a week back — through the provider's\n * `formatDate` (the app's date preference) when it has one. */\n formatLastActive?: (date: Date) => string;\n /** Overrides the provider's locale for the default format. */\n locale?: string;\n labels?: LabelOverride<SessionsLabels>;\n}\n\n/**\n * Where the account is signed in, and the way out of all of it\n * (docs/user-admin-harmonization.md §6.3, §2.6).\n *\n * **\"Sign out everywhere\", in every app.** It ends every session, THIS one included —\n * the server stamps a cut-off (`sessions_invalid_before`) that the page's own token is\n * older than — so the confirm says so before it is pressed, and the app signs out once it\n * resolves. A {@link DangerConfirm} in the warning tone: nothing is lost, but the person\n * has to sign in again on every device. keksdose kept its ordinary sign-out device-only\n * (its offline mirror is wiped on an explicit sign-out), which is why this is an action\n * of its own, not a mode of that one.\n *\n * **The device list, where sessions are stored** (kastlan): device, address, last\n * active, and \"This device\" on the current one, with \"Sign out\" on each other row — no\n * confirm, since a session ended is a sign-in away from coming back, not data lost.\n * Without `sessions` there is no list: the other apps keep a cut-off, not rows.\n *\n * Both requests are the app's; a failure is said under the card's action, in the app's\n * words if `describeError` has them.\n *\n * **Under a write lock** both are `commit` controls exempt from billing\n * (`COMMIT_EXCEPT_BILLING`, 0.33): a lapsed plan never keeps a person from ending their\n * own sessions (docs/billing-harmonization.md §12.13, §12.36); a demo's lock still does.\n */\nexport function SessionsSetting<Id extends SessionId = SessionId>({\n onSignOutEverywhere,\n sessions,\n loading,\n onRevoke,\n describeError,\n formatLastActive,\n locale: localeProp,\n labels: labelsProp,\n className,\n ...rest\n}: SessionsSettingProps<Id>) {\n const labels = useKitLabels(\"sessions\", DEFAULT_SESSIONS_LABELS, labelsProp);\n // The provider's locale and `timeZone`; past a week the words are a date, and a date\n // that names a day follows the app's preference (refactor audit 2026-10-30, DUP-2).\n const { formatDate, formatRelativeTime } = useKitFormat(localeProp);\n const day = useDayFormatter(null, localeProp);\n const [busyId, setBusyId] = useState<Id | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const mounted = useMounted();\n\n const describe = (error: unknown, action: SessionsAction): ReactNode =>\n describeFailure(describeError?.(error, action), labels.failed);\n\n const lastActive = (value: DateInput): string | null => {\n const date = toDate(value);\n if (!date) return null;\n if (formatLastActive) return formatLastActive(date);\n const words = formatRelativeTime(date, { absoluteAfterDays: 7, absoluteStyle: \"medium\" });\n // Past a week the words ARE the medium date (\"5 weeks ago\" makes a reader do sums);\n // then the day as the app's preference writes it.\n return words === formatDate(date, \"medium\") ? day(date) : words;\n };\n\n const signOutEverywhere = () => {\n setFailure(null);\n // Rejected again after it is said, so the tile stays armed for a retry.\n return settle(onSignOutEverywhere).catch((error: unknown) => {\n if (mounted.current) setFailure(describe(error, \"sign-out-everywhere\"));\n throw error;\n });\n };\n\n const revoke = (id: Id) => {\n if (!onRevoke || busyId !== null) return;\n setBusyId(id);\n setFailure(null);\n settle(() => onRevoke(id)).then(\n () => {\n if (mounted.current) setBusyId(null);\n },\n (error: unknown) => {\n if (!mounted.current) return;\n setBusyId(null);\n setFailure(describe(error, \"revoke\"));\n },\n );\n };\n\n const showList = sessions !== undefined || loading;\n\n return (\n <Card {...rest} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{labels.description}</div>\n </div>\n {showList &&\n (loading || sessions === undefined ? (\n <Skeleton lines={2} label={labels.loading} />\n ) : sessions.length === 0 ? (\n <p className={CARD_DESCRIPTION_CLASS}>{labels.empty}</p>\n ) : (\n <ul aria-label={labels.list} className=\"divide-y divide-subtle\">\n {sessions.map((session) => {\n const device = session.device?.trim() || labels.unknownDevice;\n const when = lastActive(session.lastActiveAt);\n const ip = session.ip?.trim();\n return (\n <li\n key={session.id}\n data-session-id={String(session.id)}\n data-current={session.current || undefined}\n className=\"flex items-center gap-3 py-2\"\n >\n <MonitorSmartphone aria-hidden className=\"size-4 shrink-0 text-muted\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1\">\n <span className=\"min-w-0 break-words text-sm font-medium\">{device}</span>\n {session.current && (\n <Chip size=\"sm\" tone=\"brand\">\n {labels.current}\n </Chip>\n )}\n </div>\n {(when || ip) && (\n <div className={CARD_DESCRIPTION_CLASS}>\n {when && labels.lastActive(when)}\n {when && ip && \" · \"}\n {/* An address reads left to right in any page direction. */}\n {ip && <span dir=\"ltr\">{labels.ip(ip)}</span>}\n </div>\n )}\n </div>\n {onRevoke && !session.current && (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={busyId === session.id}\n disabled={busyId !== null && busyId !== session.id}\n aria-label={labels.revokeItem(device)}\n onClick={() => revoke(session.id)}\n >\n {labels.revoke}\n </Button>\n )}\n </li>\n );\n })}\n </ul>\n ))}\n <DangerConfirm\n tone=\"warning\"\n commit={COMMIT_EXCEPT_BILLING}\n armLabel={labels.signOutEverywhere}\n prompt={labels.signOutEverywherePrompt}\n confirmLabel={labels.confirmSignOutEverywhere}\n onConfirm={signOutEverywhere}\n />\n {hasContent(failure) && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure}\n </AlertBanner>\n )}\n </Card>\n );\n}\n"],"mappings":";AA+MM,SACE,KADF;AA/MN,SAAS,gBAAgB;AAEzB,SAAS,yBAAyB;AAElC,SAAS,oBAAwC;AACjD,SAAS,UAAU;AACnB,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,QAAQ,oBAAoB;AAErC,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,Y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W,IAAI;AAAA,gBAC9B,QAAQ,MAAM;AAAA,gBAEd,MAAM,oBAAC,UAAK,KAAI,OAAO,iBAAO,GAAG,EAAE,GAAE;AAAA,iBACxC;AAAA,eAEJ;AAAA,YACC,YAAY,CAAC,QAAQ,WACpB;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,MAAK;AAAA,gBACL,SAAQ;AAAA,gBACR,QAAQ;AAAA,gBACR,SAAS,WAAW,QAAQ;AAAA,gBAC5B,UAAU,WAAW,QAAQ,WAAW,QAAQ;AAAA,gBAChD,cAAY,OAAO,WAAW,MAAM;AAAA,gBACpC,SAAS,MAAM,OAAO,QAAQ,EAAE;AAAA,gBAE/B,iBAAO;AAAA;AAAA,YACV;AAAA;AAAA;AAAA,QApCG,QAAQ;AAAA,MAsCf;AAAA,IAEJ,CAAC,GACH;AAAA,IAEJ;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,QAAQ;AAAA,QACR,UAAU,OAAO;AAAA,QACjB,QAAQ,OAAO;AAAA,QACf,cAAc,OAAO;AAAA,QACrB,WAAW;AAAA;AAAA,IACb;AAAA,IACC,WAAW,OAAO,KACjB,oBAAC,eAAY,MAAK,UAAS,MAAK,MAAK,MAAK,SACvC,mBACH;AAAA,KAEJ;AAEJ;","names":[]}
@@ -11,11 +11,9 @@ import { Button } from "../components/button.js";
11
11
  import { authErrorCode } from "../auth/auth-errors.js";
12
12
  import { usePersonLabel } from "./admin-parts.js";
13
13
  import { hasContent } from "../lib/presence.js";
14
+ import { isThenable } from "../lib/thenable.js";
14
15
  import { isGroupTarget } from "./admin-action-log.js";
15
16
  import { DEFAULT_ADMIN_ACTION_LABELS } from "./admin-action-confirm-labels.js";
16
- function isThenable(value) {
17
- return typeof value === "object" && value !== null && typeof value.then === "function";
18
- }
19
17
  function refusalOf(error, present, describeError, labels) {
20
18
  if (!present) return null;
21
19
  const code = authErrorCode(error);
@@ -169,6 +167,7 @@ function AdminActionConfirm({
169
167
  title: heading,
170
168
  description: identity,
171
169
  onClose: () => onClose(confirmed.current),
170
+ busy,
172
171
  actions: (close) => /* @__PURE__ */ jsx(CloseOnDone, { done, children: /* @__PURE__ */ jsx(Button, { type: "button", variant: "secondary", disabled: busy, onClick: close, children: labels.close }) }),
173
172
  children: refusalBanner
174
173
  }
@@ -194,10 +193,7 @@ function AdminActionConfirm({
194
193
  title: heading,
195
194
  description: identity,
196
195
  onClose: () => onClose(confirmed.current),
197
- onKeyDown: (event) => {
198
- if (busy && event.key === "Escape") event.preventDefault();
199
- },
200
- "aria-busy": busy || void 0,
196
+ busy,
201
197
  actions: (close) => /* @__PURE__ */ jsxs(CloseOnDone, { done, children: [
202
198
  /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", disabled: busy, onClick: close, children: labels.cancel }),
203
199
  /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/admin/admin-action-confirm.tsx"],"sourcesContent":["import { Children, useContext, useEffect, useId, useRef, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { Checkbox } from \"../components/checkbox\";\nimport { DEFAULT_DANGER_CONFIRM_LABELS, TypedConfirmField, typedMatches } from \"../components/danger-confirm\";\nimport type { DangerConsequence } from \"../components/danger-confirm\";\nimport { DialogFrame } from \"../components/dialog-frame\";\nimport { ModalCloseContext } from \"../components/modal\";\nimport { Button } from \"../components/button\";\nimport { authErrorCode } from \"../auth/auth-errors\";\nimport type { KitErrorCode } from \"../auth/auth-errors\";\nimport { usePersonLabel } from \"./admin-parts\";\nimport { hasContent } from \"../lib/presence\";\nimport type { AdminPerson, MaybePromise } from \"./admin-parts\";\nimport { isGroupTarget } from \"./admin-action-log\";\nimport type { AdminGroupTarget } from \"./admin-action-log\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport { DEFAULT_ADMIN_ACTION_LABELS } from \"./admin-action-confirm-labels\";\n\n/**\n * The confirmation in front of an admin action, at the level the SERVER states\n * (docs/user-admin-harmonization.md §4.2):\n *\n * | level | what it asks | actions |\n * |---|---|---|\n * | `none` | nothing: it confirms at once and renders nothing | resend a mail, reactivate, the reviewer scope… |\n * | `acknowledge` | a tick under the consequence | force a password change, change a role, delete a group |\n * | `type_email` | the target's address, typed | deactivate, erase now, transfer |\n *\n * A GROUP (round 0.34, §11.8) is a target at `none` and `acknowledge` only, said by its\n * name: it has no address to type, and no level table gives a group's action\n * `type_email` (server-kit's `require_confirmation` raises for one). The props' types\n * say so. Deleting one (`group_delete`) is `acknowledge` — a tick under the app's own\n * sentence of what goes with it, Kurvenschmiede's \"3 members, 2 grants and 1 invitation\n * go with it\" (decision 5): the cascade is what nobody can see afterwards.\n *\n * keksdose decides the level per action and per account on the server\n * (`admin_user_actions_service`) and Kurvenschmiede asks for the typed address on its\n * two hard-to-undo actions; both drew the dialog by hand beside the kit's `DangerConfirm`\n * and `useConfirm`. The level is a PROP, never derived here: the server enforces it and\n * a hand-written request never sees this dialog, so a page that guessed its own level\n * could only disagree with the server. The comparison (caseless), the field and the tick\n * are `DangerConfirm`'s (`TypedConfirmField`, the `dangerConfirm` words), so the three\n * confirmations in the kit cannot disagree about what counts as the address.\n *\n * WHY TYPE THE TARGET'S ADDRESS and not the admin's password: the admin proved who they\n * are at the admin gate. What is unproven is which ROW they are on (keksdose's\n * `TYPE_EMAIL` rule, Kurvenschmiede's `TypedConfirm`).\n *\n * THE REFUSALS (§4.1, §9.6) are read by code — `authErrorCode`, which knows the account\n * codes beside the sign-in ones — and stay in the dialog, which stays open so the admin\n * can read them: `last_admin`, `self_action`, `confirmation_mismatch`, and kastlan's\n * `other_companies` — with \"Remove from company\" offered in its place when the app passes\n * `onRemoveFromCompany`. Anything else is `describeError`'s words, else \"That didn't work\".\n * At level `none` nothing is drawn while the action runs; a refusal opens a dialog of its\n * own to say it.\n *\n * It never sends a request: `onConfirm` does, with what the guards were answered with.\n */\n\n/** How much confirmation an action needs — the server's `confirmation_level(action)`. */\nexport type AdminConfirmLevel = \"none\" | \"acknowledge\" | \"type_email\";\n\n/** What {@link AdminActionConfirmProps.onConfirm} receives — the guards' answers, for\n * the request body (the server re-checks both). */\nexport interface AdminActionConfirmValues {\n /** `type_email`: the address as typed — trimmed, its case the admin's; the body's\n * `confirm_email`, which the server compares with the account's (server-kit's\n * `confirm_email_matches`). */\n confirmEmail?: string;\n /** `acknowledge` and `type_email`: the action was confirmed past a guard — the body's\n * `acknowledged`, which every admin action carries (server-kit 0.4). */\n acknowledged?: true;\n}\n\n/** The account the action is about. A group is an {@link AdminGroupTarget}. */\nexport type AdminActionTarget = AdminPerson & { email: string };\n\n/** The `adminAction` namespace. The tick, the typed field and their held-button reasons\n * are the `dangerConfirm` namespace's, shared with `DangerConfirm`. */\nexport interface AdminActionLabels {\n /** The confirm button when the action names none. */\n confirm: string;\n cancel: string;\n /** The refusal dialog's only button (level `none`). */\n close: string;\n /** `409 last_admin`. */\n lastAdmin: string;\n /** `409 self_action`: the admin's own account. */\n self: string;\n /** `confirmation_mismatch`: the typed address is not this account's — the page and\n * the server disagree about which row this is. */\n confirmationMismatch: string;\n /** kastlan's `409 other_companies` (§9.6). */\n otherCompanies: string;\n /** The alternative offered with it. */\n removeFromCompany: string;\n /** Any other failure, unless `describeError` says better. */\n failed: string;\n}\n\n// Defined in ./admin-action-confirm-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_ADMIN_ACTION_LABELS };\n\n/** What the action is about, and the level the server states for it. A union, so a group\n * can't be given `type_email` (§11.8). */\ntype AdminActionConfirmTarget =\n | {\n /** The level the server states for this action on this account (§4.2). */\n level: AdminConfirmLevel;\n /** Whom it is about: the address (typed at `type_email`) and the name parts. */\n target: AdminActionTarget;\n }\n | {\n /** A group's action: `none`, or `acknowledge` for `group_delete` (decision 5). */\n level: Exclude<AdminConfirmLevel, \"type_email\">;\n /** The group it is about, said by its name (0.34, §11.8). */\n target: AdminGroupTarget;\n };\n\n/** The props whatever the target. */\ninterface AdminActionConfirmCommonProps {\n /** The confirm button — \"Deactivate\". Also the title when no `title` is given. */\n confirmLabel?: ReactNode;\n /** The dialog's heading — \"Deactivate Ada Example?\". Default `confirmLabel`. */\n title?: ReactNode;\n /**\n * What the action does to THIS account, said before it happens: a sentence, or lines\n * (`DangerConsequence`, a `severe` one in the danger colour). Derive them from the\n * row's facts rather than reciting the worst case (keksdose dev#488).\n */\n consequence?: ReactNode | readonly (string | DangerConsequence)[];\n /** The tick's words at `acknowledge`. Default `dangerConfirm.acknowledge` — \"I have\n * read what this does and want to continue.\" */\n acknowledgeLabel?: ReactNode;\n /** `danger` (default at `type_email`): a red confirm. `warning` (default at\n * `acknowledge`) and `neutral`: the primary confirm. */\n tone?: \"danger\" | \"warning\" | \"neutral\";\n /**\n * Runs the action. Return a promise and the dialog manages itself: busy until it\n * settles, closed (`onClose(true)`) when it resolves, open with the refusal when it\n * rejects. Return nothing and the app owns the rest — `busy`, `error`, closing it.\n */\n onConfirm: (values: AdminActionConfirmValues) => MaybePromise;\n /** The dialog has closed: `true` after the action (or the alternative) went through,\n * `false` for Cancel, Escape, the backdrop or Back. */\n onClose: (done: boolean) => void;\n /** kastlan: offered with an `other_companies` refusal — `DELETE …/membership`,\n * logged as `membership_remove` (§4.1). Promise handling as `onConfirm`. */\n onRemoveFromCompany?: () => MaybePromise;\n /** The app's words for a failure the kit has no code for. Asked first. */\n describeError?: (error: unknown) => ReactNode | undefined;\n /** A refusal the app caught itself, when `onConfirm` returns nothing. */\n error?: unknown;\n /** The action is running, for an app that tracks it itself. */\n busy?: boolean;\n /**\n * Fields of the action's own, above the guard — the transfer's recipient, kastlan's\n * roles (`RolesEditor`). Their values are the app's; hold the confirm with\n * `confirmDisabledReason` until they are complete.\n */\n children?: ReactNode;\n /** Why the confirm is held for a reason of the app's (\"Choose who receives it\").\n * Named before the guard's own, since the fields are above it. */\n confirmDisabledReason?: ReactNode;\n /** Kept-mounted mode, as on `DialogFrame`; left out, open while mounted. */\n open?: boolean;\n /** The confirm COMMITS: under a locked `WriteLockProvider` it is held with the lock's\n * reason. Off by default — an admin action is not a write to the open record. */\n commit?: CommitScope;\n labels?: LabelOverride<AdminActionLabels>;\n}\n\n/** A type since 0.34 (an interface before): a person at any level, or a group at `none`\n * and `acknowledge`. */\nexport type AdminActionConfirmProps = AdminActionConfirmCommonProps & AdminActionConfirmTarget;\n\n/** Whether a callback answered a promise. */\nfunction isThenable(value: unknown): value is PromiseLike<unknown> {\n return typeof value === \"object\" && value !== null && typeof (value as PromiseLike<unknown>).then === \"function\";\n}\n\n/** The refusal's words and code. */\nfunction refusalOf(\n error: unknown,\n present: boolean,\n describeError: AdminActionConfirmProps[\"describeError\"],\n labels: AdminActionLabels,\n): { text: ReactNode; code: KitErrorCode | undefined } | null {\n if (!present) return null;\n const code = authErrorCode(error);\n const own = describeError?.(error);\n if (hasContent(own)) return { text: own, code };\n const text =\n code === \"last_admin\"\n ? labels.lastAdmin\n : code === \"self_action\"\n ? labels.self\n : code === \"confirmation_mismatch\"\n ? labels.confirmationMismatch\n : code === \"other_companies\"\n ? labels.otherCompanies\n : labels.failed;\n return { text, code };\n}\n\n/** The selector for the first field among the caller's `children` — what opening focuses. */\nconst FIELD =\n 'input:not([type=\"hidden\"]):not(:disabled), select:not(:disabled), textarea:not(:disabled), [role=\"combobox\"]';\n\nexport function AdminActionConfirm({\n level,\n target,\n confirmLabel,\n title,\n consequence,\n acknowledgeLabel,\n tone: toneProp,\n onConfirm,\n onClose,\n onRemoveFromCompany,\n describeError,\n error: errorProp,\n busy: busyProp,\n children,\n confirmDisabledReason,\n open,\n commit,\n labels: labelsProp,\n}: AdminActionConfirmProps) {\n const labels = useKitLabels(\"adminAction\", DEFAULT_ADMIN_ACTION_LABELS, labelsProp);\n const guardLabels = useKitLabels(\"dangerConfirm\", DEFAULT_DANGER_CONFIRM_LABELS);\n const nameOf = usePersonLabel();\n const isOpen = open ?? true;\n const [typed, setTyped] = useState(\"\");\n const [ticked, setTicked] = useState(false);\n const [pending, setPending] = useState(false);\n // The last rejection, boxed so a rejection with `undefined` still counts as one.\n const [failure, setFailure] = useState<{ error: unknown } | null>(null);\n // Resolved: the actions row lowers the panel, and `onClose` answers true.\n const [done, setDone] = useState(false);\n const confirmed = useRef(false);\n const mounted = useRef(true);\n const started = useRef(false);\n const formId = useId();\n const slotRef = useRef<HTMLDivElement>(null);\n const guardRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n // A close (kept-mounted) wipes the guards and the refusal: a reopened dialog starts\n // over. During render, like ReauthDialog's, so no frame shows the old answers.\n const [wasOpen, setWasOpen] = useState(isOpen);\n if (wasOpen !== isOpen) {\n setWasOpen(isOpen);\n if (!isOpen) {\n setTyped(\"\");\n setTicked(false);\n setFailure(null);\n setDone(false);\n }\n }\n\n const busy = Boolean(busyProp) || pending;\n\n /** Runs `call`, managing busy, the refusal and the close — or not, when it answers\n * no promise (the app owns it then). */\n const perform = (call: () => MaybePromise) => {\n let result: MaybePromise;\n try {\n result = call();\n } catch (caught) {\n setFailure({ error: caught });\n return;\n }\n if (!isThenable(result)) return;\n setFailure(null);\n setPending(true);\n result.then(\n () => {\n if (!mounted.current) return;\n setPending(false);\n confirmed.current = true;\n setDone(true);\n },\n (caught: unknown) => {\n if (!mounted.current) return;\n setPending(false);\n setFailure({ error: caught });\n },\n );\n };\n\n // Level `none`: confirmed the moment it opens, once per opening. Nothing is drawn\n // while it runs; the promise's answer comes back asynchronously.\n useEffect(() => {\n if (level !== \"none\") return;\n if (!isOpen) {\n started.current = false;\n return;\n }\n if (started.current) return;\n started.current = true;\n confirmed.current = false;\n let result: unknown;\n try {\n result = onConfirm({});\n } catch (caught) {\n result = Promise.reject(caught);\n }\n // No promise: the app owns the rest (it closes the part, or passes `error`).\n if (!isThenable(result)) return;\n result.then(\n () => {\n if (mounted.current) onClose(true);\n },\n (caught: unknown) => {\n if (mounted.current) setFailure({ error: caught });\n },\n );\n }, [level, isOpen, onConfirm, onClose]);\n\n // Focus the first thing the dialog waits for, after Modal's own effect has recorded\n // the trigger to return to (a parent's effects run after its children's).\n useEffect(() => {\n if (!isOpen || level === \"none\") return;\n const field = slotRef.current?.querySelector<HTMLElement>(FIELD) ?? guardRef.current;\n field?.focus();\n }, [isOpen, level]);\n\n const hasRefusal = failure !== null || errorProp !== undefined;\n const refusal = refusalOf(failure ? failure.error : errorProp, hasRefusal, describeError, labels);\n const offerRemoval = refusal?.code === \"other_companies\" && onRemoveFromCompany !== undefined;\n\n // A group has no address: it is said by its name, and nothing is typed for it — not\n // even when a caller outside the types passes `type_email` (the server refuses that).\n const group = isGroupTarget(target);\n const email = group ? \"\" : target.email;\n const name = group ? (target.name ?? \"\").trim() : nameOf(target);\n const said = !name || name === email ? email : email ? `${name} · ${email}` : name;\n const identity = <span data-private>{said}</span>;\n const heading = title ?? confirmLabel ?? labels.confirm;\n\n const refusalBanner = refusal && (\n <AlertBanner\n tone=\"danger\"\n size=\"sm\"\n action={\n offerRemoval ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"secondary\"\n disabled={busy}\n onClick={() => perform(() => onRemoveFromCompany!())}\n >\n {labels.removeFromCompany}\n </Button>\n ) : undefined\n }\n >\n {refusal.text}\n </AlertBanner>\n );\n\n if (level === \"none\") {\n // Nothing to ask: only a refusal is worth a dialog.\n if (!isOpen || !refusal) return null;\n return (\n <DialogFrame\n role=\"alertdialog\"\n title={heading}\n description={identity}\n onClose={() => onClose(confirmed.current)}\n actions={(close) => (\n <CloseOnDone done={done}>\n <Button type=\"button\" variant=\"secondary\" disabled={busy} onClick={close}>\n {labels.close}\n </Button>\n </CloseOnDone>\n )}\n >\n {refusalBanner}\n </DialogFrame>\n );\n }\n\n const tone = toneProp ?? (level === \"type_email\" ? \"danger\" : \"warning\");\n const askTyped = level === \"type_email\" && !group;\n const typedOk = !askTyped || typedMatches(typed, email, \"caseless\");\n const tickOk = askTyped || ticked;\n const guardReason: ReactNode = hasContent(confirmDisabledReason)\n ? confirmDisabledReason\n : !tickOk\n ? guardLabels.needsAcknowledge\n : !typedOk\n ? typeof guardLabels.needsPhrase === \"function\"\n ? guardLabels.needsPhrase(email)\n : guardLabels.needsPhrase\n : undefined;\n\n const submit = () => {\n if (busy || guardReason !== undefined) return;\n perform(() => onConfirm(askTyped ? { confirmEmail: typed.trim(), acknowledged: true } : { acknowledged: true }));\n };\n\n const lines = Array.isArray(consequence)\n ? (consequence as readonly (string | DangerConsequence)[]).map((item, index) =>\n typeof item === \"string\"\n ? { key: item, text: item as ReactNode, severe: false }\n : { key: item.key ?? String(index), text: item.text, severe: Boolean(item.severe) },\n )\n : null;\n\n return (\n <DialogFrame\n open={open}\n role=\"alertdialog\"\n title={heading}\n description={identity}\n onClose={() => onClose(confirmed.current)}\n // A request that has left cannot be called back by closing the dialog.\n onKeyDown={(event: KeyboardEvent<HTMLDivElement>) => {\n if (busy && event.key === \"Escape\") event.preventDefault();\n }}\n aria-busy={busy || undefined}\n actions={(close) => (\n <CloseOnDone done={done}>\n <Button type=\"button\" variant=\"ghost\" disabled={busy} onClick={close}>\n {labels.cancel}\n </Button>\n <Button\n type=\"submit\"\n form={formId}\n variant={tone === \"danger\" ? \"danger\" : \"default\"}\n pending={busy}\n commit={commit}\n disabledReason={busy ? undefined : guardReason}\n >\n {confirmLabel ?? labels.confirm}\n </Button>\n </CloseOnDone>\n )}\n >\n <form\n id={formId}\n noValidate\n className=\"space-y-3\"\n onSubmit={(event) => {\n event.preventDefault();\n submit();\n }}\n >\n {lines ? (\n <ul className=\"list-disc space-y-1 ps-5 text-sm text-secondary\">\n {lines.map((line) => (\n <li key={line.key} className={line.severe ? \"text-danger\" : undefined}>\n {line.text}\n </li>\n ))}\n </ul>\n ) : (\n hasContent(consequence as ReactNode) && <p className=\"text-sm text-secondary\">{consequence as ReactNode}</p>\n )}\n {Children.toArray(children).some(hasContent) && (\n <div ref={slotRef} className=\"space-y-3\">\n {children}\n </div>\n )}\n {askTyped ? (\n <TypedConfirmField\n ref={guardRef}\n target={email}\n match=\"caseless\"\n value={typed}\n onValueChange={setTyped}\n busy={busy}\n data-private\n />\n ) : (\n <Checkbox\n ref={guardRef}\n label={acknowledgeLabel ?? guardLabels.acknowledge}\n checked={ticked}\n // Not `disabled` while busy: the box may hold the focus.\n onCheckedChange={(next) => {\n if (!busy) setTicked(next);\n }}\n />\n )}\n {refusalBanner}\n </form>\n </DialogFrame>\n );\n}\n\n/**\n * The actions row's wrapper: it renders INSIDE the Modal, where the panel's animated\n * close is in context, so a resolved action lowers the panel the way Cancel does and\n * Modal then calls `onClose` (ReauthDialog's pattern).\n */\nfunction CloseOnDone({ done, children }: { done: boolean; children: ReactNode }) {\n const close = useContext(ModalCloseContext);\n useEffect(() => {\n if (done) close?.();\n }, [done, close]);\n return <>{children}</>;\n}\n"],"mappings":";AA0VmB,SAsKV,UAtKU,KAuFX,YAvFW;AA1VnB,SAAS,UAAU,YAAY,WAAW,OAAO,QAAQ,gBAAgB;AAEzE,SAAS,oBAAwC;AACjD,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,+BAA+B,mBAAmB,oBAAoB;AAE/E,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAE9B,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAE3B,SAAS,qBAAqB;AAG9B,SAAS,mCAAmC;AAiK5C,SAAS,WAAW,OAA+C;AACjE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAQ,MAA+B,SAAS;AACxG;AAGA,SAAS,UACP,OACA,SACA,eACA,QAC4D;AAC5D,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,OAAO,cAAc,KAAK;AAChC,QAAM,MAAM,gBAAgB,KAAK;AACjC,MAAI,WAAW,GAAG,EAAG,QAAO,EAAE,MAAM,KAAK,KAAK;AAC9C,QAAM,OACJ,SAAS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,"sources":["../../src/admin/admin-action-confirm.tsx"],"sourcesContent":["import { Children, useContext, useEffect, useId, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { Checkbox } from \"../components/checkbox\";\nimport { DEFAULT_DANGER_CONFIRM_LABELS, TypedConfirmField, typedMatches } from \"../components/danger-confirm\";\nimport type { DangerConsequence } from \"../components/danger-confirm\";\nimport { DialogFrame } from \"../components/dialog-frame\";\nimport { ModalCloseContext } from \"../components/modal\";\nimport { Button } from \"../components/button\";\nimport { authErrorCode } from \"../auth/auth-errors\";\nimport type { KitErrorCode } from \"../auth/auth-errors\";\nimport { usePersonLabel } from \"./admin-parts\";\nimport { hasContent } from \"../lib/presence\";\nimport { isThenable } from \"../lib/thenable\";\nimport type { AdminPerson, MaybePromise } from \"./admin-parts\";\nimport { isGroupTarget } from \"./admin-action-log\";\nimport type { AdminGroupTarget } from \"./admin-action-log\";\nimport type { CommitScope } from \"../components/write-lock\";\nimport { DEFAULT_ADMIN_ACTION_LABELS } from \"./admin-action-confirm-labels\";\n\n/**\n * The confirmation in front of an admin action, at the level the SERVER states\n * (docs/user-admin-harmonization.md §4.2):\n *\n * | level | what it asks | actions |\n * |---|---|---|\n * | `none` | nothing: it confirms at once and renders nothing | resend a mail, reactivate, the reviewer scope… |\n * | `acknowledge` | a tick under the consequence | force a password change, change a role, delete a group |\n * | `type_email` | the target's address, typed | deactivate, erase now, transfer |\n *\n * A GROUP (round 0.34, §11.8) is a target at `none` and `acknowledge` only, said by its\n * name: it has no address to type, and no level table gives a group's action\n * `type_email` (server-kit's `require_confirmation` raises for one). The props' types\n * say so. Deleting one (`group_delete`) is `acknowledge` — a tick under the app's own\n * sentence of what goes with it, Kurvenschmiede's \"3 members, 2 grants and 1 invitation\n * go with it\" (decision 5): the cascade is what nobody can see afterwards.\n *\n * keksdose decides the level per action and per account on the server\n * (`admin_user_actions_service`) and Kurvenschmiede asks for the typed address on its\n * two hard-to-undo actions; both drew the dialog by hand beside the kit's `DangerConfirm`\n * and `useConfirm`. The level is a PROP, never derived here: the server enforces it and\n * a hand-written request never sees this dialog, so a page that guessed its own level\n * could only disagree with the server. The comparison (caseless), the field and the tick\n * are `DangerConfirm`'s (`TypedConfirmField`, the `dangerConfirm` words), so the three\n * confirmations in the kit cannot disagree about what counts as the address.\n *\n * WHY TYPE THE TARGET'S ADDRESS and not the admin's password: the admin proved who they\n * are at the admin gate. What is unproven is which ROW they are on (keksdose's\n * `TYPE_EMAIL` rule, Kurvenschmiede's `TypedConfirm`).\n *\n * THE REFUSALS (§4.1, §9.6) are read by code — `authErrorCode`, which knows the account\n * codes beside the sign-in ones — and stay in the dialog, which stays open so the admin\n * can read them: `last_admin`, `self_action`, `confirmation_mismatch`, and kastlan's\n * `other_companies` — with \"Remove from company\" offered in its place when the app passes\n * `onRemoveFromCompany`. Anything else is `describeError`'s words, else \"That didn't work\".\n * At level `none` nothing is drawn while the action runs; a refusal opens a dialog of its\n * own to say it.\n *\n * It never sends a request: `onConfirm` does, with what the guards were answered with.\n */\n\n/** How much confirmation an action needs — the server's `confirmation_level(action)`. */\nexport type AdminConfirmLevel = \"none\" | \"acknowledge\" | \"type_email\";\n\n/** What {@link AdminActionConfirmProps.onConfirm} receives — the guards' answers, for\n * the request body (the server re-checks both). */\nexport interface AdminActionConfirmValues {\n /** `type_email`: the address as typed — trimmed, its case the admin's; the body's\n * `confirm_email`, which the server compares with the account's (server-kit's\n * `confirm_email_matches`). */\n confirmEmail?: string;\n /** `acknowledge` and `type_email`: the action was confirmed past a guard — the body's\n * `acknowledged`, which every admin action carries (server-kit 0.4). */\n acknowledged?: true;\n}\n\n/** The account the action is about. A group is an {@link AdminGroupTarget}. */\nexport type AdminActionTarget = AdminPerson & { email: string };\n\n/** The `adminAction` namespace. The tick, the typed field and their held-button reasons\n * are the `dangerConfirm` namespace's, shared with `DangerConfirm`. */\nexport interface AdminActionLabels {\n /** The confirm button when the action names none. */\n confirm: string;\n cancel: string;\n /** The refusal dialog's only button (level `none`). */\n close: string;\n /** `409 last_admin`. */\n lastAdmin: string;\n /** `409 self_action`: the admin's own account. */\n self: string;\n /** `confirmation_mismatch`: the typed address is not this account's — the page and\n * the server disagree about which row this is. */\n confirmationMismatch: string;\n /** kastlan's `409 other_companies` (§9.6). */\n otherCompanies: string;\n /** The alternative offered with it. */\n removeFromCompany: string;\n /** Any other failure, unless `describeError` says better. */\n failed: string;\n}\n\n// Defined in ./admin-action-confirm-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_ADMIN_ACTION_LABELS };\n\n/** What the action is about, and the level the server states for it. A union, so a group\n * can't be given `type_email` (§11.8). */\ntype AdminActionConfirmTarget =\n | {\n /** The level the server states for this action on this account (§4.2). */\n level: AdminConfirmLevel;\n /** Whom it is about: the address (typed at `type_email`) and the name parts. */\n target: AdminActionTarget;\n }\n | {\n /** A group's action: `none`, or `acknowledge` for `group_delete` (decision 5). */\n level: Exclude<AdminConfirmLevel, \"type_email\">;\n /** The group it is about, said by its name (0.34, §11.8). */\n target: AdminGroupTarget;\n };\n\n/** The props whatever the target. */\ninterface AdminActionConfirmCommonProps {\n /** The confirm button — \"Deactivate\". Also the title when no `title` is given. */\n confirmLabel?: ReactNode;\n /** The dialog's heading — \"Deactivate Ada Example?\". Default `confirmLabel`. */\n title?: ReactNode;\n /**\n * What the action does to THIS account, said before it happens: a sentence, or lines\n * (`DangerConsequence`, a `severe` one in the danger colour). Derive them from the\n * row's facts rather than reciting the worst case (keksdose dev#488).\n */\n consequence?: ReactNode | readonly (string | DangerConsequence)[];\n /** The tick's words at `acknowledge`. Default `dangerConfirm.acknowledge` — \"I have\n * read what this does and want to continue.\" */\n acknowledgeLabel?: ReactNode;\n /** `danger` (default at `type_email`): a red confirm. `warning` (default at\n * `acknowledge`) and `neutral`: the primary confirm. */\n tone?: \"danger\" | \"warning\" | \"neutral\";\n /**\n * Runs the action. Return a promise and the dialog manages itself: busy until it\n * settles, closed (`onClose(true)`) when it resolves, open with the refusal when it\n * rejects. Return nothing and the app owns the rest — `busy`, `error`, closing it.\n */\n onConfirm: (values: AdminActionConfirmValues) => MaybePromise;\n /** The dialog has closed: `true` after the action (or the alternative) went through,\n * `false` for Cancel, Escape, the backdrop or Back. */\n onClose: (done: boolean) => void;\n /** kastlan: offered with an `other_companies` refusal — `DELETE …/membership`,\n * logged as `membership_remove` (§4.1). Promise handling as `onConfirm`. */\n onRemoveFromCompany?: () => MaybePromise;\n /** The app's words for a failure the kit has no code for. Asked first. */\n describeError?: (error: unknown) => ReactNode | undefined;\n /** A refusal the app caught itself, when `onConfirm` returns nothing. */\n error?: unknown;\n /** The action is running, for an app that tracks it itself. */\n busy?: boolean;\n /**\n * Fields of the action's own, above the guard — the transfer's recipient, kastlan's\n * roles (`RolesEditor`). Their values are the app's; hold the confirm with\n * `confirmDisabledReason` until they are complete.\n */\n children?: ReactNode;\n /** Why the confirm is held for a reason of the app's (\"Choose who receives it\").\n * Named before the guard's own, since the fields are above it. */\n confirmDisabledReason?: ReactNode;\n /** Kept-mounted mode, as on `DialogFrame`; left out, open while mounted. */\n open?: boolean;\n /** The confirm COMMITS: under a locked `WriteLockProvider` it is held with the lock's\n * reason. Off by default — an admin action is not a write to the open record. */\n commit?: CommitScope;\n labels?: LabelOverride<AdminActionLabels>;\n}\n\n/** A type since 0.34 (an interface before): a person at any level, or a group at `none`\n * and `acknowledge`. */\nexport type AdminActionConfirmProps = AdminActionConfirmCommonProps & AdminActionConfirmTarget;\n\n/** The refusal's words and code. */\nfunction refusalOf(\n error: unknown,\n present: boolean,\n describeError: AdminActionConfirmProps[\"describeError\"],\n labels: AdminActionLabels,\n): { text: ReactNode; code: KitErrorCode | undefined } | null {\n if (!present) return null;\n const code = authErrorCode(error);\n const own = describeError?.(error);\n if (hasContent(own)) return { text: own, code };\n const text =\n code === \"last_admin\"\n ? labels.lastAdmin\n : code === \"self_action\"\n ? labels.self\n : code === \"confirmation_mismatch\"\n ? labels.confirmationMismatch\n : code === \"other_companies\"\n ? labels.otherCompanies\n : labels.failed;\n return { text, code };\n}\n\n/** The selector for the first field among the caller's `children` — what opening focuses. */\nconst FIELD =\n 'input:not([type=\"hidden\"]):not(:disabled), select:not(:disabled), textarea:not(:disabled), [role=\"combobox\"]';\n\nexport function AdminActionConfirm({\n level,\n target,\n confirmLabel,\n title,\n consequence,\n acknowledgeLabel,\n tone: toneProp,\n onConfirm,\n onClose,\n onRemoveFromCompany,\n describeError,\n error: errorProp,\n busy: busyProp,\n children,\n confirmDisabledReason,\n open,\n commit,\n labels: labelsProp,\n}: AdminActionConfirmProps) {\n const labels = useKitLabels(\"adminAction\", DEFAULT_ADMIN_ACTION_LABELS, labelsProp);\n const guardLabels = useKitLabels(\"dangerConfirm\", DEFAULT_DANGER_CONFIRM_LABELS);\n const nameOf = usePersonLabel();\n const isOpen = open ?? true;\n const [typed, setTyped] = useState(\"\");\n const [ticked, setTicked] = useState(false);\n const [pending, setPending] = useState(false);\n // The last rejection, boxed so a rejection with `undefined` still counts as one.\n const [failure, setFailure] = useState<{ error: unknown } | null>(null);\n // Resolved: the actions row lowers the panel, and `onClose` answers true.\n const [done, setDone] = useState(false);\n const confirmed = useRef(false);\n const mounted = useRef(true);\n const started = useRef(false);\n const formId = useId();\n const slotRef = useRef<HTMLDivElement>(null);\n const guardRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n // A close (kept-mounted) wipes the guards and the refusal: a reopened dialog starts\n // over. During render, like ReauthDialog's, so no frame shows the old answers.\n const [wasOpen, setWasOpen] = useState(isOpen);\n if (wasOpen !== isOpen) {\n setWasOpen(isOpen);\n if (!isOpen) {\n setTyped(\"\");\n setTicked(false);\n setFailure(null);\n setDone(false);\n }\n }\n\n const busy = Boolean(busyProp) || pending;\n\n /** Runs `call`, managing busy, the refusal and the close — or not, when it answers\n * no promise (the app owns it then). */\n const perform = (call: () => MaybePromise) => {\n let result: MaybePromise;\n try {\n result = call();\n } catch (caught) {\n setFailure({ error: caught });\n return;\n }\n if (!isThenable(result)) return;\n setFailure(null);\n setPending(true);\n result.then(\n () => {\n if (!mounted.current) return;\n setPending(false);\n confirmed.current = true;\n setDone(true);\n },\n (caught: unknown) => {\n if (!mounted.current) return;\n setPending(false);\n setFailure({ error: caught });\n },\n );\n };\n\n // Level `none`: confirmed the moment it opens, once per opening. Nothing is drawn\n // while it runs; the promise's answer comes back asynchronously.\n useEffect(() => {\n if (level !== \"none\") return;\n if (!isOpen) {\n started.current = false;\n return;\n }\n if (started.current) return;\n started.current = true;\n confirmed.current = false;\n let result: unknown;\n try {\n result = onConfirm({});\n } catch (caught) {\n result = Promise.reject(caught);\n }\n // No promise: the app owns the rest (it closes the part, or passes `error`).\n if (!isThenable(result)) return;\n result.then(\n () => {\n if (mounted.current) onClose(true);\n },\n (caught: unknown) => {\n if (mounted.current) setFailure({ error: caught });\n },\n );\n }, [level, isOpen, onConfirm, onClose]);\n\n // Focus the first thing the dialog waits for, after Modal's own effect has recorded\n // the trigger to return to (a parent's effects run after its children's).\n useEffect(() => {\n if (!isOpen || level === \"none\") return;\n const field = slotRef.current?.querySelector<HTMLElement>(FIELD) ?? guardRef.current;\n field?.focus();\n }, [isOpen, level]);\n\n const hasRefusal = failure !== null || errorProp !== undefined;\n const refusal = refusalOf(failure ? failure.error : errorProp, hasRefusal, describeError, labels);\n const offerRemoval = refusal?.code === \"other_companies\" && onRemoveFromCompany !== undefined;\n\n // A group has no address: it is said by its name, and nothing is typed for it — not\n // even when a caller outside the types passes `type_email` (the server refuses that).\n const group = isGroupTarget(target);\n const email = group ? \"\" : target.email;\n const name = group ? (target.name ?? \"\").trim() : nameOf(target);\n const said = !name || name === email ? email : email ? `${name} · ${email}` : name;\n const identity = <span data-private>{said}</span>;\n const heading = title ?? confirmLabel ?? labels.confirm;\n\n const refusalBanner = refusal && (\n <AlertBanner\n tone=\"danger\"\n size=\"sm\"\n action={\n offerRemoval ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"secondary\"\n disabled={busy}\n onClick={() => perform(() => onRemoveFromCompany!())}\n >\n {labels.removeFromCompany}\n </Button>\n ) : undefined\n }\n >\n {refusal.text}\n </AlertBanner>\n );\n\n if (level === \"none\") {\n // Nothing to ask: only a refusal is worth a dialog.\n if (!isOpen || !refusal) return null;\n return (\n <DialogFrame\n role=\"alertdialog\"\n title={heading}\n description={identity}\n onClose={() => onClose(confirmed.current)}\n // The removal offered with the refusal is a request too.\n busy={busy}\n actions={(close) => (\n <CloseOnDone done={done}>\n <Button type=\"button\" variant=\"secondary\" disabled={busy} onClick={close}>\n {labels.close}\n </Button>\n </CloseOnDone>\n )}\n >\n {refusalBanner}\n </DialogFrame>\n );\n }\n\n const tone = toneProp ?? (level === \"type_email\" ? \"danger\" : \"warning\");\n const askTyped = level === \"type_email\" && !group;\n const typedOk = !askTyped || typedMatches(typed, email, \"caseless\");\n const tickOk = askTyped || ticked;\n const guardReason: ReactNode = hasContent(confirmDisabledReason)\n ? confirmDisabledReason\n : !tickOk\n ? guardLabels.needsAcknowledge\n : !typedOk\n ? typeof guardLabels.needsPhrase === \"function\"\n ? guardLabels.needsPhrase(email)\n : guardLabels.needsPhrase\n : undefined;\n\n const submit = () => {\n if (busy || guardReason !== undefined) return;\n perform(() => onConfirm(askTyped ? { confirmEmail: typed.trim(), acknowledged: true } : { acknowledged: true }));\n };\n\n const lines = Array.isArray(consequence)\n ? (consequence as readonly (string | DangerConsequence)[]).map((item, index) =>\n typeof item === \"string\"\n ? { key: item, text: item as ReactNode, severe: false }\n : { key: item.key ?? String(index), text: item.text, severe: Boolean(item.severe) },\n )\n : null;\n\n return (\n <DialogFrame\n open={open}\n role=\"alertdialog\"\n title={heading}\n description={identity}\n onClose={() => onClose(confirmed.current)}\n // A request that has left cannot be called back by closing the dialog.\n busy={busy}\n actions={(close) => (\n <CloseOnDone done={done}>\n <Button type=\"button\" variant=\"ghost\" disabled={busy} onClick={close}>\n {labels.cancel}\n </Button>\n <Button\n type=\"submit\"\n form={formId}\n variant={tone === \"danger\" ? \"danger\" : \"default\"}\n pending={busy}\n commit={commit}\n disabledReason={busy ? undefined : guardReason}\n >\n {confirmLabel ?? labels.confirm}\n </Button>\n </CloseOnDone>\n )}\n >\n <form\n id={formId}\n noValidate\n className=\"space-y-3\"\n onSubmit={(event) => {\n event.preventDefault();\n submit();\n }}\n >\n {lines ? (\n <ul className=\"list-disc space-y-1 ps-5 text-sm text-secondary\">\n {lines.map((line) => (\n <li key={line.key} className={line.severe ? \"text-danger\" : undefined}>\n {line.text}\n </li>\n ))}\n </ul>\n ) : (\n hasContent(consequence as ReactNode) && <p className=\"text-sm text-secondary\">{consequence as ReactNode}</p>\n )}\n {Children.toArray(children).some(hasContent) && (\n <div ref={slotRef} className=\"space-y-3\">\n {children}\n </div>\n )}\n {askTyped ? (\n <TypedConfirmField\n ref={guardRef}\n target={email}\n match=\"caseless\"\n value={typed}\n onValueChange={setTyped}\n busy={busy}\n data-private\n />\n ) : (\n <Checkbox\n ref={guardRef}\n label={acknowledgeLabel ?? guardLabels.acknowledge}\n checked={ticked}\n // Not `disabled` while busy: the box may hold the focus.\n onCheckedChange={(next) => {\n if (!busy) setTicked(next);\n }}\n />\n )}\n {refusalBanner}\n </form>\n </DialogFrame>\n );\n}\n\n/**\n * The actions row's wrapper: it renders INSIDE the Modal, where the panel's animated\n * close is in context, so a resolved action lowers the panel the way Cancel does and\n * Modal then calls `onClose` (ReauthDialog's pattern).\n */\nfunction CloseOnDone({ done, children }: { done: boolean; children: ReactNode }) {\n const close = useContext(ModalCloseContext);\n useEffect(() => {\n if (done) close?.();\n }, [done, close]);\n return <>{children}</>;\n}\n"],"mappings":";AAsVmB,SAqKV,UArKU,KAsFX,YAtFW;AAtVnB,SAAS,UAAU,YAAY,WAAW,OAAO,QAAQ,gBAAgB;AAEzE,SAAS,oBAAwC;AACjD,SAAS,mBAAmB;AAC5B,SAAS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AAiB,CAAC,SAAS;AACzB,sBAAI,CAAC,KAAM,WAAU,IAAI;AAAA,gBAC3B;AAAA;AAAA,YACF;AAAA,YAED;AAAA;AAAA;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;AAOA,SAAS,YAAY,EAAE,MAAM,SAAS,GAA2C;AAC/E,QAAM,QAAQ,WAAW,iBAAiB;AAC1C,YAAU,MAAM;AACd,QAAI,KAAM,SAAQ;AAAA,EACpB,GAAG,CAAC,MAAM,KAAK,CAAC;AAChB,SAAO,gCAAG,UAAS;AACrB;","names":[]}
@@ -33,8 +33,11 @@ export declare function usePersonLabel(localeProp?: string): (person: AdminPerso
33
33
  /**
34
34
  * A day as words in a sentence ("6 Nov 2026"): the provider's `formatDate` when the app
35
35
  * set one (keksdose K12), asked for no weekday — a date in a sentence carries none — else
36
- * `Intl`'s medium date. `""` for no date.
36
+ * `Intl`'s medium date, in the provider's locale and `timeZone` (0.52: the kit's one day
37
+ * ladder, `useDayFormatter` — refactor audit 2026-10-30, DUP-2). `""` for no date or one
38
+ * that does not parse: the caller leaves the sentence out.
37
39
  */
38
40
  export declare function useDayText(localeProp?: string): (value: DateInput) => string;
39
- /** Call a callback that may throw or answer a promise, as a promise. */
40
- export declare function settle<T>(call: () => MaybePromise<T>): Promise<T | void>;
41
+ /** Call a callback that may throw or answer a promise, as a promise — the kit's one
42
+ * (hooks/use-mounted), not a copy of it (0.52 code review, this file). */
43
+ export { settle } from "../hooks/use-mounted.js";