@eifi1/ui-kit 0.52.0 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/README.md +47 -54
  2. package/dist/billing/cancel-subscription.d.ts +5 -14
  3. package/dist/billing/cancel-subscription.js +1 -3
  4. package/dist/billing/cancel-subscription.js.map +1 -1
  5. package/dist/billing/plan-card.d.ts +5 -13
  6. package/dist/billing/plan-card.js +3 -11
  7. package/dist/billing/plan-card.js.map +1 -1
  8. package/dist/billing/plan-switch.d.ts +5 -14
  9. package/dist/billing/plan-switch.js +1 -3
  10. package/dist/billing/plan-switch.js.map +1 -1
  11. package/dist/chart.d.ts +3 -14
  12. package/dist/chart.js +64 -11
  13. package/dist/chart.js.map +1 -1
  14. package/dist/components/date-field.d.ts +1 -1
  15. package/dist/components/date-field.js.map +1 -1
  16. package/dist/components/date-picker.d.ts +1 -1
  17. package/dist/components/date-picker.js.map +1 -1
  18. package/dist/components/date-range-picker.d.ts +4 -17
  19. package/dist/components/date-range-picker.js +2 -2
  20. package/dist/components/date-range-picker.js.map +1 -1
  21. package/dist/components/nav-pills.d.ts +1 -1
  22. package/dist/components/nav-pills.js.map +1 -1
  23. package/dist/components/series-chart-axes.d.ts +1 -1
  24. package/dist/components/series-chart-axes.js.map +1 -1
  25. package/dist/components/series-chart.d.ts +64 -19
  26. package/dist/components/series-chart.js +2 -1
  27. package/dist/components/series-chart.js.map +1 -1
  28. package/dist/components/treemap-labels.d.ts +6 -1
  29. package/dist/components/treemap-labels.js +2 -2
  30. package/dist/components/treemap-labels.js.map +1 -1
  31. package/dist/components/treemap.d.ts +29 -4
  32. package/dist/components/treemap.js +22 -9
  33. package/dist/components/treemap.js.map +1 -1
  34. package/dist/data-table.d.ts +1 -6
  35. package/dist/data-table.js +1 -9
  36. package/dist/data-table.js.map +1 -1
  37. package/dist/demo/demo-countdown.d.ts +0 -5
  38. package/dist/demo/demo-countdown.js +0 -4
  39. package/dist/demo/demo-countdown.js.map +1 -1
  40. package/dist/eslint/index.js +1 -1
  41. package/dist/feedback/feedback-mutation.d.ts +11 -23
  42. package/dist/feedback/feedback-mutation.js +1 -9
  43. package/dist/feedback/feedback-mutation.js.map +1 -1
  44. package/dist/feedback/feedback-public-list.d.ts +1 -6
  45. package/dist/feedback/feedback-public-list.js +1 -2
  46. package/dist/feedback/feedback-public-list.js.map +1 -1
  47. package/dist/feedback/feedback-row-detail-labels.js +0 -8
  48. package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
  49. package/dist/feedback/feedback-row-detail.d.ts +3 -50
  50. package/dist/feedback/feedback-row-detail.js +0 -8
  51. package/dist/feedback/feedback-row-detail.js.map +1 -1
  52. package/dist/feedback/feedback-status-undo.d.ts +3 -19
  53. package/dist/feedback/feedback-status-undo.js.map +1 -1
  54. package/dist/feedback/feedback-thread.d.ts +0 -9
  55. package/dist/feedback/feedback-thread.js.map +1 -1
  56. package/dist/feedback.d.ts +6 -40
  57. package/dist/feedback.js +88 -46
  58. package/dist/feedback.js.map +1 -1
  59. package/dist/i18n/defaults.js +0 -4
  60. package/dist/i18n/defaults.js.map +1 -1
  61. package/dist/i18n/german.js +2 -19
  62. package/dist/i18n/german.js.map +1 -1
  63. package/dist/i18n/kit-labels.d.ts +5 -14
  64. package/dist/i18n/kit-labels.js.map +1 -1
  65. package/dist/i18n/locales/en.js +2 -30
  66. package/dist/i18n/locales/en.js.map +3 -3
  67. package/dist/i18n/locales/es.js +2 -19
  68. package/dist/i18n/locales/es.js.map +1 -1
  69. package/dist/i18n/locales/fr.js +2 -19
  70. package/dist/i18n/locales/fr.js.map +1 -1
  71. package/dist/i18n/locales/hu.js +2 -19
  72. package/dist/i18n/locales/hu.js.map +1 -1
  73. package/dist/i18n/locales/it.js +2 -20
  74. package/dist/i18n/locales/it.js.map +1 -1
  75. package/dist/i18n/locales/zh.js +2 -19
  76. package/dist/i18n/locales/zh.js.map +1 -1
  77. package/dist/i18n/review.js +9 -4
  78. package/dist/i18n/review.js.map +1 -1
  79. package/dist/i18n/shared-labels.js +0 -1
  80. package/dist/i18n/shared-labels.js.map +1 -1
  81. package/dist/index.d.ts +15 -64
  82. package/dist/index.js +22 -102
  83. package/dist/index.js.map +1 -1
  84. package/dist/rhf/fields.d.ts +2 -2
  85. package/dist/rhf/fields.js.map +1 -1
  86. package/dist/search/search-index.d.ts +0 -6
  87. package/dist/search/search-index.js +0 -4
  88. package/dist/search/search-index.js.map +1 -1
  89. package/dist/search.d.ts +1 -8
  90. package/dist/search.js +2 -7
  91. package/dist/search.js.map +1 -1
  92. package/dist/shell/account-menu-language.d.ts +7 -21
  93. package/dist/shell/account-menu-language.js +1 -3
  94. package/dist/shell/account-menu-language.js.map +1 -1
  95. package/dist/shell/account-menu-text-size.d.ts +9 -23
  96. package/dist/shell/account-menu-text-size.js +2 -3
  97. package/dist/shell/account-menu-text-size.js.map +1 -1
  98. package/dist/shell/app-shell.d.ts +0 -10
  99. package/dist/shell/app-shell.js +1 -7
  100. package/dist/shell/app-shell.js.map +1 -1
  101. package/dist/shell/company-switcher.d.ts +1 -1
  102. package/dist/shell/company-switcher.js.map +1 -1
  103. package/dist/shell/dev-menu.d.ts +1 -1
  104. package/dist/shell/dev-menu.js.map +1 -1
  105. package/dist/shell/top-bar-parts-labels.d.ts +1 -1
  106. package/dist/shell/top-bar-parts-labels.js.map +1 -1
  107. package/dist/shell.d.ts +7 -29
  108. package/dist/shell.js +12 -42
  109. package/dist/shell.js.map +1 -1
  110. package/dist/sync.d.ts +2 -6
  111. package/dist/sync.js +2 -15
  112. package/dist/sync.js.map +1 -1
  113. package/dist/theme/chart-palette.d.ts +0 -5
  114. package/dist/theme/chart-palette.js +0 -2
  115. package/dist/theme/chart-palette.js.map +1 -1
  116. package/package.json +1 -1
  117. package/src/billing/cancel-subscription.tsx +5 -16
  118. package/src/billing/plan-card.tsx +7 -24
  119. package/src/billing/plan-switch.tsx +5 -16
  120. package/src/chart.ts +62 -13
  121. package/src/components/date-field.tsx +1 -1
  122. package/src/components/date-picker.tsx +0 -1
  123. package/src/components/date-range-picker.tsx +6 -22
  124. package/src/components/nav-pills.tsx +1 -1
  125. package/src/components/series-chart-axes.ts +6 -1
  126. package/src/components/series-chart.tsx +78 -21
  127. package/src/components/treemap-labels.ts +11 -3
  128. package/src/components/treemap.tsx +65 -12
  129. package/src/data-table.ts +1 -11
  130. package/src/demo/demo-countdown.ts +3 -8
  131. package/src/feedback/feedback-mutation.ts +12 -33
  132. package/src/feedback/feedback-public-list.tsx +1 -7
  133. package/src/feedback/feedback-row-detail-labels.ts +0 -8
  134. package/src/feedback/feedback-row-detail.tsx +8 -58
  135. package/src/feedback/feedback-status-undo.ts +4 -18
  136. package/src/feedback/feedback-thread.tsx +0 -10
  137. package/src/feedback.ts +89 -48
  138. package/src/i18n/defaults.ts +0 -4
  139. package/src/i18n/german.ts +2 -19
  140. package/src/i18n/kit-labels.tsx +5 -14
  141. package/src/i18n/locales/es.ts +2 -19
  142. package/src/i18n/locales/fr.ts +2 -19
  143. package/src/i18n/locales/hu.ts +2 -19
  144. package/src/i18n/locales/it.ts +2 -20
  145. package/src/i18n/locales/zh.ts +2 -19
  146. package/src/i18n/review.ts +9 -4
  147. package/src/i18n/shared-labels.ts +0 -1
  148. package/src/index.ts +30 -112
  149. package/src/rhf/fields.tsx +2 -2
  150. package/src/search/search-index.ts +0 -15
  151. package/src/search.ts +8 -8
  152. package/src/shell/account-menu-language.tsx +7 -27
  153. package/src/shell/account-menu-text-size.tsx +13 -32
  154. package/src/shell/app-shell.tsx +0 -13
  155. package/src/shell/company-switcher.tsx +1 -1
  156. package/src/shell/dev-menu.tsx +1 -1
  157. package/src/shell/top-bar-parts-labels.ts +1 -1
  158. package/src/shell.ts +17 -44
  159. package/src/sync.ts +2 -15
  160. package/src/theme/chart-palette.ts +0 -2
  161. package/tokens.css +4 -4
  162. package/dist/billing/dialog-close.d.ts +0 -29
  163. package/dist/billing/dialog-close.js +0 -8
  164. package/dist/billing/dialog-close.js.map +0 -1
  165. package/dist/components/field-sync-labels.d.ts +0 -3
  166. package/dist/components/field-sync-labels.js +0 -12
  167. package/dist/components/field-sync-labels.js.map +0 -1
  168. package/dist/components/field-sync.d.ts +0 -186
  169. package/dist/components/field-sync.js +0 -269
  170. package/dist/components/field-sync.js.map +0 -1
  171. package/dist/components/section-nav.d.ts +0 -44
  172. package/dist/components/section-nav.js +0 -33
  173. package/dist/components/section-nav.js.map +0 -1
  174. package/dist/components/sign-chip-labels.d.ts +0 -3
  175. package/dist/components/sign-chip-labels.js +0 -11
  176. package/dist/components/sign-chip-labels.js.map +0 -1
  177. package/dist/components/sign-chip.d.ts +0 -77
  178. package/dist/components/sign-chip.js +0 -47
  179. package/dist/components/sign-chip.js.map +0 -1
  180. package/dist/lib/isin.d.ts +0 -38
  181. package/dist/lib/isin.js +0 -36
  182. package/dist/lib/isin.js.map +0 -1
  183. package/dist/shell/role-switcher.d.ts +0 -28
  184. package/dist/shell/role-switcher.js +0 -31
  185. package/dist/shell/role-switcher.js.map +0 -1
  186. package/src/billing/dialog-close.ts +0 -34
  187. package/src/components/field-sync-labels.ts +0 -14
  188. package/src/components/field-sync.tsx +0 -504
  189. package/src/components/section-nav.tsx +0 -72
  190. package/src/components/sign-chip-labels.ts +0 -13
  191. package/src/components/sign-chip.tsx +0 -133
  192. package/src/lib/isin.ts +0 -72
  193. package/src/shell/role-switcher.tsx +0 -53
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/treemap-labels.ts"],"sourcesContent":["// All user-facing strings for `Treemap`, as the `treemap` namespace of\n// `<UiKitProvider labels>`, and per map the `labels` prop over that (0.52, refactor audit\n// 2026-10-30, DSP-5).\n//\n// A module of its own, with no recharts in it, for the reason `pie-chart-labels` is one:\n// the label registry (src/i18n) imports the defaults, and must not pull the chart\n// library in behind them.\n\nexport interface TreemapLabels {\n /**\n * One tile's accessible name — what a screen reader says for a tile, clickable or\n * not, since its area is nothing it can say. `value` arrives through the map's\n * `valueFormatter` when that returns text, else as the number in the provider's\n * locale; `share` is the tile's share of what is drawn, already a formatted percent\n * (\"60 %\" in German, \"60%\" in English) — the function only arranges them.\n */\n tile: (name: string, value: string, share: string) => string;\n /**\n * A group's accessible name (0.52, `TreemapNode.children`): its frame is a stop of the\n * map's keyboard before its tiles, so a reader hears the group and its total once, on the\n * way in. `value` and `share` as for {@link TreemapLabels.tile}, of the group's tiles\n * together; the word \"group\" tells it from a tile of the same shape.\n */\n group: (name: string, value: string, share: string) => string;\n /**\n * A name inside a group: `name` is the tile's (or a nested group's) own, from\n * {@link TreemapLabels.tile} or {@link TreemapLabels.group}, and `group` the name of the\n * group round it — applied once per group, the innermost first, so a tile two levels deep\n * reads \"Rent: 1,050 (40%), in Housing, in Fixed costs\". In the name rather than said once\n * by the frame, because Home, End and a click land on a tile without passing its frame.\n */\n inGroup: (name: string, group: string) => string;\n}\n\nexport const DEFAULT_TREEMAP_LABELS: TreemapLabels = {\n tile: (name, value, share) => `${name}: ${value} (${share})`,\n group: (name, value, share) => `${name}, group: ${value} (${share})`,\n inGroup: (name, group) => `${name}, in ${group}`,\n};\n"],"mappings":";AAkCO,MAAM,yBAAwC;AAAA,EACnD,MAAM,CAAC,MAAM,OAAO,UAAU,GAAG,IAAI,KAAK,KAAK,KAAK,KAAK;AAAA,EACzD,OAAO,CAAC,MAAM,OAAO,UAAU,GAAG,IAAI,YAAY,KAAK,KAAK,KAAK;AAAA,EACjE,SAAS,CAAC,MAAM,UAAU,GAAG,IAAI,QAAQ,KAAK;AAChD;","names":[]}
1
+ {"version":3,"sources":["../../src/components/treemap-labels.ts"],"sourcesContent":["// All user-facing strings for `Treemap`, as the `treemap` namespace of\n// `<UiKitProvider labels>`, and per map the `labels` prop over that (0.52, refactor audit\n// 2026-10-30, DSP-5).\n//\n// A module of its own, with no recharts in it, for the reason `pie-chart-labels` is one:\n// the label registry (src/i18n) imports the defaults, and must not pull the chart\n// library in behind them.\n\nexport interface TreemapLabels {\n /**\n * One tile's accessible name — what a screen reader says for a tile, clickable or\n * not, since its area is nothing it can say. `value` arrives through the map's\n * `valueFormatter` when that returns text, else as the number in the provider's\n * locale; `share` is the tile's share of what is drawn, already a formatted percent\n * (\"60 %\" in German, \"60%\" in English) — the function only arranges them.\n *\n * `share` is `\"\"` when the map's `shareInValue` says the formatter's text already holds\n * it (0.53): leave out whatever frames it, as every catalogue drops its \" (share)\" —\n * \"Migros: CHF 412.30 · 12%\", not \"… · 12% ()\".\n */\n tile: (name: string, value: string, share: string) => string;\n /**\n * A group's accessible name (0.52, `TreemapNode.children`): its frame is a stop of the\n * map's keyboard before its tiles, so a reader hears the group and its total once, on the\n * way in. `value` and `share` as for {@link TreemapLabels.tile}, of the group's tiles\n * together, the share `\"\"` under `shareInValue` as there; the word \"group\" tells it from\n * a tile of the same shape.\n */\n group: (name: string, value: string, share: string) => string;\n /**\n * A name inside a group: `name` is the tile's (or a nested group's) own, from\n * {@link TreemapLabels.tile} or {@link TreemapLabels.group}, and `group` the name of the\n * group round it — applied once per group, the innermost first, so a tile two levels deep\n * reads \"Rent: 1,050 (40%), in Housing, in Fixed costs\". In the name rather than said once\n * by the frame, because Home, End and a click land on a tile without passing its frame.\n */\n inGroup: (name: string, group: string) => string;\n}\n\n// The share in brackets only when there is one: `\"\"` under the map's `shareInValue` (0.53,\n// keksdose after 0.52), which the catalogues in src/i18n/locales follow, each in its own\n// typography.\nexport const DEFAULT_TREEMAP_LABELS: TreemapLabels = {\n tile: (name, value, share) => `${name}: ${value}${share ? ` (${share})` : \"\"}`,\n group: (name, value, share) => `${name}, group: ${value}${share ? ` (${share})` : \"\"}`,\n inGroup: (name, group) => `${name}, in ${group}`,\n};\n"],"mappings":";AA0CO,MAAM,yBAAwC;AAAA,EACnD,MAAM,CAAC,MAAM,OAAO,UAAU,GAAG,IAAI,KAAK,KAAK,GAAG,QAAQ,KAAK,KAAK,MAAM,EAAE;AAAA,EAC5E,OAAO,CAAC,MAAM,OAAO,UAAU,GAAG,IAAI,YAAY,KAAK,GAAG,QAAQ,KAAK,KAAK,MAAM,EAAE;AAAA,EACpF,SAAS,CAAC,MAAM,UAAU,GAAG,IAAI,QAAQ,KAAK;AAChD;","names":[]}
@@ -94,13 +94,26 @@ export interface TreemapProps extends Omit<ComponentPropsWithoutRef<"div">, "chi
94
94
  * A tile's and a group's accessible name (`labels.tile`, `labels.group`, 0.52) says the
95
95
  * value too, asked of the formatter as the tooltip asks it, share and all, and its text
96
96
  * is used; markup is said as the bare number. The name says the share itself, so a
97
- * formatter that writes it into its text has it said twice.
97
+ * formatter that writes it into its text has it said twice — say so with
98
+ * {@link TreemapProps.shareInValue}.
98
99
  *
99
100
  * Default: the bare number through `Intl.NumberFormat` in the provider's locale (0.52,
100
101
  * DOC-10: before, the runtime's). A host with a currency passes this — the kit knows
101
102
  * none.
102
103
  */
103
104
  valueFormatter?: (value: number, share: number | undefined) => ReactNode;
