@alfadocs/ui-kit 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.
@@ -1,22 +1,22 @@
1
- import { jsxs as w, jsx as c } from "react/jsx-runtime";
2
- import { forwardRef as be, useId as ve, useMemo as d, useRef as ge, useState as H, useEffect as ee, useImperativeHandle as Te } from "react";
3
- import { c as Se } from "./index-D2ZczOXr.js";
4
- import { useTranslation as we } from "react-i18next";
5
- import Ie from "react-apexcharts";
6
- import te from "apexcharts";
7
- import { u as Ce, g as ae } from "./apexcharts-theme-BJigns_V.js";
8
- import { u as ke } from "./use-prefers-reduced-motion-BMwIQRjB.js";
9
- import { u as Re } from "./registry-DvAUVLHh.js";
10
- import { I as _e } from "./icon-button-C_kbcd7I.js";
11
- import { I as Le } from "./icon-button-group-BLHPN6jg.js";
12
- import { c as I } from "./createLucideIcon-DhHxpK9K.js";
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 xe = [
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
- ], Ee = I("chart-area", xe);
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 Ne = [
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
- ], Ae = I("chart-column", Ne);
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 Pe = [
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
- ], ze = I("chart-line", Pe);
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 Be = [
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
- ], Me = I("chart-pie", Be);
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 Oe = [
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
- ], $e = I("donut", Oe), He = {
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: (a) => a.getTypeState().declaredType
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: (a) => a.getTypeState().effectiveType
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: (a) => a.getTypeState().availableTypes
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: (a, h) => a.setType(h.type)
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: (a, h) => {
173
- a.updateSeries(h.series);
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: (a) => a.dataURI()
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
- }, Ge = Se("ds:relative ds:block ds:w-full", {
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
- }), je = [
209
+ }), Ve = [
210
210
  "verticalLines",
211
211
  "horizontalLines",
212
212
  "slantedLines",
213
213
  "squares",
214
214
  "circles"
215
- ], De = ["line", "bar", "area"], Ke = ["pie", "donut", "radialBar"], re = [
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
- ], Ue = {
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
- }, Ve = {
228
- line: /* @__PURE__ */ c(ze, {}),
229
- bar: /* @__PURE__ */ c(Ae, {}),
230
- area: /* @__PURE__ */ c(Ee, {}),
231
- pie: /* @__PURE__ */ c(Me, {}),
232
- donut: /* @__PURE__ */ c($e, {})
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 f(a) {
235
- return Ke.includes(a);
234
+ function m(r) {
235
+ return Ye.includes(r);
236
236
  }
237
- function We(a) {
238
- return De.includes(a);
237
+ function se(r) {
238
+ return We.includes(r);
239
239
  }
240
- function Ye(a, h) {
241
- return f(h) ? [
240
+ function Fe(r, h) {
241
+ return m(h) ? [
242
242
  {
243
243
  name: "",
244
- data: a
244
+ data: r
245
245
  }
246
- ] : a;
246
+ ] : r;
247
247
  }
248
- const qe = be(
248
+ const Je = Se(
249
249
  ({
250
- title: a,
250
+ title: r,
251
251
  id: h,
252
252
  type: l,
253
- series: C,
254
- categories: G,
255
- labels: L,
256
- height: j,
257
- width: oe,
258
- patterns: D = !1,
259
- colors: k,
260
- toolbar: x = !1,
261
- locale: ie,
262
- radialValueFormatter: m,
263
- valueFormatter: K,
264
- switchableTypes: R,
265
- onTypeChange: E,
266
- density: ne,
267
- className: U
268
- }, se) => {
269
- const { t: r, i18n: ce } = we(), V = ve(), y = d(
270
- () => `chart-${V.replace(/[^a-zA-Z0-9-_]/g, "")}`,
271
- [V]
272
- ), N = `${y}-summary`, A = ge(null), [W, de] = H(0);
273
- Ce(A);
274
- const b = ie ?? ce.language ?? "en", [Y, le] = H(
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 ae();
280
+ return ie();
278
281
  } catch {
279
282
  return {};
280
283
  }
281
284
  }
282
285
  );
283
- ee(() => {
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
- le(ae());
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
- }, []), ee(() => {
303
+ }, []), re(() => {
301
304
  const e = A.current;
302
305
  if (!e || typeof ResizeObserver > "u") return;
303
- const t = new ResizeObserver((i) => {
304
- const n = i[0];
305
- n && de(Math.floor(n.contentRect.width));
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 v = d(() => {
310
- if (!R || R.length === 0) return [];
311
- const e = R.filter(
312
- (i) => re.includes(i)
312
+ const g = d(() => {
313
+ if (!_ || _.length === 0) return [];
314
+ const e = _.filter(
315
+ (n) => ne.includes(n)
313
316
  );
314
- if (!re.includes(l))
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
- }, [R, l]), u = v.length >= 2, [P, q] = H(null), o = u && P && v.includes(P) ? P : l, z = f(l), Z = f(o), { effectiveSeries: g, effectiveCategories: _, effectiveLabels: T } = d(() => {
319
- if (z === Z)
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: C,
322
- effectiveCategories: G,
323
- effectiveLabels: L
324
+ effectiveSeries: k,
325
+ effectiveCategories: j,
326
+ effectiveLabels: x
324
327
  };
325
- if (!z) {
326
- const t = C;
328
+ if (!O) {
329
+ const t = k;
327
330
  return {
328
331
  effectiveSeries: t.map(
329
- (n) => n.data.reduce((p, s) => p + s, 0)
332
+ (s) => s.data.reduce((p, i) => p + i, 0)
330
333
  ),
331
334
  effectiveCategories: void 0,
332
- effectiveLabels: t.map((n) => n.name)
335
+ effectiveLabels: t.map((s) => s.name)
333
336
  };
334
337
  }
335
- const e = C;
338
+ const e = k;
336
339
  return {
337
340
  effectiveSeries: [
338
- { name: r("chart.table.value"), data: e }
341
+ { name: o("chart.table.value"), data: e }
339
342
  ],
340
- effectiveCategories: L ?? [],
343
+ effectiveCategories: x ?? [],
341
344
  effectiveLabels: void 0
342
345
  };
343
- }, [C, G, L, z, Z, r]), B = d(
346
+ }, [k, j, x, O, Q, o]), M = d(
344
347
  () => ({
345
348
  async dataURI() {
346
- const e = te.getChartByID(y);
349
+ const e = oe.getChartByID(b);
347
350
  return e ? (await e.dataURI()).imgURI : "";
348
351
  },
349
352
  updateSeries(e) {
350
- const t = te.getChartByID(y);
353
+ const t = oe.getChartByID(b);
351
354
  if (!t) return;
352
- const i = f(l), n = f(o);
353
- if (i === n) {
355
+ const n = m(l), s = m(a);
356
+ if (n === s) {
354
357
  t.updateSeries(e);
355
358
  return;
356
359
  }
357
- if (!i) {
360
+ if (!n) {
358
361
  const p = e;
359
362
  t.updateOptions(
360
- { labels: p.map((s) => s.name) },
363
+ { labels: p.map((i) => i.name) },
361
364
  !1,
362
365
  !0
363
366
  ), t.updateSeries(
364
- p.map((s) => s.data.reduce(($, ye) => $ + ye, 0))
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: r("chart.table.value"), data: e }
372
+ { name: o("chart.table.value"), data: e }
370
373
  ]);
371
374
  },
372
375
  setType(e) {
373
- return !u || !v.includes(e) ? !1 : (q(e), !0);
376
+ return !u || !g.includes(e) ? !1 : (J(e), !0);
374
377
  },
375
378
  getTypeState() {
376
379
  return {
377
380
  declaredType: l,
378
- effectiveType: o,
379
- availableTypes: u ? [...v] : []
381
+ effectiveType: a,
382
+ availableTypes: u ? [...g] : []
380
383
  };
381
384
  }
382
385
  }),
383
- [y, l, o, r, u, v]
386
+ [b, l, a, o, u, g]
384
387
  );
385
- Te(se, () => B, [B]), Re(He, B, h);
386
- const M = typeof document < "u" && document.documentElement.dir === "rtl", F = d(
387
- () => Ye(g, o),
388
- [g, o]
389
- ), J = d(
390
- () => new Intl.NumberFormat(b),
391
- [b]
392
- ), S = d(
393
- () => K ?? ((e) => J.format(e)),
394
- [K, J]
395
- ), Q = d(
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: b,
400
+ name: v,
398
401
  options: {
399
402
  toolbar: {
400
- download: r("chart.toolbar.download"),
401
- selection: r("chart.toolbar.selection"),
402
- selectionZoom: r("chart.toolbar.selectionZoom"),
403
- zoomIn: r("chart.toolbar.zoomIn"),
404
- zoomOut: r("chart.toolbar.zoomOut"),
405
- pan: r("chart.toolbar.pan"),
406
- reset: r("chart.toolbar.reset"),
407
- exportToSVG: r("chart.toolbar.exportToSVG"),
408
- exportToPNG: r("chart.toolbar.exportToPNG"),
409
- exportToCSV: r("chart.toolbar.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
- [b, r]
414
- ), O = ke(), pe = d(() => {
415
- var i, n, p;
416
- const e = Y, t = {
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: y,
421
- toolbar: { show: x },
422
- zoom: { enabled: x },
423
+ id: b,
424
+ toolbar: { show: N },
425
+ zoom: { enabled: N },
423
426
  animations: {
424
- enabled: !O,
425
- dynamicAnimation: { enabled: !O }
427
+ enabled: !H,
428
+ dynamicAnimation: { enabled: !H }
426
429
  },
427
- locales: [Q],
428
- defaultLocale: b,
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
- ...T ? { labels: T } : {},
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: M ? "right" : "left",
452
+ horizontalAlign: $ ? "right" : "left",
446
453
  fontFamily: "inherit"
447
454
  },
448
455
  tooltip: {
449
456
  ...e.tooltip,
450
457
  y: {
451
- formatter: (s) => S(s)
458
+ formatter: (i) => T(i)
452
459
  }
453
460
  },
454
461
  noData: {
455
- text: r("chart.noData")
462
+ text: o("chart.noData")
456
463
  }
457
464
  };
458
- if (k && k.length > 0 && (t.colors = k), We(o) && (t.xaxis = {
459
- ...e.xaxis,
460
- categories: _ ?? []
461
- }, t.yaxis = {
462
- ...e.yaxis,
463
- opposite: M,
464
- labels: {
465
- formatter: (s) => S(s)
466
- }
467
- }, t.stroke = {
468
- curve: "smooth",
469
- width: o === "bar" ? 0 : 2
470
- }, t.dataLabels = { enabled: !1 }), o === "radialBar" && m) {
471
- const s = e.plotOptions ?? {};
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
- ...s,
487
+ ...i,
474
488
  radialBar: {
475
- ...s.radialBar ?? {},
489
+ ...i.radialBar ?? {},
476
490
  dataLabels: {
477
- ...((i = s.radialBar) == null ? void 0 : i.dataLabels) ?? {},
491
+ ...((n = i.radialBar) == null ? void 0 : n.dataLabels) ?? {},
478
492
  value: {
479
- ...((p = (n = s.radialBar) == null ? void 0 : n.dataLabels) == null ? void 0 : p.value) ?? {},
480
- formatter: ($) => m(Number($))
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
- return D ? t.fill = {
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: o === "area" ? 0.3 : 1,
509
+ opacity: a === "area" ? 0.3 : 1,
489
510
  pattern: {
490
- style: [...je],
511
+ style: [...Ve],
491
512
  strokeWidth: 2
492
513
  }
493
- } : o === "area" && (t.fill = {
514
+ } : a === "area" && (t.fill = {
494
515
  type: "gradient",
495
516
  opacity: 0.3
496
517
  }), t;
497
518
  }, [
498
- Y,
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
- M,
510
- D,
511
- k,
512
- m
513
- ]), he = oe ?? (W > 0 ? W : "100%"), ue = j ?? 320, fe = d(() => {
514
- const e = f(o) ? T ?? [] : _ ?? [], t = F;
515
- return /* @__PURE__ */ w("table", { id: N, className: "ds:sr-only", children: [
516
- /* @__PURE__ */ c("caption", { children: a }),
517
- /* @__PURE__ */ c("thead", { children: /* @__PURE__ */ w("tr", { children: [
518
- /* @__PURE__ */ c("th", { scope: "col", children: r("chart.table.series") }),
519
- e.map((i, n) => /* @__PURE__ */ c("th", { scope: "col", children: i }, `${i}-${n}`))
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((i, n) => /* @__PURE__ */ w("tr", { children: [
522
- /* @__PURE__ */ c("th", { scope: "row", children: i.name || r("chart.table.value") }),
523
- i.data.map((p, s) => /* @__PURE__ */ c("td", { children: o === "radialBar" && m ? m(p) : S(p) }, `${n}-${s}`))
524
- ] }, `${i.name}-${n}`)) })
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
- S,
535
- m
536
- ]), me = d(() => (f(o), g), [g, o]), X = /* @__PURE__ */ w(
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": a,
542
- "aria-describedby": N,
543
- className: Ge({
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: ne ?? (j !== void 0 ? "none" : void 0),
547
- className: u ? void 0 : U
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
- fe,
575
+ ve,
552
576
  /* @__PURE__ */ c(
553
- Ie,
577
+ _e,
554
578
  {
555
- type: o,
556
- series: me,
557
- options: pe,
558
- width: he,
559
- height: ue,
579
+ type: a,
580
+ series: ge,
581
+ options: me,
582
+ width: ye,
583
+ height: be,
560
584
  "aria-hidden": "true"
561
585
  },
562
- o
586
+ a
563
587
  )
564
588
  ]
565
589
  }
566
590
  );
567
- return u ? /* @__PURE__ */ w(
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 ${U ?? ""}`.trim(),
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
- Le,
599
+ ze,
576
600
  {
577
601
  role: "radiogroup",
578
602
  mode: "toggle-single",
579
603
  size: "sm",
580
- "aria-label": r("chart.typeSwitcher.label"),
581
- value: o,
604
+ "aria-label": o("chart.typeSwitcher.label"),
605
+ value: a,
582
606
  onValueChange: (e) => {
583
- e !== o && (q(e), E == null || E(e));
607
+ e !== a && (J(e), z == null || z(e));
584
608
  },
585
- children: v.map((e) => /* @__PURE__ */ c(
586
- _e,
609
+ children: g.map((e) => /* @__PURE__ */ c(
610
+ Ne,
587
611
  {
588
612
  value: e,
589
613
  type: "button",
590
- icon: Ve[e],
591
- "aria-label": r(Ue[e])
614
+ icon: Ze[e],
615
+ "aria-label": o(qe[e])
592
616
  },
593
617
  e
594
618
  ))
595
619
  }
596
620
  ) }),
597
- X
621
+ ae
598
622
  ]
599
623
  }
600
- ) : X;
624
+ ) : ae;
601
625
  }
602
626
  );
603
- qe.displayName = "Chart";
627
+ Je.displayName = "Chart";
604
628
  export {
605
- qe as C,
606
- Ge as a,
607
- He as c
629
+ Je as C,
630
+ Ue as a,
631
+ Ke as c
608
632
  };
609
- //# sourceMappingURL=chart-GFLv4cXm.js.map
633
+ //# sourceMappingURL=chart-CNaLgvx4.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.86.0",
3
+ "packageVersion": "0.87.0",
4
4
  "components": [
5
5
  {
6
6
  "kind": "component",
@@ -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,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,4 +1,4 @@
1
- import { C as t, c as s, a as c } from "../../_chunks/chart-GFLv4cXm.js";
1
+ import { C as t, c as s, a as c } from "../../_chunks/chart-CNaLgvx4.js";
2
2
  export {
3
3
  t as Chart,
4
4
  s as chartAgent,
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-GFLv4cXm.js";
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",
3
- "version": "0.86.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.",
6
6
  "license": "BUSL-1.1",