@wealth-os/design-system 0.0.0-stage → 0.2.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 (63) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE +201 -0
  3. package/README.md +89 -2
  4. package/dist/button-yvMc7CT-.js +47 -0
  5. package/dist/charts.d.ts +138 -0
  6. package/dist/charts.js +712 -0
  7. package/dist/command-menu.d.ts +3 -0
  8. package/dist/command-menu.js +53 -0
  9. package/dist/components/advanced-controls.d.ts +145 -0
  10. package/dist/components/badge.d.ts +9 -0
  11. package/dist/components/button-group.d.ts +15 -0
  12. package/dist/components/button.d.ts +14 -0
  13. package/dist/components/command-menu.d.ts +42 -0
  14. package/dist/components/data-display.d.ts +100 -0
  15. package/dist/components/data-table.d.ts +113 -0
  16. package/dist/components/date-input.d.ts +36 -0
  17. package/dist/components/date-range-picker.d.ts +23 -0
  18. package/dist/components/field.d.ts +18 -0
  19. package/dist/components/financial.d.ts +83 -0
  20. package/dist/components/form.d.ts +8 -0
  21. package/dist/components/icon-button.d.ts +11 -0
  22. package/dist/components/icons.d.ts +9 -0
  23. package/dist/components/navigation.d.ts +53 -0
  24. package/dist/components/notice.d.ts +11 -0
  25. package/dist/components/number-input.d.ts +44 -0
  26. package/dist/components/overlays.d.ts +91 -0
  27. package/dist/components/select-menu.d.ts +27 -0
  28. package/dist/components/select.d.ts +23 -0
  29. package/dist/components/status-badge.d.ts +9 -0
  30. package/dist/components/surface.d.ts +16 -0
  31. package/dist/components/text-input.d.ts +8 -0
  32. package/dist/components/textarea.d.ts +7 -0
  33. package/dist/components/validation-message.d.ts +8 -0
  34. package/dist/data-display-BA7t1E4G.js +278 -0
  35. package/dist/data-table.d.ts +2 -0
  36. package/dist/data-table.js +346 -0
  37. package/dist/financial.d.ts +1 -0
  38. package/dist/financial.js +178 -0
  39. package/dist/form-Csxly6Es.js +74 -0
  40. package/dist/forms.d.ts +39 -0
  41. package/dist/forms.js +32 -0
  42. package/dist/index.d.ts +23 -0
  43. package/dist/index.js +1411 -0
  44. package/dist/lib/control-density.d.ts +3 -0
  45. package/dist/lib/utils.d.ts +3 -0
  46. package/dist/navigation.d.ts +3 -0
  47. package/dist/navigation.js +224 -0
  48. package/dist/notice-jbY9FQu_.js +49 -0
  49. package/dist/overlays-BleXRtz6.js +219 -0
  50. package/dist/overlays.d.ts +7 -0
  51. package/dist/overlays.js +2 -0
  52. package/dist/reset.css +16 -0
  53. package/dist/styles.css +3 -0
  54. package/dist/tokens.css +157 -0
  55. package/dist/utils-CX-Pz5p6.js +8 -0
  56. package/docs/accessibility.md +154 -0
  57. package/docs/charts.md +47 -0
  58. package/docs/components.md +296 -0
  59. package/docs/data-table.md +87 -0
  60. package/docs/layout-composition.md +224 -0
  61. package/docs/migration.md +91 -0
  62. package/docs/tokens.md +170 -0
  63. package/package.json +118 -4
