@devalok/shilp-sutra 0.8.3 → 0.9.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 (217) hide show
  1. package/dist/_chunks/avatar.js +50 -0
  2. package/dist/_chunks/button.js +95 -0
  3. package/dist/_chunks/card.js +40 -0
  4. package/dist/_chunks/checkbox.js +14 -0
  5. package/dist/_chunks/form.js +27 -0
  6. package/dist/_chunks/primitives.js +6965 -0
  7. package/dist/_chunks/sidebar.js +592 -0
  8. package/dist/_chunks/spinner.js +34 -0
  9. package/dist/_chunks/tiptap.js +15254 -0
  10. package/dist/_chunks/tooltip.js +13 -0
  11. package/dist/_chunks/tree-view.js +304 -0
  12. package/dist/_chunks/use-calendar.js +990 -0
  13. package/dist/_chunks/utils.js +15 -0
  14. package/dist/_chunks/vendor.js +5823 -0
  15. package/dist/composed/avatar-group.js +20 -20
  16. package/dist/composed/command-palette.js +1 -1
  17. package/dist/composed/confirm-dialog.js +5 -5
  18. package/dist/composed/content-card.d.ts +1 -1
  19. package/dist/composed/content-card.js +6 -6
  20. package/dist/composed/date-picker/index.js +13 -0
  21. package/dist/composed/empty-state.js +10 -10
  22. package/dist/composed/error-boundary.js +2 -2
  23. package/dist/composed/global-loading.js +4 -4
  24. package/dist/composed/index.js +45 -53
  25. package/dist/composed/loading-skeleton.js +2 -2
  26. package/dist/composed/member-picker.js +5 -5
  27. package/dist/composed/page-header.js +4 -4
  28. package/dist/composed/page-skeletons.js +1 -1
  29. package/dist/composed/priority-indicator.js +6 -6
  30. package/dist/composed/rich-text-editor.js +422 -209
  31. package/dist/composed/schedule-view.js +1 -1
  32. package/dist/composed/simple-tooltip.js +6 -6
  33. package/dist/composed/status-badge.d.ts +1 -1
  34. package/dist/composed/status-badge.js +2 -2
  35. package/dist/shell/bottom-navbar.js +1 -1
  36. package/dist/shell/notification-center.js +2 -2
  37. package/dist/shell/notification-preferences.js +32 -33
  38. package/dist/shell/sidebar.js +24 -24
  39. package/dist/shell/top-bar.js +22 -22
  40. package/dist/ui/accordion.js +17 -17
  41. package/dist/ui/alert-dialog.js +29 -29
  42. package/dist/ui/alert.d.ts +2 -2
  43. package/dist/ui/alert.js +65 -44
  44. package/dist/ui/aspect-ratio.js +1 -1
  45. package/dist/ui/autocomplete.js +11 -11
  46. package/dist/ui/avatar.d.ts +1 -1
  47. package/dist/ui/avatar.js +67 -25
  48. package/dist/ui/badge.d.ts +2 -2
  49. package/dist/ui/badge.js +115 -91
  50. package/dist/ui/banner.d.ts +1 -1
  51. package/dist/ui/banner.js +5 -5
  52. package/dist/ui/breadcrumb.js +14 -14
  53. package/dist/ui/button-group.js +30 -15
  54. package/dist/ui/button.d.ts +2 -2
  55. package/dist/ui/button.js +114 -71
  56. package/dist/ui/card.js +66 -22
  57. package/dist/ui/charts/index.js +1221 -18
  58. package/dist/ui/checkbox.js +25 -5
  59. package/dist/ui/chip.d.ts +4 -4
  60. package/dist/ui/chip.js +2 -2
  61. package/dist/ui/code.js +1 -1
  62. package/dist/ui/collapsible.js +5 -5
  63. package/dist/ui/color-input.js +11 -11
  64. package/dist/ui/combobox.js +12 -12
  65. package/dist/ui/container.js +4 -4
  66. package/dist/ui/context-menu.js +37 -37
  67. package/dist/ui/data-table-toolbar.js +18 -18
  68. package/dist/ui/data-table.js +2 -2
  69. package/dist/ui/dialog.js +33 -33
  70. package/dist/ui/dropdown-menu.js +60 -60
  71. package/dist/ui/file-upload.js +1 -1
  72. package/dist/ui/form.js +36 -15
  73. package/dist/ui/hover-card.js +7 -7
  74. package/dist/ui/icon-button.js +9 -9
  75. package/dist/ui/index.js +523 -325
  76. package/dist/ui/input-otp.d.ts +2 -2
  77. package/dist/ui/input-otp.js +14 -14
  78. package/dist/ui/input.js +56 -28
  79. package/dist/ui/label.js +18 -4
  80. package/dist/ui/lib/utils.js +4 -5
  81. package/dist/ui/link.js +9 -9
  82. package/dist/ui/menubar.js +81 -81
  83. package/dist/ui/navigation-menu.js +42 -42
  84. package/dist/ui/number-input.js +13 -13
  85. package/dist/ui/pagination.js +5 -5
  86. package/dist/ui/popover.js +9 -9
  87. package/dist/ui/progress.d.ts +1 -1
  88. package/dist/ui/progress.js +15 -15
  89. package/dist/ui/radio.js +10 -10
  90. package/dist/ui/search-input.js +5 -5
  91. package/dist/ui/segmented-control.js +91 -83
  92. package/dist/ui/select.js +52 -52
  93. package/dist/ui/separator.js +20 -5
  94. package/dist/ui/sheet.js +28 -28
  95. package/dist/ui/sidebar.js +36 -560
  96. package/dist/ui/skeleton.d.ts +1 -1
  97. package/dist/ui/skeleton.js +9 -9
  98. package/dist/ui/slider.js +11 -11
  99. package/dist/ui/spinner.js +37 -2
  100. package/dist/ui/stack.js +1 -1
  101. package/dist/ui/stat-card.js +1 -1
  102. package/dist/ui/stepper.js +15 -15
  103. package/dist/ui/switch.js +22 -3
  104. package/dist/ui/table.js +1 -1
  105. package/dist/ui/tabs.js +59 -32
  106. package/dist/ui/text.js +2 -2
  107. package/dist/ui/textarea.js +7 -7
  108. package/dist/ui/toast.d.ts +1 -1
  109. package/dist/ui/toast.js +28 -28
  110. package/dist/ui/toggle-group.js +11 -11
  111. package/dist/ui/toggle.js +9 -9
  112. package/dist/ui/tooltip.js +17 -6
  113. package/dist/ui/transitions.js +68 -58
  114. package/dist/ui/tree-view/index.js +7 -0
  115. package/dist/ui/visually-hidden.js +3 -3
  116. package/llms-full.txt +1 -1
  117. package/llms.txt +7 -0
  118. package/package.json +656 -701
  119. package/dist/_virtual/client.js +0 -5
  120. package/dist/_virtual/index.js +0 -5
  121. package/dist/_virtual/react-dom-client.development.js +0 -5
  122. package/dist/_virtual/react-dom-client.production.js +0 -5
  123. package/dist/_virtual/scheduler.development.js +0 -5
  124. package/dist/_virtual/scheduler.production.js +0 -5
  125. package/dist/composed/date-picker/calendar-grid.js +0 -194
  126. package/dist/composed/date-picker/date-picker.js +0 -124
  127. package/dist/composed/date-picker/date-range-picker.js +0 -167
  128. package/dist/composed/date-picker/date-time-picker.js +0 -193
  129. package/dist/composed/date-picker/month-picker.js +0 -53
  130. package/dist/composed/date-picker/presets.js +0 -84
  131. package/dist/composed/date-picker/time-picker.js +0 -181
  132. package/dist/composed/date-picker/use-calendar.js +0 -17
  133. package/dist/composed/date-picker/year-picker.js +0 -45
  134. package/dist/composed/extensions/emoji-suggestion.js +0 -119
  135. package/dist/composed/extensions/file-attachment.js +0 -55
  136. package/dist/composed/extensions/mention-suggestion.js +0 -79
  137. package/dist/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.js +0 -40141
  138. package/dist/node_modules/.pnpm/@emoji-mart_react@1.1.1_emoji-mart@5.6.0_react@19.2.4/node_modules/@emoji-mart/react/dist/module.js +0 -17
  139. package/dist/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.js +0 -2958
  140. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.development.js +0 -17062
  141. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.production.js +0 -9790
  142. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/client.js +0 -20
  143. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.development.js +0 -237
  144. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.production.js +0 -234
  145. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/index.js +0 -11
  146. package/dist/primitives/_internal/number.js +0 -6
  147. package/dist/primitives/_internal/primitive.js +0 -9
  148. package/dist/primitives/_internal/react-arrow.js +0 -13
  149. package/dist/primitives/_internal/react-collection.js +0 -48
  150. package/dist/primitives/_internal/react-compose-refs.js +0 -29
  151. package/dist/primitives/_internal/react-context.js +0 -76
  152. package/dist/primitives/_internal/react-direction.js +0 -10
  153. package/dist/primitives/_internal/react-dismissable-layer.js +0 -103
  154. package/dist/primitives/_internal/react-focus-guards.js +0 -17
  155. package/dist/primitives/_internal/react-focus-scope.js +0 -137
  156. package/dist/primitives/_internal/react-id.js +0 -14
  157. package/dist/primitives/_internal/react-popper.js +0 -137
  158. package/dist/primitives/_internal/react-portal.js +0 -16
  159. package/dist/primitives/_internal/react-presence.js +0 -71
  160. package/dist/primitives/_internal/react-primitive.js +0 -36
  161. package/dist/primitives/_internal/react-use-callback-ref.js +0 -13
  162. package/dist/primitives/_internal/react-use-controllable-state.js +0 -44
  163. package/dist/primitives/_internal/react-use-escape-keydown.js +0 -14
  164. package/dist/primitives/_internal/react-use-is-hydrated.js +0 -15
  165. package/dist/primitives/_internal/react-use-layout-effect.js +0 -6
  166. package/dist/primitives/_internal/react-use-previous.js +0 -8
  167. package/dist/primitives/_internal/react-use-size.js +0 -27
  168. package/dist/primitives/react-accordion.js +0 -239
  169. package/dist/primitives/react-alert-dialog.js +0 -127
  170. package/dist/primitives/react-aspect-ratio.js +0 -43
  171. package/dist/primitives/react-avatar.js +0 -75
  172. package/dist/primitives/react-checkbox.js +0 -251
  173. package/dist/primitives/react-collapsible.js +0 -120
  174. package/dist/primitives/react-context-menu.js +0 -240
  175. package/dist/primitives/react-dialog.js +0 -262
  176. package/dist/primitives/react-dropdown-menu.js +0 -227
  177. package/dist/primitives/react-hover-card.js +0 -187
  178. package/dist/primitives/react-label.js +0 -20
  179. package/dist/primitives/react-menu.js +0 -652
  180. package/dist/primitives/react-menubar.js +0 -355
  181. package/dist/primitives/react-navigation-menu.js +0 -607
  182. package/dist/primitives/react-popover.js +0 -243
  183. package/dist/primitives/react-progress.js +0 -84
  184. package/dist/primitives/react-radio-group.js +0 -238
  185. package/dist/primitives/react-roving-focus.js +0 -183
  186. package/dist/primitives/react-select.js +0 -862
  187. package/dist/primitives/react-separator.js +0 -24
  188. package/dist/primitives/react-slider.js +0 -437
  189. package/dist/primitives/react-slot.js +0 -70
  190. package/dist/primitives/react-switch.js +0 -132
  191. package/dist/primitives/react-tabs.js +0 -163
  192. package/dist/primitives/react-toast.js +0 -446
  193. package/dist/primitives/react-toggle-group.js +0 -137
  194. package/dist/primitives/react-toggle.js +0 -33
  195. package/dist/primitives/react-tooltip.js +0 -338
  196. package/dist/primitives/react-visually-hidden.js +0 -32
  197. package/dist/ui/charts/_internal/animation.js +0 -18
  198. package/dist/ui/charts/_internal/axes.js +0 -42
  199. package/dist/ui/charts/_internal/colors.js +0 -21
  200. package/dist/ui/charts/_internal/grid-lines.js +0 -43
  201. package/dist/ui/charts/_internal/legend.js +0 -29
  202. package/dist/ui/charts/_internal/tooltip.js +0 -39
  203. package/dist/ui/charts/_internal/types.js +0 -10
  204. package/dist/ui/charts/area-chart.js +0 -245
  205. package/dist/ui/charts/bar-chart.js +0 -153
  206. package/dist/ui/charts/chart-container.js +0 -27
  207. package/dist/ui/charts/gauge-chart.js +0 -72
  208. package/dist/ui/charts/line-chart.js +0 -163
  209. package/dist/ui/charts/pie-chart.js +0 -132
  210. package/dist/ui/charts/radar-chart.js +0 -223
  211. package/dist/ui/charts/sparkline.js +0 -124
  212. package/dist/ui/lib/motion.js +0 -32
  213. package/dist/ui/lib/use-reduced-motion.js +0 -15
  214. package/dist/ui/lib/use-ripple.js +0 -14
  215. package/dist/ui/tree-view/tree-item.js +0 -139
  216. package/dist/ui/tree-view/tree-view.js +0 -140
  217. package/dist/ui/tree-view/use-tree.js +0 -38
