@eifi1/ui-kit 0.31.1 → 0.32.1

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 (565) hide show
  1. package/README.md +51 -28
  2. package/dist/account/delete-account-setting.d.ts +8 -3
  3. package/dist/admin/admin-action-confirm.d.ts +8 -3
  4. package/dist/admin/admin-action-log.d.ts +1 -1
  5. package/dist/admin/admin-action-log.js +4 -2
  6. package/dist/admin/admin-action-log.js.map +1 -1
  7. package/dist/admin/invitations-panel.d.ts +8 -3
  8. package/dist/admin/invitations-panel.js +29 -26
  9. package/dist/admin/invitations-panel.js.map +1 -1
  10. package/dist/admin/reviewer-scope-editor.d.ts +8 -3
  11. package/dist/admin/role-select.d.ts +10 -5
  12. package/dist/admin/transfer-ownership-dialog.d.ts +8 -3
  13. package/dist/admin/user-roster.d.ts +10 -5
  14. package/dist/admin/user-roster.js +8 -47
  15. package/dist/admin/user-roster.js.map +1 -1
  16. package/dist/auth/auth-errors.d.ts +43 -8
  17. package/dist/auth/auth-errors.js +24 -1
  18. package/dist/auth/auth-errors.js.map +1 -1
  19. package/dist/auth/register-form.d.ts +8 -3
  20. package/dist/billing/billing-banner.d.ts +184 -0
  21. package/dist/billing/billing-banner.js +98 -0
  22. package/dist/billing/billing-banner.js.map +1 -0
  23. package/dist/billing/billing-labels.d.ts +100 -0
  24. package/dist/billing/billing-labels.js +76 -0
  25. package/dist/billing/billing-labels.js.map +1 -0
  26. package/dist/billing/billing-lock.d.ts +158 -0
  27. package/dist/billing/billing-lock.js +17 -0
  28. package/dist/billing/billing-lock.js.map +1 -0
  29. package/dist/billing/billing-standing.d.ts +149 -0
  30. package/dist/billing/billing-standing.js +28 -0
  31. package/dist/billing/billing-standing.js.map +1 -0
  32. package/dist/billing/plan-card.d.ts +248 -0
  33. package/dist/billing/plan-card.js +248 -0
  34. package/dist/billing/plan-card.js.map +1 -0
  35. package/dist/billing/plan-limit-notice.d.ts +156 -0
  36. package/dist/billing/plan-limit-notice.js +76 -0
  37. package/dist/billing/plan-limit-notice.js.map +1 -0
  38. package/dist/billing/plan-limit.d.ts +34 -0
  39. package/dist/billing/plan-limit.js +20 -0
  40. package/dist/billing/plan-limit.js.map +1 -0
  41. package/dist/billing/plan-price.d.ts +61 -0
  42. package/dist/billing/plan-price.js +45 -0
  43. package/dist/billing/plan-price.js.map +1 -0
  44. package/dist/billing/subscription-actions.d.ts +133 -0
  45. package/dist/billing/subscription-actions.js +28 -0
  46. package/dist/billing/subscription-actions.js.map +1 -0
  47. package/dist/billing/subscription-status-chip.d.ts +149 -0
  48. package/dist/billing/subscription-status-chip.js +48 -0
  49. package/dist/billing/subscription-status-chip.js.map +1 -0
  50. package/dist/chart.d.ts +9 -3
  51. package/dist/chart.js.map +1 -1
  52. package/dist/components/account-chips.d.ts +16 -4
  53. package/dist/components/account-chips.js +21 -3
  54. package/dist/components/account-chips.js.map +1 -1
  55. package/dist/components/alert-banner.d.ts +6 -1
  56. package/dist/components/alert-banner.js +5 -4
  57. package/dist/components/alert-banner.js.map +1 -1
  58. package/dist/components/amount-input.d.ts +8 -3
  59. package/dist/components/amount-input.js +5 -5
  60. package/dist/components/amount-input.js.map +1 -1
  61. package/dist/components/appearance-labels.d.ts +38 -0
  62. package/dist/components/appearance-labels.js +19 -0
  63. package/dist/components/appearance-labels.js.map +1 -0
  64. package/dist/components/autocomplete.js +2 -2
  65. package/dist/components/autocomplete.js.map +1 -1
  66. package/dist/components/breadcrumbs.js +3 -2
  67. package/dist/components/breadcrumbs.js.map +1 -1
  68. package/dist/components/bulk-action-bar.d.ts +2 -2
  69. package/dist/components/bulk-action-bar.js +7 -12
  70. package/dist/components/bulk-action-bar.js.map +1 -1
  71. package/dist/components/button-group.d.ts +8 -3
  72. package/dist/components/button-group.js +7 -1
  73. package/dist/components/button-group.js.map +1 -1
  74. package/dist/components/calculator.d.ts +8 -3
  75. package/dist/components/calculator.js +4 -3
  76. package/dist/components/calculator.js.map +1 -1
  77. package/dist/components/calendar-heatmap.js +5 -5
  78. package/dist/components/calendar-heatmap.js.map +1 -1
  79. package/dist/components/chart-height.d.ts +23 -0
  80. package/dist/components/chart-height.js +15 -0
  81. package/dist/components/chart-height.js.map +1 -0
  82. package/dist/components/chart-zoom.js +6 -1
  83. package/dist/components/chart-zoom.js.map +1 -1
  84. package/dist/components/checkbox-group.js +2 -2
  85. package/dist/components/checkbox-group.js.map +1 -1
  86. package/dist/components/checkbox.d.ts +10 -0
  87. package/dist/components/checkbox.js +25 -10
  88. package/dist/components/checkbox.js.map +1 -1
  89. package/dist/components/chip.d.ts +19 -3
  90. package/dist/components/chip.js +54 -23
  91. package/dist/components/chip.js.map +1 -1
  92. package/dist/components/choice-card.d.ts +1 -1
  93. package/dist/components/choice-card.js +9 -8
  94. package/dist/components/choice-card.js.map +1 -1
  95. package/dist/components/column-mapper.js +1 -1
  96. package/dist/components/column-mapper.js.map +1 -1
  97. package/dist/components/combobox-core.js +8 -7
  98. package/dist/components/combobox-core.js.map +1 -1
  99. package/dist/components/combobox.js +8 -8
  100. package/dist/components/combobox.js.map +1 -1
  101. package/dist/components/confirm-dialog.d.ts +8 -3
  102. package/dist/components/copy-button.d.ts +10 -5
  103. package/dist/components/country-select.js +1 -1
  104. package/dist/components/country-select.js.map +1 -1
  105. package/dist/components/currency-select.js +3 -3
  106. package/dist/components/currency-select.js.map +1 -1
  107. package/dist/components/danger-confirm.d.ts +8 -3
  108. package/dist/components/data-table-cells.d.ts +1 -1
  109. package/dist/components/data-table-filter-popover.d.ts +1 -1
  110. package/dist/components/data-table-filter-popover.js +4 -1
  111. package/dist/components/data-table-filter-popover.js.map +1 -1
  112. package/dist/components/data-table-filters.d.ts +1 -1
  113. package/dist/components/data-table-labels.d.ts +1 -1
  114. package/dist/components/data-table-pagination.d.ts +3 -2
  115. package/dist/components/data-table-pagination.js +15 -6
  116. package/dist/components/data-table-pagination.js.map +1 -1
  117. package/dist/components/data-table.d.ts +1 -1
  118. package/dist/components/data-table.js +123 -52
  119. package/dist/components/data-table.js.map +1 -1
  120. package/dist/components/date-picker.d.ts +1 -1
  121. package/dist/components/date-picker.js +18 -6
  122. package/dist/components/date-picker.js.map +1 -1
  123. package/dist/components/description-list.js +2 -2
  124. package/dist/components/description-list.js.map +1 -1
  125. package/dist/components/dialog-frame.js +2 -1
  126. package/dist/components/dialog-frame.js.map +1 -1
  127. package/dist/components/disclosure.js +3 -2
  128. package/dist/components/disclosure.js.map +1 -1
  129. package/dist/components/dropdown.d.ts +1 -1
  130. package/dist/components/dropdown.js +7 -1
  131. package/dist/components/dropdown.js.map +1 -1
  132. package/dist/components/facing-pair.d.ts +19 -6
  133. package/dist/components/facing-pair.js +3 -2
  134. package/dist/components/facing-pair.js.map +1 -1
  135. package/dist/components/field-parts.d.ts +102 -6
  136. package/dist/components/field-parts.js +81 -6
  137. package/dist/components/field-parts.js.map +1 -1
  138. package/dist/components/field-sync.d.ts +4 -1
  139. package/dist/components/field-sync.js +12 -2
  140. package/dist/components/field-sync.js.map +1 -1
  141. package/dist/components/field.js +2 -2
  142. package/dist/components/field.js.map +1 -1
  143. package/dist/components/file-button.d.ts +8 -3
  144. package/dist/components/file-dropzone.d.ts +8 -3
  145. package/dist/components/floating-panel.js +7 -4
  146. package/dist/components/floating-panel.js.map +1 -1
  147. package/dist/components/focus-ring.d.ts +12 -0
  148. package/dist/components/focus-ring.js +8 -0
  149. package/dist/components/focus-ring.js.map +1 -0
  150. package/dist/components/form-actions.d.ts +8 -3
  151. package/dist/components/form-actions.js +33 -19
  152. package/dist/components/form-actions.js.map +1 -1
  153. package/dist/components/full-bleed-dialog.d.ts +11 -1
  154. package/dist/components/full-bleed-dialog.js +3 -1
  155. package/dist/components/full-bleed-dialog.js.map +1 -1
  156. package/dist/components/iban-input.d.ts +8 -3
  157. package/dist/components/image-grid.js +1 -1
  158. package/dist/components/image-grid.js.map +1 -1
  159. package/dist/components/inline-edit-field.js +10 -4
  160. package/dist/components/inline-edit-field.js.map +1 -1
  161. package/dist/components/language-select.d.ts +8 -3
  162. package/dist/components/legal-page.d.ts +26 -5
  163. package/dist/components/legal-page.js +3 -1
  164. package/dist/components/legal-page.js.map +1 -1
  165. package/dist/components/legal.d.ts +8 -3
  166. package/dist/components/legal.js +2 -1
  167. package/dist/components/legal.js.map +1 -1
  168. package/dist/components/lightbox.js +24 -2
  169. package/dist/components/lightbox.js.map +1 -1
  170. package/dist/components/line-items.js +2 -1
  171. package/dist/components/line-items.js.map +1 -1
  172. package/dist/components/list.d.ts +5 -0
  173. package/dist/components/list.js +13 -9
  174. package/dist/components/list.js.map +1 -1
  175. package/dist/components/measured-grid.d.ts +3 -1
  176. package/dist/components/measured-grid.js +38 -20
  177. package/dist/components/measured-grid.js.map +1 -1
  178. package/dist/components/menu-item.js +2 -1
  179. package/dist/components/menu-item.js.map +1 -1
  180. package/dist/components/mini-calendar.js +8 -4
  181. package/dist/components/mini-calendar.js.map +1 -1
  182. package/dist/components/money-field.d.ts +8 -3
  183. package/dist/components/month-picker.js +50 -39
  184. package/dist/components/month-picker.js.map +1 -1
  185. package/dist/components/nav-pills.js +1 -1
  186. package/dist/components/nav-pills.js.map +1 -1
  187. package/dist/components/number-field.d.ts +8 -3
  188. package/dist/components/number-input.d.ts +11 -4
  189. package/dist/components/number-input.js +8 -6
  190. package/dist/components/number-input.js.map +1 -1
  191. package/dist/components/numpad-sheet.d.ts +8 -3
  192. package/dist/components/numpad-sheet.js +2 -1
  193. package/dist/components/numpad-sheet.js.map +1 -1
  194. package/dist/components/one-time-code-input.js +2 -2
  195. package/dist/components/one-time-code-input.js.map +1 -1
  196. package/dist/components/page-contents.js +2 -2
  197. package/dist/components/page-contents.js.map +1 -1
  198. package/dist/components/phone-input.d.ts +8 -3
  199. package/dist/components/phone-input.js +4 -4
  200. package/dist/components/phone-input.js.map +1 -1
  201. package/dist/components/pie-chart.d.ts +8 -2
  202. package/dist/components/pie-chart.js +11 -7
  203. package/dist/components/pie-chart.js.map +1 -1
  204. package/dist/components/popover.d.ts +9 -1
  205. package/dist/components/popover.js +8 -4
  206. package/dist/components/popover.js.map +1 -1
  207. package/dist/components/row-actions.d.ts +100 -0
  208. package/dist/components/row-actions.js +231 -0
  209. package/dist/components/row-actions.js.map +1 -0
  210. package/dist/components/scroll-area.js +1 -1
  211. package/dist/components/scroll-area.js.map +1 -1
  212. package/dist/components/search-field.js +3 -2
  213. package/dist/components/search-field.js.map +1 -1
  214. package/dist/components/series-chart-budget.d.ts +30 -7
  215. package/dist/components/series-chart-budget.js +12 -4
  216. package/dist/components/series-chart-budget.js.map +1 -1
  217. package/dist/components/series-chart-ticks.d.ts +7 -1
  218. package/dist/components/series-chart-ticks.js +6 -0
  219. package/dist/components/series-chart-ticks.js.map +1 -1
  220. package/dist/components/series-chart.d.ts +58 -28
  221. package/dist/components/series-chart.js +42 -32
  222. package/dist/components/series-chart.js.map +1 -1
  223. package/dist/components/settings-fields.d.ts +57 -8
  224. package/dist/components/settings-fields.js +39 -1
  225. package/dist/components/settings-fields.js.map +1 -1
  226. package/dist/components/share-card.d.ts +11 -6
  227. package/dist/components/share-card.js +8 -2
  228. package/dist/components/share-card.js.map +1 -1
  229. package/dist/components/sign-chip.d.ts +4 -0
  230. package/dist/components/sign-chip.js +17 -4
  231. package/dist/components/sign-chip.js.map +1 -1
  232. package/dist/components/signature-pad.d.ts +3 -1
  233. package/dist/components/signature-pad.js +8 -5
  234. package/dist/components/signature-pad.js.map +1 -1
  235. package/dist/components/slider.js +7 -6
  236. package/dist/components/slider.js.map +1 -1
  237. package/dist/components/sparkline.d.ts +5 -1
  238. package/dist/components/sparkline.js +4 -2
  239. package/dist/components/sparkline.js.map +1 -1
  240. package/dist/components/stat-tile.d.ts +17 -1
  241. package/dist/components/stat-tile.js +48 -20
  242. package/dist/components/stat-tile.js.map +1 -1
  243. package/dist/components/status-dot.d.ts +4 -0
  244. package/dist/components/status-dot.js +9 -2
  245. package/dist/components/status-dot.js.map +1 -1
  246. package/dist/components/swipeable-row.js +10 -2
  247. package/dist/components/swipeable-row.js.map +1 -1
  248. package/dist/components/switch.d.ts +21 -7
  249. package/dist/components/switch.js +24 -11
  250. package/dist/components/switch.js.map +1 -1
  251. package/dist/components/table.js +2 -2
  252. package/dist/components/table.js.map +1 -1
  253. package/dist/components/text-link.d.ts +8 -3
  254. package/dist/components/text-link.js +1 -1
  255. package/dist/components/text-link.js.map +1 -1
  256. package/dist/components/text.d.ts +7 -2
  257. package/dist/components/text.js +5 -5
  258. package/dist/components/text.js.map +1 -1
  259. package/dist/components/tile-radio.js +2 -1
  260. package/dist/components/tile-radio.js.map +1 -1
  261. package/dist/components/time-input.d.ts +8 -3
  262. package/dist/components/toast.d.ts +18 -2
  263. package/dist/components/toast.js +8 -5
  264. package/dist/components/toast.js.map +1 -1
  265. package/dist/components/toggle-group.d.ts +25 -3
  266. package/dist/components/toggle-group.js +40 -11
  267. package/dist/components/toggle-group.js.map +1 -1
  268. package/dist/components/toggle-legend.d.ts +10 -1
  269. package/dist/components/toggle-legend.js +21 -7
  270. package/dist/components/toggle-legend.js.map +1 -1
  271. package/dist/components/translation-review-editor.js +1 -1
  272. package/dist/components/translation-review-editor.js.map +1 -1
  273. package/dist/components/translation-review-parts.d.ts +4 -0
  274. package/dist/components/translation-review.d.ts +4 -0
  275. package/dist/components/translation-review.js +3 -3
  276. package/dist/components/translation-review.js.map +1 -1
  277. package/dist/components/tree-view.js +3 -2
  278. package/dist/components/tree-view.js.map +1 -1
  279. package/dist/components/treemap.d.ts +5 -2
  280. package/dist/components/treemap.js +33 -16
  281. package/dist/components/treemap.js.map +1 -1
  282. package/dist/components/ui.d.ts +8 -3
  283. package/dist/components/ui.js +207 -119
  284. package/dist/components/ui.js.map +1 -1
  285. package/dist/components/use-table-state.d.ts +1 -1
  286. package/dist/components/user-avatar.d.ts +5 -1
  287. package/dist/components/user-avatar.js +1 -1
  288. package/dist/components/user-avatar.js.map +1 -1
  289. package/dist/components/wizard-stepper.js +20 -14
  290. package/dist/components/wizard-stepper.js.map +1 -1
  291. package/dist/{data-table-labels-DUELeXpa.d.ts → data-table-labels-kpAAVi6g.d.ts} +26 -2
  292. package/dist/data-table.d.ts +1 -1
  293. package/dist/{delete-account-setting-CpIhzxxZ.d.ts → delete-account-setting-FLyJf-kZ.d.ts} +642 -60
  294. package/dist/demo/demo-banner.js +1 -0
  295. package/dist/demo/demo-banner.js.map +1 -1
  296. package/dist/feedback/feedback-attachment.d.ts +8 -3
  297. package/dist/feedback/feedback-context.d.ts +8 -3
  298. package/dist/feedback/feedback-crash.d.ts +8 -3
  299. package/dist/feedback/feedback-dialog.d.ts +8 -3
  300. package/dist/feedback/feedback-dialog.js +3 -3
  301. package/dist/feedback/feedback-dialog.js.map +1 -1
  302. package/dist/feedback/feedback-inbox.d.ts +8 -3
  303. package/dist/feedback/feedback-inbox.js +2 -2
  304. package/dist/feedback/feedback-inbox.js.map +1 -1
  305. package/dist/feedback/feedback-labels.d.ts +8 -3
  306. package/dist/feedback/feedback-menu.d.ts +9 -4
  307. package/dist/feedback/feedback-record.d.ts +8 -3
  308. package/dist/feedback/feedback-row-detail.d.ts +8 -3
  309. package/dist/feedback/feedback-status-undo.d.ts +8 -3
  310. package/dist/feedback/feedback-submit.d.ts +8 -3
  311. package/dist/feedback/feedback-swipe.d.ts +8 -3
  312. package/dist/feedback/feedback-table.d.ts +8 -3
  313. package/dist/feedback/feedback-thread.d.ts +8 -3
  314. package/dist/feedback/feedback-thread.js +3 -3
  315. package/dist/feedback/feedback-thread.js.map +1 -1
  316. package/dist/feedback.d.ts +8 -3
  317. package/dist/hooks/use-anchored-panel.d.ts +32 -3
  318. package/dist/hooks/use-anchored-panel.js +21 -3
  319. package/dist/hooks/use-anchored-panel.js.map +1 -1
  320. package/dist/hooks/use-breakpoint.d.ts +88 -0
  321. package/dist/hooks/use-breakpoint.js +50 -0
  322. package/dist/hooks/use-breakpoint.js.map +1 -0
  323. package/dist/hooks/use-file-drop.d.ts +8 -3
  324. package/dist/hooks/use-large-text.d.ts +29 -0
  325. package/dist/hooks/use-large-text.js +20 -0
  326. package/dist/hooks/use-large-text.js.map +1 -0
  327. package/dist/hooks/use-windowed-rows.d.ts +52 -8
  328. package/dist/hooks/use-windowed-rows.js +94 -5
  329. package/dist/hooks/use-windowed-rows.js.map +1 -1
  330. package/dist/i18n/defaults.d.ts +8 -3
  331. package/dist/i18n/defaults.js +8 -0
  332. package/dist/i18n/defaults.js.map +1 -1
  333. package/dist/i18n/german.d.ts +8 -3
  334. package/dist/i18n/german.js +94 -3
  335. package/dist/i18n/german.js.map +1 -1
  336. package/dist/i18n/kit-labels.d.ts +8 -3
  337. package/dist/i18n/kit-labels.js.map +1 -1
  338. package/dist/i18n/languages.d.ts +10 -5
  339. package/dist/i18n/locales/de-CH.d.ts +8 -3
  340. package/dist/i18n/locales/en.d.ts +8 -3
  341. package/dist/i18n/locales/es.d.ts +8 -3
  342. package/dist/i18n/locales/es.js +89 -3
  343. package/dist/i18n/locales/es.js.map +1 -1
  344. package/dist/i18n/locales/fr.d.ts +8 -3
  345. package/dist/i18n/locales/fr.js +91 -3
  346. package/dist/i18n/locales/fr.js.map +1 -1
  347. package/dist/i18n/locales/hu.d.ts +8 -3
  348. package/dist/i18n/locales/hu.js +91 -3
  349. package/dist/i18n/locales/hu.js.map +1 -1
  350. package/dist/i18n/locales/it.d.ts +8 -3
  351. package/dist/i18n/locales/it.js +92 -3
  352. package/dist/i18n/locales/it.js.map +1 -1
  353. package/dist/i18n/locales/zh.d.ts +8 -3
  354. package/dist/i18n/locales/zh.js +89 -3
  355. package/dist/i18n/locales/zh.js.map +1 -1
  356. package/dist/i18n/review.d.ts +8 -3
  357. package/dist/i18n/review.js +15 -1
  358. package/dist/i18n/review.js.map +1 -1
  359. package/dist/index.d.ts +27 -11
  360. package/dist/index.js +77 -4
  361. package/dist/index.js.map +1 -1
  362. package/dist/landing/landing-actions.d.ts +8 -3
  363. package/dist/landing/landing-sections.d.ts +8 -3
  364. package/dist/landing/landing-sections.js +7 -3
  365. package/dist/landing/landing-sections.js.map +1 -1
  366. package/dist/landing/public-header.d.ts +9 -4
  367. package/dist/landing/public-header.js +3 -3
  368. package/dist/landing/public-header.js.map +1 -1
  369. package/dist/landing/routing.d.ts +8 -3
  370. package/dist/lib/cn.js +3 -2
  371. package/dist/lib/cn.js.map +1 -1
  372. package/dist/rhf/fields.d.ts +8 -3
  373. package/dist/rhf/fields.js +1 -1
  374. package/dist/rhf/fields.js.map +1 -1
  375. package/dist/rhf/form.d.ts +8 -3
  376. package/dist/rhf/form.js +2 -2
  377. package/dist/rhf/form.js.map +1 -1
  378. package/dist/rhf.d.ts +8 -3
  379. package/dist/search/command-palette.d.ts +1 -1
  380. package/dist/search/command-palette.js +9 -8
  381. package/dist/search/command-palette.js.map +1 -1
  382. package/dist/settings/settings-layout.js +2 -1
  383. package/dist/settings/settings-layout.js.map +1 -1
  384. package/dist/settings/settings-section.d.ts +8 -3
  385. package/dist/settings/use-account-appearance.d.ts +92 -0
  386. package/dist/settings/use-account-appearance.js +63 -0
  387. package/dist/settings/use-account-appearance.js.map +1 -0
  388. package/dist/settings/use-settings-route.d.ts +1 -1
  389. package/dist/settings/use-settings-route.js +2 -3
  390. package/dist/settings/use-settings-route.js.map +1 -1
  391. package/dist/shell/app-shell.d.ts +12 -171
  392. package/dist/shell/app-shell.js +144 -28
  393. package/dist/shell/app-shell.js.map +1 -1
  394. package/dist/shell/auth-layout.js +1 -1
  395. package/dist/shell/auth-layout.js.map +1 -1
  396. package/dist/shell/option-switcher-menu.js +1 -1
  397. package/dist/shell/option-switcher-menu.js.map +1 -1
  398. package/dist/shell/top-bar-brand.d.ts +8 -3
  399. package/dist/shell/top-bar-brand.js +3 -1
  400. package/dist/shell/top-bar-brand.js.map +1 -1
  401. package/dist/shell/topbar-action-menu.d.ts +4 -0
  402. package/dist/shell/topbar-action-menu.js +3 -3
  403. package/dist/shell/topbar-action-menu.js.map +1 -1
  404. package/dist/shell/topbar-controls.js +4 -4
  405. package/dist/shell/topbar-controls.js.map +1 -1
  406. package/dist/shell.d.ts +9 -5
  407. package/dist/theme/contrast-tokens.d.ts +41 -0
  408. package/dist/theme/contrast-tokens.js +59 -0
  409. package/dist/theme/contrast-tokens.js.map +1 -0
  410. package/dist/theme/contrast.d.ts +110 -0
  411. package/dist/theme/contrast.js +128 -0
  412. package/dist/theme/contrast.js.map +1 -0
  413. package/dist/theme/palette-presets.d.ts +12 -1
  414. package/dist/theme/palette-presets.js +9 -4
  415. package/dist/theme/palette-presets.js.map +1 -1
  416. package/dist/theme/palette-store.js.map +1 -1
  417. package/dist/theme/text-size.d.ts +173 -0
  418. package/dist/theme/text-size.js +121 -0
  419. package/dist/theme/text-size.js.map +1 -0
  420. package/dist/wizard/stepper-nav.d.ts +8 -3
  421. package/dist/wizard/wizard-summary.js +1 -1
  422. package/dist/wizard/wizard-summary.js.map +1 -1
  423. package/dist/wizard.d.ts +8 -3
  424. package/package.json +1 -1
  425. package/src/admin/admin-action-log.tsx +6 -1
  426. package/src/admin/invitations-panel.tsx +36 -29
  427. package/src/admin/user-roster.tsx +17 -72
  428. package/src/auth/auth-errors.ts +68 -7
  429. package/src/billing/billing-banner.tsx +205 -0
  430. package/src/billing/billing-labels.ts +240 -0
  431. package/src/billing/billing-lock.ts +75 -0
  432. package/src/billing/billing-standing.ts +72 -0
  433. package/src/billing/plan-card.tsx +458 -0
  434. package/src/billing/plan-limit-notice.tsx +145 -0
  435. package/src/billing/plan-limit.ts +53 -0
  436. package/src/billing/plan-price.ts +101 -0
  437. package/src/billing/subscription-actions.tsx +76 -0
  438. package/src/billing/subscription-status-chip.tsx +95 -0
  439. package/src/chart.ts +2 -0
  440. package/src/components/account-chips.tsx +36 -10
  441. package/src/components/alert-banner.tsx +16 -7
  442. package/src/components/amount-input.tsx +5 -5
  443. package/src/components/appearance-labels.ts +47 -0
  444. package/src/components/autocomplete.tsx +2 -2
  445. package/src/components/breadcrumbs.tsx +3 -3
  446. package/src/components/bulk-action-bar.tsx +11 -14
  447. package/src/components/button-group.tsx +21 -0
  448. package/src/components/calculator.tsx +4 -3
  449. package/src/components/calendar-heatmap.tsx +5 -5
  450. package/src/components/chart-height.ts +30 -0
  451. package/src/components/chart-zoom.tsx +6 -1
  452. package/src/components/checkbox-group.tsx +2 -2
  453. package/src/components/checkbox.tsx +62 -20
  454. package/src/components/chip.tsx +139 -30
  455. package/src/components/choice-card.tsx +16 -11
  456. package/src/components/column-mapper.tsx +1 -1
  457. package/src/components/combobox-core.tsx +8 -7
  458. package/src/components/combobox.tsx +8 -8
  459. package/src/components/country-select.tsx +1 -1
  460. package/src/components/currency-select.tsx +3 -3
  461. package/src/components/data-table-filter-popover.tsx +7 -1
  462. package/src/components/data-table-pagination.tsx +60 -31
  463. package/src/components/data-table.tsx +164 -43
  464. package/src/components/date-picker.tsx +44 -10
  465. package/src/components/description-list.tsx +2 -2
  466. package/src/components/dialog-frame.tsx +2 -1
  467. package/src/components/disclosure.tsx +3 -2
  468. package/src/components/dropdown.tsx +10 -2
  469. package/src/components/facing-pair.ts +12 -5
  470. package/src/components/field-parts.tsx +190 -7
  471. package/src/components/field-sync.tsx +17 -3
  472. package/src/components/field.tsx +2 -2
  473. package/src/components/floating-panel.tsx +7 -4
  474. package/src/components/focus-ring.ts +12 -0
  475. package/src/components/form-actions.tsx +55 -18
  476. package/src/components/full-bleed-dialog.tsx +18 -4
  477. package/src/components/image-grid.tsx +1 -1
  478. package/src/components/inline-edit-field.tsx +26 -4
  479. package/src/components/legal-page.tsx +28 -2
  480. package/src/components/legal.tsx +19 -1
  481. package/src/components/lightbox.tsx +24 -2
  482. package/src/components/line-items.tsx +7 -1
  483. package/src/components/list.tsx +36 -10
  484. package/src/components/measured-grid.tsx +49 -24
  485. package/src/components/menu-item.tsx +2 -2
  486. package/src/components/mini-calendar.tsx +8 -4
  487. package/src/components/month-picker.tsx +15 -6
  488. package/src/components/nav-pills.tsx +1 -1
  489. package/src/components/number-input.tsx +14 -7
  490. package/src/components/numpad-sheet.tsx +2 -2
  491. package/src/components/one-time-code-input.tsx +2 -2
  492. package/src/components/page-contents.tsx +2 -2
  493. package/src/components/phone-input.tsx +9 -4
  494. package/src/components/pie-chart.tsx +19 -9
  495. package/src/components/popover.tsx +22 -5
  496. package/src/components/row-actions.tsx +450 -0
  497. package/src/components/scroll-area.tsx +1 -1
  498. package/src/components/search-field.tsx +4 -2
  499. package/src/components/series-chart-budget.ts +40 -8
  500. package/src/components/series-chart-ticks.ts +10 -0
  501. package/src/components/series-chart.tsx +123 -72
  502. package/src/components/settings-fields.tsx +89 -5
  503. package/src/components/share-card.tsx +31 -2
  504. package/src/components/sign-chip.tsx +28 -4
  505. package/src/components/signature-pad.tsx +13 -7
  506. package/src/components/slider.tsx +22 -9
  507. package/src/components/sparkline.tsx +11 -3
  508. package/src/components/stat-tile.tsx +70 -14
  509. package/src/components/status-dot.tsx +25 -2
  510. package/src/components/swipeable-row.tsx +10 -2
  511. package/src/components/switch.tsx +57 -23
  512. package/src/components/table.tsx +2 -2
  513. package/src/components/text-link.tsx +1 -1
  514. package/src/components/text.tsx +11 -6
  515. package/src/components/tile-radio.tsx +4 -1
  516. package/src/components/toast.tsx +27 -7
  517. package/src/components/toggle-group.tsx +115 -14
  518. package/src/components/toggle-legend.tsx +53 -8
  519. package/src/components/translation-review-editor.tsx +1 -1
  520. package/src/components/translation-review.tsx +11 -5
  521. package/src/components/tree-view.tsx +3 -2
  522. package/src/components/treemap.tsx +27 -10
  523. package/src/components/ui.tsx +353 -153
  524. package/src/components/user-avatar.tsx +1 -1
  525. package/src/components/wizard-stepper.tsx +5 -1
  526. package/src/demo/demo-banner.tsx +5 -0
  527. package/src/feedback/feedback-dialog.tsx +3 -3
  528. package/src/feedback/feedback-inbox.tsx +2 -2
  529. package/src/feedback/feedback-thread.tsx +3 -3
  530. package/src/hooks/use-anchored-panel.ts +67 -5
  531. package/src/hooks/use-breakpoint.ts +132 -0
  532. package/src/hooks/use-large-text.ts +41 -0
  533. package/src/hooks/use-windowed-rows.ts +168 -12
  534. package/src/i18n/defaults.ts +8 -0
  535. package/src/i18n/german.ts +107 -0
  536. package/src/i18n/kit-labels.tsx +12 -0
  537. package/src/i18n/locales/es.ts +98 -0
  538. package/src/i18n/locales/fr.ts +102 -0
  539. package/src/i18n/locales/hu.ts +100 -0
  540. package/src/i18n/locales/it.ts +103 -0
  541. package/src/i18n/locales/zh.ts +94 -0
  542. package/src/i18n/review.ts +14 -0
  543. package/src/index.ts +76 -6
  544. package/src/landing/landing-sections.tsx +7 -3
  545. package/src/landing/public-header.tsx +4 -4
  546. package/src/lib/cn.ts +13 -2
  547. package/src/rhf/fields.tsx +1 -1
  548. package/src/rhf/form.tsx +2 -2
  549. package/src/search/command-palette.tsx +10 -9
  550. package/src/settings/settings-layout.tsx +2 -1
  551. package/src/settings/use-account-appearance.ts +148 -0
  552. package/src/settings/use-settings-route.ts +3 -4
  553. package/src/shell/app-shell.tsx +278 -54
  554. package/src/shell/auth-layout.tsx +1 -1
  555. package/src/shell/option-switcher-menu.tsx +1 -1
  556. package/src/shell/top-bar-brand.tsx +3 -1
  557. package/src/shell/topbar-action-menu.tsx +3 -3
  558. package/src/shell/topbar-controls.tsx +4 -4
  559. package/src/theme/contrast-tokens.ts +112 -0
  560. package/src/theme/contrast.ts +225 -0
  561. package/src/theme/palette-presets.ts +24 -4
  562. package/src/theme/palette-store.ts +6 -1
  563. package/src/theme/text-size.ts +283 -0
  564. package/src/wizard/wizard-summary.tsx +4 -2
  565. package/tokens.css +158 -8
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/text.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\n\n/* ── SectionLabel ─────────────────────────────────────────────────────────── */\n\n/**\n * `xs` is 10px — the size `LegendGroup`'s title and the top-bar menus' heading row draw;\n * `sm` (default) is 12px — the size `StatTile`'s label and lenkbank's section headings\n * (control-page.tsx:119/123/127) draw. Two sizes because the label sits either inside a\n * dense panel (a legend, a menu) or above a block of page content, and one size looked\n * wrong in the other place.\n *\n * `md` (0.11.0) is 11px, the rung between them: keksdose's budget-summary card labels\n * its figures (\"Assigned\", \"Activity\", \"Upcoming\", \"Available\" —\n * budget-summary-card:258/264/286/297) and its support thread its day divider and a message's meta line\n * (support-thread:153/223) at `text-[11px]` by hand — 10px read as a footnote under a\n * figure that size, 12px competed with it. Named `md` rather than slotted in order\n * because `sm` was already the default and renaming it would move every caller.\n *\n * `md` is also the heading over a CHART COLUMN (lenkbank P9): the small label centred\n * over each of a pair of facing charts, or over each column of a small-multiples grid.\n * There the label names a plot, not a section of the page, so `sm` (12px, the page's\n * section heading) out-ranks the card title above it, and `xs` (10px, a legend's\n * title) sinks below the axis ticks it sits beside. Rule of thumb: `xs` inside a\n * control (legend, menu), `md` over a figure or a plot, `sm` over a block of page\n * content.\n */\nexport type SectionLabelSize = \"xs\" | \"md\" | \"sm\";\n\n/**\n * The small, uppercase, tracked, muted label — as a class string, per size.\n *\n * Exported because `LegendGroup` and `StatTile` already draw it inline, and a class a\n * caller has to position itself (a `<th>`, a `<legend>`, a menu `<li>`) is better\n * reached as a string than wrapped in a component that only takes a `className`. The\n * uppercase is CSS, so a screen reader reads the text as written: write it in normal\n * case.\n */\nexport const SECTION_LABEL_CLASS: Record<SectionLabelSize, string> = {\n xs: \"text-[10px] font-semibold uppercase tracking-wide text-[var(--text-muted)]\",\n md: \"text-[11px] font-semibold uppercase tracking-wide text-[var(--text-muted)]\",\n sm: \"text-xs font-semibold uppercase tracking-wide text-[var(--text-muted)]\",\n};\n\n/**\n * `plain` (default): the label alone, as above.\n *\n * `band` (0.13, keksdose F5): the label on a full-width `surface-2` bar with a bottom\n * border — the day-group header of keksdose's mobile transaction list\n * (mobile-transaction-list.tsx:171), which separates one day's rows from the next.\n * Its type is kept as keksdose drew it — `font-medium` in the SECONDARY text colour,\n * not the plain label's semibold muted — so adopting the kit does not restyle a live\n * list: the bar already sets the label apart, and needs no extra weight. The padding (`px-4 py-2`) lines the text up with a\n * `ListItem density=\"comfortable\"` row below it; override it with `className` for a\n * list at another density. A sticky header is the caller's: add `sticky top-0`.\n */\nexport type SectionLabelVariant = \"plain\" | \"band\";\n\n/** The band's own type and box, per size — spelled out rather than merged over\n * {@link SECTION_LABEL_CLASS}, so the result does not hang on tailwind-merge telling\n * a font-size arbitrary `text-` value from a colour one. (Not spelt out as class\n * names here: Tailwind scans comments, and a literal one broke the showcase CSS.) */\nconst SECTION_LABEL_BAND_CLASS: Record<SectionLabelSize, string> = {\n xs: \"text-[10px]\",\n md: \"text-[11px]\",\n sm: \"text-xs\",\n};\nconst BAND =\n \"block border-b border-[var(--border)] bg-[var(--bg-surface-2)] px-4 py-2 font-medium uppercase tracking-wide text-[var(--text-secondary)]\";\n\ntype SectionLabelElement = \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"p\" | \"span\" | \"div\" | \"legend\";\n\nexport interface SectionLabelProps extends ComponentPropsWithoutRef<\"h3\"> {\n /**\n * The element — which is the heading LEVEL, and so is the caller's to pick: the kit\n * cannot know where in the outline the label sits. Default `h3`, which is what\n * lenkbank's control page writes under its `h2` card title. Pass `span` or `p` for a\n * label that is not a heading at all (a legend group's title).\n */\n as?: SectionLabelElement;\n size?: SectionLabelSize;\n /** `band` draws the label on a `surface-2` bar with a bottom border — a list's group\n * header. See {@link SectionLabelVariant}. */\n variant?: SectionLabelVariant;\n children: ReactNode;\n}\n\n/**\n * A section's small uppercase label. lenkbank spells\n * `text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400`\n * on every `<h3>` of its control page and more; keksdose's budget switcher writes the\n * 10px version on a menu row. One component, the token colour, and the level chosen\n * where the outline is known.\n */\nexport function SectionLabel({\n as = \"h3\",\n size = \"sm\",\n variant = \"plain\",\n className,\n children,\n ...rest\n}: SectionLabelProps) {\n const Tag = as as ElementType;\n const type = variant === \"band\" ? cn(SECTION_LABEL_BAND_CLASS[size], BAND) : SECTION_LABEL_CLASS[size];\n return (\n <Tag {...rest} className={cn(type, className)}>\n {children}\n </Tag>\n );\n}\n\n/* ── Caption ──────────────────────────────────────────────────────────────── */\n\n/**\n * The caption type as a class string: 11px, snug, muted. lenkbank's `CAPTION`\n * (shared/ui/caption.ts:23) — written out 31 times before it was a constant — as a\n * token colour rather than `slate-500 dark:slate-400`, so it follows the palette.\n * Exported for the same reason lenkbank's is a string: every caller positions it\n * differently (`mt-1`, `self-end pb-2`, `border-t`), and what must be one thing is the\n * type, not the box.\n */\nexport const CAPTION_CLASS = \"text-[11px] leading-snug text-[var(--text-muted)]\";\n\nexport interface CaptionProps extends ComponentPropsWithoutRef<\"p\"> {\n /** Default `p`; `span` for a caption inside a line of other content. */\n as?: \"p\" | \"span\" | \"div\";\n children: ReactNode;\n}\n\n/**\n * The small grey sentence under a field, a table or a button — prose ABOUT the thing\n * above it. Not `FieldHint`, which hides behind a field label's \"?\" so a paragraph does\n * not make one field taller than its neighbour (lenkbank feedback #27).\n */\nexport function Caption({ as = \"p\", className, children, ...rest }: CaptionProps) {\n const Tag = as as ElementType;\n return (\n <Tag {...rest} className={cn(CAPTION_CLASS, className)}>\n {children}\n </Tag>\n );\n}\n"],"mappings":";AAyGI;AAxGJ,SAAS,UAAU;AAqCZ,MAAM,sBAAwD;AAAA,EACnE,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAoBA,MAAM,2BAA6D;AAAA,EACjE,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AACA,MAAM,OACJ;AA0BK,SAAS,aAAa;AAAA,EAC3B,KAAK;AAAA,EACL,OAAO;AAAA,EACP,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,QAAM,MAAM;AACZ,QAAM,OAAO,YAAY,SAAS,GAAG,yBAAyB,IAAI,GAAG,IAAI,IAAI,oBAAoB,IAAI;AACrG,SACE,oBAAC,OAAK,GAAG,MAAM,WAAW,GAAG,MAAM,SAAS,GACzC,UACH;AAEJ;AAYO,MAAM,gBAAgB;AAatB,SAAS,QAAQ,EAAE,KAAK,KAAK,WAAW,UAAU,GAAG,KAAK,GAAiB;AAChF,QAAM,MAAM;AACZ,SACE,oBAAC,OAAK,GAAG,MAAM,WAAW,GAAG,eAAe,SAAS,GAClD,UACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/text.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\n\n/* ── SectionLabel ─────────────────────────────────────────────────────────── */\n\n/**\n * `xs` is 10px — the size `LegendGroup`'s title and the top-bar menus' heading row draw;\n * `sm` (default) is 12px — the size `StatTile`'s label and lenkbank's section headings\n * (control-page.tsx:119/123/127) draw. Two sizes because the label sits either inside a\n * dense panel (a legend, a menu) or above a block of page content, and one size looked\n * wrong in the other place.\n *\n * `md` (0.11.0) is 11px, the rung between them: keksdose's budget-summary card labels\n * its figures (\"Assigned\", \"Activity\", \"Upcoming\", \"Available\" —\n * budget-summary-card:258/264/286/297) and its support thread its day divider and a message's meta line\n * (support-thread:153/223) at `text-[11px]` by hand — 10px read as a footnote under a\n * figure that size, 12px competed with it. Named `md` rather than slotted in order\n * because `sm` was already the default and renaming it would move every caller.\n *\n * `md` is also the heading over a CHART COLUMN (lenkbank P9): the small label centred\n * over each of a pair of facing charts, or over each column of a small-multiples grid.\n * There the label names a plot, not a section of the page, so `sm` (12px, the page's\n * section heading) out-ranks the card title above it, and `xs` (10px, a legend's\n * title) sinks below the axis ticks it sits beside. Rule of thumb: `xs` inside a\n * control (legend, menu), `md` over a figure or a plot, `sm` over a block of page\n * content.\n */\nexport type SectionLabelSize = \"xs\" | \"md\" | \"sm\";\n\n/**\n * The small, uppercase, tracked, muted label — as a class string, per size.\n *\n * Exported because `LegendGroup` and `StatTile` already draw it inline, and a class a\n * caller has to position itself (a `<th>`, a `<legend>`, a menu `<li>`) is better\n * reached as a string than wrapped in a component that only takes a `className`. The\n * uppercase is CSS, so a screen reader reads the text as written: write it in normal\n * case.\n *\n * The sizes are the kit's named rem steps since 0.32 (`text-micro` 0.625rem,\n * `text-caption` 0.6875rem — 10 and 11 px at Normal), so a label grows with the text\n * size like everything around it (docs/text-size-harmonization.md §3.2).\n */\nexport const SECTION_LABEL_CLASS: Record<SectionLabelSize, string> = {\n xs: \"text-micro font-semibold uppercase tracking-wide text-[var(--text-muted)]\",\n md: \"text-caption font-semibold uppercase tracking-wide text-[var(--text-muted)]\",\n sm: \"text-xs font-semibold uppercase tracking-wide text-[var(--text-muted)]\",\n};\n\n/**\n * `plain` (default): the label alone, as above.\n *\n * `band` (0.13, keksdose F5): the label on a full-width `surface-2` bar with a bottom\n * border — the day-group header of keksdose's mobile transaction list\n * (mobile-transaction-list.tsx:171), which separates one day's rows from the next.\n * Its type is kept as keksdose drew it — `font-medium` in the SECONDARY text colour,\n * not the plain label's semibold muted — so adopting the kit does not restyle a live\n * list: the bar already sets the label apart, and needs no extra weight. The padding (`px-4 py-2`) lines the text up with a\n * `ListItem density=\"comfortable\"` row below it; override it with `className` for a\n * list at another density. A sticky header is the caller's: add `sticky top-0`.\n */\nexport type SectionLabelVariant = \"plain\" | \"band\";\n\n/** The band's own type and box, per size — spelled out rather than merged over\n * {@link SECTION_LABEL_CLASS}, so the result does not hang on tailwind-merge telling\n * a font-size arbitrary `text-` value from a colour one. (Not spelt out as class\n * names here: Tailwind scans comments, and a literal one broke the showcase CSS.) */\nconst SECTION_LABEL_BAND_CLASS: Record<SectionLabelSize, string> = {\n xs: \"text-micro\",\n md: \"text-caption\",\n sm: \"text-xs\",\n};\nconst BAND =\n \"block border-b border-[var(--border)] bg-[var(--bg-surface-2)] px-4 py-2 font-medium uppercase tracking-wide text-[var(--text-secondary)]\";\n\ntype SectionLabelElement = \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"p\" | \"span\" | \"div\" | \"legend\";\n\nexport interface SectionLabelProps extends ComponentPropsWithoutRef<\"h3\"> {\n /**\n * The element — which is the heading LEVEL, and so is the caller's to pick: the kit\n * cannot know where in the outline the label sits. Default `h3`, which is what\n * lenkbank's control page writes under its `h2` card title. Pass `span` or `p` for a\n * label that is not a heading at all (a legend group's title).\n */\n as?: SectionLabelElement;\n size?: SectionLabelSize;\n /** `band` draws the label on a `surface-2` bar with a bottom border — a list's group\n * header. See {@link SectionLabelVariant}. */\n variant?: SectionLabelVariant;\n children: ReactNode;\n}\n\n/**\n * A section's small uppercase label. lenkbank spells\n * `text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400`\n * on every `<h3>` of its control page and more; keksdose's budget switcher writes the\n * 10px version on a menu row. One component, the token colour, and the level chosen\n * where the outline is known.\n */\nexport function SectionLabel({\n as = \"h3\",\n size = \"sm\",\n variant = \"plain\",\n className,\n children,\n ...rest\n}: SectionLabelProps) {\n const Tag = as as ElementType;\n const type = variant === \"band\" ? cn(SECTION_LABEL_BAND_CLASS[size], BAND) : SECTION_LABEL_CLASS[size];\n return (\n <Tag {...rest} className={cn(type, className)}>\n {children}\n </Tag>\n );\n}\n\n/* ── Caption ──────────────────────────────────────────────────────────────── */\n\n/**\n * The caption type as a class string: `text-caption` (0.6875rem, 11 px at Normal, §3.2),\n * snug, muted. lenkbank's `CAPTION`\n * (shared/ui/caption.ts:23) — written out 31 times before it was a constant — as a\n * token colour rather than `slate-500 dark:slate-400`, so it follows the palette.\n * Exported for the same reason lenkbank's is a string: every caller positions it\n * differently (`mt-1`, `self-end pb-2`, `border-t`), and what must be one thing is the\n * type, not the box.\n */\nexport const CAPTION_CLASS = \"text-caption leading-snug text-[var(--text-muted)]\";\n\nexport interface CaptionProps extends ComponentPropsWithoutRef<\"p\"> {\n /** Default `p`; `span` for a caption inside a line of other content. */\n as?: \"p\" | \"span\" | \"div\";\n children: ReactNode;\n}\n\n/**\n * The small grey sentence under a field, a table or a button — prose ABOUT the thing\n * above it. Not `FieldHint`, which hides behind a field label's \"?\" so a paragraph does\n * not make one field taller than its neighbour (lenkbank feedback #27).\n */\nexport function Caption({ as = \"p\", className, children, ...rest }: CaptionProps) {\n const Tag = as as ElementType;\n return (\n <Tag {...rest} className={cn(CAPTION_CLASS, className)}>\n {children}\n </Tag>\n );\n}\n"],"mappings":";AA6GI;AA5GJ,SAAS,UAAU;AAyCZ,MAAM,sBAAwD;AAAA,EACnE,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAoBA,MAAM,2BAA6D;AAAA,EACjE,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AACA,MAAM,OACJ;AA0BK,SAAS,aAAa;AAAA,EAC3B,KAAK;AAAA,EACL,OAAO;AAAA,EACP,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,QAAM,MAAM;AACZ,QAAM,OAAO,YAAY,SAAS,GAAG,yBAAyB,IAAI,GAAG,IAAI,IAAI,oBAAoB,IAAI;AACrG,SACE,oBAAC,OAAK,GAAG,MAAM,WAAW,GAAG,MAAM,SAAS,GACzC,UACH;AAEJ;AAaO,MAAM,gBAAgB;AAatB,SAAS,QAAQ,EAAE,KAAK,KAAK,WAAW,UAAU,GAAG,KAAK,GAAiB;AAChF,QAAM,MAAM;AACZ,SACE,oBAAC,OAAK,GAAG,MAAM,WAAW,GAAG,eAAe,SAAS,GAClD,UACH;AAEJ;","names":[]}
@@ -3,6 +3,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useId, useRef } from "react";
4
4
  import { Ban, Check } from "lucide-react";
