@alfadocs/ui-kit-debug 0.86.0 → 0.87.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.
- package/dist/_chunks/{chart-GFLv4cXm.js → chart-CNaLgvx4.js} +254 -230
- package/dist/_chunks/chart-CNaLgvx4.js.map +1 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/chart/chart.d.ts +30 -0
- package/dist/components/chart/chart.d.ts.map +1 -1
- package/dist/components/chart/index.d.ts +1 -1
- package/dist/components/chart/index.d.ts.map +1 -1
- package/dist/components/chart/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/_chunks/chart-GFLv4cXm.js.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { u as
|
|
8
|
-
import { u as
|
|
9
|
-
import { u as
|
|
10
|
-
import { I as
|
|
11
|
-
import { I as
|
|
12
|
-
import { c as
|
|
1
|
+
import { jsxs as I, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Se, useId as we, useMemo as d, useRef as Ie, useState as G, useEffect as re, useImperativeHandle as Ce } from "react";
|
|
3
|
+
import { c as ke } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as Re } from "react-i18next";
|
|
5
|
+
import _e from "react-apexcharts";
|
|
6
|
+
import oe from "apexcharts";
|
|
7
|
+
import { u as Le, g as ie } from "./apexcharts-theme-BJigns_V.js";
|
|
8
|
+
import { u as xe } from "./use-prefers-reduced-motion-BMwIQRjB.js";
|
|
9
|
+
import { u as Ee } from "./registry-DvAUVLHh.js";
|
|
10
|
+
import { I as Ne } from "./icon-button-C_kbcd7I.js";
|
|
11
|
+
import { I as ze } from "./icon-button-group-BLHPN6jg.js";
|
|
12
|
+
import { c as C } from "./createLucideIcon-DhHxpK9K.js";
|
|
13
13
|
/**
|
|
14
14
|
* @license lucide-react v1.22.0 - ISC
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the ISC license.
|
|
17
17
|
* See the LICENSE file in the root directory of this source tree.
|
|
18
18
|
*/
|
|
19
|
-
const
|
|
19
|
+
const Pe = [
|
|
20
20
|
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
|
|
21
21
|
[
|
|
22
22
|
"path",
|
|
@@ -25,36 +25,36 @@ const xe = [
|
|
|
25
25
|
key: "q0gr47"
|
|
26
26
|
}
|
|
27
27
|
]
|
|
28
|
-
],
|
|
28
|
+
], Ae = C("chart-area", Pe);
|
|
29
29
|
/**
|
|
30
30
|
* @license lucide-react v1.22.0 - ISC
|
|
31
31
|
*
|
|
32
32
|
* This source code is licensed under the ISC license.
|
|
33
33
|
* See the LICENSE file in the root directory of this source tree.
|
|
34
34
|
*/
|
|
35
|
-
const
|
|
35
|
+
const Be = [
|
|
36
36
|
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
|
|
37
37
|
["path", { d: "M18 17V9", key: "2bz60n" }],
|
|
38
38
|
["path", { d: "M13 17V5", key: "1frdt8" }],
|
|
39
39
|
["path", { d: "M8 17v-3", key: "17ska0" }]
|
|
40
|
-
],
|
|
40
|
+
], Oe = C("chart-column", Be);
|
|
41
41
|
/**
|
|
42
42
|
* @license lucide-react v1.22.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
46
|
*/
|
|
47
|
-
const
|
|
47
|
+
const Me = [
|
|
48
48
|
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
|
|
49
49
|
["path", { d: "m19 9-5 5-4-4-3 3", key: "2osh9i" }]
|
|
50
|
-
],
|
|
50
|
+
], $e = C("chart-line", Me);
|
|
51
51
|
/**
|
|
52
52
|
* @license lucide-react v1.22.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
56
|
*/
|
|
57
|
-
const
|
|
57
|
+
const He = [
|
|
58
58
|
[
|
|
59
59
|
"path",
|
|
60
60
|
{
|
|
@@ -63,14 +63,14 @@ const Be = [
|
|
|
63
63
|
}
|
|
64
64
|
],
|
|
65
65
|
["path", { d: "M21.21 15.89A10 10 0 1 1 8 2.83", key: "k2fpak" }]
|
|
66
|
-
],
|
|
66
|
+
], Ge = C("chart-pie", He);
|
|
67
67
|
/**
|
|
68
68
|
* @license lucide-react v1.22.0 - ISC
|
|
69
69
|
*
|
|
70
70
|
* This source code is licensed under the ISC license.
|
|
71
71
|
* See the LICENSE file in the root directory of this source tree.
|
|
72
72
|
*/
|
|
73
|
-
const
|
|
73
|
+
const je = [
|
|
74
74
|
[
|
|
75
75
|
"path",
|
|
76
76
|
{
|
|
@@ -79,7 +79,7 @@ const Oe = [
|
|
|
79
79
|
}
|
|
80
80
|
],
|
|
81
81
|
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
82
|
-
],
|
|
82
|
+
], De = C("donut", je), Ke = {
|
|
83
83
|
id: "chart",
|
|
84
84
|
// view_change backs the opt-in type switcher (`switchableTypes` prop):
|
|
85
85
|
// the same chart re-presented as line / bar / area / pie / donut.
|
|
@@ -89,19 +89,19 @@ const Oe = [
|
|
|
89
89
|
type: "'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'",
|
|
90
90
|
descriptionKey: "ui.agent.chart.state.declaredType",
|
|
91
91
|
description: "The consumer-declared chart type — the shape `update_series` expects.",
|
|
92
|
-
read: (
|
|
92
|
+
read: (r) => r.getTypeState().declaredType
|
|
93
93
|
},
|
|
94
94
|
effectiveType: {
|
|
95
95
|
type: "'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'",
|
|
96
96
|
descriptionKey: "ui.agent.chart.state.effectiveType",
|
|
97
97
|
description: "The type currently rendered — differs from declaredType after a type-switcher pick.",
|
|
98
|
-
read: (
|
|
98
|
+
read: (r) => r.getTypeState().effectiveType
|
|
99
99
|
},
|
|
100
100
|
availableTypes: {
|
|
101
101
|
type: "ChartType[]",
|
|
102
102
|
descriptionKey: "ui.agent.chart.state.availableTypes",
|
|
103
103
|
description: "Types the switcher offers. Empty when the chart has no type switcher.",
|
|
104
|
-
read: (
|
|
104
|
+
read: (r) => r.getTypeState().availableTypes
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
actions: {
|
|
@@ -129,7 +129,7 @@ const Oe = [
|
|
|
129
129
|
idempotent: !0,
|
|
130
130
|
descriptionKey: "ui.agent.chart.actions.changeView",
|
|
131
131
|
description: "Switch the rendered chart type via the type switcher. No-op (returns false) when the chart has no switcher or the type is not offered.",
|
|
132
|
-
invoke: (
|
|
132
|
+
invoke: (r, h) => r.setType(h.type)
|
|
133
133
|
},
|
|
134
134
|
update_series: {
|
|
135
135
|
// Replacing the rendered series mutates what the chart displays — it
|
|
@@ -169,8 +169,8 @@ const Oe = [
|
|
|
169
169
|
idempotent: !0,
|
|
170
170
|
descriptionKey: "ui.agent.chart.actions.updateSeries",
|
|
171
171
|
description: "Replace the chart series without remounting. Pass the DECLARED type’s shape (see declaredType state) — when the user has switched the view cross-shape the values are converted to the rendered shape. The write targets the live instance only: a later type switch re-reads the original props and discards it.",
|
|
172
|
-
invoke: (
|
|
173
|
-
|
|
172
|
+
invoke: (r, h) => {
|
|
173
|
+
r.updateSeries(h.series);
|
|
174
174
|
}
|
|
175
175
|
},
|
|
176
176
|
export_png: {
|
|
@@ -183,7 +183,7 @@ const Oe = [
|
|
|
183
183
|
idempotent: !0,
|
|
184
184
|
descriptionKey: "ui.agent.chart.actions.exportPng",
|
|
185
185
|
description: "Return a PNG data URI of the chart for export or screenshotting.",
|
|
186
|
-
invoke: (
|
|
186
|
+
invoke: (r) => r.dataURI()
|
|
187
187
|
}
|
|
188
188
|
},
|
|
189
189
|
domHooks: {
|
|
@@ -194,7 +194,7 @@ const Oe = [
|
|
|
194
194
|
description: "Sourced from the id prop."
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
},
|
|
197
|
+
}, Ue = ke("ds:relative ds:block ds:w-full", {
|
|
198
198
|
variants: {
|
|
199
199
|
density: {
|
|
200
200
|
compact: "ds:min-h-[var(--chart-min-height-compact)]",
|
|
@@ -206,87 +206,90 @@ const Oe = [
|
|
|
206
206
|
}
|
|
207
207
|
},
|
|
208
208
|
defaultVariants: { density: "comfortable" }
|
|
209
|
-
}),
|
|
209
|
+
}), Ve = [
|
|
210
210
|
"verticalLines",
|
|
211
211
|
"horizontalLines",
|
|
212
212
|
"slantedLines",
|
|
213
213
|
"squares",
|
|
214
214
|
"circles"
|
|
215
|
-
],
|
|
215
|
+
], We = ["line", "bar", "area"], Ye = ["pie", "donut", "radialBar"], ne = [
|
|
216
216
|
"line",
|
|
217
217
|
"bar",
|
|
218
218
|
"area",
|
|
219
219
|
"pie",
|
|
220
220
|
"donut"
|
|
221
|
-
],
|
|
221
|
+
], qe = {
|
|
222
222
|
line: "chart.typeSwitcher.line",
|
|
223
223
|
bar: "chart.typeSwitcher.bar",
|
|
224
224
|
area: "chart.typeSwitcher.area",
|
|
225
225
|
pie: "chart.typeSwitcher.pie",
|
|
226
226
|
donut: "chart.typeSwitcher.donut"
|
|
227
|
-
},
|
|
228
|
-
line: /* @__PURE__ */ c(
|
|
229
|
-
bar: /* @__PURE__ */ c(
|
|
230
|
-
area: /* @__PURE__ */ c(
|
|
231
|
-
pie: /* @__PURE__ */ c(
|
|
232
|
-
donut: /* @__PURE__ */ c(
|
|
227
|
+
}, Ze = {
|
|
228
|
+
line: /* @__PURE__ */ c($e, {}),
|
|
229
|
+
bar: /* @__PURE__ */ c(Oe, {}),
|
|
230
|
+
area: /* @__PURE__ */ c(Ae, {}),
|
|
231
|
+
pie: /* @__PURE__ */ c(Ge, {}),
|
|
232
|
+
donut: /* @__PURE__ */ c(De, {})
|
|
233
233
|
};
|
|
234
|
-
function
|
|
235
|
-
return
|
|
234
|
+
function m(r) {
|
|
235
|
+
return Ye.includes(r);
|
|
236
236
|
}
|
|
237
|
-
function
|
|
238
|
-
return
|
|
237
|
+
function se(r) {
|
|
238
|
+
return We.includes(r);
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
return
|
|
240
|
+
function Fe(r, h) {
|
|
241
|
+
return m(h) ? [
|
|
242
242
|
{
|
|
243
243
|
name: "",
|
|
244
|
-
data:
|
|
244
|
+
data: r
|
|
245
245
|
}
|
|
246
|
-
] :
|
|
246
|
+
] : r;
|
|
247
247
|
}
|
|
248
|
-
const
|
|
248
|
+
const Je = Se(
|
|
249
249
|
({
|
|
250
|
-
title:
|
|
250
|
+
title: r,
|
|
251
251
|
id: h,
|
|
252
252
|
type: l,
|
|
253
|
-
series:
|
|
254
|
-
categories:
|
|
255
|
-
labels:
|
|
256
|
-
height:
|
|
257
|
-
width:
|
|
258
|
-
patterns:
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
253
|
+
series: k,
|
|
254
|
+
categories: j,
|
|
255
|
+
labels: x,
|
|
256
|
+
height: D,
|
|
257
|
+
width: ce,
|
|
258
|
+
patterns: K = !1,
|
|
259
|
+
stacked: U = !1,
|
|
260
|
+
orientation: E = "vertical",
|
|
261
|
+
curve: V = "smooth",
|
|
262
|
+
colors: R,
|
|
263
|
+
toolbar: N = !1,
|
|
264
|
+
locale: de,
|
|
265
|
+
radialValueFormatter: y,
|
|
266
|
+
valueFormatter: W,
|
|
267
|
+
switchableTypes: _,
|
|
268
|
+
onTypeChange: z,
|
|
269
|
+
density: le,
|
|
270
|
+
className: Y
|
|
271
|
+
}, pe) => {
|
|
272
|
+
const { t: o, i18n: he } = Re(), q = we(), b = d(
|
|
273
|
+
() => `chart-${q.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
274
|
+
[q]
|
|
275
|
+
), P = `${b}-summary`, A = Ie(null), [Z, ue] = G(0);
|
|
276
|
+
Le(A);
|
|
277
|
+
const v = de ?? he.language ?? "en", [F, fe] = G(
|
|
275
278
|
() => {
|
|
276
279
|
try {
|
|
277
|
-
return
|
|
280
|
+
return ie();
|
|
278
281
|
} catch {
|
|
279
282
|
return {};
|
|
280
283
|
}
|
|
281
284
|
}
|
|
282
285
|
);
|
|
283
|
-
|
|
286
|
+
re(() => {
|
|
284
287
|
if (typeof document > "u") return;
|
|
285
288
|
let e;
|
|
286
289
|
const t = new MutationObserver(() => {
|
|
287
290
|
clearTimeout(e), e = setTimeout(() => {
|
|
288
291
|
try {
|
|
289
|
-
|
|
292
|
+
fe(ie());
|
|
290
293
|
} catch {
|
|
291
294
|
}
|
|
292
295
|
}, 50);
|
|
@@ -297,136 +300,140 @@ const qe = be(
|
|
|
297
300
|
}), () => {
|
|
298
301
|
clearTimeout(e), t.disconnect();
|
|
299
302
|
};
|
|
300
|
-
}, []),
|
|
303
|
+
}, []), re(() => {
|
|
301
304
|
const e = A.current;
|
|
302
305
|
if (!e || typeof ResizeObserver > "u") return;
|
|
303
|
-
const t = new ResizeObserver((
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
+
const t = new ResizeObserver((n) => {
|
|
307
|
+
const s = n[0];
|
|
308
|
+
s && ue(Math.floor(s.contentRect.width));
|
|
306
309
|
});
|
|
307
310
|
return t.observe(e), () => t.disconnect();
|
|
308
311
|
}, []);
|
|
309
|
-
const
|
|
310
|
-
if (!
|
|
311
|
-
const e =
|
|
312
|
-
(
|
|
312
|
+
const g = d(() => {
|
|
313
|
+
if (!_ || _.length === 0) return [];
|
|
314
|
+
const e = _.filter(
|
|
315
|
+
(n) => ne.includes(n)
|
|
313
316
|
);
|
|
314
|
-
if (!
|
|
317
|
+
if (!ne.includes(l))
|
|
315
318
|
return [];
|
|
316
319
|
const t = e.includes(l) ? e : [l, ...e];
|
|
317
320
|
return [...new Set(t)];
|
|
318
|
-
}, [
|
|
319
|
-
if (
|
|
321
|
+
}, [_, l]), u = g.length >= 2, [B, J] = G(null), a = u && B && g.includes(B) ? B : l, O = m(l), Q = m(a), { effectiveSeries: S, effectiveCategories: L, effectiveLabels: w } = d(() => {
|
|
322
|
+
if (O === Q)
|
|
320
323
|
return {
|
|
321
|
-
effectiveSeries:
|
|
322
|
-
effectiveCategories:
|
|
323
|
-
effectiveLabels:
|
|
324
|
+
effectiveSeries: k,
|
|
325
|
+
effectiveCategories: j,
|
|
326
|
+
effectiveLabels: x
|
|
324
327
|
};
|
|
325
|
-
if (!
|
|
326
|
-
const t =
|
|
328
|
+
if (!O) {
|
|
329
|
+
const t = k;
|
|
327
330
|
return {
|
|
328
331
|
effectiveSeries: t.map(
|
|
329
|
-
(
|
|
332
|
+
(s) => s.data.reduce((p, i) => p + i, 0)
|
|
330
333
|
),
|
|
331
334
|
effectiveCategories: void 0,
|
|
332
|
-
effectiveLabels: t.map((
|
|
335
|
+
effectiveLabels: t.map((s) => s.name)
|
|
333
336
|
};
|
|
334
337
|
}
|
|
335
|
-
const e =
|
|
338
|
+
const e = k;
|
|
336
339
|
return {
|
|
337
340
|
effectiveSeries: [
|
|
338
|
-
{ name:
|
|
341
|
+
{ name: o("chart.table.value"), data: e }
|
|
339
342
|
],
|
|
340
|
-
effectiveCategories:
|
|
343
|
+
effectiveCategories: x ?? [],
|
|
341
344
|
effectiveLabels: void 0
|
|
342
345
|
};
|
|
343
|
-
}, [
|
|
346
|
+
}, [k, j, x, O, Q, o]), M = d(
|
|
344
347
|
() => ({
|
|
345
348
|
async dataURI() {
|
|
346
|
-
const e =
|
|
349
|
+
const e = oe.getChartByID(b);
|
|
347
350
|
return e ? (await e.dataURI()).imgURI : "";
|
|
348
351
|
},
|
|
349
352
|
updateSeries(e) {
|
|
350
|
-
const t =
|
|
353
|
+
const t = oe.getChartByID(b);
|
|
351
354
|
if (!t) return;
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
355
|
+
const n = m(l), s = m(a);
|
|
356
|
+
if (n === s) {
|
|
354
357
|
t.updateSeries(e);
|
|
355
358
|
return;
|
|
356
359
|
}
|
|
357
|
-
if (!
|
|
360
|
+
if (!n) {
|
|
358
361
|
const p = e;
|
|
359
362
|
t.updateOptions(
|
|
360
|
-
{ labels: p.map((
|
|
363
|
+
{ labels: p.map((i) => i.name) },
|
|
361
364
|
!1,
|
|
362
365
|
!0
|
|
363
366
|
), t.updateSeries(
|
|
364
|
-
p.map((
|
|
367
|
+
p.map((i) => i.data.reduce((f, Te) => f + Te, 0))
|
|
365
368
|
);
|
|
366
369
|
return;
|
|
367
370
|
}
|
|
368
371
|
t.updateSeries([
|
|
369
|
-
{ name:
|
|
372
|
+
{ name: o("chart.table.value"), data: e }
|
|
370
373
|
]);
|
|
371
374
|
},
|
|
372
375
|
setType(e) {
|
|
373
|
-
return !u || !
|
|
376
|
+
return !u || !g.includes(e) ? !1 : (J(e), !0);
|
|
374
377
|
},
|
|
375
378
|
getTypeState() {
|
|
376
379
|
return {
|
|
377
380
|
declaredType: l,
|
|
378
|
-
effectiveType:
|
|
379
|
-
availableTypes: u ? [...
|
|
381
|
+
effectiveType: a,
|
|
382
|
+
availableTypes: u ? [...g] : []
|
|
380
383
|
};
|
|
381
384
|
}
|
|
382
385
|
}),
|
|
383
|
-
[
|
|
386
|
+
[b, l, a, o, u, g]
|
|
384
387
|
);
|
|
385
|
-
|
|
386
|
-
const
|
|
387
|
-
() =>
|
|
388
|
-
[
|
|
389
|
-
),
|
|
390
|
-
() => new Intl.NumberFormat(
|
|
391
|
-
[
|
|
392
|
-
),
|
|
393
|
-
() =>
|
|
394
|
-
[
|
|
395
|
-
),
|
|
388
|
+
Ce(pe, () => M, [M]), Ee(Ke, M, h);
|
|
389
|
+
const $ = typeof document < "u" && document.documentElement.dir === "rtl", X = d(
|
|
390
|
+
() => Fe(S, a),
|
|
391
|
+
[S, a]
|
|
392
|
+
), ee = d(
|
|
393
|
+
() => new Intl.NumberFormat(v),
|
|
394
|
+
[v]
|
|
395
|
+
), T = d(
|
|
396
|
+
() => W ?? ((e) => ee.format(e)),
|
|
397
|
+
[W, ee]
|
|
398
|
+
), te = d(
|
|
396
399
|
() => ({
|
|
397
|
-
name:
|
|
400
|
+
name: v,
|
|
398
401
|
options: {
|
|
399
402
|
toolbar: {
|
|
400
|
-
download:
|
|
401
|
-
selection:
|
|
402
|
-
selectionZoom:
|
|
403
|
-
zoomIn:
|
|
404
|
-
zoomOut:
|
|
405
|
-
pan:
|
|
406
|
-
reset:
|
|
407
|
-
exportToSVG:
|
|
408
|
-
exportToPNG:
|
|
409
|
-
exportToCSV:
|
|
403
|
+
download: o("chart.toolbar.download"),
|
|
404
|
+
selection: o("chart.toolbar.selection"),
|
|
405
|
+
selectionZoom: o("chart.toolbar.selectionZoom"),
|
|
406
|
+
zoomIn: o("chart.toolbar.zoomIn"),
|
|
407
|
+
zoomOut: o("chart.toolbar.zoomOut"),
|
|
408
|
+
pan: o("chart.toolbar.pan"),
|
|
409
|
+
reset: o("chart.toolbar.reset"),
|
|
410
|
+
exportToSVG: o("chart.toolbar.exportToSVG"),
|
|
411
|
+
exportToPNG: o("chart.toolbar.exportToPNG"),
|
|
412
|
+
exportToCSV: o("chart.toolbar.exportToCSV")
|
|
410
413
|
}
|
|
411
414
|
}
|
|
412
415
|
}),
|
|
413
|
-
[
|
|
414
|
-
),
|
|
415
|
-
var
|
|
416
|
-
const e =
|
|
416
|
+
[v, o]
|
|
417
|
+
), H = xe(), me = d(() => {
|
|
418
|
+
var n, s, p;
|
|
419
|
+
const e = F, t = {
|
|
417
420
|
...e,
|
|
418
421
|
chart: {
|
|
419
422
|
...e.chart,
|
|
420
|
-
id:
|
|
421
|
-
toolbar: { show:
|
|
422
|
-
zoom: { enabled:
|
|
423
|
+
id: b,
|
|
424
|
+
toolbar: { show: N },
|
|
425
|
+
zoom: { enabled: N },
|
|
423
426
|
animations: {
|
|
424
|
-
enabled: !
|
|
425
|
-
dynamicAnimation: { enabled: !
|
|
427
|
+
enabled: !H,
|
|
428
|
+
dynamicAnimation: { enabled: !H }
|
|
426
429
|
},
|
|
427
|
-
locales: [
|
|
428
|
-
defaultLocale:
|
|
429
|
-
parentHeightOffset: 0
|
|
430
|
+
locales: [te],
|
|
431
|
+
defaultLocale: v,
|
|
432
|
+
parentHeightOffset: 0,
|
|
433
|
+
// Stacking is an axis-only concept — gate on the categorical types
|
|
434
|
+
// so a slice/radial chart never receives it, and omit the key
|
|
435
|
+
// entirely when unstacked so the default output is byte-identical.
|
|
436
|
+
...U && se(a) ? { stacked: !0 } : {}
|
|
430
437
|
},
|
|
431
438
|
// Only set `labels` when the effective type actually has them (slice
|
|
432
439
|
// charts). Emitting `labels: undefined` crashes ApexCharts' bar
|
|
@@ -434,7 +441,7 @@ const qe = be(
|
|
|
434
441
|
// "Cannot read properties of undefined (reading 'length')", which
|
|
435
442
|
// aborts the render and leaves a blank chart. Absent is safe; area /
|
|
436
443
|
// line tolerate the undefined but bar does not, so never pass it.
|
|
437
|
-
...
|
|
444
|
+
...w ? { labels: w } : {},
|
|
438
445
|
legend: {
|
|
439
446
|
...e.legend,
|
|
440
447
|
position: "bottom",
|
|
@@ -442,168 +449,185 @@ const qe = be(
|
|
|
442
449
|
// to the chart's own text flow. For RTL we flip via `yaxis.opposite`
|
|
443
450
|
// and ApexCharts' own `direction: 'rtl'` handling; legend stays anchored
|
|
444
451
|
// to the inline-start by asking for 'left' on LTR and 'right' on RTL.
|
|
445
|
-
horizontalAlign:
|
|
452
|
+
horizontalAlign: $ ? "right" : "left",
|
|
446
453
|
fontFamily: "inherit"
|
|
447
454
|
},
|
|
448
455
|
tooltip: {
|
|
449
456
|
...e.tooltip,
|
|
450
457
|
y: {
|
|
451
|
-
formatter: (
|
|
458
|
+
formatter: (i) => T(i)
|
|
452
459
|
}
|
|
453
460
|
},
|
|
454
461
|
noData: {
|
|
455
|
-
text:
|
|
462
|
+
text: o("chart.noData")
|
|
456
463
|
}
|
|
457
464
|
};
|
|
458
|
-
if (
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
465
|
+
if (R && R.length > 0 && (t.colors = R), se(a)) {
|
|
466
|
+
const i = a === "bar" && E === "horizontal";
|
|
467
|
+
t.xaxis = {
|
|
468
|
+
...e.xaxis,
|
|
469
|
+
categories: L ?? [],
|
|
470
|
+
...i ? {
|
|
471
|
+
labels: {
|
|
472
|
+
formatter: (f) => T(Number(f))
|
|
473
|
+
}
|
|
474
|
+
} : {}
|
|
475
|
+
}, t.yaxis = {
|
|
476
|
+
...e.yaxis,
|
|
477
|
+
opposite: $,
|
|
478
|
+
...i ? {} : { labels: { formatter: (f) => T(f) } }
|
|
479
|
+
}, t.stroke = {
|
|
480
|
+
curve: V,
|
|
481
|
+
width: a === "bar" ? 0 : 2
|
|
482
|
+
}, t.dataLabels = { enabled: !1 };
|
|
483
|
+
}
|
|
484
|
+
if (a === "radialBar" && y) {
|
|
485
|
+
const i = e.plotOptions ?? {};
|
|
472
486
|
t.plotOptions = {
|
|
473
|
-
...
|
|
487
|
+
...i,
|
|
474
488
|
radialBar: {
|
|
475
|
-
...
|
|
489
|
+
...i.radialBar ?? {},
|
|
476
490
|
dataLabels: {
|
|
477
|
-
...((
|
|
491
|
+
...((n = i.radialBar) == null ? void 0 : n.dataLabels) ?? {},
|
|
478
492
|
value: {
|
|
479
|
-
...((p = (
|
|
480
|
-
formatter: (
|
|
493
|
+
...((p = (s = i.radialBar) == null ? void 0 : s.dataLabels) == null ? void 0 : p.value) ?? {},
|
|
494
|
+
formatter: (f) => y(Number(f))
|
|
481
495
|
}
|
|
482
496
|
}
|
|
483
497
|
}
|
|
484
498
|
};
|
|
485
499
|
}
|
|
486
|
-
|
|
500
|
+
if (a === "bar" && E === "horizontal") {
|
|
501
|
+
const i = e.plotOptions ?? {};
|
|
502
|
+
t.plotOptions = {
|
|
503
|
+
...i,
|
|
504
|
+
bar: { ...i.bar ?? {}, horizontal: !0 }
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
return K ? t.fill = {
|
|
487
508
|
type: "pattern",
|
|
488
|
-
opacity:
|
|
509
|
+
opacity: a === "area" ? 0.3 : 1,
|
|
489
510
|
pattern: {
|
|
490
|
-
style: [...
|
|
511
|
+
style: [...Ve],
|
|
491
512
|
strokeWidth: 2
|
|
492
513
|
}
|
|
493
|
-
} :
|
|
514
|
+
} : a === "area" && (t.fill = {
|
|
494
515
|
type: "gradient",
|
|
495
516
|
opacity: 0.3
|
|
496
517
|
}), t;
|
|
497
518
|
}, [
|
|
498
|
-
|
|
499
|
-
y,
|
|
500
|
-
x,
|
|
501
|
-
O,
|
|
502
|
-
Q,
|
|
519
|
+
F,
|
|
503
520
|
b,
|
|
521
|
+
N,
|
|
522
|
+
H,
|
|
523
|
+
te,
|
|
524
|
+
v,
|
|
525
|
+
w,
|
|
504
526
|
T,
|
|
505
|
-
S,
|
|
506
|
-
r,
|
|
507
527
|
o,
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
528
|
+
a,
|
|
529
|
+
L,
|
|
530
|
+
$,
|
|
531
|
+
K,
|
|
532
|
+
U,
|
|
533
|
+
E,
|
|
534
|
+
V,
|
|
535
|
+
R,
|
|
536
|
+
y
|
|
537
|
+
]), ye = ce ?? (Z > 0 ? Z : "100%"), be = D ?? 320, ve = d(() => {
|
|
538
|
+
const e = m(a) ? w ?? [] : L ?? [], t = X;
|
|
539
|
+
return /* @__PURE__ */ I("table", { id: P, className: "ds:sr-only", children: [
|
|
540
|
+
/* @__PURE__ */ c("caption", { children: r }),
|
|
541
|
+
/* @__PURE__ */ c("thead", { children: /* @__PURE__ */ I("tr", { children: [
|
|
542
|
+
/* @__PURE__ */ c("th", { scope: "col", children: o("chart.table.series") }),
|
|
543
|
+
e.map((n, s) => /* @__PURE__ */ c("th", { scope: "col", children: n }, `${n}-${s}`))
|
|
520
544
|
] }) }),
|
|
521
|
-
/* @__PURE__ */ c("tbody", { children: t.map((
|
|
522
|
-
/* @__PURE__ */ c("th", { scope: "row", children:
|
|
523
|
-
|
|
524
|
-
] }, `${
|
|
545
|
+
/* @__PURE__ */ c("tbody", { children: t.map((n, s) => /* @__PURE__ */ I("tr", { children: [
|
|
546
|
+
/* @__PURE__ */ c("th", { scope: "row", children: n.name || o("chart.table.value") }),
|
|
547
|
+
n.data.map((p, i) => /* @__PURE__ */ c("td", { children: a === "radialBar" && y ? y(p) : T(p) }, `${s}-${i}`))
|
|
548
|
+
] }, `${n.name}-${s}`)) })
|
|
525
549
|
] });
|
|
526
550
|
}, [
|
|
527
|
-
o,
|
|
528
|
-
F,
|
|
529
|
-
T,
|
|
530
|
-
_,
|
|
531
|
-
N,
|
|
532
551
|
a,
|
|
552
|
+
X,
|
|
553
|
+
w,
|
|
554
|
+
L,
|
|
555
|
+
P,
|
|
533
556
|
r,
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
557
|
+
o,
|
|
558
|
+
T,
|
|
559
|
+
y
|
|
560
|
+
]), ge = d(() => (m(a), S), [S, a]), ae = /* @__PURE__ */ I(
|
|
537
561
|
"div",
|
|
538
562
|
{
|
|
539
563
|
ref: A,
|
|
540
564
|
role: "img",
|
|
541
|
-
"aria-label":
|
|
542
|
-
"aria-describedby":
|
|
543
|
-
className:
|
|
565
|
+
"aria-label": r,
|
|
566
|
+
"aria-describedby": P,
|
|
567
|
+
className: Ue({
|
|
544
568
|
// Explicit height wins over the density min-height unless the
|
|
545
569
|
// caller also asked for a density explicitly.
|
|
546
|
-
density:
|
|
547
|
-
className: u ? void 0 :
|
|
570
|
+
density: le ?? (D !== void 0 ? "none" : void 0),
|
|
571
|
+
className: u ? void 0 : Y
|
|
548
572
|
}),
|
|
549
573
|
...u ? {} : { "data-component": "chart", "data-component-id": h },
|
|
550
574
|
children: [
|
|
551
|
-
|
|
575
|
+
ve,
|
|
552
576
|
/* @__PURE__ */ c(
|
|
553
|
-
|
|
577
|
+
_e,
|
|
554
578
|
{
|
|
555
|
-
type:
|
|
556
|
-
series:
|
|
557
|
-
options:
|
|
558
|
-
width:
|
|
559
|
-
height:
|
|
579
|
+
type: a,
|
|
580
|
+
series: ge,
|
|
581
|
+
options: me,
|
|
582
|
+
width: ye,
|
|
583
|
+
height: be,
|
|
560
584
|
"aria-hidden": "true"
|
|
561
585
|
},
|
|
562
|
-
|
|
586
|
+
a
|
|
563
587
|
)
|
|
564
588
|
]
|
|
565
589
|
}
|
|
566
590
|
);
|
|
567
|
-
return u ? /* @__PURE__ */
|
|
591
|
+
return u ? /* @__PURE__ */ I(
|
|
568
592
|
"div",
|
|
569
593
|
{
|
|
570
594
|
"data-component": "chart",
|
|
571
595
|
"data-component-id": h,
|
|
572
|
-
className: `ds:block ds:w-full ${
|
|
596
|
+
className: `ds:block ds:w-full ${Y ?? ""}`.trim(),
|
|
573
597
|
children: [
|
|
574
598
|
/* @__PURE__ */ c("div", { className: "ds:mb-[var(--spacing-xs)] ds:flex ds:justify-end", children: /* @__PURE__ */ c(
|
|
575
|
-
|
|
599
|
+
ze,
|
|
576
600
|
{
|
|
577
601
|
role: "radiogroup",
|
|
578
602
|
mode: "toggle-single",
|
|
579
603
|
size: "sm",
|
|
580
|
-
"aria-label":
|
|
581
|
-
value:
|
|
604
|
+
"aria-label": o("chart.typeSwitcher.label"),
|
|
605
|
+
value: a,
|
|
582
606
|
onValueChange: (e) => {
|
|
583
|
-
e !==
|
|
607
|
+
e !== a && (J(e), z == null || z(e));
|
|
584
608
|
},
|
|
585
|
-
children:
|
|
586
|
-
|
|
609
|
+
children: g.map((e) => /* @__PURE__ */ c(
|
|
610
|
+
Ne,
|
|
587
611
|
{
|
|
588
612
|
value: e,
|
|
589
613
|
type: "button",
|
|
590
|
-
icon:
|
|
591
|
-
"aria-label":
|
|
614
|
+
icon: Ze[e],
|
|
615
|
+
"aria-label": o(qe[e])
|
|
592
616
|
},
|
|
593
617
|
e
|
|
594
618
|
))
|
|
595
619
|
}
|
|
596
620
|
) }),
|
|
597
|
-
|
|
621
|
+
ae
|
|
598
622
|
]
|
|
599
623
|
}
|
|
600
|
-
) :
|
|
624
|
+
) : ae;
|
|
601
625
|
}
|
|
602
626
|
);
|
|
603
|
-
|
|
627
|
+
Je.displayName = "Chart";
|
|
604
628
|
export {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
629
|
+
Je as C,
|
|
630
|
+
Ue as a,
|
|
631
|
+
Ke as c
|
|
608
632
|
};
|
|
609
|
-
//# sourceMappingURL=chart-
|
|
633
|
+
//# sourceMappingURL=chart-CNaLgvx4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-CNaLgvx4.js","sources":["../../node_modules/lucide-react/dist/esm/icons/chart-area.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-column.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-line.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-pie.mjs","../../node_modules/lucide-react/dist/esm/icons/donut.mjs","../../src/components/chart/chart.agent.ts","../../src/components/chart/chart.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\n \"path\",\n {\n d: \"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z\",\n key: \"q0gr47\"\n }\n ]\n];\nconst ChartArea = createLucideIcon(\"chart-area\", __iconNode);\n\nexport { __iconNode, ChartArea as default };\n//# sourceMappingURL=chart-area.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\"path\", { d: \"M18 17V9\", key: \"2bz60n\" }],\n [\"path\", { d: \"M13 17V5\", key: \"1frdt8\" }],\n [\"path\", { d: \"M8 17v-3\", key: \"17ska0\" }]\n];\nconst ChartColumn = createLucideIcon(\"chart-column\", __iconNode);\n\nexport { __iconNode, ChartColumn as default };\n//# sourceMappingURL=chart-column.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\"path\", { d: \"m19 9-5 5-4-4-3 3\", key: \"2osh9i\" }]\n];\nconst ChartLine = createLucideIcon(\"chart-line\", __iconNode);\n\nexport { __iconNode, ChartLine as default };\n//# sourceMappingURL=chart-line.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z\",\n key: \"pzmjnu\"\n }\n ],\n [\"path\", { d: \"M21.21 15.89A10 10 0 1 1 8 2.83\", key: \"k2fpak\" }]\n];\nconst ChartPie = createLucideIcon(\"chart-pie\", __iconNode);\n\nexport { __iconNode, ChartPie as default };\n//# sourceMappingURL=chart-pie.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3\",\n key: \"19sr3x\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\", key: \"1v7zrd\" }]\n];\nconst Donut = createLucideIcon(\"donut\", __iconNode);\n\nexport { __iconNode, Donut as default };\n//# sourceMappingURL=donut.mjs.map\n","import type { AgentAdapter } from '../../agent/types';\nimport type { ChartHandle } from './chart';\n\nexport const chartAgent: AgentAdapter<ChartHandle> = {\n id: 'chart',\n // view_change backs the opt-in type switcher (`switchableTypes` prop):\n // the same chart re-presented as line / bar / area / pie / donut.\n capabilities: ['view_change'],\n state: {\n declaredType: {\n type: \"'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'\",\n descriptionKey: 'ui.agent.chart.state.declaredType',\n description:\n 'The consumer-declared chart type — the shape `update_series` expects.',\n read: (handle) => handle.getTypeState().declaredType,\n },\n effectiveType: {\n type: \"'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'\",\n descriptionKey: 'ui.agent.chart.state.effectiveType',\n description:\n 'The type currently rendered — differs from declaredType after a type-switcher pick.',\n read: (handle) => handle.getTypeState().effectiveType,\n },\n availableTypes: {\n type: 'ChartType[]',\n descriptionKey: 'ui.agent.chart.state.availableTypes',\n description:\n 'Types the switcher offers. Empty when the chart has no type switcher.',\n read: (handle) => handle.getTypeState().availableTypes,\n },\n },\n actions: {\n change_view: {\n // Switching the presentation is a write (it changes what the user\n // sees) but is trivially reversible by switching back.\n safety: 'write',\n argsType: 'type',\n argsSchema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['line', 'bar', 'area', 'pie', 'donut'],\n description: 'The chart type to render.',\n },\n },\n required: ['type'],\n },\n returns: 'boolean (accepted)',\n returnsSchema: {\n type: 'boolean',\n description:\n 'True when the switch was applied; false when the chart has no type switcher or the type is not offered (check availableTypes first).',\n },\n idempotent: true,\n descriptionKey: 'ui.agent.chart.actions.changeView',\n description:\n 'Switch the rendered chart type via the type switcher. No-op (returns false) when the chart has no switcher or the type is not offered.',\n invoke: (handle, args: { type: string }) =>\n handle.setType(args.type as Parameters<ChartHandle['setType']>[0]),\n },\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:\n 'Replace the chart series without remounting. Pass the DECLARED type’s shape (see declaredType state) — when the user has switched the view cross-shape the values are converted to the rendered shape. The write targets the live instance only: a later type switch re-reads the original props and discards it.',\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 {\n ChartArea,\n ChartColumn,\n ChartLine,\n ChartPie,\n Donut,\n} from 'lucide-react';\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';\nimport { IconButton } from '../button/icon-button';\nimport { IconButtonGroup } from '../icon-button-group';\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\n/** Bar orientation. `'horizontal'` renders a ranking sideways. Default `'vertical'`. */\nexport type ChartOrientation = 'vertical' | 'horizontal';\n\n/** Line / area stroke interpolation. Default `'smooth'`. */\nexport type ChartCurve = 'smooth' | 'straight' | 'stepline';\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 * Stack multiple `bar` / `area` series into a composition-over-time view.\n * Maps to ApexCharts `chart.stacked`. Only applies to the axis types\n * (`line` / `bar` / `area`); slice types (`pie` / `donut` / `radialBar`)\n * have no axis to stack against and ignore it. Default `false` — an\n * unstacked chart emits no `chart.stacked` key and renders identically to\n * before this prop existed.\n */\n stacked?: boolean;\n /**\n * Orientation for the `bar` type. `'horizontal'` renders the bars sideways\n * (ApexCharts `plotOptions.bar.horizontal`) for ranking-style charts where\n * the category is a name and the value runs across the horizontal axis.\n * Still an axis chart — pass `series` as `ChartSeries[]` with `categories`.\n * Ignored for every non-`bar` type. Default `'vertical'`.\n */\n orientation?: ChartOrientation;\n /**\n * Stroke interpolation for `line` / `area` charts (ApexCharts\n * `stroke.curve`). `'straight'` avoids the overshoot a smoothed spline\n * introduces on spiky monthly financials — where a `'smooth'` curve can dip\n * visually below zero between two positive points. Inert on `bar` (stroke\n * width is 0) and ignored on slice types. Default `'smooth'` — existing\n * charts are unaffected.\n */\n curve?: ChartCurve;\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 /**\n * Opt-in type switcher. Pass two or more of `'line' | 'bar' | 'area' |\n * 'pie' | 'donut'` to render an icon radiogroup (an `IconButtonGroup`)\n * above the plot that lets the user flip the chart between those types.\n * `type` is the initial selection and is always offered; the user's pick\n * then sticks across re-renders (remount with a new `key` to reset it).\n * When the picked type reads the other data shape, the data adapts: axis\n * series collapse to one slice per series (that series' total) for `pie` /\n * `donut`, and slice values become a single-series axis chart with\n * `labels` as the categories. `radialBar` cannot participate — such\n * entries are ignored (DEV warning) and a `radialBar` chart never shows\n * the switcher.\n */\n switchableTypes?: ChartType[];\n /** Called when the user picks a different type via the switcher. */\n onTypeChange?: (type: ChartType) => void;\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 /**\n * Updates series without remounting. Always pass the DECLARED `type`'s\n * shape — while the user has switched the view across the axis/slice\n * boundary the values (and, for axis→slice, the slice labels) are\n * converted to the rendered shape; for slice→axis the categories stay\n * the `labels` prop, so keep the value count stable. The update writes\n * to the live ApexCharts instance only: a later type switch remounts\n * from the original props and discards it.\n */\n updateSeries: (next: ChartProps['series']) => void;\n /**\n * Switches the rendered type via the type switcher. Returns `false`\n * (no-op) when the switcher is not enabled or the type is not offered.\n */\n setType: (next: ChartType) => boolean;\n /** Declared vs rendered type plus the types the switcher offers ([] when disabled). */\n getTypeState: () => {\n declaredType: ChartType;\n effectiveType: ChartType;\n availableTypes: ChartType[];\n };\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/** Types the switcher may offer. `radialBar` is excluded — its series are\n * synthetic arc percents that cannot be re-plotted on an axis or as slices. */\nconst SWITCHABLE_TYPES: ReadonlyArray<ChartType> = [\n 'line',\n 'bar',\n 'area',\n 'pie',\n 'donut',\n];\n\ntype SwitchableType = Exclude<ChartType, 'radialBar'>;\n\n/* Static key map (not template-built) so the i18n coverage tooling can see\n every key literally. */\nconst TYPE_SWITCHER_LABEL_KEYS: Record<SwitchableType, string> = {\n line: 'chart.typeSwitcher.line',\n bar: 'chart.typeSwitcher.bar',\n area: 'chart.typeSwitcher.area',\n pie: 'chart.typeSwitcher.pie',\n donut: 'chart.typeSwitcher.donut',\n};\n\nconst TYPE_SWITCHER_ICONS: Record<SwitchableType, React.ReactNode> = {\n line: <ChartLine />,\n bar: <ChartColumn />,\n area: <ChartArea />,\n pie: <ChartPie />,\n donut: <Donut />,\n};\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 stacked = false,\n orientation = 'vertical',\n curve = 'smooth',\n colors,\n toolbar = false,\n locale: localeProp,\n radialValueFormatter,\n valueFormatter,\n switchableTypes,\n onTypeChange,\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 /* ---- type switcher ---------------------------------------------- */\n const switcherTypes = useMemo<SwitchableType[]>(() => {\n if (!switchableTypes || switchableTypes.length === 0) return [];\n const valid = switchableTypes.filter((entry): entry is SwitchableType =>\n SWITCHABLE_TYPES.includes(entry),\n );\n if (import.meta.env.DEV && valid.length !== switchableTypes.length) {\n console.warn(\n \"Chart: `switchableTypes` accepts 'line' | 'bar' | 'area' | 'pie' | 'donut' — other entries are ignored.\",\n );\n }\n if (!SWITCHABLE_TYPES.includes(type)) {\n if (import.meta.env.DEV && valid.length > 0) {\n console.warn(\n 'Chart: the type switcher is unavailable when `type` is \"radialBar\".',\n );\n }\n return [];\n }\n const withCurrent = valid.includes(type as SwitchableType)\n ? valid\n : [type as SwitchableType, ...valid];\n return [...new Set(withCurrent)];\n }, [switchableTypes, type]);\n const switcherEnabled = switcherTypes.length >= 2;\n\n const [pickedType, setPickedType] = useState<SwitchableType | null>(null);\n const effectiveType: ChartType =\n switcherEnabled && pickedType && switcherTypes.includes(pickedType)\n ? pickedType\n : type;\n\n /* ---- data adaptation for the switcher --------------------------- */\n /* Axis and slice types read different `series` shapes. When the user */\n /* switches across that boundary the data adapts: each axis series */\n /* becomes one slice (its total across the categories), and slice */\n /* values become one axis series with `labels` as the categories. */\n /* Same-shape switches (line/bar/area, pie/donut) pass through as-is. */\n const declaredIsSlice = isSliceType(type);\n const effectiveIsSlice = isSliceType(effectiveType);\n const { effectiveSeries, effectiveCategories, effectiveLabels } =\n useMemo(() => {\n if (declaredIsSlice === effectiveIsSlice) {\n return {\n effectiveSeries: series,\n effectiveCategories: categories,\n effectiveLabels: labels,\n };\n }\n if (!declaredIsSlice) {\n const rows = series as ChartSeries[];\n const totals = rows.map((row) =>\n row.data.reduce((sum, v) => sum + v, 0),\n );\n if (import.meta.env.DEV && totals.some((v) => v < 0)) {\n console.warn(\n 'Chart: the axis→slice adaptation produced a negative series total — pie/donut cannot represent negative values. Offer only axis types in `switchableTypes` for delta-style data.',\n );\n }\n return {\n effectiveSeries: totals,\n effectiveCategories: undefined,\n effectiveLabels: rows.map((row) => row.name),\n };\n }\n const values = series as number[];\n return {\n effectiveSeries: [\n { name: t('chart.table.value'), data: values },\n ] as ChartSeries[],\n effectiveCategories: labels ?? [],\n effectiveLabels: undefined,\n };\n }, [series, categories, labels, declaredIsSlice, effectiveIsSlice, t]);\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 // Callers always pass the DECLARED type's shape. When the user has\n // switched the view across the axis/slice boundary, convert to what\n // the live instance actually renders (mirrors the render-time\n // adaptation) so the update never hits a mismatched instance.\n const declaredSlice = isSliceType(type);\n const renderedSlice = isSliceType(effectiveType);\n if (declaredSlice === renderedSlice) {\n if (declaredSlice) instance.updateSeries(next as number[]);\n else instance.updateSeries(next as ChartSeries[]);\n return;\n }\n if (!declaredSlice) {\n const rows = next as ChartSeries[];\n // Keep slice labels in step with the incoming series — without\n // this, a series-count or name change desyncs slices from the\n // labels captured at the last React render.\n instance.updateOptions(\n { labels: rows.map((row) => row.name) },\n false,\n true,\n );\n instance.updateSeries(\n rows.map((row) => row.data.reduce((sum, v) => sum + v, 0)),\n );\n return;\n }\n instance.updateSeries([\n { name: t('chart.table.value'), data: next as number[] },\n ]);\n },\n setType(next: ChartType): boolean {\n if (!switcherEnabled) return false;\n if (!switcherTypes.includes(next as SwitchableType)) return false;\n setPickedType(next as SwitchableType);\n return true;\n },\n getTypeState() {\n return {\n declaredType: type,\n effectiveType,\n availableTypes: switcherEnabled\n ? ([...switcherTypes] as ChartType[])\n : [],\n };\n },\n }),\n [chartId, type, effectiveType, t, switcherEnabled, switcherTypes],\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(effectiveSeries, effectiveType),\n [effectiveSeries, effectiveType],\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 // Stacking is an axis-only concept — gate on the categorical types\n // so a slice/radial chart never receives it, and omit the key\n // entirely when unstacked so the default output is byte-identical.\n ...(stacked && isCategoricalType(effectiveType)\n ? { stacked: true }\n : {}),\n },\n // Only set `labels` when the effective type actually has 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 ...(effectiveLabels ? { labels: effectiveLabels } : {}),\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(effectiveType)) {\n // A horizontal bar makes ApexCharts swap axes: the numeric axis\n // becomes the x-axis and the categories move to the y-axis. The value\n // formatter must follow the numbers, so on a horizontal bar it lives\n // on `xaxis.labels` and the category y-axis keeps its default (string)\n // labels; every other categorical chart keeps the formatter on `yaxis`.\n const horizontalBar =\n effectiveType === 'bar' && orientation === 'horizontal';\n options.xaxis = {\n ...base.xaxis,\n categories: effectiveCategories ?? [],\n ...(horizontalBar\n ? {\n labels: {\n formatter: (value: string | number) =>\n formatValue(Number(value)),\n },\n }\n : {}),\n };\n options.yaxis = {\n ...base.yaxis,\n opposite: isRtl,\n ...(horizontalBar\n ? {}\n : { labels: { formatter: (value: number) => formatValue(value) } }),\n };\n options.stroke = {\n curve,\n width: effectiveType === 'bar' ? 0 : 2,\n };\n options.dataLabels = { enabled: false };\n }\n\n if (effectiveType === '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 // Horizontal bars for rankings. `bar` and `radialBar` are mutually\n // exclusive effective types, so this never collides with the radialBar\n // plotOptions above. Absent (vertical) = the ApexCharts default, so the\n // key is only emitted when the consumer opts in.\n if (effectiveType === 'bar' && orientation === 'horizontal') {\n const basePlot = (base.plotOptions ?? {}) as NonNullable<\n ApexCharts.ApexOptions['plotOptions']\n >;\n options.plotOptions = {\n ...basePlot,\n bar: { ...(basePlot.bar ?? {}), horizontal: true },\n };\n }\n\n if (patterns) {\n options.fill = {\n type: 'pattern',\n opacity: effectiveType === 'area' ? 0.3 : 1,\n pattern: {\n style: [...PATTERN_STYLES],\n strokeWidth: 2,\n },\n };\n } else if (effectiveType === '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 effectiveLabels,\n formatValue,\n t,\n effectiveType,\n effectiveCategories,\n isRtl,\n patterns,\n stacked,\n orientation,\n curve,\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(effectiveType)\n ? (effectiveLabels ?? [])\n : (effectiveCategories ?? []);\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 {effectiveType === 'radialBar' && radialValueFormatter\n ? radialValueFormatter(value)\n : formatValue(value)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n }, [\n effectiveType,\n tableSeries,\n effectiveLabels,\n effectiveCategories,\n summaryId,\n title,\n t,\n formatValue,\n radialValueFormatter,\n ]);\n\n /* ---- ApexCharts `series` prop shape ----------------------------- */\n const apexSeries = useMemo(() => {\n if (isSliceType(effectiveType)) {\n return effectiveSeries as number[];\n }\n return effectiveSeries as ChartSeries[];\n }, [effectiveSeries, effectiveType]);\n\n /* `key={effectiveType}` remounts ApexCharts on a switch: its in-place\n axis↔slice type transitions are unreliable (stale internal scales),\n and a clean mount is the documented-safe path. */\n const chartRegion = (\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: switcherEnabled ? undefined : className,\n })}\n {...(switcherEnabled\n ? {}\n : { 'data-component': 'chart', 'data-component-id': id })}\n >\n {srTable}\n <ReactApexChart\n key={effectiveType}\n type={effectiveType}\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 if (!switcherEnabled) return chartRegion;\n\n /* The switcher cannot live inside the `role=\"img\"` region — that role\n makes the whole subtree presentational, which would strip the radios\n from the accessibility tree. It renders as a sibling above the plot,\n and the bounding `data-component` marker moves to this shared\n wrapper so the component boundary still encloses everything. */\n return (\n <div\n data-component=\"chart\"\n data-component-id={id}\n className={`ds:block ds:w-full ${className ?? ''}`.trim()}\n >\n <div className=\"ds:mb-[var(--spacing-xs)] ds:flex ds:justify-end\">\n <IconButtonGroup\n role=\"radiogroup\"\n mode=\"toggle-single\"\n size=\"sm\"\n aria-label={t('chart.typeSwitcher.label')}\n value={effectiveType}\n onValueChange={(next) => {\n // Guard: keyboard paths can re-commit the current value; the\n // contract is \"called when the user picks a DIFFERENT type\".\n if (next === effectiveType) return;\n setPickedType(next as SwitchableType);\n onTypeChange?.(next as ChartType);\n }}\n >\n {switcherTypes.map((entry) => (\n <IconButton\n key={entry}\n value={entry}\n // Explicit — the default (submit) would post a surrounding\n // consumer <form> on click/Space.\n type=\"button\"\n icon={TYPE_SWITCHER_ICONS[entry]}\n aria-label={t(TYPE_SWITCHER_LABEL_KEYS[entry])}\n />\n ))}\n </IconButtonGroup>\n </div>\n {chartRegion}\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":["__iconNode","ChartArea","createLucideIcon","ChartColumn","ChartLine","ChartPie","Donut","chartAgent","handle","args","chartVariants","cva","PATTERN_STYLES","CATEGORICAL_TYPES","SLICE_TYPES","SWITCHABLE_TYPES","TYPE_SWITCHER_LABEL_KEYS","TYPE_SWITCHER_ICONS","isSliceType","type","isCategoricalType","normaliseSeries","series","Chart","forwardRef","title","id","categories","labels","height","width","patterns","stacked","orientation","curve","colors","toolbar","localeProp","radialValueFormatter","valueFormatter","switchableTypes","onTypeChange","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","switcherTypes","valid","withCurrent","switcherEnabled","pickedType","setPickedType","effectiveType","declaredIsSlice","effectiveIsSlice","effectiveSeries","effectiveCategories","effectiveLabels","rows","row","sum","v","values","agentHandle","instance","ApexCharts","next","declaredSlice","renderedSlice","useImperativeHandle","useAgentRegistration","isRtl","tableSeries","numberFormatter","formatValue","value","toolbarLocale","reducedMotion","usePrefersReducedMotion","chartOptions","base","options","horizontalBar","basePlot","_a","_c","_b","val","resolvedWidth","resolvedHeight","srTable","columnLabels","jsx","jsxs","col","i","rowIndex","colIndex","apexSeries","chartRegion","ReactApexChart","IconButtonGroup","IconButton"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,4BAA4B,KAAK,SAAQ,CAAE;AAAA,EACzD;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,KAAYC,EAAiB,cAAcF,EAAU;ACnB3D;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,4BAA4B,KAAK,SAAQ,CAAE;AAAA,EACzD,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAC3C,GACMG,KAAcD,EAAiB,gBAAgBF,EAAU;ACf/D;AAA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A;AAAA,gBANxCA;AAAA,cAAA,CAQR;AAAA,YAAA;AAAA,UAAA,GAEL;AAAA,UACCsD;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,IAzCwBA;AAAA,EA4C/B;AACF;AAEApG,GAAM,cAAc;","x_google_ignoreList":[0,1,2,3,4]}
|
package/dist/agent-catalog.json
CHANGED
|
@@ -7,6 +7,10 @@ export interface ChartSeries {
|
|
|
7
7
|
name: string;
|
|
8
8
|
data: number[];
|
|
9
9
|
}
|
|
10
|
+
/** Bar orientation. `'horizontal'` renders a ranking sideways. Default `'vertical'`. */
|
|
11
|
+
export type ChartOrientation = 'vertical' | 'horizontal';
|
|
12
|
+
/** Line / area stroke interpolation. Default `'smooth'`. */
|
|
13
|
+
export type ChartCurve = 'smooth' | 'straight' | 'stepline';
|
|
10
14
|
export interface ChartProps extends VariantProps<typeof chartVariants> {
|
|
11
15
|
/** Required — drives aria-label and sr-only table caption. */
|
|
12
16
|
title: string;
|
|
@@ -29,6 +33,32 @@ export interface ChartProps extends VariantProps<typeof chartVariants> {
|
|
|
29
33
|
width?: number | string;
|
|
30
34
|
/** Opt-in pattern fills for colour-blind users. */
|
|
31
35
|
patterns?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Stack multiple `bar` / `area` series into a composition-over-time view.
|
|
38
|
+
* Maps to ApexCharts `chart.stacked`. Only applies to the axis types
|
|
39
|
+
* (`line` / `bar` / `area`); slice types (`pie` / `donut` / `radialBar`)
|
|
40
|
+
* have no axis to stack against and ignore it. Default `false` — an
|
|
41
|
+
* unstacked chart emits no `chart.stacked` key and renders identically to
|
|
42
|
+
* before this prop existed.
|
|
43
|
+
*/
|
|
44
|
+
stacked?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Orientation for the `bar` type. `'horizontal'` renders the bars sideways
|
|
47
|
+
* (ApexCharts `plotOptions.bar.horizontal`) for ranking-style charts where
|
|
48
|
+
* the category is a name and the value runs across the horizontal axis.
|
|
49
|
+
* Still an axis chart — pass `series` as `ChartSeries[]` with `categories`.
|
|
50
|
+
* Ignored for every non-`bar` type. Default `'vertical'`.
|
|
51
|
+
*/
|
|
52
|
+
orientation?: ChartOrientation;
|
|
53
|
+
/**
|
|
54
|
+
* Stroke interpolation for `line` / `area` charts (ApexCharts
|
|
55
|
+
* `stroke.curve`). `'straight'` avoids the overshoot a smoothed spline
|
|
56
|
+
* introduces on spiky monthly financials — where a `'smooth'` curve can dip
|
|
57
|
+
* visually below zero between two positive points. Inert on `bar` (stroke
|
|
58
|
+
* width is 0) and ignored on slice types. Default `'smooth'` — existing
|
|
59
|
+
* charts are unaffected.
|
|
60
|
+
*/
|
|
61
|
+
curve?: ChartCurve;
|
|
32
62
|
/**
|
|
33
63
|
* Override the series colour ramp. Pass **already-resolved** colour strings
|
|
34
64
|
* (e.g. the live value of `var(--success)` sampled by the consumer) — these
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../src/components/chart/chart.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAuBlE,QAAA,MAAM,aAAa;;8EAYjB,CAAC;AAMH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC;AAEhF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,UAAW,SAAQ,YAAY,CAAC,OAAO,aAAa,CAAC;IACpE,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,yBAAyB;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB;;;OAGG;IACH,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,CAAC;IACjC,gDAAgD;IAChD,UAAU,CA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;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;IAC9B,oEAAoE;IACpE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,4CAA4C;IAC5C,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B;;;;;;;;OAQG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IACnD;;;OAGG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;IACtC,uFAAuF;IACvF,YAAY,EAAE,MAAM;QAClB,YAAY,EAAE,SAAS,CAAC;QACxB,aAAa,EAAE,SAAS,CAAC;QACzB,cAAc,EAAE,SAAS,EAAE,CAAC;KAC7B,CAAC;CACH;AAmFD,eAAO,MAAM,KAAK,oGAwlBjB,CAAC;AAQF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Chart, chartVariants } from './chart';
|
|
2
|
-
export type { ChartHandle, ChartProps, ChartSeries, ChartType } from './chart';
|
|
2
|
+
export type { ChartCurve, ChartHandle, ChartOrientation, ChartProps, ChartSeries, ChartType, } from './chart';
|
|
3
3
|
export { chartAgent } from './chart.agent';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -164,7 +164,7 @@ import { S as hp } from "./_chunks/separator-CYU_bGFn.js";
|
|
|
164
164
|
import { T as bp } from "./_chunks/theme-root-BOO73p5t.js";
|
|
165
165
|
import { C as Rp, U as _p, a as yp, b as vp, c as Dp } from "./_chunks/unit-converter-CSLWFDQh.js";
|
|
166
166
|
import { V as Mp } from "./_chunks/visually-hidden-BHxEUGyT.js";
|
|
167
|
-
import { C as Op, c as kp, a as Bp } from "./_chunks/chart-
|
|
167
|
+
import { C as Op, c as kp, a as Bp } from "./_chunks/chart-CNaLgvx4.js";
|
|
168
168
|
import { A as Hp, a as Gp } from "./_chunks/ai-prompt-input-DziJCGLe.js";
|
|
169
169
|
import { A as Up, a as Wp } from "./_chunks/audio-recorder-BjnB7V8n.js";
|
|
170
170
|
import { A as Kp } from "./_chunks/audio-visualiser-l6zPd0AG.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfadocs/ui-kit-debug",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chart-GFLv4cXm.js","sources":["../../node_modules/lucide-react/dist/esm/icons/chart-area.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-column.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-line.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-pie.mjs","../../node_modules/lucide-react/dist/esm/icons/donut.mjs","../../src/components/chart/chart.agent.ts","../../src/components/chart/chart.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\n \"path\",\n {\n d: \"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z\",\n key: \"q0gr47\"\n }\n ]\n];\nconst ChartArea = createLucideIcon(\"chart-area\", __iconNode);\n\nexport { __iconNode, ChartArea as default };\n//# sourceMappingURL=chart-area.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\"path\", { d: \"M18 17V9\", key: \"2bz60n\" }],\n [\"path\", { d: \"M13 17V5\", key: \"1frdt8\" }],\n [\"path\", { d: \"M8 17v-3\", key: \"17ska0\" }]\n];\nconst ChartColumn = createLucideIcon(\"chart-column\", __iconNode);\n\nexport { __iconNode, ChartColumn as default };\n//# sourceMappingURL=chart-column.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\"path\", { d: \"m19 9-5 5-4-4-3 3\", key: \"2osh9i\" }]\n];\nconst ChartLine = createLucideIcon(\"chart-line\", __iconNode);\n\nexport { __iconNode, ChartLine as default };\n//# sourceMappingURL=chart-line.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z\",\n key: \"pzmjnu\"\n }\n ],\n [\"path\", { d: \"M21.21 15.89A10 10 0 1 1 8 2.83\", key: \"k2fpak\" }]\n];\nconst ChartPie = createLucideIcon(\"chart-pie\", __iconNode);\n\nexport { __iconNode, ChartPie as default };\n//# sourceMappingURL=chart-pie.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3\",\n key: \"19sr3x\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\", key: \"1v7zrd\" }]\n];\nconst Donut = createLucideIcon(\"donut\", __iconNode);\n\nexport { __iconNode, Donut as default };\n//# sourceMappingURL=donut.mjs.map\n","import type { AgentAdapter } from '../../agent/types';\nimport type { ChartHandle } from './chart';\n\nexport const chartAgent: AgentAdapter<ChartHandle> = {\n id: 'chart',\n // view_change backs the opt-in type switcher (`switchableTypes` prop):\n // the same chart re-presented as line / bar / area / pie / donut.\n capabilities: ['view_change'],\n state: {\n declaredType: {\n type: \"'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'\",\n descriptionKey: 'ui.agent.chart.state.declaredType',\n description:\n 'The consumer-declared chart type — the shape `update_series` expects.',\n read: (handle) => handle.getTypeState().declaredType,\n },\n effectiveType: {\n type: \"'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'\",\n descriptionKey: 'ui.agent.chart.state.effectiveType',\n description:\n 'The type currently rendered — differs from declaredType after a type-switcher pick.',\n read: (handle) => handle.getTypeState().effectiveType,\n },\n availableTypes: {\n type: 'ChartType[]',\n descriptionKey: 'ui.agent.chart.state.availableTypes',\n description:\n 'Types the switcher offers. Empty when the chart has no type switcher.',\n read: (handle) => handle.getTypeState().availableTypes,\n },\n },\n actions: {\n change_view: {\n // Switching the presentation is a write (it changes what the user\n // sees) but is trivially reversible by switching back.\n safety: 'write',\n argsType: 'type',\n argsSchema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['line', 'bar', 'area', 'pie', 'donut'],\n description: 'The chart type to render.',\n },\n },\n required: ['type'],\n },\n returns: 'boolean (accepted)',\n returnsSchema: {\n type: 'boolean',\n description:\n 'True when the switch was applied; false when the chart has no type switcher or the type is not offered (check availableTypes first).',\n },\n idempotent: true,\n descriptionKey: 'ui.agent.chart.actions.changeView',\n description:\n 'Switch the rendered chart type via the type switcher. No-op (returns false) when the chart has no switcher or the type is not offered.',\n invoke: (handle, args: { type: string }) =>\n handle.setType(args.type as Parameters<ChartHandle['setType']>[0]),\n },\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:\n 'Replace the chart series without remounting. Pass the DECLARED type’s shape (see declaredType state) — when the user has switched the view cross-shape the values are converted to the rendered shape. The write targets the live instance only: a later type switch re-reads the original props and discards it.',\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 {\n ChartArea,\n ChartColumn,\n ChartLine,\n ChartPie,\n Donut,\n} from 'lucide-react';\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';\nimport { IconButton } from '../button/icon-button';\nimport { IconButtonGroup } from '../icon-button-group';\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 /**\n * Opt-in type switcher. Pass two or more of `'line' | 'bar' | 'area' |\n * 'pie' | 'donut'` to render an icon radiogroup (an `IconButtonGroup`)\n * above the plot that lets the user flip the chart between those types.\n * `type` is the initial selection and is always offered; the user's pick\n * then sticks across re-renders (remount with a new `key` to reset it).\n * When the picked type reads the other data shape, the data adapts: axis\n * series collapse to one slice per series (that series' total) for `pie` /\n * `donut`, and slice values become a single-series axis chart with\n * `labels` as the categories. `radialBar` cannot participate — such\n * entries are ignored (DEV warning) and a `radialBar` chart never shows\n * the switcher.\n */\n switchableTypes?: ChartType[];\n /** Called when the user picks a different type via the switcher. */\n onTypeChange?: (type: ChartType) => void;\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 /**\n * Updates series without remounting. Always pass the DECLARED `type`'s\n * shape — while the user has switched the view across the axis/slice\n * boundary the values (and, for axis→slice, the slice labels) are\n * converted to the rendered shape; for slice→axis the categories stay\n * the `labels` prop, so keep the value count stable. The update writes\n * to the live ApexCharts instance only: a later type switch remounts\n * from the original props and discards it.\n */\n updateSeries: (next: ChartProps['series']) => void;\n /**\n * Switches the rendered type via the type switcher. Returns `false`\n * (no-op) when the switcher is not enabled or the type is not offered.\n */\n setType: (next: ChartType) => boolean;\n /** Declared vs rendered type plus the types the switcher offers ([] when disabled). */\n getTypeState: () => {\n declaredType: ChartType;\n effectiveType: ChartType;\n availableTypes: ChartType[];\n };\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/** Types the switcher may offer. `radialBar` is excluded — its series are\n * synthetic arc percents that cannot be re-plotted on an axis or as slices. */\nconst SWITCHABLE_TYPES: ReadonlyArray<ChartType> = [\n 'line',\n 'bar',\n 'area',\n 'pie',\n 'donut',\n];\n\ntype SwitchableType = Exclude<ChartType, 'radialBar'>;\n\n/* Static key map (not template-built) so the i18n coverage tooling can see\n every key literally. */\nconst TYPE_SWITCHER_LABEL_KEYS: Record<SwitchableType, string> = {\n line: 'chart.typeSwitcher.line',\n bar: 'chart.typeSwitcher.bar',\n area: 'chart.typeSwitcher.area',\n pie: 'chart.typeSwitcher.pie',\n donut: 'chart.typeSwitcher.donut',\n};\n\nconst TYPE_SWITCHER_ICONS: Record<SwitchableType, React.ReactNode> = {\n line: <ChartLine />,\n bar: <ChartColumn />,\n area: <ChartArea />,\n pie: <ChartPie />,\n donut: <Donut />,\n};\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 switchableTypes,\n onTypeChange,\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 /* ---- type switcher ---------------------------------------------- */\n const switcherTypes = useMemo<SwitchableType[]>(() => {\n if (!switchableTypes || switchableTypes.length === 0) return [];\n const valid = switchableTypes.filter((entry): entry is SwitchableType =>\n SWITCHABLE_TYPES.includes(entry),\n );\n if (import.meta.env.DEV && valid.length !== switchableTypes.length) {\n console.warn(\n \"Chart: `switchableTypes` accepts 'line' | 'bar' | 'area' | 'pie' | 'donut' — other entries are ignored.\",\n );\n }\n if (!SWITCHABLE_TYPES.includes(type)) {\n if (import.meta.env.DEV && valid.length > 0) {\n console.warn(\n 'Chart: the type switcher is unavailable when `type` is \"radialBar\".',\n );\n }\n return [];\n }\n const withCurrent = valid.includes(type as SwitchableType)\n ? valid\n : [type as SwitchableType, ...valid];\n return [...new Set(withCurrent)];\n }, [switchableTypes, type]);\n const switcherEnabled = switcherTypes.length >= 2;\n\n const [pickedType, setPickedType] = useState<SwitchableType | null>(null);\n const effectiveType: ChartType =\n switcherEnabled && pickedType && switcherTypes.includes(pickedType)\n ? pickedType\n : type;\n\n /* ---- data adaptation for the switcher --------------------------- */\n /* Axis and slice types read different `series` shapes. When the user */\n /* switches across that boundary the data adapts: each axis series */\n /* becomes one slice (its total across the categories), and slice */\n /* values become one axis series with `labels` as the categories. */\n /* Same-shape switches (line/bar/area, pie/donut) pass through as-is. */\n const declaredIsSlice = isSliceType(type);\n const effectiveIsSlice = isSliceType(effectiveType);\n const { effectiveSeries, effectiveCategories, effectiveLabels } =\n useMemo(() => {\n if (declaredIsSlice === effectiveIsSlice) {\n return {\n effectiveSeries: series,\n effectiveCategories: categories,\n effectiveLabels: labels,\n };\n }\n if (!declaredIsSlice) {\n const rows = series as ChartSeries[];\n const totals = rows.map((row) =>\n row.data.reduce((sum, v) => sum + v, 0),\n );\n if (import.meta.env.DEV && totals.some((v) => v < 0)) {\n console.warn(\n 'Chart: the axis→slice adaptation produced a negative series total — pie/donut cannot represent negative values. Offer only axis types in `switchableTypes` for delta-style data.',\n );\n }\n return {\n effectiveSeries: totals,\n effectiveCategories: undefined,\n effectiveLabels: rows.map((row) => row.name),\n };\n }\n const values = series as number[];\n return {\n effectiveSeries: [\n { name: t('chart.table.value'), data: values },\n ] as ChartSeries[],\n effectiveCategories: labels ?? [],\n effectiveLabels: undefined,\n };\n }, [series, categories, labels, declaredIsSlice, effectiveIsSlice, t]);\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 // Callers always pass the DECLARED type's shape. When the user has\n // switched the view across the axis/slice boundary, convert to what\n // the live instance actually renders (mirrors the render-time\n // adaptation) so the update never hits a mismatched instance.\n const declaredSlice = isSliceType(type);\n const renderedSlice = isSliceType(effectiveType);\n if (declaredSlice === renderedSlice) {\n if (declaredSlice) instance.updateSeries(next as number[]);\n else instance.updateSeries(next as ChartSeries[]);\n return;\n }\n if (!declaredSlice) {\n const rows = next as ChartSeries[];\n // Keep slice labels in step with the incoming series — without\n // this, a series-count or name change desyncs slices from the\n // labels captured at the last React render.\n instance.updateOptions(\n { labels: rows.map((row) => row.name) },\n false,\n true,\n );\n instance.updateSeries(\n rows.map((row) => row.data.reduce((sum, v) => sum + v, 0)),\n );\n return;\n }\n instance.updateSeries([\n { name: t('chart.table.value'), data: next as number[] },\n ]);\n },\n setType(next: ChartType): boolean {\n if (!switcherEnabled) return false;\n if (!switcherTypes.includes(next as SwitchableType)) return false;\n setPickedType(next as SwitchableType);\n return true;\n },\n getTypeState() {\n return {\n declaredType: type,\n effectiveType,\n availableTypes: switcherEnabled\n ? ([...switcherTypes] as ChartType[])\n : [],\n };\n },\n }),\n [chartId, type, effectiveType, t, switcherEnabled, switcherTypes],\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(effectiveSeries, effectiveType),\n [effectiveSeries, effectiveType],\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 effective type actually has 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 ...(effectiveLabels ? { labels: effectiveLabels } : {}),\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(effectiveType)) {\n options.xaxis = {\n ...base.xaxis,\n categories: effectiveCategories ?? [],\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: effectiveType === 'bar' ? 0 : 2,\n };\n options.dataLabels = { enabled: false };\n }\n\n if (effectiveType === '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: effectiveType === 'area' ? 0.3 : 1,\n pattern: {\n style: [...PATTERN_STYLES],\n strokeWidth: 2,\n },\n };\n } else if (effectiveType === '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 effectiveLabels,\n formatValue,\n t,\n effectiveType,\n effectiveCategories,\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(effectiveType)\n ? (effectiveLabels ?? [])\n : (effectiveCategories ?? []);\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 {effectiveType === 'radialBar' && radialValueFormatter\n ? radialValueFormatter(value)\n : formatValue(value)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n }, [\n effectiveType,\n tableSeries,\n effectiveLabels,\n effectiveCategories,\n summaryId,\n title,\n t,\n formatValue,\n radialValueFormatter,\n ]);\n\n /* ---- ApexCharts `series` prop shape ----------------------------- */\n const apexSeries = useMemo(() => {\n if (isSliceType(effectiveType)) {\n return effectiveSeries as number[];\n }\n return effectiveSeries as ChartSeries[];\n }, [effectiveSeries, effectiveType]);\n\n /* `key={effectiveType}` remounts ApexCharts on a switch: its in-place\n axis↔slice type transitions are unreliable (stale internal scales),\n and a clean mount is the documented-safe path. */\n const chartRegion = (\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: switcherEnabled ? undefined : className,\n })}\n {...(switcherEnabled\n ? {}\n : { 'data-component': 'chart', 'data-component-id': id })}\n >\n {srTable}\n <ReactApexChart\n key={effectiveType}\n type={effectiveType}\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 if (!switcherEnabled) return chartRegion;\n\n /* The switcher cannot live inside the `role=\"img\"` region — that role\n makes the whole subtree presentational, which would strip the radios\n from the accessibility tree. It renders as a sibling above the plot,\n and the bounding `data-component` marker moves to this shared\n wrapper so the component boundary still encloses everything. */\n return (\n <div\n data-component=\"chart\"\n data-component-id={id}\n className={`ds:block ds:w-full ${className ?? ''}`.trim()}\n >\n <div className=\"ds:mb-[var(--spacing-xs)] ds:flex ds:justify-end\">\n <IconButtonGroup\n role=\"radiogroup\"\n mode=\"toggle-single\"\n size=\"sm\"\n aria-label={t('chart.typeSwitcher.label')}\n value={effectiveType}\n onValueChange={(next) => {\n // Guard: keyboard paths can re-commit the current value; the\n // contract is \"called when the user picks a DIFFERENT type\".\n if (next === effectiveType) return;\n setPickedType(next as SwitchableType);\n onTypeChange?.(next as ChartType);\n }}\n >\n {switcherTypes.map((entry) => (\n <IconButton\n key={entry}\n value={entry}\n // Explicit — the default (submit) would post a surrounding\n // consumer <form> on click/Space.\n type=\"button\"\n icon={TYPE_SWITCHER_ICONS[entry]}\n aria-label={t(TYPE_SWITCHER_LABEL_KEYS[entry])}\n />\n ))}\n </IconButtonGroup>\n </div>\n {chartRegion}\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":["__iconNode","ChartArea","createLucideIcon","ChartColumn","ChartLine","ChartPie","Donut","chartAgent","handle","args","chartVariants","cva","PATTERN_STYLES","CATEGORICAL_TYPES","SLICE_TYPES","SWITCHABLE_TYPES","TYPE_SWITCHER_LABEL_KEYS","TYPE_SWITCHER_ICONS","isSliceType","type","isCategoricalType","normaliseSeries","series","Chart","forwardRef","title","id","categories","labels","height","width","patterns","colors","toolbar","localeProp","radialValueFormatter","valueFormatter","switchableTypes","onTypeChange","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","switcherTypes","valid","withCurrent","switcherEnabled","pickedType","setPickedType","effectiveType","declaredIsSlice","effectiveIsSlice","effectiveSeries","effectiveCategories","effectiveLabels","rows","row","sum","v","values","agentHandle","instance","ApexCharts","next","declaredSlice","renderedSlice","useImperativeHandle","useAgentRegistration","isRtl","tableSeries","numberFormatter","formatValue","value","toolbarLocale","reducedMotion","usePrefersReducedMotion","chartOptions","base","options","basePlot","_a","_c","_b","val","resolvedWidth","resolvedHeight","srTable","columnLabels","jsx","jsxs","col","i","rowIndex","colIndex","apexSeries","chartRegion","ReactApexChart","IconButtonGroup","IconButton"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,4BAA4B,KAAK,SAAQ,CAAE;AAAA,EACzD;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA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