@alfadocs/ui-kit-debug 0.93.0 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/_chunks/apexcharts-theme-B_AxGC_h.js +72 -0
  2. package/dist/_chunks/apexcharts-theme-B_AxGC_h.js.map +1 -0
  3. package/dist/_chunks/chart-DR68TJD5.js +705 -0
  4. package/dist/_chunks/chart-DR68TJD5.js.map +1 -0
  5. package/dist/_chunks/{date-range-picker-Cc4DLAL2.js → date-range-picker-pEG3Ln3i.js} +315 -290
  6. package/dist/_chunks/date-range-picker-pEG3Ln3i.js.map +1 -0
  7. package/dist/_chunks/{link-cell-renderer-DQjZeoAr.js → link-cell-renderer-flfZh2qY.js} +2 -2
  8. package/dist/_chunks/{link-cell-renderer-DQjZeoAr.js.map → link-cell-renderer-flfZh2qY.js.map} +1 -1
  9. package/dist/_chunks/{patient-table-DU_zFZoq.js → patient-table-CvZTIM2R.js} +2 -2
  10. package/dist/_chunks/{patient-table-DU_zFZoq.js.map → patient-table-CvZTIM2R.js.map} +1 -1
  11. package/dist/_chunks/{radiograph-panel.agent-rnrQZtK3.js → radiograph-panel.agent-AsXJBr1p.js} +2 -2
  12. package/dist/_chunks/{radiograph-panel.agent-rnrQZtK3.js.map → radiograph-panel.agent-AsXJBr1p.js.map} +1 -1
  13. package/dist/_chunks/{sparkline-iOXYgvJe.js → sparkline-DcXqRZoq.js} +2 -2
  14. package/dist/_chunks/{sparkline-iOXYgvJe.js.map → sparkline-DcXqRZoq.js.map} +1 -1
  15. package/dist/agent-catalog.json +9 -1
  16. package/dist/components/chart/chart.agent.d.ts.map +1 -1
  17. package/dist/components/chart/chart.d.ts +27 -0
  18. package/dist/components/chart/chart.d.ts.map +1 -1
  19. package/dist/components/chart/index.js +1 -1
  20. package/dist/components/data-table/index.js +1 -1
  21. package/dist/components/date-range-picker/date-range-picker.d.ts +22 -1
  22. package/dist/components/date-range-picker/date-range-picker.d.ts.map +1 -1
  23. package/dist/components/date-range-picker/index.js +1 -1
  24. package/dist/components/patient-table/index.js +1 -1
  25. package/dist/components/radiograph-panel/index.js +1 -1
  26. package/dist/components/sparkline/index.js +1 -1
  27. package/dist/index.js +6 -6
  28. package/dist/tokens/apexcharts-theme.d.ts +22 -1
  29. package/dist/tokens/apexcharts-theme.d.ts.map +1 -1
  30. package/dist/tokens.css +1 -1
  31. package/package.json +1 -1
  32. package/dist/_chunks/apexcharts-theme-BJigns_V.js +0 -53
  33. package/dist/_chunks/apexcharts-theme-BJigns_V.js.map +0 -1
  34. package/dist/_chunks/chart-CNaLgvx4.js +0 -633
  35. package/dist/_chunks/chart-CNaLgvx4.js.map +0 -1
  36. package/dist/_chunks/date-range-picker-Cc4DLAL2.js.map +0 -1