5
5
  import { cn } from "../lib/cn.js";
6
+ import { FOCUS_RING } from "./focus-ring.js";
6
7
  import { horizontalStep } from "../lib/direction.js";
7
8
  import { Tooltip } from "./tooltip.js";
8
9
  const TILE_SIZE = {
@@ -10,7 +11,7 @@ const TILE_SIZE = {
10
11
  md: { tile: "size-8", glyph: "size-4", swatch: "size-5" },
11
12
  lg: { tile: "size-11", glyph: "size-5", swatch: "size-6" }
12
13
  };
13
- const TILE_BASE = "relative inline-flex shrink-0 items-center justify-center rounded-md border transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--bg-surface)] disabled:cursor-not-allowed disabled:opacity-50";
14
+ const TILE_BASE = "relative inline-flex shrink-0 items-center justify-center rounded-md border transition-colors focus:outline-none " + FOCUS_RING + " focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--bg-surface)] disabled:cursor-not-allowed disabled:opacity-50";
14
15
  const TILE_IDLE = "border-[var(--border)] bg-[var(--bg-surface)] hover:border-[var(--border-strong)] hover:bg-[var(--bg-hover)]";
15
16
  const TILE_SELECTED = "border-[var(--text-primary)] bg-[var(--bg-surface)] ring-1 ring-[var(--text-primary)]";
16
17
  const TILE_LOCKED = "cursor-not-allowed opacity-50";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/tile-radio.tsx"],"sourcesContent":["import { useId, useRef } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport { Ban, Check } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { horizontalStep } from \"../lib/direction\";\nimport { Tooltip } from \"./tooltip\";\n\n/**\n * A row of square tiles that behaves as ONE radio group — the machinery\n * {@link SwatchPicker} and {@link IconPicker} are built on, public since 0.22.0 for the\n * one-of-n pickers those two do not cover (kastlan's input audit: a choice whose tiles\n * show something of the app's own — a mark, a pattern, a symbol set the kit does not\n * ship).\n *\n * Keksdose had three of these (the category colours, the category symbols, the\n * transaction flags) and all three were rows of `aria-pressed` buttons: a separate\n * tab stop per tile, and \"pressed\" on a choice that is really one-of-n. The APG radio\n * group is the shape a screen reader expects for that (\"Red, radio, 2 of 7, checked\")\n * and the one a keyboard expects too — a single tab stop, arrows to move.\n *\n * ## The container is yours\n *\n * It renders the TILES only — no wrapper — so it can sit in a layout the caller owns\n * (a wrapping row, a grid, a row beside a search box). That element must carry the\n * group's semantics, as SwatchPicker's does:\n *\n * ```tsx\n * <div role=\"radiogroup\" aria-labelledby={headingId} className=\"flex flex-wrap gap-1.5\">\n * <TileRadioGroup\n * items={[{ key: \"dots\", label: \"Dots\" }, { key: \"lines\", label: \"Lines\" }]}\n * checked={pattern}\n * onSelect={(key) => key && setPattern(key)}\n * renderTile={(item) => <PatternGlyph pattern={item.key} className={TILE_SIZE.md.glyph} />}\n * />\n * </div>\n * ```\n *\n * `role=\"radiogroup\"` and a name (`aria-label` or `aria-labelledby`) — without them a\n * screen reader hears radios that belong to nothing, and no \"2 of 7\". Set\n * `aria-disabled` on it as well when the whole group is `disabled`.\n *\n * ## What a tile is\n *\n * A square (28 / 32 / 44px, {@link TILE_SIZE}) holding `renderTile`'s content, NAMED by\n * the item's `label` (`aria-label`, so what is drawn inside is decoration) and showing\n * that label in a bubble on hover and focus — a row of unlabelled squares is the\n * complaint that put the bubble there. It is for choices that are SEEN: a colour, a\n * glyph, a pattern. A choice that has to be READ — a plan with a price and three lines\n * of features, an option with a sentence of explanation — is a {@link ChoiceCardGroup}\n * (`type=\"radio\"`): a card names its option by its title and describes it by its text,\n * where a tile would hide the text behind a bubble and repeat it.\n *\n * No strings of its own: every name is an item's `label`, the \"none\" tile's included.\n *\n * ## A tile that cannot be chosen\n *\n * `disabled` takes a tile out of the choice AND out of reach: the arrow keys skip it\n * and Tab never lands on it, so a dimmed square says nothing about why. Give it a\n * `disabledReason` instead and it stays reachable, `aria-disabled`, with the reason in\n * its bubble and its description — and choosing it does nothing (0.23, the kit's later\n * list after keksdose K3; {@link Button}'s `disabledReason`, one tile at a time).\n */\n\n/** A tile's size: 28 / 32 / 44px — see {@link TILE_SIZE}. */\nexport type TileSize = \"sm\" | \"md\" | \"lg\";\n\n/** 28 / 32 / 44px. `lg` is the touch target a phone surface wants (`min-h-11`). `glyph`\n * and `swatch` are the content sizes the kit's own pickers draw inside each — use them\n * in `renderTile` so a tile of the app's own matches theirs. */\nexport const TILE_SIZE: Record<TileSize, { tile: string; glyph: string; swatch: string }> = {\n sm: { tile: \"size-7\", glyph: \"size-3.5\", swatch: \"size-4\" },\n md: { tile: \"size-8\", glyph: \"size-4\", swatch: \"size-5\" },\n lg: { tile: \"size-11\", glyph: \"size-5\", swatch: \"size-6\" },\n};\n\n/** One tile, whatever it shows. `key` is `null` for the \"none\" entry — a tile of its\n * own that leads back to nothing, since clicking a checked tile does not uncheck it. */\nexport interface TileItem<T extends string> {\n key: T | null;\n label: string;\n /** Said after the name, and shown in the bubble under it. Marks the tile with a\n * dot, so the note is visible without hovering every tile to find it. */\n note?: string;\n /** Out of the choice and out of reach: natively disabled, skipped by the arrow keys,\n * never the tab stop. */\n disabled?: boolean;\n /**\n * Why this tile cannot be chosen right now — a colour another category already wears,\n * a symbol only an owner may set. The tile LOOKS disabled but is `aria-disabled`, not\n * `disabled`: Tab and the arrow keys still reach it, the reason shows in its bubble\n * under its name (and its `note`) and describes it, and a click, Space / Enter or an\n * arrow under automatic activation chooses nothing — the focus moves, the checked\n * tile stays. Wins over `disabled`, as on {@link Button}; the whole group's\n * `disabled` still wins over it.\n */\n disabledReason?: ReactNode;\n}\n\nexport interface TileRadioGroupProps<T extends string> {\n /** The tiles, in reading order. Render them inside a `role=\"radiogroup\"` element\n * with a name — see the module note. */\n items: TileItem<T>[];\n /** The checked key, or `undefined` for \"nothing is checked\" (the mixed state, or\n * a value that is not among the options). */\n checked: T | null | undefined;\n onSelect: (key: T | null) => void;\n /** \"automatic\" (default): an arrow key moves AND checks, the APG default. \"manual\":\n * arrows move focus only, Space or Enter checks — for a picker whose change is\n * expensive (a bulk edit that saves on every change). */\n activation?: \"automatic\" | \"manual\";\n /** Every tile disabled. Mark the container `aria-disabled` too. Default `false`. */\n disabled?: boolean;\n /** 28 / 32 / 44px tiles ({@link TILE_SIZE}). Default \"md\"; \"lg\" is the touch-target\n * size a phone surface wants. */\n size?: TileSize;\n /** What goes inside a tile — `aria-hidden` decoration, since the tile is named by\n * `label`. Not called for the `null` (\"none\") item, which shows the kit's \"no\"\n * glyph. The frame, the tick and the note's dot are drawn around it. */\n renderTile: (item: TileItem<T>, selected: boolean) => ReactNode;\n /** Extra classes for a tile, per item, merged after the kit's — so a `size-*` here\n * beats `size`'s (a tile that grows in a narrow card). */\n tileClassName?: (item: TileItem<T>, selected: boolean) => string | undefined;\n}\n\n/**\n * The tile's frame. Selection is a thicker, darker frame AND a tick in the corner —\n * never a colour change alone,\n * because the thing inside a swatch tile IS a colour, and a red frame round a red dot\n * says nothing to a reader who cannot see red.\n *\n * `focus-visible` with an offset in the surface colour, as the checkbox does: the ring\n * must not be painted in the colour of the frame it touches.\n */\nconst TILE_BASE =\n \"relative inline-flex shrink-0 items-center justify-center rounded-md border transition-colors \" +\n \"focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--bg-surface)] \" +\n \"disabled:cursor-not-allowed disabled:opacity-50\";\nconst TILE_IDLE =\n \"border-[var(--border)] bg-[var(--bg-surface)] hover:border-[var(--border-strong)] hover:bg-[var(--bg-hover)]\";\nconst TILE_SELECTED =\n \"border-[var(--text-primary)] bg-[var(--bg-surface)] ring-1 ring-[var(--text-primary)]\";\n/** A locked tile: the disabled look without `disabled` — dimmed, a not-allowed cursor. */\nconst TILE_LOCKED = \"cursor-not-allowed opacity-50\";\n/** …and no hover offer on an idle one, which cannot be chosen. Not on the selected\n * tile, whose frame IS its state. */\nconst TILE_LOCKED_IDLE = \"hover:border-[var(--border)] hover:bg-[var(--bg-surface)]\";\n\n/** `undefined`, `null`, `false` and `\"\"` are no reason — what `cond && \"…\"` gives. */\nfunction isLocked(item: TileItem<string>): boolean {\n const r = item.disabledReason;\n return r !== undefined && r !== null && r !== false && r !== \"\";\n}\n\n/** Out of reach: natively disabled. A reason keeps a `disabled` tile reachable. */\nfunction isOff(item: TileItem<string>): boolean {\n return Boolean(item.disabled) && !isLocked(item);\n}\n\n/**\n * The tiles of one radio group, without the group element — render them inside a\n * `role=\"radiogroup\"` with a name (the module note above has the example). One tab stop\n * (the checked tile, else the first that can be chosen), arrows to move — left and\n * right follow the page's direction — Home and End to the ends, and by default the\n * arrows choose as they go.\n */\nexport function TileRadioGroup<T extends string>({\n items,\n checked,\n onSelect,\n activation = \"automatic\",\n disabled = false,\n size = \"md\",\n renderTile,\n tileClassName,\n}: TileRadioGroupProps<T>) {\n const refs = useRef<Array<HTMLButtonElement | null>>([]);\n const noteId = useId();\n const reasonId = useId();\n const s = TILE_SIZE[size];\n const checkedIndex =\n checked === undefined ? -1 : items.findIndex((it) => it.key === checked);\n // The ONE tab stop: the checked tile, else the first that can be reached — the APG\n // rule, so Tab into a group with nothing checked still lands somewhere. A locked\n // tile is reachable: landing on it is how its reason is read.\n const tabStop =\n checkedIndex >= 0 && !isOff(items[checkedIndex])\n ? checkedIndex\n : items.findIndex((it) => !isOff(it));\n\n const onKeyDown = (e: KeyboardEvent<HTMLButtonElement>, index: number) => {\n // Left and right are VISUAL directions: in a right-to-left page the row runs the\n // other way. Up and down follow reading order either way — the APG's radio group\n // treats them as previous/next, and the tiles wrap, so there is no column to keep.\n const horizontal = horizontalStep(e.key, e.currentTarget);\n let step: number | \"first\" | \"last\";\n switch (horizontal ? \"horizontal\" : e.key) {\n case \"horizontal\":\n step = horizontal;\n break;\n case \"ArrowDown\":\n step = 1;\n break;\n case \"ArrowUp\":\n step = -1;\n break;\n case \"Home\":\n step = \"first\";\n break;\n case \"End\":\n step = \"last\";\n break;\n default:\n return;\n }\n e.preventDefault();\n // Locked tiles are in the walk; natively disabled ones are not.\n const enabled = items.map((it, i) => (isOff(it) ? -1 : i)).filter((i) => i >= 0);\n if (!enabled.length) return;\n const at = enabled.indexOf(index);\n let target: number;\n if (step === \"first\") target = enabled[0];\n else if (step === \"last\") target = enabled[enabled.length - 1];\n // Wrapping, as a native radio group does: the last tile's \"next\" is the first.\n else target = enabled[(at + step + enabled.length) % enabled.length];\n refs.current[target]?.focus();\n // Onto a locked tile the focus moves and the choice does not: the checked tile\n // stays checked, and the next arrow walks on from here.\n if (activation === \"automatic\" && !isLocked(items[target])) onSelect(items[target].key);\n };\n\n return (\n <>\n {items.map((item, i) => {\n const selected = i === checkedIndex;\n const locked = isLocked(item);\n const describedBy = [item.note && `${noteId}-${i}`, locked && `${reasonId}-${i}`].filter(Boolean).join(\" \");\n const button = (\n <button\n ref={(el) => {\n refs.current[i] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n aria-label={item.label}\n // The note is a DESCRIPTION, read after the name and the state, not glued\n // into the name — the punctuation between the two would be English's. So\n // is a lock's reason, after the note.\n aria-describedby={describedBy || undefined}\n tabIndex={i === tabStop ? 0 : -1}\n // A reason wins over the tile's own `disabled` (as on Button): reachable,\n // and refusing. The whole group's `disabled` still wins over both.\n disabled={disabled || isOff(item)}\n aria-disabled={(locked && !disabled) || undefined}\n // Clicking the checked tile again does nothing: a radio is not a toggle.\n // \"None\" is the way back to nothing, and it is a tile of its own. A locked\n // tile is never chosen.\n onClick={() => !selected && !locked && onSelect(item.key)}\n onKeyDown={(e) => onKeyDown(e, i)}\n className={cn(\n TILE_BASE,\n s.tile,\n selected ? TILE_SELECTED : TILE_IDLE,\n locked && TILE_LOCKED,\n locked && !selected && TILE_LOCKED_IDLE,\n tileClassName?.(item, selected),\n )}\n >\n {item.key === null ? (\n <Ban aria-hidden className={cn(s.glyph, \"text-[var(--text-muted)]\")} />\n ) : (\n renderTile(item, selected)\n )}\n {item.note && (\n <>\n {/* A dot rather than a dimmed tile: dimming reads as \"disabled\", and a\n tile with a note is entirely available. */}\n <span\n aria-hidden\n className=\"absolute end-0.5 top-0.5 size-1.5 rounded-full bg-[var(--text-muted)]\"\n />\n {/* `hidden` still serves as a description: aria-describedby reads\n hidden text, which is what keeps it out of the layout. */}\n <span id={`${noteId}-${i}`} hidden>\n {item.note}\n </span>\n </>\n )}\n {/* The reason's description is a `hidden` copy, as on a locked Button: the\n bubble exists only while hovered or focused once portalled, and a\n description that comes and goes is read inconsistently. */}\n {locked && (\n <span id={`${reasonId}-${i}`} hidden>\n {item.disabledReason}\n </span>\n )}\n {selected && <SelectedTick />}\n </button>\n );\n return (\n // The bubble is the SIGHTED user's name for the tile — eight unlabelled\n // squares are the complaint that put a bubble on Keksdose's (live #289).\n // It wraps a span rather than the button, because a Tooltip hands its\n // child an `aria-describedby`, and a tile named \"Red\" and described as\n // \"Red\" is read out twice.\n <Tooltip\n key={item.key ?? \"\\u0000none\"}\n label={\n item.note || locked ? (\n <>\n <span className=\"block\">{item.label}</span>\n {item.note && <span className=\"block font-normal text-[var(--text-muted)]\">{item.note}</span>}\n {/* The reason in the body colour: it is the news, the note is\n standing context. */}\n {locked && <span className=\"block font-normal\">{item.disabledReason}</span>}\n </>\n ) : (\n item.label\n )\n }\n portal\n >\n <span className=\"inline-flex\">{button}</span>\n </Tooltip>\n );\n })}\n </>\n );\n}\n\n/** The tick on a selected tile — a small badge in the corner, in the text colour on\n * the surface colour, so it reads the same over every swatch colour. */\nfunction SelectedTick() {\n return (\n <span\n aria-hidden\n className=\"absolute -bottom-1 -end-1 inline-flex size-3.5 items-center justify-center rounded-full bg-[var(--text-primary)] text-[var(--bg-surface)]\"\n >\n <Check strokeWidth={3} className=\"size-2.5\" />\n </span>\n );\n}\n"],"mappings":";AA6Qc,SAKA,UALA,KAKA,YALA;AA7Qd,SAAS,OAAO,cAAc;AAE9B,SAAS,KAAK,aAAa;AAC3B,SAAS,UAAU;AACnB,SAAS,sBAAsB;AAC/B,SAAS,eAAe;AAgEjB,MAAM,YAA+E;AAAA,EAC1F,IAAI,EAAE,MAAM,UAAU,OAAO,YAAY,QAAQ,SAAS;AAAA,EAC1D,IAAI,EAAE,MAAM,UAAU,OAAO,UAAU,QAAQ,SAAS;AAAA,EACxD,IAAI,EAAE,MAAM,WAAW,OAAO,UAAU,QAAQ,SAAS;AAC3D;AA4DA,MAAM,YACJ;AAGF,MAAM,YACJ;AACF,MAAM,gBACJ;AAEF,MAAM,cAAc;AAGpB,MAAM,mBAAmB;AAGzB,SAAS,SAAS,MAAiC;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1B,KAAK,QACJ,iCAGE;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,eAAW;AAAA,gBACX,WAAU;AAAA;AAAA,YACZ;AAAA,YAGA,oBAAC,UAAK,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,QAAM,MAC/B,eAAK,MACR;AAAA,aACF;AAAA,UAKD,UACC,oBAAC,UAAK,IAAI,GAAG,QAAQ,IAAI,CAAC,IAAI,QAAM,MACjC,eAAK,gBACR;AAAA,UAED,YAAY,oBAAC,gBAAa;AAAA;AAAA;AAAA,IAC7B;AAEF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAME;AAAA,QAAC;AAAA;AAAA,UAEC,OACE,KAAK,QAAQ,SACX,iCACE;AAAA,gCAAC,UAAK,WAAU,SAAS,eAAK,OAAM;AAAA,YACnC,KAAK,QAAQ,oBAAC,UAAK,WAAU,8CAA8C,eAAK,MAAK;AAAA,YAGrF,UAAU,oBAAC,UAAK,WAAU,qBAAqB,eAAK,gBAAe;AAAA,aACtE,IAEA,KAAK;AAAA,UAGT,QAAM;AAAA,UAEN,8BAAC,UAAK,WAAU,eAAe,kBAAO;AAAA;AAAA,QAhBjC,KAAK,OAAO;AAAA,MAiBnB;AAAA;AAAA,EAEJ,CAAC,GACH;AAEJ;AAIA,SAAS,eAAe;AACtB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,MACX,WAAU;AAAA,MAEV,8BAAC,SAAM,aAAa,GAAG,WAAU,YAAW;AAAA;AAAA,EAC9C;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/tile-radio.tsx"],"sourcesContent":["import { useId, useRef } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport { Ban, Check } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { FOCUS_RING } from \"./focus-ring\";\nimport { horizontalStep } from \"../lib/direction\";\nimport { Tooltip } from \"./tooltip\";\n\n/**\n * A row of square tiles that behaves as ONE radio group — the machinery\n * {@link SwatchPicker} and {@link IconPicker} are built on, public since 0.22.0 for the\n * one-of-n pickers those two do not cover (kastlan's input audit: a choice whose tiles\n * show something of the app's own — a mark, a pattern, a symbol set the kit does not\n * ship).\n *\n * Keksdose had three of these (the category colours, the category symbols, the\n * transaction flags) and all three were rows of `aria-pressed` buttons: a separate\n * tab stop per tile, and \"pressed\" on a choice that is really one-of-n. The APG radio\n * group is the shape a screen reader expects for that (\"Red, radio, 2 of 7, checked\")\n * and the one a keyboard expects too — a single tab stop, arrows to move.\n *\n * ## The container is yours\n *\n * It renders the TILES only — no wrapper — so it can sit in a layout the caller owns\n * (a wrapping row, a grid, a row beside a search box). That element must carry the\n * group's semantics, as SwatchPicker's does:\n *\n * ```tsx\n * <div role=\"radiogroup\" aria-labelledby={headingId} className=\"flex flex-wrap gap-1.5\">\n * <TileRadioGroup\n * items={[{ key: \"dots\", label: \"Dots\" }, { key: \"lines\", label: \"Lines\" }]}\n * checked={pattern}\n * onSelect={(key) => key && setPattern(key)}\n * renderTile={(item) => <PatternGlyph pattern={item.key} className={TILE_SIZE.md.glyph} />}\n * />\n * </div>\n * ```\n *\n * `role=\"radiogroup\"` and a name (`aria-label` or `aria-labelledby`) — without them a\n * screen reader hears radios that belong to nothing, and no \"2 of 7\". Set\n * `aria-disabled` on it as well when the whole group is `disabled`.\n *\n * ## What a tile is\n *\n * A square (28 / 32 / 44px, {@link TILE_SIZE}) holding `renderTile`'s content, NAMED by\n * the item's `label` (`aria-label`, so what is drawn inside is decoration) and showing\n * that label in a bubble on hover and focus — a row of unlabelled squares is the\n * complaint that put the bubble there. It is for choices that are SEEN: a colour, a\n * glyph, a pattern. A choice that has to be READ — a plan with a price and three lines\n * of features, an option with a sentence of explanation — is a {@link ChoiceCardGroup}\n * (`type=\"radio\"`): a card names its option by its title and describes it by its text,\n * where a tile would hide the text behind a bubble and repeat it.\n *\n * No strings of its own: every name is an item's `label`, the \"none\" tile's included.\n *\n * ## A tile that cannot be chosen\n *\n * `disabled` takes a tile out of the choice AND out of reach: the arrow keys skip it\n * and Tab never lands on it, so a dimmed square says nothing about why. Give it a\n * `disabledReason` instead and it stays reachable, `aria-disabled`, with the reason in\n * its bubble and its description — and choosing it does nothing (0.23, the kit's later\n * list after keksdose K3; {@link Button}'s `disabledReason`, one tile at a time).\n */\n\n/** A tile's size: 28 / 32 / 44px — see {@link TILE_SIZE}. */\nexport type TileSize = \"sm\" | \"md\" | \"lg\";\n\n/** 28 / 32 / 44px. `lg` is the touch target a phone surface wants (`min-h-11`). `glyph`\n * and `swatch` are the content sizes the kit's own pickers draw inside each — use them\n * in `renderTile` so a tile of the app's own matches theirs. */\nexport const TILE_SIZE: Record<TileSize, { tile: string; glyph: string; swatch: string }> = {\n sm: { tile: \"size-7\", glyph: \"size-3.5\", swatch: \"size-4\" },\n md: { tile: \"size-8\", glyph: \"size-4\", swatch: \"size-5\" },\n lg: { tile: \"size-11\", glyph: \"size-5\", swatch: \"size-6\" },\n};\n\n/** One tile, whatever it shows. `key` is `null` for the \"none\" entry — a tile of its\n * own that leads back to nothing, since clicking a checked tile does not uncheck it. */\nexport interface TileItem<T extends string> {\n key: T | null;\n label: string;\n /** Said after the name, and shown in the bubble under it. Marks the tile with a\n * dot, so the note is visible without hovering every tile to find it. */\n note?: string;\n /** Out of the choice and out of reach: natively disabled, skipped by the arrow keys,\n * never the tab stop. */\n disabled?: boolean;\n /**\n * Why this tile cannot be chosen right now — a colour another category already wears,\n * a symbol only an owner may set. The tile LOOKS disabled but is `aria-disabled`, not\n * `disabled`: Tab and the arrow keys still reach it, the reason shows in its bubble\n * under its name (and its `note`) and describes it, and a click, Space / Enter or an\n * arrow under automatic activation chooses nothing — the focus moves, the checked\n * tile stays. Wins over `disabled`, as on {@link Button}; the whole group's\n * `disabled` still wins over it.\n */\n disabledReason?: ReactNode;\n}\n\nexport interface TileRadioGroupProps<T extends string> {\n /** The tiles, in reading order. Render them inside a `role=\"radiogroup\"` element\n * with a name — see the module note. */\n items: TileItem<T>[];\n /** The checked key, or `undefined` for \"nothing is checked\" (the mixed state, or\n * a value that is not among the options). */\n checked: T | null | undefined;\n onSelect: (key: T | null) => void;\n /** \"automatic\" (default): an arrow key moves AND checks, the APG default. \"manual\":\n * arrows move focus only, Space or Enter checks — for a picker whose change is\n * expensive (a bulk edit that saves on every change). */\n activation?: \"automatic\" | \"manual\";\n /** Every tile disabled. Mark the container `aria-disabled` too. Default `false`. */\n disabled?: boolean;\n /** 28 / 32 / 44px tiles ({@link TILE_SIZE}). Default \"md\"; \"lg\" is the touch-target\n * size a phone surface wants. */\n size?: TileSize;\n /** What goes inside a tile — `aria-hidden` decoration, since the tile is named by\n * `label`. Not called for the `null` (\"none\") item, which shows the kit's \"no\"\n * glyph. The frame, the tick and the note's dot are drawn around it. */\n renderTile: (item: TileItem<T>, selected: boolean) => ReactNode;\n /** Extra classes for a tile, per item, merged after the kit's — so a `size-*` here\n * beats `size`'s (a tile that grows in a narrow card). */\n tileClassName?: (item: TileItem<T>, selected: boolean) => string | undefined;\n}\n\n/**\n * The tile's frame. Selection is a thicker, darker frame AND a tick in the corner —\n * never a colour change alone,\n * because the thing inside a swatch tile IS a colour, and a red frame round a red dot\n * says nothing to a reader who cannot see red.\n *\n * `focus-visible` with an offset in the surface colour, as the checkbox does: the ring\n * must not be painted in the colour of the frame it touches.\n */\nconst TILE_BASE =\n \"relative inline-flex shrink-0 items-center justify-center rounded-md border transition-colors \" +\n \"focus:outline-none \" +\n FOCUS_RING +\n \" focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--bg-surface)] \" +\n \"disabled:cursor-not-allowed disabled:opacity-50\";\nconst TILE_IDLE =\n \"border-[var(--border)] bg-[var(--bg-surface)] hover:border-[var(--border-strong)] hover:bg-[var(--bg-hover)]\";\nconst TILE_SELECTED =\n \"border-[var(--text-primary)] bg-[var(--bg-surface)] ring-1 ring-[var(--text-primary)]\";\n/** A locked tile: the disabled look without `disabled` — dimmed, a not-allowed cursor. */\nconst TILE_LOCKED = \"cursor-not-allowed opacity-50\";\n/** …and no hover offer on an idle one, which cannot be chosen. Not on the selected\n * tile, whose frame IS its state. */\nconst TILE_LOCKED_IDLE = \"hover:border-[var(--border)] hover:bg-[var(--bg-surface)]\";\n\n/** `undefined`, `null`, `false` and `\"\"` are no reason — what `cond && \"…\"` gives. */\nfunction isLocked(item: TileItem<string>): boolean {\n const r = item.disabledReason;\n return r !== undefined && r !== null && r !== false && r !== \"\";\n}\n\n/** Out of reach: natively disabled. A reason keeps a `disabled` tile reachable. */\nfunction isOff(item: TileItem<string>): boolean {\n return Boolean(item.disabled) && !isLocked(item);\n}\n\n/**\n * The tiles of one radio group, without the group element — render them inside a\n * `role=\"radiogroup\"` with a name (the module note above has the example). One tab stop\n * (the checked tile, else the first that can be chosen), arrows to move — left and\n * right follow the page's direction — Home and End to the ends, and by default the\n * arrows choose as they go.\n */\nexport function TileRadioGroup<T extends string>({\n items,\n checked,\n onSelect,\n activation = \"automatic\",\n disabled = false,\n size = \"md\",\n renderTile,\n tileClassName,\n}: TileRadioGroupProps<T>) {\n const refs = useRef<Array<HTMLButtonElement | null>>([]);\n const noteId = useId();\n const reasonId = useId();\n const s = TILE_SIZE[size];\n const checkedIndex =\n checked === undefined ? -1 : items.findIndex((it) => it.key === checked);\n // The ONE tab stop: the checked tile, else the first that can be reached — the APG\n // rule, so Tab into a group with nothing checked still lands somewhere. A locked\n // tile is reachable: landing on it is how its reason is read.\n const tabStop =\n checkedIndex >= 0 && !isOff(items[checkedIndex])\n ? checkedIndex\n : items.findIndex((it) => !isOff(it));\n\n const onKeyDown = (e: KeyboardEvent<HTMLButtonElement>, index: number) => {\n // Left and right are VISUAL directions: in a right-to-left page the row runs the\n // other way. Up and down follow reading order either way — the APG's radio group\n // treats them as previous/next, and the tiles wrap, so there is no column to keep.\n const horizontal = horizontalStep(e.key, e.currentTarget);\n let step: number | \"first\" | \"last\";\n switch (horizontal ? \"horizontal\" : e.key) {\n case \"horizontal\":\n step = horizontal;\n break;\n case \"ArrowDown\":\n step = 1;\n break;\n case \"ArrowUp\":\n step = -1;\n break;\n case \"Home\":\n step = \"first\";\n break;\n case \"End\":\n step = \"last\";\n break;\n default:\n return;\n }\n e.preventDefault();\n // Locked tiles are in the walk; natively disabled ones are not.\n const enabled = items.map((it, i) => (isOff(it) ? -1 : i)).filter((i) => i >= 0);\n if (!enabled.length) return;\n const at = enabled.indexOf(index);\n let target: number;\n if (step === \"first\") target = enabled[0];\n else if (step === \"last\") target = enabled[enabled.length - 1];\n // Wrapping, as a native radio group does: the last tile's \"next\" is the first.\n else target = enabled[(at + step + enabled.length) % enabled.length];\n refs.current[target]?.focus();\n // Onto a locked tile the focus moves and the choice does not: the checked tile\n // stays checked, and the next arrow walks on from here.\n if (activation === \"automatic\" && !isLocked(items[target])) onSelect(items[target].key);\n };\n\n return (\n <>\n {items.map((item, i) => {\n const selected = i === checkedIndex;\n const locked = isLocked(item);\n const describedBy = [item.note && `${noteId}-${i}`, locked && `${reasonId}-${i}`].filter(Boolean).join(\" \");\n const button = (\n <button\n ref={(el) => {\n refs.current[i] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n aria-label={item.label}\n // The note is a DESCRIPTION, read after the name and the state, not glued\n // into the name — the punctuation between the two would be English's. So\n // is a lock's reason, after the note.\n aria-describedby={describedBy || undefined}\n tabIndex={i === tabStop ? 0 : -1}\n // A reason wins over the tile's own `disabled` (as on Button): reachable,\n // and refusing. The whole group's `disabled` still wins over both.\n disabled={disabled || isOff(item)}\n aria-disabled={(locked && !disabled) || undefined}\n // Clicking the checked tile again does nothing: a radio is not a toggle.\n // \"None\" is the way back to nothing, and it is a tile of its own. A locked\n // tile is never chosen.\n onClick={() => !selected && !locked && onSelect(item.key)}\n onKeyDown={(e) => onKeyDown(e, i)}\n className={cn(\n TILE_BASE,\n s.tile,\n selected ? TILE_SELECTED : TILE_IDLE,\n locked && TILE_LOCKED,\n locked && !selected && TILE_LOCKED_IDLE,\n tileClassName?.(item, selected),\n )}\n >\n {item.key === null ? (\n <Ban aria-hidden className={cn(s.glyph, \"text-[var(--text-muted)]\")} />\n ) : (\n renderTile(item, selected)\n )}\n {item.note && (\n <>\n {/* A dot rather than a dimmed tile: dimming reads as \"disabled\", and a\n tile with a note is entirely available. */}\n <span\n aria-hidden\n className=\"absolute end-0.5 top-0.5 size-1.5 rounded-full bg-[var(--text-muted)]\"\n />\n {/* `hidden` still serves as a description: aria-describedby reads\n hidden text, which is what keeps it out of the layout. */}\n <span id={`${noteId}-${i}`} hidden>\n {item.note}\n </span>\n </>\n )}\n {/* The reason's description is a `hidden` copy, as on a locked Button: the\n bubble exists only while hovered or focused once portalled, and a\n description that comes and goes is read inconsistently. */}\n {locked && (\n <span id={`${reasonId}-${i}`} hidden>\n {item.disabledReason}\n </span>\n )}\n {selected && <SelectedTick />}\n </button>\n );\n return (\n // The bubble is the SIGHTED user's name for the tile — eight unlabelled\n // squares are the complaint that put a bubble on Keksdose's (live #289).\n // It wraps a span rather than the button, because a Tooltip hands its\n // child an `aria-describedby`, and a tile named \"Red\" and described as\n // \"Red\" is read out twice.\n <Tooltip\n key={item.key ?? \"\\u0000none\"}\n label={\n item.note || locked ? (\n <>\n <span className=\"block\">{item.label}</span>\n {item.note && <span className=\"block font-normal text-[var(--text-muted)]\">{item.note}</span>}\n {/* The reason in the body colour: it is the news, the note is\n standing context. */}\n {locked && <span className=\"block font-normal\">{item.disabledReason}</span>}\n </>\n ) : (\n item.label\n )\n }\n portal\n >\n <span className=\"inline-flex\">{button}</span>\n </Tooltip>\n );\n })}\n </>\n );\n}\n\n/** The tick on a selected tile — a small badge in the corner, in the text colour on\n * the surface colour, so it reads the same over every swatch colour. */\nfunction SelectedTick() {\n return (\n <span\n aria-hidden\n className=\"absolute -bottom-1 -end-1 inline-flex size-3.5 items-center justify-center rounded-full bg-[var(--text-primary)] text-[var(--bg-surface)]\"\n >\n <Check strokeWidth={3} className=\"size-2.5\" />\n </span>\n );\n}\n"],"mappings":";AAgRc,SAKA,UALA,KAK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MAiBnB;AAAA;AAAA,EAEJ,CAAC,GACH;AAEJ;AAIA,SAAS,eAAe;AACtB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,MACX,WAAU;AAAA,MAEV,8BAAC,SAAM,aAAa,GAAG,WAAU,YAAW;AAAA;AAAA,EAC9C;AAEJ;","names":[]}
