@eifi1/ui-kit 0.48.2 → 0.50.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 (377) hide show
  1. package/README.md +34 -16
  2. package/dist/admin/admin-action-confirm.js +1 -1
  3. package/dist/admin/admin-action-confirm.js.map +1 -1
  4. package/dist/admin/invitations-panel.js +5 -1
  5. package/dist/admin/invitations-panel.js.map +1 -1
  6. package/dist/admin/user-roster.d.ts +24 -12
  7. package/dist/admin/user-roster.js +21 -6
  8. package/dist/admin/user-roster.js.map +1 -1
  9. package/dist/auth/accept-invitation.js +2 -2
  10. package/dist/auth/accept-invitation.js.map +1 -1
  11. package/dist/auth/not-found-page.js +1 -1
  12. package/dist/auth/not-found-page.js.map +1 -1
  13. package/dist/auth/reset-password-form.js +2 -2
  14. package/dist/auth/reset-password-form.js.map +1 -1
  15. package/dist/auth/verify-email.d.ts +9 -1
  16. package/dist/auth/verify-email.js +5 -3
  17. package/dist/auth/verify-email.js.map +1 -1
  18. package/dist/billing/plan-card.js +2 -2
  19. package/dist/billing/plan-card.js.map +1 -1
  20. package/dist/components/amount-input.d.ts +2 -1
  21. package/dist/components/amount-input.js +3 -2
  22. package/dist/components/amount-input.js.map +1 -1
  23. package/dist/components/autocomplete.js +1 -0
  24. package/dist/components/autocomplete.js.map +1 -1
  25. package/dist/components/breadcrumbs.d.ts +19 -1
  26. package/dist/components/breadcrumbs.js +11 -4
  27. package/dist/components/breadcrumbs.js.map +1 -1
  28. package/dist/components/button-look.d.ts +37 -7
  29. package/dist/components/button-look.js +33 -6
  30. package/dist/components/button-look.js.map +1 -1
  31. package/dist/components/button.d.ts +4 -1
  32. package/dist/components/button.js +2 -2
  33. package/dist/components/button.js.map +1 -1
  34. package/dist/components/calendar-heatmap.js +2 -1
  35. package/dist/components/calendar-heatmap.js.map +1 -1
  36. package/dist/components/chart-edge.d.ts +10 -0
  37. package/dist/components/chart-edge.js +57 -0
  38. package/dist/components/chart-edge.js.map +1 -0
  39. package/dist/components/chart.js +2 -1
  40. package/dist/components/chart.js.map +1 -1
  41. package/dist/components/chip.d.ts +8 -1
  42. package/dist/components/chip.js +4 -1
  43. package/dist/components/chip.js.map +1 -1
  44. package/dist/components/combobox-core.js +1 -0
  45. package/dist/components/combobox-core.js.map +1 -1
  46. package/dist/components/combobox-suggestions.js +1 -0
  47. package/dist/components/combobox-suggestions.js.map +1 -1
  48. package/dist/components/confirm-context.d.ts +5 -0
  49. package/dist/components/confirm-context.js +7 -0
  50. package/dist/components/confirm-context.js.map +1 -0
  51. package/dist/components/confirm-dialog.js +3 -3
  52. package/dist/components/confirm-dialog.js.map +1 -1
  53. package/dist/components/currency-select.d.ts +28 -2
  54. package/dist/components/currency-select.js +56 -10
  55. package/dist/components/currency-select.js.map +1 -1
  56. package/dist/components/danger-confirm.d.ts +2 -2
  57. package/dist/components/danger-confirm.js +1 -1
  58. package/dist/components/danger-confirm.js.map +1 -1
  59. package/dist/components/data-table-fit.js +21 -3
  60. package/dist/components/data-table-fit.js.map +1 -1
  61. package/dist/components/data-table-mobile.d.ts +58 -3
  62. package/dist/components/data-table-mobile.js +147 -16
  63. package/dist/components/data-table-mobile.js.map +1 -1
  64. package/dist/components/data-table-row-actions.d.ts +2 -1
  65. package/dist/components/data-table-row-actions.js +7 -0
  66. package/dist/components/data-table-row-actions.js.map +1 -1
  67. package/dist/components/data-table-row.d.ts +1 -1
  68. package/dist/components/data-table-row.js.map +1 -1
  69. package/dist/components/data-table.d.ts +34 -1
  70. package/dist/components/data-table.js +37 -10
  71. package/dist/components/data-table.js.map +1 -1
  72. package/dist/components/dropdown.js +1 -0
  73. package/dist/components/dropdown.js.map +1 -1
  74. package/dist/components/error-boundary.js +2 -2
  75. package/dist/components/error-boundary.js.map +1 -1
  76. package/dist/components/floating-panel.d.ts +36 -13
  77. package/dist/components/floating-panel.js +27 -7
  78. package/dist/components/floating-panel.js.map +1 -1
  79. package/dist/components/form-actions.d.ts +1 -1
  80. package/dist/components/form-actions.js +1 -1
  81. package/dist/components/form-actions.js.map +1 -1
  82. package/dist/components/full-bleed-dialog.js +1 -0
  83. package/dist/components/full-bleed-dialog.js.map +1 -1
  84. package/dist/components/icon-button.d.ts +11 -0
  85. package/dist/components/icon-button.js +7 -5
  86. package/dist/components/icon-button.js.map +1 -1
  87. package/dist/components/modal.js +1 -0
  88. package/dist/components/modal.js.map +1 -1
  89. package/dist/components/nav-pills.d.ts +8 -1
  90. package/dist/components/nav-pills.js +61 -38
  91. package/dist/components/nav-pills.js.map +1 -1
  92. package/dist/components/number-input.d.ts +2 -1
  93. package/dist/components/number-input.js +6 -2
  94. package/dist/components/number-input.js.map +1 -1
  95. package/dist/components/numpad-sheet.js +2 -0
  96. package/dist/components/numpad-sheet.js.map +1 -1
  97. package/dist/components/page-header-context.d.ts +8 -0
  98. package/dist/components/page-header-context.js +7 -0
  99. package/dist/components/page-header-context.js.map +1 -0
  100. package/dist/components/page-header.d.ts +14 -2
  101. package/dist/components/page-header.js +10 -1
  102. package/dist/components/page-header.js.map +1 -1
  103. package/dist/components/picker-sheet.js +2 -0
  104. package/dist/components/picker-sheet.js.map +1 -1
  105. package/dist/components/pie-chart.js +2 -1
  106. package/dist/components/pie-chart.js.map +1 -1
  107. package/dist/components/popover.js +1 -0
  108. package/dist/components/popover.js.map +1 -1
  109. package/dist/components/progress-bar.js +5 -4
  110. package/dist/components/progress-bar.js.map +1 -1
  111. package/dist/components/reauth-dialog.js +1 -1
  112. package/dist/components/reauth-dialog.js.map +1 -1
  113. package/dist/components/row-actions-labels.js +3 -1
  114. package/dist/components/row-actions-labels.js.map +1 -1
  115. package/dist/components/row-actions.d.ts +43 -9
  116. package/dist/components/row-actions.js +78 -15
  117. package/dist/components/row-actions.js.map +1 -1
  118. package/dist/components/section-nav.d.ts +37 -0
  119. package/dist/components/section-nav.js +33 -0
  120. package/dist/components/section-nav.js.map +1 -0
  121. package/dist/components/series-chart.js +8 -3
  122. package/dist/components/series-chart.js.map +1 -1
  123. package/dist/components/share-card.js +1 -1
  124. package/dist/components/share-card.js.map +1 -1
  125. package/dist/components/signature-pad.js +1 -1
  126. package/dist/components/signature-pad.js.map +1 -1
  127. package/dist/components/sparkline.js +2 -1
  128. package/dist/components/sparkline.js.map +1 -1
  129. package/dist/components/stat-tile.js +14 -7
  130. package/dist/components/stat-tile.js.map +1 -1
  131. package/dist/components/status-dot.d.ts +5 -1
  132. package/dist/components/status-dot.js +4 -1
  133. package/dist/components/status-dot.js.map +1 -1
  134. package/dist/components/tooltip.js +1 -1
  135. package/dist/components/tooltip.js.map +1 -1
  136. package/dist/components/translation-review-editor.js +2 -2
  137. package/dist/components/translation-review-editor.js.map +1 -1
  138. package/dist/components/translation-review.js +2 -2
  139. package/dist/components/translation-review.js.map +1 -1
  140. package/dist/components/treemap.d.ts +5 -2
  141. package/dist/components/treemap.js +26 -6
  142. package/dist/components/treemap.js.map +1 -1
  143. package/dist/components/use-table-state.js +37 -6
  144. package/dist/components/use-table-state.js.map +1 -1
  145. package/dist/data-table.js.map +1 -1
  146. package/dist/demo/demo-banner.js +1 -1
  147. package/dist/demo/demo-banner.js.map +1 -1
  148. package/dist/demo/demo-ended.js +1 -1
  149. package/dist/demo/demo-ended.js.map +1 -1
  150. package/dist/demo/demo-start.js +1 -1
  151. package/dist/demo/demo-start.js.map +1 -1
  152. package/dist/eslint/index.js +1 -1
  153. package/dist/feedback/feedback-inbox.js +1 -1
  154. package/dist/feedback/feedback-inbox.js.map +1 -1
  155. package/dist/hooks/use-dismiss.d.ts +9 -1
  156. package/dist/hooks/use-dismiss.js +25 -5
  157. package/dist/hooks/use-dismiss.js.map +1 -1
  158. package/dist/hooks/use-document-title.d.ts +14 -0
  159. package/dist/hooks/use-document-title.js +22 -0
  160. package/dist/hooks/use-document-title.js.map +1 -0
  161. package/dist/i18n/defaults.js +2 -0
  162. package/dist/i18n/defaults.js.map +1 -1
  163. package/dist/i18n/german.js +20 -3
  164. package/dist/i18n/german.js.map +1 -1
  165. package/dist/i18n/kit-labels.d.ts +34 -1
  166. package/dist/i18n/kit-labels.js +43 -2
  167. package/dist/i18n/kit-labels.js.map +1 -1
  168. package/dist/i18n/locales/en.js +22 -3
  169. package/dist/i18n/locales/en.js.map +3 -3
  170. package/dist/i18n/locales/es.js +20 -3
  171. package/dist/i18n/locales/es.js.map +1 -1
  172. package/dist/i18n/locales/fr.js +20 -3
  173. package/dist/i18n/locales/fr.js.map +1 -1
  174. package/dist/i18n/locales/hu.js +20 -3
  175. package/dist/i18n/locales/hu.js.map +1 -1
  176. package/dist/i18n/locales/it.js +20 -3
  177. package/dist/i18n/locales/it.js.map +1 -1
  178. package/dist/i18n/locales/zh.js +20 -3
  179. package/dist/i18n/locales/zh.js.map +1 -1
  180. package/dist/i18n/review.js +3 -0
  181. package/dist/i18n/review.js.map +1 -1
  182. package/dist/i18n/shared-labels.js +1 -0
  183. package/dist/i18n/shared-labels.js.map +1 -1
  184. package/dist/index.d.ts +8 -1
  185. package/dist/index.js +11 -0
  186. package/dist/index.js.map +1 -1
  187. package/dist/landing/landing-actions.js +2 -2
  188. package/dist/landing/landing-actions.js.map +1 -1
  189. package/dist/landing/public-header.js +2 -2
  190. package/dist/landing/public-header.js.map +1 -1
  191. package/dist/lib/clipboard-minus.d.ts +27 -0
  192. package/dist/lib/clipboard-minus.js +63 -0
  193. package/dist/lib/clipboard-minus.js.map +1 -0
  194. package/dist/lib/data-attributes.d.ts +11 -0
  195. package/dist/lib/data-attributes.js +10 -0
  196. package/dist/lib/data-attributes.js.map +1 -0
  197. package/dist/lib/document-title.d.ts +17 -0
  198. package/dist/lib/document-title.js +29 -0
  199. package/dist/lib/document-title.js.map +1 -0
  200. package/dist/lib/float-clearance.js +8 -2
  201. package/dist/lib/float-clearance.js.map +1 -1
  202. package/dist/lib/format.d.ts +36 -10
  203. package/dist/lib/format.js +57 -11
  204. package/dist/lib/format.js.map +1 -1
  205. package/dist/lib/minus.d.ts +32 -0
  206. package/dist/lib/minus.js +14 -0
  207. package/dist/lib/minus.js.map +1 -0
  208. package/dist/lib/status-tone.d.ts +30 -0
  209. package/dist/lib/status-tone.js +17 -0
  210. package/dist/lib/status-tone.js.map +1 -0
  211. package/dist/settings/settings-layout.js +3 -2
  212. package/dist/settings/settings-layout.js.map +1 -1
  213. package/dist/shell/account-menu-language.d.ts +1 -1
  214. package/dist/shell/account-menu-language.js +9 -1
  215. package/dist/shell/account-menu-language.js.map +1 -1
  216. package/dist/shell/app-shell-labels.js +2 -1
  217. package/dist/shell/app-shell-labels.js.map +1 -1
  218. package/dist/shell/app-shell.d.ts +58 -16
  219. package/dist/shell/app-shell.js +151 -43
  220. package/dist/shell/app-shell.js.map +1 -1
  221. package/dist/shell/language-code.d.ts +3 -0
  222. package/dist/shell/language-code.js +8 -0
  223. package/dist/shell/language-code.js.map +1 -0
  224. package/dist/shell/topbar-controls.d.ts +14 -6
  225. package/dist/shell/topbar-controls.js +14 -17
  226. package/dist/shell/topbar-controls.js.map +1 -1
  227. package/dist/testing/css-variables.generated.d.ts +1 -1
  228. package/dist/testing/css-variables.generated.js +1 -1
  229. package/dist/testing/css-variables.generated.js.map +1 -1
  230. package/dist/testing/react.d.ts +25 -0
  231. package/dist/testing/react.js +19 -0
  232. package/dist/testing/react.js.map +1 -0
  233. package/dist/theme/chart-palette.d.ts +82 -15
  234. package/dist/theme/chart-palette.js +51 -24
  235. package/dist/theme/chart-palette.js.map +1 -1
  236. package/dist/theme/palette-presets.d.ts +9 -0
  237. package/dist/theme/palette-presets.js +77 -62
  238. package/dist/theme/palette-presets.js.map +1 -1
  239. package/dist/tour/tour-dock.d.ts +42 -0
  240. package/dist/tour/tour-dock.js +80 -0
  241. package/dist/tour/tour-dock.js.map +1 -0
  242. package/dist/tour/tour-gates.d.ts +71 -0
  243. package/dist/tour/tour-gates.js +114 -0
  244. package/dist/tour/tour-gates.js.map +1 -0
  245. package/dist/tour/tour-guide-button.d.ts +27 -0
  246. package/dist/tour/tour-guide-button.js +45 -0
  247. package/dist/tour/tour-guide-button.js.map +1 -0
  248. package/dist/tour/tour-guide-labels.d.ts +8 -0
  249. package/dist/tour/tour-guide-labels.js +9 -0
  250. package/dist/tour/tour-guide-labels.js.map +1 -0
  251. package/dist/tour/tour-labels.js +9 -1
  252. package/dist/tour/tour-labels.js.map +1 -1
  253. package/dist/tour/tour.d.ts +133 -9
  254. package/dist/tour/tour.js +594 -70
  255. package/dist/tour/tour.js.map +1 -1
  256. package/dist/tour/use-tour-url-sync.d.ts +5 -2
  257. package/dist/tour/use-tour-url-sync.js +7 -1
  258. package/dist/tour/use-tour-url-sync.js.map +1 -1
  259. package/dist/tour.d.ts +2 -0
  260. package/dist/tour.js +3 -0
  261. package/dist/tour.js.map +1 -1
  262. package/dist/wizard/stepper-nav.d.ts +1 -1
  263. package/dist/wizard/stepper-nav.js +18 -5
  264. package/dist/wizard/stepper-nav.js.map +1 -1
  265. package/dist/wizard/types.d.ts +11 -0
  266. package/dist/wizard/types.js.map +1 -1
  267. package/dist/wizard/use-wizard.js +11 -5
  268. package/dist/wizard/use-wizard.js.map +1 -1
  269. package/package.json +9 -1
  270. package/src/admin/admin-action-confirm.tsx +1 -1
  271. package/src/admin/invitations-panel.tsx +7 -3
  272. package/src/admin/user-roster.tsx +41 -14
  273. package/src/auth/accept-invitation.tsx +3 -3
  274. package/src/auth/not-found-page.tsx +1 -1
  275. package/src/auth/reset-password-form.tsx +3 -3
  276. package/src/auth/verify-email.tsx +13 -3
  277. package/src/billing/plan-card.tsx +2 -2
  278. package/src/components/amount-input.tsx +5 -4
  279. package/src/components/autocomplete.tsx +2 -0
  280. package/src/components/breadcrumbs.tsx +32 -4
  281. package/src/components/button-look.ts +86 -15
  282. package/src/components/button.tsx +6 -3
  283. package/src/components/calendar-heatmap.tsx +2 -1
  284. package/src/components/chart-edge.ts +73 -0
  285. package/src/components/chart.tsx +3 -1
  286. package/src/components/chip.tsx +10 -1
  287. package/src/components/combobox-core.tsx +2 -0
  288. package/src/components/combobox-suggestions.tsx +2 -0
  289. package/src/components/confirm-context.ts +7 -0
  290. package/src/components/confirm-dialog.tsx +3 -3
  291. package/src/components/currency-select.tsx +95 -6
  292. package/src/components/danger-confirm.tsx +3 -3
  293. package/src/components/data-table-fit.ts +41 -6
  294. package/src/components/data-table-mobile.tsx +259 -17
  295. package/src/components/data-table-row-actions.tsx +9 -1
  296. package/src/components/data-table-row.tsx +3 -0
  297. package/src/components/data-table.tsx +91 -19
  298. package/src/components/dropdown.tsx +2 -0
  299. package/src/components/error-boundary.tsx +2 -2
  300. package/src/components/floating-panel.tsx +67 -16
  301. package/src/components/form-actions.tsx +2 -2
  302. package/src/components/full-bleed-dialog.tsx +3 -0
  303. package/src/components/icon-button.tsx +21 -8
  304. package/src/components/modal.tsx +3 -0
  305. package/src/components/nav-pills.tsx +29 -2
  306. package/src/components/number-input.tsx +8 -3
  307. package/src/components/numpad-sheet.tsx +4 -0
  308. package/src/components/page-header-context.ts +8 -0
  309. package/src/components/page-header.tsx +34 -2
  310. package/src/components/picker-sheet.tsx +4 -0
  311. package/src/components/pie-chart.tsx +2 -1
  312. package/src/components/popover.tsx +2 -0
  313. package/src/components/progress-bar.tsx +6 -3
  314. package/src/components/reauth-dialog.tsx +1 -1
  315. package/src/components/row-actions-labels.ts +2 -0
  316. package/src/components/row-actions.tsx +154 -33
  317. package/src/components/section-nav.tsx +65 -0
  318. package/src/components/series-chart.tsx +12 -3
  319. package/src/components/share-card.tsx +1 -1
  320. package/src/components/signature-pad.tsx +1 -1
  321. package/src/components/sparkline.tsx +2 -1
  322. package/src/components/stat-tile.tsx +19 -7
  323. package/src/components/status-dot.tsx +7 -1
  324. package/src/components/tooltip.tsx +3 -1
  325. package/src/components/translation-review-editor.tsx +2 -2
  326. package/src/components/translation-review.tsx +2 -2
  327. package/src/components/treemap.tsx +34 -8
  328. package/src/components/use-table-state.ts +63 -8
  329. package/src/data-table.ts +3 -3
  330. package/src/demo/demo-banner.tsx +1 -1
  331. package/src/demo/demo-ended.tsx +1 -1
  332. package/src/demo/demo-start.tsx +1 -1
  333. package/src/feedback/feedback-inbox.tsx +1 -1
  334. package/src/hooks/use-dismiss.ts +43 -4
  335. package/src/hooks/use-document-title.ts +31 -0
  336. package/src/i18n/defaults.ts +2 -0
  337. package/src/i18n/german.ts +17 -0
  338. package/src/i18n/kit-labels.tsx +79 -1
  339. package/src/i18n/locales/es.ts +17 -0
  340. package/src/i18n/locales/fr.ts +17 -0
  341. package/src/i18n/locales/hu.ts +17 -0
  342. package/src/i18n/locales/it.ts +17 -0
  343. package/src/i18n/locales/zh.ts +17 -0
  344. package/src/i18n/review.ts +3 -0
  345. package/src/i18n/shared-labels.ts +1 -0
  346. package/src/index.ts +13 -0
  347. package/src/landing/landing-actions.tsx +2 -2
  348. package/src/landing/public-header.tsx +2 -2
  349. package/src/lib/clipboard-minus.ts +94 -0
  350. package/src/lib/data-attributes.ts +14 -0
  351. package/src/lib/document-title.ts +41 -0
  352. package/src/lib/float-clearance.ts +19 -3
  353. package/src/lib/format.ts +117 -30
  354. package/src/lib/minus.ts +50 -0
  355. package/src/lib/status-tone.ts +43 -0
  356. package/src/settings/settings-layout.tsx +3 -2
  357. package/src/shell/account-menu-language.tsx +14 -2
  358. package/src/shell/app-shell-labels.ts +1 -0
  359. package/src/shell/app-shell.tsx +291 -68
  360. package/src/shell/language-code.ts +5 -0
  361. package/src/shell/topbar-controls.tsx +35 -15
  362. package/src/testing/css-variables.generated.ts +6 -6
  363. package/src/testing/react.ts +59 -0
  364. package/src/theme/chart-palette.ts +102 -20
  365. package/src/theme/palette-presets.ts +121 -84
  366. package/src/tour/tour-dock.ts +132 -0
  367. package/src/tour/tour-gates.ts +195 -0
  368. package/src/tour/tour-guide-button.tsx +64 -0
  369. package/src/tour/tour-guide-labels.ts +15 -0
  370. package/src/tour/tour-labels.ts +8 -0
  371. package/src/tour/tour.tsx +949 -86
  372. package/src/tour/use-tour-url-sync.ts +14 -4
  373. package/src/tour.ts +3 -0
  374. package/src/wizard/stepper-nav.tsx +27 -7
  375. package/src/wizard/types.ts +12 -0
  376. package/src/wizard/use-wizard.ts +16 -9
  377. package/tokens.css +28 -18
