@cloudflare/kumo 2.2.0 → 2.2.1

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 (85) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/ai/component-registry.json +3 -6
  3. package/ai/component-registry.md +1 -1
  4. package/dist/.build-complete +1 -1
  5. package/dist/chunks/SankeyChart-dkq90770ad7hgzx3.js +635 -0
  6. package/dist/chunks/{SankeyChart-h1kzhs1tyt20luha.js.map → SankeyChart-dkq90770ad7hgzx3.js.map} +1 -1
  7. package/dist/chunks/{autocomplete-nw1ig02pawtj3il9.js → autocomplete-mhrvtq4y5n21vr0t.js} +3 -3
  8. package/dist/chunks/{autocomplete-nw1ig02pawtj3il9.js.map → autocomplete-mhrvtq4y5n21vr0t.js.map} +1 -1
  9. package/dist/chunks/banner-ip2lm8r87hich557.js +88 -0
  10. package/dist/chunks/banner-ip2lm8r87hich557.js.map +1 -0
  11. package/dist/chunks/{breadcrumbs-f7bi3g8tx6dfcgl6.js → breadcrumbs-ohstavaqvycoremm.js} +2 -2
  12. package/dist/chunks/{breadcrumbs-f7bi3g8tx6dfcgl6.js.map → breadcrumbs-ohstavaqvycoremm.js.map} +1 -1
  13. package/dist/chunks/{button-gflkhovvkmt0ftzz.js → button-oevxukl0zmwoq4tb.js} +2 -2
  14. package/dist/chunks/{button-gflkhovvkmt0ftzz.js.map → button-oevxukl0zmwoq4tb.js.map} +1 -1
  15. package/dist/chunks/{checkbox-imuc4c45j7sds6wk.js → checkbox-h6vkv17lnq854z2c.js} +2 -2
  16. package/dist/chunks/{checkbox-imuc4c45j7sds6wk.js.map → checkbox-h6vkv17lnq854z2c.js.map} +1 -1
  17. package/dist/chunks/{clipboard-text-dp5eb2c2qudgusnc.js → clipboard-text-kyy71jmx7umdh8k8.js} +3 -3
  18. package/dist/chunks/{clipboard-text-dp5eb2c2qudgusnc.js.map → clipboard-text-kyy71jmx7umdh8k8.js.map} +1 -1
  19. package/dist/chunks/{combobox-42i2nyvfgkqjb5a4.js → combobox-g3cudlfajecou4va.js} +3 -3
  20. package/dist/chunks/{combobox-42i2nyvfgkqjb5a4.js.map → combobox-g3cudlfajecou4va.js.map} +1 -1
  21. package/dist/chunks/{empty-jwan4d5hqjocakhm.js → empty-n3r7xutkb9sxjaso.js} +2 -2
  22. package/dist/chunks/{empty-jwan4d5hqjocakhm.js.map → empty-n3r7xutkb9sxjaso.js.map} +1 -1
  23. package/dist/chunks/{field-yhlyu6fy0qi1ewtl.js → field-l1oapopp6kjnephi.js} +2 -2
  24. package/dist/chunks/{field-yhlyu6fy0qi1ewtl.js.map → field-l1oapopp6kjnephi.js.map} +1 -1
  25. package/dist/chunks/{input-area-d85jzxlnvx7mc3x9.js → input-area-gudamx1ruz8rxiw2.js} +3 -3
  26. package/dist/chunks/{input-area-d85jzxlnvx7mc3x9.js.map → input-area-gudamx1ruz8rxiw2.js.map} +1 -1
  27. package/dist/chunks/{input-group-mu8yklweljytpt04.js → input-group-gy08vju7eoogil8k.js} +5 -5
  28. package/dist/chunks/{input-group-mu8yklweljytpt04.js.map → input-group-gy08vju7eoogil8k.js.map} +1 -1
  29. package/dist/chunks/{input-cyils8jxj8e0udr7.js → input-i3os21puacqw4r75.js} +2 -2
  30. package/dist/chunks/{input-cyils8jxj8e0udr7.js.map → input-i3os21puacqw4r75.js.map} +1 -1
  31. package/dist/chunks/{label-kaz4uxdt1yf3i5x5.js → label-i0bj94d43irz0k1x.js} +3 -3
  32. package/dist/chunks/{label-kaz4uxdt1yf3i5x5.js.map → label-i0bj94d43irz0k1x.js.map} +1 -1
  33. package/dist/chunks/{menubar-gk322oew1y1lr851.js → menubar-jalggrag4utvdpey.js} +2 -2
  34. package/dist/chunks/{menubar-gk322oew1y1lr851.js.map → menubar-jalggrag4utvdpey.js.map} +1 -1
  35. package/dist/chunks/{pagination-kswioh2znglyq7as.js → pagination-ceetno8sc1rd0wr2.js} +3 -3
  36. package/dist/chunks/{pagination-kswioh2znglyq7as.js.map → pagination-ceetno8sc1rd0wr2.js.map} +1 -1
  37. package/dist/chunks/{select-hz8wwd2msvp1u0jp.js → select-g1xvti1k1hj7xe5t.js} +5 -5
  38. package/dist/chunks/{select-hz8wwd2msvp1u0jp.js.map → select-g1xvti1k1hj7xe5t.js.map} +1 -1
  39. package/dist/chunks/{sensitive-input-mdtjukbb3wimz1iy.js → sensitive-input-hokm527ollnz9dqc.js} +3 -3
  40. package/dist/chunks/{sensitive-input-mdtjukbb3wimz1iy.js.map → sensitive-input-hokm527ollnz9dqc.js.map} +1 -1
  41. package/dist/chunks/{sidebar-dlh79t5uliezwniq.js → sidebar-oan40ylmqkyui21w.js} +2 -2
  42. package/dist/chunks/{sidebar-dlh79t5uliezwniq.js.map → sidebar-oan40ylmqkyui21w.js.map} +1 -1
  43. package/dist/chunks/{switch-luut1d75u179g7x6.js → switch-fv0ttj24uhocvuh8.js} +2 -2
  44. package/dist/chunks/{switch-luut1d75u179g7x6.js.map → switch-fv0ttj24uhocvuh8.js.map} +1 -1
  45. package/dist/chunks/{table-ef63hg1r1zia9u9j.js → table-nsfcgpo93gfetrhh.js} +2 -2
  46. package/dist/chunks/{table-ef63hg1r1zia9u9j.js.map → table-nsfcgpo93gfetrhh.js.map} +1 -1
  47. package/dist/chunks/{toast-e5id2hx8pv0x3vue.js → toast-ofqlfmddcyka091n.js} +2 -2
  48. package/dist/chunks/{toast-e5id2hx8pv0x3vue.js.map → toast-ofqlfmddcyka091n.js.map} +1 -1
  49. package/dist/chunks/{tooltip-caka3fmn1ogdc7q8.js → tooltip-icvb67awe1zolz61.js} +6 -6
  50. package/dist/chunks/tooltip-icvb67awe1zolz61.js.map +1 -0
  51. package/dist/code.js +1 -1
  52. package/dist/components/autocomplete.js +1 -1
  53. package/dist/components/banner.js +1 -1
  54. package/dist/components/breadcrumbs.js +1 -1
  55. package/dist/components/button.js +1 -1
  56. package/dist/components/chart.js +1 -1
  57. package/dist/components/checkbox.js +1 -1
  58. package/dist/components/clipboard-text.js +1 -1
  59. package/dist/components/combobox.js +1 -1
  60. package/dist/components/empty.js +1 -1
  61. package/dist/components/field.js +1 -1
  62. package/dist/components/input-group.js +1 -1
  63. package/dist/components/input.js +3 -3
  64. package/dist/components/label.js +1 -1
  65. package/dist/components/menubar.js +1 -1
  66. package/dist/components/pagination.js +1 -1
  67. package/dist/components/select.js +1 -1
  68. package/dist/components/sensitive-input.js +1 -1
  69. package/dist/components/sidebar.js +1 -1
  70. package/dist/components/switch.js +1 -1
  71. package/dist/components/table.js +1 -1
  72. package/dist/components/toast.js +1 -1
  73. package/dist/components/tooltip.js +1 -1
  74. package/dist/index.js +26 -26
  75. package/dist/src/components/banner/banner.d.ts +3 -3
  76. package/dist/src/components/banner/banner.d.ts.map +1 -1
  77. package/dist/src/components/chart/SankeyChart.d.ts +5 -1
  78. package/dist/src/components/chart/SankeyChart.d.ts.map +1 -1
  79. package/dist/src/components/tooltip/tooltip.d.ts.map +1 -1
  80. package/dist/styles/kumo-standalone.css +1 -1
  81. package/package.json +1 -1
  82. package/dist/chunks/SankeyChart-h1kzhs1tyt20luha.js +0 -629
  83. package/dist/chunks/banner-eux4y8xaogjg64af.js +0 -80
  84. package/dist/chunks/banner-eux4y8xaogjg64af.js.map +0 -1
  85. package/dist/chunks/tooltip-caka3fmn1ogdc7q8.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @cloudflare/kumo