@@ -1,16 +1,18 @@
1
1
  import * as react from 'react';
2
- import { dD as InputProps } from '../delete-account-setting-CpIhzxxZ.js';
2
+ import { dO as InputProps } from '../delete-account-setting-FLyJf-kZ.js';
3
3
  import './tooltip.js';
4
4
  import '../hooks/use-anchored-rect.js';
5
5
  import '../lib/clipping.js';
6
- import '../data-table-labels-DUELeXpa.js';
6
+ import '../data-table-labels-kpAAVi6g.js';
7
7
  import './data-table-sort.js';
8
8
  import './swipeable-row.js';
9
9
  import './mini-calendar.js';
10
10
  import './calendar-heatmap.js';
11
11
  import './popover.js';
12
+ import '../hooks/use-breakpoint.js';
12
13
  import './chip.js';
13
14
  import 'lucide-react';
15
+ import './field-parts.js';
14
16
  import './field-sync.js';
15
17
  import '../wizard/types.js';
16
18
  import '../tour/tour.js';
@@ -79,6 +81,9 @@ import '../admin/admin-parts.js';
79
81
  import '../admin/admin-action-log.js';
80
82
  import '../settings/settings-labels.js';
81
83
  import '../demo/demo-labels.js';
84
+ import './appearance-labels.js';
85
+ import '../theme/contrast.js';
86
+ import '../theme/text-size.js';
82
87
  import './reauth-dialog.js';
