@alfadocs/ui-kit-debug 0.81.0 → 0.83.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 (141) hide show
  1. package/dist/_chunks/{actions-cell-renderer-DLrcSTK_.js → actions-cell-renderer-DaL80uqL.js} +2 -2
  2. package/dist/_chunks/{actions-cell-renderer-DLrcSTK_.js.map → actions-cell-renderer-DaL80uqL.js.map} +1 -1
  3. package/dist/_chunks/chart-GFLv4cXm.js +609 -0
  4. package/dist/_chunks/chart-GFLv4cXm.js.map +1 -0
  5. package/dist/_chunks/{editable-currency-cell-renderer-GwfA9tTR.js → editable-currency-cell-renderer-Dus_sBvX.js} +2 -2
  6. package/dist/_chunks/{editable-currency-cell-renderer-GwfA9tTR.js.map → editable-currency-cell-renderer-Dus_sBvX.js.map} +1 -1
  7. package/dist/_chunks/{face-scheme-C0rk21gg.js → face-scheme-CjQAHvSP.js} +2 -2
  8. package/dist/_chunks/{face-scheme-C0rk21gg.js.map → face-scheme-CjQAHvSP.js.map} +1 -1
  9. package/dist/_chunks/{file-manager-DfTG7bxx.js → file-manager-DLJlinIO.js} +3 -3
  10. package/dist/_chunks/{file-manager-DfTG7bxx.js.map → file-manager-DLJlinIO.js.map} +1 -1
  11. package/dist/_chunks/{header-settings-DMfdx0Vq.js → header-settings-CLwFqMHI.js} +2 -2
  12. package/dist/_chunks/{header-settings-DMfdx0Vq.js.map → header-settings-CLwFqMHI.js.map} +1 -1
  13. package/dist/_chunks/{icon-button-group-C_lqXTAj.js → icon-button-group-BLHPN6jg.js} +178 -163
  14. package/dist/_chunks/icon-button-group-BLHPN6jg.js.map +1 -0
  15. package/dist/_chunks/{marketplace-app-shell-Bxq1PYAj.js → marketplace-app-shell-Br2yebEK.js} +2 -2
  16. package/dist/_chunks/{marketplace-app-shell-Bxq1PYAj.js.map → marketplace-app-shell-Br2yebEK.js.map} +1 -1
  17. package/dist/_chunks/{patient-table-DweKjiXg.js → patient-table-BHzmUbzu.js} +2 -2
  18. package/dist/_chunks/{patient-table-DweKjiXg.js.map → patient-table-BHzmUbzu.js.map} +1 -1
  19. package/dist/_chunks/{payment-request-card-C0fqlKqO.js → payment-request-card-d-RmzsUd.js} +15 -13
  20. package/dist/_chunks/{payment-request-card-C0fqlKqO.js.map → payment-request-card-d-RmzsUd.js.map} +1 -1
  21. package/dist/_chunks/{theme-toggle-BJCz_UOi.js → theme-toggle-B4mOrQX1.js} +2 -2
  22. package/dist/_chunks/{theme-toggle-BJCz_UOi.js.map → theme-toggle-B4mOrQX1.js.map} +1 -1
  23. package/dist/agent-catalog.json +139 -4
  24. package/dist/agent-i18n/en.json +14 -1
  25. package/dist/components/chart/chart.agent.d.ts.map +1 -1
  26. package/dist/components/chart/chart.d.ts +36 -1
  27. package/dist/components/chart/chart.d.ts.map +1 -1
  28. package/dist/components/chart/index.js +1 -1
  29. package/dist/components/data-table/index.js +2 -2
  30. package/dist/components/face-scheme/index.js +1 -1
  31. package/dist/components/file-manager/index.js +1 -1
  32. package/dist/components/header-settings/index.js +1 -1
  33. package/dist/components/icon-button-group/icon-button-group.d.ts.map +1 -1
  34. package/dist/components/icon-button-group/index.js +1 -1
  35. package/dist/components/index.d.ts +1 -0
  36. package/dist/components/index.d.ts.map +1 -1
  37. package/dist/components/patient-table/index.js +1 -1
  38. package/dist/components/payment-card/index.js +1 -1
  39. package/dist/components/theme-toggle/index.js +1 -1
  40. package/dist/i18n/locales/ar.d.ts +8 -0
  41. package/dist/i18n/locales/ar.d.ts.map +1 -1
  42. package/dist/i18n/locales/ar.js +8 -0
  43. package/dist/i18n/locales/ar.js.map +1 -1
  44. package/dist/i18n/locales/de.d.ts +8 -0
  45. package/dist/i18n/locales/de.d.ts.map +1 -1
  46. package/dist/i18n/locales/de.js +8 -0
  47. package/dist/i18n/locales/de.js.map +1 -1
  48. package/dist/i18n/locales/el.d.ts +8 -0
  49. package/dist/i18n/locales/el.d.ts.map +1 -1
  50. package/dist/i18n/locales/el.js +8 -0
  51. package/dist/i18n/locales/el.js.map +1 -1
  52. package/dist/i18n/locales/en.d.ts +8 -0
  53. package/dist/i18n/locales/en.d.ts.map +1 -1
  54. package/dist/i18n/locales/en.js +8 -0
  55. package/dist/i18n/locales/en.js.map +1 -1
  56. package/dist/i18n/locales/es.d.ts +8 -0
  57. package/dist/i18n/locales/es.d.ts.map +1 -1
  58. package/dist/i18n/locales/es.js +8 -0
  59. package/dist/i18n/locales/es.js.map +1 -1
  60. package/dist/i18n/locales/fr.d.ts +8 -0
  61. package/dist/i18n/locales/fr.d.ts.map +1 -1
  62. package/dist/i18n/locales/fr.js +8 -0
  63. package/dist/i18n/locales/fr.js.map +1 -1
  64. package/dist/i18n/locales/hi.d.ts +8 -0
  65. package/dist/i18n/locales/hi.d.ts.map +1 -1
  66. package/dist/i18n/locales/hi.js +8 -0
  67. package/dist/i18n/locales/hi.js.map +1 -1
  68. package/dist/i18n/locales/it.d.ts +8 -0
  69. package/dist/i18n/locales/it.d.ts.map +1 -1
  70. package/dist/i18n/locales/it.js +8 -0
  71. package/dist/i18n/locales/it.js.map +1 -1
  72. package/dist/i18n/locales/ja.d.ts +8 -0
  73. package/dist/i18n/locales/ja.d.ts.map +1 -1
  74. package/dist/i18n/locales/ja.js +8 -0
  75. package/dist/i18n/locales/ja.js.map +1 -1
  76. package/dist/i18n/locales/nl.d.ts +8 -0
  77. package/dist/i18n/locales/nl.d.ts.map +1 -1
  78. package/dist/i18n/locales/nl.js +8 -0
  79. package/dist/i18n/locales/nl.js.map +1 -1
  80. package/dist/i18n/locales/pl.d.ts +8 -0
  81. package/dist/i18n/locales/pl.d.ts.map +1 -1
  82. package/dist/i18n/locales/pl.js +8 -0
  83. package/dist/i18n/locales/pl.js.map +1 -1
  84. package/dist/i18n/locales/pt.d.ts +8 -0
  85. package/dist/i18n/locales/pt.d.ts.map +1 -1
  86. package/dist/i18n/locales/pt.js +8 -0
  87. package/dist/i18n/locales/pt.js.map +1 -1
  88. package/dist/i18n/locales/ro.d.ts +8 -0
  89. package/dist/i18n/locales/ro.d.ts.map +1 -1
  90. package/dist/i18n/locales/ro.js +8 -0
  91. package/dist/i18n/locales/ro.js.map +1 -1
  92. package/dist/i18n/locales/ru.d.ts +8 -0
  93. package/dist/i18n/locales/ru.d.ts.map +1 -1
  94. package/dist/i18n/locales/ru.js +8 -0
  95. package/dist/i18n/locales/ru.js.map +1 -1
  96. package/dist/i18n/locales/sq.d.ts +8 -0
  97. package/dist/i18n/locales/sq.d.ts.map +1 -1
  98. package/dist/i18n/locales/sq.js +8 -0
  99. package/dist/i18n/locales/sq.js.map +1 -1
  100. package/dist/i18n/locales/sv.d.ts +8 -0
  101. package/dist/i18n/locales/sv.d.ts.map +1 -1
  102. package/dist/i18n/locales/sv.js +8 -0
  103. package/dist/i18n/locales/sv.js.map +1 -1
  104. package/dist/i18n/locales/tr.d.ts +8 -0
  105. package/dist/i18n/locales/tr.d.ts.map +1 -1
  106. package/dist/i18n/locales/tr.js +8 -0
  107. package/dist/i18n/locales/tr.js.map +1 -1
  108. package/dist/i18n/locales/zh.d.ts +8 -0
  109. package/dist/i18n/locales/zh.d.ts.map +1 -1
  110. package/dist/i18n/locales/zh.js +8 -0
  111. package/dist/i18n/locales/zh.js.map +1 -1
  112. package/dist/index.js +1270 -963
  113. package/dist/index.js.map +1 -1
  114. package/dist/locales/ar.json +8 -0
  115. package/dist/locales/de.json +8 -0
  116. package/dist/locales/el.json +8 -0
  117. package/dist/locales/en.json +8 -0
  118. package/dist/locales/es.json +8 -0
  119. package/dist/locales/fr.json +8 -0
  120. package/dist/locales/hi.json +8 -0
  121. package/dist/locales/it.json +8 -0
  122. package/dist/locales/ja.json +8 -0
  123. package/dist/locales/nl.json +8 -0
  124. package/dist/locales/pl.json +8 -0
  125. package/dist/locales/pt.json +8 -0
  126. package/dist/locales/ro.json +8 -0
  127. package/dist/locales/ru.json +8 -0
  128. package/dist/locales/sq.json +8 -0
  129. package/dist/locales/sv.json +8 -0
  130. package/dist/locales/tr.json +8 -0
  131. package/dist/locales/zh.json +8 -0
  132. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  133. package/dist/patterns/payment-automation-upsell/index.d.ts +3 -0
  134. package/dist/patterns/payment-automation-upsell/index.d.ts.map +1 -0
  135. package/dist/patterns/payment-automation-upsell/payment-automation-upsell.d.ts +93 -0
  136. package/dist/patterns/payment-automation-upsell/payment-automation-upsell.d.ts.map +1 -0
  137. package/dist/tokens.css +1 -1
  138. package/package.json +1 -1
  139. package/dist/_chunks/chart-CpkpA74k.js +0 -374
  140. package/dist/_chunks/chart-CpkpA74k.js.map +0 -1
  141. package/dist/_chunks/icon-button-group-C_lqXTAj.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit-debug",