105
+ /**
106
+ * The `valueFormatter`'s text already says the share ("CHF 412.30 · 12%"), so a tile's
107
+ * and a group's accessible name leave their own " (12%)" out (0.53, keksdose after 0.52):
108
+ * the map hands `labels.tile` and `labels.group` the share as `""`, and every catalogue's
109
+ * template drops it there, in its own typography. Before, the only way out was to replace
110
+ * both templates, and with them the kit's seven catalogues. The tooltip is the same either
111
+ * way: it prints what the formatter prints. A formatter whose value is markup is said as
112
+ * the bare number, so its share is then not said at all.
113
+ *
114
+ * Default `false`: the name says the share.
115
+ */
116
+ shareInValue?: boolean;
104
117
  /**
105
118
  * What the map SHOWS, in a sentence — "Rent is three fifths of the month." — the
106
119
  * figure's accessible description (0.52, DSP-5). Not drawn; a caption the eye should
@@ -150,8 +163,18 @@ export interface TreemapProps extends Omit<ComponentPropsWithoutRef<"div">, "chi
150
163
  * Every tile is tagged as a whole too, clickable or not (0.52): its accessible name
151
164
  * (`labels.tile`) says the name and the value, in an attribute a host's redaction
152
165
  * reaches only through the tag.
166
+ *
167
+ * - `true`: every node — the tiles, and a group's frame (its `<g>` and its band's name)
168
+ * and tooltip bubble too.
169
+ * - `"tiles"` (0.53, keksdose after 0.52): the tiles as `true` tags them, and no group —
170
+ * for groups that are public names over private ones, as chains (Migros, Coop) over
171
+ * the shops a user paid. Its frame's band, its frame and its bubble's name are
172
+ * untagged, and so is the frame's accessible name (`labels.group`), which says the
173
+ * group's TOTAL: use it only where the groups' names and totals are not the private
174
+ * part. The bubble's value cell is tagged whatever this says, as in every chart.
175
+ * A tile's name still says its group's (`labels.inGroup`), under the tile's tag.
153
176
  */
154
- redactNames?: boolean;
177
+ redactNames?: boolean | "tiles";
155
178
  /**
156
179
  * A second, smaller line under a tile's label — one extra figure per node that the
157
180
  * name cannot carry (a year-on-year `+12%`, `new`). Return `undefined` for a node
@@ -242,7 +265,9 @@ export interface TreemapCellProps {
242
265
  /** Filled in by recharts for a GROUP: the nodes laid out inside it. A cell with
243
266
  * children draws a frame, not a tile (0.52). */
244
267
  children?: readonly object[] | null;
245
- redactNames?: boolean;
268
+ /** See {@link TreemapProps.redactNames}: `"tiles"` tags a cell with no `children`, and
269
+ * leaves a group's frame and band untagged (0.53). */
270
+ redactNames?: boolean | "tiles";
246
271
  nodeNote?: (id: string) => string | undefined;
247
272
  /** The page's reading direction, which `Treemap` reads off its own root. In `rtl`
248
273
  * the label stands in the tile's top RIGHT corner and is shaped right-to-left, so a
@@ -289,4 +314,4 @@ export declare function TreemapCell(props: TreemapCellProps): import("react").JS
289
314
  *
290
315
  * Needs `recharts`, like everything behind `@eifi1/ui-kit/chart`.
291
316
  */