package/dist/charts.js ADDED
@@ -0,0 +1,712 @@
1
+ import { useId as e, useMemo as t, useState as n } from "react";
2
+ import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
3
+ import { Area as o, AreaChart as s, Bar as c, BarChart as l, CartesianGrid as u, Cell as d, ComposedChart as f, LabelList as p, Line as m, LineChart as h, Pie as g, PieChart as _, PolarAngleAxis as v, PolarGrid as y, RadialBar as b, RadialBarChart as x, ReferenceArea as S, ReferenceLine as C, ResponsiveContainer as w, Scatter as T, ScatterChart as E, Tooltip as D, XAxis as O, YAxis as k } from "recharts";
4
+ //#region src/charts.tsx
5
+ var A = [
6
+ "var(--chart-1)",
7
+ "var(--chart-2)",
8
+ "var(--chart-3)",
9
+ "var(--chart-4)",
10
+ "var(--chart-5)"
11
+ ], j = (e, t, n) => e.color ?? n?.[e.dataKey]?.color ?? A[t % A.length], M = (e, t) => e.marker ?? [
12
+ "circle",
13
+ "square",
14
+ "diamond",
15
+ "line"
16
+ ][t % 4];
17
+ function N({ title: n, description: r, data: o = [], config: s, series: c = [], height: l = 280, className: u = "", children: d, tableLabel: f = "View chart data table", summary: p }) {
18
+ let m = e(), h = t(() => [.../* @__PURE__ */ new Set([...o.flatMap((e) => Object.keys(e)), ...c.map((e) => e.dataKey)])], [o, c]), g = c.length ? c.map((e) => ({
19
+ key: e.dataKey,
20
+ label: e.label
21
+ })) : h.map((e) => ({
22
+ key: e,
23
+ label: s?.[e]?.label ?? e
24
+ }));
25
+ return /* @__PURE__ */ a("section", {
26
+ className: `wos-chart ${u}`,
27
+ "aria-labelledby": `${m}-title`,
28
+ children: [
29
+ /* @__PURE__ */ a("header", {
30
+ className: "wos-chart-heading",
31
+ children: [/* @__PURE__ */ i("h3", {
32
+ id: `${m}-title`,
33
+ className: "wos-chart-title",
34
+ children: n
35
+ }), /* @__PURE__ */ a("p", {
36
+ id: `${m}-description`,
37
+ className: "wos-chart-description",
38
+ children: [r, p ? ` ${p}` : ""]
39
+ })]
40
+ }),
41
+ /* @__PURE__ */ i("div", {
42
+ className: "wos-chart-plot",
43
+ role: "group",
44
+ "aria-label": `${n}. ${r}${p ? ` ${p}` : ""}`,
45
+ style: { "--wos-chart-height": `${l}px` },
46
+ children: d
47
+ }),
48
+ g.length > 0 && o.length > 0 && /* @__PURE__ */ a("details", {
49
+ className: "wos-chart-table-details",
50
+ children: [/* @__PURE__ */ i("summary", { children: f }), /* @__PURE__ */ i("div", {
51
+ className: "wos-chart-table-scroll",
52
+ children: /* @__PURE__ */ a("table", {
53
+ className: "wos-chart-table",
54
+ children: [
55
+ /* @__PURE__ */ a("caption", {
56
+ className: "wos-sr-only",
57
+ children: [
58
+ n,
59
+ " data. ",
60
+ r
61
+ ]
62
+ }),
63
+ /* @__PURE__ */ i("thead", { children: /* @__PURE__ */ a("tr", { children: [/* @__PURE__ */ i("th", {
64
+ scope: "col",
65
+ children: "Category"
66
+ }), g.map(({ key: e, label: t }) => /* @__PURE__ */ i("th", {
67
+ scope: "col",
68
+ children: t
69
+ }, e))] }) }),
70
+ /* @__PURE__ */ i("tbody", { children: o.map((e, t) => /* @__PURE__ */ a("tr", { children: [/* @__PURE__ */ i("th", {
71
+ scope: "row",
72
+ children: String(e.name ?? e.label ?? e.x ?? t + 1)
73
+ }), g.map(({ key: t }) => /* @__PURE__ */ i("td", { children: e[t] == null ? "Not available" : String(e[t]) }, t))] }, String(e.name ?? e.label ?? e.x ?? t))) })
74
+ ]
75
+ })
76
+ })]
77
+ })
78
+ ]
79
+ });
80
+ }
81
+ function P({ items: e, onToggle: t, highlightedKey: n, onHighlight: r, label: o = "Chart series" }) {
82
+ return e.length ? /* @__PURE__ */ i("div", {
83
+ className: "wos-chart-legend",
84
+ role: "group",
85
+ "aria-label": o,
86
+ children: e.map((e, o) => {
87
+ let s = /* @__PURE__ */ i("span", {
88
+ "aria-hidden": "true",
89
+ className: `wos-chart-marker wos-chart-marker-${e.marker ?? [
90
+ "circle",
91
+ "square",
92
+ "diamond",
93
+ "line"
94
+ ][o % 4]}`,
95
+ style: { "--wos-series-color": e.color }
96
+ }), c = {
97
+ className: `wos-chart-legend-item${e.hidden ? " is-hidden" : ""}${n === e.key ? " is-highlighted" : ""}`,
98
+ onMouseEnter: () => r?.(e.key),
99
+ onMouseLeave: () => r?.(null),
100
+ onFocus: () => r?.(e.key),
101
+ onBlur: () => r?.(null),
102
+ "aria-pressed": t ? !e.hidden : void 0,
103
+ title: e.label
104
+ };
105
+ return t ? /* @__PURE__ */ a("button", {
106
+ type: "button",
107
+ ...c,
108
+ onClick: () => t(e.key),
109
+ children: [s, /* @__PURE__ */ i("span", { children: e.label })]
110
+ }, e.key) : /* @__PURE__ */ a("span", {
111
+ ...c,
112
+ children: [s, /* @__PURE__ */ i("span", { children: e.label })]
113
+ }, e.key);
114
+ })
115
+ }) : null;
116
+ }
117
+ function F({ active: e, payload: t = [], label: n, config: r, formatValue: o, formatLabel: s, labelFormatter: c }) {
118
+ if (!e || !t.length) return null;
119
+ let l = t;
120
+ return /* @__PURE__ */ a("div", {
121
+ className: "wos-chart-tooltip",
122
+ children: [/* @__PURE__ */ i("p", {
123
+ className: "wos-chart-tooltip-label",
124
+ children: c?.(n) ?? s?.(n) ?? String(n ?? "")
125
+ }), l.map((e, t) => /* @__PURE__ */ a("div", {
126
+ className: "wos-chart-tooltip-row",
127
+ children: [
128
+ /* @__PURE__ */ i("span", {
129
+ className: "wos-chart-tooltip-marker",
130
+ "aria-hidden": "true",
131
+ style: { "--wos-series-color": e.color ?? A[t % A.length] }
132
+ }),
133
+ /* @__PURE__ */ i("span", { children: r?.[String(e.dataKey)]?.label ?? String(e.name ?? e.dataKey ?? "") }),
134
+ /* @__PURE__ */ i("strong", { children: o ? o(e.value, e.payload, e.dataKey == null ? void 0 : String(e.dataKey)) : e.value == null ? "Not available" : String(e.value) })
135
+ ]
136
+ }, `${String(e.dataKey ?? e.name ?? t)}`))]
137
+ });
138
+ }
139
+ function I({ title: e = "No chart data", description: t = "Data will appear here when it is available." }) {
140
+ return /* @__PURE__ */ a("div", {
141
+ className: "wos-chart-state",
142
+ role: "status",
143
+ children: [/* @__PURE__ */ i("strong", { children: e }), /* @__PURE__ */ i("span", { children: t })]
144
+ });
145
+ }
146
+ function L({ label: e = "Loading chart data" }) {
147
+ return /* @__PURE__ */ a("div", {
148
+ className: "wos-chart-state",
149
+ role: "status",
150
+ "aria-live": "polite",
151
+ children: [/* @__PURE__ */ i("span", {
152
+ className: "wos-chart-loading-mark",
153
+ "aria-hidden": "true"
154
+ }), e]
155
+ });
156
+ }
157
+ function R({ title: e = "Chart unavailable", description: t = "The chart data could not be displayed." }) {
158
+ return /* @__PURE__ */ a("div", {
159
+ className: "wos-chart-state wos-chart-error",
160
+ role: "alert",
161
+ children: [/* @__PURE__ */ i("strong", { children: e }), /* @__PURE__ */ i("span", { children: t })]
162
+ });
163
+ }
164
+ function z(e, t, r = {}) {
165
+ let [o, s] = n(() => new Set(e.series.filter((e) => e.hidden).map((e) => e.dataKey))), [c, l] = n(null), { title: u, description: d, data: f, series: p, height: m = 280, className: h, loading: g, error: _, emptyState: v, showLegend: y = !0, interactiveLegend: b = !1, config: x } = e;
166
+ if (g) return /* @__PURE__ */ i(N, {
167
+ title: u,
168
+ description: d,
169
+ data: [],
170
+ series: p,
171
+ height: m,
172
+ className: h,
173
+ children: /* @__PURE__ */ i(L, {})
174
+ });
175
+ if (_) return /* @__PURE__ */ i(N, {
176
+ title: u,
177
+ description: d,
178
+ data: [],
179
+ series: p,
180
+ height: m,
181
+ className: h,
182
+ children: /* @__PURE__ */ i("div", {
183
+ className: "wos-chart-state wos-chart-error",
184
+ role: "alert",
185
+ children: _
186
+ })
187
+ });
188
+ if (!f.length) return /* @__PURE__ */ i(N, {
189
+ title: u,
190
+ description: d,
191
+ data: [],
192
+ series: p,
193
+ height: m,
194
+ className: h,
195
+ children: v ?? /* @__PURE__ */ i(I, {})
196
+ });
197
+ let S = p.filter((e) => !o.has(e.dataKey)).map((e) => ({
198
+ ...e,
199
+ color: j(e, p.indexOf(e), x)
200
+ })), C = p.map((e, t) => ({
201
+ key: e.dataKey,
202
+ label: x?.[e.dataKey]?.label ?? e.label,
203
+ color: j(e, t, x),
204
+ marker: M(e, t),
205
+ hidden: o.has(e.dataKey)
206
+ })), T = (e) => s((t) => {
207
+ let n = new Set(t);
208
+ return n.has(e) ? n.delete(e) : n.add(e), n;
209
+ });
210
+ return /* @__PURE__ */ i(N, {
211
+ title: u,
212
+ description: d,
213
+ data: f,
214
+ series: p,
215
+ height: m,
216
+ className: h,
217
+ config: x,
218
+ children: /* @__PURE__ */ a("div", {
219
+ className: "wos-chart-content",
220
+ children: [
221
+ !r.sparkline && y && /* @__PURE__ */ i(P, {
222
+ items: C,
223
+ onToggle: b ? T : void 0,
224
+ highlightedKey: c,
225
+ onHighlight: l
226
+ }),
227
+ /* @__PURE__ */ i("div", {
228
+ className: "wos-chart-responsive",
229
+ children: /* @__PURE__ */ i(w, {
230
+ width: "100%",
231
+ height: "100%",
232
+ children: typeof t == "function" ? t(S, c) : t
233
+ })
234
+ }),
235
+ r.sparkline && /* @__PURE__ */ i(P, {
236
+ items: C,
237
+ onToggle: b ? T : void 0,
238
+ highlightedKey: c,
239
+ onHighlight: l
240
+ })
241
+ ]
242
+ })
243
+ });
244
+ }
245
+ function B({ props: e }) {
246
+ return /* @__PURE__ */ a(r, { children: [
247
+ e.showGrid !== !1 && /* @__PURE__ */ i(u, {
248
+ stroke: "var(--border-subtle)",
249
+ strokeDasharray: "3 3",
250
+ vertical: !1,
251
+ ...e.gridOptions
252
+ }),
253
+ e.xAxis !== !1 && /* @__PURE__ */ i(O, {
254
+ dataKey: e.xAxisOptions?.dataKey ?? e.xKey ?? "name",
255
+ tick: {
256
+ fill: "var(--muted-foreground)",
257
+ fontSize: 11
258
+ },
259
+ tickLine: !1,
260
+ axisLine: { stroke: "var(--border)" },
261
+ tickFormatter: e.formatLabel,
262
+ label: e.xAxisLabel ? {
263
+ value: e.xAxisLabel,
264
+ position: "insideBottom",
265
+ offset: -4,
266
+ fill: "var(--muted-foreground)"
267
+ } : void 0,
268
+ ...e.xAxisOptions
269
+ }),
270
+ e.yAxis !== !1 && /* @__PURE__ */ i(k, {
271
+ tick: {
272
+ fill: "var(--muted-foreground)",
273
+ fontSize: 11
274
+ },
275
+ tickLine: !1,
276
+ axisLine: !1,
277
+ tickFormatter: e.formatValue,
278
+ label: e.yAxisLabel ? {
279
+ value: e.yAxisLabel,
280
+ angle: -90,
281
+ position: "insideLeft",
282
+ fill: "var(--muted-foreground)"
283
+ } : void 0,
284
+ ...e.yAxisOptions
285
+ }),
286
+ e.referenceAreas?.map((e, t) => /* @__PURE__ */ i(S, {
287
+ x1: e.x1,
288
+ x2: e.x2,
289
+ y1: e.y1,
290
+ y2: e.y2,
291
+ fill: e.color ?? "var(--chart-5)",
292
+ fillOpacity: .2,
293
+ label: e.label
294
+ }, `area-${t}`)),
295
+ e.referenceLines?.map((e, t) => /* @__PURE__ */ i(C, {
296
+ ...e.axis === "x" ? { x: e.value } : { y: e.value },
297
+ stroke: e.color ?? "var(--muted-foreground)",
298
+ strokeDasharray: e.dashed === !1 ? void 0 : "4 4",
299
+ label: e.label
300
+ }, `line-${t}`))
301
+ ] });
302
+ }
303
+ function V({ props: e }) {
304
+ return e.showTooltip === !1 ? null : /* @__PURE__ */ i(D, { content: (t) => /* @__PURE__ */ i(F, {
305
+ active: t.active,
306
+ payload: t.payload,
307
+ label: t.label,
308
+ config: e.config,
309
+ formatValue: e.formatValue,
310
+ formatLabel: e.formatLabel
311
+ }) });
312
+ }
313
+ function H(e) {
314
+ return e == null ? "Not available" : String(e);
315
+ }
316
+ function U({ props: e, type: t, highlightedKey: n }) {
317
+ return /* @__PURE__ */ i(r, { children: e.series.map((r, a) => {
318
+ let s = j(r, a, e.config), l = e.showDataLabels ? /* @__PURE__ */ i(p, {
319
+ dataKey: r.dataKey,
320
+ position: "top",
321
+ formatter: (t) => String(e.formatValue?.(t, void 0, r.dataKey) ?? H(t)),
322
+ fill: "var(--foreground)",
323
+ fontSize: 10
324
+ }) : void 0, u = n === r.dataKey ? 3 : 2;
325
+ return (t === "line" || t === "composed") && (r.type === "line" || t === "line" || !r.type) ? /* @__PURE__ */ i(m, {
326
+ dataKey: r.dataKey,
327
+ name: r.label,
328
+ stroke: s,
329
+ strokeWidth: u,
330
+ dot: e.data.length === 1 && { r: 4 },
331
+ activeDot: { r: 5 },
332
+ connectNulls: r.connectNulls ?? e.connectNulls ?? !1,
333
+ yAxisId: r.yAxisId,
334
+ label: l,
335
+ isAnimationActive: e.isAnimationActive
336
+ }, r.dataKey) : (t === "area" || t === "composed") && (r.type === "area" || t === "area") ? /* @__PURE__ */ i(o, {
337
+ dataKey: r.dataKey,
338
+ name: r.label,
339
+ stroke: s,
340
+ fill: s,
341
+ fillOpacity: .14,
342
+ strokeWidth: u,
343
+ activeDot: { r: 4 },
344
+ connectNulls: r.connectNulls ?? e.connectNulls ?? !1,
345
+ stackId: e.stacked ? r.stackId ?? "wealthos" : r.stackId,
346
+ yAxisId: r.yAxisId,
347
+ label: l,
348
+ isAnimationActive: e.isAnimationActive
349
+ }, r.dataKey) : /* @__PURE__ */ i(c, {
350
+ dataKey: r.dataKey,
351
+ name: r.label,
352
+ fill: s,
353
+ radius: [
354
+ 3,
355
+ 3,
356
+ 0,
357
+ 0
358
+ ],
359
+ stackId: e.stacked ? r.stackId ?? "wealthos" : r.stackId,
360
+ yAxisId: r.yAxisId,
361
+ label: l,
362
+ isAnimationActive: e.isAnimationActive
363
+ }, r.dataKey);
364
+ }) });
365
+ }
366
+ function W(e) {
367
+ return z(e, (t, n) => /* @__PURE__ */ a(h, {
368
+ accessibilityLayer: !0,
369
+ data: e.data,
370
+ children: [
371
+ /* @__PURE__ */ i(B, { props: e }),
372
+ /* @__PURE__ */ i(V, { props: e }),
373
+ /* @__PURE__ */ i(U, {
374
+ props: {
375
+ ...e,
376
+ series: t
377
+ },
378
+ type: "line",
379
+ highlightedKey: n
380
+ })
381
+ ]
382
+ }));
383
+ }
384
+ function G(e) {
385
+ return z(e, (t, n) => /* @__PURE__ */ a(s, {
386
+ accessibilityLayer: !0,
387
+ data: e.data,
388
+ children: [
389
+ /* @__PURE__ */ i(B, { props: e }),
390
+ /* @__PURE__ */ i(V, { props: e }),
391
+ /* @__PURE__ */ i(U, {
392
+ props: {
393
+ ...e,
394
+ series: t
395
+ },
396
+ type: "area",
397
+ highlightedKey: n
398
+ })
399
+ ]
400
+ }));
401
+ }
402
+ function K(e) {
403
+ return z(e, (t, n) => /* @__PURE__ */ a(l, {
404
+ accessibilityLayer: !0,
405
+ data: e.data,
406
+ children: [
407
+ /* @__PURE__ */ i(B, { props: e }),
408
+ /* @__PURE__ */ i(V, { props: e }),
409
+ /* @__PURE__ */ i(U, {
410
+ props: {
411
+ ...e,
412
+ series: t
413
+ },
414
+ type: "bar",
415
+ highlightedKey: n
416
+ })
417
+ ]
418
+ }));
419
+ }
420
+ function q(e) {
421
+ return z({
422
+ ...e,
423
+ stacked: !0
424
+ }, (t, n) => /* @__PURE__ */ a(l, {
425
+ accessibilityLayer: !0,
426
+ data: e.data,
427
+ children: [
428
+ /* @__PURE__ */ i(B, { props: e }),
429
+ /* @__PURE__ */ i(V, { props: e }),
430
+ /* @__PURE__ */ i(U, {
431
+ props: {
432
+ ...e,
433
+ series: t,
434
+ stacked: !0
435
+ },
436
+ type: "bar",
437
+ highlightedKey: n
438
+ })
439
+ ]
440
+ }));
441
+ }
442
+ function J(e) {
443
+ return z(e, (t, n) => /* @__PURE__ */ a(f, {
444
+ accessibilityLayer: !0,
445
+ data: e.data,
446
+ children: [
447
+ /* @__PURE__ */ i(B, { props: e }),
448
+ /* @__PURE__ */ i(V, { props: e }),
449
+ /* @__PURE__ */ i(U, {
450
+ props: {
451
+ ...e,
452
+ series: t
453
+ },
454
+ type: "composed",
455
+ highlightedKey: n
456
+ })
457
+ ]
458
+ }));
459
+ }
460
+ function Y(e) {
461
+ return z({
462
+ ...e,
463
+ xAxis: !1,
464
+ yAxis: !1,
465
+ showGrid: !1,
466
+ showLegend: e.showLegend ?? !1
467
+ }, (t, n) => /* @__PURE__ */ a(h, {
468
+ accessibilityLayer: !0,
469
+ data: e.data,
470
+ margin: {
471
+ top: 8,
472
+ right: 4,
473
+ bottom: 4,
474
+ left: 4
475
+ },
476
+ children: [/* @__PURE__ */ i(V, { props: e }), /* @__PURE__ */ i(U, {
477
+ props: {
478
+ ...e,
479
+ series: t,
480
+ showDataLabels: !1
481
+ },
482
+ type: "line",
483
+ highlightedKey: n
484
+ })]
485
+ }), { sparkline: !0 });
486
+ }
487
+ function X(e, t) {
488
+ let [r, o] = n(() => /* @__PURE__ */ new Set()), [s, c] = n(null), { data: l, series: u, title: f, description: p, nameKey: m = "name", valueKey: h = u[0]?.dataKey ?? "value", height: v = 280, className: y, loading: b, error: x, emptyState: S } = e;
489
+ if (b) return /* @__PURE__ */ i(N, {
490
+ title: f,
491
+ description: p,
492
+ data: [],
493
+ series: u,
494
+ height: v,
495
+ className: y,
496
+ children: /* @__PURE__ */ i(L, {})
497
+ });
498
+ if (x) return /* @__PURE__ */ i(N, {
499
+ title: f,
500
+ description: p,
501
+ data: [],
502
+ series: u,
503
+ height: v,
504
+ className: y,
505
+ children: /* @__PURE__ */ i("div", {
506
+ className: "wos-chart-state wos-chart-error",
507
+ role: "alert",
508
+ children: x
509
+ })
510
+ });
511
+ if (!l.length) return /* @__PURE__ */ i(N, {
512
+ title: f,
513
+ description: p,
514
+ data: [],
515
+ series: u,
516
+ height: v,
517
+ className: y,
518
+ children: S ?? /* @__PURE__ */ i(I, {})
519
+ });
520
+ let C = (e, t) => String(e[m] ?? t), T = l.map((t, n) => e.config?.[C(t, n)]?.color ?? A[n % A.length]), E = l.filter((e, t) => !r.has(C(e, t)));
521
+ return /* @__PURE__ */ i(N, {
522
+ title: f,
523
+ description: p,
524
+ data: l,
525
+ series: u,
526
+ height: v,
527
+ className: y,
528
+ config: e.config,
529
+ children: /* @__PURE__ */ a("div", {
530
+ className: "wos-chart-content",
531
+ children: [e.showLegend !== !1 && /* @__PURE__ */ i(P, {
532
+ items: l.map((t, n) => ({
533
+ key: C(t, n),
534
+ label: e.config?.[C(t, n)]?.label ?? String(t[m] ?? n + 1),
535
+ color: T[n],
536
+ marker: [
537
+ "circle",
538
+ "square",
539
+ "diamond",
540
+ "line"
541
+ ][n % 4],
542
+ hidden: r.has(C(t, n))
543
+ })),
544
+ onToggle: e.interactiveLegend ? (e) => o((t) => {
545
+ let n = new Set(t);
546
+ return n.has(e) ? n.delete(e) : n.add(e), n;
547
+ }) : void 0,
548
+ highlightedKey: s,
549
+ onHighlight: c
550
+ }), /* @__PURE__ */ i("div", {
551
+ className: "wos-chart-responsive",
552
+ children: /* @__PURE__ */ i(w, {
553
+ width: "100%",
554
+ height: "100%",
555
+ children: /* @__PURE__ */ a(_, {
556
+ accessibilityLayer: !0,
557
+ children: [/* @__PURE__ */ i(D, { content: (t) => /* @__PURE__ */ i(F, {
558
+ active: t.active,
559
+ payload: t.payload,
560
+ label: t.label,
561
+ config: e.config,
562
+ formatValue: e.formatValue,
563
+ formatLabel: e.formatLabel
564
+ }) }), /* @__PURE__ */ i(g, {
565
+ data: E,
566
+ dataKey: h,
567
+ nameKey: m,
568
+ innerRadius: t ? e.innerRadius ?? "58%" : 0,
569
+ outerRadius: e.outerRadius ?? "78%",
570
+ paddingAngle: 2,
571
+ label: e.dataLabels ? ({ name: t, value: n }) => `${String(t)}: ${e.formatValue ? e.formatValue(n) : H(n)}` : !1,
572
+ labelLine: e.dataLabels,
573
+ isAnimationActive: e.isAnimationActive,
574
+ children: E.map((e) => {
575
+ let t = l.indexOf(e), n = s === C(e, t);
576
+ return /* @__PURE__ */ i(d, {
577
+ fill: T[t % T.length],
578
+ stroke: "var(--surface)",
579
+ strokeWidth: n ? 4 : 2
580
+ }, `slice-${C(e, t)}`);
581
+ })
582
+ })]
583
+ })
584
+ })
585
+ })]
586
+ })
587
+ });
588
+ }
589
+ function Z(e) {
590
+ return X(e, !1);
591
+ }
592
+ function Q(e) {
593
+ return X(e, !0);
594
+ }
595
+ function $(e) {
596
+ let { data: t, series: n, title: r, description: o, height: s = 280, className: c } = e;
597
+ return z(e, (n, r) => /* @__PURE__ */ a(E, {
598
+ accessibilityLayer: !0,
599
+ children: [
600
+ /* @__PURE__ */ i(B, { props: {
601
+ ...e,
602
+ xKey: e.xKey ?? "x"
603
+ } }),
604
+ /* @__PURE__ */ i(V, { props: e }),
605
+ n.map((n, a) => /* @__PURE__ */ i(T, {
606
+ name: n.label,
607
+ data: t.map((t) => ({
608
+ ...t,
609
+ x: t[e.xKey ?? "x"],
610
+ y: t[e.yKey ?? n.dataKey]
611
+ })),
612
+ fill: j(n, a, e.config),
613
+ stroke: r === n.dataKey ? "var(--foreground)" : void 0,
614
+ strokeWidth: r === n.dataKey ? 2 : 0,
615
+ isAnimationActive: e.isAnimationActive
616
+ }, n.dataKey))
617
+ ]
618
+ }));
619
+ }
620
+ function ee(e) {
621
+ let [t, r] = n(() => /* @__PURE__ */ new Set()), [o, s] = n(null), { data: c, series: l, title: u, description: f, height: p = 280, className: m } = e, h = e.valueKey ?? l[0]?.dataKey ?? "value", g = e.nameKey ?? "name", _ = (e, t) => String(e[g] ?? t), S = c.map((t, n) => e.config?.[_(t, n)]?.color ?? A[n % A.length]), C = c.filter((e, n) => !t.has(_(e, n)));
622
+ return /* @__PURE__ */ i(N, {
623
+ title: u,
624
+ description: f,
625
+ data: c,
626
+ series: l,
627
+ height: p,
628
+ className: m,
629
+ config: e.config,
630
+ children: e.loading ? /* @__PURE__ */ i(L, {}) : e.error ? /* @__PURE__ */ i("div", {
631
+ className: "wos-chart-state wos-chart-error",
632
+ role: "alert",
633
+ children: e.error
634
+ }) : c.length ? /* @__PURE__ */ a("div", {
635
+ className: "wos-chart-content",
636
+ children: [e.showLegend !== !1 && /* @__PURE__ */ i(P, {
637
+ items: c.map((n, r) => ({
638
+ key: _(n, r),
639
+ label: e.config?.[_(n, r)]?.label ?? String(n[g] ?? r + 1),
640
+ color: S[r],
641
+ marker: [
642
+ "circle",
643
+ "square",
644
+ "diamond",
645
+ "line"
646
+ ][r % 4],
647
+ hidden: t.has(_(n, r))
648
+ })),
649
+ onToggle: e.interactiveLegend ? (e) => r((t) => {
650
+ let n = new Set(t);
651
+ return n.has(e) ? n.delete(e) : n.add(e), n;
652
+ }) : void 0,
653
+ highlightedKey: o,
654
+ onHighlight: s
655
+ }), /* @__PURE__ */ i("div", {
656
+ className: "wos-chart-responsive",
657
+ style: { "--wos-chart-height": `${p}px` },
658
+ children: /* @__PURE__ */ i(w, {
659
+ width: "100%",
660
+ height: "100%",
661
+ children: /* @__PURE__ */ a(x, {
662
+ accessibilityLayer: !0,
663
+ data: C,
664
+ innerRadius: "25%",
665
+ outerRadius: "90%",
666
+ startAngle: 90,
667
+ endAngle: -270,
668
+ children: [
669
+ /* @__PURE__ */ i(y, {
670
+ gridType: "circle",
671
+ stroke: "var(--border-subtle)"
672
+ }),
673
+ /* @__PURE__ */ i(v, {
674
+ type: "number",
675
+ domain: [0, "dataMax"],
676
+ tick: !1
677
+ }),
678
+ e.showTooltip !== !1 && /* @__PURE__ */ i(D, { content: (t) => /* @__PURE__ */ i(F, {
679
+ active: t.active,
680
+ payload: t.payload,
681
+ label: t.label,
682
+ config: e.config,
683
+ formatValue: e.formatValue,
684
+ formatLabel: e.formatLabel
685
+ }) }),
686
+ /* @__PURE__ */ i(b, {
687
+ dataKey: h,
688
+ background: { fill: "var(--surface-subtle)" },
689
+ cornerRadius: 4,
690
+ label: e.dataLabels ? {
691
+ position: "insideStart",
692
+ fill: "var(--surface)",
693
+ formatter: H
694
+ } : !1,
695
+ children: C.map((e) => {
696
+ let t = c.indexOf(e), n = o === _(e, t);
697
+ return /* @__PURE__ */ i(d, {
698
+ fill: S[t],
699
+ stroke: n ? "var(--foreground)" : void 0,
700
+ strokeWidth: n ? 2 : 0
701
+ }, _(e, t));
702
+ })
703
+ })
704
+ ]
705
+ })
706
+ })
707
+ })]
708
+ }) : e.emptyState ?? /* @__PURE__ */ i(I, {})
709
+ });
710
+ }
711
+ //#endregion
712
+ export { G as AreaChart, K as BarChart, N as ChartContainer, I as ChartEmptyState, R as ChartErrorState, P as ChartLegend, L as ChartLoadingState, F as ChartTooltip, J as ComposedChart, Q as DonutChart, W as LineChart, Z as PieChart, ee as RadialChart, $ as ScatterChart, Y as Sparkline, q as StackedBarChart };
@@ -0,0 +1,3 @@
1
+ import "./styles.css";
2
+ export { CommandMenu, CommandMenuGroup, CommandMenuItem, CommandMenuSeparator, CommandMenuShortcut } from "./components/command-menu";
3
+ export type { CommandMenuProps } from "./components/command-menu";