83
88
  import './server-wake.js';
84
89
  import '../lib/server-wake.js';
@@ -92,7 +97,7 @@ import './sign-chip.js';
92
97
  import './column-mapper.js';
93
98
  import '../lib/column-mapping.js';
94
99
  import '../lib/table-text.js';
95
- import './field-parts.js';
100
+ import './focus-ring.js';
96
101
 
97
102
  /**
98
103
  * A time of day, as a `"HH:mm"` string (`"HH:mm:ss"` once `step` asks for seconds).
@@ -109,7 +109,9 @@ declare const toast: ((message: ReactNode, opts?: ToastOptions) => ToastId) & {
109
109
  };
110
110
  type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
111
111
  type ToastSwipeDirection = "top" | "right" | "bottom" | "left";
112
- /** sonner's offset: one value for every edge, or per edge. Numbers are px. */
112
+ /** sonner's offset: one value for every edge, or per edge. Numbers are px, which do not
113
+ * follow the text size — prefer a CSS length (rem, or a `calc()` on
114
+ * {@link TOASTER_OFFSET_TOP} / {@link TOASTER_OFFSET_BOTTOM}). */
113
115
  type ToasterOffset = string | number | {
114
116
  top?: string | number;
115
117
  right?: string | number;
@@ -160,6 +162,20 @@ interface ToasterProps {
160
162
  className?: string;
161
163
  style?: CSSProperties;
162
164
  }
165
+ /**
166
+ * The Toaster's default distance from the top edge (desktop), as a CSS length (0.32,
167
+ * docs/text-size-harmonization.md §10.11): below a 3rem top bar with 1rem to spare, and
168
+ * the safe area. In rem, so it moves with the text size along with the top bar — an
169
+ * app's `offset={{ top: 64 }}` (keksdose) did not. Pass it, or a `calc()` built on it,
170
+ * instead of a px number.
171
+ */
172
+ declare const TOASTER_OFFSET_TOP = "calc(env(safe-area-inset-top, 0px) + 4rem)";
173
+ /**
174
+ * The Toaster's default distance from the bottom edge (phone), as a CSS length: above
175
+ * AppShell's measured bottom nav (`--app-nav-h`) or the home indicator, whichever is
176
+ * taller, with 0.75rem to spare.
177
+ */
178
+ declare const TOASTER_OFFSET_BOTTOM = "calc(max(var(--app-nav-h, 0px), env(safe-area-inset-bottom, 0px)) + 0.75rem)";
163
179
  /**
164
180
  * Where the toasts appear, with the kit's defaults — mount ONE, near the root and
165
181
  * inside `<UiKitProvider>` (it reads the `toast` labels) and inside the router if a
@@ -173,4 +189,4 @@ interface ToasterProps {
173
189
  */
174
190
  declare function Toaster({ position, navOffset, theme, labels: labelsProp, closeButton, richColors, swipeDirections, offset, mobileOffset, dismissOnMiddleClick, className, style, ...rest }: ToasterProps): react.JSX.Element | null;
175
191
 
176
- export { DEFAULT_TOAST_LABELS, TOAST_ACTION_DURATION, type ToastAction, type ToastId, type ToastLabels, type ToastOptions, type ToastPosition, type ToastPromiseOptions, type ToastRedoOptions, type ToastSwipeDirection, type ToastUndoOptions, Toaster, type ToasterOffset, type ToasterProps, toast };
192
+ export { DEFAULT_TOAST_LABELS, TOASTER_OFFSET_BOTTOM, TOASTER_OFFSET_TOP, TOAST_ACTION_DURATION, type ToastAction, type ToastId, type ToastLabels, type ToastOptions, type ToastPosition, type ToastPromiseOptions, type ToastRedoOptions, type ToastSwipeDirection, type ToastUndoOptions, Toaster, type ToasterOffset, type ToasterProps, toast };
@@ -2,8 +2,7 @@
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { useEffect, useState, useSyncExternalStore } from "react";
4
4
  import { useKitLabels } from "../i18n/kit-labels.js";
5
- import { useMediaQuery } from "../hooks/use-media-query.js";
6
- import { PHONE_QUERY } from "./ui.js";
5
+ import { usePhoneLayout } from "../hooks/use-breakpoint.js";
7
6
  let sonner = null;
8
7
  let loading = null;
9
8
  const queue = [];
@@ -170,6 +169,8 @@ function subscribeDocumentTheme(onChange) {
170
169
  return () => mo.disconnect();
171
170
  }
172
171
  const px = (v) => typeof v === "number" ? `${v}px` : v;
172
+ const TOASTER_OFFSET_TOP = "calc(env(safe-area-inset-top, 0px) + 4rem)";
173
+ const TOASTER_OFFSET_BOTTOM = "calc(max(var(--app-nav-h, 0px), env(safe-area-inset-bottom, 0px)) + 0.75rem)";
173
174
  function Toaster({
174
175
  position,
175
176
  navOffset,
@@ -232,10 +233,10 @@ function Toaster({
232
233
  };
233
234
  }, [dismissOnMiddleClick, mod]);
234
235
  const documentTheme = useSyncExternalStore(subscribeDocumentTheme, readDocumentTheme, () => "light");
235
- const phone = useMediaQuery(PHONE_QUERY, false);
236
+ const phone = usePhoneLayout();
236
237
  const resolved = position ?? (phone ? "bottom-center" : "top-center");
237
- const bottom = `calc(max(${navOffset === void 0 ? "var(--app-nav-h, 0px)" : px(navOffset)}, env(safe-area-inset-bottom, 0px)) + 0.75rem)`;
238
- const top = "calc(env(safe-area-inset-top, 0px) + 4rem)";
238
+ const bottom = navOffset === void 0 ? TOASTER_OFFSET_BOTTOM : `calc(max(${px(navOffset)}, env(safe-area-inset-bottom, 0px)) + 0.75rem)`;
239
+ const top = TOASTER_OFFSET_TOP;
239
240
  const computed = resolved.startsWith("bottom") ? { bottom } : { top };
240
241
  if (!mod) return null;
241
242
  const Sonner = mod.Toaster;
@@ -259,6 +260,8 @@ function Toaster({
259
260
  }
260
261
  export {
261
262
  DEFAULT_TOAST_LABELS,
263
+ TOASTER_OFFSET_BOTTOM,
264
+ TOASTER_OFFSET_TOP,
262
265
  TOAST_ACTION_DURATION,
263
266
  Toaster,
264
267
  toast
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/toast.tsx"],"sourcesContent":["import { useEffect, useState, useSyncExternalStore } from \"react\";\nimport type { CSSProperties, MouseEvent, ReactElement, ReactNode } from \"react\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { useMediaQuery } from \"../hooks/use-media-query\";\nimport { PHONE_QUERY } from \"./ui\";\n\n/**\n * The kit's toast layer: a `toast` API and a `<Toaster>`, over sonner.\n *\n * WHY A WRAPPER AND NOT \"USE SONNER\". Both apps mounted sonner by hand and carried the\n * same policy in it — bottom-centre on a phone so the toast covers neither the header\n * nor the bottom nav, a lift above that nav, swipe in every direction, a z-index above\n * every overlay, the theme fed in from the store — and one of them wrote that policy\n * twice. `toast` mirrors sonner's call shape, so migrating is an import swap:\n *\n * import { toast } from \"@eifi1/ui-kit\"; // was: from \"sonner\"\n *\n * WHY SONNER IS LOADED LAZILY. It is an OPTIONAL peer, and this module is re-exported by\n * the barrel: a static import here would make every app that imports a Button install\n * it (see optional-peer-imports.test.tsx). So nothing here imports it statically. The\n * `<Toaster>` loads it when it mounts — long before anyone clicks anything — and a call\n * made before that is queued and replayed in order the moment it has loaded. Every call\n * returns its id synchronously anyway: the id is chosen here, not by sonner.\n */\n\ntype Sonner = typeof import(\"sonner\");\ntype SonnerData = NonNullable<Parameters<Sonner[\"toast\"]>[1]>;\n\n/* ── Loading sonner ──────────────────────────────────────────────────────── */\n\nlet sonner: Sonner | null = null;\nlet loading: Promise<Sonner | null> | null = null;\nconst queue: Array<(s: Sonner) => void> = [];\n\nfunction loadSonner(): Promise<Sonner | null> {\n loading ??= import(\"sonner\").then(\n (mod) => {\n sonner = mod;\n // Flushed in the SAME callback that sets `sonner`, so a call arriving between\n // the two cannot overtake one that was queued before it.\n for (const fn of queue.splice(0)) fn(mod);\n return mod;\n },\n () => {\n queue.length = 0;\n console.warn(\n \"@eifi1/ui-kit: `toast` needs the optional peer `sonner` — install it (npm i sonner) to show toasts.\",\n );\n return null;\n },\n );\n return loading;\n}\n\nfunction withSonner(fn: (s: Sonner) => void): void {\n if (sonner) {\n fn(sonner);\n return;\n }\n queue.push(fn);\n void loadSonner();\n}\n\nlet counter = 0;\nconst nextId = () => `kit-toast-${++counter}`;\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** The words the toast layer says. `close` and `notifications` are read by a screen\n * reader (the close button's name, the toast region's name); `undo` and `redo` are\n * the default action labels of {@link toast.undo} / {@link toast.redo}. */\nexport interface ToastLabels {\n close: string;\n notifications: string;\n undo: string;\n redo: string;\n}\n\nexport const DEFAULT_TOAST_LABELS: ToastLabels = {\n close: \"Close notification\",\n notifications: \"Notifications\",\n undo: \"Undo\",\n redo: \"Redo\",\n};\n\n/** What the mounted `<Toaster>` resolved from `<UiKitProvider>` — so `toast.undo()`,\n * which is called from mutation callbacks and not from a component, still says\n * \"Rückgängig\" in a German app. */\nlet activeLabels: ToastLabels = DEFAULT_TOAST_LABELS;\n\n/* ── The API ─────────────────────────────────────────────────────────────── */\n\nexport type ToastId = string | number;\n\n/** A button on the toast. Clicking it dismisses the toast, unless `onClick` calls\n * `event.preventDefault()`. */\nexport interface ToastAction {\n label: ReactNode;\n onClick: (event: MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport interface ToastOptions {\n /** Re-using an id REPLACES the toast on screen with that id (in place — it does not\n * stack a second one), which is how a toast is updated. Default: a fresh id. */\n id?: ToastId;\n description?: ReactNode;\n action?: ToastAction;\n /** A second, quieter button (sonner's `cancel`). */\n cancel?: ToastAction;\n /** Milliseconds; `Infinity` keeps it until dismissed. Default 4s — or\n * {@link TOAST_ACTION_DURATION} when there is an `action`, so there is time to\n * read the message AND reach the button. */\n duration?: number;\n /** Called when the toast is closed by the user (close button, swipe, action). */\n onDismiss?: (toast: { id: ToastId }) => void;\n /** Called when the toast times out. */\n onAutoClose?: (toast: { id: ToastId }) => void;\n /** Wrap the message and the description in `data-private`, so an app's demo /\n * privacy mode blurs them like every other sensitive value. */\n redact?: boolean;\n /** Replaces the tone's icon. */\n icon?: ReactNode;\n /** `false`: no close button, no swipe. */\n dismissible?: boolean;\n /** Per toast, over the `<Toaster>`'s `closeButton`. */\n closeButton?: boolean;\n className?: string;\n style?: CSSProperties;\n}\n\n/** The default duration of a toast that carries an action (8s rather than 4s). */\nexport const TOAST_ACTION_DURATION = 8000;\n\ntype Kind = \"default\" | \"success\" | \"error\" | \"warning\" | \"info\" | \"loading\";\n\nconst privately = (node: ReactNode) => <span data-private=\"\">{node}</span>;\n\n/**\n * The toast's id, written onto its `<li>` as a class — the one per-toast attribute\n * sonner passes through untouched besides `testId`, which is the app's (sonner keeps the\n * id in React state only). `<Toaster dismissOnMiddleClick>` reads it back to dismiss\n * the toast under the pointer, close button or not. The type is kept (`s`/`n`) because\n * sonner matches ids with `===`, and the value is URI-encoded so any string id is one\n * whitespace-free class token.\n */\nconst ID_CLASS = \"kit-toast-id-\";\nconst idClass = (id: ToastId) =>\n `${ID_CLASS}${typeof id === \"number\" ? \"n\" : \"s\"}-${encodeURIComponent(String(id))}`;\n\n/** The id {@link idClass} stamped on a toast element, or null for a toast the kit did\n * not make (an app still calling sonner directly). */\nfunction readToastId(el: Element): ToastId | null {\n for (const token of el.classList) {\n if (!token.startsWith(ID_CLASS)) continue;\n const kind = token.charAt(ID_CLASS.length);\n const raw = decodeURIComponent(token.slice(ID_CLASS.length + 2));\n return kind === \"n\" ? Number(raw) : raw;\n }\n return null;\n}\n\nfunction toSonnerData(opts: ToastOptions | undefined, id: ToastId): SonnerData {\n const { redact, description, duration, action, className, ...rest } = opts ?? {};\n const data: SonnerData = { ...rest, id, className: className ? `${idClass(id)} ${className}` : idClass(id) };\n if (description !== undefined) data.description = redact ? privately(description) : description;\n if (action) data.action = action;\n const resolved = duration ?? (action ? TOAST_ACTION_DURATION : undefined);\n if (resolved !== undefined) data.duration = resolved;\n return data;\n}\n\nfunction show(kind: Kind, message: ReactNode, opts?: ToastOptions): ToastId {\n const id = opts?.id ?? nextId();\n const title = opts?.redact ? privately(message) : message;\n const data = toSonnerData(opts, id);\n withSonner((s) => {\n if (kind === \"default\") s.toast(title, data);\n else s.toast[kind](title, data);\n });\n return id;\n}\n\nexport interface ToastPromiseOptions<T> extends ToastOptions {\n loading: ReactNode;\n /** The success message, or a function of the resolved value. Omitted: the loading\n * toast is dismissed. */\n success?: ReactNode | ((value: T) => ReactNode);\n /** The error message, or a function of the rejection. Omitted: dismissed. */\n error?: ReactNode | ((error: unknown) => ReactNode);\n finally?: () => void;\n}\n\nexport interface ToastUndoOptions extends Omit<ToastOptions, \"action\"> {\n /** Called when the button is pressed. */\n onUndo: () => void;\n /** Default: `toast.undo` from `<UiKitProvider>` (\"Undo\"). */\n label?: ReactNode;\n /** Default `success` — the step the toast reports worked. */\n tone?: Exclude<Kind, \"loading\">;\n}\n\nexport interface ToastRedoOptions extends Omit<ToastUndoOptions, \"onUndo\"> {\n onRedo: () => void;\n}\n\nfunction undoable(\n message: ReactNode,\n { tone = \"success\", label, run, ...opts }: Omit<ToastUndoOptions, \"onUndo\"> & { run: () => void },\n fallback: ReactNode,\n): ToastId {\n return show(tone, message, {\n ...opts,\n action: { label: label ?? fallback, onClick: () => run() },\n });\n}\n\n/**\n * Show a toast. The same shape as sonner's `toast`, so an app migrates by changing the\n * import: `toast(msg, opts)`, `toast.success` / `error` / `warning` / `info` /\n * `loading`, `toast.promise`, `toast.dismiss`, `toast.custom`. Each returns the toast's\n * id; pass it back as `id` to replace that toast in place.\n *\n * Needs a mounted {@link Toaster}. Messages may be any ReactNode.\n */\nexport const toast = Object.assign(\n (message: ReactNode, opts?: ToastOptions): ToastId => show(\"default\", message, opts),\n {\n message: (message: ReactNode, opts?: ToastOptions) => show(\"default\", message, opts),\n success: (message: ReactNode, opts?: ToastOptions) => show(\"success\", message, opts),\n error: (message: ReactNode, opts?: ToastOptions) => show(\"error\", message, opts),\n warning: (message: ReactNode, opts?: ToastOptions) => show(\"warning\", message, opts),\n info: (message: ReactNode, opts?: ToastOptions) => show(\"info\", message, opts),\n /** A spinner that does not time out — replace it (same `id`) or dismiss it. */\n loading: (message: ReactNode, opts?: ToastOptions) => show(\"loading\", message, opts),\n\n /**\n * A loading toast that becomes the success or the error toast, in place, when\n * `promise` settles. Returns the toast's id; the promise itself is the caller's.\n */\n promise<T>(promise: Promise<T> | (() => Promise<T>), options: ToastPromiseOptions<T>): ToastId {\n const { loading: pending, success, error, finally: onFinally, ...opts } = options;\n const id = show(\"loading\", pending, opts);\n const same = { ...opts, id };\n Promise.resolve()\n .then(() => (typeof promise === \"function\" ? promise() : promise))\n .then(\n (value) => {\n if (success === undefined) toast.dismiss(id);\n else show(\"success\", typeof success === \"function\" ? success(value) : success, same);\n },\n (reason: unknown) => {\n if (error === undefined) toast.dismiss(id);\n else show(\"error\", typeof error === \"function\" ? error(reason) : error, same);\n },\n )\n .finally(() => onFinally?.());\n return id;\n },\n\n /** Close one toast, or every toast when `id` is omitted. */\n dismiss(id?: ToastId): void {\n withSonner((s) => s.toast.dismiss(id));\n },\n\n /** Render your own node in a toast slot — `render` receives the id to dismiss it. */\n custom(render: (id: ToastId) => ReactElement, opts?: Omit<ToastOptions, \"redact\">): ToastId {\n const id = opts?.id ?? nextId();\n const data = toSonnerData(opts, id);\n withSonner((s) => s.toast.custom(render, data));\n return id;\n },\n\n /**\n * \"Deleted — Undo\": a toast whose action takes the step back, labelled by the\n * provider's `toast.undo`. The journal stays the app's; this is only its toast.\n * Pair with {@link toast.redo} so the step back can itself be taken back.\n */\n undo(message: ReactNode, { onUndo, ...opts }: ToastUndoOptions): ToastId {\n return undoable(message, { ...opts, run: onUndo }, activeLabels.undo);\n },\n\n /** {@link toast.undo}'s mirror: the action is labelled `toast.redo`. */\n redo(message: ReactNode, { onRedo, ...opts }: ToastRedoOptions): ToastId {\n return undoable(message, { ...opts, run: onRedo }, activeLabels.redo);\n },\n },\n);\n\n/* ── The Toaster ─────────────────────────────────────────────────────────── */\n\nexport type ToastPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\nexport type ToastSwipeDirection = \"top\" | \"right\" | \"bottom\" | \"left\";\n\n/** sonner's offset: one value for every edge, or per edge. Numbers are px. */\nexport type ToasterOffset =\n | string\n | number\n | { top?: string | number; right?: string | number; bottom?: string | number; left?: string | number };\n\nexport interface ToasterProps {\n /** Default: `bottom-center` on a phone (so the toast covers neither the header's\n * buttons nor the bottom nav's), `top-center` from `md` up. */\n position?: ToastPosition;\n /** The height to keep clear at the bottom — AppShell's bottom nav. Default: its\n * measured `--app-nav-h`, so nothing has to be passed under an AppShell. The safe\n * area is added either way. Numbers are px. */\n navOffset?: string | number;\n /** Default: follows the `.dark` class the kit's theme store (`useApplyTheme`) puts\n * on `<html>` — whichever store the app built, with nothing passed. */\n theme?: \"light\" | \"dark\" | \"system\";\n labels?: Partial<ToastLabels>;\n /** Default 4s (8s for a toast with an action). */\n duration?: number;\n visibleToasts?: number;\n expand?: boolean;\n /** Default true. */\n closeButton?: boolean;\n /** Tone-coloured toasts (the AlertBanner tokens). Default true. */\n richColors?: boolean;\n /** Default: every direction. */\n swipeDirections?: ToastSwipeDirection[];\n /** Overrides the computed offset outright (above the nav on a phone, below a 48px\n * top bar on desktop). */\n offset?: ToasterOffset;\n /** Below 600px, where sonner switches to its full-width layout. Default: `offset`'s\n * phone value. */\n mobileOffset?: ToasterOffset;\n /** Keyboard shortcut that moves focus into the toasts. Default Alt+T. */\n hotkey?: string[];\n gap?: number;\n dir?: \"ltr\" | \"rtl\" | \"auto\";\n /**\n * A middle click on a toast dismisses it (0.18.0) — the gesture that closes a tab,\n * which is what keksdose's users reached for (dev #583). By id, so it works on a\n * toast with `closeButton: false` too; it counts as the user closing it, so\n * `onDismiss` runs. Not on a link or a button inside the toast — a middle click on a\n * link still opens it in a new tab — and not on a `dismissible: false` toast.\n * Default true.\n */\n dismissOnMiddleClick?: boolean;\n className?: string;\n style?: CSSProperties;\n}\n\n/** The kit's palette, mapped onto sonner's variables. Inline on the toaster element,\n * so it wins over sonner's injected sheet with no specificity contest. The tone\n * backgrounds go through `--toast-*` aliases computed at `:root` in tokens.css:\n * sonner redefines `--success-bg` on this same element, and a variable cannot read\n * its own name — `--success-bg: var(--success-bg)` here would be a cycle. */\nconst KIT_TOASTER_STYLE = {\n zIndex: \"var(--z-toast, 2147483647)\",\n fontFamily: \"inherit\",\n \"--normal-bg\": \"var(--bg-surface)\",\n \"--normal-bg-hover\": \"var(--bg-hover)\",\n \"--normal-border\": \"var(--border)\",\n \"--normal-border-hover\": \"var(--border-strong)\",\n \"--normal-text\": \"var(--text-primary)\",\n \"--gray2\": \"var(--bg-hover)\",\n \"--gray5\": \"var(--border-strong)\",\n \"--gray11\": \"var(--text-muted)\",\n \"--success-bg\": \"var(--toast-success-bg)\",\n \"--success-border\": \"var(--toast-success-border)\",\n \"--success-text\": \"var(--success)\",\n \"--info-bg\": \"var(--toast-info-bg)\",\n \"--info-border\": \"var(--toast-info-border)\",\n \"--info-text\": \"var(--info)\",\n \"--warning-bg\": \"var(--toast-warning-bg)\",\n \"--warning-border\": \"var(--toast-warning-border)\",\n \"--warning-text\": \"var(--warning)\",\n \"--error-bg\": \"var(--toast-danger-bg)\",\n \"--error-border\": \"var(--toast-danger-border)\",\n \"--error-text\": \"var(--danger)\",\n} as CSSProperties;\n\nconst ALL_DIRECTIONS: ToastSwipeDirection[] = [\"top\", \"right\", \"bottom\", \"left\"];\n\n/** Light or dark, as the `.dark` class on `<html>` says right now. */\nfunction readDocumentTheme(): \"light\" | \"dark\" {\n return typeof document !== \"undefined\" && document.documentElement.classList.contains(\"dark\")\n ? \"dark\"\n : \"light\";\n}\n\nfunction subscribeDocumentTheme(onChange: () => void): () => void {\n if (typeof MutationObserver === \"undefined\") return () => {};\n const mo = new MutationObserver(onChange);\n mo.observe(document.documentElement, { attributes: true, attributeFilter: [\"class\"] });\n return () => mo.disconnect();\n}\n\nconst px = (v: string | number) => (typeof v === \"number\" ? `${v}px` : v);\n\n/**\n * Where the toasts appear, with the kit's defaults — mount ONE, near the root and\n * inside `<UiKitProvider>` (it reads the `toast` labels) and inside the router if a\n * toast's content navigates.\n *\n * Accessible as sonner makes it: the toasts sit in a polite live region, so a message\n * is announced with its description and its action's label; every toast and every\n * button in it is focusable, the timer pauses while focus or the pointer is inside,\n * and Alt+T ({@link ToasterProps.hotkey}) moves focus to the newest toast. A toast\n * with an action stays up 8s by default, so the button can be reached.\n */\nexport function Toaster({\n position,\n navOffset,\n theme,\n labels: labelsProp,\n closeButton = true,\n richColors = true,\n swipeDirections = ALL_DIRECTIONS,\n offset,\n mobileOffset,\n dismissOnMiddleClick = true,\n className,\n style,\n ...rest\n}: ToasterProps) {\n const [mod, setMod] = useState<Sonner | null>(sonner);\n useEffect(() => {\n if (mod) return;\n let live = true;\n void loadSonner().then((m) => {\n if (live && m) setMod(m);\n });\n return () => {\n live = false;\n };\n }, [mod]);\n\n const labels = useKitLabels(\"toast\", DEFAULT_TOAST_LABELS, labelsProp);\n useEffect(() => {\n activeLabels = labels;\n return () => {\n if (activeLabels === labels) activeLabels = DEFAULT_TOAST_LABELS;\n };\n }, [labels]);\n\n useEffect(() => {\n if (!dismissOnMiddleClick || !mod) return;\n // On the document rather than the toaster: sonner owns the `<ol>`, and a listener\n // there would have to be re-attached whenever it remounts it.\n const toastUnder = (e: globalThis.MouseEvent) => {\n if (e.button !== 1 || !(e.target instanceof Element)) return null;\n const li = e.target.closest<HTMLElement>(\"[data-sonner-toast]\");\n if (!li || li.dataset.dismissible === \"false\") return null;\n // A link keeps its middle click (open in a new tab); a button or a field inside\n // the toast is the app's, not a background to click.\n const control = e.target.closest(\"a[href], button, input, select, textarea, [role='button'], [role='link']\");\n if (control && li.contains(control)) return null;\n return li;\n };\n // `mousedown`: the middle button starts autoscroll (Windows) before any click.\n const onDown = (e: globalThis.MouseEvent) => {\n if (toastUnder(e)) e.preventDefault();\n };\n const onAux = (e: globalThis.MouseEvent) => {\n const li = toastUnder(e);\n if (!li) return;\n // No paste of the primary selection on Linux, no other handler's idea of it.\n e.preventDefault();\n const id = readToastId(li);\n if (id !== null) mod.toast.dismiss(id);\n // A toast made by sonner directly carries no id: its close button, if any.\n else li.querySelector<HTMLButtonElement>(\"[data-close-button]\")?.click();\n };\n document.addEventListener(\"mousedown\", onDown);\n document.addEventListener(\"auxclick\", onAux);\n return () => {\n document.removeEventListener(\"mousedown\", onDown);\n document.removeEventListener(\"auxclick\", onAux);\n };\n }, [dismissOnMiddleClick, mod]);\n\n const documentTheme = useSyncExternalStore(subscribeDocumentTheme, readDocumentTheme, () => \"light\" as const);\n const phone = useMediaQuery(PHONE_QUERY, false);\n const resolved: ToastPosition = position ?? (phone ? \"bottom-center\" : \"top-center\");\n\n // Above the bottom nav and the home indicator: whichever is taller, since the nav\n // already pads itself by the safe area (the same sum BulkActionBar floats on).\n const bottom = `calc(max(${navOffset === undefined ? \"var(--app-nav-h, 0px)\" : px(navOffset)}, env(safe-area-inset-bottom, 0px)) + 0.75rem)`;\n // Below a 48px TopBar with the same 1rem clearance.\n const top = \"calc(env(safe-area-inset-top, 0px) + 4rem)\";\n const computed = resolved.startsWith(\"bottom\") ? { bottom } : { top };\n\n if (!mod) return null;\n const Sonner = mod.Toaster;\n return (\n <Sonner\n {...rest}\n position={resolved}\n theme={theme ?? documentTheme}\n closeButton={closeButton}\n richColors={richColors}\n swipeDirections={swipeDirections}\n offset={offset ?? computed}\n mobileOffset={mobileOffset ?? offset ?? computed}\n containerAriaLabel={labels.notifications}\n toastOptions={{ closeButtonAriaLabel: labels.close }}\n className={className ? `kit-toaster ${className}` : \"kit-toaster\"}\n style={{ ...KIT_TOASTER_STYLE, ...style }}\n />\n );\n}\n"],"mappings":";AAuIuC;AAvIvC,SAAS,WAAW,UAAU,4BAA4B;AAE1D,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AA0B5B,IAAI,SAAwB;AAC5B,IAAI,UAAyC;AAC7C,MAAM,QAAoC,CAAC;AAE3C,SAAS,aAAqC;AAC5C,cAAY,OAAO,QAAQ,EAAE;AAAA,IAC3B,CAAC,QAAQ;AACP,eAAS;AAGT,iBAAW,MAAM,MAAM,OAAO,CAAC,EAAG,IAAG,GAAG;AACxC,aAAO;AAAA,IACT;AAAA,IACA,MAAM;AACJ,YAAM,SAAS;AACf,cAAQ;AAAA,QACN;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,WAAW,IAA+B;AACjD,MAAI,QAAQ;AACV,OAAG,MAAM;AACT;AAAA,EACF;AACA,QAAM,KAAK,EAAE;AACb,OAAK,WAAW;AAClB;AAEA,IAAI,UAAU;AACd,MAAM,SAAS,MAAM,aAAa,EAAE,OAAO;AAcpC,MAAM,uBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,eAAe;AAAA,EACf,MAAM;AAAA,EACN,MAAM;AACR;AAKA,IAAI,eAA4B;AA2CzB,MAAM,wBAAwB;AAIrC,MAAM,YAAY,CAAC,SAAoB,oBAAC,UAAK,gBAAa,IAAI,gBAAK;AAUnE,MAAM,WAAW;AACjB,MAAM,UAAU,CAAC,OACf,GAAG,QAAQ,GAAG,OAAO,OAAO,WAAW,MAAM,GAAG,IAAI,mBAAmB,OAAO,EAAE,CAAC,CAAC;AAIpF,SAAS,YA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AmB,GAAG,MAAM;AAAA;AAAA,EAC1C;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/toast.tsx"],"sourcesContent":["import { useEffect, useState, useSyncExternalStore } from \"react\";\nimport type { CSSProperties, MouseEvent, ReactElement, ReactNode } from \"react\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { usePhoneLayout } from \"../hooks/use-breakpoint\";\n\n/**\n * The kit's toast layer: a `toast` API and a `<Toaster>`, over sonner.\n *\n * WHY A WRAPPER AND NOT \"USE SONNER\". Both apps mounted sonner by hand and carried the\n * same policy in it — bottom-centre on a phone so the toast covers neither the header\n * nor the bottom nav, a lift above that nav, swipe in every direction, a z-index above\n * every overlay, the theme fed in from the store — and one of them wrote that policy\n * twice. `toast` mirrors sonner's call shape, so migrating is an import swap:\n *\n * import { toast } from \"@eifi1/ui-kit\"; // was: from \"sonner\"\n *\n * WHY SONNER IS LOADED LAZILY. It is an OPTIONAL peer, and this module is re-exported by\n * the barrel: a static import here would make every app that imports a Button install\n * it (see optional-peer-imports.test.tsx). So nothing here imports it statically. The\n * `<Toaster>` loads it when it mounts — long before anyone clicks anything — and a call\n * made before that is queued and replayed in order the moment it has loaded. Every call\n * returns its id synchronously anyway: the id is chosen here, not by sonner.\n */\n\ntype Sonner = typeof import(\"sonner\");\ntype SonnerData = NonNullable<Parameters<Sonner[\"toast\"]>[1]>;\n\n/* ── Loading sonner ──────────────────────────────────────────────────────── */\n\nlet sonner: Sonner | null = null;\nlet loading: Promise<Sonner | null> | null = null;\nconst queue: Array<(s: Sonner) => void> = [];\n\nfunction loadSonner(): Promise<Sonner | null> {\n loading ??= import(\"sonner\").then(\n (mod) => {\n sonner = mod;\n // Flushed in the SAME callback that sets `sonner`, so a call arriving between\n // the two cannot overtake one that was queued before it.\n for (const fn of queue.splice(0)) fn(mod);\n return mod;\n },\n () => {\n queue.length = 0;\n console.warn(\n \"@eifi1/ui-kit: `toast` needs the optional peer `sonner` — install it (npm i sonner) to show toasts.\",\n );\n return null;\n },\n );\n return loading;\n}\n\nfunction withSonner(fn: (s: Sonner) => void): void {\n if (sonner) {\n fn(sonner);\n return;\n }\n queue.push(fn);\n void loadSonner();\n}\n\nlet counter = 0;\nconst nextId = () => `kit-toast-${++counter}`;\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** The words the toast layer says. `close` and `notifications` are read by a screen\n * reader (the close button's name, the toast region's name); `undo` and `redo` are\n * the default action labels of {@link toast.undo} / {@link toast.redo}. */\nexport interface ToastLabels {\n close: string;\n notifications: string;\n undo: string;\n redo: string;\n}\n\nexport const DEFAULT_TOAST_LABELS: ToastLabels = {\n close: \"Close notification\",\n notifications: \"Notifications\",\n undo: \"Undo\",\n redo: \"Redo\",\n};\n\n/** What the mounted `<Toaster>` resolved from `<UiKitProvider>` — so `toast.undo()`,\n * which is called from mutation callbacks and not from a component, still says\n * \"Rückgängig\" in a German app. */\nlet activeLabels: ToastLabels = DEFAULT_TOAST_LABELS;\n\n/* ── The API ─────────────────────────────────────────────────────────────── */\n\nexport type ToastId = string | number;\n\n/** A button on the toast. Clicking it dismisses the toast, unless `onClick` calls\n * `event.preventDefault()`. */\nexport interface ToastAction {\n label: ReactNode;\n onClick: (event: MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport interface ToastOptions {\n /** Re-using an id REPLACES the toast on screen with that id (in place — it does not\n * stack a second one), which is how a toast is updated. Default: a fresh id. */\n id?: ToastId;\n description?: ReactNode;\n action?: ToastAction;\n /** A second, quieter button (sonner's `cancel`). */\n cancel?: ToastAction;\n /** Milliseconds; `Infinity` keeps it until dismissed. Default 4s — or\n * {@link TOAST_ACTION_DURATION} when there is an `action`, so there is time to\n * read the message AND reach the button. */\n duration?: number;\n /** Called when the toast is closed by the user (close button, swipe, action). */\n onDismiss?: (toast: { id: ToastId }) => void;\n /** Called when the toast times out. */\n onAutoClose?: (toast: { id: ToastId }) => void;\n /** Wrap the message and the description in `data-private`, so an app's demo /\n * privacy mode blurs them like every other sensitive value. */\n redact?: boolean;\n /** Replaces the tone's icon. */\n icon?: ReactNode;\n /** `false`: no close button, no swipe. */\n dismissible?: boolean;\n /** Per toast, over the `<Toaster>`'s `closeButton`. */\n closeButton?: boolean;\n className?: string;\n style?: CSSProperties;\n}\n\n/** The default duration of a toast that carries an action (8s rather than 4s). */\nexport const TOAST_ACTION_DURATION = 8000;\n\ntype Kind = \"default\" | \"success\" | \"error\" | \"warning\" | \"info\" | \"loading\";\n\nconst privately = (node: ReactNode) => <span data-private=\"\">{node}</span>;\n\n/**\n * The toast's id, written onto its `<li>` as a class — the one per-toast attribute\n * sonner passes through untouched besides `testId`, which is the app's (sonner keeps the\n * id in React state only). `<Toaster dismissOnMiddleClick>` reads it back to dismiss\n * the toast under the pointer, close button or not. The type is kept (`s`/`n`) because\n * sonner matches ids with `===`, and the value is URI-encoded so any string id is one\n * whitespace-free class token.\n */\nconst ID_CLASS = \"kit-toast-id-\";\nconst idClass = (id: ToastId) =>\n `${ID_CLASS}${typeof id === \"number\" ? \"n\" : \"s\"}-${encodeURIComponent(String(id))}`;\n\n/** The id {@link idClass} stamped on a toast element, or null for a toast the kit did\n * not make (an app still calling sonner directly). */\nfunction readToastId(el: Element): ToastId | null {\n for (const token of el.classList) {\n if (!token.startsWith(ID_CLASS)) continue;\n const kind = token.charAt(ID_CLASS.length);\n const raw = decodeURIComponent(token.slice(ID_CLASS.length + 2));\n return kind === \"n\" ? Number(raw) : raw;\n }\n return null;\n}\n\nfunction toSonnerData(opts: ToastOptions | undefined, id: ToastId): SonnerData {\n const { redact, description, duration, action, className, ...rest } = opts ?? {};\n const data: SonnerData = { ...rest, id, className: className ? `${idClass(id)} ${className}` : idClass(id) };\n if (description !== undefined) data.description = redact ? privately(description) : description;\n if (action) data.action = action;\n const resolved = duration ?? (action ? TOAST_ACTION_DURATION : undefined);\n if (resolved !== undefined) data.duration = resolved;\n return data;\n}\n\nfunction show(kind: Kind, message: ReactNode, opts?: ToastOptions): ToastId {\n const id = opts?.id ?? nextId();\n const title = opts?.redact ? privately(message) : message;\n const data = toSonnerData(opts, id);\n withSonner((s) => {\n if (kind === \"default\") s.toast(title, data);\n else s.toast[kind](title, data);\n });\n return id;\n}\n\nexport interface ToastPromiseOptions<T> extends ToastOptions {\n loading: ReactNode;\n /** The success message, or a function of the resolved value. Omitted: the loading\n * toast is dismissed. */\n success?: ReactNode | ((value: T) => ReactNode);\n /** The error message, or a function of the rejection. Omitted: dismissed. */\n error?: ReactNode | ((error: unknown) => ReactNode);\n finally?: () => void;\n}\n\nexport interface ToastUndoOptions extends Omit<ToastOptions, \"action\"> {\n /** Called when the button is pressed. */\n onUndo: () => void;\n /** Default: `toast.undo` from `<UiKitProvider>` (\"Undo\"). */\n label?: ReactNode;\n /** Default `success` — the step the toast reports worked. */\n tone?: Exclude<Kind, \"loading\">;\n}\n\nexport interface ToastRedoOptions extends Omit<ToastUndoOptions, \"onUndo\"> {\n onRedo: () => void;\n}\n\nfunction undoable(\n message: ReactNode,\n { tone = \"success\", label, run, ...opts }: Omit<ToastUndoOptions, \"onUndo\"> & { run: () => void },\n fallback: ReactNode,\n): ToastId {\n return show(tone, message, {\n ...opts,\n action: { label: label ?? fallback, onClick: () => run() },\n });\n}\n\n/**\n * Show a toast. The same shape as sonner's `toast`, so an app migrates by changing the\n * import: `toast(msg, opts)`, `toast.success` / `error` / `warning` / `info` /\n * `loading`, `toast.promise`, `toast.dismiss`, `toast.custom`. Each returns the toast's\n * id; pass it back as `id` to replace that toast in place.\n *\n * Needs a mounted {@link Toaster}. Messages may be any ReactNode.\n */\nexport const toast = Object.assign(\n (message: ReactNode, opts?: ToastOptions): ToastId => show(\"default\", message, opts),\n {\n message: (message: ReactNode, opts?: ToastOptions) => show(\"default\", message, opts),\n success: (message: ReactNode, opts?: ToastOptions) => show(\"success\", message, opts),\n error: (message: ReactNode, opts?: ToastOptions) => show(\"error\", message, opts),\n warning: (message: ReactNode, opts?: ToastOptions) => show(\"warning\", message, opts),\n info: (message: ReactNode, opts?: ToastOptions) => show(\"info\", message, opts),\n /** A spinner that does not time out — replace it (same `id`) or dismiss it. */\n loading: (message: ReactNode, opts?: ToastOptions) => show(\"loading\", message, opts),\n\n /**\n * A loading toast that becomes the success or the error toast, in place, when\n * `promise` settles. Returns the toast's id; the promise itself is the caller's.\n */\n promise<T>(promise: Promise<T> | (() => Promise<T>), options: ToastPromiseOptions<T>): ToastId {\n const { loading: pending, success, error, finally: onFinally, ...opts } = options;\n const id = show(\"loading\", pending, opts);\n const same = { ...opts, id };\n Promise.resolve()\n .then(() => (typeof promise === \"function\" ? promise() : promise))\n .then(\n (value) => {\n if (success === undefined) toast.dismiss(id);\n else show(\"success\", typeof success === \"function\" ? success(value) : success, same);\n },\n (reason: unknown) => {\n if (error === undefined) toast.dismiss(id);\n else show(\"error\", typeof error === \"function\" ? error(reason) : error, same);\n },\n )\n .finally(() => onFinally?.());\n return id;\n },\n\n /** Close one toast, or every toast when `id` is omitted. */\n dismiss(id?: ToastId): void {\n withSonner((s) => s.toast.dismiss(id));\n },\n\n /** Render your own node in a toast slot — `render` receives the id to dismiss it. */\n custom(render: (id: ToastId) => ReactElement, opts?: Omit<ToastOptions, \"redact\">): ToastId {\n const id = opts?.id ?? nextId();\n const data = toSonnerData(opts, id);\n withSonner((s) => s.toast.custom(render, data));\n return id;\n },\n\n /**\n * \"Deleted — Undo\": a toast whose action takes the step back, labelled by the\n * provider's `toast.undo`. The journal stays the app's; this is only its toast.\n * Pair with {@link toast.redo} so the step back can itself be taken back.\n */\n undo(message: ReactNode, { onUndo, ...opts }: ToastUndoOptions): ToastId {\n return undoable(message, { ...opts, run: onUndo }, activeLabels.undo);\n },\n\n /** {@link toast.undo}'s mirror: the action is labelled `toast.redo`. */\n redo(message: ReactNode, { onRedo, ...opts }: ToastRedoOptions): ToastId {\n return undoable(message, { ...opts, run: onRedo }, activeLabels.redo);\n },\n },\n);\n\n/* ── The Toaster ─────────────────────────────────────────────────────────── */\n\nexport type ToastPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\nexport type ToastSwipeDirection = \"top\" | \"right\" | \"bottom\" | \"left\";\n\n/** sonner's offset: one value for every edge, or per edge. Numbers are px, which do not\n * follow the text size — prefer a CSS length (rem, or a `calc()` on\n * {@link TOASTER_OFFSET_TOP} / {@link TOASTER_OFFSET_BOTTOM}). */\nexport type ToasterOffset =\n | string\n | number\n | { top?: string | number; right?: string | number; bottom?: string | number; left?: string | number };\n\nexport interface ToasterProps {\n /** Default: `bottom-center` on a phone (so the toast covers neither the header's\n * buttons nor the bottom nav's), `top-center` from `md` up. */\n position?: ToastPosition;\n /** The height to keep clear at the bottom — AppShell's bottom nav. Default: its\n * measured `--app-nav-h`, so nothing has to be passed under an AppShell. The safe\n * area is added either way. Numbers are px. */\n navOffset?: string | number;\n /** Default: follows the `.dark` class the kit's theme store (`useApplyTheme`) puts\n * on `<html>` — whichever store the app built, with nothing passed. */\n theme?: \"light\" | \"dark\" | \"system\";\n labels?: Partial<ToastLabels>;\n /** Default 4s (8s for a toast with an action). */\n duration?: number;\n visibleToasts?: number;\n expand?: boolean;\n /** Default true. */\n closeButton?: boolean;\n /** Tone-coloured toasts (the AlertBanner tokens). Default true. */\n richColors?: boolean;\n /** Default: every direction. */\n swipeDirections?: ToastSwipeDirection[];\n /** Overrides the computed offset outright (above the nav on a phone, below a 48px\n * top bar on desktop). */\n offset?: ToasterOffset;\n /** Below 600px, where sonner switches to its full-width layout. Default: `offset`'s\n * phone value. */\n mobileOffset?: ToasterOffset;\n /** Keyboard shortcut that moves focus into the toasts. Default Alt+T. */\n hotkey?: string[];\n gap?: number;\n dir?: \"ltr\" | \"rtl\" | \"auto\";\n /**\n * A middle click on a toast dismisses it (0.18.0) — the gesture that closes a tab,\n * which is what keksdose's users reached for (dev #583). By id, so it works on a\n * toast with `closeButton: false` too; it counts as the user closing it, so\n * `onDismiss` runs. Not on a link or a button inside the toast — a middle click on a\n * link still opens it in a new tab — and not on a `dismissible: false` toast.\n * Default true.\n */\n dismissOnMiddleClick?: boolean;\n className?: string;\n style?: CSSProperties;\n}\n\n/** The kit's palette, mapped onto sonner's variables. Inline on the toaster element,\n * so it wins over sonner's injected sheet with no specificity contest. The tone\n * backgrounds go through `--toast-*` aliases computed at `:root` in tokens.css:\n * sonner redefines `--success-bg` on this same element, and a variable cannot read\n * its own name — `--success-bg: var(--success-bg)` here would be a cycle. */\nconst KIT_TOASTER_STYLE = {\n zIndex: \"var(--z-toast, 2147483647)\",\n fontFamily: \"inherit\",\n \"--normal-bg\": \"var(--bg-surface)\",\n \"--normal-bg-hover\": \"var(--bg-hover)\",\n \"--normal-border\": \"var(--border)\",\n \"--normal-border-hover\": \"var(--border-strong)\",\n \"--normal-text\": \"var(--text-primary)\",\n \"--gray2\": \"var(--bg-hover)\",\n \"--gray5\": \"var(--border-strong)\",\n \"--gray11\": \"var(--text-muted)\",\n \"--success-bg\": \"var(--toast-success-bg)\",\n \"--success-border\": \"var(--toast-success-border)\",\n \"--success-text\": \"var(--success)\",\n \"--info-bg\": \"var(--toast-info-bg)\",\n \"--info-border\": \"var(--toast-info-border)\",\n \"--info-text\": \"var(--info)\",\n \"--warning-bg\": \"var(--toast-warning-bg)\",\n \"--warning-border\": \"var(--toast-warning-border)\",\n \"--warning-text\": \"var(--warning)\",\n \"--error-bg\": \"var(--toast-danger-bg)\",\n \"--error-border\": \"var(--toast-danger-border)\",\n \"--error-text\": \"var(--danger)\",\n} as CSSProperties;\n\nconst ALL_DIRECTIONS: ToastSwipeDirection[] = [\"top\", \"right\", \"bottom\", \"left\"];\n\n/** Light or dark, as the `.dark` class on `<html>` says right now. */\nfunction readDocumentTheme(): \"light\" | \"dark\" {\n return typeof document !== \"undefined\" && document.documentElement.classList.contains(\"dark\")\n ? \"dark\"\n : \"light\";\n}\n\nfunction subscribeDocumentTheme(onChange: () => void): () => void {\n if (typeof MutationObserver === \"undefined\") return () => {};\n const mo = new MutationObserver(onChange);\n mo.observe(document.documentElement, { attributes: true, attributeFilter: [\"class\"] });\n return () => mo.disconnect();\n}\n\nconst px = (v: string | number) => (typeof v === \"number\" ? `${v}px` : v);\n\n/**\n * The Toaster's default distance from the top edge (desktop), as a CSS length (0.32,\n * docs/text-size-harmonization.md §10.11): below a 3rem top bar with 1rem to spare, and\n * the safe area. In rem, so it moves with the text size along with the top bar — an\n * app's `offset={{ top: 64 }}` (keksdose) did not. Pass it, or a `calc()` built on it,\n * instead of a px number.\n */\nexport const TOASTER_OFFSET_TOP = \"calc(env(safe-area-inset-top, 0px) + 4rem)\";\n\n/**\n * The Toaster's default distance from the bottom edge (phone), as a CSS length: above\n * AppShell's measured bottom nav (`--app-nav-h`) or the home indicator, whichever is\n * taller, with 0.75rem to spare.\n */\nexport const TOASTER_OFFSET_BOTTOM = \"calc(max(var(--app-nav-h, 0px), env(safe-area-inset-bottom, 0px)) + 0.75rem)\";\n\n/**\n * Where the toasts appear, with the kit's defaults — mount ONE, near the root and\n * inside `<UiKitProvider>` (it reads the `toast` labels) and inside the router if a\n * toast's content navigates.\n *\n * Accessible as sonner makes it: the toasts sit in a polite live region, so a message\n * is announced with its description and its action's label; every toast and every\n * button in it is focusable, the timer pauses while focus or the pointer is inside,\n * and Alt+T ({@link ToasterProps.hotkey}) moves focus to the newest toast. A toast\n * with an action stays up 8s by default, so the button can be reached.\n */\nexport function Toaster({\n position,\n navOffset,\n theme,\n labels: labelsProp,\n closeButton = true,\n richColors = true,\n swipeDirections = ALL_DIRECTIONS,\n offset,\n mobileOffset,\n dismissOnMiddleClick = true,\n className,\n style,\n ...rest\n}: ToasterProps) {\n const [mod, setMod] = useState<Sonner | null>(sonner);\n useEffect(() => {\n if (mod) return;\n let live = true;\n void loadSonner().then((m) => {\n if (live && m) setMod(m);\n });\n return () => {\n live = false;\n };\n }, [mod]);\n\n const labels = useKitLabels(\"toast\", DEFAULT_TOAST_LABELS, labelsProp);\n useEffect(() => {\n activeLabels = labels;\n return () => {\n if (activeLabels === labels) activeLabels = DEFAULT_TOAST_LABELS;\n };\n }, [labels]);\n\n useEffect(() => {\n if (!dismissOnMiddleClick || !mod) return;\n // On the document rather than the toaster: sonner owns the `<ol>`, and a listener\n // there would have to be re-attached whenever it remounts it.\n const toastUnder = (e: globalThis.MouseEvent) => {\n if (e.button !== 1 || !(e.target instanceof Element)) return null;\n const li = e.target.closest<HTMLElement>(\"[data-sonner-toast]\");\n if (!li || li.dataset.dismissible === \"false\") return null;\n // A link keeps its middle click (open in a new tab); a button or a field inside\n // the toast is the app's, not a background to click.\n const control = e.target.closest(\"a[href], button, input, select, textarea, [role='button'], [role='link']\");\n if (control && li.contains(control)) return null;\n return li;\n };\n // `mousedown`: the middle button starts autoscroll (Windows) before any click.\n const onDown = (e: globalThis.MouseEvent) => {\n if (toastUnder(e)) e.preventDefault();\n };\n const onAux = (e: globalThis.MouseEvent) => {\n const li = toastUnder(e);\n if (!li) return;\n // No paste of the primary selection on Linux, no other handler's idea of it.\n e.preventDefault();\n const id = readToastId(li);\n if (id !== null) mod.toast.dismiss(id);\n // A toast made by sonner directly carries no id: its close button, if any.\n else li.querySelector<HTMLButtonElement>(\"[data-close-button]\")?.click();\n };\n document.addEventListener(\"mousedown\", onDown);\n document.addEventListener(\"auxclick\", onAux);\n return () => {\n document.removeEventListener(\"mousedown\", onDown);\n document.removeEventListener(\"auxclick\", onAux);\n };\n }, [dismissOnMiddleClick, mod]);\n\n const documentTheme = useSyncExternalStore(subscribeDocumentTheme, readDocumentTheme, () => \"light\" as const);\n const phone = usePhoneLayout();\n const resolved: ToastPosition = position ?? (phone ? \"bottom-center\" : \"top-center\");\n\n // Above the bottom nav and the home indicator: whichever is taller, since the nav\n // already pads itself by the safe area (the same sum BulkActionBar floats on).\n const bottom =\n navOffset === undefined\n ? TOASTER_OFFSET_BOTTOM\n : `calc(max(${px(navOffset)}, env(safe-area-inset-bottom, 0px)) + 0.75rem)`;\n // Below a 3rem TopBar with the same 1rem clearance.\n const top = TOASTER_OFFSET_TOP;\n const computed = resolved.startsWith(\"bottom\") ? { bottom } : { top };\n\n if (!mod) return null;\n const Sonner = mod.Toaster;\n return (\n <Sonner\n {...rest}\n position={resolved}\n theme={theme ?? documentTheme}\n closeButton={closeButton}\n richColors={richColors}\n swipeDirections={swipeDirections}\n offset={offset ?? computed}\n mobileOffset={mobileOffset ?? offset ?? computed}\n containerAriaLabel={labels.notifications}\n toastOptions={{ closeButtonAriaLabel: labels.close }}\n className={className ? `kit-toaster ${className}` : \"kit-toaster\"}\n style={{ ...KIT_TOASTER_STYLE, ...style }}\n />\n );\n}\n"],"mappings":";AAsIuC;AAtIvC,SAAS,WAAW,UAAU,4BAA4B;AAE1D,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AA0B/B,IAAI,SAAwB;AAC5B,IAAI,UAAyC;AAC7C,MAAM,QAAoC,CAAC;AAE3C,SAAS,aAAqC;AAC5C,cAAY,OAAO,QAAQ,EAAE;AAAA,IAC3B,CAAC,QAAQ;AACP,eAAS;AAGT,iBAAW,MAAM,MAAM,OAAO,CAAC,EAAG,IAAG,GAAG;AACxC,aAAO;AAAA,IACT;AAAA,IACA,MAAM;AACJ,YAAM,SAAS;AACf,cAAQ;AAAA,QACN;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,WAAW,IAA+B;AACjD,MAAI,QAAQ;AACV,OAAG,MAAM;AACT;AAAA,EACF;AACA,QAAM,KAAK,EAAE;AACb,OAAK,WAAW;AAClB;AAEA,IAAI,UAAU;AACd,MAAM,SAAS,MAAM,aAAa,EAAE,OAAO;AAcpC,MAAM,uBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,eAAe;AAAA,EACf,MAAM;AAAA,EACN,MAAM;AACR;AAKA,IAAI,eAA4B;AA2CzB,MAAM,wBAAwB;AAIrC,MAAM,YAAY,CAAC,SAAoB,oBAAC,UAAK,gBAAa,IAAI,gBAAK;AAUnE,MAAM,WAAW;AACjB,MAAM,U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AAA,MACxC,oBAAoB,OAAO;AAAA,MAC3B,cAAc,EAAE,sBAAsB,OAAO,MAAM;AAAA,MACnD,WAAW,YAAY,eAAe,SAAS,KAAK;AAAA,MACpD,OAAO,EAAE,GAAG,mBAAmB,GAAG,MAAM;AAAA;AAAA,EAC1C;AAEJ;","names":[]}
@@ -1,4 +1,8 @@
1
1
  import { ComponentPropsWithoutRef, ReactNode, ReactElement } from 'react';
2
+ import { DisabledReasonDisplay } from './field-parts.js';
3
+ import './tooltip.js';
4
+ import '../hooks/use-anchored-rect.js';
5
+ import '../lib/clipping.js';
2
6
 
3
7
  interface ToggleOption<T extends string> {
4
8
  value: T;
@@ -27,6 +31,11 @@ interface ToggleGroupBaseProps<T extends string> extends Omit<ComponentPropsWith
27
31
  * whole ("Bewegung", not "Beweg…"), at the price of a taller group on a narrow
28
32
  * screen (lenkbank L4: five signal types on a 390px control page). From the width
29
33
  * where they fit, both look the same.
34
+ *
35
+ * Since 0.32 a group in the field chrome (`label`, the default placement) with four or
36
+ * more options wraps at Large and Extra large under `"truncate"` too, inside its frame:
37
+ * the type is bigger there and the field would otherwise run past a phone's edge
38
+ * (docs/text-size-harmonization.md §4). The keyboard is the same either way.
30
39
  */
31
40
  overflow?: "truncate" | "wrap";
32
41
  /**
@@ -107,8 +116,15 @@ interface ToggleGroupBaseProps<T extends string> extends Omit<ComponentPropsWith
107
116
  * two stack and both keep their corners.
108
117
  */
109
118
  chromeClassName?: string;
110
- /** A {@link FieldHint} on the label line, as on a labelled {@link Select}. Only with
111
- * `label`. */
119
+ /**
120
+ * As on a labelled {@link Select}: a {@link FieldHint} "?" on the label line, and plain
121
+ * text (a string) as a caption under the group. Only with `label`.
122
+ *
123
+ * 0.32.1 (keksdose's 0.32 report): text went on the label line in every placement, so
124
+ * `TextSizeSetting`'s hint with `labelPlacement="above"` sat beside the label in body
125
+ * type, and at Extra large became a column one word wide — on the setting a reader who
126
+ * needs large text opens first. The label line holds the "?" only (`isTextHint`).
127
+ */
112
128
  hint?: ReactNode;
113
129
  /** The message under the field when it is wrong: paints the field's border with
114
130
  * `--danger`, marks the group `aria-invalid` and describes it with the message, as
@@ -127,6 +143,12 @@ interface ToggleGroupBaseProps<T extends string> extends Omit<ComponentPropsWith
127
143
  * Wins over `disabled`, as on Button: passing both keeps the group reachable.
128
144
  */
129
145
  disabledReason?: ReactNode;
146
+ /**
147
+ * Where `disabledReason` shows (0.32, §4 "No fact only in a tooltip"): by default, at
148
+ * Large and on a touch screen, as a line under the group (where its caption goes), and
149
+ * in the tooltip over the segments otherwise. See {@link DisabledReasonDisplay}.
150
+ */
151
+ disabledReasonDisplay?: DisabledReasonDisplay;
130
152
  /**
131
153
  * This group COMMITS — choosing an option saves it. Under a locked
132
154
  * {@link WriteLockProvider} it takes the `disabledReason` path with the lock's
@@ -145,7 +167,7 @@ interface ToggleGroupBaseProps<T extends string> extends Omit<ComponentPropsWith
145
167
  * region, because a description is read when the group is entered and not again when
146
168
  * an arrow key changes the choice underneath it.
147
169
  *
148
- * In muted 11px text under the field (or the bare group), above an `error`.
170
+ * In muted caption-size text under the field (or the bare group), above an `error`.
149
171
  */
150
172
  type ToggleGroupCaption<V> = ReactNode | ((value: V) => ReactNode);
151
173
  /** The group as it has always been: one option is always the answer. */