@eifi1/ui-kit 0.51.3 → 0.51.5

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 (780) hide show
  1. package/README.md +6 -6
  2. package/dist/account/account-settings-labels.js.map +1 -1
  3. package/dist/account/account-settings.js +11 -9
  4. package/dist/account/account-settings.js.map +1 -1
  5. package/dist/account/delete-account-setting.js +56 -65
  6. package/dist/account/delete-account-setting.js.map +1 -1
  7. package/dist/account/email-change-setting-labels.js.map +1 -1
  8. package/dist/account/email-change-setting.js.map +1 -1
  9. package/dist/account/passkeys-setting.js.map +1 -1
  10. package/dist/account/sessions-setting.js.map +1 -1
  11. package/dist/admin/admin-action-confirm.js +1 -3
  12. package/dist/admin/admin-action-confirm.js.map +1 -1
  13. package/dist/admin/admin-action-log.js.map +1 -1
  14. package/dist/admin/admin-area-labels.js +4 -1
  15. package/dist/admin/admin-area-labels.js.map +1 -1
  16. package/dist/admin/admin-overview.js +19 -11
  17. package/dist/admin/admin-overview.js.map +1 -1
  18. package/dist/admin/admin-sections.js.map +1 -1
  19. package/dist/admin/admin-tool-links.d.ts +1 -1
  20. package/dist/admin/admin-tool-links.js +7 -1
  21. package/dist/admin/admin-tool-links.js.map +1 -1
  22. package/dist/admin/invitations-panel.js +2 -13
  23. package/dist/admin/invitations-panel.js.map +1 -1
  24. package/dist/admin/mail-test-card.js.map +1 -1
  25. package/dist/admin/reviewer-scope-editor.js +4 -11
  26. package/dist/admin/reviewer-scope-editor.js.map +1 -1
  27. package/dist/admin/role-select.js.map +1 -1
  28. package/dist/admin/user-roster.js +1 -9
  29. package/dist/admin/user-roster.js.map +1 -1
  30. package/dist/auth/accept-invitation.js.map +1 -1
  31. package/dist/auth/auth-errors.js.map +1 -1
  32. package/dist/auth/forgot-password-form.js +23 -31
  33. package/dist/auth/forgot-password-form.js.map +1 -1
  34. package/dist/auth/register-form.js.map +1 -1
  35. package/dist/auth/reset-password-form.js.map +1 -1
  36. package/dist/auth/sign-in-form.js +13 -5
  37. package/dist/auth/sign-in-form.js.map +1 -1
  38. package/dist/auth/verify-email.js +1 -8
  39. package/dist/auth/verify-email.js.map +1 -1
  40. package/dist/billing/billing-banner.js.map +1 -1
  41. package/dist/billing/billing-labels.js.map +1 -1
  42. package/dist/billing/checkout-processing.js.map +1 -1
  43. package/dist/billing/plan-card.js +91 -85
  44. package/dist/billing/plan-card.js.map +1 -1
  45. package/dist/billing/plan-limit-toast.js.map +1 -1
  46. package/dist/billing/plan-limit.js.map +1 -1
  47. package/dist/billing/plan-price.js.map +1 -1
  48. package/dist/billing/plan-switch.js.map +1 -1
  49. package/dist/billing/subscription-actions.js.map +1 -1
  50. package/dist/bin/eifi1-pay-page.mjs +6 -1
  51. package/dist/components/account-chips.js.map +1 -1
  52. package/dist/components/alert-banner.js +1 -5
  53. package/dist/components/alert-banner.js.map +1 -1
  54. package/dist/components/amount-input.js +29 -12
  55. package/dist/components/amount-input.js.map +1 -1
  56. package/dist/components/authed-image.js.map +1 -1
  57. package/dist/components/autocomplete.js.map +1 -1
  58. package/dist/components/bulk-action-bar.js +1 -4
  59. package/dist/components/bulk-action-bar.js.map +1 -1
  60. package/dist/components/button-group.js.map +1 -1
  61. package/dist/components/button-look.js.map +1 -1
  62. package/dist/components/button.js +1 -7
  63. package/dist/components/button.js.map +1 -1
  64. package/dist/components/calculator.js +5 -5
  65. package/dist/components/calculator.js.map +1 -1
  66. package/dist/components/calendar-heatmap.js +4 -10
  67. package/dist/components/calendar-heatmap.js.map +1 -1
  68. package/dist/components/card.js +1 -8
  69. package/dist/components/card.js.map +1 -1
  70. package/dist/components/chart-zoom-core.js +3 -17
  71. package/dist/components/chart-zoom-core.js.map +1 -1
  72. package/dist/components/chart.d.ts +1 -1
  73. package/dist/components/chart.js +4 -22
  74. package/dist/components/chart.js.map +1 -1
  75. package/dist/components/checkbox-group.js +1 -4
  76. package/dist/components/checkbox-group.js.map +1 -1
  77. package/dist/components/chip-input.js +4 -1
  78. package/dist/components/chip-input.js.map +1 -1
  79. package/dist/components/chip.js +10 -5
  80. package/dist/components/chip.js.map +1 -1
  81. package/dist/components/choice-card.js +58 -74
  82. package/dist/components/choice-card.js.map +1 -1
  83. package/dist/components/column-mapper-labels.js.map +1 -1
  84. package/dist/components/column-mapper.js +167 -227
  85. package/dist/components/column-mapper.js.map +1 -1
  86. package/dist/components/combobox-core.js +5 -9
  87. package/dist/components/combobox-core.js.map +1 -1
  88. package/dist/components/combobox.js +1 -4
  89. package/dist/components/combobox.js.map +1 -1
  90. package/dist/components/confirm-dialog.js.map +1 -1
  91. package/dist/components/copy-button.js.map +1 -1
  92. package/dist/components/country-select.d.ts +5 -4
  93. package/dist/components/country-select.js +3 -19
  94. package/dist/components/country-select.js.map +1 -1
  95. package/dist/components/currency-option-list.js +13 -11
  96. package/dist/components/currency-option-list.js.map +1 -1
  97. package/dist/components/currency-select.js +1 -6
  98. package/dist/components/currency-select.js.map +1 -1
  99. package/dist/components/danger-confirm.js.map +1 -1
  100. package/dist/components/data-table-cells.js.map +1 -1
  101. package/dist/components/data-table-column-settings.js.map +1 -1
  102. package/dist/components/data-table-filter-popover.js +2 -18
  103. package/dist/components/data-table-filter-popover.js.map +1 -1
  104. package/dist/components/data-table-filters.js.map +1 -1
  105. package/dist/components/data-table-fit.js +7 -5
  106. package/dist/components/data-table-fit.js.map +1 -1
  107. package/dist/components/data-table-groups.js +3 -1
  108. package/dist/components/data-table-groups.js.map +1 -1
  109. package/dist/components/data-table-head.js +49 -57
  110. package/dist/components/data-table-head.js.map +1 -1
  111. package/dist/components/data-table-mobile.js +31 -44
  112. package/dist/components/data-table-mobile.js.map +1 -1
  113. package/dist/components/data-table-pagination.js.map +1 -1
  114. package/dist/components/data-table-row-actions.js +19 -16
  115. package/dist/components/data-table-row-actions.js.map +1 -1
  116. package/dist/components/data-table-row.js.map +1 -1
  117. package/dist/components/data-table-shared.js.map +1 -1
  118. package/dist/components/data-table-sort.js.map +1 -1
  119. package/dist/components/data-table-virtual.js +4 -1
  120. package/dist/components/data-table-virtual.js.map +1 -1
  121. package/dist/components/data-table.d.ts +8 -0
  122. package/dist/components/data-table.js +30 -39
  123. package/dist/components/data-table.js.map +1 -1
  124. package/dist/components/date-picker.js +1 -6
  125. package/dist/components/date-picker.js.map +1 -1
  126. package/dist/components/date-range-picker.js.map +1 -1
  127. package/dist/components/description-list.js +10 -10
  128. package/dist/components/description-list.js.map +1 -1
  129. package/dist/components/dialog-frame.js +9 -2
  130. package/dist/components/dialog-frame.js.map +1 -1
  131. package/dist/components/disclosure.js +17 -27
  132. package/dist/components/disclosure.js.map +1 -1
  133. package/dist/components/dropdown.js +25 -35
  134. package/dist/components/dropdown.js.map +1 -1
  135. package/dist/components/empty-state.js.map +1 -1
  136. package/dist/components/entity-combobox.js.map +1 -1
  137. package/dist/components/error-boundary.js.map +1 -1
  138. package/dist/components/field-base.js +5 -5
  139. package/dist/components/field-base.js.map +1 -1
  140. package/dist/components/field-parts.d.ts +1 -1
  141. package/dist/components/field-parts.js +10 -14
  142. package/dist/components/field-parts.js.map +1 -1
  143. package/dist/components/field-sync.js +8 -10
  144. package/dist/components/field-sync.js.map +1 -1
  145. package/dist/components/file-button.js.map +1 -1
  146. package/dist/components/file-dropzone.js.map +1 -1
  147. package/dist/components/floating-panel.js +4 -1
  148. package/dist/components/floating-panel.js.map +1 -1
  149. package/dist/components/focus-ring.js.map +1 -1
  150. package/dist/components/form-actions.js.map +1 -1
  151. package/dist/components/grouped-picker.js +11 -12
  152. package/dist/components/grouped-picker.js.map +1 -1
  153. package/dist/components/hover-menu.js +1 -4
  154. package/dist/components/hover-menu.js.map +1 -1
  155. package/dist/components/iban-input-labels.js.map +1 -1
  156. package/dist/components/icon-button.js +4 -1
  157. package/dist/components/icon-button.js.map +1 -1
  158. package/dist/components/icon-picker.js +6 -10
  159. package/dist/components/icon-picker.js.map +1 -1
  160. package/dist/components/image-grid.js +41 -50
  161. package/dist/components/image-grid.js.map +1 -1
  162. package/dist/components/inline-edit-field.js.map +1 -1
  163. package/dist/components/inline-entity-combobox.js +6 -12
  164. package/dist/components/inline-entity-combobox.js.map +1 -1
  165. package/dist/components/input.js +14 -2
  166. package/dist/components/input.js.map +1 -1
  167. package/dist/components/jump-calendar.js +1 -7
  168. package/dist/components/jump-calendar.js.map +1 -1
  169. package/dist/components/legal-labels.js +8 -2
  170. package/dist/components/legal-labels.js.map +1 -1
  171. package/dist/components/legal-page.d.ts +18 -1
  172. package/dist/components/legal-page.js +27 -2
  173. package/dist/components/legal-page.js.map +1 -1
  174. package/dist/components/legal.d.ts +40 -5
  175. package/dist/components/legal.js +41 -5
  176. package/dist/components/legal.js.map +1 -1
  177. package/dist/components/lightbox.js.map +1 -1
  178. package/dist/components/line-items.js +26 -36
  179. package/dist/components/line-items.js.map +1 -1
  180. package/dist/components/list-labels.js +3 -1
  181. package/dist/components/list-labels.js.map +1 -1
  182. package/dist/components/list.d.ts +18 -1
  183. package/dist/components/list.js +54 -13
  184. package/dist/components/list.js.map +1 -1
  185. package/dist/components/measured-grid.js +29 -53
  186. package/dist/components/measured-grid.js.map +1 -1
  187. package/dist/components/menu-item.js.map +1 -1
  188. package/dist/components/mini-calendar.js +13 -31
  189. package/dist/components/mini-calendar.js.map +1 -1
  190. package/dist/components/money-field.js.map +1 -1
  191. package/dist/components/month-picker.js +10 -21
  192. package/dist/components/month-picker.js.map +1 -1
  193. package/dist/components/multi-entity-combobox.js +3 -16
  194. package/dist/components/multi-entity-combobox.js.map +1 -1
  195. package/dist/components/multi-select.js.map +1 -1
  196. package/dist/components/nav-pills.js +10 -1
  197. package/dist/components/nav-pills.js.map +1 -1
  198. package/dist/components/number-field.js.map +1 -1
  199. package/dist/components/number-input.js +1 -7
  200. package/dist/components/number-input.js.map +1 -1
  201. package/dist/components/numpad-sheet.js +1 -4
  202. package/dist/components/numpad-sheet.js.map +1 -1
  203. package/dist/components/one-time-code-input.js +1 -7
  204. package/dist/components/one-time-code-input.js.map +1 -1
  205. package/dist/components/page-contents.js +13 -22
  206. package/dist/components/page-contents.js.map +1 -1
  207. package/dist/components/page-header.js +1 -11
  208. package/dist/components/page-header.js.map +1 -1
  209. package/dist/components/password-strength-labels.js.map +1 -1
  210. package/dist/components/password-strength.js +2 -8
  211. package/dist/components/password-strength.js.map +1 -1
  212. package/dist/components/phone-input.js +42 -57
  213. package/dist/components/phone-input.js.map +1 -1
  214. package/dist/components/picker-sheet.js.map +1 -1
  215. package/dist/components/pie-chart.js +1 -8
  216. package/dist/components/pie-chart.js.map +1 -1
  217. package/dist/components/popover.js.map +1 -1
  218. package/dist/components/progress-bar.js +16 -9
  219. package/dist/components/progress-bar.js.map +1 -1
  220. package/dist/components/qr-code.js +1 -8
  221. package/dist/components/qr-code.js.map +1 -1
  222. package/dist/components/row-actions.js +5 -1
  223. package/dist/components/row-actions.js.map +1 -1
  224. package/dist/components/search-field.js.map +1 -1
  225. package/dist/components/select.js +28 -38
  226. package/dist/components/select.js.map +1 -1
  227. package/dist/components/separator.js +1 -5
  228. package/dist/components/separator.js.map +1 -1
  229. package/dist/components/series-chart-axes.js +4 -1
  230. package/dist/components/series-chart-axes.js.map +1 -1
  231. package/dist/components/series-chart-budget.js.map +1 -1
  232. package/dist/components/series-chart-ticks.js.map +1 -1
  233. package/dist/components/series-chart.js +29 -45
  234. package/dist/components/series-chart.js.map +1 -1
  235. package/dist/components/settings-fields.js +21 -17
  236. package/dist/components/settings-fields.js.map +1 -1
  237. package/dist/components/share-card.js +4 -9
  238. package/dist/components/share-card.js.map +1 -1
  239. package/dist/components/sign-chip.js.map +1 -1
  240. package/dist/components/signature-pad.js +4 -13
  241. package/dist/components/signature-pad.js.map +1 -1
  242. package/dist/components/signed-amount.js +12 -5
  243. package/dist/components/signed-amount.js.map +1 -1
  244. package/dist/components/skeleton.js +2 -17
  245. package/dist/components/skeleton.js.map +1 -1
  246. package/dist/components/slider.js +13 -36
  247. package/dist/components/slider.js.map +1 -1
  248. package/dist/components/sparkline.js.map +1 -1
  249. package/dist/components/stat-tile.js +14 -10
  250. package/dist/components/stat-tile.js.map +1 -1
  251. package/dist/components/swatch-picker.js +14 -4
  252. package/dist/components/swatch-picker.js.map +1 -1
  253. package/dist/components/swipeable-row.d.ts +1 -1
  254. package/dist/components/swipeable-row.js +1 -8
  255. package/dist/components/swipeable-row.js.map +1 -1
  256. package/dist/components/table-skeleton.js +4 -1
  257. package/dist/components/table-skeleton.js.map +1 -1
  258. package/dist/components/table.js +12 -9
  259. package/dist/components/table.js.map +1 -1
  260. package/dist/components/tabs.js +5 -24
  261. package/dist/components/tabs.js.map +1 -1
  262. package/dist/components/text-link.js.map +1 -1
  263. package/dist/components/text.js.map +1 -1
  264. package/dist/components/tile-radio.js +1 -7
  265. package/dist/components/tile-radio.js.map +1 -1
  266. package/dist/components/time-input.js.map +1 -1
  267. package/dist/components/toast.js.map +1 -1
  268. package/dist/components/toggle-group.js +6 -1
  269. package/dist/components/toggle-group.js.map +1 -1
  270. package/dist/components/toggle-legend.js +2 -11
  271. package/dist/components/toggle-legend.js.map +1 -1
  272. package/dist/components/tooltip.js +2 -22
  273. package/dist/components/tooltip.js.map +1 -1
  274. package/dist/components/translation-review-editor.js +1 -4
  275. package/dist/components/translation-review-editor.js.map +1 -1
  276. package/dist/components/translation-review-parts.d.ts +1 -1
  277. package/dist/components/translation-review-parts.js +7 -1
  278. package/dist/components/translation-review-parts.js.map +1 -1
  279. package/dist/components/translation-review.js +18 -7
  280. package/dist/components/translation-review.js.map +1 -1
  281. package/dist/components/tree-view.js +14 -10
  282. package/dist/components/tree-view.js.map +1 -1
  283. package/dist/components/treemap.js +1 -13
  284. package/dist/components/treemap.js.map +1 -1
  285. package/dist/components/trigger-aria.js.map +1 -1
  286. package/dist/components/use-table-state.js +14 -11
  287. package/dist/components/use-table-state.js.map +1 -1
  288. package/dist/components/user-avatar.js +3 -26
  289. package/dist/components/user-avatar.js.map +1 -1
  290. package/dist/demo/demo-start.js +8 -4
  291. package/dist/demo/demo-start.js.map +1 -1
  292. package/dist/eslint/index.js +1 -1
  293. package/dist/feedback/feedback-attachment-labels.js.map +1 -1
  294. package/dist/feedback/feedback-attachment.js +1 -8
  295. package/dist/feedback/feedback-attachment.js.map +1 -1
  296. package/dist/feedback/feedback-capture.d.ts +1 -1
  297. package/dist/feedback/feedback-capture.js +3 -1
  298. package/dist/feedback/feedback-capture.js.map +1 -1
  299. package/dist/feedback/feedback-comment-thread.js +27 -13
  300. package/dist/feedback/feedback-comment-thread.js.map +1 -1
  301. package/dist/feedback/feedback-context.js +1 -4
  302. package/dist/feedback/feedback-context.js.map +1 -1
  303. package/dist/feedback/feedback-dialog.js.map +1 -1
  304. package/dist/feedback/feedback-inbox.js.map +1 -1
  305. package/dist/feedback/feedback-public-list.js +7 -1
  306. package/dist/feedback/feedback-public-list.js.map +1 -1
  307. package/dist/feedback/feedback-record.js +1 -5
  308. package/dist/feedback/feedback-record.js.map +1 -1
  309. package/dist/feedback/feedback-replies.js +25 -10
  310. package/dist/feedback/feedback-replies.js.map +1 -1
  311. package/dist/feedback/feedback-row-detail.js.map +1 -1
  312. package/dist/feedback/feedback-status-undo.js.map +1 -1
  313. package/dist/feedback/feedback-submit-dialog.js.map +1 -1
  314. package/dist/feedback/feedback-table.d.ts +3 -1
  315. package/dist/feedback/feedback-table.js +22 -5
  316. package/dist/feedback/feedback-table.js.map +1 -1
  317. package/dist/feedback/feedback-thread.js +2 -13
  318. package/dist/feedback/feedback-thread.js.map +1 -1
  319. package/dist/feedback/feedback-vocabulary.js.map +1 -1
  320. package/dist/feedback/feedback-vote-button.js.map +1 -1
  321. package/dist/hooks/use-anchored-rect.js.map +1 -1
  322. package/dist/hooks/use-document-title.js.map +1 -1
  323. package/dist/hooks/use-file-drop.js.map +1 -1
  324. package/dist/hooks/use-file-picker-labels.js.map +1 -1
  325. package/dist/hooks/use-file-picker.js.map +1 -1
  326. package/dist/hooks/use-focus-trap.js.map +1 -1
  327. package/dist/hooks/use-overlay-history.js +10 -5
  328. package/dist/hooks/use-overlay-history.js.map +1 -1
  329. package/dist/hooks/use-row-swipe.d.ts +1 -1
  330. package/dist/hooks/use-row-swipe.js +1 -6
  331. package/dist/hooks/use-row-swipe.js.map +1 -1
  332. package/dist/i18n/defaults.js +1 -4
  333. package/dist/i18n/defaults.js.map +1 -1
  334. package/dist/i18n/german.js +15 -4
  335. package/dist/i18n/german.js.map +1 -1
  336. package/dist/i18n/kit-labels.js +2 -8
  337. package/dist/i18n/kit-labels.js.map +1 -1
  338. package/dist/i18n/languages.js.map +1 -1
  339. package/dist/i18n/locales/en.js +19 -4
  340. package/dist/i18n/locales/en.js.map +2 -2
  341. package/dist/i18n/locales/es.js +15 -4
  342. package/dist/i18n/locales/es.js.map +1 -1
  343. package/dist/i18n/locales/fr.js +15 -4
  344. package/dist/i18n/locales/fr.js.map +1 -1
  345. package/dist/i18n/locales/hu.js +15 -4
  346. package/dist/i18n/locales/hu.js.map +1 -1
  347. package/dist/i18n/locales/it.js +15 -4
  348. package/dist/i18n/locales/it.js.map +1 -1
  349. package/dist/i18n/locales/zh.js +11 -3
  350. package/dist/i18n/locales/zh.js.map +1 -1
  351. package/dist/i18n/plurals.js.map +1 -1
  352. package/dist/i18n/review.js +15 -7
  353. package/dist/i18n/review.js.map +1 -1
  354. package/dist/i18n/shared-labels.js.map +1 -1
  355. package/dist/index.d.ts +17 -17
  356. package/dist/index.js +40 -23
  357. package/dist/index.js.map +1 -1
  358. package/dist/landing/access.js +1 -4
  359. package/dist/landing/access.js.map +1 -1
  360. package/dist/landing/landing-sections.js +35 -38
  361. package/dist/landing/landing-sections.js.map +1 -1
  362. package/dist/landing/page-seo.js.map +1 -1
  363. package/dist/lib/calc.js.map +1 -1
  364. package/dist/lib/clipboard-minus.js.map +1 -1
  365. package/dist/lib/dates.js.map +1 -1
  366. package/dist/lib/decimal-marks.js.map +1 -1
  367. package/dist/lib/device-settings.js +2 -1
  368. package/dist/lib/device-settings.js.map +1 -1
  369. package/dist/lib/direction.js.map +1 -1
  370. package/dist/lib/iban.js.map +1 -1
  371. package/dist/lib/logger.js +1 -5
  372. package/dist/lib/logger.js.map +1 -1
  373. package/dist/lib/person-name.js.map +1 -1
  374. package/dist/lib/phone.js.map +1 -1
  375. package/dist/lib/qr-encode.js +344 -8
  376. package/dist/lib/qr-encode.js.map +1 -1
  377. package/dist/lib/session-refresh.js.map +1 -1
  378. package/dist/lib/table-text.js +15 -3
  379. package/dist/lib/table-text.js.map +1 -1
  380. package/dist/lib/text-match.d.ts +20 -0
  381. package/dist/lib/text-match.js +11 -1
  382. package/dist/lib/text-match.js.map +1 -1
  383. package/dist/lib/translation-review.js.map +1 -1
  384. package/dist/notifications/notification-inbox.js +63 -44
  385. package/dist/notifications/notification-inbox.js.map +1 -1
  386. package/dist/notifications/notification-parts.js.map +1 -1
  387. package/dist/notifications/notification-types-setting.js.map +1 -1
  388. package/dist/notifications/notifications-labels.js.map +1 -1
  389. package/dist/notifications/push-device-setting.js +6 -1
  390. package/dist/notifications/push-device-setting.js.map +1 -1
  391. package/dist/notifications/push-devices-setting.js.map +1 -1
  392. package/dist/notifications/push-worker.js.map +1 -1
  393. package/dist/notifications/quiet-hours-setting.js.map +1 -1
  394. package/dist/notifications/use-push-device.js +4 -1
  395. package/dist/notifications/use-push-device.js.map +1 -1
  396. package/dist/offline/pwa-update-prompt.d.ts +1 -1
  397. package/dist/offline/pwa-update-prompt.js +7 -1
  398. package/dist/offline/pwa-update-prompt.js.map +1 -1
  399. package/dist/offline/query-persistence.js.map +1 -1
  400. package/dist/offline.d.ts +1 -1
  401. package/dist/offline.js +6 -1
  402. package/dist/offline.js.map +1 -1
  403. package/dist/pay/pay.css +8 -1
  404. package/dist/rhf/fields.d.ts +1 -2
  405. package/dist/rhf/fields.js +1 -10
  406. package/dist/rhf/fields.js.map +1 -1
  407. package/dist/rhf/form-core.js +1 -4
  408. package/dist/rhf/form-core.js.map +1 -1
  409. package/dist/rhf/line-items.js.map +1 -1
  410. package/dist/rhf/use-rhf-wizard-step.js.map +1 -1
  411. package/dist/search/command-palette.js +71 -62
  412. package/dist/search/command-palette.js.map +1 -1
  413. package/dist/search/global-search.js +34 -5
  414. package/dist/search/global-search.js.map +1 -1
  415. package/dist/search/search-index.js.map +1 -1
  416. package/dist/settings/device-reset-setting.js +1 -6
  417. package/dist/settings/device-reset-setting.js.map +1 -1
  418. package/dist/settings/settings-heading.js.map +1 -1
  419. package/dist/settings/settings-layout.js +9 -20
  420. package/dist/settings/settings-layout.js.map +1 -1
  421. package/dist/settings/use-settings-focus.d.ts +7 -0
  422. package/dist/settings/use-settings-focus.js +2 -0
  423. package/dist/settings/use-settings-focus.js.map +1 -1
  424. package/dist/settings/use-settings-route.js.map +1 -1
  425. package/dist/shell/app-shell.js +62 -31
  426. package/dist/shell/app-shell.js.map +1 -1
  427. package/dist/shell/auth-layout.js +1 -10
  428. package/dist/shell/auth-layout.js.map +1 -1
  429. package/dist/shell/dev-menu.d.ts +5 -0
  430. package/dist/shell/dev-menu.js +14 -7
  431. package/dist/shell/dev-menu.js.map +1 -1
  432. package/dist/shell/option-switcher-menu.js.map +1 -1
  433. package/dist/shell/sync-status-indicator.js +7 -6
  434. package/dist/shell/sync-status-indicator.js.map +1 -1
  435. package/dist/shell/top-bar-parts-labels.js.map +1 -1
  436. package/dist/shell/topbar-action-menu.d.ts +14 -1
  437. package/dist/shell/topbar-action-menu.js +85 -34
  438. package/dist/shell/topbar-action-menu.js.map +1 -1
  439. package/dist/shell/topbar-controls.js +1 -10
  440. package/dist/shell/topbar-controls.js.map +1 -1
  441. package/dist/shell/tour-menu.js +9 -1
  442. package/dist/shell/tour-menu.js.map +1 -1
  443. package/dist/shell.d.ts +1 -1
  444. package/dist/shell.js +2 -1
  445. package/dist/shell.js.map +1 -1
  446. package/dist/sync/db.js.map +1 -1
  447. package/dist/sync/engine.js +24 -6
  448. package/dist/sync/engine.js.map +1 -1
  449. package/dist/sync.d.ts +2 -2
  450. package/dist/sync.js +7 -1
  451. package/dist/sync.js.map +1 -1
  452. package/dist/testing/css-variables.js.map +1 -1
  453. package/dist/testing/index.d.ts +1 -1
  454. package/dist/testing/index.js +1 -3
  455. package/dist/testing/index.js.map +1 -1
  456. package/dist/testing/react.js.map +1 -1
  457. package/dist/testing/viewport.js +7 -4
  458. package/dist/testing/viewport.js.map +1 -1
  459. package/dist/theme/contrast-tokens.js +13 -2
  460. package/dist/theme/contrast-tokens.js.map +1 -1
  461. package/dist/theme/palette-derive.d.ts +1 -1
  462. package/dist/theme/palette-derive.js +18 -29
  463. package/dist/theme/palette-derive.js.map +1 -1
  464. package/dist/theme/palette-presets.js.map +1 -1
  465. package/dist/theme/palette-store.js.map +1 -1
  466. package/dist/theme/text-size.js.map +1 -1
  467. package/dist/theme/theme-store.js +1 -3
  468. package/dist/theme/theme-store.js.map +1 -1
  469. package/dist/tour/tour-catalogue.js.map +1 -1
  470. package/dist/tour/tour-dock.js +5 -1
  471. package/dist/tour/tour-dock.js.map +1 -1
  472. package/dist/tour/tour-engine.js +1 -4
  473. package/dist/tour/tour-engine.js.map +1 -1
  474. package/dist/tour/tour.js +21 -12
  475. package/dist/tour/tour.js.map +1 -1
  476. package/dist/tour/use-tour-progress.js.map +1 -1
  477. package/dist/tour/use-tour-url-sync.js.map +1 -1
  478. package/dist/wizard/stepper-nav.js +3 -24
  479. package/dist/wizard/stepper-nav.js.map +1 -1
  480. package/dist/wizard/types.js.map +1 -1
  481. package/dist/wizard/use-wizard.js +24 -28
  482. package/dist/wizard/use-wizard.js.map +1 -1
  483. package/dist/wizard/validation.js.map +1 -1
  484. package/dist/wizard/wizard-context.js.map +1 -1
  485. package/dist/wizard/wizard-step.d.ts +1 -1
  486. package/dist/wizard/wizard-step.js +1 -8
  487. package/dist/wizard/wizard-step.js.map +1 -1
  488. package/dist/wizard/wizard-summary.js.map +1 -1
  489. package/package.json +5 -2
  490. package/src/account/account-settings-labels.ts +1 -2
  491. package/src/account/account-settings.tsx +11 -17
  492. package/src/account/delete-account-setting.tsx +1 -6
  493. package/src/account/email-change-setting-labels.ts +1 -2
  494. package/src/account/email-change-setting.tsx +3 -1
  495. package/src/account/passkeys-setting.tsx +1 -3
  496. package/src/account/sessions-setting.tsx +4 -2
  497. package/src/admin/admin-action-confirm.tsx +4 -7
  498. package/src/admin/admin-action-log.tsx +29 -29
  499. package/src/admin/admin-area-labels.ts +4 -1
  500. package/src/admin/admin-overview.tsx +8 -2
  501. package/src/admin/admin-sections.tsx +3 -1
  502. package/src/admin/admin-tool-links.tsx +7 -1
  503. package/src/admin/invitations-panel.tsx +5 -11
  504. package/src/admin/mail-test-card.tsx +1 -2
  505. package/src/admin/reviewer-scope-editor.tsx +4 -9
  506. package/src/admin/role-select.tsx +4 -2
  507. package/src/admin/user-roster.tsx +2 -11
  508. package/src/auth/accept-invitation.tsx +1 -7
  509. package/src/auth/auth-errors.ts +1 -6
  510. package/src/auth/forgot-password-form.tsx +2 -7
  511. package/src/auth/register-form.tsx +7 -8
  512. package/src/auth/reset-password-form.tsx +2 -5
  513. package/src/auth/sign-in-form.tsx +15 -14
  514. package/src/auth/verify-email.tsx +2 -7
  515. package/src/billing/billing-banner.tsx +3 -7
  516. package/src/billing/billing-labels.ts +6 -4
  517. package/src/billing/checkout-processing.ts +0 -1
  518. package/src/billing/plan-card.tsx +9 -8
  519. package/src/billing/plan-limit-toast.tsx +1 -2
  520. package/src/billing/plan-limit.ts +1 -2
  521. package/src/billing/plan-price.ts +1 -4
  522. package/src/billing/plan-switch.tsx +1 -2
  523. package/src/billing/subscription-actions.tsx +5 -2
  524. package/src/components/account-chips.tsx +1 -7
  525. package/src/components/alert-banner.tsx +2 -8
  526. package/src/components/amount-input.tsx +206 -178
  527. package/src/components/authed-image.tsx +7 -4
  528. package/src/components/autocomplete.tsx +7 -9
  529. package/src/components/bulk-action-bar.tsx +2 -7
  530. package/src/components/button-group.tsx +1 -2
  531. package/src/components/button-look.ts +6 -17
  532. package/src/components/button.tsx +1 -4
  533. package/src/components/calculator.tsx +6 -9
  534. package/src/components/calendar-heatmap.tsx +5 -10
  535. package/src/components/card.tsx +9 -13
  536. package/src/components/chart-zoom-core.tsx +6 -33
  537. package/src/components/chart.tsx +8 -31
  538. package/src/components/checkbox-group.tsx +1 -4
  539. package/src/components/chip-input.tsx +6 -6
  540. package/src/components/chip.tsx +14 -26
  541. package/src/components/choice-card.tsx +4 -18
  542. package/src/components/column-mapper-labels.ts +3 -10
  543. package/src/components/column-mapper.tsx +33 -122
  544. package/src/components/combobox-core.tsx +17 -47
  545. package/src/components/combobox.tsx +2 -6
  546. package/src/components/confirm-dialog.tsx +1 -3
  547. package/src/components/copy-button.tsx +2 -4
  548. package/src/components/country-select.tsx +9 -21
  549. package/src/components/currency-option-list.tsx +16 -18
  550. package/src/components/currency-select.tsx +2 -7
  551. package/src/components/danger-confirm.tsx +8 -9
  552. package/src/components/data-table-cells.tsx +1 -2
  553. package/src/components/data-table-column-settings.tsx +1 -3
  554. package/src/components/data-table-filter-popover.tsx +5 -19
  555. package/src/components/data-table-filters.ts +1 -6
  556. package/src/components/data-table-fit.ts +7 -7
  557. package/src/components/data-table-groups.tsx +3 -1
  558. package/src/components/data-table-head.tsx +32 -46
  559. package/src/components/data-table-mobile.tsx +99 -108
  560. package/src/components/data-table-pagination.tsx +2 -6
  561. package/src/components/data-table-row-actions.tsx +25 -24
  562. package/src/components/data-table-row.tsx +16 -17
  563. package/src/components/data-table-shared.tsx +10 -16
  564. package/src/components/data-table-sort.ts +1 -2
  565. package/src/components/data-table-virtual.ts +9 -4
  566. package/src/components/data-table.tsx +497 -501
  567. package/src/components/date-picker.tsx +1 -7
  568. package/src/components/date-range-picker.tsx +3 -13
  569. package/src/components/description-list.tsx +7 -13
  570. package/src/components/dialog-frame.tsx +12 -3
  571. package/src/components/disclosure.tsx +8 -12
  572. package/src/components/dropdown.tsx +3 -11
  573. package/src/components/empty-state.tsx +1 -3
  574. package/src/components/entity-combobox.tsx +2 -6
  575. package/src/components/error-boundary.tsx +7 -7
  576. package/src/components/field-base.tsx +8 -14
  577. package/src/components/field-parts.tsx +12 -23
  578. package/src/components/field-sync.tsx +7 -11
  579. package/src/components/file-button.tsx +7 -3
  580. package/src/components/file-dropzone.tsx +7 -12
  581. package/src/components/floating-panel.tsx +44 -51
  582. package/src/components/focus-ring.ts +1 -2
  583. package/src/components/form-actions.tsx +1 -4
  584. package/src/components/grouped-picker.tsx +21 -16
  585. package/src/components/hover-menu.tsx +1 -4
  586. package/src/components/iban-input-labels.ts +1 -2
  587. package/src/components/icon-button.tsx +46 -48
  588. package/src/components/icon-picker.tsx +9 -20
  589. package/src/components/image-grid.tsx +1 -6
  590. package/src/components/inline-edit-field.tsx +1 -5
  591. package/src/components/inline-entity-combobox.tsx +11 -25
  592. package/src/components/input.tsx +14 -2
  593. package/src/components/jump-calendar.tsx +2 -6
  594. package/src/components/legal-labels.ts +8 -3
  595. package/src/components/legal-page.tsx +56 -6
  596. package/src/components/legal.tsx +83 -10
  597. package/src/components/lightbox.tsx +1 -3
  598. package/src/components/line-items.tsx +7 -15
  599. package/src/components/list-labels.ts +2 -0
  600. package/src/components/list.tsx +81 -27
  601. package/src/components/measured-grid.tsx +8 -30
  602. package/src/components/menu-item.tsx +1 -3
  603. package/src/components/mini-calendar.tsx +129 -159
  604. package/src/components/money-field.tsx +4 -2
  605. package/src/components/month-picker.tsx +14 -21
  606. package/src/components/multi-entity-combobox.tsx +6 -26
  607. package/src/components/multi-select.tsx +5 -9
  608. package/src/components/nav-pills.tsx +10 -2
  609. package/src/components/number-field.tsx +18 -15
  610. package/src/components/number-input.tsx +3 -19
  611. package/src/components/numpad-sheet.tsx +9 -13
  612. package/src/components/one-time-code-input.tsx +6 -11
  613. package/src/components/page-contents.tsx +2 -9
  614. package/src/components/page-header.tsx +5 -10
  615. package/src/components/password-strength-labels.ts +1 -2
  616. package/src/components/password-strength.tsx +6 -9
  617. package/src/components/phone-input.tsx +2 -13
  618. package/src/components/picker-sheet.tsx +2 -5
  619. package/src/components/pie-chart.tsx +6 -12
  620. package/src/components/popover.tsx +2 -1
  621. package/src/components/progress-bar.tsx +16 -25
  622. package/src/components/qr-code.tsx +2 -9
  623. package/src/components/row-actions.tsx +9 -1
  624. package/src/components/search-field.tsx +4 -5
  625. package/src/components/select.tsx +2 -10
  626. package/src/components/separator.tsx +1 -5
  627. package/src/components/series-chart-axes.ts +5 -5
  628. package/src/components/series-chart-budget.ts +1 -4
  629. package/src/components/series-chart-ticks.ts +1 -4
  630. package/src/components/series-chart.tsx +43 -83
  631. package/src/components/settings-fields.tsx +20 -15
  632. package/src/components/share-card.tsx +6 -14
  633. package/src/components/sign-chip.tsx +16 -16
  634. package/src/components/signature-pad.tsx +21 -13
  635. package/src/components/signed-amount.tsx +6 -14
  636. package/src/components/skeleton.tsx +2 -13
  637. package/src/components/slider.tsx +9 -20
  638. package/src/components/sparkline.tsx +2 -13
  639. package/src/components/stat-tile.tsx +13 -24
  640. package/src/components/swatch-picker.tsx +8 -3
  641. package/src/components/swipeable-row.tsx +2 -11
  642. package/src/components/table-skeleton.tsx +4 -1
  643. package/src/components/table.tsx +12 -8
  644. package/src/components/tabs.tsx +24 -39
  645. package/src/components/text-link.tsx +6 -6
  646. package/src/components/text.tsx +1 -2
  647. package/src/components/tile-radio.tsx +6 -19
  648. package/src/components/time-input.tsx +4 -5
  649. package/src/components/toast.tsx +3 -12
  650. package/src/components/toggle-group.tsx +9 -9
  651. package/src/components/toggle-legend.tsx +4 -16
  652. package/src/components/tooltip.tsx +9 -48
  653. package/src/components/translation-review-editor.tsx +4 -4
  654. package/src/components/translation-review-parts.tsx +7 -1
  655. package/src/components/translation-review.tsx +15 -16
  656. package/src/components/tree-view.tsx +17 -20
  657. package/src/components/treemap.tsx +3 -15
  658. package/src/components/trigger-aria.ts +1 -4
  659. package/src/components/use-table-state.ts +16 -17
  660. package/src/components/user-avatar.tsx +4 -21
  661. package/src/demo/demo-start.tsx +8 -4
  662. package/src/feedback/feedback-attachment-labels.ts +2 -1
  663. package/src/feedback/feedback-attachment.tsx +16 -29
  664. package/src/feedback/feedback-capture.ts +3 -1
  665. package/src/feedback/feedback-comment-thread.tsx +9 -6
  666. package/src/feedback/feedback-context.tsx +1 -4
  667. package/src/feedback/feedback-dialog.tsx +3 -4
  668. package/src/feedback/feedback-inbox.tsx +3 -9
  669. package/src/feedback/feedback-public-list.tsx +7 -1
  670. package/src/feedback/feedback-record.ts +6 -14
  671. package/src/feedback/feedback-replies.tsx +10 -5
  672. package/src/feedback/feedback-row-detail.tsx +2 -5
  673. package/src/feedback/feedback-status-undo.ts +1 -4
  674. package/src/feedback/feedback-submit-dialog.tsx +4 -4
  675. package/src/feedback/feedback-table.tsx +29 -9
  676. package/src/feedback/feedback-thread.tsx +4 -16
  677. package/src/feedback/feedback-vocabulary.ts +72 -82
  678. package/src/feedback/feedback-vote-button.tsx +9 -8
  679. package/src/hooks/use-anchored-rect.ts +1 -4
  680. package/src/hooks/use-document-title.ts +3 -1
  681. package/src/hooks/use-file-drop.ts +1 -3
  682. package/src/hooks/use-file-picker-labels.ts +1 -2
  683. package/src/hooks/use-file-picker.tsx +1 -5
  684. package/src/hooks/use-focus-trap.ts +1 -2
  685. package/src/hooks/use-overlay-history.ts +10 -5
  686. package/src/hooks/use-row-swipe.ts +1 -6
  687. package/src/i18n/defaults.ts +1 -4
  688. package/src/i18n/german.ts +42 -50
  689. package/src/i18n/kit-labels.tsx +5 -20
  690. package/src/i18n/languages.ts +2 -8
  691. package/src/i18n/locales/en.ts +15 -31
  692. package/src/i18n/locales/es.ts +44 -50
  693. package/src/i18n/locales/fr.ts +43 -52
  694. package/src/i18n/locales/hu.ts +35 -38
  695. package/src/i18n/locales/it.ts +44 -53
  696. package/src/i18n/locales/zh.ts +23 -33
  697. package/src/i18n/plurals.ts +4 -1
  698. package/src/i18n/review.ts +20 -7
  699. package/src/i18n/shared-labels.ts +1 -2
  700. package/src/index.ts +107 -32
  701. package/src/landing/access.ts +2 -7
  702. package/src/landing/landing-sections.tsx +14 -15
  703. package/src/landing/page-seo.ts +1 -3
  704. package/src/lib/calc.ts +4 -1
  705. package/src/lib/clipboard-minus.ts +4 -1
  706. package/src/lib/dates.ts +2 -10
  707. package/src/lib/decimal-marks.ts +1 -3
  708. package/src/lib/device-settings.ts +2 -1
  709. package/src/lib/direction.ts +1 -3
  710. package/src/lib/iban.ts +89 -9
  711. package/src/lib/logger.ts +1 -5
  712. package/src/lib/person-name.ts +1 -3
  713. package/src/lib/phone.ts +5 -8
  714. package/src/lib/qr-encode.ts +32 -8
  715. package/src/lib/session-refresh.ts +5 -6
  716. package/src/lib/table-text.ts +24 -6
  717. package/src/lib/text-match.ts +43 -1
  718. package/src/lib/translation-review.ts +1 -3
  719. package/src/notifications/notification-inbox.tsx +17 -4
  720. package/src/notifications/notification-parts.tsx +1 -2
  721. package/src/notifications/notification-types-setting.tsx +19 -18
  722. package/src/notifications/notifications-labels.ts +1 -2
  723. package/src/notifications/push-device-setting.tsx +7 -1
  724. package/src/notifications/push-devices-setting.tsx +7 -3
  725. package/src/notifications/push-worker.ts +10 -2
  726. package/src/notifications/quiet-hours-setting.tsx +4 -1
  727. package/src/notifications/use-push-device.ts +4 -1
  728. package/src/offline/pwa-update-prompt.tsx +7 -1
  729. package/src/offline/query-persistence.ts +9 -6
  730. package/src/offline.ts +6 -1
  731. package/src/rhf/fields.tsx +50 -19
  732. package/src/rhf/form-core.tsx +2 -6
  733. package/src/rhf/line-items.tsx +5 -7
  734. package/src/rhf/use-rhf-wizard-step.ts +3 -12
  735. package/src/search/command-palette.tsx +15 -23
  736. package/src/search/global-search.tsx +38 -8
  737. package/src/search/search-index.ts +5 -1
  738. package/src/settings/device-reset-setting.tsx +5 -8
  739. package/src/settings/settings-heading.tsx +3 -1
  740. package/src/settings/settings-layout.tsx +6 -13
  741. package/src/settings/use-settings-focus.ts +8 -0
  742. package/src/settings/use-settings-route.ts +4 -3
  743. package/src/shell/app-shell.tsx +48 -24
  744. package/src/shell/auth-layout.tsx +1 -6
  745. package/src/shell/dev-menu.tsx +18 -6
  746. package/src/shell/option-switcher-menu.tsx +1 -3
  747. package/src/shell/sync-status-indicator.tsx +14 -12
  748. package/src/shell/top-bar-parts-labels.ts +1 -3
  749. package/src/shell/topbar-action-menu.tsx +130 -45
  750. package/src/shell/topbar-controls.tsx +5 -19
  751. package/src/shell/tour-menu.tsx +9 -1
  752. package/src/shell.ts +1 -1
  753. package/src/sync/db.ts +5 -1
  754. package/src/sync/engine.ts +44 -12
  755. package/src/sync.ts +16 -2
  756. package/src/testing/css-variables.ts +1 -2
  757. package/src/testing/index.ts +1 -6
  758. package/src/testing/react.ts +1 -2
  759. package/src/testing/viewport.ts +9 -9
  760. package/src/theme/contrast-tokens.ts +13 -2
  761. package/src/theme/palette-derive.ts +24 -50
  762. package/src/theme/palette-presets.ts +0 -1
  763. package/src/theme/palette-store.ts +1 -4
  764. package/src/theme/text-size.ts +1 -1
  765. package/src/theme/theme-store.ts +2 -6
  766. package/src/tour/tour-catalogue.tsx +4 -2
  767. package/src/tour/tour-dock.ts +5 -1
  768. package/src/tour/tour-engine.ts +2 -6
  769. package/src/tour/tour.tsx +28 -12
  770. package/src/tour/use-tour-progress.ts +8 -2
  771. package/src/tour/use-tour-url-sync.ts +3 -1
  772. package/src/vite-env.d.ts +1 -4
  773. package/src/wizard/stepper-nav.tsx +10 -35
  774. package/src/wizard/types.ts +1 -4
  775. package/src/wizard/use-wizard.ts +28 -43
  776. package/src/wizard/validation.ts +1 -5
  777. package/src/wizard/wizard-context.tsx +2 -6
  778. package/src/wizard/wizard-step.tsx +1 -8
  779. package/src/wizard/wizard-summary.tsx +2 -6
  780. package/tokens.css +393 -152
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/calendar-heatmap.tsx"],"sourcesContent":["import { useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, KeyboardEvent, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { dirOf, horizontalStep } from \"../lib/direction\";\nimport { addMonthsClamped, localeWeekStart, parseIsoDate, toLocalIso } from \"../lib/dates\";\nimport { useKitLabels, useKitLocale, useKitWeekStart, type LabelOverride } from \"../i18n/kit-labels\";\nimport { lerpHex, textOn } from \"../theme/chart-palette\";\nimport { parseHex } from \"../theme/color\";\nimport { Tooltip } from \"./tooltip\";\nimport type { WeekDay } from \"./mini-calendar\";\nimport { DEFAULT_CALENDAR_HEATMAP_LABELS } from \"./calendar-heatmap-labels\";\nimport { formatWithMinus } from \"../lib/minus\";\n\n/**\n * Every string the heatmap speaks — the `calendarHeatmap` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. Dates and\n * values arrive already formatted (in `locale`, and through `formatValue`), so the\n * functions only arrange them.\n */\nexport interface CalendarHeatmapLabels {\n /** Accessible name of the grid. */\n grid: string;\n /**\n * One day: its accessible name, and the tooltip unless `tooltip` is given. `date`\n * is the whole date in `locale` (\"Monday, 14 September 2026\"), `value` the day's\n * figure through `formatValue`.\n */\n day: (date: string, value: string) => string;\n /** The two ends of the legend's scale. */\n less: string;\n more: string;\n /** `maxDays` cut the window: how many of its earliest days are not drawn. */\n truncated: (count: number) => string;\n}\n\n// Defined in ./calendar-heatmap-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_CALENDAR_HEATMAP_LABELS };\n\n/** One day's figure. Several entries for one date are added up. */\nexport interface CalendarHeatmapDatum {\n /** \"YYYY-MM-DD\". */\n date: string;\n value: number;\n}\n\n/** What `tooltip` is told about the day under the pointer. */\nexport interface CalendarHeatmapDay {\n iso: string;\n date: Date;\n /** The day's figure; `0` when `data` has no entry for it (see `hasData`). */\n value: number;\n hasData: boolean;\n /** `0` = empty … `levels` = the busiest. */\n level: number;\n /** The whole date in `locale`. */\n formattedDate: string;\n /** `value` through `formatValue`. */\n formattedValue: string;\n}\n\n/**\n * `onSelect` is omitted from the `<div>` attributes for the reason `MiniCalendar` gives:\n * the DOM event of that name is a text-selection event, and this one answers with a date.\n */\nexport interface CalendarHeatmapProps extends Omit<ComponentPropsWithRef<\"div\">, \"onSelect\"> {\n data: readonly CalendarHeatmapDatum[];\n /** The window, inclusive, as \"YYYY-MM-DD\". */\n from: string;\n to: string;\n /**\n * `\"weeks\"` (default): the contribution-graph shape — one COLUMN per week, the\n * weekdays down the side, month names along the top; a year fits in ~53 small\n * squares and scrolls sideways where it does not. `\"month\"`: a 7-column calendar\n * with day numbers in large square cells, for a single month on a phone (switch on\n * `useMediaQuery` and narrow `from`/`to` to the month).\n */\n layout?: \"weeks\" | \"month\";\n /** The day shown as selected (\"YYYY-MM-DD\"). */\n selected?: string;\n /** Makes each day a button: a click (or Enter/Space) selects it — a drill-down into\n * that day's rows, a day panel. Without it the days are focusable but inert. */\n onSelect?: (iso: string) => void;\n /** How a value is written in the tooltip and the day's name. Default: `Intl.NumberFormat`\n * in `locale`. Pass a currency formatter for money. */\n formatValue?: (value: number) => string;\n /** Tooltip content for a day. Default: `labels.day(date, value)`. */\n tooltip?: (day: CalendarHeatmapDay) => ReactNode;\n /**\n * Tag each tooltip `data-private`, so the host's demo-mode rule blurs it (the\n * attribute `Tooltip redact` and `StatTile sensitive` carry). ON by default: a heatmap\n * is almost always the user's own figures, and a missing tag is silent — the grid\n * looks anonymous and the bubble spells the amount out on hover.\n */\n sensitive?: boolean;\n /** The value that reaches the top of the scale. Default: the largest value ON SCREEN,\n * so a peak outside the window does not wash the drawn days out to empty. */\n max?: number;\n /** How many non-empty intensity steps. Default 4. */\n levels?: number;\n /** The scale's colour, as any CSS colour. Default `var(--brand)`; each step is this\n * mixed into `--bg-surface`, so the ramp follows the theme. */\n color?: string;\n /**\n * A CONTINUOUS scale from `colorFrom` (the smallest value) to `colorTo` (the busiest\n * day), instead of `levels` steps of `color` — keksdose's palette-store ramp,\n * `seqLow` → `seqHigh`. Both are needed; `color` is then unused. Two `#rrggbb`\n * colours are interpolated in JS, so the fill is a concrete hex and the day number's\n * ink (in `\"month\"`) is MEASURED against it; anything else (a `var()`) is mixed with\n * `color-mix()`. `levels` still sets `data-level` and the legend's swatch count.\n */\n colorFrom?: string;\n colorTo?: string;\n /**\n * A fill of the caller's own for a day with a value: handed the value and the\n * scale's `max`, returns any CSS colour. Wins over `color` and `colorFrom`/`colorTo`.\n * Also paints the legend, at `max × level / levels`.\n */\n fill?: (value: number, max: number) => string;\n /** The fill of a day with no value (or a value of 0). Default: a wash of the text\n * colour over the surface, which reads as a cell on both themes. */\n emptyColor?: string;\n /**\n * Where the window ENDS — the day `maxDays` counts back from, and the last one drawn:\n *\n * - `\"to\"` (default): on `to`.\n * - `\"today\"`: on today.\n * - `\"latest\"`: on the last day that can carry a figure — today, or a later day that\n * actually has a value. A window running into the future (a report's \"all\" preset\n * ends a year ahead) then spends its cells on the days a person is looking for,\n * not on a year of empty ones.\n * - a `\"YYYY-MM-DD\"`: on that day.\n *\n * Always kept inside `from`…`to`.\n */\n anchor?: \"to\" | \"today\" | \"latest\" | (string & {});\n /**\n * The most days to draw. A longer window keeps its LATEST `maxDays` and says how many\n * it left out (`labels.truncated`) rather than silently ending. Default: no cap.\n */\n maxDays?: number;\n /** Draw the Less … More legend. Default `true`. */\n legend?: boolean;\n /** BCP 47 tag for the dates, month and weekday names and numbers. */\n locale?: string;\n /** `0` = Sunday … `6` = Saturday. Default: the provider's, else the locale's. */\n weekStartsOn?: WeekDay;\n labels?: LabelOverride<CalendarHeatmapLabels>;\n className?: string;\n}\n\nconst DAY_NAME_FORMAT: Intl.DateTimeFormatOptions = {\n weekday: \"long\",\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n};\n\n/** The empty day: a wash of the text colour, like `--bg-hover`, so it reads as a cell\n * on both themes without claiming any value. */\nconst EMPTY_FILL = \"color-mix(in oklab, var(--text-primary) 8%, var(--bg-surface))\";\n\nconst weekdayIndex = (d: Date, weekStart: WeekDay) => (d.getDay() - weekStart + 7) % 7;\n\n/** Where the window ends for an {@link CalendarHeatmapProps.anchor}, kept in `[from, to]`.\n * `latestData` is the latest ISO date carrying a value, or `\"\"`. */\nexport function heatmapWindowEnd(\n from: string,\n to: string,\n anchor: string,\n latestData: string,\n today: string = toLocalIso(new Date()),\n): string {\n let end: string;\n if (anchor === \"today\") end = today;\n else if (anchor === \"latest\") end = latestData > today ? latestData : today;\n else if (anchor === \"to\" || !parseIsoDate(anchor)) end = to;\n else end = anchor;\n // ISO dates sort as strings, so the clamp is plain comparison.\n if (end > to) end = to;\n if (end < from) end = from;\n return end;\n}\n\n/** The step a value falls on: 0 for nothing, else 1…levels by its share of `max`. */\nexport function heatmapLevel(value: number, max: number, levels: number): number {\n if (!(value > 0) || !(max > 0) || levels < 1) return 0;\n return Math.min(levels, Math.max(1, Math.ceil((value / max) * levels)));\n}\n\n/** How much of `color` a step mixes into the surface: 20% for the first step, 100% for\n * the last — the floor keeps the smallest value visibly apart from an empty day. */\nfunction levelPercent(level: number, levels: number): number {\n if (levels <= 1) return 100;\n return Math.round(20 + (80 * (level - 1)) / (levels - 1));\n}\n\nfunction levelFill(level: number, levels: number, color: string): string {\n if (level === 0) return EMPTY_FILL;\n return `color-mix(in oklab, ${color} ${levelPercent(level, levels)}%, var(--bg-surface))`;\n}\n\n/**\n * Days as a grid of shaded squares — how much happened on each, at a glance\n * (a contribution graph, a spending calendar).\n *\n * **Every day is a cell you can reach.** The grid is a `role=\"grid\"` with ONE tab\n * stop (the roving tabindex, as in `MiniCalendar`); the arrows move by the grid's own\n * geometry — in `\"weeks\"` ↑/↓ are the previous/next day and ←/→ a week, in `\"month\"`\n * the other way round, mirrored in RTL — PageUp/PageDown move a month and Home/End go\n * to the window's first/last day. Each cell is named with its whole date AND its value,\n * because the colour is not something a screen reader can say, and carries\n * `data-day=\"YYYY-MM-DD\"` as its identity for tests and for the host. Note that in\n * `\"weeks\"` the cells are in DOM order by WEEKDAY ROW (all Mondays, then all\n * Tuesdays…), not by date — query by `data-day`, not by position.\n *\n * The tooltip is portalled (a year of squares always sits in a sideways scroller) and\n * `data-private` unless `sensitive={false}`. Cell size in `\"weeks\"` is the CSS variable\n * `--heatmap-cell` (default `0.75rem`): `style={{ \"--heatmap-cell\": \"1rem\" }}`.\n */\nexport function CalendarHeatmap({\n data,\n from,\n to,\n layout = \"weeks\",\n selected,\n onSelect,\n formatValue: formatValueProp,\n tooltip,\n sensitive = true,\n max: maxProp,\n levels = 4,\n color = \"var(--brand)\",\n colorFrom,\n colorTo,\n fill: fillProp,\n emptyColor,\n anchor = \"to\",\n maxDays,\n legend = true,\n locale: localeProp,\n weekStartsOn,\n labels: labelsProp,\n className,\n \"aria-label\": ariaLabel,\n ...rest\n}: CalendarHeatmapProps) {\n const labels = useKitLabels(\"calendarHeatmap\", DEFAULT_CALENDAR_HEATMAP_LABELS, labelsProp);\n const locale = useKitLocale(localeProp);\n const providerWeekStart = useKitWeekStart();\n const weekStart: WeekDay = weekStartsOn ?? providerWeekStart ?? localeWeekStart(locale);\n const numberFormat = useMemo(() => new Intl.NumberFormat(locale), [locale]);\n const formatValue = formatValueProp ?? ((v: number) => formatWithMinus(numberFormat, v));\n\n const values = useMemo(() => {\n const m = new Map<string, number>();\n for (const p of data) m.set(p.date, (m.get(p.date) ?? 0) + p.value);\n return m;\n }, [data]);\n\n // The window, trimmed from the FRONT: the days a person looks for are the recent\n // ones, and a cap that kept the oldest would end the calendar before today.\n const latestData = useMemo(() => {\n let latest = \"\";\n for (const [iso, v] of values) if (v !== 0 && iso > latest) latest = iso;\n return latest;\n }, [values]);\n const windowEnd = heatmapWindowEnd(from, to, anchor, latestData);\n\n const { days, dropped } = useMemo(() => {\n const start = parseIsoDate(from);\n const end = parseIsoDate(windowEnd);\n const list: Date[] = [];\n if (!start || !end || end < start) return { days: list, dropped: 0 };\n const cursor = new Date(end);\n const cap = maxDays && maxDays > 0 ? maxDays : Infinity;\n while (cursor >= start && list.length < cap) {\n list.unshift(new Date(cursor));\n cursor.setDate(cursor.getDate() - 1);\n }\n const first = list[0];\n const trimmed = first ? Math.round((first.getTime() - start.getTime()) / 86_400_000) : 0;\n return { days: list, dropped: Math.max(0, trimmed) };\n }, [from, windowEnd, maxDays]);\n\n const firstIso = days.length ? toLocalIso(days[0]) : \"\";\n const lastIso = days.length ? toLocalIso(days[days.length - 1]) : \"\";\n\n const max = useMemo(() => {\n if (maxProp !== undefined) return maxProp;\n let m = 0;\n for (const d of days) m = Math.max(m, values.get(toLocalIso(d)) ?? 0);\n return m;\n }, [maxProp, days, values]);\n\n const clampIso = (iso: string) => (iso < firstIso ? firstIso : iso > lastIso ? lastIso : iso);\n\n // The roving tab stop: the selected day, else the latest one.\n const [activeState, setActiveIso] = useState(() => selected || lastIso);\n const [lastSelected, setLastSelected] = useState(selected);\n if (lastSelected !== selected) {\n setLastSelected(selected);\n if (selected) setActiveIso(selected);\n }\n const activeIso = days.length ? clampIso(activeState || lastIso) : \"\";\n\n const gridRef = useRef<HTMLDivElement>(null);\n const scrollerRef = useRef<HTMLDivElement>(null);\n const pendingFocus = useRef<string | null>(null);\n useEffect(() => {\n const iso = pendingFocus.current;\n if (!iso) return;\n pendingFocus.current = null;\n gridRef.current?.querySelector<HTMLElement>(`[data-day=\"${iso}\"]`)?.focus();\n });\n\n // Open the sideways scroller on the latest weeks, not the oldest. In RTL the end is\n // on the left, where browsers count scrollLeft down from 0.\n //\n // And KEEP it there while the box changes size — a sidebar or a contents rail that\n // appears after mount narrows the scroller, which leaves scrollLeft where it was and\n // so shows older weeks than it opened on. The pin holds only while the view sits at\n // the end: a user who scrolls back through the year unpins it, and a resize then\n // leaves their position alone. (Scrolling back to the end pins it again.)\n useLayoutEffect(() => {\n const el = scrollerRef.current;\n if (!el || layout !== \"weeks\") return;\n const toEnd = () => {\n el.scrollLeft = dirOf(el) === \"rtl\" ? -el.scrollWidth : el.scrollWidth;\n };\n toEnd();\n if (typeof ResizeObserver === \"undefined\") return;\n // |scrollLeft| covers both directions: 0 → max in LTR, 0 → -max in RTL.\n let pinned = true;\n const onScroll = () => {\n pinned = Math.abs(el.scrollLeft) >= el.scrollWidth - el.clientWidth - 1;\n };\n const ro = new ResizeObserver(() => {\n if (pinned) toEnd();\n });\n el.addEventListener(\"scroll\", onScroll, { passive: true });\n ro.observe(el);\n return () => {\n ro.disconnect();\n el.removeEventListener(\"scroll\", onScroll);\n };\n }, [layout, firstIso, lastIso]);\n\n const formatDay = (d: Date) => d.toLocaleDateString(locale, DAY_NAME_FORMAT);\n\n const weekdayLabels = useMemo(() => {\n const ref = new Date(2024, 0, 7 + weekStart); // 7 January 2024 was a Sunday\n const week = Array.from({ length: 7 }, (_, i) => {\n const d = new Date(ref);\n d.setDate(ref.getDate() + i);\n return d;\n });\n const name = (d: Date, weekday: \"short\" | \"narrow\" | \"long\") => d.toLocaleDateString(locale, { weekday });\n // The label column is 2rem at 10px type, room for about four characters. Most\n // locales' \"short\" is three or four (\"Thu\", \"jeu.\", \"czw.\"), but some have no\n // abbreviation at all — Arabic's short Thursday IS \"الخميس\", which overran the box\n // and was cut. Such a locale takes the \"narrow\" form (\"خ\") for ALL seven, so the\n // column never mixes two forms; the full name is on the aria-label either way.\n const tooLong = week.some((d) => [...name(d, \"short\")].length > 4);\n return week.map((d) => ({ short: name(d, tooLong ? \"narrow\" : \"short\"), long: name(d, \"long\") }));\n }, [locale, weekStart]);\n\n const lead = days.length ? weekdayIndex(days[0], weekStart) : 0;\n const weekCount = Math.ceil((lead + days.length) / 7);\n /** The day at position `i` of the week-aligned sequence (blanks before the first). */\n const dayAt = (i: number): Date | null => (i >= lead && i - lead < days.length ? days[i - lead] : null);\n\n const move = (e: KeyboardEvent<HTMLElement>) => {\n const current = parseIsoDate(activeIso);\n if (!current) return;\n const next = new Date(current);\n const step = horizontalStep(e.key, e.currentTarget);\n // In \"weeks\" a row is a weekday, so sideways is a week and up/down is a day.\n const across = layout === \"weeks\" ? 7 : 1;\n const down = layout === \"weeks\" ? 1 : 7;\n switch (step ? \"horizontal\" : e.key) {\n case \"horizontal\":\n next.setDate(next.getDate() + step * across);\n break;\n case \"ArrowUp\":\n next.setDate(next.getDate() - down);\n break;\n case \"ArrowDown\":\n next.setDate(next.getDate() + down);\n break;\n case \"PageUp\":\n next.setTime(addMonthsClamped(next, -1).getTime());\n break;\n case \"PageDown\":\n next.setTime(addMonthsClamped(next, 1).getTime());\n break;\n case \"Home\":\n next.setTime(days[0].getTime());\n break;\n case \"End\":\n next.setTime(days[days.length - 1].getTime());\n break;\n default:\n return;\n }\n e.preventDefault();\n const iso = clampIso(toLocalIso(next));\n if (iso === activeIso) return;\n pendingFocus.current = iso;\n setActiveIso(iso);\n };\n\n const legendLevels = Array.from({ length: levels + 1 }, (_, l) => l);\n const empty = emptyColor ?? EMPTY_FILL;\n const continuous = colorFrom !== undefined && colorTo !== undefined;\n const hexRamp = continuous && parseHex(colorFrom) != null && parseHex(colorTo) != null;\n\n /** A day's fill, and the ink its number is set in (`\"month\"`). */\n const paint = (value: number, level: number): { fill: string; ink: string } => {\n if (level === 0) return { fill: empty, ink: \"var(--text-primary)\" };\n if (fillProp || continuous) {\n const t = max > 0 ? Math.min(1, Math.max(0, value / max)) : 1;\n const fill = fillProp\n ? fillProp(value, max)\n : hexRamp\n ? lerpHex(colorFrom!, colorTo!, t)\n : `color-mix(in oklab, ${colorTo} ${Math.round(t * 100)}%, ${colorFrom})`;\n // Measured where the fill is a colour; a mix of references cannot be measured,\n // and the page's own text colour is the safe answer there.\n const measured = textOn(fill);\n return { fill, ink: measured === \"currentColor\" ? \"var(--text-primary)\" : measured };\n }\n // Light text once the fill is the stronger half of the mix — `--bg-surface` is the\n // colour the scale is mixed INTO, so it is the one that contrasts with its far end\n // on either theme.\n const strong = levelPercent(level, levels) >= 45;\n return {\n fill: levelFill(level, levels, color),\n ink: strong ? \"var(--bg-surface)\" : \"var(--text-primary)\",\n };\n };\n // The legend's swatches: a value that lands on each step (the top one on `max`).\n const legendFill = (l: number) => paint(((max > 0 ? max : 1) * l) / levels, l).fill;\n\n const cell = (d: Date, wrapClass: string, cellClass: string, withNumber: boolean) => {\n const iso = toLocalIso(d);\n const raw = values.get(iso);\n const value = raw ?? 0;\n const level = heatmapLevel(value, max, levels);\n const { fill, ink } = paint(value, level);\n const formattedDate = formatDay(d);\n const formattedValue = formatValue(value);\n const name = labels.day(formattedDate, formattedValue);\n const label = tooltip\n ? tooltip({ iso, date: d, value, hasData: raw !== undefined, level, formattedDate, formattedValue })\n : name;\n const isSelected = selected === iso;\n const shared = {\n role: \"gridcell\",\n \"data-day\": iso,\n \"data-level\": level,\n tabIndex: iso === activeIso ? 0 : -1,\n \"aria-label\": name,\n \"aria-selected\": onSelect ? isSelected : undefined,\n onKeyDown: move,\n onFocus: () => {\n if (iso !== activeIso) setActiveIso(iso);\n },\n style: { background: fill, color: ink },\n className: cn(\n cellClass,\n isSelected && \"ring-2 ring-[var(--text-primary)]\",\n onSelect && \"cursor-pointer hover:ring-1 hover:ring-brand\",\n ),\n } as const;\n const inner = withNumber ? (\n <span aria-hidden className=\"text-caption leading-none tabular-nums\">\n {numberFormat.format(d.getDate())}\n </span>\n ) : null;\n return (\n <Tooltip key={iso} label={label} portal redact={sensitive} role=\"none\" className={wrapClass}>\n {onSelect ? (\n <button type=\"button\" {...shared} onClick={() => onSelect(iso)}>\n {inner}\n </button>\n ) : (\n <div {...shared}>{inner}</div>\n )}\n </Tooltip>\n );\n };\n\n const gridName = ariaLabel ?? labels.grid;\n let body: ReactNode;\n if (layout === \"weeks\") {\n const columns = { gridTemplateColumns: `var(--heatmap-label, 2rem) repeat(${weekCount}, var(--heatmap-cell, 0.75rem))` } as CSSProperties;\n const cellSize = \"size-[var(--heatmap-cell,0.75rem)]\";\n // A month's name over the first column that holds its 1st — or over the first\n // column, when the window opens far enough before the next month for it to fit.\n const monthLabels = Array.from({ length: weekCount }, (_, w) => {\n for (let r = 0; r < 7; r++) {\n const d = dayAt(w * 7 + r);\n if (d && (d.getDate() === 1 || (w === 0 && r === lead && d.getDate() <= 14))) {\n return d.toLocaleDateString(locale, { month: \"short\" });\n }\n }\n return \"\";\n });\n body = (\n <div ref={scrollerRef} className=\"overflow-x-auto pb-1\">\n <div ref={gridRef} role=\"grid\" aria-label={gridName} className=\"inline-grid gap-0.5\">\n {/* Decoration: every cell's name already carries its month. */}\n <div aria-hidden className=\"grid gap-0.5 text-micro leading-3 text-muted\" style={columns}>\n <span />\n {monthLabels.map((m, w) => (\n <span key={w} className=\"overflow-visible whitespace-nowrap\">\n {m}\n </span>\n ))}\n </div>\n {Array.from({ length: 7 }, (_, r) => (\n <div key={r} role=\"row\" className=\"grid gap-0.5\" style={columns}>\n <div\n role=\"rowheader\"\n aria-label={weekdayLabels[r].long}\n className=\"overflow-hidden pe-1 text-micro leading-3 text-muted\"\n >\n {/* Every other weekday, as a contribution graph does: seven labels\n at this size are a smear. The name is there for all seven. */}\n {r % 2 === 1 ? weekdayLabels[r].short : \"\"}\n </div>\n {Array.from({ length: weekCount }, (_, w) => {\n const d = dayAt(w * 7 + r);\n return d ? (\n cell(d, cellSize, cn(cellSize, \"block rounded-sm\"), false)\n ) : (\n <div key={`pad-${w}`} role=\"gridcell\" className={cellSize} />\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n } else {\n const rows = Array.from({ length: weekCount }, (_, w) => w);\n body = (\n <div ref={gridRef} role=\"grid\" aria-label={gridName} className=\"grid gap-1\">\n <div role=\"row\" className=\"grid grid-cols-7 gap-1\">\n {weekdayLabels.map((w, i) => (\n <div\n key={i}\n role=\"columnheader\"\n aria-label={w.long}\n className=\"pb-0.5 text-center text-micro uppercase tracking-wide text-muted\"\n >\n {w.short}\n </div>\n ))}\n </div>\n {rows.map((w) => (\n <div key={w} role=\"row\" className=\"grid grid-cols-7 gap-1\">\n {Array.from({ length: 7 }, (_, c) => {\n const d = dayAt(w * 7 + c);\n return d ? (\n cell(d, \"aspect-square w-full\", \"flex h-full w-full items-center justify-center rounded\", true)\n ) : (\n <div key={`pad-${c}`} role=\"gridcell\" className=\"aspect-square\" />\n );\n })}\n </div>\n ))}\n </div>\n );\n }\n\n return (\n <div {...rest} className={cn(\"min-w-0\", className)}>\n {dropped > 0 && (\n <div className=\"mb-2 text-xs text-muted\">{labels.truncated(dropped)}</div>\n )}\n {body}\n {legend && (\n <div aria-hidden className=\"mt-2 flex items-center justify-end gap-1 text-micro text-muted\">\n <span className=\"me-0.5\">{labels.less}</span>\n {legendLevels.map((l) => (\n <span\n key={l}\n data-legend-level={l}\n className=\"size-2.5 rounded-sm\"\n style={{ background: legendFill(l) }}\n />\n ))}\n <span className=\"ms-0.5\">{labels.more}</span>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AA2dM,cAqCI,YArCJ;AA3dN,SAAS,WAAW,iBAAiB,SAAS,QAAQ,gBAAgB;AAEtE,SAAS,UAAU;AACnB,SAAS,OAAO,sBAAsB;AACtC,SAAS,kBAAkB,iBAAiB,cAAc,kBAAkB;AAC5E,SAAS,cAAc,cAAc,uBAA2C;AAChF,SAAS,SAAS,cAAc;AAChC,SAAS,gBAAgB;AACzB,SAAS,eAAe;AAExB,SAAS,uCAAuC;AAChD,SAAS,uBAAuB;AA2IhC,MAAM,kBAA8C;AAAA,EAClD,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM;AACR;AAIA,MAAM,aAAa;AAEnB,MAAM,eAAe,CAAC,GAAS,eAAwB,EAAE,OAAO,IAAI,YAAY,KAAK;AAI9E,SAAS,iBACd,MACA,IACA,QACA,YACA,QAAgB,WAAW,oBAAI,KAAK,CAAC,GAC7B;AACR,MAAI;AACJ,MAAI,WAAW,QAAS,OAAM;AAAA,WACrB,WAAW,SAAU,OAAM,aAAa,QAAQ,aAAa;AAAA,WAC7D,WAAW,QAAQ,CAAC,aAAa,MAAM,EAAG,OAAM;AAAA,MACpD,OAAM;AAEX,MAAI,MAAM,GAAI,OAAM;AACpB,MAAI,MAAM,KAAM,OAAM;AACtB,SAAO;AACT;AAGO,SAAS,aAAa,OAAe,KAAa,QAAwB;AAC/E,MAAI,EAAE,QAAQ,MAAM,EAAE,MAAM,MAAM,SAAS,EAAG,QAAO;AACrD,SAAO,KAAK,IAAI,QAAQ,KAAK,IA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AAS,GAC9C;AAAA,cAAU,KACT,oBAAC,SAAI,WAAU,2BAA2B,iBAAO,UAAU,OAAO,GAAE;AAAA,IAErE;AAAA,IACA,UACC,qBAAC,SAAI,eAAW,MAAC,WAAU,kEACzB;AAAA,0BAAC,UAAK,WAAU,UAAU,iBAAO,MAAK;AAAA,MACrC,aAAa,IAAI,CAAC,MACjB;AAAA,QAAC;AAAA;AAAA,UAEC,qBAAmB;AAAA,UACnB,WAAU;AAAA,UACV,OAAO,EAAE,YAAY,WAAW,CAAC,EAAE;AAAA;AAAA,QAH9B;AAAA,MAIP,CACD;AAAA,MACD,oBAAC,UAAK,WAAU,UAAU,iBAAO,MAAK;AAAA,OACxC;AAAA,KAEJ;AAEJ;","names":["_"]}
1
+ {"version":3,"sources":["../../src/components/calendar-heatmap.tsx"],"sourcesContent":["import { useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, KeyboardEvent, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { dirOf, horizontalStep } from \"../lib/direction\";\nimport { addMonthsClamped, localeWeekStart, parseIsoDate, toLocalIso } from \"../lib/dates\";\nimport { useKitLabels, useKitLocale, useKitWeekStart, type LabelOverride } from \"../i18n/kit-labels\";\nimport { lerpHex, textOn } from \"../theme/chart-palette\";\nimport { parseHex } from \"../theme/color\";\nimport { Tooltip } from \"./tooltip\";\nimport type { WeekDay } from \"./mini-calendar\";\nimport { DEFAULT_CALENDAR_HEATMAP_LABELS } from \"./calendar-heatmap-labels\";\nimport { formatWithMinus } from \"../lib/minus\";\n\n/**\n * Every string the heatmap speaks — the `calendarHeatmap` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. Dates and\n * values arrive already formatted (in `locale`, and through `formatValue`), so the\n * functions only arrange them.\n */\nexport interface CalendarHeatmapLabels {\n /** Accessible name of the grid. */\n grid: string;\n /**\n * One day: its accessible name, and the tooltip unless `tooltip` is given. `date`\n * is the whole date in `locale` (\"Monday, 14 September 2026\"), `value` the day's\n * figure through `formatValue`.\n */\n day: (date: string, value: string) => string;\n /** The two ends of the legend's scale. */\n less: string;\n more: string;\n /** `maxDays` cut the window: how many of its earliest days are not drawn. */\n truncated: (count: number) => string;\n}\n\n// Defined in ./calendar-heatmap-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_CALENDAR_HEATMAP_LABELS };\n\n/** One day's figure. Several entries for one date are added up. */\nexport interface CalendarHeatmapDatum {\n /** \"YYYY-MM-DD\". */\n date: string;\n value: number;\n}\n\n/** What `tooltip` is told about the day under the pointer. */\nexport interface CalendarHeatmapDay {\n iso: string;\n date: Date;\n /** The day's figure; `0` when `data` has no entry for it (see `hasData`). */\n value: number;\n hasData: boolean;\n /** `0` = empty … `levels` = the busiest. */\n level: number;\n /** The whole date in `locale`. */\n formattedDate: string;\n /** `value` through `formatValue`. */\n formattedValue: string;\n}\n\n/**\n * `onSelect` is omitted from the `<div>` attributes for the reason `MiniCalendar` gives:\n * the DOM event of that name is a text-selection event, and this one answers with a date.\n */\nexport interface CalendarHeatmapProps extends Omit<ComponentPropsWithRef<\"div\">, \"onSelect\"> {\n data: readonly CalendarHeatmapDatum[];\n /** The window, inclusive, as \"YYYY-MM-DD\". */\n from: string;\n to: string;\n /**\n * `\"weeks\"` (default): the contribution-graph shape — one COLUMN per week, the\n * weekdays down the side, month names along the top; a year fits in ~53 small\n * squares and scrolls sideways where it does not. `\"month\"`: a 7-column calendar\n * with day numbers in large square cells, for a single month on a phone (switch on\n * `useMediaQuery` and narrow `from`/`to` to the month).\n */\n layout?: \"weeks\" | \"month\";\n /** The day shown as selected (\"YYYY-MM-DD\"). */\n selected?: string;\n /** Makes each day a button: a click (or Enter/Space) selects it — a drill-down into\n * that day's rows, a day panel. Without it the days are focusable but inert. */\n onSelect?: (iso: string) => void;\n /** How a value is written in the tooltip and the day's name. Default: `Intl.NumberFormat`\n * in `locale`. Pass a currency formatter for money. */\n formatValue?: (value: number) => string;\n /** Tooltip content for a day. Default: `labels.day(date, value)`. */\n tooltip?: (day: CalendarHeatmapDay) => ReactNode;\n /**\n * Tag each tooltip `data-private`, so the host's demo-mode rule blurs it (the\n * attribute `Tooltip redact` and `StatTile sensitive` carry). ON by default: a heatmap\n * is almost always the user's own figures, and a missing tag is silent — the grid\n * looks anonymous and the bubble spells the amount out on hover.\n */\n sensitive?: boolean;\n /** The value that reaches the top of the scale. Default: the largest value ON SCREEN,\n * so a peak outside the window does not wash the drawn days out to empty. */\n max?: number;\n /** How many non-empty intensity steps. Default 4. */\n levels?: number;\n /** The scale's colour, as any CSS colour. Default `var(--brand)`; each step is this\n * mixed into `--bg-surface`, so the ramp follows the theme. */\n color?: string;\n /**\n * A CONTINUOUS scale from `colorFrom` (the smallest value) to `colorTo` (the busiest\n * day), instead of `levels` steps of `color` — keksdose's palette-store ramp,\n * `seqLow` → `seqHigh`. Both are needed; `color` is then unused. Two `#rrggbb`\n * colours are interpolated in JS, so the fill is a concrete hex and the day number's\n * ink (in `\"month\"`) is MEASURED against it; anything else (a `var()`) is mixed with\n * `color-mix()`. `levels` still sets `data-level` and the legend's swatch count.\n */\n colorFrom?: string;\n colorTo?: string;\n /**\n * A fill of the caller's own for a day with a value: handed the value and the\n * scale's `max`, returns any CSS colour. Wins over `color` and `colorFrom`/`colorTo`.\n * Also paints the legend, at `max × level / levels`.\n */\n fill?: (value: number, max: number) => string;\n /** The fill of a day with no value (or a value of 0). Default: a wash of the text\n * colour over the surface, which reads as a cell on both themes. */\n emptyColor?: string;\n /**\n * Where the window ENDS — the day `maxDays` counts back from, and the last one drawn:\n *\n * - `\"to\"` (default): on `to`.\n * - `\"today\"`: on today.\n * - `\"latest\"`: on the last day that can carry a figure — today, or a later day that\n * actually has a value. A window running into the future (a report's \"all\" preset\n * ends a year ahead) then spends its cells on the days a person is looking for,\n * not on a year of empty ones.\n * - a `\"YYYY-MM-DD\"`: on that day.\n *\n * Always kept inside `from`…`to`.\n */\n anchor?: \"to\" | \"today\" | \"latest\" | (string & {});\n /**\n * The most days to draw. A longer window keeps its LATEST `maxDays` and says how many\n * it left out (`labels.truncated`) rather than silently ending. Default: no cap.\n */\n maxDays?: number;\n /** Draw the Less … More legend. Default `true`. */\n legend?: boolean;\n /** BCP 47 tag for the dates, month and weekday names and numbers. */\n locale?: string;\n /** `0` = Sunday … `6` = Saturday. Default: the provider's, else the locale's. */\n weekStartsOn?: WeekDay;\n labels?: LabelOverride<CalendarHeatmapLabels>;\n className?: string;\n}\n\nconst DAY_NAME_FORMAT: Intl.DateTimeFormatOptions = {\n weekday: \"long\",\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n};\n\n/** The empty day: a wash of the text colour, like `--bg-hover`, so it reads as a cell\n * on both themes without claiming any value. */\nconst EMPTY_FILL = \"color-mix(in oklab, var(--text-primary) 8%, var(--bg-surface))\";\n\nconst weekdayIndex = (d: Date, weekStart: WeekDay) => (d.getDay() - weekStart + 7) % 7;\n\n/** Where the window ends for an {@link CalendarHeatmapProps.anchor}, kept in `[from, to]`.\n * `latestData` is the latest ISO date carrying a value, or `\"\"`. */\nexport function heatmapWindowEnd(\n from: string,\n to: string,\n anchor: string,\n latestData: string,\n today: string = toLocalIso(new Date()),\n): string {\n let end: string;\n if (anchor === \"today\") end = today;\n else if (anchor === \"latest\") end = latestData > today ? latestData : today;\n else if (anchor === \"to\" || !parseIsoDate(anchor)) end = to;\n else end = anchor;\n // ISO dates sort as strings, so the clamp is plain comparison.\n if (end > to) end = to;\n if (end < from) end = from;\n return end;\n}\n\n/** The step a value falls on: 0 for nothing, else 1…levels by its share of `max`. */\nexport function heatmapLevel(value: number, max: number, levels: number): number {\n if (!(value > 0) || !(max > 0) || levels < 1) return 0;\n return Math.min(levels, Math.max(1, Math.ceil((value / max) * levels)));\n}\n\n/** How much of `color` a step mixes into the surface: 20% for the first step, 100% for\n * the last — the floor keeps the smallest value visibly apart from an empty day. */\nfunction levelPercent(level: number, levels: number): number {\n if (levels <= 1) return 100;\n return Math.round(20 + (80 * (level - 1)) / (levels - 1));\n}\n\nfunction levelFill(level: number, levels: number, color: string): string {\n if (level === 0) return EMPTY_FILL;\n return `color-mix(in oklab, ${color} ${levelPercent(level, levels)}%, var(--bg-surface))`;\n}\n\n/**\n * Days as a grid of shaded squares — how much happened on each, at a glance\n * (a contribution graph, a spending calendar).\n *\n * **Every day is a cell you can reach.** The grid is a `role=\"grid\"` with ONE tab\n * stop (the roving tabindex, as in `MiniCalendar`); the arrows move by the grid's own\n * geometry — in `\"weeks\"` ↑/↓ are the previous/next day and ←/→ a week, in `\"month\"`\n * the other way round, mirrored in RTL — PageUp/PageDown move a month and Home/End go\n * to the window's first/last day. Each cell is named with its whole date AND its value,\n * because the colour is not something a screen reader can say, and carries\n * `data-day=\"YYYY-MM-DD\"` as its identity for tests and for the host. Note that in\n * `\"weeks\"` the cells are in DOM order by WEEKDAY ROW (all Mondays, then all\n * Tuesdays…), not by date — query by `data-day`, not by position.\n *\n * The tooltip is portalled (a year of squares always sits in a sideways scroller) and\n * `data-private` unless `sensitive={false}`. Cell size in `\"weeks\"` is the CSS variable\n * `--heatmap-cell` (default `0.75rem`): `style={{ \"--heatmap-cell\": \"1rem\" }}`.\n */\nexport function CalendarHeatmap({\n data,\n from,\n to,\n layout = \"weeks\",\n selected,\n onSelect,\n formatValue: formatValueProp,\n tooltip,\n sensitive = true,\n max: maxProp,\n levels = 4,\n color = \"var(--brand)\",\n colorFrom,\n colorTo,\n fill: fillProp,\n emptyColor,\n anchor = \"to\",\n maxDays,\n legend = true,\n locale: localeProp,\n weekStartsOn,\n labels: labelsProp,\n className,\n \"aria-label\": ariaLabel,\n ...rest\n}: CalendarHeatmapProps) {\n const labels = useKitLabels(\"calendarHeatmap\", DEFAULT_CALENDAR_HEATMAP_LABELS, labelsProp);\n const locale = useKitLocale(localeProp);\n const providerWeekStart = useKitWeekStart();\n const weekStart: WeekDay = weekStartsOn ?? providerWeekStart ?? localeWeekStart(locale);\n const numberFormat = useMemo(() => new Intl.NumberFormat(locale), [locale]);\n const formatValue = formatValueProp ?? ((v: number) => formatWithMinus(numberFormat, v));\n\n const values = useMemo(() => {\n const m = new Map<string, number>();\n for (const p of data) m.set(p.date, (m.get(p.date) ?? 0) + p.value);\n return m;\n }, [data]);\n\n // The window, trimmed from the FRONT: the days a person looks for are the recent\n // ones, and a cap that kept the oldest would end the calendar before today.\n const latestData = useMemo(() => {\n let latest = \"\";\n for (const [iso, v] of values) if (v !== 0 && iso > latest) latest = iso;\n return latest;\n }, [values]);\n const windowEnd = heatmapWindowEnd(from, to, anchor, latestData);\n\n const { days, dropped } = useMemo(() => {\n const start = parseIsoDate(from);\n const end = parseIsoDate(windowEnd);\n const list: Date[] = [];\n if (!start || !end || end < start) return { days: list, dropped: 0 };\n const cursor = new Date(end);\n const cap = maxDays && maxDays > 0 ? maxDays : Infinity;\n while (cursor >= start && list.length < cap) {\n list.unshift(new Date(cursor));\n cursor.setDate(cursor.getDate() - 1);\n }\n const first = list[0];\n const trimmed = first ? Math.round((first.getTime() - start.getTime()) / 86_400_000) : 0;\n return { days: list, dropped: Math.max(0, trimmed) };\n }, [from, windowEnd, maxDays]);\n\n const firstIso = days.length ? toLocalIso(days[0]) : \"\";\n const lastIso = days.length ? toLocalIso(days[days.length - 1]) : \"\";\n\n const max = useMemo(() => {\n if (maxProp !== undefined) return maxProp;\n let m = 0;\n for (const d of days) m = Math.max(m, values.get(toLocalIso(d)) ?? 0);\n return m;\n }, [maxProp, days, values]);\n\n const clampIso = (iso: string) => (iso < firstIso ? firstIso : iso > lastIso ? lastIso : iso);\n\n // The roving tab stop: the selected day, else the latest one.\n const [activeState, setActiveIso] = useState(() => selected || lastIso);\n const [lastSelected, setLastSelected] = useState(selected);\n if (lastSelected !== selected) {\n setLastSelected(selected);\n if (selected) setActiveIso(selected);\n }\n const activeIso = days.length ? clampIso(activeState || lastIso) : \"\";\n\n const gridRef = useRef<HTMLDivElement>(null);\n const scrollerRef = useRef<HTMLDivElement>(null);\n const pendingFocus = useRef<string | null>(null);\n useEffect(() => {\n const iso = pendingFocus.current;\n if (!iso) return;\n pendingFocus.current = null;\n gridRef.current?.querySelector<HTMLElement>(`[data-day=\"${iso}\"]`)?.focus();\n });\n\n // Open the sideways scroller on the latest weeks, not the oldest. In RTL the end is\n // on the left, where browsers count scrollLeft down from 0.\n //\n // And KEEP it there while the box changes size — a sidebar or a contents rail that\n // appears after mount narrows the scroller, which leaves scrollLeft where it was and\n // so shows older weeks than it opened on. The pin holds only while the view sits at\n // the end: a user who scrolls back through the year unpins it, and a resize then\n // leaves their position alone. (Scrolling back to the end pins it again.)\n useLayoutEffect(() => {\n const el = scrollerRef.current;\n if (!el || layout !== \"weeks\") return;\n const toEnd = () => {\n el.scrollLeft = dirOf(el) === \"rtl\" ? -el.scrollWidth : el.scrollWidth;\n };\n toEnd();\n if (typeof ResizeObserver === \"undefined\") return;\n // |scrollLeft| covers both directions: 0 → max in LTR, 0 → -max in RTL.\n let pinned = true;\n const onScroll = () => {\n pinned = Math.abs(el.scrollLeft) >= el.scrollWidth - el.clientWidth - 1;\n };\n const ro = new ResizeObserver(() => {\n if (pinned) toEnd();\n });\n el.addEventListener(\"scroll\", onScroll, { passive: true });\n ro.observe(el);\n return () => {\n ro.disconnect();\n el.removeEventListener(\"scroll\", onScroll);\n };\n }, [layout, firstIso, lastIso]);\n\n const formatDay = (d: Date) => d.toLocaleDateString(locale, DAY_NAME_FORMAT);\n\n const weekdayLabels = useMemo(() => {\n const ref = new Date(2024, 0, 7 + weekStart); // 7 January 2024 was a Sunday\n const week = Array.from({ length: 7 }, (_, i) => {\n const d = new Date(ref);\n d.setDate(ref.getDate() + i);\n return d;\n });\n const name = (d: Date, weekday: \"short\" | \"narrow\" | \"long\") => d.toLocaleDateString(locale, { weekday });\n // The label column is 2rem at 10px type, room for about four characters. Most\n // locales' \"short\" is three or four (\"Thu\", \"jeu.\", \"czw.\"), but some have no\n // abbreviation at all — Arabic's short Thursday IS \"الخميس\", which overran the box\n // and was cut. Such a locale takes the \"narrow\" form (\"خ\") for ALL seven, so the\n // column never mixes two forms; the full name is on the aria-label either way.\n const tooLong = week.some((d) => [...name(d, \"short\")].length > 4);\n return week.map((d) => ({ short: name(d, tooLong ? \"narrow\" : \"short\"), long: name(d, \"long\") }));\n }, [locale, weekStart]);\n\n const lead = days.length ? weekdayIndex(days[0], weekStart) : 0;\n const weekCount = Math.ceil((lead + days.length) / 7);\n /** The day at position `i` of the week-aligned sequence (blanks before the first). */\n const dayAt = (i: number): Date | null => (i >= lead && i - lead < days.length ? days[i - lead] : null);\n\n const move = (e: KeyboardEvent<HTMLElement>) => {\n const current = parseIsoDate(activeIso);\n if (!current) return;\n const next = new Date(current);\n const step = horizontalStep(e.key, e.currentTarget);\n // In \"weeks\" a row is a weekday, so sideways is a week and up/down is a day.\n const across = layout === \"weeks\" ? 7 : 1;\n const down = layout === \"weeks\" ? 1 : 7;\n switch (step ? \"horizontal\" : e.key) {\n case \"horizontal\":\n next.setDate(next.getDate() + step * across);\n break;\n case \"ArrowUp\":\n next.setDate(next.getDate() - down);\n break;\n case \"ArrowDown\":\n next.setDate(next.getDate() + down);\n break;\n case \"PageUp\":\n next.setTime(addMonthsClamped(next, -1).getTime());\n break;\n case \"PageDown\":\n next.setTime(addMonthsClamped(next, 1).getTime());\n break;\n case \"Home\":\n next.setTime(days[0].getTime());\n break;\n case \"End\":\n next.setTime(days[days.length - 1].getTime());\n break;\n default:\n return;\n }\n e.preventDefault();\n const iso = clampIso(toLocalIso(next));\n if (iso === activeIso) return;\n pendingFocus.current = iso;\n setActiveIso(iso);\n };\n\n const legendLevels = Array.from({ length: levels + 1 }, (_, l) => l);\n const empty = emptyColor ?? EMPTY_FILL;\n const continuous = colorFrom !== undefined && colorTo !== undefined;\n const hexRamp = continuous && parseHex(colorFrom) != null && parseHex(colorTo) != null;\n\n /** A day's fill, and the ink its number is set in (`\"month\"`). */\n const paint = (value: number, level: number): { fill: string; ink: string } => {\n if (level === 0) return { fill: empty, ink: \"var(--text-primary)\" };\n if (fillProp || continuous) {\n const t = max > 0 ? Math.min(1, Math.max(0, value / max)) : 1;\n const fill = fillProp\n ? fillProp(value, max)\n : hexRamp\n ? lerpHex(colorFrom!, colorTo!, t)\n : `color-mix(in oklab, ${colorTo} ${Math.round(t * 100)}%, ${colorFrom})`;\n // Measured where the fill is a colour; a mix of references cannot be measured,\n // and the page's own text colour is the safe answer there.\n const measured = textOn(fill);\n return { fill, ink: measured === \"currentColor\" ? \"var(--text-primary)\" : measured };\n }\n // Light text once the fill is the stronger half of the mix — `--bg-surface` is the\n // colour the scale is mixed INTO, so it is the one that contrasts with its far end\n // on either theme.\n const strong = levelPercent(level, levels) >= 45;\n return {\n fill: levelFill(level, levels, color),\n ink: strong ? \"var(--bg-surface)\" : \"var(--text-primary)\",\n };\n };\n // The legend's swatches: a value that lands on each step (the top one on `max`).\n const legendFill = (l: number) => paint(((max > 0 ? max : 1) * l) / levels, l).fill;\n\n const cell = (d: Date, wrapClass: string, cellClass: string, withNumber: boolean) => {\n const iso = toLocalIso(d);\n const raw = values.get(iso);\n const value = raw ?? 0;\n const level = heatmapLevel(value, max, levels);\n const { fill, ink } = paint(value, level);\n const formattedDate = formatDay(d);\n const formattedValue = formatValue(value);\n const name = labels.day(formattedDate, formattedValue);\n const label = tooltip\n ? tooltip({ iso, date: d, value, hasData: raw !== undefined, level, formattedDate, formattedValue })\n : name;\n const isSelected = selected === iso;\n const shared = {\n role: \"gridcell\",\n \"data-day\": iso,\n \"data-level\": level,\n tabIndex: iso === activeIso ? 0 : -1,\n \"aria-label\": name,\n \"aria-selected\": onSelect ? isSelected : undefined,\n onKeyDown: move,\n onFocus: () => {\n if (iso !== activeIso) setActiveIso(iso);\n },\n style: { background: fill, color: ink },\n className: cn(\n cellClass,\n isSelected && \"ring-2 ring-[var(--text-primary)]\",\n onSelect && \"cursor-pointer hover:ring-1 hover:ring-brand\",\n ),\n } as const;\n const inner = withNumber ? (\n <span aria-hidden className=\"text-caption leading-none tabular-nums\">\n {numberFormat.format(d.getDate())}\n </span>\n ) : null;\n return (\n <Tooltip key={iso} label={label} portal redact={sensitive} role=\"none\" className={wrapClass}>\n {onSelect ? (\n <button type=\"button\" {...shared} onClick={() => onSelect(iso)}>\n {inner}\n </button>\n ) : (\n <div {...shared}>{inner}</div>\n )}\n </Tooltip>\n );\n };\n\n const gridName = ariaLabel ?? labels.grid;\n let body: ReactNode;\n if (layout === \"weeks\") {\n const columns = {\n gridTemplateColumns: `var(--heatmap-label, 2rem) repeat(${weekCount}, var(--heatmap-cell, 0.75rem))`,\n } as CSSProperties;\n const cellSize = \"size-[var(--heatmap-cell,0.75rem)]\";\n // A month's name over the first column that holds its 1st — or over the first\n // column, when the window opens far enough before the next month for it to fit.\n const monthLabels = Array.from({ length: weekCount }, (_, w) => {\n for (let r = 0; r < 7; r++) {\n const d = dayAt(w * 7 + r);\n if (d && (d.getDate() === 1 || (w === 0 && r === lead && d.getDate() <= 14))) {\n return d.toLocaleDateString(locale, { month: \"short\" });\n }\n }\n return \"\";\n });\n body = (\n <div ref={scrollerRef} className=\"overflow-x-auto pb-1\">\n <div ref={gridRef} role=\"grid\" aria-label={gridName} className=\"inline-grid gap-0.5\">\n {/* Decoration: every cell's name already carries its month. */}\n <div aria-hidden className=\"grid gap-0.5 text-micro leading-3 text-muted\" style={columns}>\n <span />\n {monthLabels.map((m, w) => (\n <span key={w} className=\"overflow-visible whitespace-nowrap\">\n {m}\n </span>\n ))}\n </div>\n {Array.from({ length: 7 }, (_, r) => (\n <div key={r} role=\"row\" className=\"grid gap-0.5\" style={columns}>\n <div\n role=\"rowheader\"\n aria-label={weekdayLabels[r].long}\n className=\"overflow-hidden pe-1 text-micro leading-3 text-muted\"\n >\n {/* Every other weekday, as a contribution graph does: seven labels\n at this size are a smear. The name is there for all seven. */}\n {r % 2 === 1 ? weekdayLabels[r].short : \"\"}\n </div>\n {Array.from({ length: weekCount }, (_, w) => {\n const d = dayAt(w * 7 + r);\n return d ? (\n cell(d, cellSize, cn(cellSize, \"block rounded-sm\"), false)\n ) : (\n <div key={`pad-${w}`} role=\"gridcell\" className={cellSize} />\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n } else {\n const rows = Array.from({ length: weekCount }, (_, w) => w);\n body = (\n <div ref={gridRef} role=\"grid\" aria-label={gridName} className=\"grid gap-1\">\n <div role=\"row\" className=\"grid grid-cols-7 gap-1\">\n {weekdayLabels.map((w, i) => (\n <div\n key={i}\n role=\"columnheader\"\n aria-label={w.long}\n className=\"pb-0.5 text-center text-micro uppercase tracking-wide text-muted\"\n >\n {w.short}\n </div>\n ))}\n </div>\n {rows.map((w) => (\n <div key={w} role=\"row\" className=\"grid grid-cols-7 gap-1\">\n {Array.from({ length: 7 }, (_, c) => {\n const d = dayAt(w * 7 + c);\n return d ? (\n cell(d, \"aspect-square w-full\", \"flex h-full w-full items-center justify-center rounded\", true)\n ) : (\n <div key={`pad-${c}`} role=\"gridcell\" className=\"aspect-square\" />\n );\n })}\n </div>\n ))}\n </div>\n );\n }\n\n return (\n <div {...rest} className={cn(\"min-w-0\", className)}>\n {dropped > 0 && <div className=\"mb-2 text-xs text-muted\">{labels.truncated(dropped)}</div>}\n {body}\n {legend && (\n <div aria-hidden className=\"mt-2 flex items-center justify-end gap-1 text-micro text-muted\">\n <span className=\"me-0.5\">{labels.less}</span>\n {legendLevels.map((l) => (\n <span key={l} data-legend-level={l} className=\"size-2.5 rounded-sm\" style={{ background: legendFill(l) }} />\n ))}\n <span className=\"ms-0.5\">{labels.more}</span>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AA2dM,cAuCI,YAvCJ;AA3dN,SAAS,WAAW,iBAAiB,SAAS,QAAQ,gBAAgB;AAEtE,SAAS,UAAU;AACnB,SAAS,OAAO,sBAAsB;AACtC,SAAS,kBAAkB,iBAAiB,cAAc,kBAAkB;AAC5E,SAAS,cAAc,cAAc,uBAA2C;AAChF,SAAS,SAAS,cAAc;AAChC,SAAS,gBAAgB;AACzB,SAAS,eAAe;AAExB,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AAC;AAC1D,WACE,qBAAC,SAAI,KAAK,SAAS,MAAK,QAAO,cAAY,UAAU,WAAU,cAC7D;AAAA,0BAAC,SAAI,MAAK,OAAM,WAAU,0BACvB,wBAAc,IAAI,CAAC,GAAG,MACrB;AAAA,QAAC;AAAA;AAAA,UAEC,MAAK;AAAA,UACL,cAAY,EAAE;AAAA,UACd,WAAU;AAAA,UAET,YAAE;AAAA;AAAA,QALE;AAAA,MAMP,CACD,GACH;AAAA,MACC,KAAK,IAAI,CAAC,MACT,oBAAC,SAAY,MAAK,OAAM,WAAU,0BAC/B,gBAAM,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,GAAG,MAAM;AACnC,cAAM,IAAI,MAAM,IAAI,IAAI,CAAC;AACzB,eAAO,IACL,KAAK,GAAG,wBAAwB,0DAA0D,IAAI,IAE9F,oBAAC,SAAqB,MAAK,YAAW,WAAU,mBAAtC,OAAO,CAAC,EAA8C;AAAA,MAEpE,CAAC,KARO,CASV,CACD;AAAA,OACH;AAAA,EAEJ;AAEA,SACE,qBAAC,SAAK,GAAG,MAAM,WAAW,GAAG,WAAW,SAAS,GAC9C;AAAA,cAAU,KAAK,oBAAC,SAAI,WAAU,2BAA2B,iBAAO,UAAU,OAAO,GAAE;AAAA,IACnF;AAAA,IACA,UACC,qBAAC,SAAI,eAAW,MAAC,WAAU,kEACzB;AAAA,0BAAC,UAAK,WAAU,UAAU,iBAAO,MAAK;AAAA,MACrC,aAAa,IAAI,CAAC,MACjB,oBAAC,UAAa,qBAAmB,GAAG,WAAU,uBAAsB,OAAO,EAAE,YAAY,WAAW,CAAC,EAAE,KAA5F,CAA+F,CAC3G;AAAA,MACD,oBAAC,UAAK,WAAU,UAAU,iBAAO,MAAK;AAAA,OACxC;AAAA,KAEJ;AAEJ;","names":["_"]}
@@ -165,14 +165,7 @@ function CardContent({ className, ...props }) {
165
165
  }
166
166
  function CardFooter({ className, ...props }) {
167
167
  const padded = useContext(CardPaddedContext);
168
- return /* @__PURE__ */ jsx(
169
- "div",
170
- {
171
- "data-slot": "card-footer",
172
- className: cn("flex items-center", !padded && "px-6 pb-6", className),
173
- ...props
174
- }
175
- );
168
+ return /* @__PURE__ */ jsx("div", { "data-slot": "card-footer", className: cn("flex items-center", !padded && "px-6 pb-6", className), ...props });
176
169
  }
177
170
  export {
178
171
  Card,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/card.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode, Ref } from \"react\";\nimport { cn } from \"../lib/cn\";\n\n/**\n * A `div`'s props, `ref` included since 0.34 — and the same for every Card part (API-2,\n * refactor audit 2026-10, Skeleton's 0.33.1 change). They always reached the element;\n * `ComponentPropsWithoutRef` only kept `ref` out of the type, so keksdose wrapped a Card in\n * a `<div ref>` to scroll it into view (admin-actions-panel).\n */\nexport interface CardProps extends ComponentPropsWithRef<\"div\"> {\n children: ReactNode;\n /**\n * When true, drop the card chrome (border, rounded corners, shadow) on mobile so the\n * card spans edge-to-edge. Chrome reappears at the `md` breakpoint. Use for primary\n * content cards on data pages; leave off for centered dialog/panel cards.\n */\n flush?: boolean;\n /**\n * `inset`: a panel INSIDE a card rather than a card on the page — the raised\n * `--bg-surface-2`, a small radius, `p-3` of its own and no border or shadow, since\n * it is already sitting on the card that has them. Lenkbank's results blocks and\n * corner panels write this by hand (`rounded-md bg-surface-2 p-3`) under a Card of\n * their own. Unlike the default card it carries its padding, because every one of\n * those copies wanted the same one; a caller's `p-*` still wins. `flush` is ignored:\n * an inset panel never runs edge to edge.\n */\n variant?: \"default\" | \"inset\" | \"outline\";\n /**\n * The card's own padding: `none`, `sm` (`p-3`) or `md` (`p-4`).\n *\n * `outline` is the bordered box with no shadow — a row or a block INSIDE a section\n * rather than a card on the page: kastlan's rent breakdown rows\n * (tenancy/components/breakdown-row.tsx, `rounded-lg border p-4`) and the meters\n * list's inline add row (meters/components/meter-add-row.tsx). It takes `md` by\n * default, as every one of those copies does; `sm` is the dense row.\n *\n * Left out, the default card keeps no padding (its CardHeader / CardContent own the\n * rhythm) and `inset` keeps its `p-3`; passing it sets theirs too. A caller's `p-*`\n * in `className` still wins.\n *\n * Whenever the card carries a padding — this prop, or the `inset` / `outline` one —\n * CardHeader, CardContent and CardFooter drop their own `px-6` / `pt-6` / `pb-6`, so\n * the card's padding is the only one. Before 0.16 they kept it regardless and a\n * `padding=\"md\"` card with parts was padded twice (40px a side); keksdose's settings\n * cards zeroed all three parts by hand (`<CardHeader className=\"p-0\">`). A padding set\n * only through `className` cannot be seen from the parts: use the prop.\n */\n padding?: \"none\" | \"sm\" | \"md\";\n /**\n * A card that is a WARNING (or other status) as a whole: the border in the tone's\n * `-border` colour and the {@link CardTitle} in the tone's text colour. kastlan's\n * dunning summary (invoice-detail-page.tsx:231-235) writes both by hand —\n * `border-[var(--warning-border)]` on the Card, `text-[var(--warning)]` on the title\n * — and the next status card would copy the pair (`outline` takes it the same way).\n * An `inset` panel has no border, so it takes the tone's quiet `-bg` fill instead.\n * `data-tone` is set for a caller's own\n * selectors.\n */\n tone?: CardTone;\n /**\n * How loud the `tone` frame is. `\"strong\"`: a 2px border in the tone's strong\n * colour — `--danger-border-strong` for `danger`, `--warning-border-strong` for\n * `warning` (0.33: amber-600 in dark, where `--warning` stood 13:1 off the card and\n * shouted; docs/colour-roles-harmonization.md §5.2), the tone's own text colour\n * (`--info`, `--success`) for the two with no `-border-strong` token of their own.\n * For the one tile on a page that guards something destructive or security-relevant:\n * keksdose's password / delete-account tile (shared/components/password-danger-card.tsx)\n * wrote `toneFrameClass(tone)` over the Card by hand for the 2px rule, and `p-[15px]`\n * under it so the content did not move. Here the extra pixel comes off the padding the\n * same way (`padding` or the variant's own), so a strong card's content sits exactly\n * where a soft one's does.\n *\n * Default `\"soft\"`: the 1px `-border` it has always been. No effect without `tone`,\n * nor on `inset`, which has no border to make louder (its tone is a fill).\n */\n toneStrength?: \"soft\" | \"strong\";\n /**\n * Wash the card in the tone's quiet `-bg` surface as well as framing it. A toned\n * card is a border and a title colour, at either strength — the wash belongs to\n * `AlertBanner`, the message, not to a card that holds a form — so it stays\n * off by default. Some tiles want both: keksdose's password / delete-account tile\n * was `toneFrameClass(tone)` (border AND wash) before 0.16, and after moving to\n * `toneStrength=\"strong\"` it re-added `bg-[var(--danger-bg)]` by hand. The wash is\n * layered OVER the card's own `--bg-surface` (as AlertBanner's `elevated` does), so\n * the dark theme's translucent tints stay a card, not a hole to the page below.\n *\n * No effect without `tone`, nor on `inset`, whose tone is already the fill.\n */\n toneFill?: boolean;\n /**\n * The parts' type scale. `\"compact\"`: CardTitle `text-sm font-medium`,\n * CardDescription `text-xs` and the CardHeader's title-to-description gap\n * `gap-0.5` — the small settings / admin card. keksdose wrote those three classes by\n * hand on ~25 cards. Set here, they reach the parts through context; a class on a\n * part still wins, and a Card nested inside starts again from its own density.\n *\n * Default `\"comfortable\"`: the parts as they have always been.\n */\n density?: CardDensity;\n}\n\nexport type CardDensity = \"comfortable\" | \"compact\";\n\nexport type CardTone = \"warning\" | \"danger\" | \"info\" | \"success\";\n\n// The title is reached through its `data-slot`, so the tone needs no context and a\n// caller's `className` on CardTitle still wins (it is on the element itself).\nconst CARD_TONES: Record<CardTone, { border: string; fill: string; title: string }> = {\n warning: {\n border: \"border-warning\",\n fill: \"bg-warning-soft\",\n title: \"[&_[data-slot=card-title]]:text-warning\",\n },\n danger: {\n border: \"border-danger\",\n fill: \"bg-danger-soft\",\n title: \"[&_[data-slot=card-title]]:text-danger\",\n },\n info: {\n border: \"border-info\",\n fill: \"bg-info-soft\",\n title: \"[&_[data-slot=card-title]]:text-info\",\n },\n success: {\n border: \"border-success\",\n fill: \"bg-success-soft\",\n title: \"[&_[data-slot=card-title]]:text-success\",\n },\n};\n\nconst CARD_PADDING: Record<NonNullable<CardProps[\"padding\"]>, string> = {\n none: \"p-0\",\n sm: \"p-3\",\n md: \"p-4\",\n};\n\n// The same padding one pixel short, for a 2px `toneStrength=\"strong\"` frame: the\n// border grows inwards by that pixel, so the content stays where the 1px card had it.\n// `calc(rem − 1px)` (0.32, §3.2): the padding grows with the text like `p-3` / `p-4`,\n// the border does not — a fixed 11 / 15 px stopped matching them at 125 %, and toggling\n// the tone shifted the content.\nconst CARD_PADDING_STRONG: Record<NonNullable<CardProps[\"padding\"]>, string> = {\n none: \"p-0\",\n sm: \"p-[calc(0.75rem-1px)]\",\n md: \"p-[calc(1rem-1px)]\",\n};\n\n// The wash as a background IMAGE over the card's opaque `--bg-surface` — see\n// `toneFill`. A plain `bg-danger-soft` would REPLACE the surface, and the dark\n// theme's washes are a translucent tint.\nconst CARD_TONE_WASH: Record<CardTone, string> = {\n warning: \"bg-[image:linear-gradient(var(--warning-bg),var(--warning-bg))]\",\n danger: \"bg-[image:linear-gradient(var(--danger-bg),var(--danger-bg))]\",\n info: \"bg-[image:linear-gradient(var(--info-bg),var(--info-bg))]\",\n success: \"bg-[image:linear-gradient(var(--success-bg),var(--success-bg))]\",\n};\n\nconst CARD_TONES_STRONG: Record<CardTone, string> = {\n warning: \"border-2 border-warning-strong\",\n danger: \"border-2 border-danger-strong\",\n info: \"border-2 border-[var(--info)]\",\n success: \"border-2 border-[var(--success)]\",\n};\n\n/**\n * Whether the {@link Card} round the parts carries the padding itself — so CardHeader,\n * CardContent and CardFooter must not add theirs on top. `false` (no Card, or a default\n * card with no `padding`) keeps the parts' own `px-6` rhythm, as it always was.\n */\nconst CardPaddedContext = createContext(false);\n\n/** The {@link CardProps.density} of the nearest Card — the parts' type scale. */\nconst CardDensityContext = createContext<CardDensity>(\"comfortable\");\n\nexport function Card({\n className,\n children,\n flush,\n variant = \"default\",\n tone,\n toneStrength = \"soft\",\n toneFill = false,\n density = \"comfortable\",\n padding,\n ...rest\n}: CardProps) {\n const toned = tone ? CARD_TONES[tone] : undefined;\n // An outline card is bordered like the default one, so a tone recolours its border.\n const bordered = variant !== \"inset\";\n const strong = toned !== undefined && bordered && toneStrength === \"strong\";\n // The padding the card itself carries: the prop, else the variant's own (`inset`\n // p-3, `outline` p-4). A default card with no prop carries none — its parts do.\n const ownPadding = padding ?? (variant === \"inset\" ? \"sm\" : variant === \"outline\" ? \"md\" : undefined);\n return (\n <div\n data-tone={tone}\n data-tone-strength={strong ? \"strong\" : undefined}\n data-density={density === \"compact\" ? \"compact\" : undefined}\n {...rest}\n className={cn(\n variant === \"inset\"\n ? \"rounded-md bg-surface-2 p-3\"\n : variant === \"outline\"\n ? // No shadow and no `flush`: it sits on a surface that already has both.\n \"rounded-lg border border-subtle bg-surface p-4\"\n : cn(\n // Surface + border are theme tokens so the palette switcher (feedback\n // #307) can re-skin every card; a caller's own bg-*/border-* override\n // still wins via tailwind-merge.\n \"bg-surface\",\n flush\n ? \"border-y border-subtle md:rounded-lg md:border md:shadow-sm\"\n : \"rounded-lg border border-subtle shadow-sm\",\n ),\n toned && (bordered ? toned.border : toned.fill),\n strong && tone && CARD_TONES_STRONG[tone],\n toneFill && bordered && tone && CARD_TONE_WASH[tone],\n toned?.title,\n ownPadding && (strong ? CARD_PADDING_STRONG : CARD_PADDING)[ownPadding],\n className,\n )}\n >\n <CardPaddedContext.Provider value={ownPadding !== undefined}>\n <CardDensityContext.Provider value={density}>{children}</CardDensityContext.Provider>\n </CardPaddedContext.Provider>\n </div>\n );\n}\n\n// Composed shadcn-style Card sub-parts. A default `Card` with no `padding` stays\n// padding-less, so these own the padding/rhythm (`px-6`, the header's `pt-6`, the\n// last part's `pb-6`). A Card that carries a padding of its own — the `padding` prop,\n// or `inset` / `outline`, which have one built in — tells them so through context and\n// they add none on top (see CardPaddedContext). Token-driven so they re-skin with the\n// palette. Use CardHeader → CardTitle/CardDescription (+ optional CardAction,\n// top-right) → CardContent → CardFooter.\n/** The sub-parts add nothing to a `<div>`'s props — they are the SAME element with a\n * `data-slot` and a padding rhythm — so most names are aliases rather than an empty\n * interface pretending to be more. They exist so a consumer's own wrapper can say\n * `CardHeaderProps` instead of `ComponentProps<typeof CardHeader>`. */\nexport interface CardHeaderProps extends ComponentPropsWithRef<\"div\"> {\n /**\n * Below the `sm` breakpoint, put the {@link CardAction} UNDER the title and\n * description instead of beside them. For an action that is wider than an icon —\n * a \"Set up two-factor\" button, a checkbox and a filter — which, kept in the\n * top-end column on a 390px phone, squeezed the title into a ribbon two words wide\n * (keksdose's settings cards). Off by default at Normal: an icon action (the wizard\n * summary's pencil) is narrow enough to stay beside the title at every width.\n *\n * Unset, it stacks at Large and Extra large only (0.32.1, the 360 px Extra-large\n * sweep; docs/text-size-harmonization.md §4): there an IconButton shows its label as\n * text, so the \"icon\" action is a word-wide pill, and \"Refresh sessions\" beside\n * \"Sessions\" ran 47 px past a 360 px phone. `false` keeps the action beside the title\n * at every size, for an action the caller knows stays narrow (`labelVisible={false}`).\n */\n stackAction?: boolean;\n}\nexport type CardTitleLevel = \"div\" | \"h2\" | \"h3\" | \"h4\";\nexport interface CardTitleProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The element the title is: `\"div\"` (default) or a heading level. Five of keksdose's\n * settings cards nested their own `<h2>` / `<h3>` INSIDE CardTitle to put the card in\n * the page's outline — a heading in a div that looks like a heading. The heading\n * takes the title's look unchanged (the reset leaves `h2`–`h4` at inherited size and\n * weight), so only the outline changes.\n */\n as?: CardTitleLevel;\n /** The title's element — a `div` or the heading `as` names, hence `HTMLElement`. */\n ref?: Ref<HTMLElement>;\n}\nexport type CardDescriptionProps = ComponentPropsWithRef<\"div\">;\nexport type CardActionProps = ComponentPropsWithRef<\"div\">;\nexport type CardContentProps = ComponentPropsWithRef<\"div\">;\nexport type CardFooterProps = ComponentPropsWithRef<\"div\">;\n\n/** {@link CardHeaderProps.stackAction}: one column under `sm`, and the action back into\n * the flow (DOM order, so after the description when it is written after it), at the\n * start edge. The descendant selector outranks CardAction's own placement classes. */\nconst CARD_STACK_ACTION =\n \"max-sm:grid-cols-1 max-sm:[&>[data-slot=card-action]]:col-start-1 max-sm:[&>[data-slot=card-action]]:row-span-1 max-sm:[&>[data-slot=card-action]]:row-start-auto max-sm:[&>[data-slot=card-action]]:justify-self-start\";\n/** The same at Large and Extra large only — `stackAction` unset (see its note). A\n * `large:` class over the scaled `max-sm`, so it costs no render and is right on the\n * first paint. */\nconst CARD_STACK_ACTION_AT_LARGE =\n \"large:max-sm:grid-cols-1 large:max-sm:[&>[data-slot=card-action]]:col-start-1 large:max-sm:[&>[data-slot=card-action]]:row-span-1 large:max-sm:[&>[data-slot=card-action]]:row-start-auto large:max-sm:[&>[data-slot=card-action]]:justify-self-start\";\n\nexport function CardHeader({ className, stackAction, ...props }: CardHeaderProps) {\n const padded = useContext(CardPaddedContext);\n const compact = useContext(CardDensityContext) === \"compact\";\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n // Grid (not flex) so CardAction can occupy a top-right column; with no\n // action it collapses to one column and title/description stack.\n //\n // The two-column switch sets a VARIABLE, not `grid-template-columns`. As\n // `has-data-[slot=card-action]:grid-cols-[1fr_auto]` it was two classes of\n // specificity (the class plus the attribute inside `:has()`), and a caller's\n // `max-sm:grid-cols-1` — one class inside a media query — lost to it at every\n // width, so the action could never be stacked on a phone from outside. Now the\n // property itself is set by a plain one-class utility that any `grid-cols-*`\n // variant of the caller's outranks by coming later in the sheet; the `:has()`\n // rule only picks the value. The base `1fr` resets the variable so a header\n // never inherits an ancestor header's two columns.\n \"grid auto-rows-min items-start gap-1.5 [--card-header-cols:1fr] has-data-[slot=card-action]:[--card-header-cols:1fr_auto] grid-cols-[var(--card-header-cols,1fr)]\",\n padded ? \"px-0 pt-0\" : \"px-6 pt-6\",\n compact && \"gap-0.5\",\n stackAction === true && CARD_STACK_ACTION,\n stackAction === undefined && CARD_STACK_ACTION_AT_LARGE,\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function CardTitle({ className, as: Tag = \"div\", ref, ...props }: CardTitleProps) {\n const compact = useContext(CardDensityContext) === \"compact\";\n return (\n <Tag\n ref={ref as Ref<HTMLDivElement & HTMLHeadingElement>}\n data-slot=\"card-title\"\n // Compact is `leading-snug`, not `leading-none`: there the title sits on a\n // 12px description `gap-0.5` below, and a line box exactly the cap height left\n // the hint hugging the title's descenders (every keksdose admin card added\n // `leading-normal` by hand). Comfortable keeps `leading-none` — its 14px\n // description is `gap-1.5` away and has always read right.\n className={cn(compact ? \"text-sm font-medium leading-snug\" : \"font-semibold leading-none\", className)}\n {...props}\n />\n );\n}\n\nexport function CardDescription({ className, ...props }: CardDescriptionProps) {\n const compact = useContext(CardDensityContext) === \"compact\";\n return (\n <div\n data-slot=\"card-description\"\n // `--text-muted`, the kit's secondary-line colour (StatTile's description, the\n // field captions). It was `--money-neutral`, a MONEY token that happened to be\n // a similar grey — and a palette that re-tunes the money colours moved every\n // card's description with them.\n className={cn(compact ? \"text-xs\" : \"text-sm\", \"text-muted\", className)}\n {...props}\n />\n );\n}\n\nexport function CardAction({ className, ...props }: CardActionProps) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\"col-start-2 row-start-1 row-span-2 self-start justify-self-end\", className)}\n {...props}\n />\n );\n}\n\nexport function CardContent({ className, ...props }: CardContentProps) {\n const padded = useContext(CardPaddedContext);\n // `last:pb-6`, not a plain `pb-6`: CardHeader owns the top padding and CardFooter\n // owns the bottom one, so a card WITHOUT a footer had nothing closing it off and\n // its last field sat flush against the card edge (kastlan feedback: the language\n // input touching the card bottom on /profile). Scoping to `:last-child` fixes that\n // case and leaves a footered card's rhythm exactly as it was. Inside a padded Card\n // the card closes itself off, so there is nothing to add.\n return <div data-slot=\"card-content\" className={cn(!padded && \"px-6 last:pb-6\", className)} {...props} />;\n}\n\nexport function CardFooter({ className, ...props }: CardFooterProps) {\n const padded = useContext(CardPaddedContext);\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\"flex items-center\", !padded && \"px-6 pb-6\", className)}\n {...props}\n />\n );\n}\n"],"mappings":";AAgOQ;AAhOR,SAAS,eAAe,kBAAkB;AAE1C,SAAS,UAAU;AA0GnB,MAAM,aAAgF;AAAA,EACpF,SAAS;AAAA,IACP,QA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yB;AAC7E,QAAM,UAAU,WAAW,kBAAkB,MAAM;AACnD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MAKV,WAAW,GAAG,UAAU,YAAY,WAAW,cAAc,SAAS;AAAA,MACrE,GAAG;AAAA;AAAA,EACN;AAEJ;AAEO,SAAS,WAAW,EAAE,WAAW,GAAG,MAAM,GAAoB;AACnE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,kEAAkE,SAAS;AAAA,MACxF,GAAG;AAAA;AAAA,EACN;AAEJ;AAEO,SAAS,YAAY,EAAE,WAAW,GAAG,MAAM,GAAqB;AACrE,QAAM,SAAS,WAAW,iBAAiB;AAO3C,SAAO,oBAAC,SAAI,aAAU,gBAAe,WAAW,GAAG,CAAC,UAAU,kBAAkB,SAAS,GAAI,GAAG,OAAO;AACzG;AAEO,SAAS,WAAW,EAAE,WAAW,GAAG,MAAM,GAAoB;AACnE,QAAM,SAAS,WAAW,iBAAiB;AAC3C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,qBAAqB,CAAC,UAAU,aAAa,SAAS;AAAA,MACnE,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/card.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode, Ref } from \"react\";\nimport { cn } from \"../lib/cn\";\n\n/**\n * A `div`'s props, `ref` included since 0.34 — and the same for every Card part (API-2,\n * refactor audit 2026-10, Skeleton's 0.33.1 change). They always reached the element;\n * `ComponentPropsWithoutRef` only kept `ref` out of the type, so keksdose wrapped a Card in\n * a `<div ref>` to scroll it into view (admin-actions-panel).\n */\nexport interface CardProps extends ComponentPropsWithRef<\"div\"> {\n children: ReactNode;\n /**\n * When true, drop the card chrome (border, rounded corners, shadow) on mobile so the\n * card spans edge-to-edge. Chrome reappears at the `md` breakpoint. Use for primary\n * content cards on data pages; leave off for centered dialog/panel cards.\n */\n flush?: boolean;\n /**\n * `inset`: a panel INSIDE a card rather than a card on the page — the raised\n * `--bg-surface-2`, a small radius, `p-3` of its own and no border or shadow, since\n * it is already sitting on the card that has them. Lenkbank's results blocks and\n * corner panels write this by hand (`rounded-md bg-surface-2 p-3`) under a Card of\n * their own. Unlike the default card it carries its padding, because every one of\n * those copies wanted the same one; a caller's `p-*` still wins. `flush` is ignored:\n * an inset panel never runs edge to edge.\n */\n variant?: \"default\" | \"inset\" | \"outline\";\n /**\n * The card's own padding: `none`, `sm` (`p-3`) or `md` (`p-4`).\n *\n * `outline` is the bordered box with no shadow — a row or a block INSIDE a section\n * rather than a card on the page: kastlan's rent breakdown rows\n * (tenancy/components/breakdown-row.tsx, `rounded-lg border p-4`) and the meters\n * list's inline add row (meters/components/meter-add-row.tsx). It takes `md` by\n * default, as every one of those copies does; `sm` is the dense row.\n *\n * Left out, the default card keeps no padding (its CardHeader / CardContent own the\n * rhythm) and `inset` keeps its `p-3`; passing it sets theirs too. A caller's `p-*`\n * in `className` still wins.\n *\n * Whenever the card carries a padding — this prop, or the `inset` / `outline` one —\n * CardHeader, CardContent and CardFooter drop their own `px-6` / `pt-6` / `pb-6`, so\n * the card's padding is the only one. Before 0.16 they kept it regardless and a\n * `padding=\"md\"` card with parts was padded twice (40px a side); keksdose's settings\n * cards zeroed all three parts by hand (`<CardHeader className=\"p-0\">`). A padding set\n * only through `className` cannot be seen from the parts: use the prop.\n */\n padding?: \"none\" | \"sm\" | \"md\";\n /**\n * A card that is a WARNING (or other status) as a whole: the border in the tone's\n * `-border` colour and the {@link CardTitle} in the tone's text colour. kastlan's\n * dunning summary (invoice-detail-page.tsx:231-235) writes both by hand —\n * `border-[var(--warning-border)]` on the Card, `text-[var(--warning)]` on the title\n * — and the next status card would copy the pair (`outline` takes it the same way).\n * An `inset` panel has no border, so it takes the tone's quiet `-bg` fill instead.\n * `data-tone` is set for a caller's own\n * selectors.\n */\n tone?: CardTone;\n /**\n * How loud the `tone` frame is. `\"strong\"`: a 2px border in the tone's strong\n * colour — `--danger-border-strong` for `danger`, `--warning-border-strong` for\n * `warning` (0.33: amber-600 in dark, where `--warning` stood 13:1 off the card and\n * shouted; docs/colour-roles-harmonization.md §5.2), the tone's own text colour\n * (`--info`, `--success`) for the two with no `-border-strong` token of their own.\n * For the one tile on a page that guards something destructive or security-relevant:\n * keksdose's password / delete-account tile (shared/components/password-danger-card.tsx)\n * wrote `toneFrameClass(tone)` over the Card by hand for the 2px rule, and `p-[15px]`\n * under it so the content did not move. Here the extra pixel comes off the padding the\n * same way (`padding` or the variant's own), so a strong card's content sits exactly\n * where a soft one's does.\n *\n * Default `\"soft\"`: the 1px `-border` it has always been. No effect without `tone`,\n * nor on `inset`, which has no border to make louder (its tone is a fill).\n */\n toneStrength?: \"soft\" | \"strong\";\n /**\n * Wash the card in the tone's quiet `-bg` surface as well as framing it. A toned\n * card is a border and a title colour, at either strength — the wash belongs to\n * `AlertBanner`, the message, not to a card that holds a form — so it stays\n * off by default. Some tiles want both: keksdose's password / delete-account tile\n * was `toneFrameClass(tone)` (border AND wash) before 0.16, and after moving to\n * `toneStrength=\"strong\"` it re-added `bg-[var(--danger-bg)]` by hand. The wash is\n * layered OVER the card's own `--bg-surface` (as AlertBanner's `elevated` does), so\n * the dark theme's translucent tints stay a card, not a hole to the page below.\n *\n * No effect without `tone`, nor on `inset`, whose tone is already the fill.\n */\n toneFill?: boolean;\n /**\n * The parts' type scale. `\"compact\"`: CardTitle `text-sm font-medium`,\n * CardDescription `text-xs` and the CardHeader's title-to-description gap\n * `gap-0.5` — the small settings / admin card. keksdose wrote those three classes by\n * hand on ~25 cards. Set here, they reach the parts through context; a class on a\n * part still wins, and a Card nested inside starts again from its own density.\n *\n * Default `\"comfortable\"`: the parts as they have always been.\n */\n density?: CardDensity;\n}\n\nexport type CardDensity = \"comfortable\" | \"compact\";\n\nexport type CardTone = \"warning\" | \"danger\" | \"info\" | \"success\";\n\n// The title is reached through its `data-slot`, so the tone needs no context and a\n// caller's `className` on CardTitle still wins (it is on the element itself).\nconst CARD_TONES: Record<CardTone, { border: string; fill: string; title: string }> = {\n warning: {\n border: \"border-warning\",\n fill: \"bg-warning-soft\",\n title: \"[&_[data-slot=card-title]]:text-warning\",\n },\n danger: {\n border: \"border-danger\",\n fill: \"bg-danger-soft\",\n title: \"[&_[data-slot=card-title]]:text-danger\",\n },\n info: {\n border: \"border-info\",\n fill: \"bg-info-soft\",\n title: \"[&_[data-slot=card-title]]:text-info\",\n },\n success: {\n border: \"border-success\",\n fill: \"bg-success-soft\",\n title: \"[&_[data-slot=card-title]]:text-success\",\n },\n};\n\nconst CARD_PADDING: Record<NonNullable<CardProps[\"padding\"]>, string> = {\n none: \"p-0\",\n sm: \"p-3\",\n md: \"p-4\",\n};\n\n// The same padding one pixel short, for a 2px `toneStrength=\"strong\"` frame: the\n// border grows inwards by that pixel, so the content stays where the 1px card had it.\n// `calc(rem − 1px)` (0.32, §3.2): the padding grows with the text like `p-3` / `p-4`,\n// the border does not — a fixed 11 / 15 px stopped matching them at 125 %, and toggling\n// the tone shifted the content.\nconst CARD_PADDING_STRONG: Record<NonNullable<CardProps[\"padding\"]>, string> = {\n none: \"p-0\",\n sm: \"p-[calc(0.75rem-1px)]\",\n md: \"p-[calc(1rem-1px)]\",\n};\n\n// The wash as a background IMAGE over the card's opaque `--bg-surface` — see\n// `toneFill`. A plain `bg-danger-soft` would REPLACE the surface, and the dark\n// theme's washes are a translucent tint.\nconst CARD_TONE_WASH: Record<CardTone, string> = {\n warning: \"bg-[image:linear-gradient(var(--warning-bg),var(--warning-bg))]\",\n danger: \"bg-[image:linear-gradient(var(--danger-bg),var(--danger-bg))]\",\n info: \"bg-[image:linear-gradient(var(--info-bg),var(--info-bg))]\",\n success: \"bg-[image:linear-gradient(var(--success-bg),var(--success-bg))]\",\n};\n\nconst CARD_TONES_STRONG: Record<CardTone, string> = {\n warning: \"border-2 border-warning-strong\",\n danger: \"border-2 border-danger-strong\",\n info: \"border-2 border-[var(--info)]\",\n success: \"border-2 border-[var(--success)]\",\n};\n\n/**\n * Whether the {@link Card} round the parts carries the padding itself — so CardHeader,\n * CardContent and CardFooter must not add theirs on top. `false` (no Card, or a default\n * card with no `padding`) keeps the parts' own `px-6` rhythm, as it always was.\n */\nconst CardPaddedContext = createContext(false);\n\n/** The {@link CardProps.density} of the nearest Card — the parts' type scale. */\nconst CardDensityContext = createContext<CardDensity>(\"comfortable\");\n\nexport function Card({\n className,\n children,\n flush,\n variant = \"default\",\n tone,\n toneStrength = \"soft\",\n toneFill = false,\n density = \"comfortable\",\n padding,\n ...rest\n}: CardProps) {\n const toned = tone ? CARD_TONES[tone] : undefined;\n // An outline card is bordered like the default one, so a tone recolours its border.\n const bordered = variant !== \"inset\";\n const strong = toned !== undefined && bordered && toneStrength === \"strong\";\n // The padding the card itself carries: the prop, else the variant's own (`inset`\n // p-3, `outline` p-4). A default card with no prop carries none — its parts do.\n const ownPadding = padding ?? (variant === \"inset\" ? \"sm\" : variant === \"outline\" ? \"md\" : undefined);\n return (\n <div\n data-tone={tone}\n data-tone-strength={strong ? \"strong\" : undefined}\n data-density={density === \"compact\" ? \"compact\" : undefined}\n {...rest}\n className={cn(\n variant === \"inset\"\n ? \"rounded-md bg-surface-2 p-3\"\n : variant === \"outline\"\n ? // No shadow and no `flush`: it sits on a surface that already has both.\n \"rounded-lg border border-subtle bg-surface p-4\"\n : cn(\n // Surface + border are theme tokens so the palette switcher (feedback\n // #307) can re-skin every card; a caller's own bg-*/border-* override\n // still wins via tailwind-merge.\n \"bg-surface\",\n flush\n ? \"border-y border-subtle md:rounded-lg md:border md:shadow-sm\"\n : \"rounded-lg border border-subtle shadow-sm\",\n ),\n toned && (bordered ? toned.border : toned.fill),\n strong && tone && CARD_TONES_STRONG[tone],\n toneFill && bordered && tone && CARD_TONE_WASH[tone],\n toned?.title,\n ownPadding && (strong ? CARD_PADDING_STRONG : CARD_PADDING)[ownPadding],\n className,\n )}\n >\n <CardPaddedContext.Provider value={ownPadding !== undefined}>\n <CardDensityContext.Provider value={density}>{children}</CardDensityContext.Provider>\n </CardPaddedContext.Provider>\n </div>\n );\n}\n\n// Composed shadcn-style Card sub-parts. A default `Card` with no `padding` stays\n// padding-less, so these own the padding/rhythm (`px-6`, the header's `pt-6`, the\n// last part's `pb-6`). A Card that carries a padding of its own — the `padding` prop,\n// or `inset` / `outline`, which have one built in — tells them so through context and\n// they add none on top (see CardPaddedContext). Token-driven so they re-skin with the\n// palette. Use CardHeader → CardTitle/CardDescription (+ optional CardAction,\n// top-right) → CardContent → CardFooter.\n/** The sub-parts add nothing to a `<div>`'s props — they are the SAME element with a\n * `data-slot` and a padding rhythm — so most names are aliases rather than an empty\n * interface pretending to be more. They exist so a consumer's own wrapper can say\n * `CardHeaderProps` instead of `ComponentProps<typeof CardHeader>`. */\nexport interface CardHeaderProps extends ComponentPropsWithRef<\"div\"> {\n /**\n * Below the `sm` breakpoint, put the {@link CardAction} UNDER the title and\n * description instead of beside them. For an action that is wider than an icon —\n * a \"Set up two-factor\" button, a checkbox and a filter — which, kept in the\n * top-end column on a 390px phone, squeezed the title into a ribbon two words wide\n * (keksdose's settings cards). Off by default at Normal: an icon action (the wizard\n * summary's pencil) is narrow enough to stay beside the title at every width.\n *\n * Unset, it stacks at Large and Extra large only (0.32.1, the 360 px Extra-large\n * sweep; docs/text-size-harmonization.md §4): there an IconButton shows its label as\n * text, so the \"icon\" action is a word-wide pill, and \"Refresh sessions\" beside\n * \"Sessions\" ran 47 px past a 360 px phone. `false` keeps the action beside the title\n * at every size, for an action the caller knows stays narrow (`labelVisible={false}`).\n */\n stackAction?: boolean;\n}\nexport type CardTitleLevel = \"div\" | \"h2\" | \"h3\" | \"h4\";\nexport interface CardTitleProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The element the title is: `\"div\"` (default) or a heading level. Five of keksdose's\n * settings cards nested their own `<h2>` / `<h3>` INSIDE CardTitle to put the card in\n * the page's outline — a heading in a div that looks like a heading. The heading\n * takes the title's look unchanged (the reset leaves `h2`–`h4` at inherited size and\n * weight), so only the outline changes.\n */\n as?: CardTitleLevel;\n /** The title's element — a `div` or the heading `as` names, hence `HTMLElement`. */\n ref?: Ref<HTMLElement>;\n}\nexport type CardDescriptionProps = ComponentPropsWithRef<\"div\">;\nexport type CardActionProps = ComponentPropsWithRef<\"div\">;\nexport type CardContentProps = ComponentPropsWithRef<\"div\">;\nexport type CardFooterProps = ComponentPropsWithRef<\"div\">;\n\n/** {@link CardHeaderProps.stackAction}: one column under `sm`, and the action back into\n * the flow (DOM order, so after the description when it is written after it), at the\n * start edge. The descendant selector outranks CardAction's own placement classes. */\nconst CARD_STACK_ACTION =\n \"max-sm:grid-cols-1 max-sm:[&>[data-slot=card-action]]:col-start-1 max-sm:[&>[data-slot=card-action]]:row-span-1 max-sm:[&>[data-slot=card-action]]:row-start-auto max-sm:[&>[data-slot=card-action]]:justify-self-start\";\n/** The same at Large and Extra large only — `stackAction` unset (see its note). A\n * `large:` class over the scaled `max-sm`, so it costs no render and is right on the\n * first paint. */\nconst CARD_STACK_ACTION_AT_LARGE =\n \"large:max-sm:grid-cols-1 large:max-sm:[&>[data-slot=card-action]]:col-start-1 large:max-sm:[&>[data-slot=card-action]]:row-span-1 large:max-sm:[&>[data-slot=card-action]]:row-start-auto large:max-sm:[&>[data-slot=card-action]]:justify-self-start\";\n\nexport function CardHeader({ className, stackAction, ...props }: CardHeaderProps) {\n const padded = useContext(CardPaddedContext);\n const compact = useContext(CardDensityContext) === \"compact\";\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n // Grid (not flex) so CardAction can occupy a top-right column; with no\n // action it collapses to one column and title/description stack.\n //\n // The two-column switch sets a VARIABLE, not `grid-template-columns`. As\n // `has-data-[slot=card-action]:grid-cols-[1fr_auto]` it was two classes of\n // specificity (the class plus the attribute inside `:has()`), and a caller's\n // `max-sm:grid-cols-1` — one class inside a media query — lost to it at every\n // width, so the action could never be stacked on a phone from outside. Now the\n // property itself is set by a plain one-class utility that any `grid-cols-*`\n // variant of the caller's outranks by coming later in the sheet; the `:has()`\n // rule only picks the value. The base `1fr` resets the variable so a header\n // never inherits an ancestor header's two columns.\n \"grid auto-rows-min items-start gap-1.5 [--card-header-cols:1fr] has-data-[slot=card-action]:[--card-header-cols:1fr_auto] grid-cols-[var(--card-header-cols,1fr)]\",\n padded ? \"px-0 pt-0\" : \"px-6 pt-6\",\n compact && \"gap-0.5\",\n stackAction === true && CARD_STACK_ACTION,\n stackAction === undefined && CARD_STACK_ACTION_AT_LARGE,\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function CardTitle({ className, as: Tag = \"div\", ref, ...props }: CardTitleProps) {\n const compact = useContext(CardDensityContext) === \"compact\";\n return (\n <Tag\n ref={ref as Ref<HTMLDivElement & HTMLHeadingElement>}\n data-slot=\"card-title\"\n // Compact is `leading-snug`, not `leading-none`: there the title sits on a\n // 12px description `gap-0.5` below, and a line box exactly the cap height left\n // the hint hugging the title's descenders (every keksdose admin card added\n // `leading-normal` by hand). Comfortable keeps `leading-none` — its 14px\n // description is `gap-1.5` away and has always read right.\n className={cn(compact ? \"text-sm font-medium leading-snug\" : \"font-semibold leading-none\", className)}\n {...props}\n />\n );\n}\n\nexport function CardDescription({ className, ...props }: CardDescriptionProps) {\n const compact = useContext(CardDensityContext) === \"compact\";\n return (\n <div\n data-slot=\"card-description\"\n // `--text-muted`, the kit's secondary-line colour (StatTile's description, the\n // field captions). It was `--money-neutral`, a MONEY token that happened to be\n // a similar grey — and a palette that re-tunes the money colours moved every\n // card's description with them.\n className={cn(compact ? \"text-xs\" : \"text-sm\", \"text-muted\", className)}\n {...props}\n />\n );\n}\n\nexport function CardAction({ className, ...props }: CardActionProps) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\"col-start-2 row-start-1 row-span-2 self-start justify-self-end\", className)}\n {...props}\n />\n );\n}\n\nexport function CardContent({ className, ...props }: CardContentProps) {\n const padded = useContext(CardPaddedContext);\n // `last:pb-6`, not a plain `pb-6`: CardHeader owns the top padding and CardFooter\n // owns the bottom one, so a card WITHOUT a footer had nothing closing it off and\n // its last field sat flush against the card edge (kastlan feedback: the language\n // input touching the card bottom on /profile). Scoping to `:last-child` fixes that\n // case and leaves a footered card's rhythm exactly as it was. Inside a padded Card\n // the card closes itself off, so there is nothing to add.\n return <div data-slot=\"card-content\" className={cn(!padded && \"px-6 last:pb-6\", className)} {...props} />;\n}\n\nexport function CardFooter({ className, ...props }: CardFooterProps) {\n const padded = useContext(CardPaddedContext);\n return (\n <div data-slot=\"card-footer\" className={cn(\"flex items-center\", !padded && \"px-6 pb-6\", className)} {...props} />\n );\n}\n"],"mappings":";AAgOQ;AAhOR,SAAS,eAAe,kBAAkB;AAE1C,SAAS,UAAU;AA0GnB,MAAM,aAAgF;AAAA,EACpF,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA,QAAQ;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AACF;AAEA,MAAM,eAAkE;AAAA,EACtE,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,IAAI;AACN;AAOA,MAAM,sBAAyE;AAAA,EAC7E,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,IAAI;AACN;AAKA,MAAM,iBAA2C;AAAA,EAC/C,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,SAAS;AACX;AAEA,MAAM,oBAA8C;AAAA,EAClD,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,SAAS;AACX;AAOA,MAAM,oBAAoB,cAAc,KAAK;AAG7C,M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AAC,UAAU,aAAa,SAAS,GAAI,GAAG,OAAO;AAEnH;","names":[]}