@@ -0,0 +1,705 @@
1
+ import { jsxs as O, jsx as d } from "react/jsx-runtime";
2
+ import { forwardRef as $e, useId as ze, useMemo as b, useRef as Me, useState as F, useEffect as be, useImperativeHandle as Pe } from "react";
3
+ import { c as He } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as De } from "react-i18next";
5
+ import qe from "react-apexcharts";
6
+ import ge from "apexcharts";
7
+ import { u as Ge, g as ve, a as Ue, r as We } from "./apexcharts-theme-B_AxGC_h.js";
8
+ import { u as je } from "./use-prefers-reduced-motion-BMwIQRjB.js";
9
+ import { u as Ke } from "./registry-DvAUVLHh.js";
10
+ import { I as Ve } from "./icon-button-C_kbcd7I.js";
11
+ import { I as Ye } from "./icon-button-group-BLHPN6jg.js";
12
+ import { c as N } from "./createLucideIcon-DhHxpK9K.js";
13
+ /**
14
+ * @license lucide-react v1.22.0 - ISC
15
+ *
16
+ * This source code is licensed under the ISC license.
17
+ * See the LICENSE file in the root directory of this source tree.
18
+ */
19
+ const Fe = [
20
+ ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
21
+ [
22
+ "path",
23
+ {
24
+ 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",
25
+ key: "q0gr47"
26
+ }
27
+ ]
28
+ ], Ze = N("chart-area", Fe);
29
+ /**
30
+ * @license lucide-react v1.22.0 - ISC
31
+ *
32
+ * This source code is licensed under the ISC license.
33
+ * See the LICENSE file in the root directory of this source tree.
34
+ */
35
+ const Je = [
36
+ ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
37
+ ["path", { d: "M18 17V9", key: "2bz60n" }],
38
+ ["path", { d: "M13 17V5", key: "1frdt8" }],
39
+ ["path", { d: "M8 17v-3", key: "17ska0" }]
40
+ ], Qe = N("chart-column", Je);
41
+ /**
42
+ * @license lucide-react v1.22.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */
47
+ const Xe = [
48
+ ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
49
+ ["path", { d: "m19 9-5 5-4-4-3 3", key: "2osh9i" }]
50
+ ], et = N("chart-line", Xe);
51
+ /**
52
+ * @license lucide-react v1.22.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */
57
+ const tt = [
58
+ [
59
+ "path",
60
+ {
61
+ 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",
62
+ key: "pzmjnu"
63
+ }
64
+ ],
65
+ ["path", { d: "M21.21 15.89A10 10 0 1 1 8 2.83", key: "k2fpak" }]
66
+ ], at = N("chart-pie", tt);
67
+ /**
68
+ * @license lucide-react v1.22.0 - ISC
69
+ *
70
+ * This source code is licensed under the ISC license.
71
+ * See the LICENSE file in the root directory of this source tree.
72
+ */
73
+ const rt = [
74
+ [
75
+ "path",
76
+ {
77
+ 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",
78
+ key: "19sr3x"
79
+ }
80
+ ],
81
+ ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
82
+ ], ot = N("donut", rt), it = {
83
+ id: "chart",
84
+ // view_change backs the opt-in type switcher (`switchableTypes` prop):
85
+ // the same chart re-presented as line / bar / area / pie / donut.
86
+ capabilities: ["view_change"],
87
+ state: {
88
+ declaredType: {
89
+ type: "'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'",
90
+ descriptionKey: "ui.agent.chart.state.declaredType",
91
+ description: "The consumer-declared chart type — the shape `update_series` expects.",
92
+ read: (i) => i.getTypeState().declaredType
93
+ },
94
+ effectiveType: {
95
+ type: "'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'",
96
+ descriptionKey: "ui.agent.chart.state.effectiveType",
97
+ description: "The type currently rendered — differs from declaredType after a type-switcher pick.",
98
+ read: (i) => i.getTypeState().effectiveType
99
+ },
100
+ availableTypes: {
101
+ type: "ChartType[]",
102
+ descriptionKey: "ui.agent.chart.state.availableTypes",
103
+ description: "Types the switcher offers. Empty when the chart has no type switcher.",
104
+ read: (i) => i.getTypeState().availableTypes
105
+ }
106
+ },
107
+ actions: {
108
+ change_view: {
109
+ // Switching the presentation is a write (it changes what the user
110
+ // sees) but is trivially reversible by switching back.
111
+ safety: "write",
112
+ argsType: "type",
113
+ argsSchema: {
114
+ type: "object",
115
+ properties: {
116
+ type: {
117
+ type: "string",
118
+ enum: ["line", "bar", "area", "pie", "donut"],
119
+ description: "The chart type to render."
120
+ }
121
+ },
122
+ required: ["type"]
123
+ },
124
+ returns: "boolean (accepted)",
125
+ returnsSchema: {
126
+ type: "boolean",
127
+ description: "True when the switch was applied; false when the chart has no type switcher or the type is not offered (check availableTypes first)."
128
+ },
129
+ idempotent: !0,
130
+ descriptionKey: "ui.agent.chart.actions.changeView",
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: (i, m) => i.setType(m.type)
133
+ },
134
+ update_series: {
135
+ // Replacing the rendered series mutates what the chart displays — it
136
+ // is a write, reversible by pushing the prior series back.
137
+ safety: "write",
138
+ argsType: "series",
139
+ // `series` is `ChartSeries[]` (line/bar/area) OR `number[]`
140
+ // (pie/donut/radialBar). Both shapes are accepted; the handle routes
141
+ // by chart type internally.
142
+ argsSchema: {
143
+ type: "object",
144
+ properties: {
145
+ series: {
146
+ oneOf: [
147
+ {
148
+ type: "array",
149
+ description: "Categorical series for line / bar / area charts.",
150
+ items: {
151
+ type: "object",
152
+ properties: {
153
+ name: { type: "string" },
154
+ data: { type: "array", items: { type: "number" } },
155
+ role: {
156
+ type: "string",
157
+ enum: ["primary", "compare"],
158
+ description: "Optional. 'compare' renders this series as a secondary, colour-blind-safe overlay (e.g. the previous period) — dashed grey for line/area, hatched grey for bar. Omit for a normal primary series."
159
+ }
160
+ },
161
+ required: ["name", "data"]
162
+ }
163
+ },
164
+ {
165
+ type: "array",
166
+ description: "Flat values for pie / donut / radialBar charts.",
167
+ items: { type: "number" }
168
+ }
169
+ ]
170
+ }
171
+ },
172
+ required: ["series"]
173
+ },
174
+ idempotent: !0,
175
+ descriptionKey: "ui.agent.chart.actions.updateSeries",
176
+ 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.",
177
+ invoke: (i, m) => {
178
+ i.updateSeries(m.series);
179
+ }
180
+ },
181
+ export_png: {
182
+ safety: "read",
183
+ returns: "string (PNG data URI)",
184
+ returnsSchema: {
185
+ type: "string",
186
+ description: "A `data:image/png;base64,…` URI of the rendered chart."
187
+ },
188
+ idempotent: !0,
189
+ descriptionKey: "ui.agent.chart.actions.exportPng",
190
+ description: "Return a PNG data URI of the chart for export or screenshotting.",
191
+ invoke: (i) => i.dataURI()
192
+ }
193
+ },
194
+ domHooks: {
195
+ root: { attr: "data-component", value: "chart" },
196
+ instanceId: {
197
+ attr: "data-component-id",
198
+ sourceProp: "id",
199
+ description: "Sourced from the id prop."
200
+ }
201
+ }
202
+ }, nt = He("ds:relative ds:block ds:w-full", {
203
+ variants: {
204
+ density: {
205
+ compact: "ds:min-h-[var(--chart-min-height-compact)]",
206
+ comfortable: "ds:min-h-[var(--chart-min-height-comfortable)]",
207
+ // Applied when an explicit `height` prop is given and no density was
208
+ // requested: the wrapper must not exceed the caller's height (a 96px
209
+ // KPI chart inside a card must not reserve 320px).
210
+ none: ""
211
+ }
212
+ },
213
+ defaultVariants: { density: "comfortable" }
214
+ }), st = [
215
+ "verticalLines",
216
+ "horizontalLines",
217
+ "slantedLines",
218
+ "squares",
219
+ "circles"
220
+ ], ct = ["line", "bar", "area"], lt = ["pie", "donut", "radialBar"], Te = [
221
+ "line",
222
+ "bar",
223
+ "area",
224
+ "pie",
225
+ "donut"
226
+ ], dt = {
227
+ line: "chart.typeSwitcher.line",
228
+ bar: "chart.typeSwitcher.bar",
229
+ area: "chart.typeSwitcher.area",
230
+ pie: "chart.typeSwitcher.pie",
231
+ donut: "chart.typeSwitcher.donut"
232
+ }, pt = {
233
+ line: /* @__PURE__ */ d(et, {}),
234
+ bar: /* @__PURE__ */ d(Qe, {}),
235
+ area: /* @__PURE__ */ d(Ze, {}),
236
+ pie: /* @__PURE__ */ d(at, {}),
237
+ donut: /* @__PURE__ */ d(ot, {})
238
+ }, ht = 2, Se = "0 6";
239
+ function ut(i, m) {
240
+ !i || m.length === 0 || i.querySelectorAll(
241
+ ".apexcharts-bar-series > .apexcharts-series"
242
+ ).forEach((h) => {
243
+ const C = Number(h.getAttribute("data:realIndex"));
244
+ m.includes(C) && h.querySelectorAll("path.apexcharts-bar-area").forEach(
245
+ (v) => {
246
+ if (typeof v.getBBox != "function") return;
247
+ const l = v.getBBox();
248
+ v.setAttribute(
249
+ "d",
250
+ `M ${l.x} ${l.y + l.height} L ${l.x} ${l.y} L ${l.x + l.width} ${l.y} L ${l.x + l.width} ${l.y + l.height}`
251
+ ), v.setAttribute("stroke-dasharray", Se), v.setAttribute("stroke-linecap", "round");
252
+ }
253
+ );
254
+ });
255
+ }
256
+ function w(i) {
257
+ return lt.includes(i);
258
+ }
259
+ function Z(i) {
260
+ return ct.includes(i);
261
+ }
262
+ function mt(i, m) {
263
+ return w(m) ? [
264
+ {
265
+ name: "",
266
+ data: i
267
+ }
268
+ ] : i;
269
+ }
270
+ const ft = $e(
271
+ ({
272
+ title: i,
273
+ id: m,
274
+ type: h,
275
+ series: C,
276
+ categories: v,
277
+ labels: l,
278
+ height: J,
279
+ width: we,
280
+ patterns: Q = !1,
281
+ stacked: X = !1,
282
+ orientation: $ = "vertical",
283
+ curve: ee = "smooth",
284
+ colors: z,
285
+ toolbar: D = !1,
286
+ locale: Ce,
287
+ radialValueFormatter: I,
288
+ valueFormatter: te,
289
+ switchableTypes: M,
290
+ onTypeChange: q,
291
+ density: Ie,
292
+ className: ae
293
+ }, xe) => {
294
+ const { t: n, i18n: Ae } = De(), re = ze(), x = b(
295
+ () => `chart-${re.replace(/[^a-zA-Z0-9-_]/g, "")}`,
296
+ [re]
297
+ ), G = `${x}-summary`, P = Me(null), [oe, ke] = F(0);
298
+ Ge(P);
299
+ const A = Ce ?? Ae.language ?? "en", [ie, Re] = F(() => {
300
+ try {
301
+ return ve();
302
+ } catch {
303
+ return {};
304
+ }
305
+ });
306
+ be(() => {
307
+ if (typeof document > "u") return;
308
+ let e;
309
+ const a = new MutationObserver(() => {
310
+ clearTimeout(e), e = setTimeout(() => {
311
+ try {
312
+ Re(ve());
313
+ } catch {
314
+ }
315
+ }, 50);
316
+ });
317
+ return a.observe(document.documentElement, {
318
+ attributes: !0,
319
+ attributeFilter: ["class"]
320
+ }), () => {
321
+ clearTimeout(e), a.disconnect();
322
+ };
323
+ }, []), be(() => {
324
+ const e = P.current;
325
+ if (!e || typeof ResizeObserver > "u") return;
326
+ const a = new ResizeObserver((o) => {
327
+ const p = o[0];
328
+ p && ke(Math.floor(p.contentRect.width));
329
+ });
330
+ return a.observe(e), () => a.disconnect();
331
+ }, []);
332
+ const k = b(() => {
333
+ if (!M || M.length === 0) return [];
334
+ const e = M.filter(
335
+ (o) => Te.includes(o)
336
+ );
337
+ if (!Te.includes(h))
338
+ return [];
339
+ const a = e.includes(h) ? e : [h, ...e];
340
+ return [...new Set(a)];
341
+ }, [M, h]), T = k.length >= 2, [U, ne] = F(null), r = T && U && k.includes(U) ? U : h, W = w(h), se = w(r), { effectiveSeries: f, effectiveCategories: H, effectiveLabels: L } = b(() => {
342
+ if (W === se)
343
+ return {
344
+ effectiveSeries: C,
345
+ effectiveCategories: v,
346
+ effectiveLabels: l
347
+ };
348
+ if (!W) {
349
+ const o = C.filter((u) => u.role !== "compare");
350
+ return {
351
+ effectiveSeries: o.map(
352
+ (u) => u.data.reduce((y, S) => y + S, 0)
353
+ ),
354
+ effectiveCategories: void 0,
355
+ effectiveLabels: o.map((u) => u.name)
356
+ };
357
+ }
358
+ const e = C;
359
+ return {
360
+ effectiveSeries: [
361
+ { name: n("chart.table.value"), data: e }
362
+ ],
363
+ effectiveCategories: l ?? [],
364
+ effectiveLabels: void 0
365
+ };
366
+ }, [C, v, l, W, se, n]), j = b(
367
+ () => ({
368
+ async dataURI() {
369
+ const e = ge.getChartByID(x);
370
+ return e ? (await e.dataURI()).imgURI : "";
371
+ },
372
+ updateSeries(e) {
373
+ const a = ge.getChartByID(x);
374
+ if (!a) return;
375
+ const o = w(h), p = w(r);
376
+ if (o === p) {
377
+ a.updateSeries(e);
378
+ return;
379
+ }
380
+ if (!o) {
381
+ const u = e.filter(
382
+ (y) => y.role !== "compare"
383
+ );
384
+ a.updateOptions(
385
+ { labels: u.map((y) => y.name) },
386
+ !1,
387
+ !0
388
+ ), a.updateSeries(
389
+ u.map((y) => y.data.reduce((S, s) => S + s, 0))
390
+ );
391
+ return;
392
+ }
393
+ a.updateSeries([
394
+ { name: n("chart.table.value"), data: e }
395
+ ]);
396
+ },
397
+ setType(e) {
398
+ return !T || !k.includes(e) ? !1 : (ne(e), !0);
399
+ },
400
+ getTypeState() {
401
+ return {
402
+ declaredType: h,
403
+ effectiveType: r,
404
+ availableTypes: T ? [...k] : []
405
+ };
406
+ }
407
+ }),
408
+ [x, h, r, n, T, k]
409
+ );
410
+ Pe(xe, () => j, [j]), Ke(it, j, m);
411
+ const K = typeof document < "u" && document.documentElement.dir === "rtl", ce = b(
412
+ () => mt(f, r),
413
+ [f, r]
414
+ ), le = b(
415
+ () => new Intl.NumberFormat(A),
416
+ [A]
417
+ ), R = b(
418
+ () => te ?? ((e) => le.format(e)),
419
+ [te, le]
420
+ ), de = b(
421
+ () => ({
422
+ name: A,
423
+ options: {
424
+ toolbar: {
425
+ download: n("chart.toolbar.download"),
426
+ selection: n("chart.toolbar.selection"),
427
+ selectionZoom: n("chart.toolbar.selectionZoom"),
428
+ zoomIn: n("chart.toolbar.zoomIn"),
429
+ zoomOut: n("chart.toolbar.zoomOut"),
430
+ pan: n("chart.toolbar.pan"),
431
+ reset: n("chart.toolbar.reset"),
432
+ exportToSVG: n("chart.toolbar.exportToSVG"),
433
+ exportToPNG: n("chart.toolbar.exportToPNG"),
434
+ exportToCSV: n("chart.toolbar.exportToCSV")
435
+ }
436
+ }
437
+ }),
438
+ [A, n]
439
+ ), V = je(), _e = b(() => {
440
+ var he, ue, me, fe, ye;
441
+ const e = ie, a = Z(r) && Array.isArray(f) ? f.map((t) => t.role === "compare") : [], o = a.some(Boolean), p = o && r === "bar", u = p && f.some(
442
+ (t) => t.role === "compare" && t.data.some((c) => c < 0)
443
+ ), y = p && $ === "vertical" && !u, S = o ? Ue() : 0.3, s = {
444
+ ...e,
445
+ chart: {
446
+ ...e.chart,
447
+ id: x,
448
+ toolbar: { show: D },
449
+ zoom: { enabled: D },
450
+ animations: {
451
+ enabled: !V,
452
+ dynamicAnimation: { enabled: !V }
453
+ },
454
+ locales: [de],
455
+ defaultLocale: A,
456
+ parentHeightOffset: 0,
457
+ // Stacking is an axis-only concept — gate on the categorical types
458
+ // so a slice/radial chart never receives it, and omit the key
459
+ // entirely when unstacked so the default output is byte-identical.
460
+ ...X && Z(r) ? { stacked: !0 } : {}
461
+ },
462
+ // Only set `labels` when the effective type actually has them (slice
463
+ // charts). Emitting `labels: undefined` crashes ApexCharts' bar
464
+ // renderer — `parseDataAxisCharts` reads `labels.length` and throws
465
+ // "Cannot read properties of undefined (reading 'length')", which
466
+ // aborts the render and leaves a blank chart. Absent is safe; area /
467
+ // line tolerate the undefined but bar does not, so never pass it.
468
+ ...L ? { labels: L } : {},
469
+ legend: {
470
+ ...e.legend,
471
+ position: "bottom",
472
+ // ApexCharts legend.horizontalAlign is a physical prop mapped internally
473
+ // to the chart's own text flow. For RTL we flip via `yaxis.opposite`
474
+ // and ApexCharts' own `direction: 'rtl'` handling; legend stays anchored
475
+ // to the inline-start by asking for 'left' on LTR and 'right' on RTL.
476
+ horizontalAlign: K ? "right" : "left",
477
+ fontFamily: "inherit"
478
+ },
479
+ tooltip: {
480
+ ...e.tooltip,
481
+ y: {
482
+ formatter: (t) => R(t)
483
+ }
484
+ },
485
+ noData: {
486
+ text: n("chart.noData")
487
+ }
488
+ };
489
+ if (z && z.length > 0 && (s.colors = z), o) {
490
+ const t = s.colors ?? e.colors ?? [], c = (g) => t[g % Math.max(t.length, 1)], _ = f.map((g, E) => g.role === "compare" ? -1 : E).filter((g) => g >= 0);
491
+ let B = 0;
492
+ s.colors = f.map((g, E) => {
493
+ if (g.role !== "compare") return c(E);
494
+ const Ne = _.length ? _[Math.min(B++, _.length - 1)] : E;
495
+ return c(Ne);
496
+ });
497
+ const Y = s.colors.map(
498
+ (g, E) => a[E] ? We(g) : g
499
+ );
500
+ s.legend = {
501
+ ...s.legend,
502
+ markers: {
503
+ ...((he = s.legend) == null ? void 0 : he.markers) ?? {},
504
+ fillColors: Y
505
+ }
506
+ };
507
+ }
508
+ if (Z(r)) {
509
+ const t = r === "bar" && $ === "horizontal";
510
+ s.xaxis = {
511
+ ...e.xaxis,
512
+ categories: H ?? [],
513
+ ...t ? {
514
+ labels: {
515
+ formatter: (c) => R(Number(c))
516
+ }
517
+ } : {}
518
+ }, s.yaxis = {
519
+ ...e.yaxis,
520
+ opposite: K,
521
+ ...t ? {} : { labels: { formatter: (c) => R(c) } }
522
+ }, s.stroke = {
523
+ curve: ee,
524
+ width: r === "bar" ? o ? a.map((c) => c ? ht : 0) : 0 : 2,
525
+ ...o ? {
526
+ lineCap: "round",
527
+ // Runtime accepts a string dash; the published types say
528
+ // `number` → one documented cast. `'0 6'` + round cap ⇒ dots.
529
+ dashArray: a.map(
530
+ (c) => c ? Se : 0
531
+ )
532
+ } : {}
533
+ }, s.dataLabels = { enabled: !1 };
534
+ }
535
+ if (r === "radialBar" && I) {
536
+ const t = e.plotOptions ?? {};
537
+ s.plotOptions = {
538
+ ...t,
539
+ radialBar: {
540
+ ...t.radialBar ?? {},
541
+ dataLabels: {
542
+ ...((ue = t.radialBar) == null ? void 0 : ue.dataLabels) ?? {},
543
+ value: {
544
+ ...((fe = (me = t.radialBar) == null ? void 0 : me.dataLabels) == null ? void 0 : fe.value) ?? {},
545
+ formatter: (c) => I(Number(c))
546
+ }
547
+ }
548
+ }
549
+ };
550
+ }
551
+ if (r === "bar" && $ === "horizontal") {
552
+ const t = e.plotOptions ?? {};
553
+ s.plotOptions = {
554
+ ...t,
555
+ bar: { ...t.bar ?? {}, horizontal: !0 }
556
+ };
557
+ }
558
+ if (Q ? s.fill = {
559
+ type: o ? a.map((t) => t ? "solid" : "pattern") : "pattern",
560
+ opacity: o ? a.map(
561
+ (t) => t ? S : r === "area" ? 0.3 : 1
562
+ ) : r === "area" ? 0.3 : 1,
563
+ pattern: {
564
+ style: [...st],
565
+ strokeWidth: 2
566
+ }
567
+ } : p ? s.fill = {
568
+ type: "solid",
569
+ opacity: a.map((t) => t ? S : 1)
570
+ } : r === "area" && (s.fill = o ? {
571
+ type: "gradient",
572
+ opacity: a.map((t) => t ? S : 0.3)
573
+ } : {
574
+ type: "gradient",
575
+ opacity: 0.3
576
+ }), y) {
577
+ const t = a.map((B, Y) => B ? Y : -1).filter((B) => B >= 0), c = () => ut(P.current, t), _ = () => typeof requestAnimationFrame == "function" ? requestAnimationFrame(c) : c();
578
+ s.chart = {
579
+ ...s.chart,
580
+ events: {
581
+ ...((ye = s.chart) == null ? void 0 : ye.events) ?? {},
582
+ mounted: () => _(),
583
+ updated: () => _(),
584
+ animationEnd: () => c()
585
+ }
586
+ };
587
+ }
588
+ return s;
589
+ }, [
590
+ ie,
591
+ x,
592
+ D,
593
+ V,
594
+ de,
595
+ A,
596
+ L,
597
+ R,
598
+ n,
599
+ r,
600
+ f,
601
+ H,
602
+ K,
603
+ Q,
604
+ X,
605
+ $,
606
+ ee,
607
+ z,
608
+ I
609
+ ]), Ee = we ?? (oe > 0 ? oe : "100%"), Le = J ?? 320, Be = b(() => {
610
+ const e = w(r) ? L ?? [] : H ?? [], a = ce;
611
+ return /* @__PURE__ */ O("table", { id: G, className: "ds:sr-only", children: [
612
+ /* @__PURE__ */ d("caption", { children: i }),
613
+ /* @__PURE__ */ d("thead", { children: /* @__PURE__ */ O("tr", { children: [
614
+ /* @__PURE__ */ d("th", { scope: "col", children: n("chart.table.series") }),
615
+ e.map((o, p) => /* @__PURE__ */ d("th", { scope: "col", children: o }, `${o}-${p}`))
616
+ ] }) }),
617
+ /* @__PURE__ */ d("tbody", { children: a.map((o, p) => /* @__PURE__ */ O("tr", { children: [
618
+ /* @__PURE__ */ d("th", { scope: "row", children: o.name || n("chart.table.value") }),
619
+ o.data.map((u, y) => /* @__PURE__ */ d("td", { children: r === "radialBar" && I ? I(u) : R(u) }, `${p}-${y}`))
620
+ ] }, `${o.name}-${p}`)) })
621
+ ] });
622
+ }, [
623
+ r,
624
+ ce,
625
+ L,
626
+ H,
627
+ G,
628
+ i,
629
+ n,
630
+ R,
631
+ I
632
+ ]), Oe = b(() => (w(r), f), [f, r]), pe = /* @__PURE__ */ O(
633
+ "div",
634
+ {
635
+ ref: P,
636
+ role: "img",
637
+ "aria-label": i,
638
+ "aria-describedby": G,
639
+ className: nt({
640
+ // Explicit height wins over the density min-height unless the
641
+ // caller also asked for a density explicitly.
642
+ density: Ie ?? (J !== void 0 ? "none" : void 0),
643
+ className: T ? void 0 : ae
644
+ }),
645
+ ...T ? {} : { "data-component": "chart", "data-component-id": m },
646
+ children: [
647
+ Be,
648
+ /* @__PURE__ */ d(
649
+ qe,
650
+ {
651
+ type: r,
652
+ series: Oe,
653
+ options: _e,
654
+ width: Ee,
655
+ height: Le,
656
+ "aria-hidden": "true"
657
+ },
658
+ r
659
+ )
660
+ ]
661
+ }
662
+ );
663
+ return T ? /* @__PURE__ */ O(
664
+ "div",
665
+ {
666
+ "data-component": "chart",
667
+ "data-component-id": m,
668
+ className: `ds:block ds:w-full ${ae ?? ""}`.trim(),
669
+ children: [
670
+ /* @__PURE__ */ d("div", { className: "ds:mb-[var(--spacing-xs)] ds:flex ds:justify-end", children: /* @__PURE__ */ d(
671
+ Ye,
672
+ {
673
+ role: "radiogroup",
674
+ mode: "toggle-single",
675
+ size: "sm",
676
+ "aria-label": n("chart.typeSwitcher.label"),
677
+ value: r,
678
+ onValueChange: (e) => {
679
+ e !== r && (ne(e), q == null || q(e));
680
+ },
681
+ children: k.map((e) => /* @__PURE__ */ d(
682
+ Ve,
683
+ {
684
+ value: e,
685
+ type: "button",
686
+ icon: pt[e],
687
+ "aria-label": n(dt[e])
688
+ },
689
+ e
690
+ ))
691
+ }
692
+ ) }),
693
+ pe
694
+ ]
695
+ }
696
+ ) : pe;
697
+ }
698
+ );
699
+ ft.displayName = "Chart";
700
+ export {
701
+ ft as C,
702
+ nt as a,
703
+ it as c
704
+ };
705
+ //# sourceMappingURL=chart-DR68TJD5.js.map