3
- "version": "0.81.0",
3
+ "version": "0.83.0",
4
4
  "type": "module",
5
5
  "description": "AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe. (debug build — identical runtime to @alfadocs/ui-kit, ships source maps for symbolication).",
6
6
  "license": "BUSL-1.1",
@@ -1,374 +0,0 @@
1
- import { jsxs as S, jsx as d } from "react/jsx-runtime";
2
- import { forwardRef as et, useId as rt, useMemo as c, useRef as at, useState as U, useEffect as k, useImperativeHandle as ot } from "react";
3
- import { c as nt } from "./index-D2ZczOXr.js";
4
- import { useTranslation as it } from "react-i18next";
5
- import st from "react-apexcharts";
6
- import H from "apexcharts";
7
- import { u as ct, g as _ } from "./apexcharts-theme-BJigns_V.js";
8
- import { u as dt } from "./use-prefers-reduced-motion-BMwIQRjB.js";
9
- import { u as lt } from "./registry-DvAUVLHh.js";
10
- const mt = {
11
- id: "chart",
12
- capabilities: [],
13
- state: {},
14
- actions: {
15
- update_series: {
16
- // Replacing the rendered series mutates what the chart displays — it
17
- // is a write, reversible by pushing the prior series back.
18
- safety: "write",
19
- argsType: "series",
20
- // `series` is `ChartSeries[]` (line/bar/area) OR `number[]`
21
- // (pie/donut/radialBar). Both shapes are accepted; the handle routes
22
- // by chart type internally.
23
- argsSchema: {
24
- type: "object",
25
- properties: {
26
- series: {
27
- oneOf: [
28
- {
29
- type: "array",
30
- description: "Categorical series for line / bar / area charts.",
31
- items: {
32
- type: "object",
33
- properties: {
34
- name: { type: "string" },
35
- data: { type: "array", items: { type: "number" } }
36
- },
37
- required: ["name", "data"]
38
- }
39
- },
40
- {
41
- type: "array",
42
- description: "Flat values for pie / donut / radialBar charts.",
43
- items: { type: "number" }
44
- }
45
- ]
46
- }
47
- },
48
- required: ["series"]
49
- },
50
- idempotent: !0,
51
- descriptionKey: "ui.agent.chart.actions.updateSeries",
52
- description: "Replace the chart series without remounting.",
53
- invoke: (o, l) => {
54
- o.updateSeries(l.series);
55
- }
56
- },
57
- export_png: {
58
- safety: "read",
59
- returns: "string (PNG data URI)",
60
- returnsSchema: {
61
- type: "string",
62
- description: "A `data:image/png;base64,…` URI of the rendered chart."
63
- },
64
- idempotent: !0,
65
- descriptionKey: "ui.agent.chart.actions.exportPng",
66
- description: "Return a PNG data URI of the chart for export or screenshotting.",
67
- invoke: (o) => o.dataURI()
68
- }
69
- },
70
- domHooks: {
71
- root: { attr: "data-component", value: "chart" },
72
- instanceId: {
73
- attr: "data-component-id",
74
- sourceProp: "id",
75
- description: "Sourced from the id prop."
76
- }
77
- }
78
- }, ut = nt("ds:relative ds:block ds:w-full", {
79
- variants: {
80
- density: {
81
- compact: "ds:min-h-[var(--chart-min-height-compact)]",
82
- comfortable: "ds:min-h-[var(--chart-min-height-comfortable)]",
83
- // Applied when an explicit `height` prop is given and no density was
84
- // requested: the wrapper must not exceed the caller's height (a 96px
85
- // KPI chart inside a card must not reserve 320px).
86
- none: ""
87
- }
88
- },
89
- defaultVariants: { density: "comfortable" }
90
- }), pt = [
91
- "verticalLines",
92
- "horizontalLines",
93
- "slantedLines",
94
- "squares",
95
- "circles"
96
- ], ht = ["line", "bar", "area"], ft = ["pie", "donut", "radialBar"];
97
- function T(o) {
98
- return ft.includes(o);
99
- }
100
- function bt(o) {
101
- return ht.includes(o);
102
- }
103
- function gt(o, l) {
104
- return T(l) ? [
105
- {
106
- name: "",
107
- data: o
108
- }
109
- ] : o;
110
- }
111
- const yt = et(
112
- ({
113
- title: o,
114
- id: l,
115
- type: r,
116
- series: h,
117
- categories: y,
118
- labels: f,
119
- height: O,
120
- width: M,
121
- patterns: A = !1,
122
- colors: v,
123
- toolbar: x = !1,
124
- locale: j,
125
- radialValueFormatter: m,
126
- valueFormatter: N,
127
- density: D,
128
- className: W
129
- }, q) => {
130
- const { t: a, i18n: Y } = it(), P = rt(), u = c(
131
- () => `chart-${P.replace(/[^a-zA-Z0-9-_]/g, "")}`,
132
- [P]
133
- ), R = `${u}-summary`, I = at(null), [z, Z] = U(0);
134
- ct(I);
135
- const p = j ?? Y.language ?? "en", [B, K] = U(
136
- () => {
137
- try {
138
- return _();
139
- } catch {
140
- return {};
141
- }
142
- }
143
- );
144
- k(() => {
145
- if (typeof document > "u") return;
146
- let t;
147
- const e = new MutationObserver(() => {
148
- clearTimeout(t), t = setTimeout(() => {
149
- try {
150
- K(_());
151
- } catch {
152
- }
153
- }, 50);
154
- });
155
- return e.observe(document.documentElement, {
156
- attributes: !0,
157
- attributeFilter: ["class"]
158
- }), () => {
159
- clearTimeout(t), e.disconnect();
160
- };
161
- }, []), k(() => {
162
- const t = I.current;
163
- if (!t || typeof ResizeObserver > "u") return;
164
- const e = new ResizeObserver((n) => {
165
- const i = n[0];
166
- i && Z(Math.floor(i.contentRect.width));
167
- });
168
- return e.observe(t), () => e.disconnect();
169
- }, []);
170
- const C = c(
171
- () => ({
172
- async dataURI() {
173
- const t = H.getChartByID(u);
174
- return t ? (await t.dataURI()).imgURI : "";
175
- },
176
- updateSeries(t) {
177
- const e = H.getChartByID(u);
178
- e && (T(r), e.updateSeries(t));
179
- }
180
- }),
181
- [u, r]
182
- );
183
- ot(q, () => C, [C]), lt(mt, C, l);
184
- const w = typeof document < "u" && document.documentElement.dir === "rtl", E = c(
185
- () => gt(h, r),
186
- [h, r]
187
- ), $ = c(
188
- () => new Intl.NumberFormat(p),
189
- [p]
190
- ), b = c(
191
- () => N ?? ((t) => $.format(t)),
192
- [N, $]
193
- ), G = c(
194
- () => ({
195
- name: p,
196
- options: {
197
- toolbar: {
198
- download: a("chart.toolbar.download"),
199
- selection: a("chart.toolbar.selection"),
200
- selectionZoom: a("chart.toolbar.selectionZoom"),
201
- zoomIn: a("chart.toolbar.zoomIn"),
202
- zoomOut: a("chart.toolbar.zoomOut"),
203
- pan: a("chart.toolbar.pan"),
204
- reset: a("chart.toolbar.reset"),
205
- exportToSVG: a("chart.toolbar.exportToSVG"),
206
- exportToPNG: a("chart.toolbar.exportToPNG"),
207
- exportToCSV: a("chart.toolbar.exportToCSV")
208
- }
209
- }
210
- }),
211
- [p, a]
212
- ), L = dt(), V = c(() => {
213
- var n, i, g;
214
- const t = B, e = {
215
- ...t,
216
- chart: {
217
- ...t.chart,
218
- id: u,
219
- toolbar: { show: x },
220
- zoom: { enabled: x },
221
- animations: {
222
- enabled: !L,
223
- dynamicAnimation: { enabled: !L }
224
- },
225
- locales: [G],
226
- defaultLocale: p,
227
- parentHeightOffset: 0
228
- },
229
- // Only set `labels` when the consumer actually supplied them (slice
230
- // charts). Emitting `labels: undefined` crashes ApexCharts' bar
231
- // renderer — `parseDataAxisCharts` reads `labels.length` and throws
232
- // "Cannot read properties of undefined (reading 'length')", which
233
- // aborts the render and leaves a blank chart. Absent is safe; area /
234
- // line tolerate the undefined but bar does not, so never pass it.
235
- ...f ? { labels: f } : {},
236
- legend: {
237
- ...t.legend,
238
- position: "bottom",
239
- // ApexCharts legend.horizontalAlign is a physical prop mapped internally
240
- // to the chart's own text flow. For RTL we flip via `yaxis.opposite`
241
- // and ApexCharts' own `direction: 'rtl'` handling; legend stays anchored
242
- // to the inline-start by asking for 'left' on LTR and 'right' on RTL.
243
- horizontalAlign: w ? "right" : "left",
244
- fontFamily: "inherit"
245
- },
246
- tooltip: {
247
- ...t.tooltip,
248
- y: {
249
- formatter: (s) => b(s)
250
- }
251
- },
252
- noData: {
253
- text: a("chart.noData")
254
- }
255
- };
256
- if (v && v.length > 0 && (e.colors = v), bt(r) && (e.xaxis = {
257
- ...t.xaxis,
258
- categories: y ?? []
259
- }, e.yaxis = {
260
- ...t.yaxis,
261
- opposite: w,
262
- labels: {
263
- formatter: (s) => b(s)
264
- }
265
- }, e.stroke = {
266
- curve: "smooth",
267
- width: r === "bar" ? 0 : 2
268
- }, e.dataLabels = { enabled: !1 }), r === "radialBar" && m) {
269
- const s = t.plotOptions ?? {};
270
- e.plotOptions = {
271
- ...s,
272
- radialBar: {
273
- ...s.radialBar ?? {},
274
- dataLabels: {
275
- ...((n = s.radialBar) == null ? void 0 : n.dataLabels) ?? {},
276
- value: {
277
- ...((g = (i = s.radialBar) == null ? void 0 : i.dataLabels) == null ? void 0 : g.value) ?? {},
278
- formatter: (tt) => m(Number(tt))
279
- }
280
- }
281
- }
282
- };
283
- }
284
- return A ? e.fill = {
285
- type: "pattern",
286
- opacity: r === "area" ? 0.3 : 1,
287
- pattern: {
288
- style: [...pt],
289
- strokeWidth: 2
290
- }
291
- } : r === "area" && (e.fill = {
292
- type: "gradient",
293
- opacity: 0.3
294
- }), e;
295
- }, [
296
- B,
297
- u,
298
- x,
299
- L,
300
- G,
301
- p,
302
- f,
303
- b,
304
- a,
305
- r,
306
- y,
307
- w,
308
- A,
309
- v,
310
- m
311
- ]), F = M ?? (z > 0 ? z : "100%"), J = O ?? 320, Q = c(() => {
312
- const t = T(r) ? f ?? [] : y ?? [], e = E;
313
- return /* @__PURE__ */ S("table", { id: R, className: "ds:sr-only", children: [
314
- /* @__PURE__ */ d("caption", { children: o }),
315
- /* @__PURE__ */ d("thead", { children: /* @__PURE__ */ S("tr", { children: [
316
- /* @__PURE__ */ d("th", { scope: "col", children: a("chart.table.series") }),
317
- t.map((n, i) => /* @__PURE__ */ d("th", { scope: "col", children: n }, `${n}-${i}`))
318
- ] }) }),
319
- /* @__PURE__ */ d("tbody", { children: e.map((n, i) => /* @__PURE__ */ S("tr", { children: [
320
- /* @__PURE__ */ d("th", { scope: "row", children: n.name || a("chart.table.value") }),
321
- n.data.map((g, s) => /* @__PURE__ */ d("td", { children: r === "radialBar" && m ? m(g) : b(g) }, `${i}-${s}`))
322
- ] }, `${n.name}-${i}`)) })
323
- ] });
324
- }, [
325
- r,
326
- E,
327
- f,
328
- y,
329
- R,
330
- o,
331
- a,
332
- b,
333
- m
334
- ]), X = c(() => (T(r), h), [h, r]);
335
- return /* @__PURE__ */ S(
336
- "div",
337
- {
338
- ref: I,
339
- role: "img",
340
- "aria-label": o,
341
- "aria-describedby": R,
342
- className: ut({
343
- // Explicit height wins over the density min-height unless the
344
- // caller also asked for a density explicitly.
345
- density: D ?? (O !== void 0 ? "none" : void 0),
346
- className: W
347
- }),
348
- "data-component": "chart",
349
- "data-component-id": l,
350
- children: [
351
- Q,
352
- /* @__PURE__ */ d(
353
- st,
354
- {
355
- type: r,
356
- series: X,
357
- options: V,
358
- width: F,
359
- height: J,
360
- "aria-hidden": "true"
361
- }
362
- )
363
- ]
364
- }
365
- );
366
- }
367
- );
368
- yt.displayName = "Chart";
369
- export {
370
- yt as C,
371
- ut as a,
372
- mt as c
373
- };
374
- //# sourceMappingURL=chart-CpkpA74k.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chart-CpkpA74k.js","sources":["../../src/components/chart/chart.agent.ts","../../src/components/chart/chart.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { ChartHandle } from './chart';\n\nexport const chartAgent: AgentAdapter<ChartHandle> = {\n id: 'chart',\n capabilities: [],\n state: {},\n actions: {\n update_series: {\n // Replacing the rendered series mutates what the chart displays — it\n // is a write, reversible by pushing the prior series back.\n safety: 'write',\n argsType: 'series',\n // `series` is `ChartSeries[]` (line/bar/area) OR `number[]`\n // (pie/donut/radialBar). Both shapes are accepted; the handle routes\n // by chart type internally.\n argsSchema: {\n type: 'object',\n properties: {\n series: {\n oneOf: [\n {\n type: 'array',\n description: 'Categorical series for line / bar / area charts.',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n data: { type: 'array', items: { type: 'number' } },\n },\n required: ['name', 'data'],\n },\n },\n {\n type: 'array',\n description: 'Flat values for pie / donut / radialBar charts.',\n items: { type: 'number' },\n },\n ],\n },\n },\n required: ['series'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.chart.actions.updateSeries',\n description: 'Replace the chart series without remounting.',\n invoke: (\n handle,\n args: { series: Parameters<ChartHandle['updateSeries']>[0] },\n ) => {\n handle.updateSeries(args.series);\n },\n },\n export_png: {\n safety: 'read',\n returns: 'string (PNG data URI)',\n returnsSchema: {\n type: 'string',\n description: 'A `data:image/png;base64,…` URI of the rendered chart.',\n },\n idempotent: true,\n descriptionKey: 'ui.agent.chart.actions.exportPng',\n description:\n 'Return a PNG data URI of the chart for export or screenshotting.',\n invoke: (handle) => handle.dataURI(),\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'chart' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Chart — thin, typed wrapper over ApexCharts (react-apexcharts). */\n/* */\n/* - All chrome, colours, and fonts flow from */\n/* `src/tokens/apexcharts-theme.ts` — never hex literals in user */\n/* code. A MutationObserver on `<html class>` re-reads the bridge so */\n/* theme changes repaint without remount. */\n/* - A ResizeObserver on the wrapper keeps the chart responsive */\n/* without listening on `window.resize`. */\n/* - Accessibility: the wrapper carries `role=\"img\"` + `aria-label` */\n/* (required `title` prop) + `aria-describedby` pointing at a */\n/* visually-hidden `<table>` that mirrors series × categories. */\n/* - Colour-blind users: `patterns` prop flips `fill.type` to pattern */\n/* using ApexCharts' built-in pattern presets. */\n/* - Numbers format via `Intl.NumberFormat(locale)` — no hand-rolled */\n/* `toFixed()`. */\n/* ------------------------------------------------------------------ */\n\nimport {\n forwardRef,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport ReactApexChart from 'react-apexcharts';\nimport ApexCharts from 'apexcharts';\nimport { getApexChartsTheme } from '../../tokens/apexcharts-theme';\nimport { usePrefersReducedMotion } from '../../hooks';\nimport { useNeutraliseHiddenFocus } from '../_shared/use-neutralize-hidden-focus';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { chartAgent } from './chart.agent';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst chartVariants = cva('ds:relative ds:block ds:w-full', {\n variants: {\n density: {\n compact: 'ds:min-h-[var(--chart-min-height-compact)]',\n comfortable: 'ds:min-h-[var(--chart-min-height-comfortable)]',\n // Applied when an explicit `height` prop is given and no density was\n // requested: the wrapper must not exceed the caller's height (a 96px\n // KPI chart inside a card must not reserve 320px).\n none: '',\n },\n },\n defaultVariants: { density: 'comfortable' },\n});\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type ChartType = 'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar';\n\nexport interface ChartSeries {\n name: string;\n data: number[];\n}\n\nexport interface ChartProps extends VariantProps<typeof chartVariants> {\n /** Required — drives aria-label and sr-only table caption. */\n title: string;\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Chart visual type. */\n type: ChartType;\n /**\n * For `line` / `bar` / `area`: an array of `ChartSeries`.\n * For `pie` / `donut` / `radialBar`: an array of numbers matched to `labels`.\n */\n series: ChartSeries[] | number[];\n /** Category axis labels (line / bar / area). */\n categories?: string[];\n /** Slice labels (pie / donut / radialBar). */\n labels?: string[];\n /** Height override. Defaults to 320px. */\n height?: number | string;\n /** Width override. Defaults to 100% of container. */\n width?: number | string;\n /** Opt-in pattern fills for colour-blind users. */\n patterns?: boolean;\n /**\n * Override the series colour ramp. Pass **already-resolved** colour strings\n * (e.g. the live value of `var(--success)` sampled by the consumer) — these\n * are handed straight to ApexCharts, which can't read CSS custom properties.\n * When omitted, the theme bridge's `colors` ramp from `apexcharts-theme.ts`\n * is used, so existing consumers are unaffected. Typical use: a single-arc\n * `radialBar` gauge (e.g. BMI) that must change hue with the value —\n * green in the healthy band, amber/red outside it.\n */\n colors?: string[];\n /** Show the ApexCharts toolbar. Defaults to false. */\n toolbar?: boolean;\n /** Locale override — defaults to the active i18next language. */\n locale?: string;\n /**\n * radialBar only. Formats the value printed in the ring centre. Use when the\n * gauge represents a non-percentage figure: pass the arc fill (0–100) as the\n * single `series` value and return the real figure here (e.g. `(_, ) => '22.4'`).\n * Ignored for every other chart type. Defaults to ApexCharts' `${value}%`.\n */\n radialValueFormatter?: (value: number) => string;\n /**\n * Formats the numeric value of each data point wherever it is surfaced as\n * text — the tooltip, the value (y) axis on categorical charts, and the\n * screen-reader summary table. Use it to append a unit or currency symbol,\n * e.g. `(v) => new Intl.NumberFormat(locale, { style: 'currency', currency:\n * 'EUR' }).format(v)`. Defaults to `Intl.NumberFormat(locale)` (grouped\n * number, no unit). Does not apply to a `radialBar` ring centre — use\n * `radialValueFormatter` for that.\n */\n valueFormatter?: (value: number) => string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\nexport interface ChartHandle {\n /** Returns a PNG data URI for the chart. */\n dataURI: () => Promise<string>;\n /** Updates series without remounting. */\n updateSeries: (next: ChartProps['series']) => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* Constants */\n/* ------------------------------------------------------------------ */\n\nconst PATTERN_STYLES = [\n 'verticalLines',\n 'horizontalLines',\n 'slantedLines',\n 'squares',\n 'circles',\n] as const;\n\n/** Types where `categories` belong on an x-axis. */\nconst CATEGORICAL_TYPES: ReadonlyArray<ChartType> = ['line', 'bar', 'area'];\n\n/** Types where `series` is a flat `number[]` paired with `labels`. */\nconst SLICE_TYPES: ReadonlyArray<ChartType> = ['pie', 'donut', 'radialBar'];\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction isSliceType(type: ChartType): boolean {\n return SLICE_TYPES.includes(type);\n}\n\nfunction isCategoricalType(type: ChartType): boolean {\n return CATEGORICAL_TYPES.includes(type);\n}\n\n/** Coerce `series` into `ChartSeries[]` for shared logic (table, aria). */\nfunction normaliseSeries(\n series: ChartSeries[] | number[],\n type: ChartType,\n): ChartSeries[] {\n if (isSliceType(type)) {\n const nums = series as number[];\n return [\n {\n name: '',\n data: nums,\n },\n ];\n }\n return series as ChartSeries[];\n}\n\n/* ------------------------------------------------------------------ */\n/* Chart component */\n/* ------------------------------------------------------------------ */\n\nexport const Chart = forwardRef<ChartHandle, ChartProps>(\n (\n {\n title,\n id,\n type,\n series,\n categories,\n labels,\n height,\n width,\n patterns = false,\n colors,\n toolbar = false,\n locale: localeProp,\n radialValueFormatter,\n valueFormatter,\n density,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const rawId = useId();\n const chartId = useMemo(\n () => `chart-${rawId.replace(/[^a-zA-Z0-9-_]/g, '')}`,\n [rawId],\n );\n const summaryId = `${chartId}-summary`;\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n const [containerWidth, setContainerWidth] = useState(0);\n\n /* ApexCharts injects focusable canvases inside the `aria-hidden` */\n /* chart wrapper. Neutralise their tabindex so axe's */\n /* `aria-hidden-focus` rule passes. Same hook used in Sparkline. */\n useNeutraliseHiddenFocus(wrapperRef);\n\n const locale = localeProp ?? i18n.language ?? 'en';\n\n /* ---- dev warning if title missing ------------------------------ */\n if (import.meta.env.DEV && !title) {\n console.warn(\n 'Chart: `title` prop is required. It drives aria-label and the screen-reader summary table.',\n );\n }\n\n /* ---- theme-reactive state -------------------------------------- */\n const [themeOptions, setThemeOptions] = useState<ApexCharts.ApexOptions>(\n () => {\n try {\n return getApexChartsTheme();\n } catch {\n return {};\n }\n },\n );\n\n /* ---- MutationObserver: re-read theme on class change ------------ */\n useEffect(() => {\n if (typeof document === 'undefined') return undefined;\n let timer: ReturnType<typeof setTimeout>;\n const observer = new MutationObserver(() => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n try {\n setThemeOptions(getApexChartsTheme());\n } catch {\n /* no-op in non-browser environments */\n }\n }, 50);\n });\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n });\n return () => {\n clearTimeout(timer);\n observer.disconnect();\n };\n }, []);\n\n /* ---- ResizeObserver: track container width --------------------- */\n useEffect(() => {\n const el = wrapperRef.current;\n if (!el || typeof ResizeObserver === 'undefined') return undefined;\n const ro = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) setContainerWidth(Math.floor(entry.contentRect.width));\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n /* ---- imperative handle ----------------------------------------- */\n const agentHandle = useMemo<ChartHandle>(\n () => ({\n async dataURI(): Promise<string> {\n const instance = ApexCharts.getChartByID(chartId);\n if (!instance) return '';\n const result = await instance.dataURI();\n return (result as { imgURI: string }).imgURI;\n },\n updateSeries(next) {\n const instance = ApexCharts.getChartByID(chartId);\n if (!instance) return;\n if (isSliceType(type)) {\n instance.updateSeries(next as number[]);\n } else {\n instance.updateSeries(next as ChartSeries[]);\n }\n },\n }),\n [chartId, type],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(chartAgent, agentHandle, id);\n\n /* ---- RTL detection --------------------------------------------- */\n const isRtl =\n typeof document !== 'undefined' && document.documentElement.dir === 'rtl';\n\n /* ---- normalised series for sr-only table ----------------------- */\n const tableSeries = useMemo(\n () => normaliseSeries(series, type),\n [series, type],\n );\n\n /* ---- Intl formatter -------------------------------------------- */\n const numberFormatter = useMemo(\n () => new Intl.NumberFormat(locale),\n [locale],\n );\n\n /* ---- resolved value formatter ---------------------------------- */\n /* The consumer's `valueFormatter` (e.g. a currency formatter) wins */\n /* everywhere a data-point value is surfaced as text; otherwise we */\n /* fall back to the locale-aware grouped number. */\n const formatValue = useMemo(\n () =>\n valueFormatter ?? ((value: number) => numberFormatter.format(value)),\n [valueFormatter, numberFormatter],\n );\n\n /* ---- toolbar localisation -------------------------------------- */\n const toolbarLocale = useMemo(\n () => ({\n name: locale,\n options: {\n toolbar: {\n download: t('chart.toolbar.download'),\n selection: t('chart.toolbar.selection'),\n selectionZoom: t('chart.toolbar.selectionZoom'),\n zoomIn: t('chart.toolbar.zoomIn'),\n zoomOut: t('chart.toolbar.zoomOut'),\n pan: t('chart.toolbar.pan'),\n reset: t('chart.toolbar.reset'),\n exportToSVG: t('chart.toolbar.exportToSVG'),\n exportToPNG: t('chart.toolbar.exportToPNG'),\n exportToCSV: t('chart.toolbar.exportToCSV'),\n },\n },\n }),\n [locale, t],\n );\n\n /* ---- build ApexOptions ----------------------------------------- */\n const reducedMotion = usePrefersReducedMotion();\n\n const chartOptions: ApexCharts.ApexOptions = useMemo(() => {\n const base = themeOptions;\n\n const options: ApexCharts.ApexOptions = {\n ...base,\n chart: {\n ...base.chart,\n id: chartId,\n toolbar: { show: toolbar },\n zoom: { enabled: toolbar },\n animations: {\n enabled: !reducedMotion,\n dynamicAnimation: { enabled: !reducedMotion },\n },\n locales: [toolbarLocale],\n defaultLocale: locale,\n parentHeightOffset: 0,\n },\n // Only set `labels` when the consumer actually supplied them (slice\n // charts). Emitting `labels: undefined` crashes ApexCharts' bar\n // renderer — `parseDataAxisCharts` reads `labels.length` and throws\n // \"Cannot read properties of undefined (reading 'length')\", which\n // aborts the render and leaves a blank chart. Absent is safe; area /\n // line tolerate the undefined but bar does not, so never pass it.\n ...(labels ? { labels } : {}),\n legend: {\n ...base.legend,\n position: 'bottom',\n // ApexCharts legend.horizontalAlign is a physical prop mapped internally\n // to the chart's own text flow. For RTL we flip via `yaxis.opposite`\n // and ApexCharts' own `direction: 'rtl'` handling; legend stays anchored\n // to the inline-start by asking for 'left' on LTR and 'right' on RTL.\n horizontalAlign: isRtl ? 'right' : 'left',\n fontFamily: 'inherit',\n },\n tooltip: {\n ...base.tooltip,\n y: {\n formatter: (value: number) => formatValue(value),\n },\n },\n noData: {\n text: t('chart.noData'),\n },\n };\n\n // Consumer-supplied, already-resolved colour ramp wins over the theme\n // bridge's `colors`. Ignored when absent so existing charts keep the\n // tokenised ramp. ApexCharts can't read `var(--…)`, so the consumer is\n // responsible for sampling the live token value before passing it in.\n if (colors && colors.length > 0) {\n options.colors = colors;\n }\n\n if (isCategoricalType(type)) {\n options.xaxis = {\n ...base.xaxis,\n categories: categories ?? [],\n };\n options.yaxis = {\n ...base.yaxis,\n opposite: isRtl,\n labels: {\n formatter: (value: number) => formatValue(value),\n },\n };\n options.stroke = {\n curve: 'smooth',\n width: type === 'bar' ? 0 : 2,\n };\n options.dataLabels = { enabled: false };\n }\n\n if (type === 'radialBar' && radialValueFormatter) {\n // ApexCharts treats a radialBar series value as a 0–100 percent and\n // renders it verbatim in the ring centre. When the displayed value is\n // NOT a percentage (e.g. a BMI), the consumer scales the series to a\n // percent for the arc and supplies `radialValueFormatter` to print the\n // real value in the centre. Without this, the gauge would read \"56%\"\n // for a BMI of 22.4 — misleading. Default behaviour is untouched.\n const basePlot = (base.plotOptions ?? {}) as NonNullable<\n ApexCharts.ApexOptions['plotOptions']\n >;\n options.plotOptions = {\n ...basePlot,\n radialBar: {\n ...(basePlot.radialBar ?? {}),\n dataLabels: {\n ...(basePlot.radialBar?.dataLabels ?? {}),\n value: {\n ...(basePlot.radialBar?.dataLabels?.value ?? {}),\n formatter: (val: number) => radialValueFormatter(Number(val)),\n },\n },\n },\n };\n }\n\n if (patterns) {\n options.fill = {\n type: 'pattern',\n opacity: type === 'area' ? 0.3 : 1,\n pattern: {\n style: [...PATTERN_STYLES],\n strokeWidth: 2,\n },\n };\n } else if (type === 'area') {\n options.fill = {\n type: 'gradient',\n opacity: 0.3,\n };\n }\n\n return options;\n }, [\n themeOptions,\n chartId,\n toolbar,\n reducedMotion,\n toolbarLocale,\n locale,\n labels,\n formatValue,\n t,\n type,\n categories,\n isRtl,\n patterns,\n colors,\n radialValueFormatter,\n ]);\n\n /* ---- resolved dimensions --------------------------------------- */\n const resolvedWidth =\n width ?? (containerWidth > 0 ? containerWidth : '100%');\n const resolvedHeight = height ?? 320;\n\n /* ---- sr-only data table --------------------------------------- */\n const srTable = useMemo(() => {\n const columnLabels = isSliceType(type)\n ? (labels ?? [])\n : (categories ?? []);\n const rows = tableSeries;\n return (\n <table id={summaryId} className=\"ds:sr-only\">\n <caption>{title}</caption>\n <thead>\n <tr>\n <th scope=\"col\">{t('chart.table.series')}</th>\n {columnLabels.map((col, i) => (\n <th key={`${col}-${i}`} scope=\"col\">\n {col}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, rowIndex) => (\n <tr key={`${row.name}-${rowIndex}`}>\n <th scope=\"row\">{row.name || t('chart.table.value')}</th>\n {row.data.map((value, colIndex) => (\n <td key={`${rowIndex}-${colIndex}`}>\n {/* For a radialBar gauge the series is a synthetic arc\n percent — announce the consumer's display value (e.g.\n the real BMI) instead of the raw fill so AT users get\n the same figure sighted users see in the ring. */}\n {type === 'radialBar' && radialValueFormatter\n ? radialValueFormatter(value)\n : formatValue(value)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n }, [\n type,\n tableSeries,\n labels,\n categories,\n summaryId,\n title,\n t,\n formatValue,\n radialValueFormatter,\n ]);\n\n /* ---- ApexCharts `series` prop shape ----------------------------- */\n const apexSeries = useMemo(() => {\n if (isSliceType(type)) {\n return series as number[];\n }\n return series as ChartSeries[];\n }, [series, type]);\n\n return (\n <div\n ref={wrapperRef}\n role=\"img\"\n aria-label={title}\n aria-describedby={summaryId}\n className={chartVariants({\n // Explicit height wins over the density min-height unless the\n // caller also asked for a density explicitly.\n density: density ?? (height !== undefined ? 'none' : undefined),\n className,\n })}\n data-component=\"chart\"\n data-component-id={id}\n >\n {srTable}\n <ReactApexChart\n type={type}\n series={apexSeries as ApexCharts.ApexOptions['series']}\n options={chartOptions}\n width={resolvedWidth}\n height={resolvedHeight}\n aria-hidden=\"true\"\n />\n </div>\n );\n },\n);\n\nChart.displayName = 'Chart';\n\n/* ------------------------------------------------------------------ */\n/* Re-export internal helper for downstream theming (kept narrow). */\n/* ------------------------------------------------------------------ */\n\nexport { chartVariants };\n"],"names":["chartAgent","handle","args","chartVariants","cva","PATTERN_STYLES","CATEGORICAL_TYPES","SLICE_TYPES","isSliceType","type","isCategoricalType","normaliseSeries","series","Chart","forwardRef","title","id","categories","labels","height","width","patterns","colors","toolbar","localeProp","radialValueFormatter","valueFormatter","density","className","ref","t","i18n","useTranslation","rawId","useId","chartId","useMemo","summaryId","wrapperRef","useRef","containerWidth","setContainerWidth","useState","useNeutraliseHiddenFocus","locale","themeOptions","setThemeOptions","getApexChartsTheme","useEffect","timer","observer","el","ro","entries","entry","agentHandle","instance","ApexCharts","next","useImperativeHandle","useAgentRegistration","isRtl","tableSeries","numberFormatter","formatValue","value","toolbarLocale","reducedMotion","usePrefersReducedMotion","chartOptions","base","options","basePlot","_a","_c","_b","val","resolvedWidth","resolvedHeight","srTable","columnLabels","rows","jsx","jsxs","col","row","rowIndex","colIndex","apexSeries","ReactApexChart"],"mappings":";;;;;;;;;AAGO,MAAMA,KAAwC;AAAA,EACnD,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO,CAAA;AAAA,EACP,SAAS;AAAA,IACP,eAAe;AAAA;AAAA;AAAA,MAGb,QAAQ;AAAA,MACR,UAAU;AAAA;AAAA;AAAA;AAAA,MAIV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,QAAQ;AAAA,YACN,OAAO;AAAA,cACL;AAAA,gBACE,MAAM;AAAA,gBACN,aAAa;AAAA,gBACb,OAAO;AAAA,kBACL,MAAM;AAAA,kBACN,YAAY;AAAA,oBACV,MAAM,EAAE,MAAM,SAAA;AAAA,oBACd,MAAM,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,WAAS;AAAA,kBAAE;AAAA,kBAEnD,U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AjE,GAAM,cAAc;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"icon-button-group-C_lqXTAj.js","sources":["../../src/components/icon-button-group/icon-button-group.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Ellipsis } from 'lucide-react';\nimport { IconButton, type IconButtonProps } from '../button/icon-button';\nimport type { ButtonProps } from '../button/button';\nimport { DropdownMenu } from '../dropdown-menu';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport { usePriorityOverflow } from '../../hooks/use-priority-overflow';\n\ntype ButtonIntent = NonNullable<ButtonProps['intent']>;\n\n// Intentionally does NOT compose `@radix-ui/react-toggle-group`. Radix\n// ToggleGroup's render shape makes it hard to layer shared-border chrome\n// across children (first-child / last-child / internal-divider CSS), and\n// the three-mode + three-role matrix (group / toolbar / radiogroup × momentary\n// / toggle-single / toggle-multi) is broader than Radix's single / multi\n// contract. The roving-tabindex implementation below mirrors Radix's pattern\n// so keyboard semantics stay consistent. See 05-accessibility.mdx for the\n// WAI-ARIA toolbar / radiogroup references.\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst iconButtonGroupVariants = cva(\n [\n 'ds:inline-flex ds:isolate',\n // Hairline border around the group unifies the children into one\n // visual unit. Internal child dividers are drawn via the per-child\n // class list below.\n 'ds:border ds:border-border',\n 'ds:rounded-[var(--radius-md)]',\n // Ensure the focus ring of a pressed child sits above its siblings.\n 'ds:[&>*]:relative ds:[&>*:focus-visible]:z-10',\n ].join(' '),\n {\n variants: {\n orientation: {\n horizontal: [\n 'ds:flex-row',\n // Flatten internal corners on children so the outer radius owns\n // the rounded edges.\n 'ds:[&>*:not(:first-child)]:rounded-s-none',\n 'ds:[&>*:not(:last-child)]:rounded-e-none',\n // Internal divider — logical so it flips in RTL.\n 'ds:[&>*:not(:first-child)]:border-s',\n 'ds:[&>*:not(:first-child)]:border-border',\n // The children already own an outer border (from IconButton's\n // own border in secondary/outline variants). Collapse the doubled\n // border so we don't get a 2px seam.\n 'ds:[&>*]:border-0',\n ].join(' '),\n vertical: [\n 'ds:flex-col',\n // Vertical groups flow block-wise. Reading direction doesn't\n // invert vertical stacks in any locale this DS targets, so the\n // physical `rounded-t/b` is intentional.\n 'ds:[&>*:not(:first-child)]:rounded-t-none',\n 'ds:[&>*:not(:last-child)]:rounded-b-none',\n 'ds:[&>*:not(:first-child)]:border-t',\n 'ds:[&>*:not(:first-child)]:border-border',\n 'ds:[&>*]:border-0',\n ].join(' '),\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n },\n);\n\n// Hidden measurement rows: laid out (so widths are real) but invisible,\n// non-interactive and out of the a11y tree. Never display:none.\nconst MEASURE_ROW_CLASSES =\n 'ds:absolute ds:start-0 ds:top-0 ds:invisible ds:pointer-events-none';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type IconButtonGroupRole = 'group' | 'toolbar' | 'radiogroup';\nexport type IconButtonGroupMode =\n | 'momentary'\n | 'toggle-single'\n | 'toggle-multi';\n\ntype SharedPropsBase = {\n /** Forwarded to every child that does not set its own `size`. */\n size?: 'sm' | 'md' | 'lg';\n orientation?: 'horizontal' | 'vertical';\n /** Disables every child. Uses `aria-disabled` on children (not the HTML\n * attribute) so each child still takes focus — matches WAI-ARIA toolbar\n * guidance. Visual disabled styling picks up the `aria-disabled:*`\n * variant declared on the Button base class. */\n disabled?: boolean;\n /** Intent applied to every child that does not set its own `intent`.\n * Defaults to `outline` — grouped icon buttons are peers, not a row\n * of solid-primary CTAs. */\n intent?: ButtonIntent;\n /** `'menu'` keeps the strip on one line whatever the container width:\n * children that stop fitting move into a dropdown behind an ellipsis\n * trigger, preserving toggle semantics (radio / checkbox items). The\n * group then fills its container's inline size. Horizontal only.\n * Children set `data-overflow-pin` to always stay in the strip. */\n overflow?: 'none' | 'menu';\n children: ReactNode;\n};\n\n// At least one of `aria-label` / `aria-labelledby` must be present. This\n// discriminated pair makes the TypeScript compiler reject a group with\n// neither — see the a11y acceptance criteria in the user story.\ntype AccessibleNameProps =\n | { 'aria-label': string; 'aria-labelledby'?: never }\n | { 'aria-label'?: never; 'aria-labelledby': string };\n\ntype SharedProps = SharedPropsBase & AccessibleNameProps;\n\n// Role + mode combinations are not all valid. Encoded via a discriminated\n// union so the compiler rejects nonsensical pairings (e.g. a multi-select\n// radiogroup).\ntype GroupRoleProps =\n | { role?: 'group'; mode?: 'momentary' | 'toggle-single' | 'toggle-multi' }\n | { role: 'toolbar'; mode?: 'momentary' | 'toggle-single' | 'toggle-multi' }\n | { role: 'radiogroup'; mode: 'toggle-single' };\n\ntype MomentaryProps = SharedProps & {\n mode?: 'momentary';\n value?: never;\n defaultValue?: never;\n onValueChange?: never;\n};\n\ntype ToggleSingleProps = SharedProps & {\n mode: 'toggle-single';\n value?: string;\n defaultValue?: string;\n onValueChange?: (next: string) => void;\n};\n\ntype ToggleMultiProps = SharedProps & {\n mode: 'toggle-multi';\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (next: string[]) => void;\n};\n\nexport type IconButtonGroupProps = (\n | MomentaryProps\n | ToggleSingleProps\n | ToggleMultiProps\n) &\n GroupRoleProps &\n Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'onChange' | 'children'> &\n VariantProps<typeof iconButtonGroupVariants>;\n\n/* ------------------------------------------------------------------ */\n/* IconButtonGroup */\n/* ------------------------------------------------------------------ */\n\nexport const IconButtonGroup = forwardRef<HTMLDivElement, IconButtonGroupProps>(\n (props, ref) => {\n const {\n size,\n orientation = 'horizontal',\n role = 'group',\n mode = 'momentary',\n disabled = false,\n intent = 'outline',\n overflow = 'none',\n className,\n children,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n // Controlled-value props are consumed via `props as …` below; strip them\n // here so they never spread onto the root <div> (React would warn that\n // `onValueChange` is an unknown DOM event handler).\n value: _value,\n defaultValue: _defaultValue,\n onValueChange: _onValueChange,\n ...rest\n } = props as IconButtonGroupProps & { className?: string };\n const { t } = useTranslation();\n\n if (import.meta.env.DEV && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n 'IconButtonGroup: `aria-label` or `aria-labelledby` is required for accessibility.',\n );\n }\n if (\n import.meta.env.DEV &&\n overflow === 'menu' &&\n orientation === 'vertical'\n ) {\n console.warn(\n 'IconButtonGroup: overflow=\"menu\" is horizontal-only; falling back to overflow=\"none\".',\n );\n }\n const overflowEnabled = overflow === 'menu' && orientation !== 'vertical';\n\n /* ---- Controlled / uncontrolled value for toggle modes --------- */\n const [internalValue, setInternalValue] = useState<string | string[]>(\n () => {\n if (mode === 'toggle-single') {\n const p = props as ToggleSingleProps;\n return p.defaultValue ?? '';\n }\n if (mode === 'toggle-multi') {\n const p = props as ToggleMultiProps;\n return p.defaultValue ?? [];\n }\n return '';\n },\n );\n\n const resolvedValue: string | string[] = (() => {\n if (mode === 'toggle-single') {\n const p = props as ToggleSingleProps;\n return p.value !== undefined ? p.value : internalValue;\n }\n if (mode === 'toggle-multi') {\n const p = props as ToggleMultiProps;\n return p.value !== undefined ? p.value : internalValue;\n }\n return '';\n })();\n\n const commitValue = useCallback(\n (next: string | string[]) => {\n if (mode === 'toggle-single') {\n const p = props as ToggleSingleProps;\n if (p.value === undefined) setInternalValue(next as string);\n p.onValueChange?.(next as string);\n } else if (mode === 'toggle-multi') {\n const p = props as ToggleMultiProps;\n if (p.value === undefined) setInternalValue(next as string[]);\n p.onValueChange?.(next as string[]);\n }\n },\n [mode, props],\n );\n\n /* ---- Roving tabindex state — only active in toolbar / radiogroup - */\n const rovingTabindex = role === 'toolbar' || role === 'radiogroup';\n const buttonsRef = useRef<Array<HTMLButtonElement | null>>([]);\n const [focusIndex, setFocusIndex] = useState(0);\n\n const registerIndex = useCallback(\n (index: number, el: HTMLButtonElement | null) => {\n buttonsRef.current[index] = el;\n },\n [],\n );\n\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [isRTL, setIsRTL] = useState(false);\n // `useLayoutEffect` so the direction is correct BEFORE the first paint\n // (otherwise a user pressing an arrow key on the first frame after mount\n // would hit the default-LTR mapping even in an RTL document).\n useIsomorphicLayoutEffect(() => {\n if (typeof window === 'undefined') return;\n const node = rootRef.current;\n if (!node) return;\n // Read the computed direction from the group's own wrapper so a\n // scoped `dir='rtl'` on any ancestor (not just <html>) flips arrow\n // navigation. `getComputedStyle` walks up automatically.\n const dir = window.getComputedStyle(node).direction;\n setIsRTL(dir === 'rtl');\n }, []);\n\n /* ---- Arrow-key navigation for roving tabindex ----------------- */\n const handleRootKeyDown = useCallback(\n (event: ReactKeyboardEvent<HTMLDivElement>) => {\n if (!rovingTabindex) return;\n const count = buttonsRef.current.filter(Boolean).length;\n if (count === 0) return;\n\n const forwardKey =\n orientation === 'vertical'\n ? 'ArrowDown'\n : isRTL\n ? 'ArrowLeft'\n : 'ArrowRight';\n const backwardKey =\n orientation === 'vertical'\n ? 'ArrowUp'\n : isRTL\n ? 'ArrowRight'\n : 'ArrowLeft';\n\n let next: number | null = null;\n if (event.key === forwardKey) next = (focusIndex + 1) % count;\n else if (event.key === backwardKey)\n next = (focusIndex - 1 + count) % count;\n else if (event.key === 'Home') next = 0;\n else if (event.key === 'End') next = count - 1;\n\n if (next === null) return;\n // Skip over disabled children.\n const maxAttempts = count;\n let attempts = 0;\n let candidate = next;\n while (attempts < maxAttempts) {\n const el = buttonsRef.current[candidate];\n if (\n el &&\n el.getAttribute('aria-disabled') !== 'true' &&\n !el.disabled\n ) {\n break;\n }\n candidate =\n event.key === backwardKey || event.key === 'End'\n ? (candidate - 1 + count) % count\n : (candidate + 1) % count;\n attempts += 1;\n }\n event.preventDefault();\n setFocusIndex(candidate);\n buttonsRef.current[candidate]?.focus();\n // WAI-ARIA radiogroup pattern: arrow keys MOVE focus AND CHANGE\n // the selected radio in one action. toolbar pattern (and plain\n // group) only moves focus.\n if (role === 'radiogroup' && mode === 'toggle-single') {\n const child = childArrayRef.current[candidate];\n if (child && typeof child === 'object' && 'props' in child) {\n const cValue = (child as ReactElement<{ value?: string }>).props\n .value;\n if (cValue) commitValue(cValue);\n }\n }\n },\n [rovingTabindex, orientation, isRTL, focusIndex, role, mode, commitValue],\n );\n\n /* ---- Overflow bookkeeping (menu mode only) --------------------- */\n type OverflowChildProps = IconButtonProps & {\n value?: string;\n 'data-overflow-pin'?: boolean | 'true' | '';\n };\n const allElements = overflowEnabled\n ? (Children.toArray(children).filter(isValidElement) as Array<\n ReactElement<OverflowChildProps>\n >)\n : [];\n const mirrorLabel = (child: ReactElement<OverflowChildProps>) => {\n const aria = child.props['aria-label'];\n if (typeof aria === 'string') return aria;\n return typeof child.props.tooltip === 'string'\n ? child.props.tooltip\n : null;\n };\n const warnedRef = useRef(false);\n const pinnedFlags = allElements.map((child) => {\n const explicit = child.props['data-overflow-pin'] !== undefined;\n const mirrorable = mirrorLabel(child) !== null;\n if (\n import.meta.env.DEV &&\n !explicit &&\n !mirrorable &&\n !warnedRef.current\n ) {\n warnedRef.current = true;\n console.warn(\n 'IconButtonGroup: a child without aria-label / tooltip cannot move into the overflow menu — it stays pinned in the strip.',\n );\n }\n return explicit || !mirrorable;\n });\n\n const { containerRef, fullRowRef, triggerProbeRef, visible, overflowing } =\n usePriorityOverflow({\n enabled: overflowEnabled,\n count: allElements.length,\n pinned: pinnedFlags,\n });\n\n const triggerNodeRef = useRef<HTMLButtonElement | null>(null);\n\n /* ---- Build enhanced children ---------------------------------- */\n const childArray = overflowEnabled\n ? allElements.filter((_, i) => visible[i])\n : Children.toArray(children);\n if (overflowEnabled) {\n buttonsRef.current.length = childArray.length + (overflowing ? 1 : 0);\n }\n // Mirror into a ref so the keydown handler (referenced from Memo deps)\n // can read the latest child list without inflating the dep array.\n const childArrayRef = useRef<ReturnType<typeof Children.toArray>>([]);\n childArrayRef.current = childArray;\n\n const visibleCount = childArray.length;\n // Clamp the roving focus when items move into the menu; hand real focus\n // to the trigger only when the focused node was the one that left.\n useEffect(() => {\n if (!rovingTabindex || !overflowEnabled) return;\n const total = visibleCount + (overflowing ? 1 : 0);\n if (total > 0 && focusIndex >= total) {\n setFocusIndex(total - 1);\n if (document.activeElement === document.body) {\n triggerNodeRef.current?.focus();\n }\n }\n }, [\n rovingTabindex,\n overflowEnabled,\n visibleCount,\n overflowing,\n focusIndex,\n ]);\n\n const enhanced = childArray.map((child, index) => {\n if (!isValidElement(child)) {\n if (import.meta.env.DEV) {\n console.warn(\n 'IconButtonGroup: children should be <IconButton> elements.',\n );\n }\n return child;\n }\n\n const childEl = child as ReactElement<\n IconButtonProps & {\n value?: string;\n asChild?: boolean;\n children?: ReactNode;\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n }\n >;\n\n // DEV-time sanity: warn if we got something that isn't an IconButton.\n // `React.cloneElement` would still work, but IconButton-specific\n // props (::before target size, forwarded tooltip) wouldn't apply.\n // `asChild` wrappers (e.g. DropdownMenu.Trigger) are fine when they\n // Slot-merge the cloned props onto their own IconButton child, as are\n // components that declare a static `rendersIconButton` marker (the\n // DataTable toolbar leaves — each renders one IconButton trigger and\n // forwards ref/tabIndex/onFocus to it).\n if (import.meta.env.DEV && childEl.type !== IconButton) {\n const slotChild =\n childEl.props.asChild === true ? childEl.props.children : null;\n const wrapsIconButton =\n isValidElement(slotChild) && slotChild.type === IconButton;\n const rendersIconButton =\n (childEl.type as { rendersIconButton?: boolean })\n .rendersIconButton === true;\n if (!wrapsIconButton && !rendersIconButton) {\n console.warn(\n 'IconButtonGroup: each child should be a DS <IconButton>. Other elements break target-size + focus-ring contracts.',\n );\n }\n }\n\n const childValue = childEl.props.value;\n\n // Compute aria-pressed / aria-checked for toggle modes.\n const { ariaPressed, ariaChecked } = computeToggleAria(\n mode,\n role,\n childValue,\n resolvedValue,\n );\n\n const groupDisabled = disabled === true;\n const childDisabled = childEl.props.disabled === true;\n\n // Click handling — wrap so aria-disabled (group-level) blocks\n // activation, then forward to the child's own onClick.\n const wrappedOnClick: React.MouseEventHandler<HTMLButtonElement> = (\n event,\n ) => {\n // aria-disabled is advisory; the native click still fires. Block\n // it explicitly when the GROUP (not the child) is disabled.\n if (groupDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n // Forward to the child's own handler first so consumers can run\n // analytics / preventDefault.\n childEl.props.onClick?.(event);\n if (event.defaultPrevented) return;\n if (!childValue) return;\n if (mode === 'toggle-single') {\n // Contract: exactly one pressed. Clicking the pressed one is a\n // no-op. This matches Radix ToggleGroup type='single' and the\n // radiogroup pattern.\n if (resolvedValue === childValue) return;\n commitValue(childValue);\n } else if (mode === 'toggle-multi') {\n const list = resolvedValue as string[];\n const next = list.includes(childValue)\n ? list.filter((v) => v !== childValue)\n : [...list, childValue];\n commitValue(next);\n }\n };\n\n // cloneElement's typed overload rejects `ref` as a prop, so we\n // build the override bag as `unknown` and cast to the element's\n // prop type. React at runtime routes `ref` via its usual channel.\n const setMergedRef = (node: HTMLButtonElement | null) => {\n registerIndex(index, node);\n const originalRef = (\n childEl as unknown as { ref?: React.Ref<HTMLButtonElement> }\n ).ref;\n if (typeof originalRef === 'function') originalRef(node);\n else if (\n originalRef !== null &&\n originalRef !== undefined &&\n typeof originalRef === 'object'\n ) {\n (\n originalRef as React.MutableRefObject<HTMLButtonElement | null>\n ).current = node;\n }\n };\n\n // Per the user story: group-level disabled injects `aria-disabled`\n // so the child stays focusable; child-level `disabled` still uses\n // the HTML attribute (child's own contract). When both are true\n // we leave the HTML disabled in place (strictest cue wins).\n const ariaDisabled = groupDisabled && !childDisabled ? true : undefined;\n\n // If the group is disabled OR we are in a toggle mode, we need the\n // wrapped click handler. In pure momentary mode with no group\n // disable, the child's own onClick is passed through unchanged.\n const needsWrappedClick = mode !== 'momentary' || groupDisabled;\n\n const overrides = {\n intent: childEl.props.intent ?? intent,\n size: childEl.props.size ?? size,\n disabled: childDisabled,\n 'aria-disabled': ariaDisabled,\n onClick: needsWrappedClick ? wrappedOnClick : childEl.props.onClick,\n 'aria-pressed': ariaPressed,\n 'aria-checked': ariaChecked,\n // When the group is a radiogroup, children must be `role=\"radio\"`\n // so screen readers announce them as radio buttons and so\n // `getByRole('radio')` works in tests. The button element is\n // re-purposed as a radio; `aria-checked` above carries the state.\n role: role === 'radiogroup' ? 'radio' : undefined,\n tabIndex: rovingTabindex ? (index === focusIndex ? 0 : -1) : undefined,\n onFocus: (ev: React.FocusEvent<HTMLButtonElement>) => {\n if (rovingTabindex) setFocusIndex(index);\n childEl.props.onFocus?.(ev);\n },\n ref: setMergedRef,\n } as unknown as Partial<IconButtonProps>;\n\n return cloneElement(childEl, overrides);\n });\n\n const mergedRootRef = (node: HTMLDivElement | null) => {\n rootRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref && typeof ref === 'object') {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n };\n\n if (!overflowEnabled) {\n return (\n <div\n ref={mergedRootRef}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-orientation={role === 'toolbar' ? orientation : undefined}\n onKeyDown={handleRootKeyDown}\n className={iconButtonGroupVariants({ orientation, className })}\n data-component=\"icon-button-group\"\n {...rest}\n >\n {enhanced}\n </div>\n );\n }\n\n /* ---- Menu path: measurement rows + strip + ellipsis trigger ---- */\n const moreLabel = t('buttonGroup.more', 'More options');\n const groupDisabled = disabled === true;\n const overflowItems = allElements\n .map((childEl, i) => ({ childEl, i }))\n .filter(({ i }) => !visible[i]);\n\n let menuContent: ReactNode = null;\n if (mode === 'toggle-single') {\n menuContent = (\n <DropdownMenu.RadioGroup\n value={resolvedValue as string}\n onValueChange={(v) => {\n if (!groupDisabled && v !== resolvedValue) commitValue(v);\n }}\n >\n {overflowItems.map(({ childEl, i }) => (\n <DropdownMenu.RadioItem\n key={childEl.key ?? i}\n value={childEl.props.value ?? ''}\n disabled={groupDisabled || childEl.props.disabled === true}\n >\n {mirrorLabel(childEl)}\n </DropdownMenu.RadioItem>\n ))}\n </DropdownMenu.RadioGroup>\n );\n } else if (mode === 'toggle-multi') {\n menuContent = overflowItems.map(({ childEl, i }) => {\n const v = childEl.props.value;\n const list = resolvedValue as string[];\n const checked = v ? list.includes(v) : false;\n return (\n <DropdownMenu.CheckboxItem\n key={childEl.key ?? i}\n checked={checked}\n disabled={groupDisabled || childEl.props.disabled === true}\n onCheckedChange={() => {\n if (groupDisabled || !v) return;\n commitValue(checked ? list.filter((x) => x !== v) : [...list, v]);\n }}\n >\n {mirrorLabel(childEl)}\n </DropdownMenu.CheckboxItem>\n );\n });\n } else {\n menuContent = overflowItems.map(({ childEl, i }) => (\n <DropdownMenu.Item\n key={childEl.key ?? i}\n startIcon={childEl.props.icon}\n disabled={groupDisabled || childEl.props.disabled === true}\n onSelect={(event) => {\n childEl.props.onClick?.(\n event as unknown as React.MouseEvent<HTMLButtonElement>,\n );\n }}\n >\n {mirrorLabel(childEl)}\n </DropdownMenu.Item>\n ));\n }\n\n const trigger = overflowing ? (\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <IconButton\n icon={<Ellipsis />}\n intent={intent}\n size={size}\n aria-label={moreLabel}\n ref={(node: HTMLButtonElement | null) => {\n triggerNodeRef.current = node;\n registerIndex(visibleCount, node);\n }}\n tabIndex={\n rovingTabindex\n ? focusIndex === visibleCount\n ? 0\n : -1\n : undefined\n }\n onFocus={\n rovingTabindex ? () => setFocusIndex(visibleCount) : undefined\n }\n />\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"end\">{menuContent}</DropdownMenu.Content>\n </DropdownMenu.Root>\n ) : null;\n\n const stripClasses = iconButtonGroupVariants({ orientation });\n // A radiogroup may own only radios, so its trigger sits beside the strip;\n // toolbar / group keep the trigger inside as the last joined control.\n const triggerInside = role !== 'radiogroup';\n const stripDiv = (\n <div\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-orientation={role === 'toolbar' ? orientation : undefined}\n onKeyDown={triggerInside ? handleRootKeyDown : undefined}\n className={`${stripClasses} ds:max-w-full`}\n >\n {enhanced}\n {triggerInside ? trigger : null}\n </div>\n );\n\n return (\n <div\n ref={mergedRootRef}\n data-component=\"icon-button-group\"\n className={[\n 'ds:relative ds:block ds:w-full ds:min-w-0 ds:overflow-x-clip',\n className ?? '',\n ]\n .join(' ')\n .trim()}\n {...rest}\n >\n <div ref={containerRef} className=\"ds:block ds:w-full ds:min-w-0\">\n <div\n ref={fullRowRef}\n aria-hidden=\"true\"\n inert\n className={`${MEASURE_ROW_CLASSES} ${stripClasses}`}\n >\n {allElements.map((childEl, i) =>\n cloneElement(childEl, {\n key: childEl.key ?? i,\n intent: childEl.props.intent ?? intent,\n size: childEl.props.size ?? size,\n tabIndex: -1,\n ref: null,\n } as Partial<OverflowChildProps>),\n )}\n </div>\n <span\n ref={triggerProbeRef}\n aria-hidden=\"true\"\n inert\n className={MEASURE_ROW_CLASSES}\n >\n <IconButton\n icon={<Ellipsis />}\n intent={intent}\n size={size}\n aria-label={moreLabel}\n tabIndex={-1}\n />\n </span>\n {triggerInside ? (\n stripDiv\n ) : (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- non-focusable wrapper; arrow-key roving bubbles up from the focusable IconButtons in the strip and the overflow trigger\n <div\n className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\"\n onKeyDown={handleRootKeyDown}\n >\n {stripDiv}\n {trigger}\n </div>\n )}\n </div>\n </div>\n );\n },\n);\n\nIconButtonGroup.displayName = 'IconButtonGroup';\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction computeToggleAria(\n mode: IconButtonGroupMode,\n role: IconButtonGroupRole,\n childValue: string | undefined,\n resolvedValue: string | string[],\n): { ariaPressed?: boolean; ariaChecked?: boolean } {\n if (mode === 'momentary' || !childValue) return {};\n\n const isActive =\n mode === 'toggle-multi'\n ? (resolvedValue as string[]).includes(childValue)\n : resolvedValue === childValue;\n\n // radiogroup uses aria-checked; toolbar/group use aria-pressed.\n if (role === 'radiogroup') {\n return { ariaChecked: isActive };\n }\n return { ariaPressed: isActive };\n}\n"],"names":["iconButtonGroupVariants","cva","MEASURE_ROW_CLASSES","IconButtonGroup","forwardRef","props","ref","size","orientation","role","mode","disabled","intent","overflow","className","children","ariaLabel","ariaLabelledBy","_value","_defaultValue","_onValueChange","rest","t","useTranslation","overflowEnabled","internalValue","setInternalValue","useState","resolvedValue","p","commitValue","useCallback","next","_a","_b","rovingTabindex","buttonsRef","useRef","focusIndex","setFocusIndex","registerIndex","index","el","rootRef","isRTL","setIsRTL","useIsomorphicLayoutEffect","node","dir","handleRootKeyDown","event","count","forwardKey","backwardKey","maxAttempts","attempts","candidate","child","childArrayRef","cValue","allElements","Children","isValidElement","mirrorLabel","aria","pinnedFlags","explicit","mirrorable","containerRef","fullRowRef","triggerProbeRef","visible","overflowing","usePriorityOverflow","triggerNodeRef","childArray","_","i","visibleCount","useEffect","total","enhanced","childEl","childValue","ariaPressed","ariaChecked","computeToggleAria","groupDisabled","childDisabled","wrappedOnClick","list","v","setMergedRef","originalRef","ariaDisabled","needsWrappedClick","overrides","ev","cloneElement","mergedRootRef","jsx","moreLabel","overflowItems","menuContent","DropdownMenu","checked","x","trigger","jsxs","IconButton","Ellipsis","stripClasses","triggerInside","stripDiv","isActive"],"mappings":";;;;;;;;;AAsCA,MAAMA,KAA0BC;AAAA,EAC9B;AAAA,IACE;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,aAAa;AAAA,QACX,YAAY;AAAA,UACV;AAAA;AAAA;AAAA,UAGA;AAAA,UACA;AAAA;AAAA,UAEA;AAAA,UACA;AAAA;AAAA;AAAA;AAAA,UAI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