2
2
 
3
+ ## 2.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 57bbe62: fix(banner): remove variant selection background for legibility
8
+
9
+ Selected text inside `Banner` now uses the browser default selection color
10
+ instead of a same-hue variant-tinted background. The previous
11
+ `selection:bg-kumo-{info,warning,danger}` utilities produced low contrast
12
+ between the selection background and the variant text color (most notably
13
+ in light mode for the `error` and `alert` variants), making selected text
14
+ hard to read.
15
+
16
+ - 3d80fe7: Add `left` and `right` props to SankeyChart for controlling series layout padding
17
+ - 194aea8: Fix tooltip popup exit transitions by animating the Tailwind `scale` property alongside opacity.
18
+
3
19
  ## 2.2.0
4
20
 
5
21
  ### Minor Changes
@@ -331,9 +331,9 @@
331
331
  "error": "Error banner for critical issues"
332
332
  },
333
333
  "classes": {
334
- "default": "bg-kumo-info-tint/30 border-kumo-info/50 text-kumo-info selection:bg-kumo-info",
335
- "alert": "bg-kumo-warning-tint/15 border-kumo-warning/50 text-kumo-warning selection:bg-kumo-warning",
336
- "error": "bg-kumo-danger-tint/15 border-kumo-danger/50 text-kumo-danger selection:bg-kumo-danger"
334
+ "default": "bg-kumo-info-tint/30 border-kumo-info/50 text-kumo-info",
335
+ "alert": "bg-kumo-warning-tint/15 border-kumo-warning/50 text-kumo-warning",
336
+ "error": "bg-kumo-danger-tint/15 border-kumo-danger/50 text-kumo-danger"
337
337
  },