@@ -1,21 +1,1224 @@
1
1
  "use client";
2
- import { ChartContainer as e } from "./chart-container.js";
3
- import { BarChart as a } from "./bar-chart.js";
4
- import { LineChart as f } from "./line-chart.js";
5
- import { AreaChart as x } from "./area-chart.js";
6
- import { PieChart as h } from "./pie-chart.js";
7
- import { Sparkline as i } from "./sparkline.js";
8
- import { GaugeChart as g } from "./gauge-chart.js";
9
- import { RadarChart as k } from "./radar-chart.js";
10
- import { Legend as u } from "./_internal/legend.js";
2
+ import { jsx as e, jsxs as f, Fragment as Q } from "react/jsx-runtime";
3
+ import * as Ne from "react";
4
+ import { useRef as ue, useState as ee, useEffect as se, useCallback as pe } from "react";
5
+ import { c as U } from "../../_chunks/utils.js";
6
+ import { scaleBand as ke, scaleLinear as K, scalePoint as ve } from "d3-scale";
7
+ import { axisLeft as Re, axisBottom as $e, axisRight as Ce, axisTop as Ae } from "d3-axis";
8
+ import { select as Ge } from "d3-selection";
9
+ import { line as oe, curveMonotoneX as ae, curveLinear as ye, stack as Se, stackOrderNone as Le, stackOffsetNone as we, area as fe, pie as Xe, arc as de, lineRadial as De, curveLinearClosed as Pe } from "d3-shape";
10
+ const ze = {
11
+ top: 20,
12
+ right: 20,
13
+ bottom: 40,
14
+ left: 50
15
+ };
16
+ function me({
17
+ height: t = 300,
18
+ margin: r,
19
+ className: n,
20
+ children: p
21
+ }) {
22
+ const i = ue(null), [M, m] = ee(0), v = { ...ze, ...r };
23
+ se(() => {
24
+ if (!i.current) return;
25
+ const A = new ResizeObserver((B) => {
26
+ const X = B[0];
27
+ X && m(X.contentRect.width);
28
+ });
29
+ return A.observe(i.current), () => A.disconnect();
30
+ }, []);
31
+ const L = Math.max(0, M - v.left - v.right), C = Math.max(0, t - v.top - v.bottom);
32
+ return /* @__PURE__ */ e("div", { ref: i, className: U("relative w-full", n), children: M > 0 && /* @__PURE__ */ e("svg", { width: M, height: t, role: "img", "aria-label": "Chart", children: /* @__PURE__ */ e("g", { transform: `translate(${v.left},${v.top})`, children: p({ width: L, height: C, margin: v }) }) }) });
33
+ }
34
+ me.displayName = "ChartContainer";
35
+ function J({
36
+ scale: t,
37
+ orientation: r,
38
+ transform: n,
39
+ tickCount: p,
40
+ tickFormat: i,
41
+ label: M,
42
+ className: m
43
+ }) {
44
+ const v = ue(null);
45
+ return se(() => {
46
+ if (!v.current) return;
47
+ const C = {
48
+ top: Ae,
49
+ right: Ce,
50
+ bottom: $e,
51
+ left: Re
52
+ }[r];
53
+ let A = C(t);
54
+ p && (A = A.ticks(p)), i && (A = A.tickFormat(i));
55
+ const B = Ge(v.current);
56
+ B.call(A), B.selectAll(".tick line").attr("stroke", "var(--color-border-subtle)"), B.selectAll(".tick text").attr("fill", "var(--color-text-secondary)").attr("font-size", "var(--font-size-xs)"), B.selectAll(".domain").attr("stroke", "var(--color-border-default)");
57
+ }, [t, r, p, i]), /* @__PURE__ */ e("g", { ref: v, transform: n, className: m, children: M && /* @__PURE__ */ e(
58
+ "text",
59
+ {
60
+ textAnchor: "middle",
61
+ fill: "var(--color-text-secondary)",
62
+ fontSize: "var(--font-size-sm)",
63
+ ...r === "bottom" ? { x: "50%", dy: 35 } : r === "left" ? { transform: "rotate(-90)", y: -40, x: 0 } : {},
64
+ children: M
65
+ }
66
+ ) });
67
+ }
68
+ J.displayName = "Axis";
69
+ function le({
70
+ width: t,
71
+ height: r,
72
+ xScale: n,
73
+ yScale: p,
74
+ horizontal: i = !0,
75
+ vertical: M = !1
76
+ }) {
77
+ return /* @__PURE__ */ f("g", { className: "grid-lines", children: [
78
+ i && (p == null ? void 0 : p.ticks) && p.ticks().map((m, v) => /* @__PURE__ */ e(
79
+ "line",
80
+ {
81
+ x1: 0,
82
+ x2: t,
83
+ y1: p(m),
84
+ y2: p(m),
85
+ stroke: "var(--color-border-subtle)",
86
+ strokeDasharray: "3,3",
87
+ opacity: 0.6
88
+ },
89
+ `h-${v}`
90
+ )),
91
+ M && (n == null ? void 0 : n.ticks) && n.ticks().map((m, v) => /* @__PURE__ */ e(
92
+ "line",
93
+ {
94
+ x1: n(m),
95
+ x2: n(m),
96
+ y1: 0,
97
+ y2: r,
98
+ stroke: "var(--color-border-subtle)",
99
+ strokeDasharray: "3,3",
100
+ opacity: 0.6
101
+ },
102
+ `v-${v}`
103
+ ))
104
+ ] });
105
+ }
106
+ le.displayName = "GridLines";
107
+ function te({ items: t, position: r = "bottom", className: n }) {
108
+ return /* @__PURE__ */ e(
109
+ "div",
110
+ {
111
+ className: U(
112
+ "flex gap-ds-04 text-ds-sm text-text-secondary",
113
+ r === "left" || r === "right" ? "flex-col" : "flex-row flex-wrap justify-center",
114
+ n
115
+ ),
116
+ children: t.map((i) => /* @__PURE__ */ f("div", { className: "flex items-center gap-ds-02", children: [
117
+ /* @__PURE__ */ e(
118
+ "span",
119
+ {
120
+ className: "inline-block h-3 w-3 shrink-0 rounded-ds-sm",
121
+ style: { backgroundColor: i.color }
122
+ }
123
+ ),
124
+ /* @__PURE__ */ e("span", { children: i.label })
125
+ ] }, i.label))
126
+ }
127
+ );
128
+ }
129
+ te.displayName = "Legend";
130
+ function ne({ state: t, className: r }) {
131
+ return t.visible ? /* @__PURE__ */ e(
132
+ "div",
133
+ {
134
+ className: U(
135
+ "pointer-events-none absolute z-tooltip",
136
+ "rounded-ds-md border border-border",
137
+ "bg-layer-01 px-ds-03 py-ds-02",
138
+ "shadow-02",
139
+ "text-ds-sm text-text-primary",
140
+ r
141
+ ),
142
+ style: { left: t.x + 12, top: t.y - 12 },
143
+ children: t.content
144
+ }
145
+ ) : null;
146
+ }
147
+ ne.displayName = "ChartTooltip";
148
+ function ce() {
149
+ const [t, r] = ee({
150
+ visible: !1,
151
+ x: 0,
152
+ y: 0,
153
+ content: null
154
+ }), n = pe((i, M, m) => {
155
+ r({ visible: !0, x: i, y: M, content: m });
156
+ }, []), p = pe(() => {
157
+ r((i) => ({ ...i, visible: !1 }));
158
+ }, []);
159
+ return { tooltip: t, show: n, hide: p };
160
+ }
161
+ const he = [
162
+ "chart-1",
163
+ "chart-2",
164
+ "chart-3",
165
+ "chart-4",
166
+ "chart-5",
167
+ "chart-6",
168
+ "chart-7",
169
+ "chart-8"
170
+ ];
171
+ function ge(t) {
172
+ return `var(--${t})`;
173
+ }
174
+ function H(t, r = 0) {
175
+ return t ? he.includes(t) ? ge(t) : t : ge(he[r % he.length]);
176
+ }
177
+ function re() {
178
+ const [t, r] = ee(!1);
179
+ return se(() => {
180
+ const n = window.matchMedia("(prefers-reduced-motion: reduce)");
181
+ r(n.matches);
182
+ const p = (i) => r(i.matches);
183
+ return n.addEventListener("change", p), () => n.removeEventListener("change", p);
184
+ }, []), t;
185
+ }
186
+ function Be(t, r = 300) {
187
+ return t ? 0 : r;
188
+ }
189
+ function Ve({
190
+ data: t,
191
+ xKey: r,
192
+ yKey: n,
193
+ orientation: p = "vertical",
194
+ stacked: i = !1,
195
+ grouped: M = !1,
196
+ color: m,
197
+ height: v = 300,
198
+ showGrid: L = !0,
199
+ showTooltip: C = !0,
200
+ showLegend: A = !1,
201
+ animate: B = !0,
202
+ barRadius: X = 4,
203
+ xLabel: w,
204
+ yLabel: I,
205
+ seriesLabels: j,
206
+ className: V
207
+ }) {
208
+ const { tooltip: E, show: T, hide: y } = ce();
209
+ re();
210
+ const N = p === "vertical", x = Array.isArray(n) ? n : [n], c = x.length > 1, F = c ? x.map(
211
+ (R, k) => H(
212
+ Array.isArray(m) ? m[k] : typeof m == "string" ? m : void 0,
213
+ k
214
+ )
215
+ ) : [
216
+ H(
217
+ typeof m == "string" ? m : Array.isArray(m) ? m[0] : void 0,
218
+ 0
219
+ )
220
+ ];
221
+ return /* @__PURE__ */ f("div", { className: U("relative", V), children: [
222
+ /* @__PURE__ */ e(me, { height: v, children: ({ width: R, height: k, margin: h }) => {
223
+ const l = t.map((G) => String(G[r]));
224
+ let s;
225
+ i ? s = Math.max(
226
+ ...t.map(
227
+ (G) => x.reduce((S, $) => S + (Number(G[$]) || 0), 0)
228
+ )
229
+ ) : s = Math.max(
230
+ ...t.flatMap((G) => x.map((S) => Number(G[S]) || 0))
231
+ );
232
+ const b = ke().domain(l).range(N ? [0, R] : [0, k]).padding(0.2), a = K().domain([0, s * 1.1]).range(N ? [k, 0] : [0, R]).nice(), o = b.bandwidth(), d = c && M ? o / x.length : o;
233
+ return /* @__PURE__ */ f(Q, { children: [
234
+ L && /* @__PURE__ */ e(
235
+ le,
236
+ {
237
+ width: R,
238
+ height: k,
239
+ yScale: N ? a : void 0,
240
+ xScale: N ? void 0 : a,
241
+ horizontal: N,
242
+ vertical: !N
243
+ }
244
+ ),
245
+ t.map((G) => {
246
+ const S = String(G[r]);
247
+ let $ = 0;
248
+ return x.map((Y, u) => {
249
+ const g = Number(G[Y]) || 0, D = F[u] || F[0];
250
+ let W, z, q, P;
251
+ return N ? (W = (b(S) ?? 0) + (M && c ? u * d : 0), z = a(i ? $ + g : g), q = d, P = i ? a($) - a($ + g) : k - a(g)) : (W = i ? a($) : 0, z = (b(S) ?? 0) + (M && c ? u * d : 0), q = i ? a($ + g) - a($) : a(g), P = d), i && ($ += g), /* @__PURE__ */ e(
252
+ "rect",
253
+ {
254
+ x: W,
255
+ y: z,
256
+ width: Math.max(0, q),
257
+ height: Math.max(0, P),
258
+ rx: X,
259
+ fill: D,
260
+ className: "transition-opacity hover:opacity-[0.8]",
261
+ onMouseMove: (O) => {
262
+ var _;
263
+ if (C) {
264
+ const Z = (_ = O.currentTarget.closest("div")) == null ? void 0 : _.getBoundingClientRect();
265
+ T(
266
+ O.clientX - ((Z == null ? void 0 : Z.left) ?? 0),
267
+ O.clientY - ((Z == null ? void 0 : Z.top) ?? 0),
268
+ /* @__PURE__ */ f("div", { children: [
269
+ /* @__PURE__ */ e("div", { className: "font-medium", children: S }),
270
+ c && /* @__PURE__ */ e("div", { className: "text-text-secondary", children: (j == null ? void 0 : j[u]) ?? Y }),
271
+ /* @__PURE__ */ e("div", { children: g.toLocaleString() })
272
+ ] })
273
+ );
274
+ }
275
+ },
276
+ onMouseLeave: y
277
+ },
278
+ `${S}-${Y}`
279
+ );
280
+ });
281
+ }),
282
+ N ? /* @__PURE__ */ f(Q, { children: [
283
+ /* @__PURE__ */ e(
284
+ J,
285
+ {
286
+ scale: b,
287
+ orientation: "bottom",
288
+ transform: `translate(0,${k})`,
289
+ label: w
290
+ }
291
+ ),
292
+ /* @__PURE__ */ e(J, { scale: a, orientation: "left", label: I })
293
+ ] }) : /* @__PURE__ */ f(Q, { children: [
294
+ /* @__PURE__ */ e(
295
+ J,
296
+ {
297
+ scale: a,
298
+ orientation: "bottom",
299
+ transform: `translate(0,${k})`,
300
+ label: w
301
+ }
302
+ ),
303
+ /* @__PURE__ */ e(
304
+ J,
305
+ {
306
+ scale: b,
307
+ orientation: "left",
308
+ label: I
309
+ }
310
+ )
311
+ ] })
312
+ ] });
313
+ } }),
314
+ C && /* @__PURE__ */ e(ne, { state: E }),
315
+ A && c && /* @__PURE__ */ e(
316
+ te,
317
+ {
318
+ items: x.map((R, k) => ({
319
+ label: (j == null ? void 0 : j[k]) ?? R,
320
+ color: F[k]
321
+ })),
322
+ className: "mt-ds-04"
323
+ }
324
+ )
325
+ ] });
326
+ }
327
+ Ve.displayName = "BarChart";
328
+ function _e({
329
+ data: t,
330
+ xKey: r,
331
+ series: n,
332
+ curved: p = !1,
333
+ showDots: i = !1,
334
+ dotSize: M = 4,
335
+ strokeWidth: m = 2,
336
+ height: v = 300,
337
+ showGrid: L = !0,
338
+ showTooltip: C = !0,
339
+ showLegend: A = !1,
340
+ animate: B = !0,
341
+ xLabel: X,
342
+ yLabel: w,
343
+ className: I
344
+ }) {
345
+ const { tooltip: j, show: V, hide: E } = ce();
346
+ re();
347
+ const T = n.map((y, N) => H(y.color, N));
348
+ return /* @__PURE__ */ f("div", { className: U("relative", I), children: [
349
+ /* @__PURE__ */ e(me, { height: v, children: ({ width: y, height: N, margin: x }) => {
350
+ const c = t.map((o) => o[r]), F = c.every((o) => typeof o == "number");
351
+ let R, k;
352
+ if (F) {
353
+ const o = c, d = Math.min(...o), G = Math.max(...o), S = K().domain([d, G]).range([0, y]);
354
+ R = S, k = ($) => S(Number($[r]));
355
+ } else {
356
+ const o = c.map(String), d = ve().domain(o).range([0, y]).padding(0.5);
357
+ R = d, k = (G) => d(String(G[r])) ?? 0;
358
+ }
359
+ const h = t.flatMap(
360
+ (o) => n.map((d) => Number(o[d.key]) || 0)
361
+ ), l = Math.max(...h), s = K().domain([0, l * 1.1]).range([N, 0]).nice(), b = p ? ae : ye, a = oe().curve(b).defined((o) => o != null);
362
+ return /* @__PURE__ */ f(Q, { children: [
363
+ L && /* @__PURE__ */ e(
364
+ le,
365
+ {
366
+ width: y,
367
+ height: N,
368
+ yScale: s,
369
+ horizontal: !0
370
+ }
371
+ ),
372
+ n.map((o, d) => {
373
+ const S = a.x(($) => k($)).y(($) => s(Number($[o.key]) || 0))(t) ?? "";
374
+ return /* @__PURE__ */ f("g", { children: [
375
+ /* @__PURE__ */ e(
376
+ "path",
377
+ {
378
+ d: S,
379
+ fill: "none",
380
+ stroke: T[d],
381
+ strokeWidth: m,
382
+ strokeLinejoin: "round",
383
+ strokeLinecap: "round"
384
+ }
385
+ ),
386
+ i && t.map(($, Y) => {
387
+ const u = k($), g = s(Number($[o.key]) || 0);
388
+ return /* @__PURE__ */ e(
389
+ "circle",
390
+ {
391
+ cx: u,
392
+ cy: g,
393
+ r: M,
394
+ fill: T[d],
395
+ className: "transition-opacity hover:opacity-[0.8]"
396
+ },
397
+ `${o.key}-dot-${Y}`
398
+ );
399
+ })
400
+ ] }, o.key);
401
+ }),
402
+ C && t.map((o, d) => {
403
+ const G = k(o), S = y / Math.max(t.length - 1, 1);
404
+ return /* @__PURE__ */ e(
405
+ "rect",
406
+ {
407
+ x: G - S / 2,
408
+ y: 0,
409
+ width: S,
410
+ height: N,
411
+ fill: "transparent",
412
+ onMouseMove: ($) => {
413
+ var u;
414
+ const Y = (u = $.currentTarget.closest("div")) == null ? void 0 : u.getBoundingClientRect();
415
+ V(
416
+ $.clientX - ((Y == null ? void 0 : Y.left) ?? 0),
417
+ $.clientY - ((Y == null ? void 0 : Y.top) ?? 0),
418
+ /* @__PURE__ */ f("div", { children: [
419
+ /* @__PURE__ */ e("div", { className: "font-medium", children: String(o[r]) }),
420
+ n.map((g, D) => /* @__PURE__ */ f(
421
+ "div",
422
+ {
423
+ className: "flex items-center gap-ds-02",
424
+ children: [
425
+ /* @__PURE__ */ e(
426
+ "span",
427
+ {
428
+ className: "inline-block h-2 w-2 rounded-ds-full",
429
+ style: { backgroundColor: T[D] }
430
+ }
431
+ ),
432
+ /* @__PURE__ */ f("span", { className: "text-text-secondary", children: [
433
+ g.label,
434
+ ":"
435
+ ] }),
436
+ " ",
437
+ Number(o[g.key]).toLocaleString()
438
+ ]
439
+ },
440
+ g.key
441
+ ))
442
+ ] })
443
+ );
444
+ },
445
+ onMouseLeave: E
446
+ },
447
+ `hover-${d}`
448
+ );
449
+ }),
450
+ /* @__PURE__ */ e(
451
+ J,
452
+ {
453
+ scale: R,
454
+ orientation: "bottom",
455
+ transform: `translate(0,${N})`,
456
+ label: X
457
+ }
458
+ ),
459
+ /* @__PURE__ */ e(J, { scale: s, orientation: "left", label: w })
460
+ ] });
461
+ } }),
462
+ C && /* @__PURE__ */ e(ne, { state: j }),
463
+ A && n.length > 1 && /* @__PURE__ */ e(
464
+ te,
465
+ {
466
+ items: n.map((y, N) => ({
467
+ label: y.label,
468
+ color: T[N]
469
+ })),
470
+ className: "mt-ds-04"
471
+ }
472
+ )
473
+ ] });
474
+ }
475
+ _e.displayName = "LineChart";
476
+ function je({
477
+ data: t,
478
+ xKey: r,
479
+ series: n,
480
+ curved: p = !1,
481
+ stacked: i = !1,
482
+ fillOpacity: M = 0.3,
483
+ gradient: m = !1,
484
+ strokeWidth: v = 2,
485
+ height: L = 300,
486
+ showGrid: C = !0,
487
+ showTooltip: A = !0,
488
+ showLegend: B = !1,
489
+ animate: X = !0,
490
+ xLabel: w,
491
+ yLabel: I,
492
+ className: j
493
+ }) {
494
+ const { tooltip: V, show: E, hide: T } = ce();
495
+ re();
496
+ const y = n.map((x, c) => H(x.color, c)), N = Ne.useId();
497
+ return /* @__PURE__ */ f("div", { className: U("relative", j), children: [
498
+ /* @__PURE__ */ e(me, { height: L, children: ({ width: x, height: c, margin: F }) => {
499
+ const R = t.map((u) => u[r]), k = R.every((u) => typeof u == "number");
500
+ let h, l, s;
501
+ if (k) {
502
+ const u = R, g = Math.min(...u), D = Math.max(...u), W = K().domain([g, D]).range([0, x]);
503
+ h = W, l = (z) => W(Number(z[r])), s = (z) => W(Number(t[z][r]));
504
+ } else {
505
+ const u = R.map(String), g = ve().domain(u).range([0, x]).padding(0.5);
506
+ h = g, l = (D) => g(String(D[r])) ?? 0, s = (D) => g(String(t[D][r])) ?? 0;
507
+ }
508
+ let b;
509
+ i ? b = Math.max(
510
+ ...t.map(
511
+ (u) => n.reduce((g, D) => g + (Number(u[D.key]) || 0), 0)
512
+ )
513
+ ) : b = Math.max(
514
+ ...t.flatMap(
515
+ (u) => n.map((g) => Number(u[g.key]) || 0)
516
+ )
517
+ );
518
+ const a = K().domain([0, b * 1.1]).range([c, 0]).nice(), o = p ? ae : ye, d = () => t.map((u, g) => {
519
+ const D = l(u), W = x / Math.max(t.length - 1, 1);
520
+ return /* @__PURE__ */ e(
521
+ "rect",
522
+ {
523
+ x: D - W / 2,
524
+ y: 0,
525
+ width: W,
526
+ height: c,
527
+ fill: "transparent",
528
+ onMouseMove: (z) => {
529
+ var P;
530
+ const q = (P = z.currentTarget.closest("div")) == null ? void 0 : P.getBoundingClientRect();
531
+ E(
532
+ z.clientX - ((q == null ? void 0 : q.left) ?? 0),
533
+ z.clientY - ((q == null ? void 0 : q.top) ?? 0),
534
+ /* @__PURE__ */ f("div", { children: [
535
+ /* @__PURE__ */ e("div", { className: "font-medium", children: String(u[r]) }),
536
+ n.map((O, _) => /* @__PURE__ */ f(
537
+ "div",
538
+ {
539
+ className: "flex items-center gap-ds-02",
540
+ children: [
541
+ /* @__PURE__ */ e(
542
+ "span",
543
+ {
544
+ className: "inline-block h-2 w-2 rounded-ds-full",
545
+ style: { backgroundColor: y[_] }
546
+ }
547
+ ),
548
+ /* @__PURE__ */ f("span", { className: "text-text-secondary", children: [
549
+ O.label,
550
+ ":"
551
+ ] }),
552
+ " ",
553
+ Number(u[O.key]).toLocaleString()
554
+ ]
555
+ },
556
+ O.key
557
+ ))
558
+ ] })
559
+ );
560
+ },
561
+ onMouseLeave: T
562
+ },
563
+ `hover-${g}`
564
+ );
565
+ }), G = () => m ? /* @__PURE__ */ e("defs", { children: n.map((u, g) => /* @__PURE__ */ f(
566
+ "linearGradient",
567
+ {
568
+ id: `${N}-gradient-${g}`,
569
+ x1: "0",
570
+ y1: "0",
571
+ x2: "0",
572
+ y2: "1",
573
+ children: [
574
+ /* @__PURE__ */ e(
575
+ "stop",
576
+ {
577
+ offset: "0%",
578
+ stopColor: y[g],
579
+ stopOpacity: M
580
+ }
581
+ ),
582
+ /* @__PURE__ */ e(
583
+ "stop",
584
+ {
585
+ offset: "100%",
586
+ stopColor: y[g],
587
+ stopOpacity: 0.05
588
+ }
589
+ )
590
+ ]
591
+ },
592
+ `grad-${g}`
593
+ )) }) : null, S = () => /* @__PURE__ */ f(Q, { children: [
594
+ /* @__PURE__ */ e(
595
+ J,
596
+ {
597
+ scale: h,
598
+ orientation: "bottom",
599
+ transform: `translate(0,${c})`,
600
+ label: w
601
+ }
602
+ ),
603
+ /* @__PURE__ */ e(J, { scale: a, orientation: "left", label: I })
604
+ ] });
605
+ if (i) {
606
+ const u = n.map((P) => P.key), g = Se().keys(u).order(Le).offset(we), D = t.map((P) => {
607
+ const O = { [r]: String(P[r]) };
608
+ for (const _ of n)
609
+ O[_.key] = Number(P[_.key]) || 0;
610
+ return O;
611
+ }), W = g(D), z = fe().curve(o).x((P, O) => s(O)).y0((P) => a(P[0])).y1((P) => a(P[1])), q = oe().curve(o).x((P, O) => s(O)).y((P) => a(P[1]));
612
+ return /* @__PURE__ */ f(Q, { children: [
613
+ G(),
614
+ C && /* @__PURE__ */ e(
615
+ le,
616
+ {
617
+ width: x,
618
+ height: c,
619
+ yScale: a,
620
+ horizontal: !0
621
+ }
622
+ ),
623
+ [...W].reverse().map((P, O) => {
624
+ const _ = W.length - 1 - O, Z = P, xe = z(Z) ?? "", be = q(Z) ?? "", Me = m ? `url(#${N}-gradient-${_})` : y[_];
625
+ return /* @__PURE__ */ f("g", { children: [
626
+ /* @__PURE__ */ e(
627
+ "path",
628
+ {
629
+ d: xe,
630
+ fill: Me,
631
+ opacity: m ? 1 : M
632
+ }
633
+ ),
634
+ /* @__PURE__ */ e(
635
+ "path",
636
+ {
637
+ d: be,
638
+ fill: "none",
639
+ stroke: y[_],
640
+ strokeWidth: v,
641
+ strokeLinejoin: "round",
642
+ strokeLinecap: "round"
643
+ }
644
+ )
645
+ ] }, n[_].key);
646
+ }),
647
+ A && d(),
648
+ S()
649
+ ] });
650
+ }
651
+ const $ = fe().curve(o).defined((u) => u != null), Y = oe().curve(o).defined((u) => u != null);
652
+ return /* @__PURE__ */ f(Q, { children: [
653
+ G(),
654
+ C && /* @__PURE__ */ e(
655
+ le,
656
+ {
657
+ width: x,
658
+ height: c,
659
+ yScale: a,
660
+ horizontal: !0
661
+ }
662
+ ),
663
+ [...n].reverse().map((u, g) => {
664
+ const D = n.length - 1 - g, W = $.x((_) => l(_)).y0(c).y1((_) => a(Number(_[u.key]) || 0)), z = Y.x((_) => l(_)).y((_) => a(Number(_[u.key]) || 0)), q = W(t) ?? "", P = z(t) ?? "", O = m ? `url(#${N}-gradient-${D})` : y[D];
665
+ return /* @__PURE__ */ f("g", { children: [
666
+ /* @__PURE__ */ e(
667
+ "path",
668
+ {
669
+ d: q,
670
+ fill: O,
671
+ opacity: m ? 1 : M
672
+ }
673
+ ),
674
+ /* @__PURE__ */ e(
675
+ "path",
676
+ {
677
+ d: P,
678
+ fill: "none",
679
+ stroke: y[D],
680
+ strokeWidth: v,
681
+ strokeLinejoin: "round",
682
+ strokeLinecap: "round"
683
+ }
684
+ )
685
+ ] }, u.key);
686
+ }),
687
+ A && d(),
688
+ S()
689
+ ] });
690
+ } }),
691
+ A && /* @__PURE__ */ e(ne, { state: V }),
692
+ B && n.length > 1 && /* @__PURE__ */ e(
693
+ te,
694
+ {
695
+ items: n.map((x, c) => ({
696
+ label: x.label,
697
+ color: y[c]
698
+ })),
699
+ className: "mt-ds-04"
700
+ }
701
+ )
702
+ ] });
703
+ }
704
+ je.displayName = "AreaChart";
705
+ function Te({
706
+ data: t,
707
+ variant: r = "pie",
708
+ innerRadius: n = 0.6,
709
+ padAngle: p = 0,
710
+ cornerRadius: i = 0,
711
+ height: M = 300,
712
+ showTooltip: m = !0,
713
+ showLegend: v = !1,
714
+ showLabels: L = !1,
715
+ animate: C = !0,
716
+ className: A,
717
+ centerLabel: B
718
+ }) {
719
+ const X = ue(null), [w, I] = ee(0), [j, V] = ee(null), { tooltip: E, show: T, hide: y } = ce();
720
+ re(), se(() => {
721
+ if (!X.current) return;
722
+ const a = new ResizeObserver((o) => {
723
+ const d = o[0];
724
+ d && I(d.contentRect.width);
725
+ });
726
+ return a.observe(X.current), () => a.disconnect();
727
+ }, []);
728
+ const x = (w > 0 ? Math.min(w, M) : M) / 2, c = r === "donut" ? x * n : 0, F = t.map((a, o) => H(a.color, o)), R = t.reduce((a, o) => a + o.value, 0), h = Xe().value((a) => a.value).padAngle(p).sort(null)(t), l = de().innerRadius(c).outerRadius(x - 2).cornerRadius(i), s = c + (x - 2 - c) * 0.7, b = de().innerRadius(s).outerRadius(s);
729
+ return /* @__PURE__ */ f("div", { ref: X, className: U("relative w-full", A), children: [
730
+ w > 0 && /* @__PURE__ */ f(Q, { children: [
731
+ /* @__PURE__ */ e(
732
+ "svg",
733
+ {
734
+ width: w,
735
+ height: M,
736
+ role: "img",
737
+ "aria-label": "Pie chart",
738
+ children: /* @__PURE__ */ f("g", { transform: `translate(${w / 2},${M / 2})`, children: [
739
+ h.map((a, o) => {
740
+ const d = l(a);
741
+ if (!d) return null;
742
+ const [G, S] = l.centroid(a), $ = Math.atan2(S, G), Y = Math.cos($) * 4, u = Math.sin($) * 4, g = j === o;
743
+ return /* @__PURE__ */ e(
744
+ "path",
745
+ {
746
+ d,
747
+ fill: F[o],
748
+ className: "cursor-pointer transition-transform",
749
+ style: {
750
+ transform: g ? `translate(${Y}px, ${u}px)` : void 0
751
+ },
752
+ onMouseEnter: () => V(o),
753
+ onMouseMove: (D) => {
754
+ var W;
755
+ if (m) {
756
+ const z = (W = D.currentTarget.closest("div")) == null ? void 0 : W.getBoundingClientRect(), q = R > 0 ? (a.data.value / R * 100).toFixed(1) : "0";
757
+ T(
758
+ D.clientX - ((z == null ? void 0 : z.left) ?? 0),
759
+ D.clientY - ((z == null ? void 0 : z.top) ?? 0),
760
+ /* @__PURE__ */ f("div", { children: [
761
+ /* @__PURE__ */ e("div", { className: "font-medium", children: a.data.label }),
762
+ /* @__PURE__ */ f("div", { children: [
763
+ a.data.value.toLocaleString(),
764
+ " (",
765
+ q,
766
+ "%)"
767
+ ] })
768
+ ] })
769
+ );
770
+ }
771
+ },
772
+ onMouseLeave: () => {
773
+ V(null), y();
774
+ }
775
+ },
776
+ `slice-${a.data.label}-${o}`
777
+ );
778
+ }),
779
+ L && h.map((a, o) => {
780
+ const [d, G] = b.centroid(a), S = R > 0 ? (a.data.value / R * 100).toFixed(0) : "0";
781
+ return R > 0 && a.data.value / R < 0.03 ? null : /* @__PURE__ */ f(
782
+ "text",
783
+ {
784
+ x: d,
785
+ y: G,
786
+ textAnchor: "middle",
787
+ dominantBaseline: "central",
788
+ className: "pointer-events-none fill-text-on-color text-ds-xs font-medium",
789
+ children: [
790
+ S,
791
+ "%"
792
+ ]
793
+ },
794
+ `label-${a.data.label}-${o}`
795
+ );
796
+ }),
797
+ r === "donut" && B && c > 0 && /* @__PURE__ */ e(
798
+ "foreignObject",
799
+ {
800
+ x: -c * 0.7,
801
+ y: -c * 0.7,
802
+ width: c * 1.4,
803
+ height: c * 1.4,
804
+ children: /* @__PURE__ */ e("div", { className: "flex h-full w-full items-center justify-center text-center text-text-primary", children: B })
805
+ }
806
+ )
807
+ ] })
808
+ }
809
+ ),
810
+ m && /* @__PURE__ */ e(ne, { state: E })
811
+ ] }),
812
+ v && /* @__PURE__ */ e(
813
+ te,
814
+ {
815
+ items: t.map((a, o) => ({
816
+ label: a.label,
817
+ color: F[o]
818
+ })),
819
+ className: "mt-ds-04"
820
+ }
821
+ )
822
+ ] });
823
+ }
824
+ Te.displayName = "PieChart";
825
+ function Ye({
826
+ data: t,
827
+ variant: r = "line",
828
+ width: n = 120,
829
+ height: p = 32,
830
+ color: i,
831
+ showLastDot: M = !1,
832
+ strokeWidth: m = 1.5,
833
+ className: v
834
+ }) {
835
+ const L = H(i, 0);
836
+ if (!t.length) return null;
837
+ const C = r === "bar" ? 1 : m, A = n - C * 2, B = p - C * 2, X = K().domain([0, Math.max(t.length - 1, 1)]).range([C, C + A]), w = Math.min(...t), I = Math.max(...t), j = w === I ? [w - 1, I + 1] : [w, I], V = K().domain(j).range([C + B, C]);
838
+ if (r === "bar") {
839
+ const c = Math.max(
840
+ 1,
841
+ (A - 1 * (t.length - 1)) / t.length
842
+ ), F = C + B;
843
+ return /* @__PURE__ */ e(
844
+ "svg",
845
+ {
846
+ width: n,
847
+ height: p,
848
+ role: "img",
849
+ "aria-label": "Sparkline bar chart",
850
+ className: U("inline-block align-middle", v),
851
+ children: t.map((R, k) => {
852
+ const h = C + k * (c + 1), l = V(R), s = Math.max(1, F - l);
853
+ return /* @__PURE__ */ e(
854
+ "rect",
855
+ {
856
+ x: h,
857
+ y: l,
858
+ width: c,
859
+ height: s,
860
+ rx: Math.min(1, c / 2),
861
+ fill: L
862
+ },
863
+ k
864
+ );
865
+ })
866
+ }
867
+ );
868
+ }
869
+ if (r === "area") {
870
+ const x = fe().curve(ae).x((l, s) => X(s)).y0(C + B).y1((l) => V(l)), c = oe().curve(ae).x((l, s) => X(s)).y((l) => V(l)), F = x(t) ?? "", R = c(t) ?? "", k = X(t.length - 1), h = V(t[t.length - 1]);
871
+ return /* @__PURE__ */ f(
872
+ "svg",
873
+ {
874
+ width: n,
875
+ height: p,
876
+ role: "img",
877
+ "aria-label": "Sparkline area chart",
878
+ className: U("inline-block align-middle", v),
879
+ children: [
880
+ /* @__PURE__ */ e("path", { d: F, fill: L, opacity: 0.2 }),
881
+ /* @__PURE__ */ e(
882
+ "path",
883
+ {
884
+ d: R,
885
+ fill: "none",
886
+ stroke: L,
887
+ strokeWidth: m,
888
+ strokeLinejoin: "round",
889
+ strokeLinecap: "round"
890
+ }
891
+ ),
892
+ M && /* @__PURE__ */ e(
893
+ "circle",
894
+ {
895
+ cx: k,
896
+ cy: h,
897
+ r: m + 1,
898
+ fill: L
899
+ }
900
+ )
901
+ ]
902
+ }
903
+ );
904
+ }
905
+ const T = oe().curve(ae).x((x, c) => X(c)).y((x) => V(x))(t) ?? "", y = X(t.length - 1), N = V(t[t.length - 1]);
906
+ return /* @__PURE__ */ f(
907
+ "svg",
908
+ {
909
+ width: n,
910
+ height: p,
911
+ role: "img",
912
+ "aria-label": "Sparkline chart",
913
+ className: U("inline-block align-middle", v),
914
+ children: [
915
+ /* @__PURE__ */ e(
916
+ "path",
917
+ {
918
+ d: T,
919
+ fill: "none",
920
+ stroke: L,
921
+ strokeWidth: m,
922
+ strokeLinejoin: "round",
923
+ strokeLinecap: "round"
924
+ }
925
+ ),
926
+ M && /* @__PURE__ */ e(
927
+ "circle",
928
+ {
929
+ cx: y,
930
+ cy: N,
931
+ r: m + 1,
932
+ fill: L
933
+ }
934
+ )
935
+ ]
936
+ }
937
+ );
938
+ }
939
+ Ye.displayName = "Sparkline";
940
+ const ie = (t) => t * Math.PI / 180;
941
+ function We({
942
+ value: t,
943
+ max: r = 100,
944
+ min: n = 0,
945
+ label: p,
946
+ valueLabel: i,
947
+ color: M,
948
+ trackColor: m = "var(--color-border-subtle)",
949
+ height: v = 200,
950
+ startAngle: L = -120,
951
+ endAngle: C = 120,
952
+ thickness: A = 16,
953
+ animate: B = !0,
954
+ className: X
955
+ }) {
956
+ const w = re(), I = Be(w, B ? 600 : 0), j = H(M, 0), V = v, E = V / 2, T = Math.min(Math.max(t, n), r), y = r === n ? 0 : (T - n) / (r - n), N = L + (C - L) * y, x = typeof i == "function" ? i(T) : typeof i == "string" ? i : String(T), c = de().innerRadius(E - A).outerRadius(E).startAngle(ie(L)).endAngle(ie(C)).cornerRadius(A / 2), F = de().innerRadius(E - A).outerRadius(E).startAngle(ie(L)).endAngle(ie(N)).cornerRadius(A / 2), R = c(null) ?? "", k = F(null) ?? "";
957
+ return /* @__PURE__ */ e(
958
+ "div",
959
+ {
960
+ className: U("inline-flex flex-col items-center", X),
961
+ role: "meter",
962
+ "aria-valuenow": T,
963
+ "aria-valuemin": n,
964
+ "aria-valuemax": r,
965
+ "aria-label": p ?? "Gauge chart",
966
+ children: /* @__PURE__ */ e("svg", { width: V, height: V, role: "img", "aria-hidden": "true", children: /* @__PURE__ */ f("g", { transform: `translate(${E},${E})`, children: [
967
+ /* @__PURE__ */ e("path", { d: R, fill: m }),
968
+ /* @__PURE__ */ e(
969
+ "path",
970
+ {
971
+ d: k,
972
+ fill: j,
973
+ style: I > 0 ? { transition: `d ${I}ms ease-out` } : void 0
974
+ }
975
+ ),
976
+ /* @__PURE__ */ e(
977
+ "text",
978
+ {
979
+ x: 0,
980
+ y: p ? -4 : 0,
981
+ textAnchor: "middle",
982
+ dominantBaseline: "central",
983
+ className: "fill-text-primary text-ds-2xl font-semibold",
984
+ children: x
985
+ }
986
+ ),
987
+ p && /* @__PURE__ */ e(
988
+ "text",
989
+ {
990
+ x: 0,
991
+ y: 20,
992
+ textAnchor: "middle",
993
+ dominantBaseline: "central",
994
+ className: "fill-text-secondary text-ds-xs",
995
+ children: p
996
+ }
997
+ )
998
+ ] }) })
999
+ }
1000
+ );
1001
+ }
1002
+ We.displayName = "GaugeChart";
1003
+ function Oe({
1004
+ data: t,
1005
+ axes: r,
1006
+ series: n,
1007
+ maxValue: p,
1008
+ levels: i = 5,
1009
+ fillOpacity: M = 0.25,
1010
+ showDots: m = !1,
1011
+ height: v = 300,
1012
+ showTooltip: L = !0,
1013
+ showLegend: C = !1,
1014
+ animate: A = !0,
1015
+ className: B
1016
+ }) {
1017
+ const X = ue(null), [w, I] = ee(0), { tooltip: j, show: V, hide: E } = ce();
1018
+ re(), se(() => {
1019
+ if (!X.current) return;
1020
+ const h = new ResizeObserver((l) => {
1021
+ const s = l[0];
1022
+ s && I(s.contentRect.width);
1023
+ });
1024
+ return h.observe(X.current), () => h.disconnect();
1025
+ }, []);
1026
+ const y = (w > 0 ? Math.min(w, v) : v) / 2 - 40, N = n.map((h, l) => H(h.color, l)), x = p ?? Math.max(
1027
+ ...t.flatMap((h) => n.map((l) => Number(h[l.key]) || 0)),
1028
+ 1
1029
+ ), c = 2 * Math.PI / r.length, F = De().radius((h) => y * h / x).angle((h, l) => l * c).curve(Pe), R = (h) => r.map((l, s) => {
1030
+ var b;
1031
+ return Number((b = t[s]) == null ? void 0 : b[h]) || 0;
1032
+ }), k = (h, l) => {
1033
+ const s = c * h - Math.PI / 2, b = y * l / x;
1034
+ return {
1035
+ x: b * Math.cos(s),
1036
+ y: b * Math.sin(s)
1037
+ };
1038
+ };
1039
+ return /* @__PURE__ */ f("div", { ref: X, className: U("relative w-full", B), children: [
1040
+ w > 0 && /* @__PURE__ */ f(Q, { children: [
1041
+ /* @__PURE__ */ e(
1042
+ "svg",
1043
+ {
1044
+ width: w,
1045
+ height: v,
1046
+ role: "img",
1047
+ "aria-label": "Radar chart",
1048
+ children: /* @__PURE__ */ f("g", { transform: `translate(${w / 2},${v / 2})`, children: [
1049
+ Array.from({ length: i }, (h, l) => {
1050
+ const s = y / i * (l + 1), b = r.map((a, o) => {
1051
+ const d = c * o - Math.PI / 2;
1052
+ return `${s * Math.cos(d)},${s * Math.sin(d)}`;
1053
+ }).join(" ");
1054
+ return /* @__PURE__ */ e(
1055
+ "polygon",
1056
+ {
1057
+ points: b,
1058
+ fill: "none",
1059
+ stroke: "var(--color-border-subtle)",
1060
+ strokeDasharray: "3,3",
1061
+ strokeWidth: 1
1062
+ },
1063
+ `grid-${l}`
1064
+ );
1065
+ }),
1066
+ r.map((h, l) => {
1067
+ const s = c * l - Math.PI / 2, b = y * Math.cos(s), a = y * Math.sin(s);
1068
+ return /* @__PURE__ */ e(
1069
+ "line",
1070
+ {
1071
+ x1: 0,
1072
+ y1: 0,
1073
+ x2: b,
1074
+ y2: a,
1075
+ stroke: "var(--color-border-subtle)",
1076
+ strokeWidth: 1
1077
+ },
1078
+ `axis-${l}`
1079
+ );
1080
+ }),
1081
+ r.map((h, l) => {
1082
+ const s = c * l - Math.PI / 2, b = y + 18, a = b * Math.cos(s), o = b * Math.sin(s);
1083
+ let d = "middle";
1084
+ return Math.abs(Math.cos(s)) > 0.1 && (d = Math.cos(s) > 0 ? "start" : "end"), /* @__PURE__ */ e(
1085
+ "text",
1086
+ {
1087
+ x: a,
1088
+ y: o,
1089
+ textAnchor: d,
1090
+ dominantBaseline: "central",
1091
+ className: "fill-text-secondary text-ds-xs",
1092
+ children: h
1093
+ },
1094
+ `label-${l}`
1095
+ );
1096
+ }),
1097
+ Array.from({ length: i }, (h, l) => {
1098
+ const s = Math.round(x / i * (l + 1)), b = y / i * (l + 1), a = -Math.PI / 2, o = b * Math.cos(a) + 4, d = b * Math.sin(a);
1099
+ return /* @__PURE__ */ e(
1100
+ "text",
1101
+ {
1102
+ x: o,
1103
+ y: d,
1104
+ textAnchor: "start",
1105
+ dominantBaseline: "auto",
1106
+ className: "fill-text-tertiary text-ds-xs",
1107
+ children: s
1108
+ },
1109
+ `level-label-${l}`
1110
+ );
1111
+ }),
1112
+ n.map((h, l) => {
1113
+ const s = R(h.key), b = F(s);
1114
+ return b ? /* @__PURE__ */ f("g", { children: [
1115
+ /* @__PURE__ */ e(
1116
+ "path",
1117
+ {
1118
+ d: b,
1119
+ fill: N[l],
1120
+ fillOpacity: M,
1121
+ stroke: N[l],
1122
+ strokeWidth: 2,
1123
+ strokeLinejoin: "round"
1124
+ }
1125
+ ),
1126
+ m && s.map((a, o) => {
1127
+ const { x: d, y: G } = k(o, a);
1128
+ return /* @__PURE__ */ e(
1129
+ "circle",
1130
+ {
1131
+ cx: d,
1132
+ cy: G,
1133
+ r: 4,
1134
+ fill: N[l],
1135
+ stroke: "var(--color-layer-01)",
1136
+ strokeWidth: 2,
1137
+ className: "transition-opacity"
1138
+ },
1139
+ `dot-${h.key}-${o}`
1140
+ );
1141
+ })
1142
+ ] }, h.key) : null;
1143
+ }),
1144
+ L && r.map((h, l) => {
1145
+ const s = c * l - Math.PI / 2, b = y * Math.cos(s), a = y * Math.sin(s);
1146
+ return /* @__PURE__ */ e(
1147
+ "circle",
1148
+ {
1149
+ cx: b,
1150
+ cy: a,
1151
+ r: 16,
1152
+ fill: "transparent",
1153
+ className: "cursor-pointer",
1154
+ onMouseMove: (o) => {
1155
+ var G;
1156
+ const d = (G = o.currentTarget.closest("div")) == null ? void 0 : G.getBoundingClientRect();
1157
+ V(
1158
+ o.clientX - ((d == null ? void 0 : d.left) ?? 0),
1159
+ o.clientY - ((d == null ? void 0 : d.top) ?? 0),
1160
+ /* @__PURE__ */ f("div", { children: [
1161
+ /* @__PURE__ */ e("div", { className: "font-medium", children: h }),
1162
+ n.map((S, $) => {
1163
+ var u;
1164
+ const Y = Number((u = t[l]) == null ? void 0 : u[S.key]) || 0;
1165
+ return /* @__PURE__ */ f(
1166
+ "div",
1167
+ {
1168
+ className: "flex items-center gap-ds-02",
1169
+ children: [
1170
+ /* @__PURE__ */ e(
1171
+ "span",
1172
+ {
1173
+ className: "inline-block h-2 w-2 rounded-ds-full",
1174
+ style: { backgroundColor: N[$] }
1175
+ }
1176
+ ),
1177
+ /* @__PURE__ */ f("span", { className: "text-text-secondary", children: [
1178
+ S.label,
1179
+ ":"
1180
+ ] }),
1181
+ " ",
1182
+ Y.toLocaleString()
1183
+ ]
1184
+ },
1185
+ S.key
1186
+ );
1187
+ })
1188
+ ] })
1189
+ );
1190
+ },
1191
+ onMouseLeave: E
1192
+ },
1193
+ `hover-${l}`
1194
+ );
1195
+ })
1196
+ ] })
1197
+ }
1198
+ ),
1199
+ L && /* @__PURE__ */ e(ne, { state: j })
1200
+ ] }),
1201
+ C && /* @__PURE__ */ e(
1202
+ te,
1203
+ {
1204
+ items: n.map((h, l) => ({
1205
+ label: h.label,
1206
+ color: N[l]
1207
+ })),
1208
+ className: "mt-ds-04"
1209
+ }
1210
+ )
1211
+ ] });
1212
+ }
1213
+ Oe.displayName = "RadarChart";
11
1214
  export {
12
- x as AreaChart,
13
- a as BarChart,
14
- e as ChartContainer,
15
- g as GaugeChart,
16
- u as Legend,
17
- f as LineChart,
18
- h as PieChart,
19
- k as RadarChart,
20
- i as Sparkline
1215
+ je as AreaChart,
1216
+ Ve as BarChart,
1217
+ me as ChartContainer,
1218
+ We as GaugeChart,
1219
+ te as Legend,
1220
+ _e as LineChart,
1221
+ Te as PieChart,
1222
+ Oe as RadarChart,
1223
+ Ye as Sparkline
21
1224
  };