@@ -34,6 +34,7 @@ function SuggestionList({
34
34
  "div",
35
35
  {
36
36
  ref: panelRef,
37
+ "data-kit-layer": "",
37
38
  className: "fixed z-50",
38
39
  dir,
39
40
  style: { ...above ? { bottom } : { top }, left: rect.left, width: rect.width },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/combobox-suggestions.tsx"],"sourcesContent":["// What the two TYPED comboboxes share — Combobox (free text) and InlineEntityCombobox\n// (an option id): the portalled suggestion list, the focus-open guard against a mouse's\n// back button, and the write lock's Enter. Moved out of combobox.tsx with the split of\n// InlineEntityCombobox into its own module (MOD-9, refactor audit 2026-10), so neither\n// imports the other. Internal: no name here is part of the package.\nimport { useRef } from \"react\";\nimport type { ReactNode, RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useAnchoredPanel } from \"../hooks/use-anchored-panel\";\nimport { useAnchorDir } from \"./use-anchor-dir\";\nimport { SUGGESTION_LIST_CLASS, suggestionRowClass } from \"./combobox-core\";\n\n// One look for both combobox flavors — the suggestion list and its rows\n// must stay pixel-identical between the free-text and the id-keyed variant (and\n// `Autocomplete`, which shares them from the core).\nconst LIST_CLASS = SUGGESTION_LIST_CLASS;\n\n/**\n * \"This focus came from a mouse button that is not the left one\" — for the two\n * fields (Combobox, InlineEntityCombobox), which open their list ON FOCUS.\n *\n * Keksdose live #309 rework: *\"When clicking the mouse back button now while hovering\n * one of the selects it opens the select as long as I am holding the button down and\n * closes select after releasing.\"* A mouse's BACK button focuses whatever it is\n * pressed over, exactly as the left one does — the browser only reserves the\n * NAVIGATION for itself — so a field that opens on focus opened a list for a gesture\n * that means \"go back\", and the release then navigated out from under it. Measured on\n * his own budget: `mousePressed button=back` over the transfer form's account field\n * left `aria-expanded=true`, and the release took the whole add card with it.\n *\n * The press is recorded and read by the focus that the SAME press causes: focus is\n * mousedown's default action, dispatched inside the same task, so the flag is always\n * read before the `setTimeout` below can drop it. And it is always dropped — a press\n * that focuses nothing (the pointer was over a disabled field, the button was\n * released elsewhere) must not leave a latch that swallows the next Tab.\n *\n * Only the OPEN is suppressed, never the navigation: Back still goes back, which is\n * the whole of what the button was pressed for.\n */\nexport function usePrimaryPressOnly() {\n const auxPress = useRef(false);\n return {\n onMouseDown: (e: { button: number }) => {\n if (e.button === 0) return;\n auxPress.current = true;\n setTimeout(() => {\n auxPress.current = false;\n }, 0);\n },\n /** True while handling the focus a non-primary press just caused. */\n fromAuxButton: () => auxPress.current,\n };\n}\n\n/**\n * The desktop suggestion list, PORTALLED and anchored to the field.\n *\n * It used to be an `absolute` `<ul>` inside the field's own wrapper, and that is\n * Keksdose live #295: *\"Category select inside the list is not readable. Some sort\n * of z indexes issue?\"*. It was not z-index — a stacking context can be out-ranked,\n * but `overflow` cannot be argued with. The receipt's line table sits in a card\n * carrying `overflow-clip`, so a list opened from the last visible row was cut off\n * at the card's edge: measured at 256px tall with 150px of it painted.\n *\n * Every other panel in this package already learned this — `DropdownPanel`'s\n * `anchorRef` form, the calculator popover, the tooltip — so this reuses the same\n * hook rather than inventing a second placement. What that buys beyond the clip:\n * the list flips above the field when there is no room below, and it caps its own\n * height against the VISIBLE viewport, which on a phone means the on-screen\n * keyboard (see {@link useAnchoredPanel}).\n *\n * `panelRef` is not optional plumbing. Portalled, the list is no longer a\n * descendant of the wrapper, so {@link useDropdown}'s outside-click test answers\n * \"outside\" for a click on the list itself — the first option a user picked would\n * close the dropdown having picked nothing.\n */\nexport function SuggestionList({\n id,\n anchorRef,\n panelRef,\n children,\n}: {\n /** What the field's `aria-controls` names. */\n id: string;\n anchorRef: RefObject<HTMLElement | null>;\n panelRef: RefObject<HTMLDivElement | null>;\n children: ReactNode;\n}) {\n const { rect, top, bottom, maxHeight, above } = useAnchoredPanel(anchorRef, true, { preferredHeight: 256 });\n const dir = useAnchorDir(anchorRef, true);\n if (!rect) return null;\n return createPortal(\n <div\n ref={panelRef}\n // z-50, not the old z-30: the list is a child of <body> now, so it is\n // competing with the app's own overlays rather than with its own siblings.\n className=\"fixed z-50\"\n // Portalled out of the form's `dir`; the field's is put back. The list is\n // exactly the field's width, so `left` places it in either direction.\n dir={dir}\n // Flipped above, the list hangs from its bottom edge: it filters as the user\n // types, and a short one placed by `top` floated above the field (keksdose K1).\n style={{ ...(above ? { bottom } : { top }), left: rect.left, width: rect.width }}\n >\n <ul id={id} role=\"listbox\" data-clips=\"\" className={LIST_CLASS} style={{ maxHeight }}>\n {children}\n </ul>\n </div>,\n document.body,\n );\n}\n\nexport const rowClass = suggestionRowClass;\n\n/**\n * The write lock on the two TYPED fields — {@link Button}'s `disabledReason`\n * path, for an input (keksdose G2).\n *\n * `readOnly` rather than `disabled`, as everywhere the kit locks a field: still focusable,\n * so the reason in the Tooltip reaches a keyboard; refusing keys, so nothing typed can\n * become a value; and FIELD_BASE paints a `[readonly]` field in the settled grey a\n * disabled one wears. No list opens, by focus, click, chevron or arrow — and Enter is\n * swallowed, so a locked field does not submit the form around it either (Select's\n * lock, `LOCKED_SELECT_KEYS`). Every other key is left alone: the arrows and Home/End\n * still move the caret through a long value someone is trying to read.\n */\nexport function lockedKeyDown(e: { key: string; preventDefault: () => void }) {\n if (e.key === \"Enter\") e.preventDefault();\n}\n"],"mappings":";AAwGM;AAnGN,SAAS,cAAc;AAEvB,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB,0BAA0B;AAK1D,MAAM,aAAa;AAwBZ,SAAS,sBAAsB;AACpC,QAAM,WAAW,OAAO,KAAK;AAC7B,SAAO;AAAA,IACL,aAAa,CAAC,MAA0B;AACtC,UAAI,EAAE,WAAW,EAAG;AACpB,eAAS,UAAU;AACnB,iBAAW,MAAM;AACf,iBAAS,UAAU;AAAA,MACrB,GAAG,CAAC;AAAA,IACN;AAAA;AAAA,IAEA,eAAe,MAAM,SAAS;AAAA,EAChC;AACF;AAwBO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,QAAM,EAAE,MAAM,KAAK,QAAQ,WAAW,MAAM,IAAI,iBAAiB,WAAW,MAAM,EAAE,iBAAiB,IAAI,CAAC;AAC1G,QAAM,MAAM,aAAa,WAAW,IAAI;AACxC,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO;AAAA,IACL;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QAGL,WAAU;AAAA,QAGV;AAAA,QAGA,OAAO,EAAE,GAAI,QAAQ,EAAE,OAAO,IAAI,EAAE,IAAI,GAAI,MAAM,KAAK,MAAM,OAAO,KAAK,MAAM;AAAA,QAE/E,8BAAC,QAAG,IAAQ,MAAK,WAAU,cAAW,IAAG,WAAW,YAAY,OAAO,EAAE,UAAU,GAChF,UACH;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;AAEO,MAAM,WAAW;AAcjB,SAAS,cAAc,GAAgD;AAC5E,MAAI,EAAE,QAAQ,QAAS,GAAE,eAAe;AAC1C;","names":[]}
1
+ {"version":3,"sources":["../../src/components/combobox-suggestions.tsx"],"sourcesContent":["// What the two TYPED comboboxes share — Combobox (free text) and InlineEntityCombobox\n// (an option id): the portalled suggestion list, the focus-open guard against a mouse's\n// back button, and the write lock's Enter. Moved out of combobox.tsx with the split of\n// InlineEntityCombobox into its own module (MOD-9, refactor audit 2026-10), so neither\n// imports the other. Internal: no name here is part of the package.\nimport { useRef } from \"react\";\nimport type { ReactNode, RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useAnchoredPanel } from \"../hooks/use-anchored-panel\";\nimport { useAnchorDir } from \"./use-anchor-dir\";\nimport { SUGGESTION_LIST_CLASS, suggestionRowClass } from \"./combobox-core\";\n\n// One look for both combobox flavors — the suggestion list and its rows\n// must stay pixel-identical between the free-text and the id-keyed variant (and\n// `Autocomplete`, which shares them from the core).\nconst LIST_CLASS = SUGGESTION_LIST_CLASS;\n\n/**\n * \"This focus came from a mouse button that is not the left one\" — for the two\n * fields (Combobox, InlineEntityCombobox), which open their list ON FOCUS.\n *\n * Keksdose live #309 rework: *\"When clicking the mouse back button now while hovering\n * one of the selects it opens the select as long as I am holding the button down and\n * closes select after releasing.\"* A mouse's BACK button focuses whatever it is\n * pressed over, exactly as the left one does — the browser only reserves the\n * NAVIGATION for itself — so a field that opens on focus opened a list for a gesture\n * that means \"go back\", and the release then navigated out from under it. Measured on\n * his own budget: `mousePressed button=back` over the transfer form's account field\n * left `aria-expanded=true`, and the release took the whole add card with it.\n *\n * The press is recorded and read by the focus that the SAME press causes: focus is\n * mousedown's default action, dispatched inside the same task, so the flag is always\n * read before the `setTimeout` below can drop it. And it is always dropped — a press\n * that focuses nothing (the pointer was over a disabled field, the button was\n * released elsewhere) must not leave a latch that swallows the next Tab.\n *\n * Only the OPEN is suppressed, never the navigation: Back still goes back, which is\n * the whole of what the button was pressed for.\n */\nexport function usePrimaryPressOnly() {\n const auxPress = useRef(false);\n return {\n onMouseDown: (e: { button: number }) => {\n if (e.button === 0) return;\n auxPress.current = true;\n setTimeout(() => {\n auxPress.current = false;\n }, 0);\n },\n /** True while handling the focus a non-primary press just caused. */\n fromAuxButton: () => auxPress.current,\n };\n}\n\n/**\n * The desktop suggestion list, PORTALLED and anchored to the field.\n *\n * It used to be an `absolute` `<ul>` inside the field's own wrapper, and that is\n * Keksdose live #295: *\"Category select inside the list is not readable. Some sort\n * of z indexes issue?\"*. It was not z-index — a stacking context can be out-ranked,\n * but `overflow` cannot be argued with. The receipt's line table sits in a card\n * carrying `overflow-clip`, so a list opened from the last visible row was cut off\n * at the card's edge: measured at 256px tall with 150px of it painted.\n *\n * Every other panel in this package already learned this — `DropdownPanel`'s\n * `anchorRef` form, the calculator popover, the tooltip — so this reuses the same\n * hook rather than inventing a second placement. What that buys beyond the clip:\n * the list flips above the field when there is no room below, and it caps its own\n * height against the VISIBLE viewport, which on a phone means the on-screen\n * keyboard (see {@link useAnchoredPanel}).\n *\n * `panelRef` is not optional plumbing. Portalled, the list is no longer a\n * descendant of the wrapper, so {@link useDropdown}'s outside-click test answers\n * \"outside\" for a click on the list itself — the first option a user picked would\n * close the dropdown having picked nothing.\n */\nexport function SuggestionList({\n id,\n anchorRef,\n panelRef,\n children,\n}: {\n /** What the field's `aria-controls` names. */\n id: string;\n anchorRef: RefObject<HTMLElement | null>;\n panelRef: RefObject<HTMLDivElement | null>;\n children: ReactNode;\n}) {\n const { rect, top, bottom, maxHeight, above } = useAnchoredPanel(anchorRef, true, { preferredHeight: 256 });\n const dir = useAnchorDir(anchorRef, true);\n if (!rect) return null;\n return createPortal(\n <div\n ref={panelRef}\n // A kit layer, for the tour's layer order (0.50, docs/tours-harmonization.md §11.6).\n data-kit-layer=\"\"\n // z-50, not the old z-30: the list is a child of <body> now, so it is\n // competing with the app's own overlays rather than with its own siblings.\n className=\"fixed z-50\"\n // Portalled out of the form's `dir`; the field's is put back. The list is\n // exactly the field's width, so `left` places it in either direction.\n dir={dir}\n // Flipped above, the list hangs from its bottom edge: it filters as the user\n // types, and a short one placed by `top` floated above the field (keksdose K1).\n style={{ ...(above ? { bottom } : { top }), left: rect.left, width: rect.width }}\n >\n <ul id={id} role=\"listbox\" data-clips=\"\" className={LIST_CLASS} style={{ maxHeight }}>\n {children}\n </ul>\n </div>,\n document.body,\n );\n}\n\nexport const rowClass = suggestionRowClass;\n\n/**\n * The write lock on the two TYPED fields — {@link Button}'s `disabledReason`\n * path, for an input (keksdose G2).\n *\n * `readOnly` rather than `disabled`, as everywhere the kit locks a field: still focusable,\n * so the reason in the Tooltip reaches a keyboard; refusing keys, so nothing typed can\n * become a value; and FIELD_BASE paints a `[readonly]` field in the settled grey a\n * disabled one wears. No list opens, by focus, click, chevron or arrow — and Enter is\n * swallowed, so a locked field does not submit the form around it either (Select's\n * lock, `LOCKED_SELECT_KEYS`). Every other key is left alone: the arrows and Home/End\n * still move the caret through a long value someone is trying to read.\n */\nexport function lockedKeyDown(e: { key: string; preventDefault: () => void }) {\n if (e.key === \"Enter\") e.preventDefault();\n}\n"],"mappings":";AA0GM;AArGN,SAAS,cAAc;AAEvB,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB,0BAA0B;AAK1D,MAAM,aAAa;AAwBZ,SAAS,sBAAsB;AACpC,QAAM,WAAW,OAAO,KAAK;AAC7B,SAAO;AAAA,IACL,aAAa,CAAC,MAA0B;AACtC,UAAI,EAAE,WAAW,EAAG;AACpB,eAAS,UAAU;AACnB,iBAAW,MAAM;AACf,iBAAS,UAAU;AAAA,MACrB,GAAG,CAAC;AAAA,IACN;AAAA;AAAA,IAEA,eAAe,MAAM,SAAS;AAAA,EAChC;AACF;AAwBO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,QAAM,EAAE,MAAM,KAAK,QAAQ,WAAW,MAAM,IAAI,iBAAiB,WAAW,MAAM,EAAE,iBAAiB,IAAI,CAAC;AAC1G,QAAM,MAAM,aAAa,WAAW,IAAI;AACxC,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO;AAAA,IACL;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QAEL,kBAAe;AAAA,QAGf,WAAU;AAAA,QAGV;AAAA,QAGA,OAAO,EAAE,GAAI,QAAQ,EAAE,OAAO,IAAI,EAAE,IAAI,GAAI,MAAM,KAAK,MAAM,OAAO,KAAK,MAAM;AAAA,QAE/E,8BAAC,QAAG,IAAQ,MAAK,WAAU,cAAW,IAAG,WAAW,YAAY,OAAO,EAAE,UAAU,GAChF,UACH;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;AAEO,MAAM,WAAW;AAcjB,SAAS,cAAc,GAAgD;AAC5E,MAAI,EAAE,QAAQ,QAAS,GAAE,eAAe;AAC1C;","names":[]}
@@ -0,0 +1,5 @@
1
+ import type { ConfirmFn } from "./confirm-dialog.js";
2
+ /** The nearest `ConfirmProvider`'s `confirm`, or `null`. Internal: its own module so a
3
+ * part that may sit outside a provider (`RowActions`, 0.49 KIT-12) can ask without
4
+ * `useConfirm()`'s throw, and without adding a name to the barrel. */
5
+ export declare const ConfirmContext: import("react").Context<ConfirmFn | null>;
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { createContext } from "react";
3
+ const ConfirmContext = createContext(null);
4
+ export {
5
+ ConfirmContext
6
+ };
7
+ //# sourceMappingURL=confirm-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/confirm-context.ts"],"sourcesContent":["import { createContext } from \"react\";\nimport type { ConfirmFn } from \"./confirm-dialog\";\n\n/** The nearest `ConfirmProvider`'s `confirm`, or `null`. Internal: its own module so a\n * part that may sit outside a provider (`RowActions`, 0.49 KIT-12) can ask without\n * `useConfirm()`'s throw, and without adding a name to the barrel. */\nexport const ConfirmContext = createContext<ConfirmFn | null>(null);\n"],"mappings":";AAAA,SAAS,qBAAqB;AAMvB,MAAM,iBAAiB,cAAgC,IAAI;","names":[]}
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
3
+ import { useCallback, useContext, useEffect, useRef, useState } from "react";
4
4
  import { useKitLabels } from "../i18n/kit-labels.js";
5
5
  import { TypedConfirmField, typedMatches } from "./danger-confirm.js";
6
6
  import { DialogFrame } from "./dialog-frame.js";
7
7
  import { Button } from "./button.js";
8
8
  import { useWriteLock, writeLockFor } from "./write-lock.js";
9
9
  import { DEFAULT_CONFIRM_DIALOG_LABELS } from "./confirm-dialog-labels.js";
10
- const ConfirmContext = createContext(null);
10
+ import { ConfirmContext } from "./confirm-context.js";
11
11
  function useConfirm() {
12
12
  const confirm = useContext(ConfirmContext);
13
13
  if (!confirm) {
@@ -87,7 +87,7 @@ function ConfirmDialogView({
87
87
  {
88
88
  ref: confirmRef,
89
89
  type: "button",
90
- variant: tone === "danger" ? "danger" : "primary",
90
+ variant: tone === "danger" ? "danger" : "default",
91
91
  disabled: !matches,
92
92
  disabledReason: request.lockReason,
93
93
  onClick: () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/confirm-dialog.tsx"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { TypedConfirmField, typedMatches } from \"./danger-confirm\";\nimport type { TypedMatch } from \"./danger-confirm\";\nimport { DialogFrame } from \"./dialog-frame\";\nimport { Button } from \"./button\";\nimport { useWriteLock, writeLockFor, type CommitScope } from \"./write-lock\";\nimport { DEFAULT_CONFIRM_DIALOG_LABELS } from \"./confirm-dialog-labels\";\n\n/**\n * The `confirmDialog` namespace of `<UiKitProvider labels>`: the two buttons' fallback\n * text. A call that knows what it is confirming says so per call (`confirmLabel:\n * \"Delete budget\"`), which is what the dialog is for — these are for the rest.\n */\nexport interface ConfirmDialogLabels {\n confirm: string;\n cancel: string;\n /**\n * 0.18: label of the field a `requireTyped` confirm shows. A FUNCTION of the text to\n * type by default — where the address sits in the sentence moves with the language —\n * or a finished STRING. A call's own `typedLabel` wins over it.\n *\n * Required, like every key of a namespace: the shipped catalogues\n * (`@eifi1/ui-kit/i18n/<code>`) translate it, and an app's own full catalogue should\n * hear about the new string from the compiler rather than show it in English.\n */\n typed: string | ((text: string) => string);\n}\n\n// Defined in ./confirm-dialog-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_CONFIRM_DIALOG_LABELS };\n\nexport type ConfirmTone = \"danger\" | \"warning\" | \"neutral\";\n\nexport interface ConfirmOptions {\n /** The question, and the dialog's accessible name. */\n title: ReactNode;\n /** The smaller line under it — the consequence. Wired to `aria-describedby`. */\n body?: ReactNode;\n /** Default: `confirmDialog.confirm` from the provider, else \"Confirm\". */\n confirmLabel?: ReactNode;\n /** Default: `confirmDialog.cancel` from the provider, else \"Cancel\". */\n cancelLabel?: ReactNode;\n /**\n * `\"danger\"` for what cannot be undone (a delete): the confirm is the destructive\n * button and focus starts on CANCEL. `\"warning\"` and `\"neutral\"` (default) start on\n * the confirm. See {@link ConfirmProvider} for why the two differ.\n */\n tone?: ConfirmTone;\n /**\n * 0.18: make the user TYPE this before confirm is enabled — the target account's\n * e-mail address, a budget's name. For the action whose risk is not \"did you mean\n * it\" but \"is this the right row\": an admin who deactivates somebody has already\n * proven who THEY are (they passed the admin gate); typing the address is what\n * proves they read which account they are on. Both keksdose (`TYPE_EMAIL`) and\n * Kurvenschmiede (`TypedConfirm`) built this beside `useConfirm` because it had no\n * field.\n *\n * The dialog then shows one text field under the body and focuses it (whatever the\n * tone: a reflexive Enter cannot confirm a field that does not match yet). Confirm\n * stays disabled until the text matches; Enter in the field confirms once it does.\n * The answer is still `true` / `false` — the text matched what you passed, so send\n * that to the server if it asks for the address too, not the user's spelling.\n */\n requireTyped?: string;\n /** Label of that field. Default: `confirmDialog.typed` — `Type “a@b.c” to confirm`. */\n typedLabel?: string;\n /**\n * How the typed text is compared. Default `\"caseless\"`: surrounding spaces and case\n * ignored, the rule both apps applied to an address. `\"trim\"` keeps case, `\"exact\"`\n * keeps spaces too — for a phrase like \"DELETE\" whose contract is \"exactly this\".\n */\n typedMatch?: TypedMatch;\n /**\n * 0.31.1: the confirm button COMMITS, as `Button`'s `commit` does. Under a locked\n * `WriteLockProvider` — read where `useConfirm` was called, not where the one dialog\n * host sits — it is `aria-disabled` with the lock's reason, so a read-only page (a\n * demo, a viewer's budget) can't confirm a delete through a dialog. One prop for the\n * many confirm sites an app has (kastlan's 0.31 adoption counted ~23).\n *\n * 0.33: a {@link CommitScope} — `confirm({ commit: COMMIT_EXCEPT_BILLING })` for a\n * confirm a lapsed plan still allows (removing access, the account's own settings;\n * docs/billing-harmonization.md §12.36).\n */\n commit?: CommitScope;\n}\n\nexport type ConfirmFn = (options: ConfirmOptions) => Promise<boolean>;\n\nconst ConfirmContext = createContext<ConfirmFn | null>(null);\n\n/**\n * `const confirm = useConfirm()` → `if (!(await confirm({ title }))) return`.\n *\n * The returned function is STABLE for the life of the provider, so it can sit in an\n * effect's or a `useCallback`'s dependency list without re-running it.\n *\n * Throws outside a {@link ConfirmProvider}, rather than falling back to\n * `window.confirm`: a silent fallback is exactly the native dialog the three apps are\n * migrating away from, and it would look like the migration had worked.\n */\nexport function useConfirm(): ConfirmFn {\n const confirm = useContext(ConfirmContext);\n if (!confirm) {\n throw new Error(\"useConfirm() must be called below a <ConfirmProvider>.\");\n }\n // The lock of the CALLER's place: the dialog host usually sits above the app's\n // `WriteLockProvider`, so it could not read the lock itself. Each call's own `commit`\n // scope is applied to it when the call runs (`writeLockFor`, §12.36).\n const lock = useWriteLock();\n return useCallback(\n (options: ConfirmOptions) => {\n const scoped = writeLockFor(lock, options.commit);\n return confirm(scoped.locked ? ({ ...options, lockReason: scoped.reason } as ConfirmOptions) : options);\n },\n [confirm, lock],\n );\n}\n\ninterface Request extends ConfirmOptions {\n id: number;\n resolve: (answer: boolean) => void;\n /** Set by {@link useConfirm} for a `commit` confirm under a locked provider. */\n lockReason?: ReactNode;\n}\n\nexport interface ConfirmProviderProps {\n children: ReactNode;\n}\n\n/**\n * The host for {@link useConfirm}: ONE confirm dialog for the whole app, rendered on\n * {@link DialogFrame}, answering a promise.\n *\n * Asked for by all three apps at once — keksdose has 20+ `window.confirm` calls,\n * kastlan 7, lenkbank 1. The native dialog cannot be translated past its OK/Cancel\n * (those are the BROWSER's language, not the app's), cannot say which button is the\n * destructive one, and on an installed PWA it prints the origin over the question.\n * A promise is what lets each of those call sites change by one `await`:\n *\n * if (!window.confirm(t(\"budget.delete_confirm\"))) return;\n * // becomes\n * if (!(await confirm({ title: t(\"budget.delete_confirm\"), tone: \"danger\" }))) return;\n *\n * ## Its own provider, not part of `UiKitProvider`\n *\n * `UiKitProvider` renders nothing: it is strings and a locale, it is optional, and it\n * NESTS (an inner one re-labels one table). A dialog host inside it would mount a host\n * per nested provider, and a component under the inner one would open a second dialog\n * layer of its own. So the host is its own component, mounted once — inside the\n * `UiKitProvider` whose strings it should speak, which is also the order the labels\n * need.\n *\n * ## Focus\n *\n * On CANCEL for `tone: \"danger\"`, on CONFIRM otherwise. A confirm is often answered by\n * a reflexive Enter — the key that pressed the Delete button in the first place may\n * still be down — and for an action that cannot be undone that reflex must land on the\n * harmless answer; `DangerConfirm` makes the same call (\"never to the destructive\n * button itself\"). For everything else the confirm is the expected answer and Enter\n * accepting it is what `window.confirm` taught users, which the migrating call sites'\n * users already rely on. Focus returns to whatever opened it, through `Modal`'s trap.\n *\n * ## Escape, the backdrop, Back and Cancel all answer `false`\n *\n * Only the confirm button answers `true`. Anything that merely dismisses is a no.\n *\n * ## A second `confirm` while one is open QUEUES\n *\n * It is shown when the first is answered, and each call gets its own answer. The\n * alternative — answering the open one `false` to make room — would answer a question\n * the user never answered: a background prompt (\"your session is about to expire\")\n * would cancel the delete they were reading. `false` has to mean \"the user said no\".\n * A double-click cannot queue two of the same: the first click opens the modal\n * synchronously (a discrete event's update is flushed before the next one), so the\n * second lands on the open dialog rather than on the button — at worst on its\n * backdrop, which answers `false`, the safe way to be wrong.\n *\n * Unmounting the provider answers everything still pending `false`, so no caller's\n * `await` hangs forever.\n *\n * ## keksdose's synchronous call (transaction-swipe-plan.ts)\n *\n * `buildTxSwipeActions` is synchronous, but its `window.confirm` sits inside the\n * action THUNK (`confirmed(key, run)` returns `() => { if (confirm(…)) run() }`), and a\n * thunk may be async without its caller knowing. So the plan builder stays\n * synchronous; it takes the confirm as an argument and the thunk awaits it:\n *\n * // mobile-transaction-list.tsx\n * const confirm = useConfirm();\n * buildTxSwipeActions({ tx, …, confirm });\n *\n * // transaction-swipe-plan.ts\n * const confirmed = (messageKey: string, run: () => void) => () => {\n * void confirm({ title: t(messageKey), tone: \"danger\" }).then((ok) => ok && run());\n * };\n *\n * Its test then passes `confirm: vi.fn(async () => false)` instead of stubbing the\n * global, and asserts after an `await` (the mutation now runs a microtask later). The\n * row snaps back when the swipe commits, before the answer — which is right: the\n * dialog, not the half-swiped row, is where the question now is.\n */\nexport function ConfirmProvider({ children }: ConfirmProviderProps) {\n const [queue, setQueue] = useState<Request[]>([]);\n const nextId = useRef(0);\n // Every unanswered request, including the ones not yet in state — the unmount\n // cleanup below must reach a request made in the same tick it unmounts.\n const pending = useRef(new Set<Request>());\n\n const confirm = useCallback<ConfirmFn>(\n (options) =>\n new Promise<boolean>((resolve) => {\n const request: Request = { ...options, id: ++nextId.current, resolve };\n pending.current.add(request);\n setQueue((q) => [...q, request]);\n }),\n [],\n );\n\n useEffect(() => {\n const open = pending.current;\n return () => {\n for (const r of open) r.resolve(false);\n open.clear();\n };\n }, []);\n\n const answer = useCallback((request: Request, value: boolean) => {\n if (!pending.current.delete(request)) return;\n request.resolve(value);\n setQueue((q) => q.filter((r) => r !== request));\n }, []);\n\n const current = queue[0];\n return (\n <ConfirmContext.Provider value={confirm}>\n {children}\n {current && (\n // Keyed per request, so a queued one gets a fresh Modal: the first one's trap\n // hands focus back to the page, and the next one's captures that as its own\n // restore target instead of a button that has just been unmounted.\n <ConfirmDialogView key={current.id} request={current} onAnswer={answer} />\n )}\n </ConfirmContext.Provider>\n );\n}\n\nfunction ConfirmDialogView({\n request,\n onAnswer,\n}: {\n request: Request;\n onAnswer: (request: Request, value: boolean) => void;\n}) {\n const labels = useKitLabels(\"confirmDialog\", DEFAULT_CONFIRM_DIALOG_LABELS);\n const tone = request.tone ?? \"neutral\";\n const confirmRef = useRef<HTMLButtonElement>(null);\n const cancelRef = useRef<HTMLButtonElement>(null);\n // Set by the confirm button, read once the panel has finished lowering. Everything\n // else that ends in `onClose` — Escape, the backdrop, Back, Cancel — leaves it false.\n const accepted = useRef(false);\n const typedRef = useRef<HTMLInputElement>(null);\n const [typed, setTyped] = useState(\"\");\n const target = request.requireTyped;\n const matches = target === undefined || typedMatches(typed, target, request.typedMatch ?? \"caseless\");\n\n // In THIS component's effect, which runs after `Modal`'s own (a parent's effects run\n // after its children's). `Modal` engages its focus trap on the panel first — and\n // records the page's focused element as the restore target — and only then does\n // focus move to the button. Focusing it from inside the panel would run first and\n // make the button the restore target. A typed confirm starts in its field: typing is\n // the one thing the dialog is waiting for.\n useEffect(() => {\n (target !== undefined ? typedRef : tone === \"danger\" ? cancelRef : confirmRef).current?.focus();\n }, [tone, target]);\n\n const typedLabel =\n target === undefined\n ? \"\"\n : (request.typedLabel ??\n (typeof labels.typed === \"string\" ? labels.typed : labels.typed(target)));\n\n return (\n <DialogFrame\n title={request.title}\n description={request.body}\n onClose={() => onAnswer(request, accepted.current)}\n // A confirmation interrupts to ask a question that must be answered.\n role=\"alertdialog\"\n data-confirm-tone={tone}\n actions={(close) => (\n <>\n <Button ref={cancelRef} type=\"button\" variant=\"ghost\" onClick={close}>\n {request.cancelLabel ?? labels.cancel}\n </Button>\n <Button\n ref={confirmRef}\n type=\"button\"\n variant={tone === \"danger\" ? \"danger\" : \"primary\"}\n disabled={!matches}\n disabledReason={request.lockReason}\n onClick={() => {\n accepted.current = true;\n close();\n }}\n >\n {request.confirmLabel ?? labels.confirm}\n </Button>\n </>\n )}\n >\n {/* The field, when there is one, is the body; a plain confirm keeps having none. */}\n {target !== undefined && (\n <form\n noValidate\n onSubmit={(e) => {\n e.preventDefault();\n // Through the button, so Enter and a click are one path — and a disabled\n // (not yet matching) confirm ignores the click.\n confirmRef.current?.click();\n }}\n >\n {/* The kit's one typed-confirmation field (0.23), DangerConfirm's too: the\n keyboard told to leave the text alone, `data-matched` on the input. The\n label is this namespace's (`confirmDialog.typed`), and `placeholder=\"\"`\n keeps out the `dangerConfirm.phrasePlaceholder` a provider may set for\n the tile — this field never had one. */}\n <TypedConfirmField\n ref={typedRef}\n target={target}\n match={request.typedMatch ?? \"caseless\"}\n label={typedLabel}\n placeholder=\"\"\n value={typed}\n onValueChange={setTyped}\n />\n </form>\n )}\n </DialogFrame>\n );\n}\n"],"mappings":";AA6OI,SAwDI,UA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,UAAO,KAAK,WAAW,MAAK,UAAS,SAAQ,SAAQ,SAAS,OAC5D,kBAAQ,eAAe,OAAO,QACjC;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,KAAK;AAAA,YACL,MAAK;AAAA,YACL,SAAS,SAAS,WAAW,WAAW;AAAA,YACxC,UAAU,CAAC;AAAA,YACX,gBAAgB,QAAQ;AAAA,YACxB,SAAS,MAAM;AACb,uBAAS,UAAU;AACnB,oBAAM;AAAA,YACR;AAAA,YAEC,kBAAQ,gBAAgB,OAAO;AAAA;AAAA,QAClC;AAAA,SACF;AAAA,MAID,qBAAW,UACV;AAAA,QAAC;AAAA;AAAA,UACC,YAAU;AAAA,UACV,UAAU,CAAC,MAAM;AACf,cAAE,eAAe;AAGjB,uBAAW,SAAS,MAAM;AAAA,UAC5B;AAAA,UAOA;AAAA,YAAC;AAAA;AAAA,cACC,KAAK;AAAA,cACL;AAAA,cACA,OAAO,QAAQ,cAAc;AAAA,cAC7B,OAAO;AAAA,cACP,aAAY;AAAA,cACZ,OAAO;AAAA,cACP,eAAe;AAAA;AAAA,UACjB;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/confirm-dialog.tsx"],"sourcesContent":["import { useCallback, useContext, useEffect, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { TypedConfirmField, typedMatches } from \"./danger-confirm\";\nimport type { TypedMatch } from \"./danger-confirm\";\nimport { DialogFrame } from \"./dialog-frame\";\nimport { Button } from \"./button\";\nimport { useWriteLock, writeLockFor, type CommitScope } from \"./write-lock\";\nimport { DEFAULT_CONFIRM_DIALOG_LABELS } from \"./confirm-dialog-labels\";\nimport { ConfirmContext } from \"./confirm-context\";\n\n/**\n * The `confirmDialog` namespace of `<UiKitProvider labels>`: the two buttons' fallback\n * text. A call that knows what it is confirming says so per call (`confirmLabel:\n * \"Delete budget\"`), which is what the dialog is for — these are for the rest.\n */\nexport interface ConfirmDialogLabels {\n confirm: string;\n cancel: string;\n /**\n * 0.18: label of the field a `requireTyped` confirm shows. A FUNCTION of the text to\n * type by default — where the address sits in the sentence moves with the language —\n * or a finished STRING. A call's own `typedLabel` wins over it.\n *\n * Required, like every key of a namespace: the shipped catalogues\n * (`@eifi1/ui-kit/i18n/<code>`) translate it, and an app's own full catalogue should\n * hear about the new string from the compiler rather than show it in English.\n */\n typed: string | ((text: string) => string);\n}\n\n// Defined in ./confirm-dialog-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_CONFIRM_DIALOG_LABELS };\n\nexport type ConfirmTone = \"danger\" | \"warning\" | \"neutral\";\n\nexport interface ConfirmOptions {\n /** The question, and the dialog's accessible name. */\n title: ReactNode;\n /** The smaller line under it — the consequence. Wired to `aria-describedby`. */\n body?: ReactNode;\n /** Default: `confirmDialog.confirm` from the provider, else \"Confirm\". */\n confirmLabel?: ReactNode;\n /** Default: `confirmDialog.cancel` from the provider, else \"Cancel\". */\n cancelLabel?: ReactNode;\n /**\n * `\"danger\"` for what cannot be undone (a delete): the confirm is the destructive\n * button and focus starts on CANCEL. `\"warning\"` and `\"neutral\"` (default) start on\n * the confirm. See {@link ConfirmProvider} for why the two differ.\n */\n tone?: ConfirmTone;\n /**\n * 0.18: make the user TYPE this before confirm is enabled — the target account's\n * e-mail address, a budget's name. For the action whose risk is not \"did you mean\n * it\" but \"is this the right row\": an admin who deactivates somebody has already\n * proven who THEY are (they passed the admin gate); typing the address is what\n * proves they read which account they are on. Both keksdose (`TYPE_EMAIL`) and\n * Kurvenschmiede (`TypedConfirm`) built this beside `useConfirm` because it had no\n * field.\n *\n * The dialog then shows one text field under the body and focuses it (whatever the\n * tone: a reflexive Enter cannot confirm a field that does not match yet). Confirm\n * stays disabled until the text matches; Enter in the field confirms once it does.\n * The answer is still `true` / `false` — the text matched what you passed, so send\n * that to the server if it asks for the address too, not the user's spelling.\n */\n requireTyped?: string;\n /** Label of that field. Default: `confirmDialog.typed` — `Type “a@b.c” to confirm`. */\n typedLabel?: string;\n /**\n * How the typed text is compared. Default `\"caseless\"`: surrounding spaces and case\n * ignored, the rule both apps applied to an address. `\"trim\"` keeps case, `\"exact\"`\n * keeps spaces too — for a phrase like \"DELETE\" whose contract is \"exactly this\".\n */\n typedMatch?: TypedMatch;\n /**\n * 0.31.1: the confirm button COMMITS, as `Button`'s `commit` does. Under a locked\n * `WriteLockProvider` — read where `useConfirm` was called, not where the one dialog\n * host sits — it is `aria-disabled` with the lock's reason, so a read-only page (a\n * demo, a viewer's budget) can't confirm a delete through a dialog. One prop for the\n * many confirm sites an app has (kastlan's 0.31 adoption counted ~23).\n *\n * 0.33: a {@link CommitScope} — `confirm({ commit: COMMIT_EXCEPT_BILLING })` for a\n * confirm a lapsed plan still allows (removing access, the account's own settings;\n * docs/billing-harmonization.md §12.36).\n */\n commit?: CommitScope;\n}\n\nexport type ConfirmFn = (options: ConfirmOptions) => Promise<boolean>;\n\n\n/**\n * `const confirm = useConfirm()` → `if (!(await confirm({ title }))) return`.\n *\n * The returned function is STABLE for the life of the provider, so it can sit in an\n * effect's or a `useCallback`'s dependency list without re-running it.\n *\n * Throws outside a {@link ConfirmProvider}, rather than falling back to\n * `window.confirm`: a silent fallback is exactly the native dialog the three apps are\n * migrating away from, and it would look like the migration had worked.\n */\nexport function useConfirm(): ConfirmFn {\n const confirm = useContext(ConfirmContext);\n if (!confirm) {\n throw new Error(\"useConfirm() must be called below a <ConfirmProvider>.\");\n }\n // The lock of the CALLER's place: the dialog host usually sits above the app's\n // `WriteLockProvider`, so it could not read the lock itself. Each call's own `commit`\n // scope is applied to it when the call runs (`writeLockFor`, §12.36).\n const lock = useWriteLock();\n return useCallback(\n (options: ConfirmOptions) => {\n const scoped = writeLockFor(lock, options.commit);\n return confirm(scoped.locked ? ({ ...options, lockReason: scoped.reason } as ConfirmOptions) : options);\n },\n [confirm, lock],\n );\n}\n\ninterface Request extends ConfirmOptions {\n id: number;\n resolve: (answer: boolean) => void;\n /** Set by {@link useConfirm} for a `commit` confirm under a locked provider. */\n lockReason?: ReactNode;\n}\n\nexport interface ConfirmProviderProps {\n children: ReactNode;\n}\n\n/**\n * The host for {@link useConfirm}: ONE confirm dialog for the whole app, rendered on\n * {@link DialogFrame}, answering a promise.\n *\n * Asked for by all three apps at once — keksdose has 20+ `window.confirm` calls,\n * kastlan 7, lenkbank 1. The native dialog cannot be translated past its OK/Cancel\n * (those are the BROWSER's language, not the app's), cannot say which button is the\n * destructive one, and on an installed PWA it prints the origin over the question.\n * A promise is what lets each of those call sites change by one `await`:\n *\n * if (!window.confirm(t(\"budget.delete_confirm\"))) return;\n * // becomes\n * if (!(await confirm({ title: t(\"budget.delete_confirm\"), tone: \"danger\" }))) return;\n *\n * ## Its own provider, not part of `UiKitProvider`\n *\n * `UiKitProvider` renders nothing: it is strings and a locale, it is optional, and it\n * NESTS (an inner one re-labels one table). A dialog host inside it would mount a host\n * per nested provider, and a component under the inner one would open a second dialog\n * layer of its own. So the host is its own component, mounted once — inside the\n * `UiKitProvider` whose strings it should speak, which is also the order the labels\n * need.\n *\n * ## Focus\n *\n * On CANCEL for `tone: \"danger\"`, on CONFIRM otherwise. A confirm is often answered by\n * a reflexive Enter — the key that pressed the Delete button in the first place may\n * still be down — and for an action that cannot be undone that reflex must land on the\n * harmless answer; `DangerConfirm` makes the same call (\"never to the destructive\n * button itself\"). For everything else the confirm is the expected answer and Enter\n * accepting it is what `window.confirm` taught users, which the migrating call sites'\n * users already rely on. Focus returns to whatever opened it, through `Modal`'s trap.\n *\n * ## Escape, the backdrop, Back and Cancel all answer `false`\n *\n * Only the confirm button answers `true`. Anything that merely dismisses is a no.\n *\n * ## A second `confirm` while one is open QUEUES\n *\n * It is shown when the first is answered, and each call gets its own answer. The\n * alternative — answering the open one `false` to make room — would answer a question\n * the user never answered: a background prompt (\"your session is about to expire\")\n * would cancel the delete they were reading. `false` has to mean \"the user said no\".\n * A double-click cannot queue two of the same: the first click opens the modal\n * synchronously (a discrete event's update is flushed before the next one), so the\n * second lands on the open dialog rather than on the button — at worst on its\n * backdrop, which answers `false`, the safe way to be wrong.\n *\n * Unmounting the provider answers everything still pending `false`, so no caller's\n * `await` hangs forever.\n *\n * ## keksdose's synchronous call (transaction-swipe-plan.ts)\n *\n * `buildTxSwipeActions` is synchronous, but its `window.confirm` sits inside the\n * action THUNK (`confirmed(key, run)` returns `() => { if (confirm(…)) run() }`), and a\n * thunk may be async without its caller knowing. So the plan builder stays\n * synchronous; it takes the confirm as an argument and the thunk awaits it:\n *\n * // mobile-transaction-list.tsx\n * const confirm = useConfirm();\n * buildTxSwipeActions({ tx, …, confirm });\n *\n * // transaction-swipe-plan.ts\n * const confirmed = (messageKey: string, run: () => void) => () => {\n * void confirm({ title: t(messageKey), tone: \"danger\" }).then((ok) => ok && run());\n * };\n *\n * Its test then passes `confirm: vi.fn(async () => false)` instead of stubbing the\n * global, and asserts after an `await` (the mutation now runs a microtask later). The\n * row snaps back when the swipe commits, before the answer — which is right: the\n * dialog, not the half-swiped row, is where the question now is.\n */\nexport function ConfirmProvider({ children }: ConfirmProviderProps) {\n const [queue, setQueue] = useState<Request[]>([]);\n const nextId = useRef(0);\n // Every unanswered request, including the ones not yet in state — the unmount\n // cleanup below must reach a request made in the same tick it unmounts.\n const pending = useRef(new Set<Request>());\n\n const confirm = useCallback<ConfirmFn>(\n (options) =>\n new Promise<boolean>((resolve) => {\n const request: Request = { ...options, id: ++nextId.current, resolve };\n pending.current.add(request);\n setQueue((q) => [...q, request]);\n }),\n [],\n );\n\n useEffect(() => {\n const open = pending.current;\n return () => {\n for (const r of open) r.resolve(false);\n open.clear();\n };\n }, []);\n\n const answer = useCallback((request: Request, value: boolean) => {\n if (!pending.current.delete(request)) return;\n request.resolve(value);\n setQueue((q) => q.filter((r) => r !== request));\n }, []);\n\n const current = queue[0];\n return (\n <ConfirmContext.Provider value={confirm}>\n {children}\n {current && (\n // Keyed per request, so a queued one gets a fresh Modal: the first one's trap\n // hands focus back to the page, and the next one's captures that as its own\n // restore target instead of a button that has just been unmounted.\n <ConfirmDialogView key={current.id} request={current} onAnswer={answer} />\n )}\n </ConfirmContext.Provider>\n );\n}\n\nfunction ConfirmDialogView({\n request,\n onAnswer,\n}: {\n request: Request;\n onAnswer: (request: Request, value: boolean) => void;\n}) {\n const labels = useKitLabels(\"confirmDialog\", DEFAULT_CONFIRM_DIALOG_LABELS);\n const tone = request.tone ?? \"neutral\";\n const confirmRef = useRef<HTMLButtonElement>(null);\n const cancelRef = useRef<HTMLButtonElement>(null);\n // Set by the confirm button, read once the panel has finished lowering. Everything\n // else that ends in `onClose` — Escape, the backdrop, Back, Cancel — leaves it false.\n const accepted = useRef(false);\n const typedRef = useRef<HTMLInputElement>(null);\n const [typed, setTyped] = useState(\"\");\n const target = request.requireTyped;\n const matches = target === undefined || typedMatches(typed, target, request.typedMatch ?? \"caseless\");\n\n // In THIS component's effect, which runs after `Modal`'s own (a parent's effects run\n // after its children's). `Modal` engages its focus trap on the panel first — and\n // records the page's focused element as the restore target — and only then does\n // focus move to the button. Focusing it from inside the panel would run first and\n // make the button the restore target. A typed confirm starts in its field: typing is\n // the one thing the dialog is waiting for.\n useEffect(() => {\n (target !== undefined ? typedRef : tone === \"danger\" ? cancelRef : confirmRef).current?.focus();\n }, [tone, target]);\n\n const typedLabel =\n target === undefined\n ? \"\"\n : (request.typedLabel ??\n (typeof labels.typed === \"string\" ? labels.typed : labels.typed(target)));\n\n return (\n <DialogFrame\n title={request.title}\n description={request.body}\n onClose={() => onAnswer(request, accepted.current)}\n // A confirmation interrupts to ask a question that must be answered.\n role=\"alertdialog\"\n data-confirm-tone={tone}\n actions={(close) => (\n <>\n <Button ref={cancelRef} type=\"button\" variant=\"ghost\" onClick={close}>\n {request.cancelLabel ?? labels.cancel}\n </Button>\n <Button\n ref={confirmRef}\n type=\"button\"\n variant={tone === \"danger\" ? \"danger\" : \"default\"}\n disabled={!matches}\n disabledReason={request.lockReason}\n onClick={() => {\n accepted.current = true;\n close();\n }}\n >\n {request.confirmLabel ?? labels.confirm}\n </Button>\n </>\n )}\n >\n {/* The field, when there is one, is the body; a plain confirm keeps having none. */}\n {target !== undefined && (\n <form\n noValidate\n onSubmit={(e) => {\n e.preventDefault();\n // Through the button, so Enter and a click are one path — and a disabled\n // (not yet matching) confirm ignores the click.\n confirmRef.current?.click();\n }}\n >\n {/* The kit's one typed-confirmation field (0.23), DangerConfirm's too: the\n keyboard told to leave the text alone, `data-matched` on the input. The\n label is this namespace's (`confirmDialog.typed`), and `placeholder=\"\"`\n keeps out the `dangerConfirm.phrasePlaceholder` a provider may set for\n the tile — this field never had one. */}\n <TypedConfirmField\n ref={typedRef}\n target={target}\n match={request.typedMatch ?? \"caseless\"}\n label={typedLabel}\n placeholder=\"\"\n value={typed}\n onValueChange={setTyped}\n />\n </form>\n )}\n </DialogFrame>\n );\n}\n"],"mappings":";AA6OI,SAwDI,UAlDA,KANJ;AA7OJ,SAAS,aAAa,YAAY,WAAW,QAAQ,gBAAgB;AAGrE,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB,oBAAoB;AAEhD,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,cAAc,oBAAsC;AAC7D,SAAS,qCAAqC;AAC9C,SAAS,sBAAsB;AA6FxB,SAAS,aAAwB;AACtC,QAAM,UAAU,WAAW,cAAc;AACzC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAIA,QAAM,OAAO,aAAa;AAC1B,SAAO;AAAA,IACL,CAAC,YAA4B;AAC3B,YAAM,SAAS,aAAa,MAAM,QAAQ,MAAM;AAChD,aAAO,QAAQ,OAAO,SAAU,EAAE,GAAG,SAAS,YAAY,OAAO,OAAO,IAAuB,OAAO;AAAA,IACxG;AAAA,IACA,CAAC,SAAS,IAAI;AAAA,EAChB;AACF;AAqFO,SAAS,gBAAgB,EAAE,SAAS,GAAyB;AAClE,QAAM,CAAC,OAAO,QAA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A,UACjB;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
@@ -1,5 +1,6 @@
1
1
  import type { ComponentPropsWithoutRef, ReactNode, Ref } from "react";
2
- import { type FieldHelpProps } from "./field-parts.js";
2
+ import { type DisabledReasonDisplay, type FieldHelpProps } from "./field-parts.js";
3
+ import type { CommitScope } from "./write-lock.js";
3
4
  import { CURRENCIES, CurrencyFlag, currencyName, getCurrency, type CurrencyFlagProps, type CurrencyOption } from "./currency-option-list.js";
4
5
  export { CURRENCIES, CurrencyFlag, currencyName, getCurrency };
5
6
  export type { CurrencyFlagProps, CurrencyOption };
@@ -66,9 +67,34 @@ export interface CurrencySelectProps extends Omit<ComponentPropsWithoutRef<"div"
66
67
  * filter that only matches the hidden English name is worse than no filter.
67
68
  */
68
69
  currencyNames?: Record<string, string>;
70
+ /** As {@link Select}'s: no focus, no list, the settled look, no chevron. */
71
+ disabled?: boolean;
72
+ /**
73
+ * Why the currency cannot be changed — {@link Select}'s `disabledReason` (keksdose,
74
+ * 2026-10-23: a budget's currency for a guest or a viewer, and while offline, which
75
+ * keksdose drew as a one-option `Select` to keep the reason and lost the flag). The
76
+ * trigger stays focusable and `aria-disabled` (never the `disabled` attribute), keeps
77
+ * its flag and code, opens nothing, and `onChange` is never called; the reason is a
78
+ * line under the field at Large and on a touch screen, else in the kit
79
+ * {@link Tooltip} (`disabledReasonDisplay`), and on the trigger's `aria-describedby`
80
+ * (after a caption, before an error). It wears the settled look of a disabled field
81
+ * and drops its chevron, as a locked Select does. It wins over `disabled`.
82
+ */
83
+ disabledReason?: ReactNode;
84
+ /** Where the reason shows — {@link Select}'s `disabledReasonDisplay`: a line under the
85
+ * field at Large and on a touch screen by default, the tooltip otherwise. */
86
+ disabledReasonDisplay?: DisabledReasonDisplay;
87
+ /**
88
+ * This picker COMMITS — choosing saves. Under a locked {@link WriteLockProvider} it is
89
+ * locked the `disabledReason` way with the lock's reason (which wins over its own).
90
+ * No provider, or an unlocked one: no effect. {@link Select}'s `commit`. A currency
91
+ * field inside a form with its own Save stays editable under the lock — leave this off
92
+ * there, and put `commit` on the Save.
93
+ */
94
+ commit?: CommitScope;
69
95
  /** The TRIGGER — the focusable `<button>` — as a React 19 ref prop, as on
70
96
  * {@link MultiSelect} and {@link CountrySelect}: react-hook-form's focus-on-error
71
97
  * calls `focus()` on it (0.34, API-3, refactor audit 2026-10). Not the wrapper. */
72
98
  ref?: Ref<HTMLButtonElement>;
73
99
  }
74
- export declare function CurrencySelect({ value, onChange, placeholder, className, label, options, invalid, error, hint, help, labels, currencyNames, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ref, ...rest }: CurrencySelectProps): import("react").JSX.Element;
100
+ export declare function CurrencySelect({ value, onChange, placeholder, className, label, options, invalid, error, hint, help, labels, currencyNames, disabled, disabledReason, disabledReasonDisplay, commit, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ref, ...rest }: CurrencySelectProps): import("react").JSX.Element;
@@ -3,7 +3,13 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useCallback, useId } from "react";
4
4
  import { FieldChevron, FIELD_TRIGGER, FIELD_INVALID, FIELD_FLOATING_PAD } from "./field-base.js";
5
5
  import { FieldLabel } from "./field-parts.js";
6
- import { assignRef, EndHintRow, useFieldMessages } from "./field-parts.js";
6
+ import {
7
+ assignRef,
8
+ EndHintRow,
9
+ LockedReason,
10
+ useFieldMessages,
11
+ useLockReason
12
+ } from "./field-parts.js";
7
13
  import { cn } from "../lib/cn.js";
8
14
  import { useComboboxCore } from "./combobox-core.js";
9
15
  import {
@@ -32,6 +38,10 @@ function CurrencySelect({
32
38
  help,
33
39
  labels,
34
40
  currencyNames,
41
+ disabled,
42
+ disabledReason,
43
+ disabledReasonDisplay,
44
+ commit,
35
45
  "aria-label": ariaLabel,
36
46
  "aria-describedby": ariaDescribedBy,
37
47
  "aria-invalid": ariaInvalid,
@@ -51,6 +61,10 @@ function CurrencySelect({
51
61
  const common = useKitLabels("common", DEFAULT_COMMON_LABELS);
52
62
  const locale = useKitLocale();
53
63
  const selected = getCurrency(value);
64
+ const lock = useLockReason(commit, disabledReason);
65
+ const locked = lock.locked;
66
+ const inert = locked || Boolean(disabled);
67
+ if (inert && open) setOpen(false);
54
68
  const listboxId = `${useId()}-listbox`;
55
69
  const field = useFieldMessages({
56
70
  hint,
@@ -59,7 +73,9 @@ function CurrencySelect({
59
73
  error,
60
74
  invalid,
61
75
  describedBy: ariaDescribedBy,
62
- ariaInvalid
76
+ ariaInvalid,
77
+ // A lock's reason sits between the caption and the error, as on Select.
78
+ reasonId: locked && lock.reasonId
63
79
  });
64
80
  const { labelHint, describedBy, isInvalid } = field;
65
81
  const fieldName = typeof label === "string" ? label : text.currency;
@@ -70,8 +86,17 @@ function CurrencySelect({
70
86
  ref: setTrigger,
71
87
  type: "button",
72
88
  "aria-label": name,
73
- onClick: () => setOpen((v) => !v),
89
+ disabled: locked ? void 0 : disabled,
90
+ "aria-disabled": locked || void 0,
91
+ onClick: (e) => {
92
+ if (inert) {
93
+ e.preventDefault();
94
+ return;
95
+ }
96
+ setOpen((v) => !v);
97
+ },
74
98
  onKeyDown: (e) => {
99
+ if (inert) return;
75
100
  if (e.key === "ArrowDown" || e.key === "ArrowUp") {
76
101
  e.preventDefault();
77
102
  setOpen(true);
@@ -83,16 +108,36 @@ function CurrencySelect({
83
108
  "aria-expanded": open,
84
109
  "aria-invalid": isInvalid || void 0,
85
110
  "aria-describedby": describedBy,
86
- className: cn(FIELD_TRIGGER, "pe-9", label !== void 0 && FIELD_FLOATING_PAD, isInvalid && FIELD_INVALID),
111
+ className: cn(
112
+ FIELD_TRIGGER,
113
+ "pe-9",
114
+ label !== void 0 && FIELD_FLOATING_PAD,
115
+ // FIELD_BASE's `disabled:` look, for a trigger locked without being `disabled`
116
+ // (the `:disabled` variants cannot match it) — Select's FIELD_LOCKED. No hover:
117
+ // nothing here answers a press.
118
+ locked && "cursor-not-allowed bg-surface-2 text-muted hover:bg-surface-2",
119
+ isInvalid && FIELD_INVALID
120
+ ),
87
121
  children: [
88
- /* @__PURE__ */ jsx("span", { className: cn("flex items-center gap-2 min-w-0", selected ? "text-primary" : "text-placeholder"), children: selected ? /* @__PURE__ */ jsxs(Fragment, { children: [
89
- /* @__PURE__ */ jsx(CurrencyFlag, { country: selected.country }),
90
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: selected.code })
91
- ] }) : placeholder ?? text.currency }),
92
- /* @__PURE__ */ jsx(FieldChevron, {})
122
+ /* @__PURE__ */ jsx(
123
+ "span",
124
+ {
125
+ className: cn(
126
+ "flex items-center gap-2 min-w-0",
127
+ // The settled look reaches the code too: `text-primary` here would outweigh it.
128
+ !selected ? "text-placeholder" : inert ? "text-muted" : "text-primary"
129
+ ),
130
+ children: selected ? /* @__PURE__ */ jsxs(Fragment, { children: [
131
+ /* @__PURE__ */ jsx(CurrencyFlag, { country: selected.country }),
132
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: selected.code })
133
+ ] }) : placeholder ?? text.currency
134
+ }
135
+ ),
136
+ !inert && /* @__PURE__ */ jsx(FieldChevron, {})
93
137
  ]
94
138
  }
95
139
  );
140
+ const control = locked ? /* @__PURE__ */ jsx(LockedReason, { lock, display: disabledReasonDisplay, className: "flex w-full items-stretch", children: trigger }) : trigger;
96
141
  return (
97
142
  // The wrapper takes `rest`; the trigger takes the name. This field's label is a
98
143
  // floating <span> rather than a <label for>, so a caller who wants the control to
@@ -108,7 +153,7 @@ function CurrencySelect({
108
153
  /* @__PURE__ */ jsx("span", { className: "pointer-events-auto flex shrink-0 items-center", children: labelHint })
109
154
  ] })
110
155
  )),
111
- /* @__PURE__ */ jsx(EndHintRow, { hint: label === void 0 ? labelHint : void 0, children: trigger }),
156
+ /* @__PURE__ */ jsx(EndHintRow, { hint: label === void 0 ? labelHint : void 0, children: control }),
112
157
  field.below,
113
158
  /* @__PURE__ */ jsx(
114
159
  CurrencyOptionList,
@@ -122,6 +167,7 @@ function CurrencySelect({
122
167
  searchPlaceholder: text.search,
123
168
  sheetTitle: label ?? text.currency,
124
169
  onChoose: (code) => {
170
+ if (inert) return;
125
171
  onChange(code);
126
172
  closeToTrigger();
127
173
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/currency-select.tsx"],"sourcesContent":["import { useCallback, useId } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { FieldChevron, FIELD_TRIGGER, FIELD_INVALID, FIELD_FLOATING_PAD } from \"./field-base\";\nimport { FieldLabel } from \"./field-parts\";\nimport { assignRef, EndHintRow, useFieldMessages, type FieldHelpProps } from \"./field-parts\";\nimport { cn } from \"../lib/cn\";\nimport { useComboboxCore } from \"./combobox-core\";\nimport {\n CURRENCIES,\n CurrencyFlag,\n CurrencyOptionList,\n currencyName,\n getCurrency,\n type CurrencyFlagProps,\n type CurrencyOption,\n} from \"./currency-option-list\";\nimport {\n DEFAULT_COMMON_LABELS,\n DEFAULT_CURRENCY_LABELS,\n useKitLabels,\n useKitLocale,\n} from \"../i18n/kit-labels\";\n\n// The data and the flag are declared beside the one list both currency pickers render\n// (./currency-option-list, round 0.34 Wave 2, DUP-4) and are this module's exports, as\n// they always were.\nexport { CURRENCIES, CurrencyFlag, currencyName, getCurrency };\nexport type { CurrencyFlagProps, CurrencyOption };\n\n/** `onChange` is the kit's — \"a currency was picked\", carrying the code — rather\n * than the div's form event. */\nexport interface CurrencySelectProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\">, FieldHelpProps {\n value: string;\n onChange: (code: string) => void;\n placeholder?: string;\n label?: ReactNode;\n /**\n * Restrict the pickable currencies to these ISO codes (e.g. only the\n * currencies actually present in a budget). Order is preserved. Defaults to\n * the full {@link CURRENCIES} list.\n */\n options?: string[];\n /** Required and unanswered — {@link FIELD_INVALID}, the same rose border the\n * native `Select` has worn since feedback #235. Every field-styled control in\n * this package carries it now, so a form can mark any of its fields rather than\n * only the one that happened to have it first. */\n invalid?: boolean;\n /**\n * What is wrong with the choice, in the caller's own words — {@link Input}'s `error`\n * (keksdose K4: of the kit's pickers this one had neither a message nor a caption, so\n * \"the account is in EUR\" sat in a loose `<p>` beside it that nothing pointed at).\n * Rendered under the field, after a text `hint`; merged into the trigger's\n * `aria-describedby`; implies `invalid`. `null`, `false` and `\"\"` are no message.\n */\n error?: ReactNode;\n /**\n * {@link Select}'s `hint`, the same rule (keksdose K4). A {@link FieldHint} \"?\" rides\n * the label's line; on an unlabelled picker it sits at the field's end edge, outside\n * the box. Plain TEXT (a string or a number) is a caption UNDER the field, attached\n * to the trigger through `aria-describedby` — the label line has no room for a\n * sentence.\n */\n hint?: ReactNode;\n /** Every user-facing string this control owns, shaped like `AmountInput`'s\n * `labels` so the two currency pickers in the kit are configured the same way.\n *\n * `search` exists because `placeholder` used to do BOTH jobs: it named the empty\n * field and, for want of anything else, it was also handed to the search box —\n * so a caller who wrote \"Currency\" got \"Currency\" as the prompt for typing a\n * filter, and a caller who wanted to name the filter had to rename the field.\n * `placeholder` still wins for the trigger, so nothing moves for the callers\n * that set it; what changes is that the search box no longer borrows it. */\n labels?: {\n /** The empty trigger, when `placeholder` is not given. */\n currency?: string;\n /** The filter box inside the open panel. */\n search?: string;\n };\n /**\n * Translated currency names, keyed by ISO code — `{ CHF: \"Schweizer Franken\" }`.\n *\n * {@link CURRENCIES} is data the package ships, so its 27 names were the one\n * string in the row a consumer could not translate: the code and the symbol are\n * language-neutral, and the name beside them stayed English in a German UI. This\n * is a sparse OVERRIDE rather than a replacement list, so an app translates the\n * eight currencies it actually uses and keeps the rest; forking `CURRENCIES` to\n * get there would also fork the flags and symbols, which nobody wants to maintain.\n *\n * The search matches what is SHOWN — type \"Franken\" and you find CHF — because a\n * filter that only matches the hidden English name is worse than no filter.\n */\n currencyNames?: Record<string, string>;\n /** The TRIGGER — the focusable `<button>` — as a React 19 ref prop, as on\n * {@link MultiSelect} and {@link CountrySelect}: react-hook-form's focus-on-error\n * calls `focus()` on it (0.34, API-3, refactor audit 2026-10). Not the wrapper. */\n ref?: Ref<HTMLButtonElement>;\n}\n\nexport function CurrencySelect({\n value,\n onChange,\n placeholder,\n className,\n label,\n options,\n invalid,\n error,\n hint,\n help,\n labels,\n currencyNames,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n ref,\n ...rest\n}: CurrencySelectProps) {\n // The picker family's foundation (round 0.34 Wave 2, DUP-4): open state, the query,\n // the highlighted row, portal anchoring, outside press, Escape on the kit's stack and\n // Back — what `useDropdownSearch` gave it, and the rest it did not. `filter: false`:\n // the list's own currency filter hands the panel its rows.\n const core = useComboboxCore<string>({ filter: false, backCloses: true });\n const { open, setOpen, triggerRef, closeToTrigger } = core;\n // The core anchors the panel to the trigger and hands focus back to it; the caller's\n // `ref` wants the same element. One callback feeds both, as on MultiSelect.\n const setTrigger = useCallback(\n (el: HTMLButtonElement | null) => {\n triggerRef.current = el;\n assignRef(ref, el);\n },\n [ref, triggerRef],\n );\n // `labels` > `currency` from the provider > English.\n const text = useKitLabels(\"currency\", DEFAULT_CURRENCY_LABELS, labels);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const locale = useKitLocale();\n\n const selected = getCurrency(value);\n\n const listboxId = `${useId()}-listbox`;\n // Text is a caption under the field; anything else (a FieldHint) rides the label\n // line — and a FieldHint is that caption at Large and on touch (§4). See `hint`. On\n // the TRIGGER, which is the control with a role: a caller's description used to land\n // on the wrapper `<div>` through the spread, where nothing reads it. The caller's ids\n // first, then the caption, then the error — Select's order, through useFieldMessages\n // since 0.34 (DUP-2, DUP-8).\n const field = useFieldMessages({\n hint,\n help,\n name: label ?? ariaLabel,\n error,\n invalid,\n describedBy: ariaDescribedBy,\n ariaInvalid,\n });\n const { labelHint, describedBy, isInvalid } = field;\n\n // The trigger's NAME. A combobox does not take its name from its content, and the\n // floating label is a <span>, not a <label for> — so without `aria-label` from the\n // caller this trigger had no name at all (keksdose's test suite, 0.5.0). Composed the\n // way MultiSelect and the entity comboboxes compose theirs, \"label: value\", with the\n // `currency` word standing in for a missing label so it is never nameless.\n const fieldName = typeof label === \"string\" ? label : text.currency;\n const name = ariaLabel ?? common.fieldValue(fieldName, selected ? selected.code : (placeholder ?? text.currency));\n\n const trigger = (\n <button\n // Where Escape on the open list hands focus back to (round 0.34 BUG-1).\n ref={setTrigger}\n type=\"button\"\n aria-label={name}\n onClick={() => setOpen((v) => !v)}\n // Down/Up opens the list from the closed trigger, per the APG; Enter and Space\n // already do through the button's own click.\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n // The implicit `button` role supports neither `aria-expanded` nor\n // `aria-invalid`, so this trigger previously wore a red border and announced\n // nothing about being invalid or about there being a list behind it. The role\n // that DESCRIBES it is the one that also supports the attributes — the same\n // treatment its siblings (MultiSelect, the entity comboboxes) now carry, so a\n // form row of pickers reads the same way throughout. And since Wave 2 the popup\n // IS the listbox it promises, of options with the chosen one selected (BUG-12).\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-controls={listboxId}\n aria-expanded={open}\n aria-invalid={isInvalid || undefined}\n aria-describedby={describedBy}\n className={cn(FIELD_TRIGGER, \"pe-9\", label !== undefined && FIELD_FLOATING_PAD, isInvalid && FIELD_INVALID)}\n >\n {/* The trigger stays COMPACT — flag + code only — so it never clips in a\n narrow field; the full names live in the (wider) popup (feedback\n #308). */}\n <span className={cn(\"flex items-center gap-2 min-w-0\", selected ? \"text-primary\" : \"text-placeholder\")}>\n {selected ? (\n <>\n <CurrencyFlag country={selected.country} />\n <span className=\"font-medium\">{selected.code}</span>\n </>\n ) : (\n placeholder ?? text.currency\n )}\n </span>\n <FieldChevron />\n </button>\n );\n\n return (\n // The wrapper takes `rest`; the trigger takes the name. This field's label is a\n // floating <span> rather than a <label for>, so a caller who wants the control to\n // announce more than the code inside it has nowhere else to put it.\n <div {...rest} className={cn(\"relative\", className)}>\n {label !== undefined &&\n (labelHint === undefined ? (\n <FieldLabel>{label}</FieldLabel>\n ) : (\n // The label and its \"?\" as one row on the label's line, as FloatingField lays\n // out a static label with a hint: the row places both, the label truncates\n // and the hint keeps its width. `z-10` like FieldLabel's own: the trigger is\n // `relative` and comes later, so it would paint over the strip.\n <div className=\"pointer-events-none absolute inset-x-3 top-1 z-10 flex items-center gap-1\">\n <FieldLabel className=\"static z-auto min-w-0 max-w-none\">{label}</FieldLabel>\n <span className=\"pointer-events-auto flex shrink-0 items-center\">{labelHint}</span>\n </div>\n ))}\n {/* No label line to ride: at the field's end edge, outside the box, as an\n unlabelled Select places its FieldHint. */}\n <EndHintRow hint={label === undefined ? labelHint : undefined}>{trigger}</EndHintRow>\n {field.below}\n {/* Portalled to <body> and anchored to the trigger (dev#548), so where it stands\n in the flow no longer moves it. */}\n <CurrencyOptionList\n core={core}\n listboxId={listboxId}\n value={value}\n codes={options}\n currencyNames={currencyNames}\n locale={locale}\n searchPlaceholder={text.search}\n // On a phone the list is a full-screen sheet, which needs the field's own name\n // to say what it asks for (live #200).\n sheetTitle={label ?? text.currency}\n onChoose={(code) => {\n onChange(code);\n // Back to the trigger: the panel holding focus is about to unmount, and a\n // keyboard user who has answered the field should stand on it, ready to Tab on.\n closeToTrigger();\n }}\n />\n </div>\n );\n}\n"],"mappings":";AAwMU,mBACE,KADF;AAxMV,SAAS,aAAa,aAAa;AAEnC,SAAS,cAAc,eAAe,eAAe,0BAA0B;AAC/E,SAAS,kBAAkB;AAC3B,SAAS,WAAW,YAAY,wBAA6C;AAC7E,SAAS,UAAU;AACnB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA6EA,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,E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AAK;AAAA,MACL,iBAAc;AAAA,MACd,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,gBAAc,aAAa;AAAA,MAC3B,oBAAkB;AAAA,MAClB,WAAW,GAAG,eAAe,QAAQ,UAAU,UAAa,oBAAoB,aAAa,aAAa;AAAA,MAK1G;AAAA,4BAAC,UAAK,WAAW,GAAG,mCAAmC,WAAW,iBAAiB,kBAAkB,GAClG,qBACC,iCACE;AAAA,8BAAC,gBAAa,SAAS,SAAS,SAAS;AAAA,UACzC,oBAAC,UAAK,WAAU,eAAe,mBAAS,MAAK;AAAA,WAC/C,IAEA,eAAe,KAAK,UAExB;AAAA,QACA,oBAAC,gBAAa;AAAA;AAAA;AAAA,EAChB;AAGF;AAAA;AAAA;AAAA;AAAA,IAIE,qBAAC,SAAK,GAAG,MAAM,WAAW,GAAG,YAAY,SAAS,GAC/C;AAAA,gBAAU,WACR,cAAc,SACb,oBAAC,cAAY,iBAAM;AAAA;AAAA;AAAA;AAAA;AAAA,QAMnB,qBAAC,SAAI,WAAU,6EACb;AAAA,8BAAC,cAAW,WAAU,oCAAoC,iBAAM;AAAA,UAChE,oBAAC,UAAK,WAAU,kDAAkD,qBAAU;AAAA,WAC9E;AAAA;AAAA,MAIJ,oBAAC,cAAW,MAAM,UAAU,SAAY,YAAY,QAAY,mBAAQ;AAAA,MACvE,MAAM;AAAA,MAGP;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA,OAAO;AAAA,UACP;AAAA,UACA;AAAA,UACA,mBAAmB,KAAK;AAAA,UAGxB,YAAY,SAAS,KAAK;AAAA,UAC1B,UAAU,CAAC,SAAS;AAClB,qBAAS,IAAI;AAGb,2BAAe;AAAA,UACjB;AAAA;AAAA,MACF;AAAA,OACF;AAAA;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/currency-select.tsx"],"sourcesContent":["import { useCallback, useId } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { FieldChevron, FIELD_TRIGGER, FIELD_INVALID, FIELD_FLOATING_PAD } from \"./field-base\";\nimport { FieldLabel } from \"./field-parts\";\nimport {\n assignRef,\n EndHintRow,\n LockedReason,\n useFieldMessages,\n useLockReason,\n type DisabledReasonDisplay,\n type FieldHelpProps,\n} from \"./field-parts\";\nimport type { CommitScope } from \"./write-lock\";\nimport { cn } from \"../lib/cn\";\nimport { useComboboxCore } from \"./combobox-core\";\nimport {\n CURRENCIES,\n CurrencyFlag,\n CurrencyOptionList,\n currencyName,\n getCurrency,\n type CurrencyFlagProps,\n type CurrencyOption,\n} from \"./currency-option-list\";\nimport {\n DEFAULT_COMMON_LABELS,\n DEFAULT_CURRENCY_LABELS,\n useKitLabels,\n useKitLocale,\n} from \"../i18n/kit-labels\";\n\n// The data and the flag are declared beside the one list both currency pickers render\n// (./currency-option-list, round 0.34 Wave 2, DUP-4) and are this module's exports, as\n// they always were.\nexport { CURRENCIES, CurrencyFlag, currencyName, getCurrency };\nexport type { CurrencyFlagProps, CurrencyOption };\n\n/** `onChange` is the kit's — \"a currency was picked\", carrying the code — rather\n * than the div's form event. */\nexport interface CurrencySelectProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\">, FieldHelpProps {\n value: string;\n onChange: (code: string) => void;\n placeholder?: string;\n label?: ReactNode;\n /**\n * Restrict the pickable currencies to these ISO codes (e.g. only the\n * currencies actually present in a budget). Order is preserved. Defaults to\n * the full {@link CURRENCIES} list.\n */\n options?: string[];\n /** Required and unanswered — {@link FIELD_INVALID}, the same rose border the\n * native `Select` has worn since feedback #235. Every field-styled control in\n * this package carries it now, so a form can mark any of its fields rather than\n * only the one that happened to have it first. */\n invalid?: boolean;\n /**\n * What is wrong with the choice, in the caller's own words — {@link Input}'s `error`\n * (keksdose K4: of the kit's pickers this one had neither a message nor a caption, so\n * \"the account is in EUR\" sat in a loose `<p>` beside it that nothing pointed at).\n * Rendered under the field, after a text `hint`; merged into the trigger's\n * `aria-describedby`; implies `invalid`. `null`, `false` and `\"\"` are no message.\n */\n error?: ReactNode;\n /**\n * {@link Select}'s `hint`, the same rule (keksdose K4). A {@link FieldHint} \"?\" rides\n * the label's line; on an unlabelled picker it sits at the field's end edge, outside\n * the box. Plain TEXT (a string or a number) is a caption UNDER the field, attached\n * to the trigger through `aria-describedby` — the label line has no room for a\n * sentence.\n */\n hint?: ReactNode;\n /** Every user-facing string this control owns, shaped like `AmountInput`'s\n * `labels` so the two currency pickers in the kit are configured the same way.\n *\n * `search` exists because `placeholder` used to do BOTH jobs: it named the empty\n * field and, for want of anything else, it was also handed to the search box —\n * so a caller who wrote \"Currency\" got \"Currency\" as the prompt for typing a\n * filter, and a caller who wanted to name the filter had to rename the field.\n * `placeholder` still wins for the trigger, so nothing moves for the callers\n * that set it; what changes is that the search box no longer borrows it. */\n labels?: {\n /** The empty trigger, when `placeholder` is not given. */\n currency?: string;\n /** The filter box inside the open panel. */\n search?: string;\n };\n /**\n * Translated currency names, keyed by ISO code — `{ CHF: \"Schweizer Franken\" }`.\n *\n * {@link CURRENCIES} is data the package ships, so its 27 names were the one\n * string in the row a consumer could not translate: the code and the symbol are\n * language-neutral, and the name beside them stayed English in a German UI. This\n * is a sparse OVERRIDE rather than a replacement list, so an app translates the\n * eight currencies it actually uses and keeps the rest; forking `CURRENCIES` to\n * get there would also fork the flags and symbols, which nobody wants to maintain.\n *\n * The search matches what is SHOWN — type \"Franken\" and you find CHF — because a\n * filter that only matches the hidden English name is worse than no filter.\n */\n currencyNames?: Record<string, string>;\n /** As {@link Select}'s: no focus, no list, the settled look, no chevron. */\n disabled?: boolean;\n /**\n * Why the currency cannot be changed — {@link Select}'s `disabledReason` (keksdose,\n * 2026-10-23: a budget's currency for a guest or a viewer, and while offline, which\n * keksdose drew as a one-option `Select` to keep the reason and lost the flag). The\n * trigger stays focusable and `aria-disabled` (never the `disabled` attribute), keeps\n * its flag and code, opens nothing, and `onChange` is never called; the reason is a\n * line under the field at Large and on a touch screen, else in the kit\n * {@link Tooltip} (`disabledReasonDisplay`), and on the trigger's `aria-describedby`\n * (after a caption, before an error). It wears the settled look of a disabled field\n * and drops its chevron, as a locked Select does. It wins over `disabled`.\n */\n disabledReason?: ReactNode;\n /** Where the reason shows — {@link Select}'s `disabledReasonDisplay`: a line under the\n * field at Large and on a touch screen by default, the tooltip otherwise. */\n disabledReasonDisplay?: DisabledReasonDisplay;\n /**\n * This picker COMMITS — choosing saves. Under a locked {@link WriteLockProvider} it is\n * locked the `disabledReason` way with the lock's reason (which wins over its own).\n * No provider, or an unlocked one: no effect. {@link Select}'s `commit`. A currency\n * field inside a form with its own Save stays editable under the lock — leave this off\n * there, and put `commit` on the Save.\n */\n commit?: CommitScope;\n /** The TRIGGER — the focusable `<button>` — as a React 19 ref prop, as on\n * {@link MultiSelect} and {@link CountrySelect}: react-hook-form's focus-on-error\n * calls `focus()` on it (0.34, API-3, refactor audit 2026-10). Not the wrapper. */\n ref?: Ref<HTMLButtonElement>;\n}\n\nexport function CurrencySelect({\n value,\n onChange,\n placeholder,\n className,\n label,\n options,\n invalid,\n error,\n hint,\n help,\n labels,\n currencyNames,\n disabled,\n disabledReason,\n disabledReasonDisplay,\n commit,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n ref,\n ...rest\n}: CurrencySelectProps) {\n // The picker family's foundation (round 0.34 Wave 2, DUP-4): open state, the query,\n // the highlighted row, portal anchoring, outside press, Escape on the kit's stack and\n // Back — what `useDropdownSearch` gave it, and the rest it did not. `filter: false`:\n // the list's own currency filter hands the panel its rows.\n const core = useComboboxCore<string>({ filter: false, backCloses: true });\n const { open, setOpen, triggerRef, closeToTrigger } = core;\n // The core anchors the panel to the trigger and hands focus back to it; the caller's\n // `ref` wants the same element. One callback feeds both, as on MultiSelect.\n const setTrigger = useCallback(\n (el: HTMLButtonElement | null) => {\n triggerRef.current = el;\n assignRef(ref, el);\n },\n [ref, triggerRef],\n );\n // `labels` > `currency` from the provider > English.\n const text = useKitLabels(\"currency\", DEFAULT_CURRENCY_LABELS, labels);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const locale = useKitLocale();\n\n const selected = getCurrency(value);\n\n // The lock — Select's (`useLockReason`): the WriteLock's reason under `commit`, else\n // the caller's own. Locked or `disabled`, nothing opens the list or picks a value.\n const lock = useLockReason(commit, disabledReason);\n const locked = lock.locked;\n const inert = locked || Boolean(disabled);\n // A lock (or `disabled`) arriving while the list is up closes it — adjusted while\n // rendering, as CountrySelect does, so no frame shows a list that cannot be used.\n if (inert && open) setOpen(false);\n\n const listboxId = `${useId()}-listbox`;\n // Text is a caption under the field; anything else (a FieldHint) rides the label\n // line — and a FieldHint is that caption at Large and on touch (§4). See `hint`. On\n // the TRIGGER, which is the control with a role: a caller's description used to land\n // on the wrapper `<div>` through the spread, where nothing reads it. The caller's ids\n // first, then the caption, then the error — Select's order, through useFieldMessages\n // since 0.34 (DUP-2, DUP-8).\n const field = useFieldMessages({\n hint,\n help,\n name: label ?? ariaLabel,\n error,\n invalid,\n describedBy: ariaDescribedBy,\n ariaInvalid,\n // A lock's reason sits between the caption and the error, as on Select.\n reasonId: locked && lock.reasonId,\n });\n const { labelHint, describedBy, isInvalid } = field;\n\n // The trigger's NAME. A combobox does not take its name from its content, and the\n // floating label is a <span>, not a <label for> — so without `aria-label` from the\n // caller this trigger had no name at all (keksdose's test suite, 0.5.0). Composed the\n // way MultiSelect and the entity comboboxes compose theirs, \"label: value\", with the\n // `currency` word standing in for a missing label so it is never nameless.\n const fieldName = typeof label === \"string\" ? label : text.currency;\n const name = ariaLabel ?? common.fieldValue(fieldName, selected ? selected.code : (placeholder ?? text.currency));\n\n const trigger = (\n <button\n // Where Escape on the open list hands focus back to (round 0.34 BUG-1).\n ref={setTrigger}\n type=\"button\"\n aria-label={name}\n // The focusable kind of disabled while locked (Select's rule): native `disabled`\n // would take the field out of the tab order, and the reason with it.\n disabled={locked ? undefined : disabled}\n aria-disabled={locked || undefined}\n onClick={(e) => {\n if (inert) {\n e.preventDefault();\n return;\n }\n setOpen((v) => !v);\n }}\n // Down/Up opens the list from the closed trigger, per the APG; Enter and Space\n // already do through the button's own click.\n onKeyDown={(e) => {\n if (inert) return;\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n // The implicit `button` role supports neither `aria-expanded` nor\n // `aria-invalid`, so this trigger previously wore a red border and announced\n // nothing about being invalid or about there being a list behind it. The role\n // that DESCRIBES it is the one that also supports the attributes — the same\n // treatment its siblings (MultiSelect, the entity comboboxes) now carry, so a\n // form row of pickers reads the same way throughout. And since Wave 2 the popup\n // IS the listbox it promises, of options with the chosen one selected (BUG-12).\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-controls={listboxId}\n aria-expanded={open}\n aria-invalid={isInvalid || undefined}\n aria-describedby={describedBy}\n className={cn(\n FIELD_TRIGGER,\n \"pe-9\",\n label !== undefined && FIELD_FLOATING_PAD,\n // FIELD_BASE's `disabled:` look, for a trigger locked without being `disabled`\n // (the `:disabled` variants cannot match it) — Select's FIELD_LOCKED. No hover:\n // nothing here answers a press.\n locked && \"cursor-not-allowed bg-surface-2 text-muted hover:bg-surface-2\",\n isInvalid && FIELD_INVALID,\n )}\n >\n {/* The trigger stays COMPACT — flag + code only — so it never clips in a\n narrow field; the full names live in the (wider) popup (feedback\n #308). */}\n <span\n className={cn(\n \"flex items-center gap-2 min-w-0\",\n // The settled look reaches the code too: `text-primary` here would outweigh it.\n !selected ? \"text-placeholder\" : inert ? \"text-muted\" : \"text-primary\",\n )}\n >\n {selected ? (\n <>\n <CurrencyFlag country={selected.country} />\n <span className=\"font-medium\">{selected.code}</span>\n </>\n ) : (\n placeholder ?? text.currency\n )}\n </span>\n {/* No menu to drop while disabled or locked, so no chevron — the arrow is the one\n thing on the control that promises a choice (dev#474, as on Select). */}\n {!inert && <FieldChevron />}\n </button>\n );\n\n // Select's frame: the line under the trigger, or the Tooltip with a hidden copy for\n // `aria-describedby`. The wrapper `<div>` keeps `className`, so the layout holds.\n // `flex w-full items-stretch`: the trigger keeps the field's full width in it.\n const control = locked ? (\n <LockedReason lock={lock} display={disabledReasonDisplay} className=\"flex w-full items-stretch\">\n {trigger}\n </LockedReason>\n ) : (\n trigger\n );\n\n return (\n // The wrapper takes `rest`; the trigger takes the name. This field's label is a\n // floating <span> rather than a <label for>, so a caller who wants the control to\n // announce more than the code inside it has nowhere else to put it.\n <div {...rest} className={cn(\"relative\", className)}>\n {label !== undefined &&\n (labelHint === undefined ? (\n <FieldLabel>{label}</FieldLabel>\n ) : (\n // The label and its \"?\" as one row on the label's line, as FloatingField lays\n // out a static label with a hint: the row places both, the label truncates\n // and the hint keeps its width. `z-10` like FieldLabel's own: the trigger is\n // `relative` and comes later, so it would paint over the strip.\n <div className=\"pointer-events-none absolute inset-x-3 top-1 z-10 flex items-center gap-1\">\n <FieldLabel className=\"static z-auto min-w-0 max-w-none\">{label}</FieldLabel>\n <span className=\"pointer-events-auto flex shrink-0 items-center\">{labelHint}</span>\n </div>\n ))}\n {/* No label line to ride: at the field's end edge, outside the box, as an\n unlabelled Select places its FieldHint. */}\n <EndHintRow hint={label === undefined ? labelHint : undefined}>{control}</EndHintRow>\n {field.below}\n {/* Portalled to <body> and anchored to the trigger (dev#548), so where it stands\n in the flow no longer moves it. */}\n <CurrencyOptionList\n core={core}\n listboxId={listboxId}\n value={value}\n codes={options}\n currencyNames={currencyNames}\n locale={locale}\n searchPlaceholder={text.search}\n // On a phone the list is a full-screen sheet, which needs the field's own name\n // to say what it asks for (live #200).\n sheetTitle={label ?? text.currency}\n onChoose={(code) => {\n if (inert) return;\n onChange(code);\n // Back to the trigger: the panel holding focus is about to unmount, and a\n // keyboard user who has answered the field should stand on it, ready to Tab on.\n closeToTrigger();\n }}\n />\n </div>\n );\n}\n"],"mappings":";AAmRU,mBACE,KADF;AAnRV,SAAS,aAAa,aAAa;AAEnC,SAAS,cAAc,eAAe,eAAe,0BA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QAGC,CAAC,SAAS,oBAAC,gBAAa;AAAA;AAAA;AAAA,EAC3B;AAMF,QAAM,UAAU,SACd,oBAAC,gBAAa,MAAY,SAAS,uBAAuB,WAAU,6BACjE,mBACH,IAEA;AAGF;AAAA;AAAA;AAAA;AAAA,IAIE,qBAAC,SAAK,GAAG,MAAM,WAAW,GAAG,YAAY,SAAS,GAC/C;AAAA,gBAAU,WACR,cAAc,SACb,oBAAC,cAAY,iBAAM;AAAA;AAAA;AAAA;AAAA;AAAA,QAMnB,qBAAC,SAAI,WAAU,6EACb;AAAA,8BAAC,cAAW,WAAU,oCAAoC,iBAAM;AAAA,UAChE,oBAAC,UAAK,WAAU,kDAAkD,qBAAU;AAAA,WAC9E;AAAA;AAAA,MAIJ,oBAAC,cAAW,MAAM,UAAU,SAAY,YAAY,QAAY,mBAAQ;AAAA,MACvE,MAAM;AAAA,MAGP;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA,OAAO;AAAA,UACP;AAAA,UACA;AAAA,UACA,mBAAmB,KAAK;AAAA,UAGxB,YAAY,SAAS,KAAK;AAAA,UAC1B,UAAU,CAAC,SAAS;AAClB,gBAAI,MAAO;AACX,qBAAS,IAAI;AAGb,2BAAe;AAAA,UACjB;AAAA;AAAA,MACF;AAAA,OACF;AAAA;AAEJ;","names":[]}
@@ -298,14 +298,14 @@ export interface DangerConfirmProps extends Omit<ComponentPropsWithRef<"div">, "
298
298
  tone?: "danger" | "warning";
299
299
  /**
300
300
  * The confirm button's variant, apart from `tone` (0.24, keksdose). Default: what
301
- * `tone` picks, as before — `"danger"` for `"danger"`, `"primary"` for `"warning"`.
301
+ * `tone` picks, as before — `"danger"` for `"danger"`, `"default"` for `"warning"`.
302
302
  *
303
303
  * `tone` says how bad the outcome is; this says how loud the last press is, and the two
304
304
  * need not agree. keksdose's `UserActionConfirm` (an admin resets somebody else's
305
305
  * password) asks an AMBER question — what it guards against is mis-targeting, not data
306
306
  * loss, so the danger colour stays its one `severe` consequence's — and ends in a RED
307
307
  * Go, as its hand-built panel did before it moved onto this tile in 0.23; with only
308
- * `tone`, the amber question made Go the neutral primary fill. `tone="warning"
308
+ * `tone`, the amber question made Go the neutral `default` fill. `tone="warning"
309
309
  * confirmVariant="danger"` is that panel again.
310
310
  */
311
311
  confirmVariant?: ButtonVariant;
@@ -345,7 +345,7 @@ function DangerConfirm({
345
345
  {
346
346
  id: confirmId,
347
347
  type: "submit",
348
- variant: confirmVariant ?? (tone === "warning" ? "primary" : "danger"),
348
+ variant: confirmVariant ?? (tone === "warning" ? "default" : "danger"),
349
349
  disabled: !canConfirm,
350
350
  disabledReason: confirmReason,
351
351
  "aria-busy": busy || void 0,