338
338
  "default": "default"
339
339
  },
@@ -356,11 +356,8 @@
356
356
  "<Banner icon={<Info />}>This is a simple banner using children.</Banner>"
357
357
  ],
358
358
  "colors": [
359
- "bg-kumo-danger",
360
359
  "bg-kumo-danger-tint",
361
- "bg-kumo-info",
362
360
  "bg-kumo-info-tint",
363
- "bg-kumo-warning",
364
361
  "bg-kumo-warning-tint",
365
362
  "border-kumo-danger",
366
363
  "border-kumo-info",
@@ -371,7 +371,7 @@ Full-width message bar for informational, warning, or error notices. Supports st
371
371
 
372
372
  **Colors (kumo tokens used):**
373
373
 
374
- `bg-kumo-danger`, `bg-kumo-danger-tint`, `bg-kumo-info`, `bg-kumo-info-tint`, `bg-kumo-warning`, `bg-kumo-warning-tint`, `border-kumo-danger`, `border-kumo-info`, `border-kumo-warning`, `text-kumo-danger`, `text-kumo-info`, `text-kumo-warning`
374
+ `bg-kumo-danger-tint`, `bg-kumo-info-tint`, `bg-kumo-warning-tint`, `border-kumo-danger`, `border-kumo-info`, `border-kumo-warning`, `text-kumo-danger`, `text-kumo-info`, `text-kumo-warning`
375
375
 
376
376
  **Examples:**
377
377
 
@@ -1 +1 @@
1
- 1778770740533
1
+ 1778851251288
@@ -0,0 +1,635 @@
1
+ "use client";
2
+ import { jsx as N, jsxs as z } from "react/jsx-runtime";
3
+ import { forwardRef as re, useRef as H, useEffect as M, useMemo as P, useCallback as se } from "react";
4
+ import { c as T } from "./cn-ct4n7r74mh8y0f48.js";
5
+ var te = /* @__PURE__ */ ((e) => (e.Attention = "#FC574A", e.Warning = "#F8A054", e.Success = "#00A63E", e.Neutral = "#B9D6FF", e.Disabled = "#CBCBCB", e.Skeleton = "#DDDDDD", e))(te || {}), ne = /* @__PURE__ */ ((e) => (e.Attention = "#FC574A", e.Warning = "#F8A054", e.Success = "#00A63E", e.Neutral = "#8EC5FF", e.Disabled = "#878787", e.Skeleton = "#5C5C5C", e))(ne || {});
6
+ const oe = {
7
+ blues: ["#E1EAF4", "#8EBCF6", "#4290F0", "#0E58B4", "#03254F"]
8
+ }, ae = {
9
+ blues: ["#03254F", "#0E58B4", "#4290F0", "#A6BFDD", "#E1EAF4"]
10
+ }, K = [
11
+ "#4290F0",
12
+ "#F5B647",
13
+ "#E8649D",
14
+ "#8D58EE",
15
+ "#50C3B6",
16
+ "#D37536"
17
+ /* Orange */
18
+ ], Y = [
19
+ "#4290F0",
20
+ "#EEB720",
21
+ "#E8649D",
22
+ "#8D58EE",
23
+ "#50C3B6",
24
+ "#D37536"
25
+ /* Orange */
26
+ ];
27
+ var j;
28
+ ((e) => {
29
+ function t(s, d = !1) {
30
+ return d ? ne[s] : te[s];
31
+ }
32
+ e.semantic = t;
33
+ function a(s, d = !1) {
34
+ return d ? Y[s % Y.length] : K[s % K.length];
35
+ }
36
+ e.categorical = a;
37
+ function l(s, d = !1) {
38
+ return d ? [...ae[s]] : [...oe[s]];
39
+ }
40
+ e.sequential = l;
41
+ function r(s, d = !1) {
42
+ const b = {
43
+ light: { primary: "#6B7280", secondary: "#9CA3AF" },
44
+ dark: { primary: "#9CA3AF", secondary: "#6B7280" }
45
+ };
46
+ return d ? b.dark[s] : b.light[s];
47
+ }
48
+ e.text = r;
49
+ })(j || (j = {}));
50
+ const Q = (e) => {
51
+ const { dangerousHtmlFormatter: t, ...a } = e;
52
+ return {
53
+ ...a,
54
+ formatter: t
55
+ };
56
+ }, ce = (e) => e.tooltip ? {
57
+ ...e,
58
+ tooltip: Array.isArray(e.tooltip) ? e.tooltip.map(Q) : Q(e.tooltip)
59
+ } : e, J = re(function({
60
+ echarts: t,
61
+ options: a,
62
+ optionUpdateBehavior: l,
63
+ className: r,
64
+ isDarkMode: s,
65
+ height: d = 350,
66
+ onEvents: b
67
+ }, g) {
68
+ const p = H(null), S = H(null), A = H({}), E = H({}), F = H(/* @__PURE__ */ new Set());
69
+ return M(() => {
70
+ if (!p.current) return;
71
+ const f = t.init(
72
+ p.current,
73
+ s ? "dark" : {
74
+ color: s ? Y : K
75
+ }
76
+ );
77
+ return S.current = f, typeof g == "function" ? g(f) : g && (g.current = f), () => {
78
+ for (const x of F.current) {
79
+ const o = E.current[x];
80
+ o && f.off(x, o);
81
+ }
82
+ F.current.clear(), typeof g == "function" ? g(null) : g && (g.current = null), S.current = null, f.dispose();
83
+ };
84
+ }, [p, s]), M(() => {
85
+ const f = S.current;
86
+ f && f.setOption(ce(a), {
87
+ notMerge: !1,
88
+ lazyUpdate: !0,
89
+ ...l
90
+ });
91
+ }, [s, l, a]), M(() => {
92
+ A.current = b ?? {};
93
+ }, [b]), M(() => {
94
+ const f = S.current;
95
+ if (!f) return;
96
+ const x = /* @__PURE__ */ new Set();
97
+ for (const [o, v] of Object.entries(b ?? {}))
98
+ typeof v == "function" && (x.add(o), E.current[o] || (E.current[o] = (L) => {
99
+ A.current[o]?.(L);
100
+ }), F.current.has(o) || f.on(o, E.current[o]));
101
+ for (const o of F.current) {
102
+ if (x.has(o)) continue;
103
+ const v = E.current[o];
104
+ v && f.off(o, v);
105
+ }
106
+ F.current = x;
107
+ }, [t, s, b]), M(() => {
108
+ const f = S.current, x = p.current;
109
+ if (!f || !x) return;
110
+ let o = !0;
111
+ const v = new ResizeObserver(() => {
112
+ if (o) {
113
+ o = !1;
114
+ return;
115
+ }
116
+ f.resize();
117
+ });
118
+ return v.observe(x), () => v.disconnect();
119
+ }, []), /* @__PURE__ */ N(
120
+ "div",
121
+ {
122
+ ref: p,
123
+ className: T("w-full", r),
124
+ style: { height: d },
125
+ tabIndex: a.aria?.enabled ? 0 : void 0,
126
+ role: a.aria?.enabled ? "img" : void 0
127
+ }
128
+ );
129
+ });
130
+ J.displayName = "Chart";
131
+ function ye({
132
+ echarts: e,
133
+ type: t = "line",
134
+ data: a,
135
+ xAxisName: l,
136
+ xAxisTickCount: r,
137
+ xAxisTickFormat: s,
138
+ yAxisTickFormat: d,
139
+ yAxisTickLabelFormat: b,
140
+ yAxisName: g,
141
+ yAxisTickCount: p,
142
+ tooltipValueFormat: S,
143
+ onTimeRangeChange: A,
144
+ height: E = 350,
145
+ incomplete: F,
146
+ isDarkMode: f,
147
+ gradient: x,
148
+ loading: o,
149
+ ariaDescription: v,
150
+ optionUpdateBehavior: L
151
+ }) {
152
+ const O = H(null), R = F?.before, C = F?.after, k = P(() => {
153
+ const i = [], B = t === "bar" ? { type: "bar", stack: "total" } : { type: "line", showSymbol: !1 };
154
+ for (const c of a) {
155
+ const $ = R && t === "line" ? c.data.filter((w) => w[0] <= R) : [], n = C && t === "line" ? c.data.filter((w) => w[0] >= C) : [], u = $.length > 0 || n.length > 0 ? c.data.slice(
156
+ Math.max(0, $.length - 1),
157
+ Math.max(0, c.data.length - n.length + 1)
158
+ ) : c.data, m = x && t === "line" ? {
159
+ color: new e.graphic.LinearGradient(0, 0, 0, 1, [
160
+ { offset: 0, color: Z(c.color, 0.4) },
161
+ { offset: 1, color: Z(c.color, 0) }
162
+ ])
163
+ } : void 0;
164
+ i.push({
165
+ data: u,
166
+ color: c.color,
167
+ name: c.name,
168
+ emphasis: { focus: "series" },
169
+ ...m ? { areaStyle: m } : {},
170
+ ...B
171
+ });
172
+ const y = {
173
+ color: c.color,
174
+ name: c.name,
175
+ type: "line",
176
+ lineStyle: { type: "dashed" },
177
+ showSymbol: !1,
178
+ emphasis: { focus: "series" }
179
+ };
180
+ $.length > 0 && i.push({
181
+ ...y,
182
+ data: $
183
+ }), n.length > 0 && i.push({
184
+ ...y,
185
+ data: n
186
+ });
187
+ }
188
+ return {
189
+ aria: {
190
+ enabled: !0,
191
+ ...v && { label: { description: v } }
192
+ },
193
+ brush: {
194
+ xAxisIndex: "all",
195
+ brushType: "lineX",
196
+ brushMode: "single",
197
+ outOfBrush: {
198
+ colorAlpha: 0.3
199
+ },
200
+ brushStyle: {
201
+ borderWidth: 1,
202
+ color: "rgba(120,140,180,0.3)",
203
+ borderColor: "rgba(120,140,180,0.8)"
204
+ }
205
+ },
206
+ tooltip: {
207
+ trigger: "axis",
208
+ appendTo: "body",
209
+ axisPointer: { type: "shadow" },
210
+ dangerousHtmlFormatter: (c) => {
211
+ const $ = Array.isArray(c) ? c : [c], n = /* @__PURE__ */ new Set(), u = $.filter((I) => n.has(I.seriesName) ? !1 : (n.add(I.seriesName), !0)), m = u[0], y = m?.value?.[0] ?? m?.axisValue, w = y != null ? `<div style="font-weight:600;margin-bottom:4px;">${e.format.encodeHTML(ie(y))}</div>` : "", V = u.map((I) => {
212
+ const G = I?.value?.[1], W = S ?? b, U = W ? e.format.encodeHTML(String(W(G))) : e.format.encodeHTML(String(G));
213
+ return `${I.marker} ${e.format.encodeHTML(I.seriesName)}: <strong>${U}</strong>`;
214
+ }).join("<br/>");
215
+ return `${w}${V}`;
216
+ }
217
+ },
218
+ backgroundColor: "transparent",
219
+ toolbox: { show: !1 },
220
+ xAxis: {
221
+ name: l,
222
+ nameLocation: "middle",
223
+ nameGap: 30,
224
+ type: "time",
225
+ splitLine: {
226
+ show: !1
227
+ },
228
+ axisLine: { show: !1 },
229
+ splitNumber: r ?? 5,
230
+ ...s && {
231
+ axisLabel: {
232
+ formatter: (c) => s(c)
233
+ }
234
+ }
235
+ },
236
+ yAxis: {
237
+ name: g,
238
+ nameLocation: "middle",
239
+ nameGap: 40,
240
+ type: "value",
241
+ axisTick: { show: !0 },
242
+ axisLabel: {
243
+ margin: 15,
244
+ ...d && {
245
+ formatter: (c) => d(c)
246
+ }
247
+ },
248
+ splitLine: {
249
+ show: !0,
250
+ lineStyle: { type: "dashed", width: 1 }
251
+ },
252
+ splitNumber: p
253
+ },
254
+ grid: {
255
+ left: g ? 30 : 24,
256
+ right: 24,
257
+ top: 24,
258
+ bottom: l ? 30 : 24
259
+ },
260
+ series: i
261
+ };
262
+ }, [
263
+ a,
264
+ l,
265
+ r,
266
+ s,
267
+ d,
268
+ b,
269
+ g,
270
+ p,
271
+ S,
272
+ R,
273
+ C,
274
+ t,
275
+ x,
276
+ e,
277
+ v
278
+ ]), _ = P(() => A ? {
279
+ brushend: (i) => {
280
+ const B = i.areas[0].coordRange;
281
+ A(B[0], B[1]), O.current?.dispatchAction({ type: "brush", areas: [] });
282
+ }
283
+ } : {}, [A]), h = !!A;
284
+ return M(() => {
285
+ const i = O.current;
286
+ if (i && h)
287
+ return i.dispatchAction({
288
+ type: "takeGlobalCursor",
289
+ key: "brush",
290
+ brushOption: {
291
+ brushType: "lineX",
292
+ brushMode: "single"
293
+ }
294
+ }), () => {
295
+ i.dispatchAction({
296
+ type: "takeGlobalCursor",
297
+ key: "brush",
298
+ brushOption: {
299
+ brushType: !1
300
+ }
301
+ });
302
+ };
303
+ }, [O, h, o]), /* @__PURE__ */ z("div", { className: "relative w-full", style: { height: E }, children: [
304
+ o && /* @__PURE__ */ N(le, { height: E, isDarkMode: f }),
305
+ !o && /* @__PURE__ */ N(
306
+ J,
307
+ {
308
+ echarts: e,
309
+ ref: O,
310
+ options: k,
311
+ height: E,
312
+ isDarkMode: f,
313
+ onEvents: _,
314
+ optionUpdateBehavior: L
315
+ }
316
+ )
317
+ ] });
318
+ }
319
+ function le({
320
+ height: e,
321
+ isDarkMode: t
322
+ }) {
323
+ const a = e / 2, l = Math.min(e * 0.12, 28), r = 400, s = 120, d = [];
324
+ for (let p = 0; p <= s; p++) {
325
+ const S = -r + p / s * r * 3, A = a + Math.sin(p / s * 2 * Math.PI * 3) * l;
326
+ d.push(`${p === 0 ? "M" : "L"}${S.toFixed(2)},${A.toFixed(2)}`);
327
+ }
328
+ const b = d.join(" "), g = t ? "rgba(255,255,255,0.5)" : "rgba(0,0,0,0.2)";
329
+ return /* @__PURE__ */ N(
330
+ "div",
331
+ {
332
+ "aria-hidden": "true",
333
+ className: "absolute inset-0 overflow-hidden",
334
+ style: { height: e },
335
+ children: /* @__PURE__ */ N(
336
+ "svg",
337
+ {
338
+ width: "100%",
339
+ height: e,
340
+ viewBox: `0 0 ${r} ${e}`,
341
+ preserveAspectRatio: "none",
342
+ className: "w-full animate-pulse",
343
+ children: /* @__PURE__ */ N(
344
+ "path",
345
+ {
346
+ d: b,
347
+ fill: "none",
348
+ stroke: g,
349
+ strokeWidth: "2",
350
+ style: {
351
+ animation: "kumo-chart-wave 2.4s linear infinite",
352
+ transformOrigin: "0 0"
353
+ }
354
+ }
355
+ )
356
+ }
357
+ )
358
+ }
359
+ );
360
+ }
361
+ function Z(e, t) {
362
+ const a = Math.max(0, Math.min(1, t)), l = e.match(
363
+ /rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i
364
+ );
365
+ if (l)
366
+ return `rgba(${l[1]}, ${l[2]}, ${l[3]}, ${a})`;
367
+ let r = e.replace(/^#/, "");
368
+ r.length === 3 && (r = r[0] + r[0] + r[1] + r[1] + r[2] + r[2]), r.length === 8 && (r = r.slice(0, 6));
369
+ const s = parseInt(r.slice(0, 2), 16), d = parseInt(r.slice(2, 4), 16), b = parseInt(r.slice(4, 6), 16);
370
+ return `rgba(${s}, ${d}, ${b}, ${a})`;
371
+ }
372
+ function D(e) {
373
+ return e.toString().padStart(2, "0");
374
+ }
375
+ function ie(e) {
376
+ const t = new Date(e);
377
+ return `${t.getFullYear()}-${D(t.getMonth() + 1)}-${D(t.getDate())} ${D(t.getHours())}:${D(t.getMinutes())}:${D(t.getSeconds())}`;
378
+ }
379
+ function ue({ color: e, value: t, name: a, unit: l, inactive: r }) {
380
+ return /* @__PURE__ */ z("div", { className: "inline-flex flex-col gap-2 min-w-42 py-2", children: [
381
+ /* @__PURE__ */ z("div", { className: "flex items-center gap-2", children: [
382
+ /* @__PURE__ */ N(
383
+ "span",
384
+ {
385
+ className: T("size-2 rounded-full inline-block", {
386
+ "opacity-50": r
387
+ }),
388
+ style: { backgroundColor: e }
389
+ }
390
+ ),
391
+ /* @__PURE__ */ N("span", { className: T("text-xs", { "opacity-50": r }), children: a })
392
+ ] }),
393
+ /* @__PURE__ */ z("div", { className: "flex items-baseline gap-0.5", children: [
394
+ /* @__PURE__ */ N(
395
+ "span",
396
+ {
397
+ className: T("text-lg font-medium leading-none", {
398
+ "opacity-50": r
399
+ }),
400
+ children: t
401
+ }
402
+ ),
403
+ l && /* @__PURE__ */ N(
404
+ "span",
405
+ {
406
+ className: T("text-xs text-kumo-subtle leading-none", {
407
+ "opacity-50": r
408
+ }),
409
+ children: l
410
+ }
411
+ )
412
+ ] })
413
+ ] });
414
+ }
415
+ function de({ color: e, value: t, name: a, inactive: l }) {
416
+ return /* @__PURE__ */ z("div", { className: "inline-flex items-center gap-2", children: [
417
+ /* @__PURE__ */ N(
418
+ "span",
419
+ {
420
+ className: T("size-2 rounded-full inline-block", {
421
+ "opacity-50": l
422
+ }),
423
+ style: { backgroundColor: e }
424
+ }
425
+ ),
426
+ /* @__PURE__ */ N("span", { className: T("text-xs", { "opacity-50": l }), children: a }),
427
+ /* @__PURE__ */ N("span", { className: T("text-xs font-medium", { "opacity-50": l }), children: t })
428
+ ] });
429
+ }
430
+ const ve = {
431
+ SmallItem: de,
432
+ LargeItem: ue
433
+ }, fe = (e) => e.toLocaleString();
434
+ function pe(e) {
435
+ return typeof e == "object" && e !== null;
436
+ }
437
+ const q = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), ee = (e) => e.replace(/[{}|]/g, (t) => `\\${t}`), X = (e) => {
438
+ const t = "#666";
439
+ return !e || typeof e != "string" ? t : /^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e) || /^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*[\d.]+\s*)?\)$/i.test(
440
+ e
441
+ ) || /^hsla?\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*[\d.]+\s*)?\)$/i.test(
442
+ e
443
+ ) || /^[a-z]{3,20}$/i.test(e) ? e : t;
444
+ };
445
+ function ge({
446
+ echarts: e,
447
+ nodes: t,
448
+ links: a,
449
+ height: l = 400,
450
+ nodeWidth: r = 8,
451
+ nodePadding: s = 10,
452
+ showTooltip: d = !0,
453
+ showNodeValues: b,
454
+ formatValue: g = fe,
455
+ tooltipFormatter: p,
456
+ defaultNodeColor: S,
457
+ left: A,
458
+ right: E,
459
+ linkColor: F = "gradient",
460
+ linkOpacity: f = 0.5,
461
+ className: x,
462
+ isDarkMode: o,
463
+ onNodeClick: v,
464
+ onLinkClick: L
465
+ }) {
466
+ const O = t.some((h) => h.value !== void 0), R = b ?? O, C = P(() => {
467
+ const h = j.text("primary", o), i = j.text("secondary", o), B = new Map(t.map((n) => [n.name, n])), c = t.map((n, u) => ({
468
+ name: n.name,
469
+ value: n.value,
470
+ itemStyle: {
471
+ color: n.color ?? S ?? j.categorical(u, o)
472
+ }
473
+ })), $ = a.map((n) => ({
474
+ source: t[n.source]?.name ?? "",
475
+ target: t[n.target]?.name ?? "",
476
+ value: n.value
477
+ }));
478
+ return {
479
+ backgroundColor: "transparent",
480
+ animation: !0,
481
+ animationDuration: 500,
482
+ animationDurationUpdate: 300,
483
+ animationEasingUpdate: "cubicInOut",
484
+ tooltip: d ? {
485
+ trigger: "item",
486
+ triggerOn: "mousemove",
487
+ dangerousHtmlFormatter: (n) => {
488
+ if (!pe(n)) return "";
489
+ if (n.dataType === "node" && n.name) {
490
+ const u = B.get(n.name), m = X(
491
+ u?.color ?? n.color ?? "#666"
492
+ );
493
+ if (p)
494
+ return p({
495
+ type: "node",
496
+ name: n.name,
497
+ node: u,
498
+ color: m
499
+ });
500
+ const y = q(n.name);
501
+ return `<div style="display:flex;align-items:center;gap:6px;"><span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${m}"></span><strong>${y}</strong></div>`;
502
+ }
503
+ if (n.dataType === "edge" && n.data) {
504
+ const { source: u, target: m, value: y } = n.data;
505
+ if (p)
506
+ return p({
507
+ type: "link",
508
+ name: `${u} → ${m}`,
509
+ link: {
510
+ source: u ?? "",
511
+ target: m ?? "",
512
+ value: y ?? 0
513
+ }
514
+ });
515
+ const w = B.get(u ?? ""), V = B.get(m ?? ""), I = X(w?.color ?? "#666"), G = X(V?.color ?? "#666"), W = q(u ?? ""), U = q(m ?? "");
516
+ return `<div style="display:flex;align-items:center;gap:6px;margin-bottom:4px;">
517
+ <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${I}"></span>
518
+ <strong>${W}</strong>
519
+ <span style="color:${i}">→</span>
520
+ <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${G}"></span>
521
+ <strong>${U}</strong>
522
+ </div>
523
+ <strong>${y !== void 0 ? q(g(y)) : ""}</strong>`;
524
+ }
525
+ return "";
526
+ }
527
+ } : void 0,
528
+ series: [
529
+ {
530
+ type: "sankey",
531
+ ...A !== void 0 && { left: A },
532
+ ...E !== void 0 && { right: E },
533
+ data: c,
534
+ links: $,
535
+ draggable: !1,
536
+ emphasis: {
537
+ focus: "adjacency"
538
+ },
539
+ nodeWidth: r,
540
+ nodeGap: s,
541
+ lineStyle: {
542
+ color: F === "gradient" ? "source" : "#d1d5db",
543
+ opacity: F === "gradient" ? f : 0.4,
544
+ curveness: 0.5
545
+ },
546
+ label: {
547
+ show: !0,
548
+ color: h,
549
+ fontSize: 12,
550
+ formatter: R ? (n) => {
551
+ const u = n.name ?? "", m = B.get(u), y = ee(u);
552
+ return m?.value !== void 0 ? `{value|${ee(g(m.value))}}
553
+ {name|${y}}` : y;
554
+ } : void 0,
555
+ rich: R ? {
556
+ value: {
557
+ fontSize: 11,
558
+ color: h,
559
+ lineHeight: 16
560
+ },
561
+ name: {
562
+ fontSize: 12,
563
+ color: h,
564
+ fontWeight: 700
565
+ }
566
+ } : void 0
567
+ }
568
+ }
569
+ ]
570
+ };
571
+ }, [
572
+ t,
573
+ a,
574
+ d,
575
+ r,
576
+ s,
577
+ S,
578
+ A,
579
+ E,
580
+ o,
581
+ F,
582
+ f,
583
+ R,
584
+ g,
585
+ p
586
+ ]), k = se(
587
+ (h) => {
588
+ if (h.dataType === "node" && v && h.name) {
589
+ const i = t.findIndex(($) => $.name === h.name), c = {
590
+ ...i >= 0 ? t[i] : null,
591
+ name: h.name
592
+ };
593
+ v(c);
594
+ } else if (h.dataType === "edge" && L && h.data) {
595
+ const i = h.data, B = typeof i == "object" && i !== null && "source" in i ? String(i.source) : "", c = typeof i == "object" && i !== null && "target" in i ? String(i.target) : "", $ = t.findIndex((w) => w.name === B), n = t.findIndex((w) => w.name === c);
596
+ if ($ === -1 || n === -1) return;
597
+ const u = h.value, m = typeof u == "number" ? u : Array.isArray(u) && typeof u[0] == "number" ? u[0] : 0, y = a.find(
598
+ (w) => w.source === $ && w.target === n
599
+ );
600
+ L({
601
+ ...y,
602
+ source: $,
603
+ target: n,
604
+ value: m
605
+ });
606
+ }
607
+ },
608
+ [t, a, v, L]
609
+ ), _ = P(
610
+ () => ({
611
+ click: k
612
+ }),
613
+ [k]
614
+ );
615
+ return /* @__PURE__ */ N(
616
+ J,
617
+ {
618
+ echarts: e,
619
+ options: C,
620
+ className: x,
621
+ isDarkMode: o,
622
+ height: l,
623
+ onEvents: _
624
+ }
625
+ );
626
+ }
627
+ ge.displayName = "SankeyChart";
628
+ export {
629
+ J as C,
630
+ ge as S,
631
+ ye as T,
632
+ ve as a,
633
+ j as b
634
+ };
635
+ //# sourceMappingURL=SankeyChart-dkq90770ad7hgzx3.js.map