@@ -1,11 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { createContext, useContext, useEffect, useRef, useState } from "react";
4
- import {
5
- usePlotArea,
6
- useXAxisInverseScale,
7
- useYAxisInverseScale
8
- } from "recharts";
4
+ import { usePlotArea, useXAxisInverseScale, useYAxisInverseScale } from "recharts";
9
5
  import { X } from "lucide-react";
10
6
  import { cn } from "../lib/cn.js";
11
7
  import { FOCUS_RING } from "./focus-ring.js";
@@ -242,14 +238,7 @@ function ZoomLayer({
242
238
  draggedRef.current = selection !== null;
243
239
  if (selection) onZoom(selection);
244
240
  };
245
- const which = drag ? zoomAxesFor(
246
- drag.toX - drag.fromX,
247
- drag.toY - drag.fromY,
248
- plot.width,
249
- plot.height,
250
- ZOOM_SQUARE_ENOUGH,
251
- only
252
- ) : null;
241
+ const which = drag ? zoomAxesFor(drag.toX - drag.fromX, drag.toY - drag.fromY, plot.width, plot.height, ZOOM_SQUARE_ENOUGH, only) : null;
253
242
  return /* @__PURE__ */ jsxs("g", { children: [
254
243
  axisIds.map((id) => /* @__PURE__ */ jsx(AxisProbe, { axisId: id, scales }, id)),
255
244
  drag && which && /* @__PURE__ */ jsx(
@@ -302,10 +291,7 @@ function ZoomLayer({
302
291
  )
303
292
  ] });
304
293
  }
305
- function AxisProbe({
306
- axisId,
307
- scales
308
- }) {
294
+ function AxisProbe({ axisId, scales }) {
309
295
  const inverse = useYAxisInverseScale(axisId);
310
296
  useEffect(() => {
311
297
  scales.set(axisId, inverse);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/chart-zoom-core.tsx"],"sourcesContent":["// Drag-to-zoom for cartesian charts — the HOC, the shared x window, and the arithmetic.\n// Lifted out of lenkbank, where every plot in the app is one `SeriesChart` and zoom is\n// therefore wired in exactly once.\n//\n// **Which axes a drag zooms is read off the drag itself.** A selection that is roughly\n// square is a box: the reader framed a REGION and means both axes. A long thin one is a\n// band, and its own direction says which: a wide flat drag means \"this stretch of the\n// abscissa\", a tall narrow one \"this range of values\". Asking with a modifier key\n// instead would be asking people to remember a convention for something they have\n// already drawn.\n//\n// Squareness is measured **in fractions of the plot**, not pixels. These charts are\n// three times wider than they are tall, so a pixel-square selection is a very wide\n// slice of the data and would read as a band to anybody looking at it.\n//\n// The zoom is VIEW state and lives here, never in a query or a store: it is where\n// somebody is looking, and a chart whose data reloads should not lose it. It is cleared\n// by the reset button, by a double click, and by nothing else.\n//\n// Everything with a decision in it is a pure exported function below (`zoomAxesFor`,\n// `selectionFromDrag`, `zoomAfter`, `zoomDomains`, `fitYToX`, `fitXToY`); the\n// components are plumbing between a pointer and those.\n//\n// The kit's own module (0.34, refactor audit 2026-10, API-6b): SeriesChart, its axes and\n// the facing pair import from here. ./chart-zoom is the public face — `SharedXZoom`, the\n// types, and until 0.35 the deprecated arithmetic and HOC, which no app imports.\nimport { createContext, useContext, useEffect, useRef, useState } from \"react\";\nimport type { ComponentType, Dispatch, ReactNode, SetStateAction } from \"react\";\nimport {\n usePlotArea,\n useXAxisInverseScale,\n useYAxisInverseScale,\n type InverseScaleFunction,\n} from \"recharts\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { FOCUS_RING } from \"./focus-ring\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { DEFAULT_SERIES_CHART_LABELS, type SeriesChartLabels } from \"./series-chart-labels\";\n\n/** The y axis a series lands on when it names none — the single shared scale most\n * charts have. `SeriesChart` and the fit below agree on it by importing this. */\nexport const DEFAULT_Y_AXIS = \"y\";\n\n/* ── The arithmetic ─────────────────────────────────────────────────────── */\n\n/**\n * How square a selection has to be before it counts as a box: the shorter side\n * against the longer, both as fractions of the plot. At 0.5 a selection twice as wide\n * as it is tall is still a box and one three times as wide is a band.\n */\nexport const ZOOM_SQUARE_ENOUGH = 0.5;\n\n/** Below this a drag is a click that moved, not a selection. In fractions of the plot,\n * so it is the same gesture on a phone and on a wall display. */\nexport const ZOOM_MIN_DRAG = 0.02;\n\nexport type ZoomAxes = \"both\" | \"x\" | \"y\";\n\n/** Which axes a drag zooms — or `null` for a drag too small to mean one, or a plot\n * that has not been laid out yet. Direction does not matter; proportion does. */\nexport function zoomAxesFor(\n dx: number,\n dy: number,\n width: number,\n height: number,\n threshold: number = ZOOM_SQUARE_ENOUGH,\n /** A chart that zooms ONE axis only (see {@link ZoomTarget.zoomAxes}): every drag is\n * a band along it, however it was drawn, and a drag with no extent along it is\n * nothing — a tall narrow drag over a bar chart names no stretch of the abscissa. */\n only?: \"x\" | \"y\",\n): ZoomAxes | null {\n if (!(width > 0) || !(height > 0)) return null;\n const across = Math.abs(dx) / width;\n const down = Math.abs(dy) / height;\n if (only === \"x\") return across < ZOOM_MIN_DRAG ? null : \"x\";\n if (only === \"y\") return down < ZOOM_MIN_DRAG ? null : \"y\";\n if (across < ZOOM_MIN_DRAG && down < ZOOM_MIN_DRAG) return null;\n const longer = Math.max(across, down);\n const shorter = Math.min(across, down);\n if (shorter / longer >= threshold) return \"both\";\n return across > down ? \"x\" : \"y\";\n}\n\n/** What a drag chose, in DATA coordinates, and which axes it actually named — the\n * caller needs the second to know which of the two it may derive from the other. */\nexport interface ZoomSelection {\n which: ZoomAxes;\n x?: [number, number];\n /** One window per y axis, keyed by axis id: they are in different units. */\n y: Record<string, [number, number]>;\n}\n\n/** A drag, in the chart's own pixel coordinates. */\nexport interface ZoomDrag {\n fromX: number;\n fromY: number;\n toX: number;\n toY: number;\n}\n\n/** A pair as a domain, smallest first. Recharts wants an ascending domain whichever\n * way the drag went, and a y axis counts downward in pixels while its values count\n * upward — so both ends are read and sorted rather than one assumed to be low. */\nfunction ordered(a: number, b: number): [number, number] {\n return a <= b ? [a, b] : [b, a];\n}\n\n/**\n * A finished drag as a selection, or `null` when it selects nothing.\n *\n * `xInverse` and `yInverse(axisId)` are recharts' pixel→value functions; an axis whose\n * function is missing, or whose ends come back non-finite, is left out rather than\n * handed a NaN window.\n */\nexport function selectionFromDrag(\n drag: ZoomDrag,\n plot: { width: number; height: number },\n xInverse: InverseScaleFunction | undefined,\n yInverse: (axisId: string) => InverseScaleFunction | undefined,\n axisIds: readonly string[],\n only?: \"x\" | \"y\",\n): ZoomSelection | null {\n const which = zoomAxesFor(\n drag.toX - drag.fromX,\n drag.toY - drag.fromY,\n plot.width,\n plot.height,\n ZOOM_SQUARE_ENOUGH,\n only,\n );\n if (!which) return null;\n const next: ZoomSelection = { which, y: {} };\n if (which !== \"y\" && xInverse) {\n const from = Number(xInverse(drag.fromX));\n const to = Number(xInverse(drag.toX));\n if (Number.isFinite(from) && Number.isFinite(to)) next.x = ordered(from, to);\n }\n if (which !== \"x\") {\n for (const id of axisIds) {\n const inverse = yInverse(id);\n if (!inverse) continue;\n const from = Number(inverse(drag.fromY));\n const to = Number(inverse(drag.toY));\n if (Number.isFinite(from) && Number.isFinite(to)) next.y[id] = ordered(from, to);\n }\n }\n return next.x || Object.keys(next.y).length ? next : null;\n}\n\n/** One row of a zoomable chart. Loose on purpose: a row also carries what the chart\n * does not plot — keksdose's `rawPeriod` for a drilldown, a label for a category axis —\n * and only the finite NUMBERS in it are ever read as samples. */\nexport type ZoomRow = Readonly<Record<string, unknown>>;\n\n/** A series as the fit sees it. `stack` groups bars/areas drawn on top of each other\n * (recharts' `stackId`), whose extent is their SUM, not any one of them. */\nexport interface ZoomFitSeries {\n key: string;\n axis?: string;\n stack?: string;\n /** Only `\"line\"` matters here: recharts cannot stack a line, so a line's `stack` is\n * ignored rather than summed into a height nothing on the chart reaches. */\n type?: string;\n}\n\n/** What a band refit needs to know about the chart — a subset of `SeriesChart`'s own\n * props, so a chart hands its data straight over. */\nexport interface ZoomFitSource {\n rows: readonly ZoomRow[];\n series: readonly ZoomFitSeries[];\n axes: readonly { id: string }[];\n xKey: string;\n}\n\n/** How much of a refitted span to leave as air, top and bottom. Without it the\n * highest sample sits exactly on the frame, where a line is half drawn and reads as\n * clipped rather than as the maximum. */\nconst FIT_AIR = 0.05;\n\n/** A span with air around it — and a real span for a flat channel, which would\n * otherwise be a zero-height window recharts cannot scale. */\nfunction airy(low: number, high: number): [number, number] {\n const span = high - low;\n const air = span > 0 ? span * FIT_AIR : Math.max(Math.abs(high), 1) * FIT_AIR;\n return [low - air, high + air];\n}\n\n/** A running low/high pair. A pair rather than an array to take `Math.min(...)` of:\n * the spread passes one argument per sample, and V8 faults past ~125,000 of them. */\ntype Span = [number, number] | undefined;\n\n/** A pair widened by one value. A non-finite one is not a value — one NaN would\n * otherwise take the whole window with it. */\nfunction widen(span: Span, value: unknown): Span {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return span;\n if (!span) return [value, value];\n if (value < span[0]) span[0] = value;\n else if (value > span[1]) span[1] = value;\n return span;\n}\n\n/** Which series are measured on an axis. */\nfunction keysOn(source: ZoomFitSource, axisId: string): string[] {\n return source.series\n .filter((entry) => (entry.axis ?? DEFAULT_Y_AXIS) === axisId)\n .map((entry) => entry.key);\n}\n\n/** A row's value as a sample, or 0 for a stack's missing layer — a stacked bar with no\n * value for one series draws the rest of the stack from where that one would end. */\nconst layer = (value: unknown) => (typeof value === \"number\" && Number.isFinite(value) ? value : 0);\n\n/**\n * The lowest and highest value an axis DRAWS over the rows whose abscissa is inside\n * `window` (every row when there is none) — `undefined` when it draws nothing finite.\n *\n * Stack-aware, and that is why it exists: a stack of three bars reaches the SUM of\n * them, and fitting the axis to the tallest single layer (what fitting on values did)\n * cuts the top two thirds of every stack off. Positive and negative layers are summed\n * apart, as recharts draws them under `stackOffset=\"sign\"` — a month with 900 income\n * and −300 expense stacks up to 900 and down to −300, not to 600. A stacked extent\n * therefore always contains the zero its layers stand on.\n *\n * `SeriesChart` fits its axes with this and the zoom refits them with it, so the two\n * cannot disagree about how tall a stack is.\n */\nexport function axisExtent(\n source: ZoomFitSource,\n axisId: string,\n window?: readonly [number, number],\n): [number, number] | undefined {\n const mine = source.series.filter((entry) => (entry.axis ?? DEFAULT_Y_AXIS) === axisId);\n const loose: string[] = [];\n const stacks = new Map<string, string[]>();\n for (const entry of mine) {\n if (entry.stack === undefined || entry.type === \"line\" || entry.type === undefined) {\n loose.push(entry.key);\n } else {\n stacks.set(entry.stack, [...(stacks.get(entry.stack) ?? []), entry.key]);\n }\n }\n let span: Span;\n for (const row of source.rows) {\n if (window) {\n const at = row[source.xKey];\n if (typeof at !== \"number\" || !(at >= window[0] && at <= window[1])) continue;\n }\n for (const key of loose) span = widen(span, row[key]);\n for (const keys of stacks.values()) {\n let up = 0;\n let down = 0;\n let any = false;\n for (const key of keys) {\n const value = layer(row[key]);\n any ||= typeof row[key] === \"number\" && Number.isFinite(row[key]);\n if (value >= 0) up += value;\n else down += value;\n }\n if (!any) continue;\n span = widen(widen(span, down), up);\n }\n }\n return span;\n}\n\n/**\n * Each y axis fitted to the samples inside an x window — what a band across x leaves\n * the axes nobody dragged showing. Zoom into a tenth of a sweep and a y axis still\n * scaled to the whole run draws that tenth as a flat line, which is the one thing the\n * zoom was for; so the unnamed axes are refitted, which is what \"zoom\" means everywhere\n * else.\n *\n * An axis with nothing inside the window is left OUT rather than collapsed: a window\n * between two samples is one where the chart should keep drawing the line across.\n */\nexport function fitYToX(\n source: ZoomFitSource,\n window: readonly [number, number],\n): Record<string, [number, number]> {\n const fitted: Record<string, [number, number]> = {};\n for (const axis of source.axes) {\n const span = axisExtent(source, axis.id, window);\n if (span) fitted[axis.id] = airy(span[0], span[1]);\n }\n return fitted;\n}\n\n/**\n * The x window that holds every sample inside a set of y windows — the other direction\n * of the same idea. A channel crossing its band once gives a tight window; one that\n * oscillates through it gives back most of the sweep, which is the truthful answer.\n * `undefined` when no sample qualifies, rather than a guess.\n */\nexport function fitXToY(\n source: ZoomFitSource,\n windows: Readonly<Record<string, readonly [number, number]>>,\n): [number, number] | undefined {\n let hits: Span;\n for (const [axisId, [low, high]] of Object.entries(windows)) {\n for (const key of keysOn(source, axisId)) {\n for (const row of source.rows) {\n const value = row[key];\n if (typeof value === \"number\" && Number.isFinite(value) && value >= low && value <= high) {\n hits = widen(hits, row[source.xKey]);\n }\n }\n }\n }\n return hits ? airy(hits[0], hits[1]) : undefined;\n}\n\n/**\n * What a chart remembers about its zoom: the x window, and the y windows the reader\n * DRAGGED. `y: null` means \"derive y from x\" — the split is the whole design: what was\n * dragged is kept, and what follows from it is recomputed on every render, so a band\n * across x refits y here and in every chart sharing the window.\n */\nexport interface ZoomState {\n x?: [number, number];\n y: Record<string, [number, number]> | null;\n}\n\nexport const NO_ZOOM: ZoomState = { x: undefined, y: null };\n\n/**\n * The state after a selection. Two band drags COMPOSE rather than the second undoing\n * the first: a band down y keeps the x window when the band holds no samples, and\n * otherwise pulls x in to where they are.\n */\nexport function zoomAfter(\n state: ZoomState,\n selection: ZoomSelection,\n source: ZoomFitSource,\n): ZoomState {\n if (selection.which === \"both\") return { x: selection.x, y: selection.y };\n // Leave y derived, so it fits itself to what is inside the new window.\n if (selection.which === \"x\") return { x: selection.x, y: null };\n return { x: fitXToY(source, selection.y) ?? state.x, y: selection.y };\n}\n\n/** The domains a chart draws for a state: the x window as is, and each y axis either\n * as dragged or fitted to the x window. `{}` means \"fit your own data\". */\nexport function zoomDomains(\n state: ZoomState,\n source: ZoomFitSource,\n): { xDomain?: [number, number]; yDomains: Record<string, [number, number]> } {\n return {\n xDomain: state.x,\n yDomains: state.y ?? (state.x ? fitYToX(source, state.x) : {}),\n };\n}\n\n/* ── The components ─────────────────────────────────────────────────────── */\n\n/** What the wrapped chart is handed. It applies the domains to its own axes and renders\n * `layer` INSIDE the recharts chart, where recharts' hooks answer. */\nexport interface ZoomBinding {\n xDomain?: [number, number];\n yDomains: Record<string, [number, number]>;\n layer: ReactNode;\n}\n\n/**\n * Which axes a chart lets a drag zoom. `\"none\"` draws no drag layer and no reset.\n * A drag on a one-axis chart is always a band along that axis (see {@link zoomAxesFor}).\n */\nexport type ZoomAxesSetting = ZoomAxes | \"none\";\n\n/**\n * The zoom a chart gets when it does not say, read off what its series ARE.\n *\n * - Only lines: `\"both\"` — lenkbank's measurement plots, unchanged.\n * - Any area: `\"x\"`. An area's height is a length from zero, and a y window that cuts\n * the baseline off draws a band of 40 as three times one of 20 — so its y axis refits\n * to the x window (still from zero), and a drag never names a y range.\n * - Any bar: `\"none\"`. A bar chart is a handful of periods read one bar at a time, and\n * in keksdose every one of them is CLICKED — to drill into a payee, a month, a budget\n * line — which a drag layer over the plot would swallow. A chart of many bars opts\n * back in with `zoomAxes: \"x\"`; a click then reports the period, not the bar.\n */\nexport function defaultZoomAxes(series: readonly { type?: string }[] | undefined): ZoomAxesSetting {\n if (series?.some((entry) => entry.type === \"bar\")) return \"none\";\n if (series?.some((entry) => entry.type === \"area\")) return \"x\";\n return \"both\";\n}\n\n/** The props `withChartZoom` reads off the chart it wraps. */\nexport interface ZoomTarget {\n /** Default: the single axis {@link DEFAULT_Y_AXIS}. */\n axes?: readonly { id: string; hide?: boolean }[];\n /** The chart's own data, so a band can refit the axis it did not name. Optional: a\n * chart with nothing plotted has nothing to fit to. */\n rows?: readonly ZoomRow[];\n series?: readonly ZoomFitSeries[];\n x?: { key?: string };\n zoom?: ZoomBinding;\n labels?: LabelOverride<SeriesChartLabels>;\n /** Which axes a drag may zoom. Default: {@link defaultZoomAxes} of `series`. */\n zoomAxes?: ZoomAxesSetting;\n}\n\nconst SharedX = createContext<{\n window?: [number, number];\n set: Dispatch<SetStateAction<[number, number] | undefined>>;\n} | null>(null);\n\n/**\n * One x window for several charts.\n *\n * A column of charts over one abscissa is one picture, and zooming one of them and not\n * the rest turns it into several pictures of different things. Every zoomable chart\n * inside this shares the x window: any drag in any of them moves all of them.\n *\n * **Only x.** The y axes stay each chart's own — they are in different units — and\n * each refits its own y to what is inside the shared window.\n */\nexport function SharedXZoom({ children }: { children: ReactNode }) {\n const [window, set] = useState<[number, number] | undefined>(undefined);\n return <SharedX.Provider value={{ window, set }}>{children}</SharedX.Provider>;\n}\n\n/**\n * Wrap a chart in drag-to-zoom.\n *\n * The chart receives a `zoom` binding: it applies `xDomain`/`yDomains` to its axes\n * (with `allowDataOverflow`, so recharts clips to the window instead of widening it\n * back out) and renders `layer` as a child of its recharts chart. A reset button\n * appears over the chart's top end corner while it is zoomed — a real button, so the\n * keyboard can undo what the pointer did.\n */\nexport function withChartZoom<P extends ZoomTarget>(Chart: ComponentType<P>) {\n function Zoomable(props: P) {\n const labels = useKitLabels(\"seriesChart\", DEFAULT_SERIES_CHART_LABELS, props.labels);\n const group = useContext(SharedX);\n const [ownX, setOwnX] = useState<[number, number] | undefined>(undefined);\n const [ownY, setOwnY] = useState<Record<string, [number, number]> | null>(null);\n const xWindow = group ? group.window : ownX;\n const setXWindow = group ? group.set : setOwnX;\n const axes = props.axes ?? [{ id: DEFAULT_Y_AXIS }];\n const setting = props.zoomAxes ?? defaultZoomAxes(props.series);\n const only = setting === \"x\" || setting === \"y\" ? setting : undefined;\n\n // Every axis, hidden ones included: a hidden axis still scales its lines, and a\n // line whose axis did not refit is drawn as a flat streak inside the window.\n const source: ZoomFitSource = {\n rows: props.rows ?? [],\n series: [...(props.series ?? [])],\n axes: [...axes],\n xKey: props.x?.key ?? \"x\",\n };\n const state: ZoomState = { x: xWindow, y: ownY };\n const zoomed = xWindow !== undefined || ownY !== null;\n // A chart handed no rows or no series draws its empty state, not a plot — and a\n // \"Reset zoom\" floating over \"No data\" (every line toggled off while zoomed) offers\n // to undo something the reader cannot see. The zoom itself is KEPT: it is where they\n // were looking, and it applies again the moment a line comes back. Only an array\n // that is there and empty counts; a chart that does not pass its data is not known\n // to be empty.\n const empty = props.rows?.length === 0 || props.series?.length === 0;\n\n const clear = () => {\n setXWindow(undefined);\n setOwnY(null);\n };\n\n // Switched off, the chart still gets a binding — with no window and no layer — so a\n // chart whose series change type mid-life is not remounted by a different tree.\n if (setting === \"none\") {\n return (\n <div className=\"relative\">\n <Chart {...props} zoom={{ yDomains: {}, layer: null }} />\n </div>\n );\n }\n\n const binding: ZoomBinding = {\n ...zoomDomains(state, source),\n layer: (\n <ZoomLayer\n axisIds={axes.map((axis) => axis.id)}\n only={only}\n label={labels.zoomHint}\n onZoom={(selection) => {\n const next = zoomAfter(state, selection, source);\n if (next.x !== xWindow) setXWindow(next.x);\n setOwnY(next.y);\n }}\n onReset={clear}\n />\n ),\n };\n\n return (\n <div className=\"relative\">\n <Chart {...props} zoom={binding} />\n {zoomed && !empty && (\n <button\n type=\"button\"\n onClick={clear}\n className={cn(\n \"absolute end-1 top-1 z-10 inline-flex items-center gap-1 rounded border border-subtle bg-surface/90 px-1.5 py-0.5 text-micro text-muted backdrop-blur transition-colors hover:text-primary\",\n FOCUS_RING,\n )}\n >\n <X aria-hidden className=\"size-3\" /> {labels.resetZoom}\n </button>\n )}\n </div>\n );\n }\n Zoomable.displayName = `withChartZoom(${Chart.displayName ?? Chart.name ?? \"Chart\"})`;\n return Zoomable;\n}\n\n/**\n * The part that lives INSIDE the recharts chart, where recharts will say where the plot\n * is and what value a pixel is.\n *\n * A transparent rectangle over the plot area that reads the drag. It does NOT stop the\n * event: recharts drives its tooltip from the same pointer move bubbling up to its own\n * wrapper, so swallowing it here would trade the tooltip for the zoom.\n */\nfunction ZoomLayer({\n axisIds,\n only,\n label,\n onZoom,\n onReset,\n}: {\n axisIds: string[];\n only?: \"x\" | \"y\";\n label: string;\n onZoom: (selection: ZoomSelection) => void;\n onReset: () => void;\n}) {\n const plot = usePlotArea();\n const xInverse = useXAxisInverseScale();\n // One probe COMPONENT per axis rather than a hook in a loop: the number of axes\n // changes as series are toggled, and a hook count that changes with the data is the\n // one thing React will not forgive.\n const [scales] = useState(() => new Map<string, InverseScaleFunction | undefined>());\n const [drag, setDrag] = useState<ZoomDrag | null>(null);\n // A finished drag is followed by a click on the same element, and a chart with an\n // `onClick` (keksdose opens a drilldown on one) would read the zoom as a pick.\n const draggedRef = useRef(false);\n\n if (!plot || plot.width <= 0 || plot.height <= 0) return null;\n\n const at = (event: { clientX: number; clientY: number; currentTarget: Element }) => {\n // Against the overlay's own screen box, so padding around the container cannot\n // shift every reading — plus the plot's offset, because the scales are in the\n // chart's coordinates rather than the plot's.\n const box = event.currentTarget.getBoundingClientRect();\n return { x: event.clientX - box.left + plot.x, y: event.clientY - box.top + plot.y };\n };\n\n const finish = () => {\n if (!drag) return;\n setDrag(null);\n const selection = selectionFromDrag(drag, plot, xInverse, (id) => scales.get(id), axisIds, only);\n draggedRef.current = selection !== null;\n if (selection) onZoom(selection);\n };\n\n // What the drag would do, shown while it is being made: a band paints the full width\n // or height, so the reader sees it is about to let the other axis refit.\n const which = drag\n ? zoomAxesFor(\n drag.toX - drag.fromX,\n drag.toY - drag.fromY,\n plot.width,\n plot.height,\n ZOOM_SQUARE_ENOUGH,\n only,\n )\n : null;\n\n return (\n <g>\n {axisIds.map((id) => (\n <AxisProbe key={id} axisId={id} scales={scales} />\n ))}\n {drag && which && (\n <rect\n x={which === \"y\" ? plot.x : Math.min(drag.fromX, drag.toX)}\n y={which === \"x\" ? plot.y : Math.min(drag.fromY, drag.toY)}\n width={which === \"y\" ? plot.width : Math.abs(drag.toX - drag.fromX)}\n height={which === \"x\" ? plot.height : Math.abs(drag.toY - drag.fromY)}\n className=\"fill-[var(--brand)]/15 stroke-[var(--brand)]\"\n strokeDasharray=\"4 3\"\n pointerEvents=\"none\"\n />\n )}\n <rect\n x={plot.x}\n y={plot.y}\n width={plot.width}\n height={plot.height}\n // `transparent`, not `none`: an unpainted shape takes no pointer events.\n fill=\"transparent\"\n role=\"application\"\n aria-label={label}\n style={{ cursor: \"crosshair\" }}\n onPointerDown={(event) => {\n if (event.button !== 0) return;\n draggedRef.current = false;\n const point = at(event);\n // Best effort: capture keeps a drag alive past the plot's edge, but a\n // pointer id the environment does not know throws — jsdom refuses them all —\n // and a zoom that threw on pointer-down would be a chart nobody could click.\n try {\n event.currentTarget.setPointerCapture(event.pointerId);\n } catch {\n /* the drag still works; it just stops at the edge of the plot */\n }\n setDrag({ fromX: point.x, fromY: point.y, toX: point.x, toY: point.y });\n }}\n onPointerMove={(event) => {\n if (!drag) return;\n const point = at(event);\n setDrag({ ...drag, toX: point.x, toY: point.y });\n }}\n onPointerUp={finish}\n onPointerCancel={() => setDrag(null)}\n onClick={(event) => {\n if (!draggedRef.current) return;\n draggedRef.current = false;\n event.stopPropagation();\n }}\n onDoubleClick={onReset}\n />\n </g>\n );\n}\n\n/** One axis's pixel→value function, parked where the pointer handler can reach it. */\nfunction AxisProbe({\n axisId,\n scales,\n}: {\n axisId: string;\n scales: Map<string, InverseScaleFunction | undefined>;\n}) {\n const inverse = useYAxisInverseScale(axisId);\n useEffect(() => {\n scales.set(axisId, inverse);\n return () => {\n scales.delete(axisId);\n };\n }, [axisId, inverse, scales]);\n return null;\n}\n"],"mappings":";AAmaS,cA8EC,YA9ED;AAzYT,SAAS,eAAe,YAAY,WAAW,QAAQ,gBAAgB;AAEvE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,SAAS;AAClB,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,oBAAwC;AACjD,SAAS,mCAA2D;AAI7D,MAAM,iBAAiB;AASvB,MAAM,qBAAqB;AAI3B,MAAM,gBAAgB;AAMtB,SAAS,YACd,IACA,IACA,OACA,QACA,YAAoB,oBAIpB,MACiB;AACjB,MAAI,EAAE,QAAQ,MAAM,EAAE,SAAS,GAAI,QAAO;AAC1C,QAAM,SAAS,KAAK,IAAI,EAAE,IAAI;AAC9B,QAAM,OAAO,KAAK,IAAI,EAAE,IAAI;AAC5B,MAAI,SAAS,IAAK,QAAO,SAAS,gBAAgB,OAAO;AACzD,MAAI,SAAS,IAAK,QAAO,OAAO,gBAAgB,OAAO;AACvD,MAAI,SAAS,iBAAiB,OAAO,cAAe,QAAO;AAC3D,QAAM,SAAS,KAAK,IAAI,QAAQ,IAAI;AACpC,QAAM,UAAU,KAAK,IAAI,QAAQ,IAAI;AACrC,MAAI,UAAU,UAAU,UAAW,QAAO;AAC1C,SAAO,SAAS,OA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ACF;AAEJ;AAGA,SAAS,UAAU;AAAA,EACjB;AAAA,EACA;AACF,GAGG;AACD,QAAM,UAAU,qBAAqB,MAAM;AAC3C,YAAU,MAAM;AACd,WAAO,IAAI,QAAQ,OAAO;AAC1B,WAAO,MAAM;AACX,aAAO,OAAO,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,QAAQ,SAAS,MAAM,CAAC;AAC5B,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/components/chart-zoom-core.tsx"],"sourcesContent":["// Drag-to-zoom for cartesian charts — the HOC, the shared x window, and the arithmetic.\n// Lifted out of lenkbank, where every plot in the app is one `SeriesChart` and zoom is\n// therefore wired in exactly once.\n//\n// **Which axes a drag zooms is read off the drag itself.** A selection that is roughly\n// square is a box: the reader framed a REGION and means both axes. A long thin one is a\n// band, and its own direction says which: a wide flat drag means \"this stretch of the\n// abscissa\", a tall narrow one \"this range of values\". Asking with a modifier key\n// instead would be asking people to remember a convention for something they have\n// already drawn.\n//\n// Squareness is measured **in fractions of the plot**, not pixels. These charts are\n// three times wider than they are tall, so a pixel-square selection is a very wide\n// slice of the data and would read as a band to anybody looking at it.\n//\n// The zoom is VIEW state and lives here, never in a query or a store: it is where\n// somebody is looking, and a chart whose data reloads should not lose it. It is cleared\n// by the reset button, by a double click, and by nothing else.\n//\n// Everything with a decision in it is a pure exported function below (`zoomAxesFor`,\n// `selectionFromDrag`, `zoomAfter`, `zoomDomains`, `fitYToX`, `fitXToY`); the\n// components are plumbing between a pointer and those.\n//\n// The kit's own module (0.34, refactor audit 2026-10, API-6b): SeriesChart, its axes and\n// the facing pair import from here. ./chart-zoom is the public face — `SharedXZoom`, the\n// types, and until 0.35 the deprecated arithmetic and HOC, which no app imports.\nimport { createContext, useContext, useEffect, useRef, useState } from \"react\";\nimport type { ComponentType, Dispatch, ReactNode, SetStateAction } from \"react\";\nimport { usePlotArea, useXAxisInverseScale, useYAxisInverseScale, type InverseScaleFunction } from \"recharts\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { FOCUS_RING } from \"./focus-ring\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { DEFAULT_SERIES_CHART_LABELS, type SeriesChartLabels } from \"./series-chart-labels\";\n\n/** The y axis a series lands on when it names none — the single shared scale most\n * charts have. `SeriesChart` and the fit below agree on it by importing this. */\nexport const DEFAULT_Y_AXIS = \"y\";\n\n/* ── The arithmetic ─────────────────────────────────────────────────────── */\n\n/**\n * How square a selection has to be before it counts as a box: the shorter side\n * against the longer, both as fractions of the plot. At 0.5 a selection twice as wide\n * as it is tall is still a box and one three times as wide is a band.\n */\nexport const ZOOM_SQUARE_ENOUGH = 0.5;\n\n/** Below this a drag is a click that moved, not a selection. In fractions of the plot,\n * so it is the same gesture on a phone and on a wall display. */\nexport const ZOOM_MIN_DRAG = 0.02;\n\nexport type ZoomAxes = \"both\" | \"x\" | \"y\";\n\n/** Which axes a drag zooms — or `null` for a drag too small to mean one, or a plot\n * that has not been laid out yet. Direction does not matter; proportion does. */\nexport function zoomAxesFor(\n dx: number,\n dy: number,\n width: number,\n height: number,\n threshold: number = ZOOM_SQUARE_ENOUGH,\n /** A chart that zooms ONE axis only (see {@link ZoomTarget.zoomAxes}): every drag is\n * a band along it, however it was drawn, and a drag with no extent along it is\n * nothing — a tall narrow drag over a bar chart names no stretch of the abscissa. */\n only?: \"x\" | \"y\",\n): ZoomAxes | null {\n if (!(width > 0) || !(height > 0)) return null;\n const across = Math.abs(dx) / width;\n const down = Math.abs(dy) / height;\n if (only === \"x\") return across < ZOOM_MIN_DRAG ? null : \"x\";\n if (only === \"y\") return down < ZOOM_MIN_DRAG ? null : \"y\";\n if (across < ZOOM_MIN_DRAG && down < ZOOM_MIN_DRAG) return null;\n const longer = Math.max(across, down);\n const shorter = Math.min(across, down);\n if (shorter / longer >= threshold) return \"both\";\n return across > down ? \"x\" : \"y\";\n}\n\n/** What a drag chose, in DATA coordinates, and which axes it actually named — the\n * caller needs the second to know which of the two it may derive from the other. */\nexport interface ZoomSelection {\n which: ZoomAxes;\n x?: [number, number];\n /** One window per y axis, keyed by axis id: they are in different units. */\n y: Record<string, [number, number]>;\n}\n\n/** A drag, in the chart's own pixel coordinates. */\nexport interface ZoomDrag {\n fromX: number;\n fromY: number;\n toX: number;\n toY: number;\n}\n\n/** A pair as a domain, smallest first. Recharts wants an ascending domain whichever\n * way the drag went, and a y axis counts downward in pixels while its values count\n * upward — so both ends are read and sorted rather than one assumed to be low. */\nfunction ordered(a: number, b: number): [number, number] {\n return a <= b ? [a, b] : [b, a];\n}\n\n/**\n * A finished drag as a selection, or `null` when it selects nothing.\n *\n * `xInverse` and `yInverse(axisId)` are recharts' pixel→value functions; an axis whose\n * function is missing, or whose ends come back non-finite, is left out rather than\n * handed a NaN window.\n */\nexport function selectionFromDrag(\n drag: ZoomDrag,\n plot: { width: number; height: number },\n xInverse: InverseScaleFunction | undefined,\n yInverse: (axisId: string) => InverseScaleFunction | undefined,\n axisIds: readonly string[],\n only?: \"x\" | \"y\",\n): ZoomSelection | null {\n const which = zoomAxesFor(\n drag.toX - drag.fromX,\n drag.toY - drag.fromY,\n plot.width,\n plot.height,\n ZOOM_SQUARE_ENOUGH,\n only,\n );\n if (!which) return null;\n const next: ZoomSelection = { which, y: {} };\n if (which !== \"y\" && xInverse) {\n const from = Number(xInverse(drag.fromX));\n const to = Number(xInverse(drag.toX));\n if (Number.isFinite(from) && Number.isFinite(to)) next.x = ordered(from, to);\n }\n if (which !== \"x\") {\n for (const id of axisIds) {\n const inverse = yInverse(id);\n if (!inverse) continue;\n const from = Number(inverse(drag.fromY));\n const to = Number(inverse(drag.toY));\n if (Number.isFinite(from) && Number.isFinite(to)) next.y[id] = ordered(from, to);\n }\n }\n return next.x || Object.keys(next.y).length ? next : null;\n}\n\n/** One row of a zoomable chart. Loose on purpose: a row also carries what the chart\n * does not plot — keksdose's `rawPeriod` for a drilldown, a label for a category axis —\n * and only the finite NUMBERS in it are ever read as samples. */\nexport type ZoomRow = Readonly<Record<string, unknown>>;\n\n/** A series as the fit sees it. `stack` groups bars/areas drawn on top of each other\n * (recharts' `stackId`), whose extent is their SUM, not any one of them. */\nexport interface ZoomFitSeries {\n key: string;\n axis?: string;\n stack?: string;\n /** Only `\"line\"` matters here: recharts cannot stack a line, so a line's `stack` is\n * ignored rather than summed into a height nothing on the chart reaches. */\n type?: string;\n}\n\n/** What a band refit needs to know about the chart — a subset of `SeriesChart`'s own\n * props, so a chart hands its data straight over. */\nexport interface ZoomFitSource {\n rows: readonly ZoomRow[];\n series: readonly ZoomFitSeries[];\n axes: readonly { id: string }[];\n xKey: string;\n}\n\n/** How much of a refitted span to leave as air, top and bottom. Without it the\n * highest sample sits exactly on the frame, where a line is half drawn and reads as\n * clipped rather than as the maximum. */\nconst FIT_AIR = 0.05;\n\n/** A span with air around it — and a real span for a flat channel, which would\n * otherwise be a zero-height window recharts cannot scale. */\nfunction airy(low: number, high: number): [number, number] {\n const span = high - low;\n const air = span > 0 ? span * FIT_AIR : Math.max(Math.abs(high), 1) * FIT_AIR;\n return [low - air, high + air];\n}\n\n/** A running low/high pair. A pair rather than an array to take `Math.min(...)` of:\n * the spread passes one argument per sample, and V8 faults past ~125,000 of them. */\ntype Span = [number, number] | undefined;\n\n/** A pair widened by one value. A non-finite one is not a value — one NaN would\n * otherwise take the whole window with it. */\nfunction widen(span: Span, value: unknown): Span {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return span;\n if (!span) return [value, value];\n if (value < span[0]) span[0] = value;\n else if (value > span[1]) span[1] = value;\n return span;\n}\n\n/** Which series are measured on an axis. */\nfunction keysOn(source: ZoomFitSource, axisId: string): string[] {\n return source.series.filter((entry) => (entry.axis ?? DEFAULT_Y_AXIS) === axisId).map((entry) => entry.key);\n}\n\n/** A row's value as a sample, or 0 for a stack's missing layer — a stacked bar with no\n * value for one series draws the rest of the stack from where that one would end. */\nconst layer = (value: unknown) => (typeof value === \"number\" && Number.isFinite(value) ? value : 0);\n\n/**\n * The lowest and highest value an axis DRAWS over the rows whose abscissa is inside\n * `window` (every row when there is none) — `undefined` when it draws nothing finite.\n *\n * Stack-aware, and that is why it exists: a stack of three bars reaches the SUM of\n * them, and fitting the axis to the tallest single layer (what fitting on values did)\n * cuts the top two thirds of every stack off. Positive and negative layers are summed\n * apart, as recharts draws them under `stackOffset=\"sign\"` — a month with 900 income\n * and −300 expense stacks up to 900 and down to −300, not to 600. A stacked extent\n * therefore always contains the zero its layers stand on.\n *\n * `SeriesChart` fits its axes with this and the zoom refits them with it, so the two\n * cannot disagree about how tall a stack is.\n */\nexport function axisExtent(\n source: ZoomFitSource,\n axisId: string,\n window?: readonly [number, number],\n): [number, number] | undefined {\n const mine = source.series.filter((entry) => (entry.axis ?? DEFAULT_Y_AXIS) === axisId);\n const loose: string[] = [];\n const stacks = new Map<string, string[]>();\n for (const entry of mine) {\n if (entry.stack === undefined || entry.type === \"line\" || entry.type === undefined) {\n loose.push(entry.key);\n } else {\n stacks.set(entry.stack, [...(stacks.get(entry.stack) ?? []), entry.key]);\n }\n }\n let span: Span;\n for (const row of source.rows) {\n if (window) {\n const at = row[source.xKey];\n if (typeof at !== \"number\" || !(at >= window[0] && at <= window[1])) continue;\n }\n for (const key of loose) span = widen(span, row[key]);\n for (const keys of stacks.values()) {\n let up = 0;\n let down = 0;\n let any = false;\n for (const key of keys) {\n const value = layer(row[key]);\n any ||= typeof row[key] === \"number\" && Number.isFinite(row[key]);\n if (value >= 0) up += value;\n else down += value;\n }\n if (!any) continue;\n span = widen(widen(span, down), up);\n }\n }\n return span;\n}\n\n/**\n * Each y axis fitted to the samples inside an x window — what a band across x leaves\n * the axes nobody dragged showing. Zoom into a tenth of a sweep and a y axis still\n * scaled to the whole run draws that tenth as a flat line, which is the one thing the\n * zoom was for; so the unnamed axes are refitted, which is what \"zoom\" means everywhere\n * else.\n *\n * An axis with nothing inside the window is left OUT rather than collapsed: a window\n * between two samples is one where the chart should keep drawing the line across.\n */\nexport function fitYToX(source: ZoomFitSource, window: readonly [number, number]): Record<string, [number, number]> {\n const fitted: Record<string, [number, number]> = {};\n for (const axis of source.axes) {\n const span = axisExtent(source, axis.id, window);\n if (span) fitted[axis.id] = airy(span[0], span[1]);\n }\n return fitted;\n}\n\n/**\n * The x window that holds every sample inside a set of y windows — the other direction\n * of the same idea. A channel crossing its band once gives a tight window; one that\n * oscillates through it gives back most of the sweep, which is the truthful answer.\n * `undefined` when no sample qualifies, rather than a guess.\n */\nexport function fitXToY(\n source: ZoomFitSource,\n windows: Readonly<Record<string, readonly [number, number]>>,\n): [number, number] | undefined {\n let hits: Span;\n for (const [axisId, [low, high]] of Object.entries(windows)) {\n for (const key of keysOn(source, axisId)) {\n for (const row of source.rows) {\n const value = row[key];\n if (typeof value === \"number\" && Number.isFinite(value) && value >= low && value <= high) {\n hits = widen(hits, row[source.xKey]);\n }\n }\n }\n }\n return hits ? airy(hits[0], hits[1]) : undefined;\n}\n\n/**\n * What a chart remembers about its zoom: the x window, and the y windows the reader\n * DRAGGED. `y: null` means \"derive y from x\" — the split is the whole design: what was\n * dragged is kept, and what follows from it is recomputed on every render, so a band\n * across x refits y here and in every chart sharing the window.\n */\nexport interface ZoomState {\n x?: [number, number];\n y: Record<string, [number, number]> | null;\n}\n\nexport const NO_ZOOM: ZoomState = { x: undefined, y: null };\n\n/**\n * The state after a selection. Two band drags COMPOSE rather than the second undoing\n * the first: a band down y keeps the x window when the band holds no samples, and\n * otherwise pulls x in to where they are.\n */\nexport function zoomAfter(state: ZoomState, selection: ZoomSelection, source: ZoomFitSource): ZoomState {\n if (selection.which === \"both\") return { x: selection.x, y: selection.y };\n // Leave y derived, so it fits itself to what is inside the new window.\n if (selection.which === \"x\") return { x: selection.x, y: null };\n return { x: fitXToY(source, selection.y) ?? state.x, y: selection.y };\n}\n\n/** The domains a chart draws for a state: the x window as is, and each y axis either\n * as dragged or fitted to the x window. `{}` means \"fit your own data\". */\nexport function zoomDomains(\n state: ZoomState,\n source: ZoomFitSource,\n): { xDomain?: [number, number]; yDomains: Record<string, [number, number]> } {\n return {\n xDomain: state.x,\n yDomains: state.y ?? (state.x ? fitYToX(source, state.x) : {}),\n };\n}\n\n/* ── The components ─────────────────────────────────────────────────────── */\n\n/** What the wrapped chart is handed. It applies the domains to its own axes and renders\n * `layer` INSIDE the recharts chart, where recharts' hooks answer. */\nexport interface ZoomBinding {\n xDomain?: [number, number];\n yDomains: Record<string, [number, number]>;\n layer: ReactNode;\n}\n\n/**\n * Which axes a chart lets a drag zoom. `\"none\"` draws no drag layer and no reset.\n * A drag on a one-axis chart is always a band along that axis (see {@link zoomAxesFor}).\n */\nexport type ZoomAxesSetting = ZoomAxes | \"none\";\n\n/**\n * The zoom a chart gets when it does not say, read off what its series ARE.\n *\n * - Only lines: `\"both\"` — lenkbank's measurement plots, unchanged.\n * - Any area: `\"x\"`. An area's height is a length from zero, and a y window that cuts\n * the baseline off draws a band of 40 as three times one of 20 — so its y axis refits\n * to the x window (still from zero), and a drag never names a y range.\n * - Any bar: `\"none\"`. A bar chart is a handful of periods read one bar at a time, and\n * in keksdose every one of them is CLICKED — to drill into a payee, a month, a budget\n * line — which a drag layer over the plot would swallow. A chart of many bars opts\n * back in with `zoomAxes: \"x\"`; a click then reports the period, not the bar.\n */\nexport function defaultZoomAxes(series: readonly { type?: string }[] | undefined): ZoomAxesSetting {\n if (series?.some((entry) => entry.type === \"bar\")) return \"none\";\n if (series?.some((entry) => entry.type === \"area\")) return \"x\";\n return \"both\";\n}\n\n/** The props `withChartZoom` reads off the chart it wraps. */\nexport interface ZoomTarget {\n /** Default: the single axis {@link DEFAULT_Y_AXIS}. */\n axes?: readonly { id: string; hide?: boolean }[];\n /** The chart's own data, so a band can refit the axis it did not name. Optional: a\n * chart with nothing plotted has nothing to fit to. */\n rows?: readonly ZoomRow[];\n series?: readonly ZoomFitSeries[];\n x?: { key?: string };\n zoom?: ZoomBinding;\n labels?: LabelOverride<SeriesChartLabels>;\n /** Which axes a drag may zoom. Default: {@link defaultZoomAxes} of `series`. */\n zoomAxes?: ZoomAxesSetting;\n}\n\nconst SharedX = createContext<{\n window?: [number, number];\n set: Dispatch<SetStateAction<[number, number] | undefined>>;\n} | null>(null);\n\n/**\n * One x window for several charts.\n *\n * A column of charts over one abscissa is one picture, and zooming one of them and not\n * the rest turns it into several pictures of different things. Every zoomable chart\n * inside this shares the x window: any drag in any of them moves all of them.\n *\n * **Only x.** The y axes stay each chart's own — they are in different units — and\n * each refits its own y to what is inside the shared window.\n */\nexport function SharedXZoom({ children }: { children: ReactNode }) {\n const [window, set] = useState<[number, number] | undefined>(undefined);\n return <SharedX.Provider value={{ window, set }}>{children}</SharedX.Provider>;\n}\n\n/**\n * Wrap a chart in drag-to-zoom.\n *\n * The chart receives a `zoom` binding: it applies `xDomain`/`yDomains` to its axes\n * (with `allowDataOverflow`, so recharts clips to the window instead of widening it\n * back out) and renders `layer` as a child of its recharts chart. A reset button\n * appears over the chart's top end corner while it is zoomed — a real button, so the\n * keyboard can undo what the pointer did.\n */\nexport function withChartZoom<P extends ZoomTarget>(Chart: ComponentType<P>) {\n function Zoomable(props: P) {\n const labels = useKitLabels(\"seriesChart\", DEFAULT_SERIES_CHART_LABELS, props.labels);\n const group = useContext(SharedX);\n const [ownX, setOwnX] = useState<[number, number] | undefined>(undefined);\n const [ownY, setOwnY] = useState<Record<string, [number, number]> | null>(null);\n const xWindow = group ? group.window : ownX;\n const setXWindow = group ? group.set : setOwnX;\n const axes = props.axes ?? [{ id: DEFAULT_Y_AXIS }];\n const setting = props.zoomAxes ?? defaultZoomAxes(props.series);\n const only = setting === \"x\" || setting === \"y\" ? setting : undefined;\n\n // Every axis, hidden ones included: a hidden axis still scales its lines, and a\n // line whose axis did not refit is drawn as a flat streak inside the window.\n const source: ZoomFitSource = {\n rows: props.rows ?? [],\n series: [...(props.series ?? [])],\n axes: [...axes],\n xKey: props.x?.key ?? \"x\",\n };\n const state: ZoomState = { x: xWindow, y: ownY };\n const zoomed = xWindow !== undefined || ownY !== null;\n // A chart handed no rows or no series draws its empty state, not a plot — and a\n // \"Reset zoom\" floating over \"No data\" (every line toggled off while zoomed) offers\n // to undo something the reader cannot see. The zoom itself is KEPT: it is where they\n // were looking, and it applies again the moment a line comes back. Only an array\n // that is there and empty counts; a chart that does not pass its data is not known\n // to be empty.\n const empty = props.rows?.length === 0 || props.series?.length === 0;\n\n const clear = () => {\n setXWindow(undefined);\n setOwnY(null);\n };\n\n // Switched off, the chart still gets a binding — with no window and no layer — so a\n // chart whose series change type mid-life is not remounted by a different tree.\n if (setting === \"none\") {\n return (\n <div className=\"relative\">\n <Chart {...props} zoom={{ yDomains: {}, layer: null }} />\n </div>\n );\n }\n\n const binding: ZoomBinding = {\n ...zoomDomains(state, source),\n layer: (\n <ZoomLayer\n axisIds={axes.map((axis) => axis.id)}\n only={only}\n label={labels.zoomHint}\n onZoom={(selection) => {\n const next = zoomAfter(state, selection, source);\n if (next.x !== xWindow) setXWindow(next.x);\n setOwnY(next.y);\n }}\n onReset={clear}\n />\n ),\n };\n\n return (\n <div className=\"relative\">\n <Chart {...props} zoom={binding} />\n {zoomed && !empty && (\n <button\n type=\"button\"\n onClick={clear}\n className={cn(\n \"absolute end-1 top-1 z-10 inline-flex items-center gap-1 rounded border border-subtle bg-surface/90 px-1.5 py-0.5 text-micro text-muted backdrop-blur transition-colors hover:text-primary\",\n FOCUS_RING,\n )}\n >\n <X aria-hidden className=\"size-3\" /> {labels.resetZoom}\n </button>\n )}\n </div>\n );\n }\n Zoomable.displayName = `withChartZoom(${Chart.displayName ?? Chart.name ?? \"Chart\"})`;\n return Zoomable;\n}\n\n/**\n * The part that lives INSIDE the recharts chart, where recharts will say where the plot\n * is and what value a pixel is.\n *\n * A transparent rectangle over the plot area that reads the drag. It does NOT stop the\n * event: recharts drives its tooltip from the same pointer move bubbling up to its own\n * wrapper, so swallowing it here would trade the tooltip for the zoom.\n */\nfunction ZoomLayer({\n axisIds,\n only,\n label,\n onZoom,\n onReset,\n}: {\n axisIds: string[];\n only?: \"x\" | \"y\";\n label: string;\n onZoom: (selection: ZoomSelection) => void;\n onReset: () => void;\n}) {\n const plot = usePlotArea();\n const xInverse = useXAxisInverseScale();\n // One probe COMPONENT per axis rather than a hook in a loop: the number of axes\n // changes as series are toggled, and a hook count that changes with the data is the\n // one thing React will not forgive.\n const [scales] = useState(() => new Map<string, InverseScaleFunction | undefined>());\n const [drag, setDrag] = useState<ZoomDrag | null>(null);\n // A finished drag is followed by a click on the same element, and a chart with an\n // `onClick` (keksdose opens a drilldown on one) would read the zoom as a pick.\n const draggedRef = useRef(false);\n\n if (!plot || plot.width <= 0 || plot.height <= 0) return null;\n\n const at = (event: { clientX: number; clientY: number; currentTarget: Element }) => {\n // Against the overlay's own screen box, so padding around the container cannot\n // shift every reading — plus the plot's offset, because the scales are in the\n // chart's coordinates rather than the plot's.\n const box = event.currentTarget.getBoundingClientRect();\n return { x: event.clientX - box.left + plot.x, y: event.clientY - box.top + plot.y };\n };\n\n const finish = () => {\n if (!drag) return;\n setDrag(null);\n const selection = selectionFromDrag(drag, plot, xInverse, (id) => scales.get(id), axisIds, only);\n draggedRef.current = selection !== null;\n if (selection) onZoom(selection);\n };\n\n // What the drag would do, shown while it is being made: a band paints the full width\n // or height, so the reader sees it is about to let the other axis refit.\n const which = drag\n ? zoomAxesFor(drag.toX - drag.fromX, drag.toY - drag.fromY, plot.width, plot.height, ZOOM_SQUARE_ENOUGH, only)\n : null;\n\n return (\n <g>\n {axisIds.map((id) => (\n <AxisProbe key={id} axisId={id} scales={scales} />\n ))}\n {drag && which && (\n <rect\n x={which === \"y\" ? plot.x : Math.min(drag.fromX, drag.toX)}\n y={which === \"x\" ? plot.y : Math.min(drag.fromY, drag.toY)}\n width={which === \"y\" ? plot.width : Math.abs(drag.toX - drag.fromX)}\n height={which === \"x\" ? plot.height : Math.abs(drag.toY - drag.fromY)}\n className=\"fill-[var(--brand)]/15 stroke-[var(--brand)]\"\n strokeDasharray=\"4 3\"\n pointerEvents=\"none\"\n />\n )}\n <rect\n x={plot.x}\n y={plot.y}\n width={plot.width}\n height={plot.height}\n // `transparent`, not `none`: an unpainted shape takes no pointer events.\n fill=\"transparent\"\n role=\"application\"\n aria-label={label}\n style={{ cursor: \"crosshair\" }}\n onPointerDown={(event) => {\n if (event.button !== 0) return;\n draggedRef.current = false;\n const point = at(event);\n // Best effort: capture keeps a drag alive past the plot's edge, but a\n // pointer id the environment does not know throws — jsdom refuses them all —\n // and a zoom that threw on pointer-down would be a chart nobody could click.\n try {\n event.currentTarget.setPointerCapture(event.pointerId);\n } catch {\n /* the drag still works; it just stops at the edge of the plot */\n }\n setDrag({ fromX: point.x, fromY: point.y, toX: point.x, toY: point.y });\n }}\n onPointerMove={(event) => {\n if (!drag) return;\n const point = at(event);\n setDrag({ ...drag, toX: point.x, toY: point.y });\n }}\n onPointerUp={finish}\n onPointerCancel={() => setDrag(null)}\n onClick={(event) => {\n if (!draggedRef.current) return;\n draggedRef.current = false;\n event.stopPropagation();\n }}\n onDoubleClick={onReset}\n />\n </g>\n );\n}\n\n/** One axis's pixel→value function, parked where the pointer handler can reach it. */\nfunction AxisProbe({ axisId, scales }: { axisId: string; scales: Map<string, InverseScaleFunction | undefined> }) {\n const inverse = useYAxisInverseScale(axisId);\n useEffect(() => {\n scales.set(axisId, inverse);\n return () => {\n scales.delete(axisId);\n };\n }, [axisId, inverse, scales]);\n return null;\n}\n"],"mappings":";AAqZS,cA8EC,YA9ED;AA3XT,SAAS,eAAe,YAAY,WAAW,QAAQ,gBAAgB;AAEvE,SAAS,aAAa,sBAAsB,4BAAuD;AACnG,SAAS,SAAS;AAClB,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,oBAAwC;AACjD,SAAS,mCAA2D;AAI7D,MAAM,iBAAiB;AASvB,MAAM,qBAAqB;AAI3B,MAAM,gBAAgB;AAMtB,SAAS,YACd,IACA,IACA,OACA,QACA,YAAoB,oBAIpB,MACiB;AACjB,MAAI,EAAE,QAAQ,MAAM,E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QACxE;AAAA,QACA,eAAe,CAAC,UAAU;AACxB,cAAI,CAAC,KAAM;AACX,gBAAM,QAAQ,GAAG,KAAK;AACtB,kBAAQ,EAAE,GAAG,MAAM,KAAK,MAAM,GAAG,KAAK,MAAM,EAAE,CAAC;AAAA,QACjD;AAAA,QACA,aAAa;AAAA,QACb,iBAAiB,MAAM,QAAQ,IAAI;AAAA,QACnC,SAAS,CAAC,UAAU;AAClB,cAAI,CAAC,WAAW,QAAS;AACzB,qBAAW,UAAU;AACrB,gBAAM,gBAAgB;AAAA,QACxB;AAAA,QACA,eAAe;AAAA;AAAA,IACjB;AAAA,KACF;AAEJ;AAGA,SAAS,UAAU,EAAE,QAAQ,OAAO,GAA8E;AAChH,QAAM,UAAU,qBAAqB,MAAM;AAC3C,YAAU,MAAM;AACd,WAAO,IAAI,QAAQ,OAAO;AAC1B,WAAO,MAAM;AACX,aAAO,OAAO,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,QAAQ,SAAS,MAAM,CAAC;AAC5B,SAAO;AACT;","names":[]}
@@ -121,5 +121,5 @@ interface ChartLegendContentProps {
121
121
  */
122
122
  activeKey?: string | null;
123
123
  }
124
- export declare function ChartLegendContent({ payload, onItemClick, hiddenKeys, activeKey, }: ChartLegendContentProps): import("react").JSX.Element | null;
124
+ export declare function ChartLegendContent({ payload, onItemClick, hiddenKeys, activeKey }: ChartLegendContentProps): import("react").JSX.Element | null;
125
125
  export {};
@@ -1,11 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { createContext, useContext, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
4
- import {
5
- Legend as RechartsLegend,
6
- ResponsiveContainer,
7
- Tooltip as RechartsTooltip
8
- } from "recharts";
4
+ import { Legend as RechartsLegend, ResponsiveContainer, Tooltip as RechartsTooltip } from "recharts";
9
5
  import { cn } from "../lib/cn.js";
10
6
  import { isRtl } from "../lib/direction.js";
11
7
  import { TYPOGRAPHIC_MINUS } from "../lib/minus.js";
@@ -172,20 +168,11 @@ function ChartTooltipContent({
172
168
  /* @__PURE__ */ jsx(
173
169
  "span",
174
170
  {
175
- className: cn(
176
- "shrink-0 rounded-[2px]",
177
- indicator === "dot" ? "h-2.5 w-2.5 rounded-full" : "h-2.5 w-1"
178
- ),
171
+ className: cn("shrink-0 rounded-[2px]", indicator === "dot" ? "h-2.5 w-2.5 rounded-full" : "h-2.5 w-1"),
179
172
  style: { backgroundColor: color }
180
173
  }
181
174
  ),
182
- /* @__PURE__ */ jsx(
183
- "span",
184
- {
185
- className: cn("min-w-0 text-muted", inRow ? "truncate" : "break-words"),
186
- children: name
187
- }
188
- ),
175
+ /* @__PURE__ */ jsx("span", { className: cn("min-w-0 text-muted", inRow ? "truncate" : "break-words"), children: name }),
189
176
  /* @__PURE__ */ jsx(
190
177
  "span",
191
178
  {
@@ -226,12 +213,7 @@ function ChartTooltipContent({
226
213
  }
227
214
  );
228
215
  }
229
- function ChartLegendContent({
230
- payload,
231
- onItemClick,
232
- hiddenKeys,
233
- activeKey
234
- }) {
216
+ function ChartLegendContent({ payload, onItemClick, hiddenKeys, activeKey }) {
235
217
  const hidden = hiddenKeys ? new Set(hiddenKeys) : null;
236
218
  const config = useChart();
237
219
  if (!payload?.length) return null;