292
- export declare function Treemap({ data, valueFormatter, height, onNodeClick, onGroupClick, redactNames, nodeNote, maxTiles, colors, edges, description, labels: labelsProp, style, ...rest }: TreemapProps): import("react").JSX.Element | null;
317
+ export declare function Treemap({ data, valueFormatter, height, onNodeClick, onGroupClick, redactNames, shareInValue, nodeNote, maxTiles, colors, edges, description, labels: labelsProp, style, ...rest }: TreemapProps): import("react").JSX.Element | null;
@@ -141,6 +141,7 @@ function Tile({
141
141
  const activate = id != null && click ? () => groups && groups.length > 0 ? click(id, name ?? "", groups) : click(id, name ?? "") : void 0;
142
142
  const roving = path != null && keys ? keys : void 0;
143
143
  const focusable = roving !== void 0 || activate !== void 0;
144
+ const redact = redactNames === true || redactNames === "tiles" && !group;
144
145
  const onKeyDown = focusable ? (e) => {
145
146
  if (roving?.move(path, e)) {
146
147
  e.preventDefault();
@@ -161,7 +162,7 @@ function Tile({
161
162
  role: activate ? "button" : roving ? "img" : void 0,
162
163
  tabIndex: roving ? -1 : activate ? 0 : void 0,
163
164
  "aria-label": focusable ? roving?.name(path) ?? name : void 0,
164
- "data-private": focusable && redactNames ? "" : void 0,
165
+ "data-private": focusable && redact ? "" : void 0,
165
166
  "data-group": group ? "" : void 0,
166
167
  cursor: activate ? "pointer" : void 0,
167
168
  className: focusable ? "outline-none [&:focus-visible>rect]:stroke-[var(--brand)]" : void 0,
@@ -197,7 +198,7 @@ function Tile({
197
198
  label != null && /* @__PURE__ */ jsx(
198
199
  "text",
199
200
  {
200
- "data-private": redactNames ? "" : void 0,
201
+ "data-private": redact ? "" : void 0,
201
202
  x: textX,
202
203
  y: py + (group ? 14 : 15) * scale,
203
204
  direction: dir,
@@ -228,8 +229,13 @@ function Tile({
228
229
  );
229
230
  }
230
231
  const TREEMAP_CONFIG = {};
231
- function RedactedTooltipContent(props) {
232
- return /* @__PURE__ */ jsx("div", { "data-private": true, children: /* @__PURE__ */ jsx(ChartTooltipContent, { ...props }) });
232
+ function RedactedTooltipContent({
233
+ groups = true,
234
+ ...props
235
+ }) {
236
+ const children = props.payload?.[0]?.payload?.children;
237
+ const group = Array.isArray(children) && children.length > 0;
238
+ return /* @__PURE__ */ jsx("div", { "data-private": groups || !group ? true : void 0, children: /* @__PURE__ */ jsx(ChartTooltipContent, { ...props }) });
233
239
  }
234
240
  function createAnchor() {
235
241
  let at = null;
@@ -321,6 +327,7 @@ function Treemap({
321
327
  onNodeClick,
322
328
  onGroupClick,
323
329
  redactNames = false,
330
+ shareInValue = false,
324
331
  nodeNote,
325
332
  maxTiles,
326
333
  colors,
@@ -430,15 +437,16 @@ function Treemap({
430
437
  return typeof out === "string" || typeof out === "number" ? String(out) : formatWithMinus(numberFormat, v);
431
438
  };
432
439
  const groupName = new Map(order.filter((n) => n.children).map((n) => [n.path, n.name]));
440
+ const shareOf = (v) => shareInValue ? "" : shareText(total > 0 ? v / total : 0);
433
441
  return new Map(
434
442
  order.map((n) => {
435
443
  const say = n.children ? labels.group : labels.tile;
436
- const own = say(n.name, valueText(n.size), shareText(total > 0 ? n.size / total : 0));
444
+ const own = say(n.name, valueText(n.size), shareOf(n.size));
437
445
  const named = n.groups.map((g, i) => groupName.get(pathOf(n.groups.slice(0, i), g)) ?? g).reduceRight((acc, group) => labels.inGroup(acc, group), own);
438
446
  return [n.path, named];
439
447
  })
440
448
  );
441
- }, [order, labels, format, numberFormat, shareText, total]);
449
+ }, [order, labels, format, numberFormat, shareText, shareInValue, total]);
442
450
  const keys = useMemo(
443
451
  () => ({ name: (path) => names.get(path), onFocus, register, move }),
444
452
  [names, onFocus, register, move]
@@ -447,7 +455,6 @@ function Treemap({
447
455
  () => ({ tokens: tokenHex, edgeFor, edges: edgesInForce, keys, layout, hover: anchor.set }),
448
456
  [tokenHex, edgeFor, edgesInForce, keys, layout, anchor]
449
457
  );
450
- const Content = redactNames ? RedactedTooltipContent : ChartTooltipContent;
451
458
  const cell = useMemo(
452
459
  () => /* @__PURE__ */ jsx(
453
460
  TreemapCell,
@@ -462,8 +469,14 @@ function Treemap({
462
469
  [onNodeClick, onGroupClick, redactNames, nodeNote, dir]
463
470
  );
464
471
  const tooltip = useMemo(
465
- () => /* @__PURE__ */ jsx(TreemapTooltip, { content: /* @__PURE__ */ jsx(Content, { hideLabel: true, valueFormatter: format }), anchor }),
466
- [Content, format, anchor]
472
+ () => /* @__PURE__ */ jsx(
473
+ TreemapTooltip,
474
+ {
475
+ content: redactNames ? /* @__PURE__ */ jsx(RedactedTooltipContent, { hideLabel: true, valueFormatter: format, groups: redactNames === true }) : /* @__PURE__ */ jsx(ChartTooltipContent, { hideLabel: true, valueFormatter: format }),
476
+ anchor
477
+ }
478
+ ),
479
+ [redactNames, format, anchor]
467
480
  );
468
481
  if (nodes.length === 0) return null;
469
482
  const box = chartHeightProps(height);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/treemap.tsx"],"sourcesContent":["// A tile chart (\"treemap\"): one rectangle per node, its AREA the node's share of what\n// is drawn. Lifted out of keksdose's reports, where five cards drew it (spending by\n// group and by category, net worth by account and by type, allocation, payees, food\n// groups) — every domain word is gone and every string it could print is a prop.\n//\n// It uses the kit's own chart shell (`ChartContainer`, `ChartTooltipContent`) and the\n// kit's own ink rule (`textOn`), so it re-skins with the palette like every other\n// chart. The one thing it cannot take from a CSS var is the tile colour: the label ink\n// is MEASURED against the fill, and a `var(--chart-3)` string measures as nothing — see\n// `useChartTokenHex` below for how the concrete hex is found instead.\n//\n// Since 0.52 a node can hold `children`: a group, drawn as a labelled frame round its\n// tiles (keksdose dev #642, shops by chain). Where every node is drawn is the map's own\n// layout (treemap-layout.ts), not recharts': see \"Groups: a frame round their tiles\".\nimport {\n createContext,\n useCallback,\n useContext,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport type { ComponentProps, ComponentPropsWithoutRef, KeyboardEvent, ReactElement, ReactNode } from \"react\";\nimport { Treemap as RechartsTreemap, useChartHeight, useChartWidth } from \"recharts\";\nimport { ChartContainer, ChartTooltip, ChartTooltipContent, type ChartConfig } from \"./chart\";\nimport { CHART_ROLES, PALETTE_HEX, PALETTE_SIZE, lerpHex, textOn } from \"../theme/chart-palette\";\nimport { resolveChartColor, useChartEdge, useEdgesInForce, type ChartEdges } from \"./chart-edge\";\nimport { parseHex } from \"../theme/color\";\nimport { dirOf, rovingTarget, type Direction } from \"../lib/direction\";\nimport { shareFormat } from \"../lib/share-format\";\nimport { cn } from \"../lib/cn\";\nimport { useTextSize } from \"../theme/text-size\";\nimport { chartHeightProps, type ChartHeight } from \"./chart-height\";\nimport { formatWithMinus } from \"../lib/minus\";\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { DEFAULT_TREEMAP_LABELS, type TreemapLabels } from \"./treemap-labels\";\nimport { groupBody, layoutTreemap, type Box, type Placed } from \"./treemap-layout\";\n\n/**\n * One tile.\n *\n * `value`, not keksdose's `total`: a treemap's areas are not always money (keksdose\n * already sizes one by transaction COUNT), and `value` is the word every other chart\n * in recharts uses for the number a mark is sized by. Migrating is a rename at the\n * mapping step — `{ id, name, value: row.total }`.\n */\nexport interface TreemapNode {\n /** Stable key, handed back by {@link TreemapProps.onNodeClick} and\n * {@link TreemapProps.nodeNote}. Names can collide; ids must not among a group's own\n * nodes (or the top's). A group and a tile inside it may share one — chain 12 and shop\n * 12 from two tables — and `onNodeClick`'s `groups` tells them apart (0.52). */\n id: string;\n name: string;\n /** The tile's area. A node whose value is not a positive finite number is NOT\n * drawn — an area cannot be negative, and recharts lays a negative size out as\n * nonsense rather than refusing it. Saying so is the caller's job: a group that\n * vanishes silently between two views of the same data is a bug report.\n *\n * A GROUP's own `value` is not read: its area is its drawn children's together. Pass\n * that sum — the field stays required so that every reader of a `TreemapNode[]` keeps\n * a `number`. */\n value: number;\n /** Overrides the by-index palette colour for this tile — e.g. to paint every child\n * in its parent group's colour, so the groups stay legible in one picture. A\n * concrete `#rrggbb` or a bare `var(--chart-N)` keeps the label ink measured — so\n * does `CHART_ROLES.other` (`var(--chart-muted)`), the colour for a \"rest\" bucket,\n * which should not wrap round to a hue the reader matches to a real node;\n * anything else (another var, a `color-mix()`) gets `currentColor` ink, because\n * there is nothing to measure — set `labelColor` then.\n *\n * On a group, the colour of every tile inside it that sets none (0.52): keksdose's\n * \"hue = chain\" is a `fill` per chain. A group left without one takes the ramp by its\n * index, as a tile does, and hands that down; its frame is drawn in the page's own\n * colours whatever it is. */\n fill?: string;\n /** The label's ink, for a `fill` the kit cannot measure (a `var()` or `color-mix()`):\n * keksdose's recency plot fills with `color-mix(in srgb, var(--chart-1) N%,\n * transparent)`, where `currentColor` put dark page text on full-strength indigo\n * (~1.5:1). Wins over the measured ink when given. A tile that takes its group's\n * `fill` takes the group's `labelColor` with it; one with a `fill` of its own, or one\n * that `shade` turns into another colour, is measured again. */\n labelColor?: string;\n /**\n * The tile's colour strength, 0–1 (0.52): its `fill` mixed into the card's colour\n * (`--bg-surface`) as a concrete hex, `1` the full hue. For a second, ordered quantity\n * on top of the hue — keksdose's recency steps (1, 0.78, 0.55) over the chain's hue —\n * without a `color-mix()`: the result is measured like any hex, so the label ink stays\n * automatic and no `labelColor` is needed. keksdose found a tile under ~0.55 stops\n * reading as its hue and passes for the muted \"other\" (#642).\n *\n * Only a fill the kit can measure is shaded (a hex, a bare `var(--chart-N)` or another\n * bare token), and only on a page that declares `--bg-surface` as a hex; anything else\n * keeps its full hue. On a group, the default for its tiles, as `fill` is.\n */\n shade?: number;\n /**\n * Makes this node a GROUP (0.52, keksdose dev #642: \"Is there already a distinction\n * between shop and chain?\"): a labelled frame, its name in a band along the top, its\n * tiles laid out inside it by the map's own layout, each at its share of the whole\n * picture (see \"Groups: a frame round their tiles\"). Groups nest. A group with nothing\n * drawable inside is not drawn; an empty array is a tile.\n *\n * The frame is in the page's colours (the well, `--bg-surface-2`, under\n * `--text-primary`, at least 7.4:1 in every preset and contrast), and under More\n * contrast it is outlined in `--chart-ink` as a pale tile is. Its band is drawn only\n * where the group has the room for it — see `TreemapCell`.\n */\n children?: readonly TreemapNode[];\n}\n\n/**\n * Everything a `<div>` takes reaches the chart's root (`ChartContainer`), so a test id\n * or a `data-tour` anchor can find it. `children` is the chart's own.\n *\n * The root is a `role=\"figure\"` (0.52, refactor audit 2026-10-30, DSP-5): name it with\n * `aria-label` (\"Spending by category\"), and say what it shows with {@link\n * TreemapProps.description}.\n */\nexport interface TreemapProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n data: readonly TreemapNode[];\n /**\n * Formats a node's value in the tooltip. Handed the node's SHARE of what is drawn\n * (0–1) as a second argument, because a tile is read for how big it is relative to\n * the rest, and \"€412.30\" alone makes the reader estimate that ratio off the areas.\n * The share is `undefined` when the drawn total is not positive.\n *\n * A tile's and a group's accessible name (`labels.tile`, `labels.group`, 0.52) says the\n * value too, asked of the formatter as the tooltip asks it, share and all, and its text\n * is used; markup is said as the bare number. The name says the share itself, so a\n * formatter that writes it into its text has it said twice.\n *\n * Default: the bare number through `Intl.NumberFormat` in the provider's locale (0.52,\n * DOC-10: before, the runtime's). A host with a currency passes this — the kit knows\n * none.\n */\n valueFormatter?: (value: number, share: number | undefined) => ReactNode;\n /**\n * What the map SHOWS, in a sentence — \"Rent is three fifths of the month.\" — the\n * figure's accessible description (0.52, DSP-5). Not drawn; a caption the eye should\n * read too belongs in the page.\n */\n description?: string;\n /** Per-map strings over `<UiKitProvider labels={{ treemap }}>`. */\n labels?: LabelOverride<TreemapLabels>;\n /** Chart height: a CSS length (`\"20rem\"`, `\"min(20rem, 50dvh)\"`), a Tailwind class,\n * or px. Default `\"20rem\"` — 320 px at Normal, growing with the text size like the\n * labels in the tiles (0.32, docs/text-size-harmonization.md §10.10). */\n height?: ChartHeight;\n /**\n * A tile was activated — by click, or by Enter/Space on a focused tile. Setting this\n * makes every tile a `role=\"button\"`.\n *\n * Either way every tile is reachable (0.52, DSP-5): ONE tab stop for the map, the\n * arrows (←/→ along the reading direction, ↓/↑), Home and End between tiles in the\n * order given, each named \"name: value (share)\" (`labels.tile`) — a `role=\"img\"` to read\n * when nothing listens, as PieChart's slices. Before, a map nobody clicked was nothing\n * to a screen reader, and a clickable tile said its name alone, one tab stop each.\n *\n * In a map with groups (`TreemapNode.children`, 0.52) the walk is the data's own order,\n * depth first: a group's frame, then its tiles, then the next group. A frame is named\n * by `labels.group` (\"Interspar, group: €1,240 (40%)\"), a tile inside one by\n * `labels.inGroup` round its own name (\"Rankweil: €412 (12%), in Interspar\"). Only\n * tiles reach this callback (a frame reaches `onGroupClick`); a tile inside a group is\n * handed a third argument, the ids of its groups, outermost first. Optional in the type,\n * so a forwarder calling this with two arguments still type-checks — and absent for a\n * tile at the top, so a flat map calls it exactly as before.\n */\n onNodeClick?: (id: string, name: string, groups?: readonly string[]) => void;\n /**\n * A group's frame was activated — by click on its band or margin, or by Enter/Space on\n * the focused frame (0.52). Setting this makes every frame a `role=\"button\"`; without it\n * a frame is a `role=\"img\"`, still a stop of the map's keyboard so its total is heard.\n * `groups` as for {@link TreemapProps.onNodeClick}: the groups round this one, passed\n * only for a group inside another.\n */\n onGroupClick?: (id: string, name: string, groups?: readonly string[]) => void;\n /**\n * The node names are the user's own data (payees, not categories): the tile labels\n * and the whole tooltip bubble get `data-private`, the same attribute the kit's\n * `Tooltip redact` and `ChartTooltipContent`'s value cell carry, so the host's one\n * privacy rule reaches them. Off by default — a category name is a label of the app.\n *\n * Every tile is tagged as a whole too, clickable or not (0.52): its accessible name\n * (`labels.tile`) says the name and the value, in an attribute a host's redaction\n * reaches only through the tag.\n */\n redactNames?: boolean;\n /**\n * A second, smaller line under a tile's label — one extra figure per node that the\n * name cannot carry (a year-on-year `+12%`, `new`). Return `undefined` for a node\n * with nothing to add. Never tagged `data-private`: a ratio reveals no amount.\n *\n * ON THE TILE rather than in the tooltip, for two reasons. The tooltip identifies a\n * node by name or by raw value, so a per-node note would be keyed on an amount (two\n * nodes of equal size would swap notes). And a tooltip is a pointer affordance: a\n * phone never hovers, so a figure that only exists on hover does not exist there.\n *\n * Asked for tiles only: a group's band holds its name and nothing else.\n */\n nodeNote?: (id: string) => string | undefined;\n /**\n * Draw at most this many tiles (the first N drawable nodes, in the order given —\n * sort first). Unbounded by default. A tile under ~44x20px has no room for a label,\n * and a map made of unlabelled rectangles answers nothing; around 24 is where the\n * smallest tile of a skewed series reaches that floor on a phone-width card. The\n * caller owns the \"N more not shown\" line, since it knows how many it passed.\n *\n * With groups, the tiles are counted across them in the order given, depth first; a\n * group left with none is not drawn, and a group's frame is not a tile.\n */\n maxTiles?: number;\n /**\n * The categorical ramp tiles take by index, as concrete hex. Default: the page's\n * live `--chart-1…8` tokens (see `useChartTokenHex`), cycled after eight like\n * `paletteFor` (0.49). Pass one when the host\n * already holds the active palette — e.g. `createPaletteStore`'s `useChartHex()` —\n * so a caller colouring a legend beside the map is guaranteed the same list.\n */\n colors?: readonly string[];\n /**\n * How tiles are parted (0.51.6, keksdose dev #642, Marcel: \"The borders do not look\n * nice when changing from tile to tile. Can this be uniform black?\" — and then, on the\n * contrast rule that would go with it: follow the contrast setting).\n *\n * - `\"auto\"` (default): `\"uniform\"` at Standard contrast, `\"contrast\"` while More\n * contrast is in force (`<html data-contrast=\"more\">`: the reader chose it, or chose\n * System on a device that asks for more). Followed live.\n * - `\"uniform\"`: one 2px gutter in the page's ground colour (`--bg-page`, near-black\n * in the dark theme) round every tile, and nothing else. Tiles always abut, so the\n * gutter parts them; each tile is named by its label.\n * - `\"contrast\"`: the 0.49 rule. The gutter is the card's colour (`--bg-surface`),\n * and a tile whose hue is under 3:1 against the card gets a 1px ink edge inside it\n * (WCAG 1.4.11, `useChartEdge`). In the dark theme that ink is light, so some tiles\n * carry a white outline and their neighbours none — the unevenness #642 saw, and\n * the price of the edge for a reader who asked for it.\n */\n edges?: TreemapEdges;\n}\n\n/** {@link TreemapProps.edges}. The switch itself is chart-edge's `useEdgesInForce`,\n * which SeriesChart's bars and areas follow too since 0.52 (DSP-18). */\nexport type TreemapEdges = ChartEdges;\n\n// ── The categorical ramp, as concrete hex ──────────────────────────────────\n//\n// The label ink is measured against the tile's fill, so the fill has to be a colour\n// and not a reference to one. keksdose read it from its palette STORE, which is an\n// app object the kit cannot import. What the kit does own is the token layer: whether\n// a palette arrives through `applyTokenSet` (inline properties on <html>) or through\n// tokens.css (`:root` / `.dark`), the resolved `--chart-N` on <html> is the colour\n// every other chart on the page is being painted with. So that is what is read, and\n// re-read whenever <html>'s class or style changes — which is exactly when a theme\n// toggle or a palette switch lands.\n\nconst CHART_TOKENS = PALETTE_SIZE;\n\n/** The resolved ramp, and after a `|` the card's colour, joined into ONE string so\n * `useSyncExternalStore` compares a primitive: a fresh array per read would never be\n * `Object.is`-equal to the last and would re-render forever. */\nfunction readChartTokens(): string {\n const root = document.documentElement;\n const fallback = root.classList.contains(\"dark\") ? PALETTE_HEX.dark : PALETTE_HEX.light;\n const style = getComputedStyle(root);\n const ramp = Array.from({ length: CHART_TOKENS }, (_, i) => {\n const v = style.getPropertyValue(`--chart-${i + 1}`).trim();\n // An unresolved token (a host that never loaded tokens.css, a test DOM) falls\n // back to the built-in ramp for the current theme rather than to no colour.\n return parseHex(v) ? v : fallback[i];\n }).join(\",\");\n // The card, which `TreemapNode.shade` mixes a hue into (0.52). No fallback: a page that\n // declares no `--bg-surface` hex leaves nothing to mix into, and the tile keeps its hue.\n const card = style.getPropertyValue(\"--bg-surface\").trim();\n return `${ramp}|${parseHex(card) ? card : \"\"}`;\n}\n\nfunction subscribeChartTokens(onChange: () => void): () => void {\n const observer = new MutationObserver(onChange);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"class\", \"style\", \"data-theme\"],\n });\n return () => observer.disconnect();\n}\n\nconst SERVER_TOKENS = `${PALETTE_HEX.light.join(\",\")}|`;\n\ninterface ChartTokens {\n ramp: readonly string[];\n /** `--bg-surface` as hex, or null when the page declares none. */\n card: string | null;\n}\n\nfunction useChartTokenHex(): ChartTokens {\n const joined = useSyncExternalStore(subscribeChartTokens, readChartTokens, () => SERVER_TOKENS);\n // One object per reading, not per render: the map's nodes are memoised on it.\n return useMemo(() => {\n const [ramp = \"\", card = \"\"] = joined.split(\"|\");\n return { ramp: ramp.split(\",\"), card: card || null };\n }, [joined]);\n}\n\nconst CHART_TOKEN_REF = /^var\\(\\s*--chart-(\\d+)\\s*\\)$/;\n\n/**\n * The hex a tile fill measures as: the fill itself when it is hex, the live token when\n * it is a bare `var(--chart-N)` (what `paletteFor` returns), otherwise null. Without\n * the token case a hand-built recharts map coloured with the kit's own `paletteFor`\n * got `currentColor` ink — dark page text on dark indigo in the light theme.\n */\nfunction measurableFill(fill: string, tokens: readonly string[]): string | null {\n if (parseHex(fill)) return fill;\n const m = CHART_TOKEN_REF.exec(fill.trim());\n const hex = m ? tokens[Number(m[1]) - 1] : undefined;\n if (hex && parseHex(hex)) return hex;\n // Any other bare token the page declares — `var(--chart-muted)` for a rest bucket,\n // `var(--chart-9)`, a money colour — read off <html> as it resolves.\n if (typeof document === \"undefined\") return null;\n return resolveChartColor(fill, getComputedStyle(document.documentElement));\n}\n\n// ── What a tile reads from its map ───────────────────────────────────────\n//\n// 0.52 (refactor audit 2026-10-30, DSP-22): every tile resolved the token ramp, the ink\n// edge and the edge rule itself — three stores, each with a MutationObserver on <html>, so\n// 72 on keksdose's 24-tile maps, and up to 29 custom properties re-read on every render of\n// every tile. `Treemap` resolves them once and hands them down here; a TreemapCell drawn\n// in a caller's own recharts `<Treemap>` has no map above it and resolves its own.\n\ninterface TileContext {\n tokens: readonly string[];\n edgeFor: (fill: string | undefined) => string | undefined;\n edges: \"uniform\" | \"contrast\";\n /** The map's keyboard (DSP-5): absent for a standalone cell. */\n keys?: TileKeys;\n /** Where every node is drawn in a chart of this size (see \"Groups\"), by path: absent\n * for a standalone cell, which draws where recharts laid it. */\n layout?: (width: number, height: number, scale: number) => ReadonlyMap<string, Placed>;\n /** The pointer is on the node drawn at `box`: where the map's tooltip stands. */\n hover?: (box: Box) => void;\n}\n\n/**\n * Keyed by a node's PATH (`MapNode.path`), not its id: a group and a tile may share an id\n * — chain 12 and shop 12 come from two tables — and keyed by id the map had two tab stops,\n * the frame said the tile's name and the arrows stuck (0.52 code review of treemap.tsx,\n * finding 3).\n */\ninterface TileKeys {\n /** A tile's or a group's accessible name (`labels.tile`, `labels.group`). */\n name: (path: string) => string | undefined;\n onFocus: (path: string) => void;\n /** A node's element as it mounts (and `null` as it goes): the map sets its `tabindex` and\n * gives it back the focus its previous element held (see the map's keyboard). */\n register: (path: string, element: SVGGElement | null) => void;\n /** Moves focus for an arrow, Home or End pressed on node `path`; `false` for any other key. */\n move: (path: string, event: KeyboardEvent<SVGGElement>) => boolean;\n}\n\nconst TreemapTiles = createContext<TileContext | null>(null);\n\n// ── Groups: a frame round their tiles ─────────────────────────────────────\n//\n// 0.52 (keksdose dev #642). A group is a frame with its name in a band along the top, its\n// tiles inside it. recharts lays nested data out edge to edge, with no room for a band, so\n// the map lays it out ITSELF (treemap-layout.ts): squarified as recharts does it, each\n// group given its frame's area on top of its tiles' — so a tile's area stays its share of\n// the picture in any group (0.52 code review of treemap.tsx, finding 1) — and computed up\n// front from the drawn nodes and the chart's size, which every cell reads by its path.\n// Before, a group's cell made the room during render and left it in a module cache for its\n// children's cells, which held only while recharts rendered a group before its children\n// (finding 8). recharts still renders each node's cell, and its tooltip; the map stands the\n// tooltip at the tile as drawn (`TreemapTooltip`), since recharts' own anchor is the centre\n// of the rectangle IT laid out.\n\n// ── Tile ──────────────────────────────────────────────────────────────────\n\n/** The name's size in px at Normal; a tile draws it × the text size's scale (§10.10), and\n * every distance below that is measured in lines grows with it. */\nconst LABEL_FONT_SIZE = 12;\n/** The optional second line, a step down from the name so the tile reads name-first. */\nconst NOTE_FONT_SIZE = 11;\n\n/**\n * Fit a label to its tile: the text itself when it fits, an ellipsised head when it\n * does not, `null` when not even three characters would. Without this a long name ran\n * on across its neighbours and collided with THEIR labels. 0.58em is the average\n * advance of a UI sans at this weight; it only needs to be close, since the tile keeps\n * 6px of padding either side. The full name stays in the tooltip.\n */\nexport function fitLabel(name: string, boxWidth: number, fontSize: number): string | null {\n const max = Math.floor((boxWidth - 12) / (fontSize * 0.58));\n if (max < 3) return null;\n return name.length <= max ? name : `${name.slice(0, max - 1).trimEnd()}…`;\n}\n\n/** A tile's text, painted over a halo in its tile's colour (see `TreemapCell`). */\nconst haloOf = (halo: string) => ({\n stroke: halo,\n strokeWidth: 2.5,\n strokeLinejoin: \"round\" as const,\n paintOrder: \"stroke\",\n});\n\n/** A band's name: the page's text on the well, 8.2:1 at the least in every preset, 7.4:1\n * under More contrast (measured 0.52) — no halo, nothing to stand out from; `none`\n * against the inherited chart stroke. */\nconst BAND_INK = { fill: \"var(--text-primary)\", stroke: \"none\" };\n\n/** What recharts hands a `content` element for each node, plus the three options the\n * chart forwards. Everything optional because recharts clones the element it was\n * given and fills the geometry in — the element as written carries only the options. */\nexport interface TreemapCellProps {\n depth?: number;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n name?: string;\n fill?: string;\n /** See {@link TreemapNode.labelColor}; recharts hands each node's fields to its cell. */\n labelColor?: string;\n id?: string;\n /** Called with `groups` as its third argument when the cell has any; see\n * {@link TreemapProps.onNodeClick}. */\n onNodeClick?: (id: string, name: string, groups?: readonly string[]) => void;\n /** A group's cell's click; see {@link TreemapProps.onGroupClick}. */\n onGroupClick?: (id: string, name: string, groups?: readonly string[]) => void;\n /** The ids of the groups round the node, outermost first. `Treemap` puts it on every\n * node it hands recharts; a cell drawn in a caller's own map has it if the data does. */\n groups?: readonly string[];\n /** The node's place in the tree, which `Treemap` puts on every node it hands recharts:\n * its key in the map's keyboard, where an id may repeat between a group and a tile. */\n path?: string;\n /** Filled in by recharts for a GROUP: the nodes laid out inside it. A cell with\n * children draws a frame, not a tile (0.52). */\n children?: readonly object[] | null;\n redactNames?: boolean;\n nodeNote?: (id: string) => string | undefined;\n /** The page's reading direction, which `Treemap` reads off its own root. In `rtl`\n * the label stands in the tile's top RIGHT corner and is shaped right-to-left, so a\n * clipped name ends in its ellipsis on the reading end. Default `ltr`. */\n dir?: Direction;\n /** See {@link TreemapProps.edges}. Default `auto`. Read by a cell drawn on its own; a\n * `Treemap` hands its tiles its own `edges`. */\n edges?: TreemapEdges;\n}\n\n/**\n * One tile. Exported so a caller drawing its own recharts `<Treemap>` gets the same\n * label rules.\n *\n * recharts' default cell inherits the chart-level `stroke`, an SVG presentation\n * attribute that lands on the `<svg>` root and cascades into the label — so the glyphs\n * were painted with a 1px outline ON TOP of themselves, which reads as blur. This cell\n * draws its own label with a halo in the TILE colour painted BEHIND the fill\n * (`paint-order: stroke`), which defeats any inherited stroke and keeps the text solid\n * where it overlaps a lighter or darker part of its own tile.\n *\n * Inside a `Treemap` it is one stop of the map's keyboard, named with its value and\n * share (0.52); drawn on its own it is a stop only as a button (`onNodeClick`), named by\n * `name`.\n *\n * A node with `children` is a GROUP (0.52): the cell draws a frame in the well's colour\n * (`--bg-surface-2`), with the group's name in a band along its top where the group has\n * the room (61px at Normal, treemap-layout's `BODY_SHARE`). Inside a `Treemap` its tiles are laid out\n * in the frame's body; in a caller's own nested recharts `<Treemap>` they are drawn where\n * recharts lays them, over the frame — only `Treemap` makes the room.\n */\nexport function TreemapCell(props: TreemapCellProps) {\n const map = useContext(TreemapTiles);\n return map ? <MapTile {...props} map={map} /> : <StandaloneTile {...props} />;\n}\n\n/** A cell inside a `Treemap`: drawn where the map's layout puts its node, read by path\n * for the chart's size as recharts measured it. */\nfunction MapTile(props: TreemapCellProps & { map: TileContext }) {\n const width = useChartWidth();\n const height = useChartHeight();\n const { scale } = useTextSize();\n const place =\n props.path !== undefined && width && height ? props.map.layout?.(width, height, scale).get(props.path) : undefined;\n return <Tile {...props} place={place} />;\n}\n\n/** A cell with no `Treemap` above it: it resolves what the map would have handed it. */\nfunction StandaloneTile(props: TreemapCellProps) {\n const tokens = useChartTokenHex().ramp;\n const edgeFor = useChartEdge();\n const edges = useEdgesInForce(props.edges ?? \"auto\");\n const map = useMemo(() => ({ tokens, edgeFor, edges }), [tokens, edgeFor, edges]);\n return <Tile {...props} map={map} />;\n}\n\nfunction Tile({\n depth,\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n name,\n fill,\n labelColor,\n id,\n onNodeClick,\n onGroupClick,\n groups,\n path,\n children,\n redactNames,\n nodeNote,\n dir = \"ltr\",\n map,\n place,\n}: TreemapCellProps & { map: TileContext; place?: Placed }) {\n // Before the early return: a hook has to run on every render of the cell.\n const { scale } = useTextSize();\n const { tokens: tokenHex, edgeFor, edges, keys } = map;\n // Depth 0 is recharts' synthetic root, which spans the whole chart.\n if (!depth) return null;\n // Inside a Treemap, where the map's layout draws the node; on its own, where recharts\n // laid it out.\n const box = place?.box ?? { x, y, width, height };\n // Whole pixels: a rect on a half pixel renders its edge across two half-lit\n // columns, and the text baseline inherits that blur.\n const px = Math.round(box.x);\n const py = Math.round(box.y);\n const pw = Math.round(box.width);\n const ph = Math.round(box.height);\n const isGroup = children != null && children.length > 0;\n const group = !isGroup\n ? undefined\n : place?.body\n ? { banded: place.banded ?? false, body: place.body }\n : groupBody({ x: px, y: py, width: pw, height: ph }, scale);\n const tileFill = fill ?? \"var(--chart-1)\";\n const measured = measurableFill(tileFill, tokenHex);\n const ink = labelColor ?? (measured ? textOn(measured) : \"currentColor\");\n // `contrast`: a tile in a hue under 3:1 against the card gets a 1px ink edge inside\n // the gutter (WCAG 1.4.11, anyplot's rule); a hue that clears it stays bare.\n // `uniform`: no per-tile edge; every tile is parted by the same gutter.\n // A group's frame is the well, 1.09–1.24:1 from the card in every preset and contrast\n // (measured 0.52): under `contrast` it always takes the edge.\n const edge =\n edges !== \"contrast\" ? undefined : group ? CHART_ROLES.outline : measured ? edgeFor(measured) : undefined;\n // The halo only on an OPAQUE fill we could measure. A translucent fill (a\n // `color-mix(… transparent)`) composited twice — once as the tile, once as the halo\n // over it — draws a darker ring round every glyph, which read as doubled text on the\n // faded tiles. `none` still overrides the inherited chart `stroke`.\n const halo = measured ? tileFill : \"none\";\n // Below ~44x20 there is no room for a readable word, so no label at all rather than\n // a one-letter stub bleeding over the tile edge. A group's name only in its band.\n const labelSize = LABEL_FONT_SIZE * scale;\n const noteSize = NOTE_FONT_SIZE * scale;\n const roomForName = group ? group.banded : pw >= 44 * scale && ph >= 20 * scale;\n const label = roomForName ? fitLabel(name ?? \"\", pw, labelSize) : null;\n // Only under a label that is itself drawn — a stray \"+12%\" on an unnamed rectangle\n // names nothing — and only where a second baseline fits: the note's baseline sits\n // 29px down and an 11px glyph hangs ~2px below it, so 36 leaves the same ~5px under\n // the note that the label keeps under itself at the 20px floor. Never in a band.\n const rawNote = !group && id != null && nodeNote ? nodeNote(id) : undefined;\n const note = label != null && rawNote != null && ph >= 36 * scale ? fitLabel(rawNote, pw, noteSize) : null;\n // The label's START edge, 6px in from the tile's. The tiles themselves are laid out\n // physically (the plot is not mirrored, see `ChartContainer`) and the chart's SVG is\n // pinned `ltr`, so the direction is set on each <text> explicitly: `start` is then\n // the right end in RTL, and the label grows leftwards from the tile's right edge.\n const textX = dir === \"rtl\" ? px + pw - 6 : px + 6;\n // A tile's click is `onNodeClick`, a frame's `onGroupClick`. The groups go along only\n // when there are any, so a flat map calls back exactly as it did before 0.52.\n const click = group ? onGroupClick : onNodeClick;\n const activate =\n id != null && click\n ? () => (groups && groups.length > 0 ? click(id, name ?? \"\", groups) : click(id, name ?? \"\"))\n : undefined;\n // Inside a Treemap every tile and frame is a stop of the map's one roving tab stop,\n // named with its value and share; a standalone cell is a stop of its own only when it\n // is a button.\n const roving = path != null && keys ? keys : undefined;\n const focusable = roving !== undefined || activate !== undefined;\n const onKeyDown = focusable\n ? (e: KeyboardEvent<SVGGElement>) => {\n if (roving?.move(path!, e)) {\n e.preventDefault();\n return;\n }\n if (!activate || (e.key !== \"Enter\" && e.key !== \" \")) return;\n e.preventDefault();\n activate();\n }\n : undefined;\n return (\n <g\n ref={roving ? refFor(roving.register, path!) : undefined}\n onClick={activate}\n onKeyDown={onKeyDown}\n onFocus={roving ? () => roving.onFocus(path!) : undefined}\n onMouseEnter={map.hover ? () => map.hover!({ x: px, y: py, width: pw, height: ph }) : undefined}\n // A clickable tile is a button to a keyboard and a screen reader too; the\n // drilldown it opens was mouse-only in the app this came from. Under `redactNames`\n // the group carries `data-private` whenever it carries a name, button or not: the\n // name says the node's name and value, and an untagged `aria-label` is read by a\n // session replay or a redaction keyed on `[data-private]` (0.52, code review of\n // feat/0.52.0 — DSP-5 named every tile, and this tagged only the buttons).\n role={activate ? \"button\" : roving ? \"img\" : undefined}\n // In a map, -1 as drawn: the map moves its one stop on the elements in place.\n tabIndex={roving ? -1 : activate ? 0 : undefined}\n aria-label={focusable ? (roving?.name(path!) ?? name) : undefined}\n data-private={focusable && redactNames ? \"\" : undefined}\n data-group={group ? \"\" : undefined}\n cursor={activate ? \"pointer\" : undefined}\n // CSS beats a presentation attribute, so this recolours the rect's own stroke\n // for as long as the tile has keyboard focus.\n className={focusable ? \"outline-none [&:focus-visible>rect]:stroke-[var(--brand)]\" : undefined}\n >\n {/* The 2px gutter: the page's ground (`uniform`, the same dark line round every\n tile in the dark theme) or the card showing through (`contrast`). Never a white\n grid: on a dark surface white lines glare harder than the tiles. A group's frame\n is the well, the inset surface: the page's own colour in light, a step up from\n it in dark, and never one of the hues its tiles are told apart by. */}\n <rect\n x={px}\n y={py}\n width={pw}\n height={ph}\n fill={group ? \"var(--bg-surface-2)\" : tileFill}\n stroke={edges === \"contrast\" ? \"var(--bg-surface)\" : \"var(--bg-page)\"}\n strokeWidth={2}\n rx={3}\n />\n {edge && pw > 3 && ph > 3 && (\n <rect\n data-edge=\"\"\n x={px + 1.5}\n y={py + 1.5}\n width={pw - 3}\n height={ph - 3}\n fill=\"none\"\n stroke={edge}\n strokeWidth={1}\n rx={2}\n style={{ pointerEvents: \"none\" }}\n />\n )}\n {label != null && (\n <text\n // A plain attribute, so the host's `[data-private]` rule reaches an SVG\n // <text> exactly as it reaches a table cell.\n data-private={redactNames ? \"\" : undefined}\n x={textX}\n // A band's name centred in its 20px; a tile's where its floor leaves room below.\n y={py + (group ? 14 : 15) * scale}\n direction={dir}\n {...(group ? BAND_INK : { fill: ink, ...haloOf(halo) })}\n fontSize={labelSize}\n fontWeight={600}\n style={{ pointerEvents: \"none\" }}\n >\n {label}\n </text>\n )}\n {note != null && (\n <text\n x={textX}\n y={py + 29 * scale}\n direction={dir}\n fill={ink}\n fillOpacity={0.85}\n {...haloOf(halo)}\n fontSize={noteSize}\n fontWeight={500}\n style={{ pointerEvents: \"none\" }}\n >\n {note}\n </text>\n )}\n </g>\n );\n}\n\n// ── Chart ─────────────────────────────────────────────────────────────────\n\n// Nodes carry their own `fill`, and `ChartTooltipContent` falls back to it for the\n// swatch, so no series config is needed.\nconst TREEMAP_CONFIG: ChartConfig = {};\n\n/**\n * The shared tooltip with the whole bubble tagged `data-private`, for names that are\n * the user's own data.\n *\n * The bubble, not just the name: `ChartTooltipContent` prints the name either from\n * `item.name` or from a config `label`, and only the config route could be tagged — but\n * a config entry keyed by a payee name is not a CSS identifier, and `ChartStyle` would\n * (rightly) refuse it. The bubble holds the name and the value, and the value cell is\n * already `data-private`, so tagging the wrapper hides nothing extra.\n *\n * recharts CLONES the `content` element to inject `active`/`payload`, so this has to BE\n * that element — a `<div>` wrapped around `<ChartTooltipContent />` in the JSX would\n * take those props itself and hand the tooltip nothing.\n */\nfunction RedactedTooltipContent(props: ComponentProps<typeof ChartTooltipContent>) {\n return (\n <div data-private>\n <ChartTooltipContent {...props} />\n </div>\n );\n}\n\n/** Where the pointer last entered a node, as drawn: a store of one box, so that only the\n * tooltip re-renders when it moves — not the map, nor (through recharts) every tile. */\ninterface Anchor {\n read: () => Box | null;\n subscribe: (onChange: () => void) => () => void;\n set: (box: Box) => void;\n}\n\nfunction createAnchor(): Anchor {\n let at: Box | null = null;\n const listeners = new Set<() => void>();\n return {\n read: () => at,\n subscribe: (onChange) => {\n listeners.add(onChange);\n return () => listeners.delete(onChange);\n },\n set: (box) => {\n if (at && at.x === box.x && at.y === box.y && at.width === box.width && at.height === box.height) return;\n at = box;\n listeners.forEach((onChange) => onChange());\n },\n };\n}\n\n/**\n * The map's tooltip, stood at the tile the pointer is on AS DRAWN. recharts anchors its\n * tooltip at the centre of the rectangle it laid the node out in, and since 0.52 the map\n * draws its nodes where its own layout puts them (see \"Groups\") — a tooltip anchored by\n * recharts could stand over a neighbour. It stands 10px off the tile's centre, towards the\n * chart's middle, so it does not run off the side the tile is on. `content` is the bubble,\n * as recharts' own `content`.\n */\nfunction TreemapTooltip({ content, anchor }: { content: ReactElement; anchor: Anchor }) {\n const at = useSyncExternalStore(anchor.subscribe, anchor.read, anchor.read);\n const width = useChartWidth() ?? 0;\n const height = useChartHeight() ?? 0;\n if (!at) return <ChartTooltip content={content} />;\n const cx = at.x + at.width / 2;\n const cy = at.y + at.height / 2;\n const left = cx > width / 2;\n const up = cy > height / 2;\n return (\n <ChartTooltip\n content={content}\n position={{ x: cx + (left ? -10 : 10), y: cy + (up ? -10 : 10) }}\n // `translate` composes with the `transform` recharts sets for `position`.\n wrapperStyle={{ translate: `${left ? \"-100%\" : \"0\"} ${up ? \"-100%\" : \"0\"}` }}\n />\n );\n}\n\n/** What `Treemap` hands recharts per node: a tile, or a group with `children`. recharts\n * hands each node's fields to its cell; a field left out of this never reaches\n * `TreemapCell` (0.8.0 shipped `labelColor` without it — keksdose). A type, not an\n * interface: recharts' `data` wants an index signature, which only an alias meets. */\ntype MapNode = {\n id: string;\n name: string;\n /** A tile's value; a group's, its drawn tiles' together. recharts sums a group again\n * for its layout, and its tooltip reads this field. */\n size: number;\n fill: string;\n labelColor?: string;\n /** The ids of the groups round the node, outermost first. */\n groups: readonly string[];\n /** The node's key in the map's keyboard and names: its id and its groups' (see TileKeys). */\n path: string;\n children?: MapNode[];\n};\n\n/** What a group hands down to the tiles inside it that set none of their own. */\ninterface Paint {\n fill: string;\n labelColor?: string;\n shade?: number;\n}\n\n/**\n * `data` as drawn: tiles with a positive value, at most `maxTiles` of them in the order\n * given (depth first), and the groups that still hold any. `shaded` turns a fill and a\n * `shade` into the fill drawn.\n *\n * Coloured by index into `data` AS GIVEN, before anything is dropped: a caller painting a\n * legend or a second map from the same list must land on the same hue for the same row,\n * and filtering first would shift every colour after a gap. Below the top a node takes\n * its group's colour, so a group's tiles share one hue unless they set their own.\n */\nfunction mapNodes(\n data: readonly TreemapNode[],\n ramp: readonly string[],\n maxTiles: number | null | undefined,\n shaded: (fill: string, shade: number | undefined) => string,\n): MapNode[] {\n // Whole tiles, as `slice(0, maxTiles ?? undefined)` counted them up to 0.51: 2.5 draws 2,\n // NaN none and null every one (0.52 code review of treemap.tsx, finding 4 — a bare\n // counter drew 3, and every tile; deep review, charts, finding 2 — Math.floor(null) is 0,\n // and a JS caller's or a `number | null` setting's null drew an empty card).\n let left = maxTiles == null ? Infinity : Number.isNaN(maxTiles) ? 0 : Math.floor(maxTiles);\n const walk = (list: readonly TreemapNode[], groups: readonly string[], paint: Paint | undefined): MapNode[] =>\n list.flatMap((d, idx): MapNode[] => {\n const fill = d.fill ?? paint?.fill ?? ramp[idx % ramp.length]!;\n // An inherited fill brings its ink along (a `color-mix()` group needs its\n // `labelColor`); a fill of the tile's own is measured again.\n const labelColor = d.labelColor ?? (d.fill === undefined ? paint?.labelColor : undefined);\n const shade = d.shade ?? paint?.shade;\n if (d.children && d.children.length > 0) {\n const children = walk(d.children, [...groups, d.id], { fill, labelColor, shade });\n if (children.length === 0) return [];\n const size = children.reduce((acc, c) => acc + c.size, 0);\n return [{ id: d.id, name: d.name, size, fill, groups, path: pathOf(groups, d.id), children }];\n }\n if (!(Number.isFinite(d.value) && d.value > 0) || left <= 0) return [];\n left -= 1;\n const drawn = shaded(fill, shade);\n // An ink the GROUP chose was chosen for the group's colour: once `shade` makes the\n // tile another hex, that hex is measured instead (0.52 code review of treemap.tsx,\n // finding 5 — white ink on a tile shaded almost to the card, ~1.3:1). The tile's\n // own `labelColor` still wins: the caller set it for this tile.\n const ink = d.labelColor ?? (drawn === fill ? labelColor : undefined);\n return [\n { id: d.id, name: d.name, size: d.value, fill: drawn, labelColor: ink, groups, path: pathOf(groups, d.id) },\n ];\n });\n return walk(data, [], undefined);\n}\n\n/** The last layout made for each drawn tree, by size and text size: a memo, not state — it\n * is a pure function of its key, so whichever cell asks first, every cell gets the same. */\nconst LAYOUTS = new WeakMap<readonly MapNode[], { key: string; placed: ReadonlyMap<string, Placed> }>();\n\nfunction layoutFor(nodes: readonly MapNode[], width: number, height: number, scale: number) {\n const key = `${width}x${height}@${scale}`;\n const last = LAYOUTS.get(nodes);\n if (last?.key === key) return last.placed;\n const placed = layoutTreemap(nodes, width, height, scale);\n LAYOUTS.set(nodes, { key, placed });\n return placed;\n}\n\n/** One ref callback per map and path, the same on every render: a new function each time\n * makes React detach and attach the element on every render of the tile. A path no longer\n * drawn is let go as the map lays out its new data (see the map's keyboard). */\nconst REFS = new WeakMap<TileKeys[\"register\"], Map<string, (element: SVGGElement | null) => void>>();\n\nfunction refFor(register: TileKeys[\"register\"], path: string) {\n let byPath = REFS.get(register);\n if (!byPath) {\n byPath = new Map();\n REFS.set(register, byPath);\n }\n let ref = byPath.get(path);\n if (!ref) {\n ref = (element) => register(path, element);\n byPath.set(path, ref);\n }\n return ref;\n}\n\n/** A node's path: its groups' ids and its own, as JSON so that no id can fake a separator. */\nconst pathOf = (groups: readonly string[], id: string) => JSON.stringify([...groups, id]);\n\n/** `nodes` in the order the keyboard walks them: each group, then what is inside it. */\nfunction depthFirst(nodes: readonly MapNode[]): MapNode[] {\n return nodes.flatMap((n) => [n, ...(n.children ? depthFirst(n.children) : [])]);\n}\n\n/**\n * Tile chart: one rectangle per {@link TreemapNode}, sized by `value`, coloured by\n * index from the chart ramp (or by the node's own `fill`), labelled in whichever of the\n * kit's two inks measures better against it. Hover shows the name and the formatted\n * value; every tile is a keyboard stop named with its value and share (see\n * `onNodeClick`), and `onNodeClick` turns the tiles into buttons.\n *\n * A node with `children` is a group (0.52): a labelled frame with its tiles inside, in\n * its colour unless they set their own — see {@link TreemapNode.children}.\n *\n * Renders nothing when no node has a positive value — an empty box is a hole in the\n * card, and the caller's own sentence is the better answer there.\n *\n * Needs `recharts`, like everything behind `@eifi1/ui-kit/chart`.\n */\nexport function Treemap({\n data,\n valueFormatter,\n height = \"20rem\",\n onNodeClick,\n onGroupClick,\n redactNames = false,\n nodeNote,\n maxTiles,\n colors,\n edges = \"auto\",\n description,\n labels: labelsProp,\n style,\n ...rest\n}: TreemapProps) {\n // Resolved once for every tile, which reads them from `TreemapTiles` (DSP-22).\n const { ramp: tokenHex, card } = useChartTokenHex();\n const edgeFor = useChartEdge();\n const edgesInForce = useEdgesInForce(edges);\n const labels = useKitLabels(\"treemap\", DEFAULT_TREEMAP_LABELS, labelsProp);\n // The provider's locale (0.52, refactor audit 2026-10-30, DOC-10): this was the one\n // formatter default in the kit that took the runtime's.\n const locale = useKitLocale();\n const numberFormat = useMemo(() => new Intl.NumberFormat(locale), [locale]);\n // One decimal under 10 %, the rule PieChart says its shares by too (lib/share-format):\n // a tile of 0.4 % named \"0%\" says it is not there.\n const shareText = useMemo(() => shareFormat(locale), [locale]);\n // Read off the DOM after mount: the `dir` a treemap sits under is an ancestor's\n // attribute, and SVG text anchoring cannot follow it by CSS (see TreemapCell). Again\n // on new data, because a map that had nothing to draw rendered no root to read.\n const rootRef = useRef<HTMLDivElement>(null);\n const [dir, setDir] = useState<Direction>(\"ltr\");\n useLayoutEffect(() => {\n setDir(dirOf(rootRef.current));\n }, [data]);\n const ramp = colors && colors.length > 0 ? colors : tokenHex;\n // Memoised: moving the tab stop re-renders the map, and fresh nodes would re-lay it.\n const nodes = useMemo(\n () =>\n mapNodes(data, ramp, maxTiles, (fill, shade) => {\n // `shade` (0.52): the hue mixed into the card as a hex, so it is measured like\n // any other. A fill or a card it cannot read keeps the full hue.\n if (shade === undefined || !Number.isFinite(shade) || shade >= 1 || !card) return fill;\n const hex = measurableFill(fill, tokenHex);\n return hex ? lerpHex(card, hex, shade) : fill;\n }),\n [data, ramp, maxTiles, tokenHex, card],\n );\n // The keyboard walks groups and tiles alike, in the data's order (see `onNodeClick`).\n const order = useMemo(() => depthFirst(nodes), [nodes]);\n // The map's layout (see \"Groups\"), for the size recharts measured: each cell asks for it\n // by that size, and `layoutFor` makes it once per size and text size.\n const layout = useMemo(\n () => (width: number, height: number, scale: number) => layoutFor(nodes, width, height, scale),\n [nodes],\n );\n // Where the pointer is, for the tooltip to stand at (`TreemapTooltip`).\n const [anchor] = useState(createAnchor);\n\n // The keyboard (DSP-5): one tab stop for the map, moved between tiles in `order` as\n // PieChart's is between slices. The tiles are drawn by recharts, so they register\n // their element here rather than being looked up.\n //\n // The stop is moved on the elements IN PLACE, as PieChart moves its own, and never\n // reaches the tiles' context: kept there, every arrow-key step was a new context and\n // every tile drew again — layout, fitted labels, notes (0.52 code review of treemap.tsx,\n // finding 6). And recharts keys a node by where IT lays it out (`x-y-name`), so new data\n // or a resize remounts the focused node: its element leaves holding the focus, which\n // fell to <body> (finding 7). The path it held is kept, and its new element takes the\n // focus back as it mounts — or, if the node is gone, the stop does.\n const tiles = useRef(new Map<string, SVGGElement>());\n const orderRef = useRef(order);\n const stopRef = useRef<string | undefined>(undefined);\n const restoreRef = useRef<string | null>(null);\n /** The path holding the stop: the last one focused while it is drawn, else the first. */\n const stopOf = useCallback(() => {\n const drawn = orderRef.current;\n return drawn.some((n) => n.path === stopRef.current) ? stopRef.current : drawn[0]?.path;\n }, []);\n const applyStop = useCallback(() => {\n const at = stopOf();\n tiles.current.forEach((el, path) => el.setAttribute(\"tabindex\", path === at ? \"0\" : \"-1\"));\n return at;\n }, [stopOf]);\n const register = useCallback(\n (path: string, element: SVGGElement | null) => {\n if (element) {\n tiles.current.set(path, element);\n element.setAttribute(\"tabindex\", path === stopOf() ? \"0\" : \"-1\");\n if (restoreRef.current === path) {\n restoreRef.current = null;\n element.focus();\n }\n return;\n }\n // Detached before it is removed: still the focused element if it held the focus.\n // Kept for this commit only — the node's new element mounts in it, or the effect below\n // hands the focus on. A node that left with no new data (`<Activity mode=\"hidden\">`, a\n // panel 0 wide) took the focus back whenever it was shown again, from wherever the\n // reader was by then (0.52 code review, deep, charts, finding 3).\n if (tiles.current.get(path) === document.activeElement) {\n restoreRef.current = path;\n queueMicrotask(() => {\n if (restoreRef.current === path) restoreRef.current = null;\n });\n }\n tiles.current.delete(path);\n },\n [stopOf],\n );\n const onFocus = useCallback(\n (path: string) => {\n stopRef.current = path;\n applyStop();\n },\n [applyStop],\n );\n // New data: the order the stop is read against, the stop set again on what is drawn now,\n // the focus of a node that is gone handed to the stop — and the ref callbacks of the paths\n // no longer drawn let go: a map that switched data (a month picker over payees) kept one\n // for every node it had ever drawn (0.52 code review, deep, charts, finding 11).\n useLayoutEffect(() => {\n orderRef.current = order;\n const refs = REFS.get(register);\n if (refs) {\n const drawn = new Set(order.map((n) => n.path));\n for (const path of refs.keys()) if (!drawn.has(path)) refs.delete(path);\n }\n const at = applyStop();\n if (restoreRef.current === null) return;\n restoreRef.current = null;\n if (at) tiles.current.get(at)?.focus();\n }, [order, applyStop, register]);\n const move = useCallback((path: string, event: KeyboardEvent<SVGGElement>) => {\n const drawn = orderRef.current;\n const at = drawn.findIndex((n) => n.path === path);\n // The ends hold: a map is a plane, not PieChart's ring. → is the next tile in any page:\n // the tiles are laid out left to right whatever the reading direction (the plot is not\n // mirrored, see `ChartContainer`), and → read off the page walked an RTL page's map\n // backwards, against the picture (0.52 code review, deep, charts, finding 1).\n const to = at < 0 ? undefined : rovingTarget(event.key, \"ltr\", at, drawn.length, false);\n if (to === undefined) return false;\n const target = drawn[to];\n if (target) tiles.current.get(target.path)?.focus();\n return true;\n }, []);\n\n // Everything below is memoised over what it reads (0.52, code review of feat/0.52.0). A\n // tile re-renders when its context or its recharts element changes, and recharts' map is\n // a PureComponent that redraws every node when `content` or its tooltip child is a new\n // element: built afresh per render, as they were, a page re-rendering the card or one\n // arrow-key step redrew every tile and ran `labels.tile` and two `Intl` formats per node\n // again — the cost DSP-22 had just taken out of the tiles.\n //\n // The share is of what is DRAWN, so it always reads as \"of this picture\" — a group's\n // and a tile's inside it alike.\n const total = useMemo(() => nodes.reduce((acc, n) => acc + n.size, 0), [nodes]);\n const format = useCallback(\n (v: number): ReactNode =>\n valueFormatter ? valueFormatter(v, total > 0 ? v / total : undefined) : formatWithMinus(numberFormat, v),\n [valueFormatter, total, numberFormat],\n );\n const names = useMemo(() => {\n // The value as the tooltip says it: the caller's formatter, handed the node's share as\n // it is there, when it gives text; a value it formats as markup is said as a number.\n //\n // It was asked with the share `undefined` — which, with anything drawn, it had never\n // been before 0.52 — so a formatter leaning on the share printed \"NaN%\" into every name\n // or threw and took the chart down (0.52 code review of treemap.tsx, finding 2). A guard\n // caught both; every named node has its share, so it is handed over instead (deep\n // review, charts, finding 13).\n const valueText = (v: number) => {\n const out = format(v);\n return typeof out === \"string\" || typeof out === \"number\" ? String(out) : formatWithMinus(numberFormat, v);\n };\n // A group's name by its path; a node's groups by theirs, its own path's prefixes.\n const groupName = new Map(order.filter((n) => n.children).map((n) => [n.path, n.name]));\n return new Map(\n order.map((n) => {\n const say = n.children ? labels.group : labels.tile;\n const own = say(n.name, valueText(n.size), shareText(total > 0 ? n.size / total : 0));\n // The innermost group first: \"Rent: …, in Housing, in Fixed costs\".\n const named = n.groups\n .map((g, i) => groupName.get(pathOf(n.groups.slice(0, i), g)) ?? g)\n .reduceRight((acc, group) => labels.inGroup(acc, group), own);\n return [n.path, named] as const;\n }),\n );\n }, [order, labels, format, numberFormat, shareText, total]);\n const keys = useMemo<TileKeys>(\n () => ({ name: (path) => names.get(path), onFocus, register, move }),\n [names, onFocus, register, move],\n );\n const context = useMemo<TileContext>(\n () => ({ tokens: tokenHex, edgeFor, edges: edgesInForce, keys, layout, hover: anchor.set }),\n [tokenHex, edgeFor, edgesInForce, keys, layout, anchor],\n );\n const Content = redactNames ? RedactedTooltipContent : ChartTooltipContent;\n const cell = useMemo(\n () => (\n <TreemapCell\n onNodeClick={onNodeClick}\n onGroupClick={onGroupClick}\n redactNames={redactNames}\n nodeNote={nodeNote}\n dir={dir}\n />\n ),\n [onNodeClick, onGroupClick, redactNames, nodeNote, dir],\n );\n const tooltip = useMemo(\n () => <TreemapTooltip content={<Content hideLabel valueFormatter={format} />} anchor={anchor} />,\n [Content, format, anchor],\n );\n\n if (nodes.length === 0) return null;\n const box = chartHeightProps(height);\n return (\n // Round the container, not inside it: ResponsiveContainer sizes its ONE child, the chart.\n <TreemapTiles.Provider value={context}>\n <ChartContainer\n role=\"figure\"\n {...rest}\n // Read through `aria-describedby`, after a caller's own ids; `hidden`, inside the\n // figure (0.52 code review, deep, charts, finding 7).\n description={description}\n ref={rootRef}\n config={TREEMAP_CONFIG}\n className={cn(box.className, rest.className)}\n style={{ ...style, ...box.style }}\n >\n {/* No chart-level `stroke`: recharts spreads it onto the <svg> root, from where\n it inherits into every label (see TreemapCell). Each cell strokes its own rect. */}\n <RechartsTreemap data={nodes} dataKey=\"size\" fill=\"var(--chart-1)\" isAnimationActive={false} content={cell}>\n {tooltip}\n </RechartsTreemap>\n </ChartContainer>\n </TreemapTiles.Provider>\n );\n}\n"],"mappings":";AAwde,cAwHX,YAxHW;AA1cf;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,WAAW,iBAAiB,gBAAgB,qBAAqB;AAC1E,SAAS,gBAAgB,cAAc,2BAA6C;AACpF,SAAS,aAAa,aAAa,cAAc,SAAS,cAAc;AACxE,SAAS,mBAAmB,cAAc,uBAAwC;AAClF,SAAS,gBAAgB;AACzB,SAAS,OAAO,oBAAoC;AACpD,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,wBAA0C;AACnD,SAAS,uBAAuB;AAChC,SAAS,cAAc,oBAAwC;AAC/D,SAAS,8BAAkD;AAC3D,SAAS,WAAW,qBAA4C;AA0NhE,MAAM,eAAe;AAKrB,SAAS,kBAA0B;AACjC,QAAM,OAAO,SAAS;AACtB,QAAM,WAAW,KAAK,UAAU,SAAS,MAAM,IAAI,YAAY,OAAO,YAAY;AAClF,QAAM,QAAQ,iBAAiB,IAAI;AACnC,QAAM,OAAO,MAAM,KAAK,EAAE,QAAQ,aAAa,GAAG,CAAC,GAAG,MAAM;AAC1D,UAAM,IAAI,MAAM,iBAAiB,WAAW,IAAI,CAAC,EAAE,EAAE,KAAK;AAG1D,WAAO,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC;AA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ACnG,mBACH;AAAA;AAAA,IACF,GACF;AAAA;AAEJ;","names":["height"]}
1
+ {"version":3,"sources":["../../src/components/treemap.tsx"],"sourcesContent":["// A tile chart (\"treemap\"): one rectangle per node, its AREA the node's share of what\n// is drawn. Lifted out of keksdose's reports, where five cards drew it (spending by\n// group and by category, net worth by account and by type, allocation, payees, food\n// groups) — every domain word is gone and every string it could print is a prop.\n//\n// It uses the kit's own chart shell (`ChartContainer`, `ChartTooltipContent`) and the\n// kit's own ink rule (`textOn`), so it re-skins with the palette like every other\n// chart. The one thing it cannot take from a CSS var is the tile colour: the label ink\n// is MEASURED against the fill, and a `var(--chart-3)` string measures as nothing — see\n// `useChartTokenHex` below for how the concrete hex is found instead.\n//\n// Since 0.52 a node can hold `children`: a group, drawn as a labelled frame round its\n// tiles (keksdose dev #642, shops by chain). Where every node is drawn is the map's own\n// layout (treemap-layout.ts), not recharts': see \"Groups: a frame round their tiles\".\nimport {\n createContext,\n useCallback,\n useContext,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport type { ComponentProps, ComponentPropsWithoutRef, KeyboardEvent, ReactElement, ReactNode } from \"react\";\nimport { Treemap as RechartsTreemap, useChartHeight, useChartWidth } from \"recharts\";\nimport { ChartContainer, ChartTooltip, ChartTooltipContent, type ChartConfig } from \"./chart\";\nimport { CHART_ROLES, PALETTE_HEX, PALETTE_SIZE, lerpHex, textOn } from \"../theme/chart-palette\";\nimport { resolveChartColor, useChartEdge, useEdgesInForce, type ChartEdges } from \"./chart-edge\";\nimport { parseHex } from \"../theme/color\";\nimport { dirOf, rovingTarget, type Direction } from \"../lib/direction\";\nimport { shareFormat } from \"../lib/share-format\";\nimport { cn } from \"../lib/cn\";\nimport { useTextSize } from \"../theme/text-size\";\nimport { chartHeightProps, type ChartHeight } from \"./chart-height\";\nimport { formatWithMinus } from \"../lib/minus\";\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { DEFAULT_TREEMAP_LABELS, type TreemapLabels } from \"./treemap-labels\";\nimport { groupBody, layoutTreemap, type Box, type Placed } from \"./treemap-layout\";\n\n/**\n * One tile.\n *\n * `value`, not keksdose's `total`: a treemap's areas are not always money (keksdose\n * already sizes one by transaction COUNT), and `value` is the word every other chart\n * in recharts uses for the number a mark is sized by. Migrating is a rename at the\n * mapping step — `{ id, name, value: row.total }`.\n */\nexport interface TreemapNode {\n /** Stable key, handed back by {@link TreemapProps.onNodeClick} and\n * {@link TreemapProps.nodeNote}. Names can collide; ids must not among a group's own\n * nodes (or the top's). A group and a tile inside it may share one — chain 12 and shop\n * 12 from two tables — and `onNodeClick`'s `groups` tells them apart (0.52). */\n id: string;\n name: string;\n /** The tile's area. A node whose value is not a positive finite number is NOT\n * drawn — an area cannot be negative, and recharts lays a negative size out as\n * nonsense rather than refusing it. Saying so is the caller's job: a group that\n * vanishes silently between two views of the same data is a bug report.\n *\n * A GROUP's own `value` is not read: its area is its drawn children's together. Pass\n * that sum — the field stays required so that every reader of a `TreemapNode[]` keeps\n * a `number`. */\n value: number;\n /** Overrides the by-index palette colour for this tile — e.g. to paint every child\n * in its parent group's colour, so the groups stay legible in one picture. A\n * concrete `#rrggbb` or a bare `var(--chart-N)` keeps the label ink measured — so\n * does `CHART_ROLES.other` (`var(--chart-muted)`), the colour for a \"rest\" bucket,\n * which should not wrap round to a hue the reader matches to a real node;\n * anything else (another var, a `color-mix()`) gets `currentColor` ink, because\n * there is nothing to measure — set `labelColor` then.\n *\n * On a group, the colour of every tile inside it that sets none (0.52): keksdose's\n * \"hue = chain\" is a `fill` per chain. A group left without one takes the ramp by its\n * index, as a tile does, and hands that down; its frame is drawn in the page's own\n * colours whatever it is. */\n fill?: string;\n /** The label's ink, for a `fill` the kit cannot measure (a `var()` or `color-mix()`):\n * keksdose's recency plot fills with `color-mix(in srgb, var(--chart-1) N%,\n * transparent)`, where `currentColor` put dark page text on full-strength indigo\n * (~1.5:1). Wins over the measured ink when given. A tile that takes its group's\n * `fill` takes the group's `labelColor` with it; one with a `fill` of its own, or one\n * that `shade` turns into another colour, is measured again. */\n labelColor?: string;\n /**\n * The tile's colour strength, 0–1 (0.52): its `fill` mixed into the card's colour\n * (`--bg-surface`) as a concrete hex, `1` the full hue. For a second, ordered quantity\n * on top of the hue — keksdose's recency steps (1, 0.78, 0.55) over the chain's hue —\n * without a `color-mix()`: the result is measured like any hex, so the label ink stays\n * automatic and no `labelColor` is needed. keksdose found a tile under ~0.55 stops\n * reading as its hue and passes for the muted \"other\" (#642).\n *\n * Only a fill the kit can measure is shaded (a hex, a bare `var(--chart-N)` or another\n * bare token), and only on a page that declares `--bg-surface` as a hex; anything else\n * keeps its full hue. On a group, the default for its tiles, as `fill` is.\n */\n shade?: number;\n /**\n * Makes this node a GROUP (0.52, keksdose dev #642: \"Is there already a distinction\n * between shop and chain?\"): a labelled frame, its name in a band along the top, its\n * tiles laid out inside it by the map's own layout, each at its share of the whole\n * picture (see \"Groups: a frame round their tiles\"). Groups nest. A group with nothing\n * drawable inside is not drawn; an empty array is a tile.\n *\n * The frame is in the page's colours (the well, `--bg-surface-2`, under\n * `--text-primary`, at least 7.4:1 in every preset and contrast), and under More\n * contrast it is outlined in `--chart-ink` as a pale tile is. Its band is drawn only\n * where the group has the room for it — see `TreemapCell`.\n */\n children?: readonly TreemapNode[];\n}\n\n/**\n * Everything a `<div>` takes reaches the chart's root (`ChartContainer`), so a test id\n * or a `data-tour` anchor can find it. `children` is the chart's own.\n *\n * The root is a `role=\"figure\"` (0.52, refactor audit 2026-10-30, DSP-5): name it with\n * `aria-label` (\"Spending by category\"), and say what it shows with {@link\n * TreemapProps.description}.\n */\nexport interface TreemapProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n data: readonly TreemapNode[];\n /**\n * Formats a node's value in the tooltip. Handed the node's SHARE of what is drawn\n * (0–1) as a second argument, because a tile is read for how big it is relative to\n * the rest, and \"€412.30\" alone makes the reader estimate that ratio off the areas.\n * The share is `undefined` when the drawn total is not positive.\n *\n * A tile's and a group's accessible name (`labels.tile`, `labels.group`, 0.52) says the\n * value too, asked of the formatter as the tooltip asks it, share and all, and its text\n * is used; markup is said as the bare number. The name says the share itself, so a\n * formatter that writes it into its text has it said twice — say so with\n * {@link TreemapProps.shareInValue}.\n *\n * Default: the bare number through `Intl.NumberFormat` in the provider's locale (0.52,\n * DOC-10: before, the runtime's). A host with a currency passes this — the kit knows\n * none.\n */\n valueFormatter?: (value: number, share: number | undefined) => ReactNode;\n /**\n * The `valueFormatter`'s text already says the share (\"CHF 412.30 · 12%\"), so a tile's\n * and a group's accessible name leave their own \" (12%)\" out (0.53, keksdose after 0.52):\n * the map hands `labels.tile` and `labels.group` the share as `\"\"`, and every catalogue's\n * template drops it there, in its own typography. Before, the only way out was to replace\n * both templates, and with them the kit's seven catalogues. The tooltip is the same either\n * way: it prints what the formatter prints. A formatter whose value is markup is said as\n * the bare number, so its share is then not said at all.\n *\n * Default `false`: the name says the share.\n */\n shareInValue?: boolean;\n /**\n * What the map SHOWS, in a sentence — \"Rent is three fifths of the month.\" — the\n * figure's accessible description (0.52, DSP-5). Not drawn; a caption the eye should\n * read too belongs in the page.\n */\n description?: string;\n /** Per-map strings over `<UiKitProvider labels={{ treemap }}>`. */\n labels?: LabelOverride<TreemapLabels>;\n /** Chart height: a CSS length (`\"20rem\"`, `\"min(20rem, 50dvh)\"`), a Tailwind class,\n * or px. Default `\"20rem\"` — 320 px at Normal, growing with the text size like the\n * labels in the tiles (0.32, docs/text-size-harmonization.md §10.10). */\n height?: ChartHeight;\n /**\n * A tile was activated — by click, or by Enter/Space on a focused tile. Setting this\n * makes every tile a `role=\"button\"`.\n *\n * Either way every tile is reachable (0.52, DSP-5): ONE tab stop for the map, the\n * arrows (←/→ along the reading direction, ↓/↑), Home and End between tiles in the\n * order given, each named \"name: value (share)\" (`labels.tile`) — a `role=\"img\"` to read\n * when nothing listens, as PieChart's slices. Before, a map nobody clicked was nothing\n * to a screen reader, and a clickable tile said its name alone, one tab stop each.\n *\n * In a map with groups (`TreemapNode.children`, 0.52) the walk is the data's own order,\n * depth first: a group's frame, then its tiles, then the next group. A frame is named\n * by `labels.group` (\"Interspar, group: €1,240 (40%)\"), a tile inside one by\n * `labels.inGroup` round its own name (\"Rankweil: €412 (12%), in Interspar\"). Only\n * tiles reach this callback (a frame reaches `onGroupClick`); a tile inside a group is\n * handed a third argument, the ids of its groups, outermost first. Optional in the type,\n * so a forwarder calling this with two arguments still type-checks — and absent for a\n * tile at the top, so a flat map calls it exactly as before.\n */\n onNodeClick?: (id: string, name: string, groups?: readonly string[]) => void;\n /**\n * A group's frame was activated — by click on its band or margin, or by Enter/Space on\n * the focused frame (0.52). Setting this makes every frame a `role=\"button\"`; without it\n * a frame is a `role=\"img\"`, still a stop of the map's keyboard so its total is heard.\n * `groups` as for {@link TreemapProps.onNodeClick}: the groups round this one, passed\n * only for a group inside another.\n */\n onGroupClick?: (id: string, name: string, groups?: readonly string[]) => void;\n /**\n * The node names are the user's own data (payees, not categories): the tile labels\n * and the whole tooltip bubble get `data-private`, the same attribute the kit's\n * `Tooltip redact` and `ChartTooltipContent`'s value cell carry, so the host's one\n * privacy rule reaches them. Off by default — a category name is a label of the app.\n *\n * Every tile is tagged as a whole too, clickable or not (0.52): its accessible name\n * (`labels.tile`) says the name and the value, in an attribute a host's redaction\n * reaches only through the tag.\n *\n * - `true`: every node — the tiles, and a group's frame (its `<g>` and its band's name)\n * and tooltip bubble too.\n * - `\"tiles\"` (0.53, keksdose after 0.52): the tiles as `true` tags them, and no group —\n * for groups that are public names over private ones, as chains (Migros, Coop) over\n * the shops a user paid. Its frame's band, its frame and its bubble's name are\n * untagged, and so is the frame's accessible name (`labels.group`), which says the\n * group's TOTAL: use it only where the groups' names and totals are not the private\n * part. The bubble's value cell is tagged whatever this says, as in every chart.\n * A tile's name still says its group's (`labels.inGroup`), under the tile's tag.\n */\n redactNames?: boolean | \"tiles\";\n /**\n * A second, smaller line under a tile's label — one extra figure per node that the\n * name cannot carry (a year-on-year `+12%`, `new`). Return `undefined` for a node\n * with nothing to add. Never tagged `data-private`: a ratio reveals no amount.\n *\n * ON THE TILE rather than in the tooltip, for two reasons. The tooltip identifies a\n * node by name or by raw value, so a per-node note would be keyed on an amount (two\n * nodes of equal size would swap notes). And a tooltip is a pointer affordance: a\n * phone never hovers, so a figure that only exists on hover does not exist there.\n *\n * Asked for tiles only: a group's band holds its name and nothing else.\n */\n nodeNote?: (id: string) => string | undefined;\n /**\n * Draw at most this many tiles (the first N drawable nodes, in the order given —\n * sort first). Unbounded by default. A tile under ~44x20px has no room for a label,\n * and a map made of unlabelled rectangles answers nothing; around 24 is where the\n * smallest tile of a skewed series reaches that floor on a phone-width card. The\n * caller owns the \"N more not shown\" line, since it knows how many it passed.\n *\n * With groups, the tiles are counted across them in the order given, depth first; a\n * group left with none is not drawn, and a group's frame is not a tile.\n */\n maxTiles?: number;\n /**\n * The categorical ramp tiles take by index, as concrete hex. Default: the page's\n * live `--chart-1…8` tokens (see `useChartTokenHex`), cycled after eight like\n * `paletteFor` (0.49). Pass one when the host\n * already holds the active palette — e.g. `createPaletteStore`'s `useChartHex()` —\n * so a caller colouring a legend beside the map is guaranteed the same list.\n */\n colors?: readonly string[];\n /**\n * How tiles are parted (0.51.6, keksdose dev #642, Marcel: \"The borders do not look\n * nice when changing from tile to tile. Can this be uniform black?\" — and then, on the\n * contrast rule that would go with it: follow the contrast setting).\n *\n * - `\"auto\"` (default): `\"uniform\"` at Standard contrast, `\"contrast\"` while More\n * contrast is in force (`<html data-contrast=\"more\">`: the reader chose it, or chose\n * System on a device that asks for more). Followed live.\n * - `\"uniform\"`: one 2px gutter in the page's ground colour (`--bg-page`, near-black\n * in the dark theme) round every tile, and nothing else. Tiles always abut, so the\n * gutter parts them; each tile is named by its label.\n * - `\"contrast\"`: the 0.49 rule. The gutter is the card's colour (`--bg-surface`),\n * and a tile whose hue is under 3:1 against the card gets a 1px ink edge inside it\n * (WCAG 1.4.11, `useChartEdge`). In the dark theme that ink is light, so some tiles\n * carry a white outline and their neighbours none — the unevenness #642 saw, and\n * the price of the edge for a reader who asked for it.\n */\n edges?: TreemapEdges;\n}\n\n/** {@link TreemapProps.edges}. The switch itself is chart-edge's `useEdgesInForce`,\n * which SeriesChart's bars and areas follow too since 0.52 (DSP-18). */\nexport type TreemapEdges = ChartEdges;\n\n// ── The categorical ramp, as concrete hex ──────────────────────────────────\n//\n// The label ink is measured against the tile's fill, so the fill has to be a colour\n// and not a reference to one. keksdose read it from its palette STORE, which is an\n// app object the kit cannot import. What the kit does own is the token layer: whether\n// a palette arrives through `applyTokenSet` (inline properties on <html>) or through\n// tokens.css (`:root` / `.dark`), the resolved `--chart-N` on <html> is the colour\n// every other chart on the page is being painted with. So that is what is read, and\n// re-read whenever <html>'s class or style changes — which is exactly when a theme\n// toggle or a palette switch lands.\n\nconst CHART_TOKENS = PALETTE_SIZE;\n\n/** The resolved ramp, and after a `|` the card's colour, joined into ONE string so\n * `useSyncExternalStore` compares a primitive: a fresh array per read would never be\n * `Object.is`-equal to the last and would re-render forever. */\nfunction readChartTokens(): string {\n const root = document.documentElement;\n const fallback = root.classList.contains(\"dark\") ? PALETTE_HEX.dark : PALETTE_HEX.light;\n const style = getComputedStyle(root);\n const ramp = Array.from({ length: CHART_TOKENS }, (_, i) => {\n const v = style.getPropertyValue(`--chart-${i + 1}`).trim();\n // An unresolved token (a host that never loaded tokens.css, a test DOM) falls\n // back to the built-in ramp for the current theme rather than to no colour.\n return parseHex(v) ? v : fallback[i];\n }).join(\",\");\n // The card, which `TreemapNode.shade` mixes a hue into (0.52). No fallback: a page that\n // declares no `--bg-surface` hex leaves nothing to mix into, and the tile keeps its hue.\n const card = style.getPropertyValue(\"--bg-surface\").trim();\n return `${ramp}|${parseHex(card) ? card : \"\"}`;\n}\n\nfunction subscribeChartTokens(onChange: () => void): () => void {\n const observer = new MutationObserver(onChange);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"class\", \"style\", \"data-theme\"],\n });\n return () => observer.disconnect();\n}\n\nconst SERVER_TOKENS = `${PALETTE_HEX.light.join(\",\")}|`;\n\ninterface ChartTokens {\n ramp: readonly string[];\n /** `--bg-surface` as hex, or null when the page declares none. */\n card: string | null;\n}\n\nfunction useChartTokenHex(): ChartTokens {\n const joined = useSyncExternalStore(subscribeChartTokens, readChartTokens, () => SERVER_TOKENS);\n // One object per reading, not per render: the map's nodes are memoised on it.\n return useMemo(() => {\n const [ramp = \"\", card = \"\"] = joined.split(\"|\");\n return { ramp: ramp.split(\",\"), card: card || null };\n }, [joined]);\n}\n\nconst CHART_TOKEN_REF = /^var\\(\\s*--chart-(\\d+)\\s*\\)$/;\n\n/**\n * The hex a tile fill measures as: the fill itself when it is hex, the live token when\n * it is a bare `var(--chart-N)` (what `paletteFor` returns), otherwise null. Without\n * the token case a hand-built recharts map coloured with the kit's own `paletteFor`\n * got `currentColor` ink — dark page text on dark indigo in the light theme.\n */\nfunction measurableFill(fill: string, tokens: readonly string[]): string | null {\n if (parseHex(fill)) return fill;\n const m = CHART_TOKEN_REF.exec(fill.trim());\n const hex = m ? tokens[Number(m[1]) - 1] : undefined;\n if (hex && parseHex(hex)) return hex;\n // Any other bare token the page declares — `var(--chart-muted)` for a rest bucket,\n // `var(--chart-9)`, a money colour — read off <html> as it resolves.\n if (typeof document === \"undefined\") return null;\n return resolveChartColor(fill, getComputedStyle(document.documentElement));\n}\n\n// ── What a tile reads from its map ───────────────────────────────────────\n//\n// 0.52 (refactor audit 2026-10-30, DSP-22): every tile resolved the token ramp, the ink\n// edge and the edge rule itself — three stores, each with a MutationObserver on <html>, so\n// 72 on keksdose's 24-tile maps, and up to 29 custom properties re-read on every render of\n// every tile. `Treemap` resolves them once and hands them down here; a TreemapCell drawn\n// in a caller's own recharts `<Treemap>` has no map above it and resolves its own.\n\ninterface TileContext {\n tokens: readonly string[];\n edgeFor: (fill: string | undefined) => string | undefined;\n edges: \"uniform\" | \"contrast\";\n /** The map's keyboard (DSP-5): absent for a standalone cell. */\n keys?: TileKeys;\n /** Where every node is drawn in a chart of this size (see \"Groups\"), by path: absent\n * for a standalone cell, which draws where recharts laid it. */\n layout?: (width: number, height: number, scale: number) => ReadonlyMap<string, Placed>;\n /** The pointer is on the node drawn at `box`: where the map's tooltip stands. */\n hover?: (box: Box) => void;\n}\n\n/**\n * Keyed by a node's PATH (`MapNode.path`), not its id: a group and a tile may share an id\n * — chain 12 and shop 12 come from two tables — and keyed by id the map had two tab stops,\n * the frame said the tile's name and the arrows stuck (0.52 code review of treemap.tsx,\n * finding 3).\n */\ninterface TileKeys {\n /** A tile's or a group's accessible name (`labels.tile`, `labels.group`). */\n name: (path: string) => string | undefined;\n onFocus: (path: string) => void;\n /** A node's element as it mounts (and `null` as it goes): the map sets its `tabindex` and\n * gives it back the focus its previous element held (see the map's keyboard). */\n register: (path: string, element: SVGGElement | null) => void;\n /** Moves focus for an arrow, Home or End pressed on node `path`; `false` for any other key. */\n move: (path: string, event: KeyboardEvent<SVGGElement>) => boolean;\n}\n\nconst TreemapTiles = createContext<TileContext | null>(null);\n\n// ── Groups: a frame round their tiles ─────────────────────────────────────\n//\n// 0.52 (keksdose dev #642). A group is a frame with its name in a band along the top, its\n// tiles inside it. recharts lays nested data out edge to edge, with no room for a band, so\n// the map lays it out ITSELF (treemap-layout.ts): squarified as recharts does it, each\n// group given its frame's area on top of its tiles' — so a tile's area stays its share of\n// the picture in any group (0.52 code review of treemap.tsx, finding 1) — and computed up\n// front from the drawn nodes and the chart's size, which every cell reads by its path.\n// Before, a group's cell made the room during render and left it in a module cache for its\n// children's cells, which held only while recharts rendered a group before its children\n// (finding 8). recharts still renders each node's cell, and its tooltip; the map stands the\n// tooltip at the tile as drawn (`TreemapTooltip`), since recharts' own anchor is the centre\n// of the rectangle IT laid out.\n\n// ── Tile ──────────────────────────────────────────────────────────────────\n\n/** The name's size in px at Normal; a tile draws it × the text size's scale (§10.10), and\n * every distance below that is measured in lines grows with it. */\nconst LABEL_FONT_SIZE = 12;\n/** The optional second line, a step down from the name so the tile reads name-first. */\nconst NOTE_FONT_SIZE = 11;\n\n/**\n * Fit a label to its tile: the text itself when it fits, an ellipsised head when it\n * does not, `null` when not even three characters would. Without this a long name ran\n * on across its neighbours and collided with THEIR labels. 0.58em is the average\n * advance of a UI sans at this weight; it only needs to be close, since the tile keeps\n * 6px of padding either side. The full name stays in the tooltip.\n */\nexport function fitLabel(name: string, boxWidth: number, fontSize: number): string | null {\n const max = Math.floor((boxWidth - 12) / (fontSize * 0.58));\n if (max < 3) return null;\n return name.length <= max ? name : `${name.slice(0, max - 1).trimEnd()}…`;\n}\n\n/** A tile's text, painted over a halo in its tile's colour (see `TreemapCell`). */\nconst haloOf = (halo: string) => ({\n stroke: halo,\n strokeWidth: 2.5,\n strokeLinejoin: \"round\" as const,\n paintOrder: \"stroke\",\n});\n\n/** A band's name: the page's text on the well, 8.2:1 at the least in every preset, 7.4:1\n * under More contrast (measured 0.52) — no halo, nothing to stand out from; `none`\n * against the inherited chart stroke. */\nconst BAND_INK = { fill: \"var(--text-primary)\", stroke: \"none\" };\n\n/** What recharts hands a `content` element for each node, plus the three options the\n * chart forwards. Everything optional because recharts clones the element it was\n * given and fills the geometry in — the element as written carries only the options. */\nexport interface TreemapCellProps {\n depth?: number;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n name?: string;\n fill?: string;\n /** See {@link TreemapNode.labelColor}; recharts hands each node's fields to its cell. */\n labelColor?: string;\n id?: string;\n /** Called with `groups` as its third argument when the cell has any; see\n * {@link TreemapProps.onNodeClick}. */\n onNodeClick?: (id: string, name: string, groups?: readonly string[]) => void;\n /** A group's cell's click; see {@link TreemapProps.onGroupClick}. */\n onGroupClick?: (id: string, name: string, groups?: readonly string[]) => void;\n /** The ids of the groups round the node, outermost first. `Treemap` puts it on every\n * node it hands recharts; a cell drawn in a caller's own map has it if the data does. */\n groups?: readonly string[];\n /** The node's place in the tree, which `Treemap` puts on every node it hands recharts:\n * its key in the map's keyboard, where an id may repeat between a group and a tile. */\n path?: string;\n /** Filled in by recharts for a GROUP: the nodes laid out inside it. A cell with\n * children draws a frame, not a tile (0.52). */\n children?: readonly object[] | null;\n /** See {@link TreemapProps.redactNames}: `\"tiles\"` tags a cell with no `children`, and\n * leaves a group's frame and band untagged (0.53). */\n redactNames?: boolean | \"tiles\";\n nodeNote?: (id: string) => string | undefined;\n /** The page's reading direction, which `Treemap` reads off its own root. In `rtl`\n * the label stands in the tile's top RIGHT corner and is shaped right-to-left, so a\n * clipped name ends in its ellipsis on the reading end. Default `ltr`. */\n dir?: Direction;\n /** See {@link TreemapProps.edges}. Default `auto`. Read by a cell drawn on its own; a\n * `Treemap` hands its tiles its own `edges`. */\n edges?: TreemapEdges;\n}\n\n/**\n * One tile. Exported so a caller drawing its own recharts `<Treemap>` gets the same\n * label rules.\n *\n * recharts' default cell inherits the chart-level `stroke`, an SVG presentation\n * attribute that lands on the `<svg>` root and cascades into the label — so the glyphs\n * were painted with a 1px outline ON TOP of themselves, which reads as blur. This cell\n * draws its own label with a halo in the TILE colour painted BEHIND the fill\n * (`paint-order: stroke`), which defeats any inherited stroke and keeps the text solid\n * where it overlaps a lighter or darker part of its own tile.\n *\n * Inside a `Treemap` it is one stop of the map's keyboard, named with its value and\n * share (0.52); drawn on its own it is a stop only as a button (`onNodeClick`), named by\n * `name`.\n *\n * A node with `children` is a GROUP (0.52): the cell draws a frame in the well's colour\n * (`--bg-surface-2`), with the group's name in a band along its top where the group has\n * the room (61px at Normal, treemap-layout's `BODY_SHARE`). Inside a `Treemap` its tiles are laid out\n * in the frame's body; in a caller's own nested recharts `<Treemap>` they are drawn where\n * recharts lays them, over the frame — only `Treemap` makes the room.\n */\nexport function TreemapCell(props: TreemapCellProps) {\n const map = useContext(TreemapTiles);\n return map ? <MapTile {...props} map={map} /> : <StandaloneTile {...props} />;\n}\n\n/** A cell inside a `Treemap`: drawn where the map's layout puts its node, read by path\n * for the chart's size as recharts measured it. */\nfunction MapTile(props: TreemapCellProps & { map: TileContext }) {\n const width = useChartWidth();\n const height = useChartHeight();\n const { scale } = useTextSize();\n const place =\n props.path !== undefined && width && height ? props.map.layout?.(width, height, scale).get(props.path) : undefined;\n return <Tile {...props} place={place} />;\n}\n\n/** A cell with no `Treemap` above it: it resolves what the map would have handed it. */\nfunction StandaloneTile(props: TreemapCellProps) {\n const tokens = useChartTokenHex().ramp;\n const edgeFor = useChartEdge();\n const edges = useEdgesInForce(props.edges ?? \"auto\");\n const map = useMemo(() => ({ tokens, edgeFor, edges }), [tokens, edgeFor, edges]);\n return <Tile {...props} map={map} />;\n}\n\nfunction Tile({\n depth,\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n name,\n fill,\n labelColor,\n id,\n onNodeClick,\n onGroupClick,\n groups,\n path,\n children,\n redactNames,\n nodeNote,\n dir = \"ltr\",\n map,\n place,\n}: TreemapCellProps & { map: TileContext; place?: Placed }) {\n // Before the early return: a hook has to run on every render of the cell.\n const { scale } = useTextSize();\n const { tokens: tokenHex, edgeFor, edges, keys } = map;\n // Depth 0 is recharts' synthetic root, which spans the whole chart.\n if (!depth) return null;\n // Inside a Treemap, where the map's layout draws the node; on its own, where recharts\n // laid it out.\n const box = place?.box ?? { x, y, width, height };\n // Whole pixels: a rect on a half pixel renders its edge across two half-lit\n // columns, and the text baseline inherits that blur.\n const px = Math.round(box.x);\n const py = Math.round(box.y);\n const pw = Math.round(box.width);\n const ph = Math.round(box.height);\n const isGroup = children != null && children.length > 0;\n const group = !isGroup\n ? undefined\n : place?.body\n ? { banded: place.banded ?? false, body: place.body }\n : groupBody({ x: px, y: py, width: pw, height: ph }, scale);\n const tileFill = fill ?? \"var(--chart-1)\";\n const measured = measurableFill(tileFill, tokenHex);\n const ink = labelColor ?? (measured ? textOn(measured) : \"currentColor\");\n // `contrast`: a tile in a hue under 3:1 against the card gets a 1px ink edge inside\n // the gutter (WCAG 1.4.11, anyplot's rule); a hue that clears it stays bare.\n // `uniform`: no per-tile edge; every tile is parted by the same gutter.\n // A group's frame is the well, 1.09–1.24:1 from the card in every preset and contrast\n // (measured 0.52): under `contrast` it always takes the edge.\n const edge =\n edges !== \"contrast\" ? undefined : group ? CHART_ROLES.outline : measured ? edgeFor(measured) : undefined;\n // The halo only on an OPAQUE fill we could measure. A translucent fill (a\n // `color-mix(… transparent)`) composited twice — once as the tile, once as the halo\n // over it — draws a darker ring round every glyph, which read as doubled text on the\n // faded tiles. `none` still overrides the inherited chart `stroke`.\n const halo = measured ? tileFill : \"none\";\n // Below ~44x20 there is no room for a readable word, so no label at all rather than\n // a one-letter stub bleeding over the tile edge. A group's name only in its band.\n const labelSize = LABEL_FONT_SIZE * scale;\n const noteSize = NOTE_FONT_SIZE * scale;\n const roomForName = group ? group.banded : pw >= 44 * scale && ph >= 20 * scale;\n const label = roomForName ? fitLabel(name ?? \"\", pw, labelSize) : null;\n // Only under a label that is itself drawn — a stray \"+12%\" on an unnamed rectangle\n // names nothing — and only where a second baseline fits: the note's baseline sits\n // 29px down and an 11px glyph hangs ~2px below it, so 36 leaves the same ~5px under\n // the note that the label keeps under itself at the 20px floor. Never in a band.\n const rawNote = !group && id != null && nodeNote ? nodeNote(id) : undefined;\n const note = label != null && rawNote != null && ph >= 36 * scale ? fitLabel(rawNote, pw, noteSize) : null;\n // The label's START edge, 6px in from the tile's. The tiles themselves are laid out\n // physically (the plot is not mirrored, see `ChartContainer`) and the chart's SVG is\n // pinned `ltr`, so the direction is set on each <text> explicitly: `start` is then\n // the right end in RTL, and the label grows leftwards from the tile's right edge.\n const textX = dir === \"rtl\" ? px + pw - 6 : px + 6;\n // A tile's click is `onNodeClick`, a frame's `onGroupClick`. The groups go along only\n // when there are any, so a flat map calls back exactly as it did before 0.52.\n const click = group ? onGroupClick : onNodeClick;\n const activate =\n id != null && click\n ? () => (groups && groups.length > 0 ? click(id, name ?? \"\", groups) : click(id, name ?? \"\"))\n : undefined;\n // Inside a Treemap every tile and frame is a stop of the map's one roving tab stop,\n // named with its value and share; a standalone cell is a stop of its own only when it\n // is a button.\n const roving = path != null && keys ? keys : undefined;\n const focusable = roving !== undefined || activate !== undefined;\n // `\"tiles\"` (0.53, keksdose after 0.52) leaves a group's frame and band untagged: its\n // groups are public chain names, and its blur on `[data-private]` blurred them with the\n // payees. A truthy test on the union would have tagged them still.\n const redact = redactNames === true || (redactNames === \"tiles\" && !group);\n const onKeyDown = focusable\n ? (e: KeyboardEvent<SVGGElement>) => {\n if (roving?.move(path!, e)) {\n e.preventDefault();\n return;\n }\n if (!activate || (e.key !== \"Enter\" && e.key !== \" \")) return;\n e.preventDefault();\n activate();\n }\n : undefined;\n return (\n <g\n ref={roving ? refFor(roving.register, path!) : undefined}\n onClick={activate}\n onKeyDown={onKeyDown}\n onFocus={roving ? () => roving.onFocus(path!) : undefined}\n onMouseEnter={map.hover ? () => map.hover!({ x: px, y: py, width: pw, height: ph }) : undefined}\n // A clickable tile is a button to a keyboard and a screen reader too; the\n // drilldown it opens was mouse-only in the app this came from. Under `redactNames`\n // the group carries `data-private` whenever it carries a name, button or not: the\n // name says the node's name and value, and an untagged `aria-label` is read by a\n // session replay or a redaction keyed on `[data-private]` (0.52, code review of\n // feat/0.52.0 — DSP-5 named every tile, and this tagged only the buttons).\n role={activate ? \"button\" : roving ? \"img\" : undefined}\n // In a map, -1 as drawn: the map moves its one stop on the elements in place.\n tabIndex={roving ? -1 : activate ? 0 : undefined}\n aria-label={focusable ? (roving?.name(path!) ?? name) : undefined}\n data-private={focusable && redact ? \"\" : undefined}\n data-group={group ? \"\" : undefined}\n cursor={activate ? \"pointer\" : undefined}\n // CSS beats a presentation attribute, so this recolours the rect's own stroke\n // for as long as the tile has keyboard focus.\n className={focusable ? \"outline-none [&:focus-visible>rect]:stroke-[var(--brand)]\" : undefined}\n >\n {/* The 2px gutter: the page's ground (`uniform`, the same dark line round every\n tile in the dark theme) or the card showing through (`contrast`). Never a white\n grid: on a dark surface white lines glare harder than the tiles. A group's frame\n is the well, the inset surface: the page's own colour in light, a step up from\n it in dark, and never one of the hues its tiles are told apart by. */}\n <rect\n x={px}\n y={py}\n width={pw}\n height={ph}\n fill={group ? \"var(--bg-surface-2)\" : tileFill}\n stroke={edges === \"contrast\" ? \"var(--bg-surface)\" : \"var(--bg-page)\"}\n strokeWidth={2}\n rx={3}\n />\n {edge && pw > 3 && ph > 3 && (\n <rect\n data-edge=\"\"\n x={px + 1.5}\n y={py + 1.5}\n width={pw - 3}\n height={ph - 3}\n fill=\"none\"\n stroke={edge}\n strokeWidth={1}\n rx={2}\n style={{ pointerEvents: \"none\" }}\n />\n )}\n {label != null && (\n <text\n // A plain attribute, so the host's `[data-private]` rule reaches an SVG\n // <text> exactly as it reaches a table cell.\n data-private={redact ? \"\" : undefined}\n x={textX}\n // A band's name centred in its 20px; a tile's where its floor leaves room below.\n y={py + (group ? 14 : 15) * scale}\n direction={dir}\n {...(group ? BAND_INK : { fill: ink, ...haloOf(halo) })}\n fontSize={labelSize}\n fontWeight={600}\n style={{ pointerEvents: \"none\" }}\n >\n {label}\n </text>\n )}\n {note != null && (\n <text\n x={textX}\n y={py + 29 * scale}\n direction={dir}\n fill={ink}\n fillOpacity={0.85}\n {...haloOf(halo)}\n fontSize={noteSize}\n fontWeight={500}\n style={{ pointerEvents: \"none\" }}\n >\n {note}\n </text>\n )}\n </g>\n );\n}\n\n// ── Chart ─────────────────────────────────────────────────────────────────\n\n// Nodes carry their own `fill`, and `ChartTooltipContent` falls back to it for the\n// swatch, so no series config is needed.\nconst TREEMAP_CONFIG: ChartConfig = {};\n\n/**\n * The shared tooltip with the whole bubble tagged `data-private`, for names that are\n * the user's own data.\n *\n * The bubble, not just the name: `ChartTooltipContent` prints the name either from\n * `item.name` or from a config `label`, and only the config route could be tagged — but\n * a config entry keyed by a payee name is not a CSS identifier, and `ChartStyle` would\n * (rightly) refuse it. The bubble holds the name and the value, and the value cell is\n * already `data-private`, so tagging the wrapper hides nothing extra.\n *\n * recharts CLONES the `content` element to inject `active`/`payload`, so this has to BE\n * that element — a `<div>` wrapped around `<ChartTooltipContent />` in the JSX would\n * take those props itself and hand the tooltip nothing.\n *\n * `groups: false` is `redactNames=\"tiles\"` (0.53): a group's bubble is left untagged, as its\n * frame is. The payload says which node is hovered — recharts hands the node itself, with\n * its laid-out `children` for a group and `null` for a tile, as the cell is told — so\n * anything else, or no payload, is tagged.\n */\nfunction RedactedTooltipContent({\n groups = true,\n ...props\n}: ComponentProps<typeof ChartTooltipContent> & { groups?: boolean }) {\n const children = props.payload?.[0]?.payload?.children;\n const group = Array.isArray(children) && children.length > 0;\n return (\n <div data-private={groups || !group ? true : undefined}>\n <ChartTooltipContent {...props} />\n </div>\n );\n}\n\n/** Where the pointer last entered a node, as drawn: a store of one box, so that only the\n * tooltip re-renders when it moves — not the map, nor (through recharts) every tile. */\ninterface Anchor {\n read: () => Box | null;\n subscribe: (onChange: () => void) => () => void;\n set: (box: Box) => void;\n}\n\nfunction createAnchor(): Anchor {\n let at: Box | null = null;\n const listeners = new Set<() => void>();\n return {\n read: () => at,\n subscribe: (onChange) => {\n listeners.add(onChange);\n return () => listeners.delete(onChange);\n },\n set: (box) => {\n if (at && at.x === box.x && at.y === box.y && at.width === box.width && at.height === box.height) return;\n at = box;\n listeners.forEach((onChange) => onChange());\n },\n };\n}\n\n/**\n * The map's tooltip, stood at the tile the pointer is on AS DRAWN. recharts anchors its\n * tooltip at the centre of the rectangle it laid the node out in, and since 0.52 the map\n * draws its nodes where its own layout puts them (see \"Groups\") — a tooltip anchored by\n * recharts could stand over a neighbour. It stands 10px off the tile's centre, towards the\n * chart's middle, so it does not run off the side the tile is on. `content` is the bubble,\n * as recharts' own `content`.\n */\nfunction TreemapTooltip({ content, anchor }: { content: ReactElement; anchor: Anchor }) {\n const at = useSyncExternalStore(anchor.subscribe, anchor.read, anchor.read);\n const width = useChartWidth() ?? 0;\n const height = useChartHeight() ?? 0;\n if (!at) return <ChartTooltip content={content} />;\n const cx = at.x + at.width / 2;\n const cy = at.y + at.height / 2;\n const left = cx > width / 2;\n const up = cy > height / 2;\n return (\n <ChartTooltip\n content={content}\n position={{ x: cx + (left ? -10 : 10), y: cy + (up ? -10 : 10) }}\n // `translate` composes with the `transform` recharts sets for `position`.\n wrapperStyle={{ translate: `${left ? \"-100%\" : \"0\"} ${up ? \"-100%\" : \"0\"}` }}\n />\n );\n}\n\n/** What `Treemap` hands recharts per node: a tile, or a group with `children`. recharts\n * hands each node's fields to its cell; a field left out of this never reaches\n * `TreemapCell` (0.8.0 shipped `labelColor` without it — keksdose). A type, not an\n * interface: recharts' `data` wants an index signature, which only an alias meets. */\ntype MapNode = {\n id: string;\n name: string;\n /** A tile's value; a group's, its drawn tiles' together. recharts sums a group again\n * for its layout, and its tooltip reads this field. */\n size: number;\n fill: string;\n labelColor?: string;\n /** The ids of the groups round the node, outermost first. */\n groups: readonly string[];\n /** The node's key in the map's keyboard and names: its id and its groups' (see TileKeys). */\n path: string;\n children?: MapNode[];\n};\n\n/** What a group hands down to the tiles inside it that set none of their own. */\ninterface Paint {\n fill: string;\n labelColor?: string;\n shade?: number;\n}\n\n/**\n * `data` as drawn: tiles with a positive value, at most `maxTiles` of them in the order\n * given (depth first), and the groups that still hold any. `shaded` turns a fill and a\n * `shade` into the fill drawn.\n *\n * Coloured by index into `data` AS GIVEN, before anything is dropped: a caller painting a\n * legend or a second map from the same list must land on the same hue for the same row,\n * and filtering first would shift every colour after a gap. Below the top a node takes\n * its group's colour, so a group's tiles share one hue unless they set their own.\n */\nfunction mapNodes(\n data: readonly TreemapNode[],\n ramp: readonly string[],\n maxTiles: number | null | undefined,\n shaded: (fill: string, shade: number | undefined) => string,\n): MapNode[] {\n // Whole tiles, as `slice(0, maxTiles ?? undefined)` counted them up to 0.51: 2.5 draws 2,\n // NaN none and null every one (0.52 code review of treemap.tsx, finding 4 — a bare\n // counter drew 3, and every tile; deep review, charts, finding 2 — Math.floor(null) is 0,\n // and a JS caller's or a `number | null` setting's null drew an empty card).\n let left = maxTiles == null ? Infinity : Number.isNaN(maxTiles) ? 0 : Math.floor(maxTiles);\n const walk = (list: readonly TreemapNode[], groups: readonly string[], paint: Paint | undefined): MapNode[] =>\n list.flatMap((d, idx): MapNode[] => {\n const fill = d.fill ?? paint?.fill ?? ramp[idx % ramp.length]!;\n // An inherited fill brings its ink along (a `color-mix()` group needs its\n // `labelColor`); a fill of the tile's own is measured again.\n const labelColor = d.labelColor ?? (d.fill === undefined ? paint?.labelColor : undefined);\n const shade = d.shade ?? paint?.shade;\n if (d.children && d.children.length > 0) {\n const children = walk(d.children, [...groups, d.id], { fill, labelColor, shade });\n if (children.length === 0) return [];\n const size = children.reduce((acc, c) => acc + c.size, 0);\n return [{ id: d.id, name: d.name, size, fill, groups, path: pathOf(groups, d.id), children }];\n }\n if (!(Number.isFinite(d.value) && d.value > 0) || left <= 0) return [];\n left -= 1;\n const drawn = shaded(fill, shade);\n // An ink the GROUP chose was chosen for the group's colour: once `shade` makes the\n // tile another hex, that hex is measured instead (0.52 code review of treemap.tsx,\n // finding 5 — white ink on a tile shaded almost to the card, ~1.3:1). The tile's\n // own `labelColor` still wins: the caller set it for this tile.\n const ink = d.labelColor ?? (drawn === fill ? labelColor : undefined);\n return [\n { id: d.id, name: d.name, size: d.value, fill: drawn, labelColor: ink, groups, path: pathOf(groups, d.id) },\n ];\n });\n return walk(data, [], undefined);\n}\n\n/** The last layout made for each drawn tree, by size and text size: a memo, not state — it\n * is a pure function of its key, so whichever cell asks first, every cell gets the same. */\nconst LAYOUTS = new WeakMap<readonly MapNode[], { key: string; placed: ReadonlyMap<string, Placed> }>();\n\nfunction layoutFor(nodes: readonly MapNode[], width: number, height: number, scale: number) {\n const key = `${width}x${height}@${scale}`;\n const last = LAYOUTS.get(nodes);\n if (last?.key === key) return last.placed;\n const placed = layoutTreemap(nodes, width, height, scale);\n LAYOUTS.set(nodes, { key, placed });\n return placed;\n}\n\n/** One ref callback per map and path, the same on every render: a new function each time\n * makes React detach and attach the element on every render of the tile. A path no longer\n * drawn is let go as the map lays out its new data (see the map's keyboard). */\nconst REFS = new WeakMap<TileKeys[\"register\"], Map<string, (element: SVGGElement | null) => void>>();\n\nfunction refFor(register: TileKeys[\"register\"], path: string) {\n let byPath = REFS.get(register);\n if (!byPath) {\n byPath = new Map();\n REFS.set(register, byPath);\n }\n let ref = byPath.get(path);\n if (!ref) {\n ref = (element) => register(path, element);\n byPath.set(path, ref);\n }\n return ref;\n}\n\n/** A node's path: its groups' ids and its own, as JSON so that no id can fake a separator. */\nconst pathOf = (groups: readonly string[], id: string) => JSON.stringify([...groups, id]);\n\n/** `nodes` in the order the keyboard walks them: each group, then what is inside it. */\nfunction depthFirst(nodes: readonly MapNode[]): MapNode[] {\n return nodes.flatMap((n) => [n, ...(n.children ? depthFirst(n.children) : [])]);\n}\n\n/**\n * Tile chart: one rectangle per {@link TreemapNode}, sized by `value`, coloured by\n * index from the chart ramp (or by the node's own `fill`), labelled in whichever of the\n * kit's two inks measures better against it. Hover shows the name and the formatted\n * value; every tile is a keyboard stop named with its value and share (see\n * `onNodeClick`), and `onNodeClick` turns the tiles into buttons.\n *\n * A node with `children` is a group (0.52): a labelled frame with its tiles inside, in\n * its colour unless they set their own — see {@link TreemapNode.children}.\n *\n * Renders nothing when no node has a positive value — an empty box is a hole in the\n * card, and the caller's own sentence is the better answer there.\n *\n * Needs `recharts`, like everything behind `@eifi1/ui-kit/chart`.\n */\nexport function Treemap({\n data,\n valueFormatter,\n height = \"20rem\",\n onNodeClick,\n onGroupClick,\n redactNames = false,\n shareInValue = false,\n nodeNote,\n maxTiles,\n colors,\n edges = \"auto\",\n description,\n labels: labelsProp,\n style,\n ...rest\n}: TreemapProps) {\n // Resolved once for every tile, which reads them from `TreemapTiles` (DSP-22).\n const { ramp: tokenHex, card } = useChartTokenHex();\n const edgeFor = useChartEdge();\n const edgesInForce = useEdgesInForce(edges);\n const labels = useKitLabels(\"treemap\", DEFAULT_TREEMAP_LABELS, labelsProp);\n // The provider's locale (0.52, refactor audit 2026-10-30, DOC-10): this was the one\n // formatter default in the kit that took the runtime's.\n const locale = useKitLocale();\n const numberFormat = useMemo(() => new Intl.NumberFormat(locale), [locale]);\n // One decimal under 10 %, the rule PieChart says its shares by too (lib/share-format):\n // a tile of 0.4 % named \"0%\" says it is not there.\n const shareText = useMemo(() => shareFormat(locale), [locale]);\n // Read off the DOM after mount: the `dir` a treemap sits under is an ancestor's\n // attribute, and SVG text anchoring cannot follow it by CSS (see TreemapCell). Again\n // on new data, because a map that had nothing to draw rendered no root to read.\n const rootRef = useRef<HTMLDivElement>(null);\n const [dir, setDir] = useState<Direction>(\"ltr\");\n useLayoutEffect(() => {\n setDir(dirOf(rootRef.current));\n }, [data]);\n const ramp = colors && colors.length > 0 ? colors : tokenHex;\n // Memoised: moving the tab stop re-renders the map, and fresh nodes would re-lay it.\n const nodes = useMemo(\n () =>\n mapNodes(data, ramp, maxTiles, (fill, shade) => {\n // `shade` (0.52): the hue mixed into the card as a hex, so it is measured like\n // any other. A fill or a card it cannot read keeps the full hue.\n if (shade === undefined || !Number.isFinite(shade) || shade >= 1 || !card) return fill;\n const hex = measurableFill(fill, tokenHex);\n return hex ? lerpHex(card, hex, shade) : fill;\n }),\n [data, ramp, maxTiles, tokenHex, card],\n );\n // The keyboard walks groups and tiles alike, in the data's order (see `onNodeClick`).\n const order = useMemo(() => depthFirst(nodes), [nodes]);\n // The map's layout (see \"Groups\"), for the size recharts measured: each cell asks for it\n // by that size, and `layoutFor` makes it once per size and text size.\n const layout = useMemo(\n () => (width: number, height: number, scale: number) => layoutFor(nodes, width, height, scale),\n [nodes],\n );\n // Where the pointer is, for the tooltip to stand at (`TreemapTooltip`).\n const [anchor] = useState(createAnchor);\n\n // The keyboard (DSP-5): one tab stop for the map, moved between tiles in `order` as\n // PieChart's is between slices. The tiles are drawn by recharts, so they register\n // their element here rather than being looked up.\n //\n // The stop is moved on the elements IN PLACE, as PieChart moves its own, and never\n // reaches the tiles' context: kept there, every arrow-key step was a new context and\n // every tile drew again — layout, fitted labels, notes (0.52 code review of treemap.tsx,\n // finding 6). And recharts keys a node by where IT lays it out (`x-y-name`), so new data\n // or a resize remounts the focused node: its element leaves holding the focus, which\n // fell to <body> (finding 7). The path it held is kept, and its new element takes the\n // focus back as it mounts — or, if the node is gone, the stop does.\n const tiles = useRef(new Map<string, SVGGElement>());\n const orderRef = useRef(order);\n const stopRef = useRef<string | undefined>(undefined);\n const restoreRef = useRef<string | null>(null);\n /** The path holding the stop: the last one focused while it is drawn, else the first. */\n const stopOf = useCallback(() => {\n const drawn = orderRef.current;\n return drawn.some((n) => n.path === stopRef.current) ? stopRef.current : drawn[0]?.path;\n }, []);\n const applyStop = useCallback(() => {\n const at = stopOf();\n tiles.current.forEach((el, path) => el.setAttribute(\"tabindex\", path === at ? \"0\" : \"-1\"));\n return at;\n }, [stopOf]);\n const register = useCallback(\n (path: string, element: SVGGElement | null) => {\n if (element) {\n tiles.current.set(path, element);\n element.setAttribute(\"tabindex\", path === stopOf() ? \"0\" : \"-1\");\n if (restoreRef.current === path) {\n restoreRef.current = null;\n element.focus();\n }\n return;\n }\n // Detached before it is removed: still the focused element if it held the focus.\n // Kept for this commit only — the node's new element mounts in it, or the effect below\n // hands the focus on. A node that left with no new data (`<Activity mode=\"hidden\">`, a\n // panel 0 wide) took the focus back whenever it was shown again, from wherever the\n // reader was by then (0.52 code review, deep, charts, finding 3).\n if (tiles.current.get(path) === document.activeElement) {\n restoreRef.current = path;\n queueMicrotask(() => {\n if (restoreRef.current === path) restoreRef.current = null;\n });\n }\n tiles.current.delete(path);\n },\n [stopOf],\n );\n const onFocus = useCallback(\n (path: string) => {\n stopRef.current = path;\n applyStop();\n },\n [applyStop],\n );\n // New data: the order the stop is read against, the stop set again on what is drawn now,\n // the focus of a node that is gone handed to the stop — and the ref callbacks of the paths\n // no longer drawn let go: a map that switched data (a month picker over payees) kept one\n // for every node it had ever drawn (0.52 code review, deep, charts, finding 11).\n useLayoutEffect(() => {\n orderRef.current = order;\n const refs = REFS.get(register);\n if (refs) {\n const drawn = new Set(order.map((n) => n.path));\n for (const path of refs.keys()) if (!drawn.has(path)) refs.delete(path);\n }\n const at = applyStop();\n if (restoreRef.current === null) return;\n restoreRef.current = null;\n if (at) tiles.current.get(at)?.focus();\n }, [order, applyStop, register]);\n const move = useCallback((path: string, event: KeyboardEvent<SVGGElement>) => {\n const drawn = orderRef.current;\n const at = drawn.findIndex((n) => n.path === path);\n // The ends hold: a map is a plane, not PieChart's ring. → is the next tile in any page:\n // the tiles are laid out left to right whatever the reading direction (the plot is not\n // mirrored, see `ChartContainer`), and → read off the page walked an RTL page's map\n // backwards, against the picture (0.52 code review, deep, charts, finding 1).\n const to = at < 0 ? undefined : rovingTarget(event.key, \"ltr\", at, drawn.length, false);\n if (to === undefined) return false;\n const target = drawn[to];\n if (target) tiles.current.get(target.path)?.focus();\n return true;\n }, []);\n\n // Everything below is memoised over what it reads (0.52, code review of feat/0.52.0). A\n // tile re-renders when its context or its recharts element changes, and recharts' map is\n // a PureComponent that redraws every node when `content` or its tooltip child is a new\n // element: built afresh per render, as they were, a page re-rendering the card or one\n // arrow-key step redrew every tile and ran `labels.tile` and two `Intl` formats per node\n // again — the cost DSP-22 had just taken out of the tiles.\n //\n // The share is of what is DRAWN, so it always reads as \"of this picture\" — a group's\n // and a tile's inside it alike.\n const total = useMemo(() => nodes.reduce((acc, n) => acc + n.size, 0), [nodes]);\n const format = useCallback(\n (v: number): ReactNode =>\n valueFormatter ? valueFormatter(v, total > 0 ? v / total : undefined) : formatWithMinus(numberFormat, v),\n [valueFormatter, total, numberFormat],\n );\n const names = useMemo(() => {\n // The value as the tooltip says it: the caller's formatter, handed the node's share as\n // it is there, when it gives text; a value it formats as markup is said as a number.\n //\n // It was asked with the share `undefined` — which, with anything drawn, it had never\n // been before 0.52 — so a formatter leaning on the share printed \"NaN%\" into every name\n // or threw and took the chart down (0.52 code review of treemap.tsx, finding 2). A guard\n // caught both; every named node has its share, so it is handed over instead (deep\n // review, charts, finding 13).\n const valueText = (v: number) => {\n const out = format(v);\n return typeof out === \"string\" || typeof out === \"number\" ? String(out) : formatWithMinus(numberFormat, v);\n };\n // A group's name by its path; a node's groups by theirs, its own path's prefixes.\n const groupName = new Map(order.filter((n) => n.children).map((n) => [n.path, n.name]));\n // `\"\"` when the formatter's text says the share already, which every template drops\n // (0.53, `shareInValue`).\n const shareOf = (v: number) => (shareInValue ? \"\" : shareText(total > 0 ? v / total : 0));\n return new Map(\n order.map((n) => {\n const say = n.children ? labels.group : labels.tile;\n const own = say(n.name, valueText(n.size), shareOf(n.size));\n // The innermost group first: \"Rent: …, in Housing, in Fixed costs\".\n const named = n.groups\n .map((g, i) => groupName.get(pathOf(n.groups.slice(0, i), g)) ?? g)\n .reduceRight((acc, group) => labels.inGroup(acc, group), own);\n return [n.path, named] as const;\n }),\n );\n }, [order, labels, format, numberFormat, shareText, shareInValue, total]);\n const keys = useMemo<TileKeys>(\n () => ({ name: (path) => names.get(path), onFocus, register, move }),\n [names, onFocus, register, move],\n );\n const context = useMemo<TileContext>(\n () => ({ tokens: tokenHex, edgeFor, edges: edgesInForce, keys, layout, hover: anchor.set }),\n [tokenHex, edgeFor, edgesInForce, keys, layout, anchor],\n );\n const cell = useMemo(\n () => (\n <TreemapCell\n onNodeClick={onNodeClick}\n onGroupClick={onGroupClick}\n redactNames={redactNames}\n nodeNote={nodeNote}\n dir={dir}\n />\n ),\n [onNodeClick, onGroupClick, redactNames, nodeNote, dir],\n );\n const tooltip = useMemo(\n () => (\n <TreemapTooltip\n content={\n redactNames ? (\n <RedactedTooltipContent hideLabel valueFormatter={format} groups={redactNames === true} />\n ) : (\n <ChartTooltipContent hideLabel valueFormatter={format} />\n )\n }\n anchor={anchor}\n />\n ),\n [redactNames, format, anchor],\n );\n\n if (nodes.length === 0) return null;\n const box = chartHeightProps(height);\n return (\n // Round the container, not inside it: ResponsiveContainer sizes its ONE child, the chart.\n <TreemapTiles.Provider value={context}>\n <ChartContainer\n role=\"figure\"\n {...rest}\n // Read through `aria-describedby`, after a caller's own ids; `hidden`, inside the\n // figure (0.52 code review, deep, charts, finding 7).\n description={description}\n ref={rootRef}\n config={TREEMAP_CONFIG}\n className={cn(box.className, rest.className)}\n style={{ ...style, ...box.style }}\n >\n {/* No chart-level `stroke`: recharts spreads it onto the <svg> root, from where\n it inherits into every label (see TreemapCell). Each cell strokes its own rect. */}\n <RechartsTreemap data={nodes} dataKey=\"size\" fill=\"var(--chart-1)\" isAnimationActive={false} content={cell}>\n {tooltip}\n </RechartsTreemap>\n </ChartContainer>\n </TreemapTiles.Provider>\n );\n}\n"],"mappings":";AAife,cA4HX,YA5HW;AAnef;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,WAAW,iBAAiB,gBAAgB,qBAAqB;AAC1E,SAAS,gBAAgB,cAAc,2BAA6C;AACpF,SAAS,aAAa,aAAa,cAAc,SAAS,cAAc;AACxE,SAAS,mBAAmB,cAAc,uBAAwC;AAClF,SAAS,gBAAgB;AACzB,SAAS,OAAO,oBAAoC;AACpD,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,wBAA0C;AACnD,SAAS,uBAAuB;AAChC,SAAS,cAAc,oBAAwC;AAC/D,SAAS,8BAAkD;AAC3D,SAAS,WAAW,qBAA4C;AAiPhE,MAAM,eAAe;AAKrB,SAAS,kBAA0B;AACjC,QAAM,OAAO,SAAS;AACtB,QAAM,WAAW,KAAK,UAAU,SAAS,MAAM,IAAI,YAAY,OAAO,YAAY;AAClF,QAAM,QAAQ,iBAAiB,IAAI;AACnC,QAAM,OAAO,MAAM,KAAK,EAAE,QAAQ,aAAa,GAAG,CAAC,GAAG,MAAM;AAC1D,UAAM,IAAI,MAAM,iBAAiB,WAAW,IAAI,CAAC,EAAE,EAAE,KAAK;AAG1D,WAAO,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC;AAAA,EACrC,CAAC,EAAE,KAAK,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;AAAA;AAAA,IAEE,oBAAC,aAAa,UAAb,EAAsB,OAAO,SAC5B;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACJ,GAAG;AAAA,QAGJ;AAAA,QACA,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,WAAW,GAAG,IAAI,WAAW,KAAK,SAAS;AAAA,QAC3C,OAAO,EAAE,GAAG,OAAO,GAAG,IAAI,MAAM;AAAA,QAIhC,8BAAC,mBAAgB,MAAM,OAAO,SAAQ,QAAO,MAAK,kBAAiB,mBAAmB,OAAO,SAAS,MACnG,mBACH;AAAA;AAAA,IACF,GACF;AAAA;AAEJ;","names":["height"]}
@@ -5,13 +5,8 @@ export * from "./components/data-table-pagination.js";
5
5
  export { FilterPopover } from "./components/data-table-filter-popover.js";
6
6
  export { DataTable, DEFAULT_DATA_TABLE_SORT_LABELS } from "./components/data-table.js";
7
7
  export type { DataTableSortLabels, DataTableColumn, DataTableCellProps, DataTableHeadProps, DataTableProps, ServerPagination, FilterState, MobileSwipeActions, DataTableDensity, DataTableChrome, DataTableRowAction, DataTableDesktopSwipeActions, } from "./components/data-table.js";
8
- export {
9
- /** @deprecated 0.52 — `DataTable`'s `desktopSwipeActions`, which builds its column with it (API-4); removed in 0.53 */
10
- swipePlanRowActions, } from "./components/data-table-row-actions.js";
11
8
  export type { DataTableGroupBy, DataTableLoadMore } from "./components/data-table-groups.js";
12
9
  export type { DataTableVirtualize } from "./components/data-table-virtual.js";
13
10
  export * from "./components/data-table-cells.js";
14
- export { useTableUrlState,
15
- /** @deprecated 0.52 — `useTableUrlState`, which reads the URL with it (API-4); removed in 0.53 */
16
- readTableUrlState, } from "./components/use-table-state.js";
11
+ export { useTableUrlState } from "./components/use-table-state.js";
17
12
  export type { TableUrlState, TableUrlSync, TableUrlStateProps, UseTableUrlStateOptions, UseTableUrlStateReturn, } from "./components/use-table-state.js";
@@ -5,20 +5,12 @@ export * from "./components/data-table-filters.js";
5
5
  export * from "./components/data-table-pagination.js";
6
6
  import { FilterPopover } from "./components/data-table-filter-popover.js";
7
7
  import { DataTable, DEFAULT_DATA_TABLE_SORT_LABELS } from "./components/data-table.js";
8
- import {
9
- swipePlanRowActions
10
- } from "./components/data-table-row-actions.js";
11
8
  export * from "./components/data-table-cells.js";
12
- import {
13
- useTableUrlState,
14
- readTableUrlState
15
- } from "./components/use-table-state.js";
9
+ import { useTableUrlState } from "./components/use-table-state.js";
16
10
  export {
17
11
  DEFAULT_DATA_TABLE_SORT_LABELS,
18
12
  DataTable,
19
13
  FilterPopover,
20
- readTableUrlState,
21
- swipePlanRowActions,
22
14
  useTableUrlState
23
15
  };
24
16
  //# sourceMappingURL=data-table.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data-table.ts"],"sourcesContent":["// `@eifi1/ui-kit/data-table` — the table suite.\n//\n// A re-slicing of the main barrel, not a new API. This entry point imports\n// `react-router` (a peer dependency), but since 0.49 (KIT-3) a Router is needed only for\n// a table with `urlSync`: without it DataTable keeps its view in local state alone.\nexport * from \"./components/data-table-labels\";\nexport * from \"./components/data-table-sort\";\nexport * from \"./components/data-table-filters\";\nexport * from \"./components/data-table-pagination\";\nexport { FilterPopover } from \"./components/data-table-filter-popover\";\n// `SortState` comes from data-table-sort above; re-exporting the module wholesale\n// would collide with it, which is why the main barrel names these explicitly too.\nexport { DataTable, DEFAULT_DATA_TABLE_SORT_LABELS } from \"./components/data-table\";\nexport type {\n DataTableSortLabels,\n DataTableColumn,\n // The barrel had these two and this entry did not (refactor audit 2026-10, MOD-5):\n // the types of a column's `cellProps` and `headProps`.\n DataTableCellProps,\n DataTableHeadProps,\n DataTableProps,\n ServerPagination,\n FilterState,\n MobileSwipeActions,\n DataTableDensity,\n DataTableChrome,\n DataTableRowAction,\n DataTableDesktopSwipeActions,\n} from \"./components/data-table\";\n// 0.46.1 (keksdose N3): a swipe plan as `RowActions`' actions — the desktop column's own\n// derivation, for an app's hand-built actions column.\nexport {\n /** @deprecated 0.52 — `DataTable`'s `desktopSwipeActions`, which builds its column with it (API-4); removed in 0.53 */\n swipePlanRowActions,\n} from \"./components/data-table-row-actions\";\n// 0.48 (keksdose dev #605): a `groupBy` level (also `mobileGroupBy`'s) and the `loadMore` footer.\nexport type { DataTableGroupBy, DataTableLoadMore } from \"./components/data-table-groups\";\n// 0.48.2 (keksdose dev #632): `virtualize`'s options.\nexport type { DataTableVirtualize } from \"./components/data-table-virtual\";\nexport * from \"./components/data-table-cells\";\nexport {\n useTableUrlState,\n /** @deprecated 0.52 — `useTableUrlState`, which reads the URL with it (API-4); removed in 0.53 */\n readTableUrlState,\n} from \"./components/use-table-state\";\nexport type {\n TableUrlState,\n TableUrlSync,\n TableUrlStateProps,\n UseTableUrlStateOptions,\n UseTableUrlStateReturn,\n} from \"./components/use-table-state\";\n"],"mappings":";AAKA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,qBAAqB;AAG9B,SAAS,WAAW,sCAAsC;AAmB1D;AAAA,EAEE;AAAA,OACK;AAKP,cAAc;AACd;AAAA,EACE;AAAA,EAEA;AAAA,OACK;","names":[]}
1
+ {"version":3,"sources":["../src/data-table.ts"],"sourcesContent":["// `@eifi1/ui-kit/data-table` — the table suite.\n//\n// A re-slicing of the main barrel, not a new API. This entry point imports\n// `react-router` (a peer dependency), but since 0.49 (KIT-3) a Router is needed only for\n// a table with `urlSync`: without it DataTable keeps its view in local state alone.\nexport * from \"./components/data-table-labels\";\nexport * from \"./components/data-table-sort\";\nexport * from \"./components/data-table-filters\";\nexport * from \"./components/data-table-pagination\";\nexport { FilterPopover } from \"./components/data-table-filter-popover\";\n// `SortState` comes from data-table-sort above; re-exporting the module wholesale\n// would collide with it, which is why the main barrel names these explicitly too.\nexport { DataTable, DEFAULT_DATA_TABLE_SORT_LABELS } from \"./components/data-table\";\nexport type {\n DataTableSortLabels,\n DataTableColumn,\n // The barrel had these two and this entry did not (refactor audit 2026-10, MOD-5):\n // the types of a column's `cellProps` and `headProps`.\n DataTableCellProps,\n DataTableHeadProps,\n DataTableProps,\n ServerPagination,\n FilterState,\n MobileSwipeActions,\n DataTableDensity,\n DataTableChrome,\n DataTableRowAction,\n DataTableDesktopSwipeActions,\n} from \"./components/data-table\";\n// 0.48 (keksdose dev #605): a `groupBy` level (also `mobileGroupBy`'s) and the `loadMore` footer.\nexport type { DataTableGroupBy, DataTableLoadMore } from \"./components/data-table-groups\";\n// 0.48.2 (keksdose dev #632): `virtualize`'s options.\nexport type { DataTableVirtualize } from \"./components/data-table-virtual\";\nexport * from \"./components/data-table-cells\";\nexport { useTableUrlState } from \"./components/use-table-state\";\nexport type {\n TableUrlState,\n TableUrlSync,\n TableUrlStateProps,\n UseTableUrlStateOptions,\n UseTableUrlStateReturn,\n} from \"./components/use-table-state\";\n"],"mappings":";AAKA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,qBAAqB;AAG9B,SAAS,WAAW,sCAAsC;AAqB1D,cAAc;AACd,SAAS,wBAAwB;","names":[]}
@@ -28,11 +28,6 @@ export interface DemoCountdown {
28
28
  /** The demo's time is up. */
29
29
  ended: boolean;
30
30
  }
31
- /**
32
- * The countdown at `now` — pure, for a test or a server-rendered value. See
33
- * {@link DemoCountdown} for the rounding and the thresholds.
34
- */
35
- export declare function demoCountdown(expiresAt: DemoExpiry | null | undefined, now: number): DemoCountdown;
36
31
  export interface DemoCountdownOptions {
37
32
  /**
38
33
  * The clock, in epoch milliseconds. Default `Date.now`. A test passes its own (or uses