@rafal.lemieszewski/tide-ui 0.87.9 → 0.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,24 @@
1
- import { jsxs as m, jsx as e, Fragment as Er } from "react/jsx-runtime";
2
- import lr, { useState as Pr, useMemo as z, useCallback as mr } from "react";
3
- import { ResponsiveContainer as Tr, ComposedChart as Br, CartesianGrid as U, XAxis as X, YAxis as $, Tooltip as J, Legend as Q, Bar as pr, Area as gr, Line as wr, ScatterChart as Or, Scatter as Rr, LineChart as Vr, ReferenceLine as qr, ReferenceDot as _r, BarChart as Nr } from "recharts";
4
- import { cn as jr } from "../../lib/utils.js";
5
- const G = (s, c = 0) => {
6
- const i = s.toFixed(c).split("."), d = i[0].replace(/\B(?=(\d{3})+(?!\d))/g, " ");
7
- return c > 0 && i[1] ? `${d}.${i[1]}` : d;
8
- }, Sr = (s, c, t, i = 20) => {
9
- if (!s.length) return i;
10
- let d = 0;
11
- s.forEach((C) => {
12
- c.forEach((o) => {
13
- const v = C[o];
14
- typeof v == "number" ? d = Math.max(d, Math.abs(v)) : Array.isArray(v) && v.forEach((n) => {
15
- typeof n == "number" && (d = Math.max(d, Math.abs(n)));
1
+ import { jsxs as d, jsx as r, Fragment as He } from "react/jsx-runtime";
2
+ import S, { useState as Ye, useMemo as $, useCallback as Se } from "react";
3
+ import { ResponsiveContainer as Ne, ComposedChart as er, CartesianGrid as se, XAxis as oe, YAxis as T, Tooltip as ne, Legend as ie, Bar as Le, Area as Te, Line as Oe, ScatterChart as rr, Scatter as tr, LineChart as ar, ReferenceLine as lr, ReferenceDot as sr, BarChart as Re } from "recharts";
4
+ import { cn as or } from "../../lib/utils.js";
5
+ const ce = (n, f = 0) => {
6
+ const p = n.toFixed(f).split("."), u = p[0].replace(/\B(?=(\d{3})+(?!\d))/g, " ");
7
+ return f > 0 && p[1] ? `${u}.${p[1]}` : u;
8
+ }, Ve = (n, f, a, p = 20) => {
9
+ if (!n.length) return p;
10
+ let u = 0;
11
+ n.forEach((N) => {
12
+ f.forEach((o) => {
13
+ const v = N[o];
14
+ typeof v == "number" ? u = Math.max(u, Math.abs(v)) : Array.isArray(v) && v.forEach((i) => {
15
+ typeof i == "number" && (u = Math.max(u, Math.abs(i)));
16
16
  });
17
17
  });
18
18
  });
19
- const y = (t ? t(d, 0) : d.toString()).length;
20
- return Math.max(i, y * 6 + 12);
21
- }, A = {
19
+ const w = (a ? a(u, 0) : u.toString()).length;
20
+ return Math.max(p, w * 6 + 12);
21
+ }, O = {
22
22
  bar: [
23
23
  "var(--color-chart-bar-1)",
24
24
  // #487D9A - Deep blue-teal
@@ -93,8 +93,8 @@ const G = (s, c = 0) => {
93
93
  "#CC0000"
94
94
  // High contrast red
95
95
  ]
96
- }, L = (s) => {
97
- switch (s) {
96
+ }, R = (n) => {
97
+ switch (n) {
98
98
  case "dashed":
99
99
  return "5 5";
100
100
  // 5px line, 5px gap
@@ -105,92 +105,92 @@ const G = (s, c = 0) => {
105
105
  default:
106
106
  return;
107
107
  }
108
- }, Fr = (s = "circle") => (c) => {
109
- const { cx: t, cy: i, r: d, fill: b, stroke: y, strokeWidth: C } = c, o = d || 4;
110
- switch (s) {
108
+ }, nr = (n = "circle") => (f) => {
109
+ const { cx: a, cy: p, r: u, fill: g, stroke: w, strokeWidth: N } = f, o = u || 4;
110
+ switch (n) {
111
111
  case "triangle":
112
- const v = o * 1.5, n = o * 1.3, f = `M ${t},${i - v} L ${t + n},${i + v / 2} L ${t - n},${i + v / 2} Z`;
113
- return /* @__PURE__ */ e(
112
+ const v = o * 1.5, i = o * 1.3, m = `M ${a},${p - v} L ${a + i},${p + v / 2} L ${a - i},${p + v / 2} Z`;
113
+ return /* @__PURE__ */ r(
114
114
  "path",
115
115
  {
116
- d: f,
117
- fill: b,
118
- stroke: y,
119
- strokeWidth: C || 0
116
+ d: m,
117
+ fill: g,
118
+ stroke: w,
119
+ strokeWidth: N || 0
120
120
  }
121
121
  );
122
122
  case "square":
123
- const k = o * 1.4;
124
- return /* @__PURE__ */ e(
123
+ const C = o * 1.4;
124
+ return /* @__PURE__ */ r(
125
125
  "rect",
126
126
  {
127
- x: t - k,
128
- y: i - k,
129
- width: k * 2,
130
- height: k * 2,
131
- fill: b,
132
- stroke: y,
133
- strokeWidth: C || 0
127
+ x: a - C,
128
+ y: p - C,
129
+ width: C * 2,
130
+ height: C * 2,
131
+ fill: g,
132
+ stroke: w,
133
+ strokeWidth: N || 0
134
134
  }
135
135
  );
136
136
  case "circle":
137
137
  default:
138
- return /* @__PURE__ */ e(
138
+ return /* @__PURE__ */ r(
139
139
  "circle",
140
140
  {
141
- cx: t,
142
- cy: i,
141
+ cx: a,
142
+ cy: p,
143
143
  r: o,
144
- fill: b,
145
- stroke: y,
146
- strokeWidth: C || 0
144
+ fill: g,
145
+ stroke: w,
146
+ strokeWidth: N || 0
147
147
  }
148
148
  );
149
149
  }
150
- }, Ir = (s) => ({ verticalAlign: "bottom", align: "center" }), H = ({ active: s, payload: c, label: t, config: i, tooltipMaxWidth: d = "max-w-xs", chartType: b, referenceMarkers: y }) => {
151
- if (!s || !c || !c.length)
150
+ }, Be = (n) => ({ verticalAlign: "bottom", align: "center" }), de = ({ active: n, payload: f, label: a, config: p, tooltipMaxWidth: u = "max-w-xs", chartType: g, referenceMarkers: w }) => {
151
+ if (!n || !f || !f.length)
152
152
  return null;
153
- const C = y?.filter((o) => o.xValue === t) || [];
154
- return /* @__PURE__ */ m(
153
+ const N = w?.filter((o) => o.xValue === a) || [];
154
+ return /* @__PURE__ */ d(
155
155
  "div",
156
156
  {
157
- className: `rounded-[var(--border-radius-s)] border border-[var(--color-border-primary-medium)] bg-[var(--color-surface-primary)] p-[var(--space-m)] shadow-[var(--shadow-300)] min-w-[120px] ${d} z-[9999]`,
157
+ className: `rounded-[var(--border-radius-s)] border border-[var(--color-border-primary-medium)] bg-[var(--color-surface-primary)] p-[var(--space-m)] shadow-[var(--shadow-300)] min-w-[120px] ${u} z-[9999]`,
158
158
  role: "tooltip",
159
159
  "aria-label": "Chart data tooltip",
160
160
  children: [
161
- /* @__PURE__ */ e("p", { className: "text-label-sm mb-[var(--space-xs)] text-[var(--color-text-primary)]", children: t }),
162
- c.map((o, v) => {
163
- const n = i[o.dataKey];
164
- let f;
165
- if (n?.type === "range-area" && o.payload) {
166
- const g = o.payload[o.dataKey];
167
- Array.isArray(g) && g.length === 2 ? f = `${G(g[0])} – ${G(g[1])}` : f = typeof o.value == "number" ? G(o.value) : o.value;
161
+ /* @__PURE__ */ r("p", { className: "text-label-sm mb-[var(--space-xs)] text-[var(--color-text-primary)]", children: a }),
162
+ f.map((o, v) => {
163
+ const i = p[o.dataKey];
164
+ let m;
165
+ if (i?.type === "range-area" && o.payload) {
166
+ const L = o.payload[o.dataKey];
167
+ Array.isArray(L) && L.length === 2 ? m = `${ce(L[0])} – ${ce(L[1])}` : m = typeof o.value == "number" ? ce(o.value) : o.value;
168
168
  } else
169
- f = typeof o.value == "number" ? G(o.value) : o.value;
170
- return /* @__PURE__ */ m("div", { className: "flex items-center gap-[var(--space-xs)]", children: [
169
+ m = typeof o.value == "number" ? ce(o.value) : o.value;
170
+ return /* @__PURE__ */ d("div", { className: "flex items-center gap-[var(--space-xs)]", children: [
171
171
  (() => {
172
- switch (b) {
172
+ switch (g) {
173
173
  case "line":
174
- const g = i[o.dataKey]?.strokeStyle, K = L(g);
175
- return /* @__PURE__ */ e(
174
+ const L = p[o.dataKey]?.strokeStyle, _ = R(L);
175
+ return /* @__PURE__ */ r(
176
176
  "div",
177
177
  {
178
178
  className: "w-3 h-0.5 flex-shrink-0 relative",
179
179
  "aria-hidden": "true",
180
- children: /* @__PURE__ */ e(
180
+ children: /* @__PURE__ */ r(
181
181
  "div",
182
182
  {
183
183
  className: "w-full h-full",
184
184
  style: {
185
- background: K ? `linear-gradient(to right, ${o.color} 50%, transparent 50%)` : o.color,
186
- backgroundSize: K === "5 5" ? "6px 100%" : K === "2 2" ? "2px 100%" : "100% 100%"
185
+ background: _ ? `linear-gradient(to right, ${o.color} 50%, transparent 50%)` : o.color,
186
+ backgroundSize: _ === "5 5" ? "6px 100%" : _ === "2 2" ? "2px 100%" : "100% 100%"
187
187
  }
188
188
  }
189
189
  )
190
190
  }
191
191
  );
192
192
  case "scatter":
193
- return /* @__PURE__ */ e(
193
+ return /* @__PURE__ */ r(
194
194
  "div",
195
195
  {
196
196
  className: "w-2 h-2 rounded-full flex-shrink-0",
@@ -199,21 +199,21 @@ const G = (s, c = 0) => {
199
199
  }
200
200
  );
201
201
  case "composed":
202
- switch (i[o.dataKey]?.type) {
202
+ switch (p[o.dataKey]?.type) {
203
203
  case "line":
204
- const N = i[o.dataKey]?.strokeStyle, w = L(N);
205
- return /* @__PURE__ */ e(
204
+ const A = p[o.dataKey]?.strokeStyle, K = R(A);
205
+ return /* @__PURE__ */ r(
206
206
  "div",
207
207
  {
208
208
  className: "w-3 h-0.5 flex-shrink-0 relative",
209
209
  "aria-hidden": "true",
210
- children: /* @__PURE__ */ e(
210
+ children: /* @__PURE__ */ r(
211
211
  "div",
212
212
  {
213
213
  className: "w-full h-full",
214
214
  style: {
215
- background: w ? `linear-gradient(to right, ${o.color} 50%, transparent 50%)` : o.color,
216
- backgroundSize: w === "5 5" ? "6px 100%" : w === "2 2" ? "2px 100%" : "100% 100%"
215
+ background: K ? `linear-gradient(to right, ${o.color} 50%, transparent 50%)` : o.color,
216
+ backgroundSize: K === "5 5" ? "6px 100%" : K === "2 2" ? "2px 100%" : "100% 100%"
217
217
  }
218
218
  }
219
219
  )
@@ -221,7 +221,7 @@ const G = (s, c = 0) => {
221
221
  );
222
222
  case "area":
223
223
  case "range-area":
224
- return /* @__PURE__ */ e(
224
+ return /* @__PURE__ */ r(
225
225
  "div",
226
226
  {
227
227
  className: "w-2.5 h-2.5 flex-shrink-0",
@@ -231,7 +231,7 @@ const G = (s, c = 0) => {
231
231
  );
232
232
  case "bar":
233
233
  default:
234
- return /* @__PURE__ */ e(
234
+ return /* @__PURE__ */ r(
235
235
  "div",
236
236
  {
237
237
  className: "w-2 h-2 flex-shrink-0",
@@ -244,7 +244,7 @@ const G = (s, c = 0) => {
244
244
  case "horizontal-bar":
245
245
  case "area":
246
246
  default:
247
- return /* @__PURE__ */ e(
247
+ return /* @__PURE__ */ r(
248
248
  "div",
249
249
  {
250
250
  className: "w-2 h-2 flex-shrink-0",
@@ -254,171 +254,217 @@ const G = (s, c = 0) => {
254
254
  );
255
255
  }
256
256
  })(),
257
- /* @__PURE__ */ m("span", { className: "text-body-sm text-[var(--color-text-primary)] min-w-0 break-words", children: [
258
- n?.label || o.dataKey,
257
+ /* @__PURE__ */ d("span", { className: "text-body-sm text-[var(--color-text-primary)] min-w-0 break-words", children: [
258
+ i?.label || o.dataKey,
259
259
  ":"
260
260
  ] }),
261
- /* @__PURE__ */ e("span", { className: "text-body-medium-sm text-[var(--color-text-primary)] ml-auto pl-[16px]", children: f })
261
+ /* @__PURE__ */ r("span", { className: "text-body-medium-sm text-[var(--color-text-primary)] ml-auto pl-[16px]", children: m })
262
262
  ] }, v);
263
263
  }),
264
- C.length > 0 && /* @__PURE__ */ m(Er, { children: [
265
- /* @__PURE__ */ e("div", { className: "my-[var(--space-m)]" }),
266
- C.map((o, v) => /* @__PURE__ */ m(lr.Fragment, { children: [
267
- o.tooltipLabel && /* @__PURE__ */ e("p", { className: "text-label-sm mb-[var(--space-xs)] text-[var(--color-text-primary)]", children: o.tooltipLabel }),
268
- !o.tooltipLabel && v === 0 && /* @__PURE__ */ e("p", { className: "text-label-sm mb-[var(--space-xs)] text-[var(--color-text-primary)]", children: "Reference Markers:" }),
269
- o.dataPoints.map((n, f) => /* @__PURE__ */ m("div", { className: "flex items-center gap-[var(--space-xs)]", children: [
264
+ N.length > 0 && /* @__PURE__ */ d(He, { children: [
265
+ /* @__PURE__ */ r("div", { className: "my-[var(--space-m)]" }),
266
+ N.map((o, v) => /* @__PURE__ */ d(S.Fragment, { children: [
267
+ o.tooltipLabel && /* @__PURE__ */ r("p", { className: "text-label-sm mb-[var(--space-xs)] text-[var(--color-text-primary)]", children: o.tooltipLabel }),
268
+ !o.tooltipLabel && v === 0 && /* @__PURE__ */ r("p", { className: "text-label-sm mb-[var(--space-xs)] text-[var(--color-text-primary)]", children: "Reference Markers:" }),
269
+ o.dataPoints.map((i, m) => /* @__PURE__ */ d("div", { className: "flex items-center gap-[var(--space-xs)]", children: [
270
270
  (() => {
271
- switch (n.shape || "circle") {
271
+ switch (i.shape || "circle") {
272
272
  case "triangle":
273
- return /* @__PURE__ */ e("svg", { width: 8, height: 8, className: "flex-shrink-0", viewBox: "0 0 10 10", children: /* @__PURE__ */ e(
273
+ return /* @__PURE__ */ r("svg", { width: 8, height: 8, className: "flex-shrink-0", viewBox: "0 0 10 10", children: /* @__PURE__ */ r(
274
274
  "path",
275
275
  {
276
276
  d: "M 5,2 L 8,8 L 2,8 Z",
277
- fill: n.fill || "var(--color-chart-line-1)",
278
- stroke: n.stroke || "transparent",
279
- strokeWidth: n.strokeWidth || 0
277
+ fill: i.fill || "var(--color-chart-line-1)",
278
+ stroke: i.stroke || "transparent",
279
+ strokeWidth: i.strokeWidth || 0
280
280
  }
281
281
  ) });
282
282
  case "square":
283
- return /* @__PURE__ */ e("svg", { width: 8, height: 8, className: "flex-shrink-0", viewBox: "0 0 10 10", children: /* @__PURE__ */ e(
283
+ return /* @__PURE__ */ r("svg", { width: 8, height: 8, className: "flex-shrink-0", viewBox: "0 0 10 10", children: /* @__PURE__ */ r(
284
284
  "rect",
285
285
  {
286
286
  x: "2",
287
287
  y: "2",
288
288
  width: "6",
289
289
  height: "6",
290
- fill: n.fill || "var(--color-chart-line-1)",
291
- stroke: n.stroke || "transparent",
292
- strokeWidth: n.strokeWidth || 0
290
+ fill: i.fill || "var(--color-chart-line-1)",
291
+ stroke: i.stroke || "transparent",
292
+ strokeWidth: i.strokeWidth || 0
293
293
  }
294
294
  ) });
295
295
  case "circle":
296
296
  default:
297
- return /* @__PURE__ */ e(
297
+ return /* @__PURE__ */ r(
298
298
  "div",
299
299
  {
300
300
  className: "w-2 h-2 rounded-full flex-shrink-0",
301
301
  style: {
302
- backgroundColor: n.fill || "var(--color-chart-line-1)",
303
- border: n.stroke ? `${n.strokeWidth || 1}px solid ${n.stroke}` : "none"
302
+ backgroundColor: i.fill || "var(--color-chart-line-1)",
303
+ border: i.stroke ? `${i.strokeWidth || 1}px solid ${i.stroke}` : "none"
304
304
  }
305
305
  }
306
306
  );
307
307
  }
308
308
  })(),
309
- /* @__PURE__ */ m("span", { className: "text-body-sm text-[var(--color-text-primary)] min-w-0 break-words", children: [
310
- n.label || `Marker ${f + 1}`,
309
+ /* @__PURE__ */ d("span", { className: "text-body-sm text-[var(--color-text-primary)] min-w-0 break-words", children: [
310
+ i.label || `Marker ${m + 1}`,
311
311
  ":"
312
312
  ] }),
313
- /* @__PURE__ */ e("span", { className: "text-body-medium-sm text-[var(--color-text-primary)] ml-auto pl-[16px]", children: G(n.yValue) })
314
- ] }, `marker-${v}-point-${f}`))
313
+ /* @__PURE__ */ r("span", { className: "text-body-medium-sm text-[var(--color-text-primary)] ml-auto pl-[16px]", children: ce(i.yValue) })
314
+ ] }, `marker-${v}-point-${m}`))
315
315
  ] }, `marker-section-${v}`))
316
316
  ] })
317
317
  ]
318
318
  }
319
319
  );
320
320
  };
321
- function Hr({
322
- type: s,
323
- data: c,
324
- config: t,
325
- className: i,
326
- height: d = 300,
327
- width: b,
328
- minWidth: y = 300,
329
- onDataPointClick: C,
321
+ function pr({
322
+ type: n,
323
+ data: f,
324
+ config: a,
325
+ className: p,
326
+ height: u = 300,
327
+ width: g,
328
+ minWidth: w = 300,
329
+ onDataPointClick: N,
330
330
  onDataPointHover: o,
331
331
  highlightedIndex: v,
332
- showGrid: n = !0,
333
- showLegend: f = !0,
334
- showTooltip: k = !0,
335
- colorScheme: g,
336
- responsive: K = !0,
337
- maintainAspectRatio: $r = !1,
338
- legendHeight: N,
339
- margin: w,
340
- yAxisWidth: sr,
341
- yAxisTickCount: vr,
342
- xAxisTickFormatter: Ar,
343
- yAxisTickFormatter: W,
344
- showRightYAxis: Y = !1,
345
- rightYAxisWidth: nr,
346
- rightYAxisTickCount: rr,
347
- rightYAxisDomain: er,
348
- rightYAxisTickFormatter: tr,
349
- title: S,
350
- description: ar,
351
- showDataTable: Mr = !1,
352
- tooltipMaxWidth: D = "max-w-xs",
353
- tooltipAllowEscapeViewBox: E,
354
- legendOrder: cr,
355
- legendPosition: Zr = "bottom",
356
- referenceMarkers: ir,
357
- yAxisDomain: fr,
358
- ...zr
332
+ showGrid: i = !0,
333
+ showLegend: m = !0,
334
+ showTooltip: C = !0,
335
+ colorScheme: L,
336
+ responsive: _ = !0,
337
+ maintainAspectRatio: je = !1,
338
+ legendHeight: A,
339
+ margin: K,
340
+ yAxisWidth: ve,
341
+ yAxisTickCount: Ie,
342
+ xAxisTickFormatter: qe,
343
+ yAxisTickFormatter: F,
344
+ showRightYAxis: ue = !1,
345
+ rightYAxisWidth: be,
346
+ rightYAxisTickCount: he,
347
+ rightYAxisDomain: fe,
348
+ rightYAxisTickFormatter: pe,
349
+ title: D,
350
+ description: xe,
351
+ showDataTable: _e = !1,
352
+ tooltipMaxWidth: X = "max-w-xs",
353
+ tooltipAllowEscapeViewBox: U,
354
+ legendOrder: V,
355
+ legendPosition: ir = "bottom",
356
+ referenceMarkers: Me,
357
+ todayMarker: W,
358
+ yAxisDomain: B,
359
+ scrollable: E = !1,
360
+ scrollableWidth: $e,
361
+ ...Fe
359
362
  }) {
360
- const [xr, Lr] = Pr(0), x = z(() => {
361
- if (g)
362
- return A[g];
363
- switch (s) {
363
+ const [ze, Xe] = Ye(0), b = S.useRef(null), ke = S.useRef(!1), Ae = S.useRef(0), Ke = S.useRef(0), Ue = S.useCallback((t) => {
364
+ b.current && (ke.current = !0, Ae.current = t.pageX - b.current.offsetLeft, Ke.current = b.current.scrollLeft, b.current.style.cursor = "grabbing");
365
+ }, []), Ze = S.useCallback((t) => {
366
+ if (!ke.current || !b.current) return;
367
+ t.preventDefault();
368
+ const e = t.pageX - b.current.offsetLeft;
369
+ b.current.scrollLeft = Ke.current - (e - Ae.current);
370
+ }, []), We = S.useCallback(() => {
371
+ ke.current = !1, b.current && (b.current.style.cursor = "grab");
372
+ }, []), k = $(() => {
373
+ if (L)
374
+ return O[L];
375
+ switch (n) {
364
376
  case "bar":
365
377
  case "horizontal-bar":
366
- return A.bar;
378
+ return O.bar;
367
379
  case "line":
368
- return A.line;
380
+ return O.line;
369
381
  case "scatter":
370
- return A.scatter;
382
+ return O.scatter;
371
383
  case "composed":
372
- return A.bar;
384
+ return O.bar;
373
385
  // Use bar colors for composed charts
374
386
  default:
375
- return A.bar;
387
+ return O.bar;
376
388
  }
377
- }, [s, g]), u = Object.keys(t).filter((r) => r !== "name"), I = z(() => c.map((r) => {
378
- const a = { ...r };
379
- return u.forEach((l) => {
380
- if (t[l].type === "range-area") {
381
- const h = r[l];
382
- Array.isArray(h) && h.length === 2 && (a[l] = h, a[`${l}_min`] = h[0], a[`${l}_max`] = h[1]);
389
+ }, [n, L]), h = Object.keys(a).filter((t) => t !== "name"), y = $(() => f.map((t) => {
390
+ const e = { ...t };
391
+ return h.forEach((s) => {
392
+ if (a[s].type === "range-area") {
393
+ const l = t[s];
394
+ Array.isArray(l) && l.length === 2 && (e[s] = l, e[`${s}_min`] = l[0], e[`${s}_max`] = l[1]);
383
395
  }
384
- }), a;
385
- }), [c, t, u]), P = mr((r) => {
386
- const a = r?.activeTooltipIndex ?? 0;
387
- Lr(a), o?.(r?.activePayload?.[0]?.payload, a);
388
- }, [o]), T = mr(() => {
396
+ }), e;
397
+ }), [f, a, h]), ge = $(() => {
398
+ if (!W) return null;
399
+ const t = y.find((e) => e.name === W.xValue);
400
+ return {
401
+ xValue: W.xValue,
402
+ showLine: !0,
403
+ lineLabel: W.label ?? "Today",
404
+ lineStyle: {
405
+ stroke: "var(--color-border-error-bold)",
406
+ strokeWidth: 2
407
+ },
408
+ dataPoints: h.filter((e) => t && t[e] != null).map((e) => ({
409
+ yValue: t[e],
410
+ yAxisId: a[e].yAxisId || "left",
411
+ fill: "var(--color-background-error-bold)",
412
+ size: 4,
413
+ pulsing: !0
414
+ }))
415
+ };
416
+ }, [W, y, h, a]), we = $(() => [
417
+ ...Me ?? [],
418
+ ...ge ? [ge] : []
419
+ ], [Me, ge]), Z = Se((t) => {
420
+ const e = t?.activeTooltipIndex ?? 0;
421
+ Xe(e), o?.(t?.activePayload?.[0]?.payload, e);
422
+ }, [o]), J = Se(() => {
389
423
  o?.(null);
390
- }, [o]), B = mr((r) => {
391
- const a = r?.activeTooltipIndex ?? 0;
392
- C?.(r?.activePayload?.[0]?.payload, a);
393
- }, [C]), O = z(() => xr >= Math.floor(I.length / 2), [xr, I.length]), br = () => {
394
- const r = { top: 0, right: 0, left: 0, bottom: 0 };
424
+ }, [o]), Q = Se((t) => {
425
+ const e = t?.activeTooltipIndex ?? 0;
426
+ N?.(t?.activePayload?.[0]?.payload, e);
427
+ }, [N]), G = $(() => ze >= Math.floor(y.length / 2), [ze, y.length]), me = () => {
428
+ const t = { top: 8, right: 0, left: 0, bottom: 0 };
395
429
  return {
396
- top: w?.top ?? r.top,
397
- right: w?.right ?? r.right,
430
+ top: K?.top ?? t.top,
431
+ right: K?.right ?? t.right,
398
432
  // Don't add rightYAxisWidth - Recharts handles it via YAxis width prop
399
- left: w?.left ?? r.left,
400
- bottom: w?.bottom ?? r.bottom
433
+ left: K?.left ?? t.left,
434
+ bottom: K?.bottom ?? t.bottom
401
435
  };
402
- }, Kr = z(() => sr || Sr(I, u, W, 20), [sr, I, u, W]), yr = z(() => {
403
- if (!Y) return 0;
404
- if (nr) return nr;
405
- const r = u.filter((a) => t[a].yAxisId === "right");
406
- return r.length === 0 ? 0 : Sr(I, r, tr, 20);
407
- }, [Y, nr, I, u, t, tr]), kr = z(() => u.some((a) => (t[a].yAxisId || "left") === "left") ? "left" : "right", [u, t]), R = N ? {
408
- ...Ir(),
436
+ }, Pe = $(() => ve || Ve(y, h, F, 20), [ve, y, h, F]), j = $(() => {
437
+ if (!E || B) return B;
438
+ const t = y.flatMap(
439
+ (e) => h.map((s) => {
440
+ const l = e[s];
441
+ return Array.isArray(l) || typeof l == "number" ? l : 0;
442
+ }).flat()
443
+ );
444
+ return [Math.min(0, ...t), Math.max(...t)];
445
+ }, [E, B, y, h]), H = $(
446
+ () => E ? $e ?? Math.max(y.length * 60, 600) : void 0,
447
+ [E, $e, y.length]
448
+ ), De = $(() => {
449
+ if (!ue) return 0;
450
+ if (be) return be;
451
+ const t = h.filter((e) => a[e].yAxisId === "right");
452
+ return t.length === 0 ? 0 : Ve(y, t, pe, 20);
453
+ }, [ue, be, y, h, a, pe]), Ee = $(() => h.some((e) => (a[e].yAxisId || "left") === "left") ? "left" : "right", [h, a]), Y = A ? {
454
+ ...Be(),
409
455
  wrapperStyle: {
410
456
  position: "absolute",
411
457
  bottom: 0,
412
458
  left: 0,
413
459
  right: 0,
414
- height: N,
460
+ height: A,
415
461
  paddingTop: 8,
416
462
  zIndex: 1
417
463
  }
418
- } : Ir(), V = {
419
- data: I,
420
- margin: br()
421
- }, q = {
464
+ } : Be(), ee = {
465
+ data: y,
466
+ margin: me()
467
+ }, re = {
422
468
  axisLine: { stroke: "var(--color-border-primary-subtle)", strokeWidth: 2 },
423
469
  tickLine: !1,
424
470
  tick: {
@@ -426,8 +472,8 @@ function Hr({
426
472
  fill: "var(--color-text-tertiary)",
427
473
  fontFamily: "Inter, sans-serif"
428
474
  },
429
- tickFormatter: Ar
430
- }, _ = {
475
+ tickFormatter: qe
476
+ }, P = {
431
477
  axisLine: { stroke: "var(--color-border-primary-subtle)", strokeWidth: 2 },
432
478
  tickLine: { stroke: "var(--color-border-primary-subtle)", strokeWidth: 1 },
433
479
  tick: {
@@ -435,77 +481,77 @@ function Hr({
435
481
  fill: "var(--color-text-tertiary)",
436
482
  fontFamily: "Inter, sans-serif"
437
483
  },
438
- width: Kr,
484
+ width: Pe,
439
485
  // Auto-calculated based on tick formatter, default 20px
440
- tickFormatter: W,
441
- ...vr && { tickCount: vr },
486
+ tickFormatter: F,
487
+ ...Ie && { tickCount: Ie },
442
488
  // Force specific number of ticks when provided
443
- ...fr && { domain: fr }
489
+ ...B && { domain: B }
444
490
  // Custom Y-axis domain when provided
445
- }, j = {
491
+ }, te = {
446
492
  stroke: "var(--color-border-primary-subtle)",
447
493
  horizontal: !0,
448
494
  vertical: !1
449
- }, F = ({ payload: r }) => {
450
- if (!r || !r.length) return null;
451
- const a = cr ? [...r].sort((p, M) => {
452
- const dr = cr.indexOf(p.dataKey), or = cr.indexOf(M.dataKey);
453
- return dr === -1 ? 1 : or === -1 ? -1 : dr - or;
454
- }) : r, h = br().left + 5;
455
- return /* @__PURE__ */ e(
495
+ }, ae = ({ payload: t }) => {
496
+ if (!t || !t.length) return null;
497
+ const e = t.filter((c) => a[c.dataKey]), s = V ? [...e].sort((c, z) => {
498
+ const M = V.indexOf(c.dataKey), I = V.indexOf(z.dataKey);
499
+ return M === -1 ? 1 : I === -1 ? -1 : M - I;
500
+ }) : e, x = me().left + 5;
501
+ return /* @__PURE__ */ r(
456
502
  "div",
457
503
  {
458
504
  style: {
459
- paddingLeft: `${h}px`,
505
+ paddingLeft: `${x}px`,
460
506
  paddingRight: "16px"
461
507
  },
462
- children: /* @__PURE__ */ e("div", { className: "flex flex-wrap justify-start items-start gap-x-[var(--space-m)] gap-y-[var(--space-s)]", children: a.map((p, M) => /* @__PURE__ */ m("div", { className: "flex items-center justify-center gap-[var(--space-xs)]", children: [
508
+ children: /* @__PURE__ */ r("div", { className: "flex flex-wrap justify-start items-start gap-x-[var(--space-m)] gap-y-[var(--space-s)]", children: s.map((c, z) => /* @__PURE__ */ d("div", { className: "flex items-center justify-center gap-[var(--space-xs)]", children: [
463
509
  (() => {
464
- switch (s) {
510
+ switch (n) {
465
511
  case "line":
466
- const or = t[p.dataKey]?.strokeStyle, hr = L(or);
467
- return /* @__PURE__ */ e(
512
+ const I = a[c.dataKey]?.strokeStyle, q = R(I);
513
+ return /* @__PURE__ */ r(
468
514
  "div",
469
515
  {
470
516
  className: "w-[12px] h-[2px] flex-shrink-0 relative",
471
517
  "aria-hidden": "true",
472
- children: /* @__PURE__ */ e(
518
+ children: /* @__PURE__ */ r(
473
519
  "div",
474
520
  {
475
521
  className: "w-full h-full",
476
522
  style: {
477
- background: hr ? `linear-gradient(to right, ${p.color} 50%, transparent 50%)` : p.color,
478
- backgroundSize: hr === "5 5" ? "8px 100%" : hr === "2 2" ? "3px 100%" : "100% 100%"
523
+ background: q ? `linear-gradient(to right, ${c.color} 50%, transparent 50%)` : c.color,
524
+ backgroundSize: q === "5 5" ? "8px 100%" : q === "2 2" ? "3px 100%" : "100% 100%"
479
525
  }
480
526
  }
481
527
  )
482
528
  }
483
529
  );
484
530
  case "scatter":
485
- return /* @__PURE__ */ e(
531
+ return /* @__PURE__ */ r(
486
532
  "div",
487
533
  {
488
534
  className: "w-[6px] h-[6px] rounded-full flex-shrink-0",
489
- style: { backgroundColor: p.color },
535
+ style: { backgroundColor: c.color },
490
536
  "aria-hidden": "true"
491
537
  }
492
538
  );
493
539
  case "composed":
494
- switch (t[p.dataKey]?.type) {
540
+ switch (a[c.dataKey]?.type) {
495
541
  case "line":
496
- const Dr = t[p.dataKey]?.strokeStyle, ur = L(Dr);
497
- return /* @__PURE__ */ e(
542
+ const Ge = a[c.dataKey]?.strokeStyle, Ce = R(Ge);
543
+ return /* @__PURE__ */ r(
498
544
  "div",
499
545
  {
500
546
  className: "w-[12px] h-[2px] flex-shrink-0 relative",
501
547
  "aria-hidden": "true",
502
- children: /* @__PURE__ */ e(
548
+ children: /* @__PURE__ */ r(
503
549
  "div",
504
550
  {
505
551
  className: "w-full h-full",
506
552
  style: {
507
- background: ur ? `linear-gradient(to right, ${p.color} 50%, transparent 50%)` : p.color,
508
- backgroundSize: ur === "5 5" ? "8px 100%" : ur === "2 2" ? "3px 100%" : "100% 100%"
553
+ background: Ce ? `linear-gradient(to right, ${c.color} 50%, transparent 50%)` : c.color,
554
+ backgroundSize: Ce === "5 5" ? "8px 100%" : Ce === "2 2" ? "3px 100%" : "100% 100%"
509
555
  }
510
556
  }
511
557
  )
@@ -513,21 +559,21 @@ function Hr({
513
559
  );
514
560
  case "area":
515
561
  case "range-area":
516
- return /* @__PURE__ */ e(
562
+ return /* @__PURE__ */ r(
517
563
  "div",
518
564
  {
519
565
  className: "w-[8px] h-[8px] flex-shrink-0",
520
- style: { backgroundColor: p.color },
566
+ style: { backgroundColor: c.color },
521
567
  "aria-hidden": "true"
522
568
  }
523
569
  );
524
570
  case "bar":
525
571
  default:
526
- return /* @__PURE__ */ e(
572
+ return /* @__PURE__ */ r(
527
573
  "div",
528
574
  {
529
575
  className: "w-[6px] h-[6px] flex-shrink-0",
530
- style: { backgroundColor: p.color },
576
+ style: { backgroundColor: c.color },
531
577
  "aria-hidden": "true"
532
578
  }
533
579
  );
@@ -535,38 +581,66 @@ function Hr({
535
581
  case "bar":
536
582
  case "horizontal-bar":
537
583
  default:
538
- return /* @__PURE__ */ e(
584
+ return /* @__PURE__ */ r(
539
585
  "div",
540
586
  {
541
587
  className: "w-[6px] h-[6px] flex-shrink-0",
542
- style: { backgroundColor: p.color },
588
+ style: { backgroundColor: c.color },
543
589
  "aria-hidden": "true"
544
590
  }
545
591
  );
546
592
  }
547
593
  })(),
548
- /* @__PURE__ */ e("span", { className: "[&]:text-body-medium-xsm [&]:text-[var(--color-text-secondary)] leading-none whitespace-nowrap", children: p.value })
549
- ] }, M)) })
594
+ /* @__PURE__ */ r("span", { className: "[&]:text-body-medium-xsm [&]:text-[var(--color-text-secondary)] leading-none whitespace-nowrap", children: c.value })
595
+ ] }, z)) })
550
596
  }
551
597
  );
552
- }, Cr = () => {
553
- switch (s) {
598
+ }, Je = () => {
599
+ const t = V ? [...V, ...Object.keys(a).filter((l) => !V.includes(l))] : Object.keys(a), s = me().left + 5;
600
+ return /* @__PURE__ */ r("div", { style: { paddingLeft: `${s}px`, paddingRight: "16px" }, children: /* @__PURE__ */ r("div", { className: "flex flex-wrap justify-start items-start gap-x-[var(--space-m)] gap-y-[var(--space-s)]", children: t.map((l, x) => {
601
+ const c = a[l];
602
+ if (!c) return null;
603
+ const z = c.color ?? "currentColor", M = R(c.strokeStyle), I = /* @__PURE__ */ r("div", { className: "w-[12px] h-[2px] flex-shrink-0 relative", "aria-hidden": "true", children: /* @__PURE__ */ r(
604
+ "div",
605
+ {
606
+ className: "w-full h-full",
607
+ style: {
608
+ background: M ? `linear-gradient(to right, ${z} 50%, transparent 50%)` : z,
609
+ backgroundSize: M === "5 5" ? "8px 100%" : M === "2 2" ? "3px 100%" : "100% 100%"
610
+ }
611
+ }
612
+ ) });
613
+ return /* @__PURE__ */ d("div", { className: "flex items-center justify-center gap-[var(--space-xs)]", children: [
614
+ I,
615
+ /* @__PURE__ */ r("span", { className: "[&]:text-body-medium-xsm [&]:text-[var(--color-text-secondary)] leading-none whitespace-nowrap", children: c.label })
616
+ ] }, x);
617
+ }) }) });
618
+ }, ye = (t = "full") => {
619
+ switch (n) {
554
620
  case "bar":
555
- return /* @__PURE__ */ m(
556
- Nr,
621
+ return /* @__PURE__ */ d(
622
+ Re,
557
623
  {
558
- ...V,
559
- onMouseMove: P,
560
- onMouseLeave: T,
561
- onClick: B,
624
+ ...ee,
625
+ onMouseMove: Z,
626
+ onMouseLeave: J,
627
+ onClick: Q,
562
628
  children: [
563
- n && /* @__PURE__ */ e(U, { ...j }),
564
- /* @__PURE__ */ e(X, { dataKey: "name", ...q }),
565
- /* @__PURE__ */ e($, { ..._ }),
566
- k && /* @__PURE__ */ e(
567
- J,
629
+ t !== "yaxis-only" && i && /* @__PURE__ */ r(se, { ...te }),
630
+ /* @__PURE__ */ r(oe, { dataKey: "name", ...re, ...t === "yaxis-only" && { axisLine: !1, tickLine: !1, tick: !1 } }),
631
+ /* @__PURE__ */ r(
632
+ T,
633
+ {
634
+ ...P,
635
+ hide: t === "data-only",
636
+ width: t === "data-only" ? 0 : P.width,
637
+ ...t !== "full" && j ? { domain: j } : {}
638
+ }
639
+ ),
640
+ t !== "yaxis-only" && C && /* @__PURE__ */ r(
641
+ ne,
568
642
  {
569
- content: (r) => /* @__PURE__ */ e(H, { ...r, config: t, tooltipMaxWidth: D, chartType: s }),
643
+ content: (e) => /* @__PURE__ */ r(de, { ...e, config: a, tooltipMaxWidth: X, chartType: n }),
570
644
  cursor: {
571
645
  stroke: "var(--color-border-primary)",
572
646
  strokeWidth: 1,
@@ -576,48 +650,49 @@ function Hr({
576
650
  position: { x: void 0, y: void 0 },
577
651
  offset: 10,
578
652
  animationDuration: 0,
579
- allowEscapeViewBox: E,
580
- reverseDirection: { x: O },
653
+ allowEscapeViewBox: U,
654
+ reverseDirection: { x: G },
581
655
  wrapperStyle: { zIndex: 100 }
582
656
  }
583
657
  ),
584
- f && /* @__PURE__ */ e(Q, { content: /* @__PURE__ */ e(F, {}), ...R }),
585
- u.map((r, a) => {
586
- const l = t[r].color || x[a % x.length];
587
- return /* @__PURE__ */ e(
588
- pr,
658
+ t === "full" && m && /* @__PURE__ */ r(ie, { content: /* @__PURE__ */ r(ae, {}), ...Y }),
659
+ h.map((e, s) => {
660
+ const l = a[e].color || k[s % k.length];
661
+ return /* @__PURE__ */ r(
662
+ Le,
589
663
  {
590
- dataKey: r,
591
- name: t[r].label,
664
+ dataKey: e,
665
+ name: a[e].label,
592
666
  fill: l,
667
+ fillOpacity: t === "yaxis-only" ? 0 : 1,
593
668
  radius: [0, 0, 0, 0],
594
669
  className: "cursor-pointer transition-colors",
595
670
  isAnimationActive: !1,
596
671
  maxBarSize: 60
597
672
  },
598
- r
673
+ e
599
674
  );
600
675
  })
601
676
  ]
602
677
  }
603
678
  );
604
679
  case "horizontal-bar":
605
- return /* @__PURE__ */ m(
606
- Nr,
680
+ return /* @__PURE__ */ d(
681
+ Re,
607
682
  {
608
- ...V,
683
+ ...ee,
609
684
  layout: "vertical",
610
- onMouseMove: P,
611
- onMouseLeave: T,
612
- onClick: B,
685
+ onMouseMove: Z,
686
+ onMouseLeave: J,
687
+ onClick: Q,
613
688
  children: [
614
- n && /* @__PURE__ */ e(U, { ...j, horizontal: !1, vertical: !0 }),
615
- /* @__PURE__ */ e(X, { type: "number", ...q }),
616
- /* @__PURE__ */ e($, { type: "category", dataKey: "name", ..._ }),
617
- k && /* @__PURE__ */ e(
618
- J,
689
+ i && /* @__PURE__ */ r(se, { ...te, horizontal: !1, vertical: !0 }),
690
+ /* @__PURE__ */ r(oe, { type: "number", ...re }),
691
+ /* @__PURE__ */ r(T, { type: "category", dataKey: "name", ...P }),
692
+ C && /* @__PURE__ */ r(
693
+ ne,
619
694
  {
620
- content: (r) => /* @__PURE__ */ e(H, { ...r, config: t, tooltipMaxWidth: D, chartType: s }),
695
+ content: (e) => /* @__PURE__ */ r(de, { ...e, config: a, tooltipMaxWidth: X, chartType: n }),
621
696
  cursor: {
622
697
  stroke: "var(--color-border-primary)",
623
698
  strokeWidth: 1,
@@ -627,45 +702,54 @@ function Hr({
627
702
  position: { x: void 0, y: void 0 },
628
703
  offset: 10,
629
704
  animationDuration: 0,
630
- allowEscapeViewBox: E,
631
- reverseDirection: { x: O },
705
+ allowEscapeViewBox: U,
706
+ reverseDirection: { x: G },
632
707
  wrapperStyle: { zIndex: 100 }
633
708
  }
634
709
  ),
635
- f && /* @__PURE__ */ e(Q, { content: /* @__PURE__ */ e(F, {}), ...R }),
636
- u.map((r, a) => {
637
- const l = t[r].color || x[a % x.length];
638
- return /* @__PURE__ */ e(
639
- pr,
710
+ m && /* @__PURE__ */ r(ie, { content: /* @__PURE__ */ r(ae, {}), ...Y }),
711
+ h.map((e, s) => {
712
+ const l = a[e].color || k[s % k.length];
713
+ return /* @__PURE__ */ r(
714
+ Le,
640
715
  {
641
- dataKey: r,
642
- name: t[r].label,
716
+ dataKey: e,
717
+ name: a[e].label,
643
718
  fill: l,
644
719
  radius: [0, 0, 0, 0],
645
720
  className: "cursor-pointer transition-colors",
646
721
  isAnimationActive: !1,
647
722
  maxBarSize: 40
648
723
  },
649
- r
724
+ e
650
725
  );
651
726
  })
652
727
  ]
653
728
  }
654
729
  );
655
730
  case "line":
656
- return /* @__PURE__ */ m(
657
- Vr,
731
+ return /* @__PURE__ */ d(
732
+ ar,
658
733
  {
659
- ...V,
660
- onMouseMove: P,
661
- onMouseLeave: T,
662
- onClick: B,
734
+ ...ee,
735
+ onMouseMove: Z,
736
+ onMouseLeave: J,
737
+ onClick: Q,
663
738
  children: [
664
- n && /* @__PURE__ */ e(U, { ...j, yAxisId: kr }),
665
- /* @__PURE__ */ e(X, { dataKey: "name", ...q }),
666
- /* @__PURE__ */ e($, { yAxisId: "left", ..._ }),
667
- Y && /* @__PURE__ */ e(
668
- $,
739
+ t !== "yaxis-only" && i && /* @__PURE__ */ r(se, { ...te, yAxisId: Ee }),
740
+ /* @__PURE__ */ r(oe, { dataKey: "name", ...re, ...t === "yaxis-only" && { axisLine: !1, tickLine: !1, tick: !1 } }),
741
+ /* @__PURE__ */ r(
742
+ T,
743
+ {
744
+ yAxisId: "left",
745
+ ...P,
746
+ hide: t === "data-only",
747
+ width: t === "data-only" ? 0 : P.width,
748
+ ...t !== "full" && j ? { domain: j } : {}
749
+ }
750
+ ),
751
+ t !== "yaxis-only" && ue && /* @__PURE__ */ r(
752
+ T,
669
753
  {
670
754
  yAxisId: "right",
671
755
  orientation: "right",
@@ -676,29 +760,16 @@ function Hr({
676
760
  fill: "var(--color-text-tertiary)",
677
761
  fontFamily: "Inter, sans-serif"
678
762
  },
679
- width: yr,
680
- tickFormatter: tr,
681
- ...rr && { tickCount: rr },
682
- ...er && { domain: er }
763
+ width: De,
764
+ tickFormatter: pe,
765
+ ...he && { tickCount: he },
766
+ ...fe && { domain: fe }
683
767
  }
684
768
  ),
685
- ir?.map(
686
- (r, a) => r.showLine !== !1 ? /* @__PURE__ */ e(
687
- qr,
688
- {
689
- x: r.xValue,
690
- yAxisId: "left",
691
- stroke: r.lineStyle?.stroke || "#000000",
692
- strokeWidth: r.lineStyle?.strokeWidth || 2,
693
- strokeDasharray: r.lineStyle?.strokeDasharray
694
- },
695
- `marker-line-${a}`
696
- ) : null
697
- ),
698
- k && /* @__PURE__ */ e(
699
- J,
769
+ t !== "yaxis-only" && C && /* @__PURE__ */ r(
770
+ ne,
700
771
  {
701
- content: (r) => /* @__PURE__ */ e(H, { ...r, config: t, tooltipMaxWidth: D, chartType: s, referenceMarkers: ir }),
772
+ content: (e) => /* @__PURE__ */ r(de, { ...e, config: a, tooltipMaxWidth: X, chartType: n, referenceMarkers: we }),
702
773
  cursor: {
703
774
  stroke: "var(--color-border-primary)",
704
775
  strokeWidth: 1,
@@ -708,72 +779,111 @@ function Hr({
708
779
  position: { x: void 0, y: void 0 },
709
780
  offset: 10,
710
781
  animationDuration: 0,
711
- allowEscapeViewBox: E,
712
- reverseDirection: { x: O },
782
+ allowEscapeViewBox: U,
783
+ reverseDirection: { x: G },
713
784
  wrapperStyle: { zIndex: 100 }
714
785
  }
715
786
  ),
716
- f && /* @__PURE__ */ e(Q, { content: /* @__PURE__ */ e(F, {}), ...R }),
717
- u.map((r, a) => {
718
- const l = t[r].color || x[a % x.length];
719
- return /* @__PURE__ */ e(
720
- wr,
787
+ t === "full" && m && /* @__PURE__ */ r(ie, { content: /* @__PURE__ */ r(ae, {}), ...Y }),
788
+ h.map((e, s) => {
789
+ const l = a[e].color || k[s % k.length];
790
+ return /* @__PURE__ */ r(
791
+ Oe,
721
792
  {
722
793
  type: "linear",
723
- dataKey: r,
724
- name: t[r].label,
725
- yAxisId: t[r].yAxisId || "left",
794
+ dataKey: e,
795
+ name: a[e].label,
796
+ yAxisId: a[e].yAxisId || "left",
726
797
  stroke: l,
727
798
  strokeWidth: 2,
728
- strokeDasharray: L(t[r].strokeStyle),
729
- dot: t[r].showDots === !0 ? {
799
+ strokeOpacity: t === "yaxis-only" ? 0 : 1,
800
+ strokeDasharray: R(a[e].strokeStyle),
801
+ dot: t === "yaxis-only" ? !1 : a[e].showDots === !0 ? {
730
802
  fill: l,
731
803
  strokeWidth: 0,
732
804
  r: 3
733
805
  } : !1,
734
- activeDot: {
806
+ activeDot: t === "yaxis-only" ? !1 : {
735
807
  r: 5,
736
808
  fill: l
737
809
  },
738
810
  className: "cursor-pointer transition-colors",
739
811
  isAnimationActive: !1
740
812
  },
741
- r
813
+ e
742
814
  );
743
815
  }),
744
- ir?.map((r, a) => /* @__PURE__ */ e(lr.Fragment, { children: r.dataPoints.map((l, h) => /* @__PURE__ */ e(
745
- _r,
816
+ t !== "yaxis-only" && we.map(
817
+ (e, s) => e.showLine !== !1 ? /* @__PURE__ */ r(
818
+ lr,
819
+ {
820
+ x: e.xValue,
821
+ yAxisId: "left",
822
+ stroke: e.lineStyle?.stroke || "#000000",
823
+ strokeWidth: e.lineStyle?.strokeWidth || 2,
824
+ strokeDasharray: e.lineStyle?.strokeDasharray,
825
+ label: e.lineLabel ? (l) => {
826
+ const { viewBox: x } = l;
827
+ return x ? /* @__PURE__ */ r(
828
+ "text",
829
+ {
830
+ x: x.x + 6,
831
+ y: x.y + 8,
832
+ dominantBaseline: "middle",
833
+ fill: "var(--color-text-error-bold)",
834
+ fontSize: 10,
835
+ fontFamily: "inherit",
836
+ fontWeight: 700,
837
+ children: e.lineLabel
838
+ }
839
+ ) : null;
840
+ } : void 0
841
+ },
842
+ `marker-line-${s}`
843
+ ) : null
844
+ ),
845
+ t !== "yaxis-only" && we.map((e, s) => /* @__PURE__ */ r(S.Fragment, { children: e.dataPoints?.map((l, x) => /* @__PURE__ */ r(
846
+ sr,
746
847
  {
747
- x: r.xValue,
848
+ x: e.xValue,
748
849
  y: l.yValue,
749
- yAxisId: "left",
850
+ yAxisId: l.yAxisId || "left",
750
851
  r: l.size || 4,
751
852
  fill: l.fill || "var(--color-chart-line-1)",
752
853
  stroke: l.stroke || "transparent",
753
854
  strokeWidth: l.strokeWidth || 0,
754
- shape: Fr(l.shape || "circle")
855
+ shape: l.pulsing ? (c) => {
856
+ const { cx: z, cy: M } = c, I = l.size || 4, q = l.fill || "var(--color-background-error-bold)";
857
+ return /* @__PURE__ */ d("g", { children: [
858
+ /* @__PURE__ */ d("circle", { cx: z, cy: M, r: I + 1, fill: q, opacity: 0.3, children: [
859
+ /* @__PURE__ */ r("animate", { attributeName: "r", from: String(I + 1), to: String(I + 8), dur: "1.5s", repeatCount: "indefinite" }),
860
+ /* @__PURE__ */ r("animate", { attributeName: "opacity", from: "0.35", to: "0", dur: "1.5s", repeatCount: "indefinite" })
861
+ ] }),
862
+ /* @__PURE__ */ r("circle", { cx: z, cy: M, r: I, fill: q })
863
+ ] });
864
+ } : nr(l.shape || "circle")
755
865
  },
756
- `marker-${a}-point-${h}`
757
- )) }, `marker-dots-${a}`))
866
+ `marker-${s}-point-${x}`
867
+ )) }, `marker-dots-${s}`))
758
868
  ]
759
869
  }
760
870
  );
761
871
  case "scatter":
762
- return /* @__PURE__ */ m(
763
- Or,
872
+ return /* @__PURE__ */ d(
873
+ rr,
764
874
  {
765
- ...V,
766
- onMouseMove: P,
767
- onMouseLeave: T,
768
- onClick: B,
875
+ ...ee,
876
+ onMouseMove: Z,
877
+ onMouseLeave: J,
878
+ onClick: Q,
769
879
  children: [
770
- n && /* @__PURE__ */ e(U, { ...j }),
771
- /* @__PURE__ */ e(X, { dataKey: "x", type: "number", ...q }),
772
- /* @__PURE__ */ e($, { dataKey: "y", type: "number", ..._ }),
773
- k && /* @__PURE__ */ e(
774
- J,
880
+ i && /* @__PURE__ */ r(se, { ...te }),
881
+ /* @__PURE__ */ r(oe, { dataKey: "x", type: "number", ...re }),
882
+ /* @__PURE__ */ r(T, { dataKey: "y", type: "number", ...P }),
883
+ C && /* @__PURE__ */ r(
884
+ ne,
775
885
  {
776
- content: (r) => /* @__PURE__ */ e(H, { ...r, config: t, tooltipMaxWidth: D, chartType: s }),
886
+ content: (e) => /* @__PURE__ */ r(de, { ...e, config: a, tooltipMaxWidth: X, chartType: n }),
777
887
  cursor: {
778
888
  stroke: "var(--color-border-primary)",
779
889
  strokeWidth: 1,
@@ -783,43 +893,52 @@ function Hr({
783
893
  position: { x: void 0, y: void 0 },
784
894
  offset: 10,
785
895
  animationDuration: 0,
786
- allowEscapeViewBox: E,
787
- reverseDirection: { x: O },
896
+ allowEscapeViewBox: U,
897
+ reverseDirection: { x: G },
788
898
  wrapperStyle: { zIndex: 100 }
789
899
  }
790
900
  ),
791
- f && /* @__PURE__ */ e(Q, { content: /* @__PURE__ */ e(F, {}), ...R }),
792
- u.filter((r) => r !== "x" && r !== "y" && r !== "name").map((r, a) => {
793
- const l = t[r]?.color || x[a % x.length];
794
- return /* @__PURE__ */ e(
795
- Rr,
901
+ m && /* @__PURE__ */ r(ie, { content: /* @__PURE__ */ r(ae, {}), ...Y }),
902
+ h.filter((e) => e !== "x" && e !== "y" && e !== "name").map((e, s) => {
903
+ const l = a[e]?.color || k[s % k.length];
904
+ return /* @__PURE__ */ r(
905
+ tr,
796
906
  {
797
- name: t[r]?.label || r,
798
- data: c.map((h) => ({ x: h.x, y: h.y, [r]: h[r] })),
907
+ name: a[e]?.label || e,
908
+ data: f.map((x) => ({ x: x.x, y: x.y, [e]: x[e] })),
799
909
  fill: l,
800
910
  className: "cursor-pointer transition-colors",
801
911
  isAnimationActive: !1
802
912
  },
803
- r
913
+ e
804
914
  );
805
915
  })
806
916
  ]
807
917
  }
808
918
  );
809
919
  case "composed":
810
- return /* @__PURE__ */ m(
811
- Br,
920
+ return /* @__PURE__ */ d(
921
+ er,
812
922
  {
813
- ...V,
814
- onMouseMove: P,
815
- onMouseLeave: T,
816
- onClick: B,
923
+ ...ee,
924
+ onMouseMove: Z,
925
+ onMouseLeave: J,
926
+ onClick: Q,
817
927
  children: [
818
- n && /* @__PURE__ */ e(U, { ...j, yAxisId: kr }),
819
- /* @__PURE__ */ e(X, { dataKey: "name", ...q }),
820
- /* @__PURE__ */ e($, { yAxisId: "left", ..._ }),
821
- Y && /* @__PURE__ */ e(
822
- $,
928
+ t !== "yaxis-only" && i && /* @__PURE__ */ r(se, { ...te, yAxisId: Ee }),
929
+ /* @__PURE__ */ r(oe, { dataKey: "name", ...re, ...t === "yaxis-only" && { axisLine: !1, tickLine: !1, tick: !1 } }),
930
+ /* @__PURE__ */ r(
931
+ T,
932
+ {
933
+ yAxisId: "left",
934
+ ...P,
935
+ hide: t === "data-only",
936
+ width: t === "data-only" ? 0 : P.width,
937
+ ...t !== "full" && j ? { domain: j } : {}
938
+ }
939
+ ),
940
+ t !== "yaxis-only" && ue && /* @__PURE__ */ r(
941
+ T,
823
942
  {
824
943
  yAxisId: "right",
825
944
  orientation: "right",
@@ -830,16 +949,16 @@ function Hr({
830
949
  fill: "var(--color-text-tertiary)",
831
950
  fontFamily: "Inter, sans-serif"
832
951
  },
833
- width: yr,
834
- tickFormatter: tr,
835
- ...rr && { tickCount: rr },
836
- ...er && { domain: er }
952
+ width: De,
953
+ tickFormatter: pe,
954
+ ...he && { tickCount: he },
955
+ ...fe && { domain: fe }
837
956
  }
838
957
  ),
839
- k && /* @__PURE__ */ e(
840
- J,
958
+ t !== "yaxis-only" && C && /* @__PURE__ */ r(
959
+ ne,
841
960
  {
842
- content: (r) => /* @__PURE__ */ e(H, { ...r, config: t, tooltipMaxWidth: D, chartType: s }),
961
+ content: (e) => /* @__PURE__ */ r(de, { ...e, config: a, tooltipMaxWidth: X, chartType: n }),
843
962
  cursor: {
844
963
  stroke: "var(--color-border-primary)",
845
964
  strokeWidth: 1,
@@ -849,158 +968,195 @@ function Hr({
849
968
  position: { x: void 0, y: void 0 },
850
969
  offset: 10,
851
970
  animationDuration: 0,
852
- allowEscapeViewBox: E,
853
- reverseDirection: { x: O },
971
+ allowEscapeViewBox: U,
972
+ reverseDirection: { x: G },
854
973
  wrapperStyle: { zIndex: 100 }
855
974
  }
856
975
  ),
857
- f && /* @__PURE__ */ e(Q, { content: /* @__PURE__ */ e(F, {}), ...R }),
858
- u.map((r, a) => {
859
- const l = t[r].color || x[a % x.length];
860
- return (t[r].type || "bar") === "bar" ? /* @__PURE__ */ e(
861
- pr,
976
+ t === "full" && m && /* @__PURE__ */ r(ie, { content: /* @__PURE__ */ r(ae, {}), ...Y }),
977
+ h.map((e, s) => {
978
+ const l = a[e].color || k[s % k.length];
979
+ return (a[e].type || "bar") === "bar" ? /* @__PURE__ */ r(
980
+ Le,
862
981
  {
863
- dataKey: r,
864
- name: t[r].label,
865
- yAxisId: t[r].yAxisId || "left",
982
+ dataKey: e,
983
+ name: a[e].label,
984
+ yAxisId: a[e].yAxisId || "left",
866
985
  fill: l,
986
+ fillOpacity: t === "yaxis-only" ? 0 : 1,
867
987
  radius: [0, 0, 0, 0],
868
988
  className: "cursor-pointer transition-colors",
869
989
  isAnimationActive: !1,
870
990
  maxBarSize: 60
871
991
  },
872
- r
992
+ e
873
993
  ) : null;
874
994
  }),
875
- u.map((r, a) => {
876
- const l = t[r].color || x[a % x.length], h = t[r].type || "bar";
877
- return h === "area" ? /* @__PURE__ */ e(
878
- gr,
995
+ h.map((e, s) => {
996
+ const l = a[e].color || k[s % k.length], x = a[e].type || "bar";
997
+ return x === "area" ? /* @__PURE__ */ r(
998
+ Te,
879
999
  {
880
1000
  type: "linear",
881
- dataKey: r,
882
- name: t[r].label,
883
- yAxisId: t[r].yAxisId || "left",
884
- stroke: t[r].stroke ?? l,
885
- fill: t[r].fill ?? l,
886
- fillOpacity: 0.3,
1001
+ dataKey: e,
1002
+ name: a[e].label,
1003
+ yAxisId: a[e].yAxisId || "left",
1004
+ stroke: a[e].stroke ?? l,
1005
+ strokeOpacity: t === "yaxis-only" ? 0 : 1,
1006
+ fill: a[e].fill ?? l,
1007
+ fillOpacity: t === "yaxis-only" ? 0 : 0.3,
887
1008
  className: "cursor-pointer transition-colors",
888
1009
  isAnimationActive: !1
889
1010
  },
890
- r
891
- ) : h === "range-area" ? /* @__PURE__ */ e(
892
- gr,
1011
+ e
1012
+ ) : x === "range-area" ? /* @__PURE__ */ r(
1013
+ Te,
893
1014
  {
894
1015
  type: "linear",
895
- dataKey: r,
896
- name: t[r].label,
897
- yAxisId: t[r].yAxisId || "left",
898
- stroke: t[r].stroke ?? "none",
899
- fill: t[r].fill ?? l,
900
- fillOpacity: 0.3,
1016
+ dataKey: e,
1017
+ name: a[e].label,
1018
+ yAxisId: a[e].yAxisId || "left",
1019
+ stroke: a[e].stroke ?? "none",
1020
+ strokeOpacity: t === "yaxis-only" ? 0 : 1,
1021
+ fill: a[e].fill ?? l,
1022
+ fillOpacity: t === "yaxis-only" ? 0 : 0.3,
901
1023
  className: "cursor-pointer transition-colors",
902
1024
  isAnimationActive: !1
903
1025
  },
904
- r
1026
+ e
905
1027
  ) : null;
906
1028
  }),
907
- u.map((r, a) => {
908
- const l = t[r].color || x[a % x.length];
909
- return (t[r].type || "bar") === "line" ? /* @__PURE__ */ e(
910
- wr,
1029
+ h.map((e, s) => {
1030
+ const l = a[e].color || k[s % k.length];
1031
+ return (a[e].type || "bar") === "line" ? /* @__PURE__ */ r(
1032
+ Oe,
911
1033
  {
912
1034
  type: "linear",
913
- dataKey: r,
914
- name: t[r].label,
915
- yAxisId: t[r].yAxisId || "left",
1035
+ dataKey: e,
1036
+ name: a[e].label,
1037
+ yAxisId: a[e].yAxisId || "left",
916
1038
  stroke: l,
917
1039
  strokeWidth: 2,
918
- strokeDasharray: L(t[r].strokeStyle),
919
- dot: t[r].showDots === !0 ? {
1040
+ strokeOpacity: t === "yaxis-only" ? 0 : 1,
1041
+ strokeDasharray: R(a[e].strokeStyle),
1042
+ dot: t === "yaxis-only" ? !1 : a[e].showDots === !0 ? {
920
1043
  fill: l,
921
1044
  strokeWidth: 0,
922
1045
  r: 3
923
1046
  } : !1,
924
- activeDot: {
1047
+ activeDot: t === "yaxis-only" ? !1 : {
925
1048
  r: 5,
926
1049
  fill: l
927
1050
  },
928
1051
  className: "cursor-pointer transition-colors",
929
1052
  isAnimationActive: !1
930
1053
  },
931
- r
1054
+ e
932
1055
  ) : null;
933
1056
  })
934
1057
  ]
935
1058
  }
936
1059
  );
937
1060
  default:
938
- return /* @__PURE__ */ e("div", { children: "Unsupported chart type" });
1061
+ return /* @__PURE__ */ r("div", { children: "Unsupported chart type" });
939
1062
  }
940
- }, Wr = () => Mr ? /* @__PURE__ */ e("div", { className: "sr-only", children: /* @__PURE__ */ m("table", { role: "table", "aria-label": S ? `Data for ${S}` : "Chart data", children: [
941
- /* @__PURE__ */ m("caption", { className: "sr-only", children: [
942
- S && `${S}. `,
943
- ar || `${s} chart showing ${u.length} data series across ${c.length} categories.`
1063
+ }, Qe = () => _e ? /* @__PURE__ */ r("div", { className: "sr-only", children: /* @__PURE__ */ d("table", { role: "table", "aria-label": D ? `Data for ${D}` : "Chart data", children: [
1064
+ /* @__PURE__ */ d("caption", { className: "sr-only", children: [
1065
+ D && `${D}. `,
1066
+ xe || `${n} chart showing ${h.length} data series across ${f.length} categories.`
944
1067
  ] }),
945
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ m("tr", { children: [
946
- /* @__PURE__ */ e("th", { scope: "col", children: "Category" }),
947
- u.map((r) => /* @__PURE__ */ e("th", { scope: "col", children: t[r]?.label || r }, r))
1068
+ /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ d("tr", { children: [
1069
+ /* @__PURE__ */ r("th", { scope: "col", children: "Category" }),
1070
+ h.map((t) => /* @__PURE__ */ r("th", { scope: "col", children: a[t]?.label || t }, t))
948
1071
  ] }) }),
949
- /* @__PURE__ */ e("tbody", { children: c.map((r, a) => /* @__PURE__ */ m("tr", { children: [
950
- /* @__PURE__ */ e("th", { scope: "row", children: r.name || `Item ${a + 1}` }),
951
- u.map((l) => /* @__PURE__ */ e("td", { children: W ? W(r[l], a) : r[l] }, l))
952
- ] }, a)) })
953
- ] }) }) : null, Z = lr.useRef(null);
954
- return lr.useEffect(() => {
955
- const r = Z.current;
956
- if (!r) return;
957
- const a = setTimeout(() => {
958
- r.querySelectorAll(".recharts-cartesian-axis-tick").forEach((h) => {
959
- const p = h.querySelector("text"), M = h.querySelector(".recharts-cartesian-axis-tick-line");
960
- p?.textContent?.trim() === "0" && M && M.setAttribute("stroke-width", "2");
1072
+ /* @__PURE__ */ r("tbody", { children: f.map((t, e) => /* @__PURE__ */ d("tr", { children: [
1073
+ /* @__PURE__ */ r("th", { scope: "row", children: t.name || `Item ${e + 1}` }),
1074
+ h.map((s) => /* @__PURE__ */ r("td", { children: F ? F(t[s], e) : t[s] }, s))
1075
+ ] }, e)) })
1076
+ ] }) }) : null, le = S.useRef(null);
1077
+ return S.useEffect(() => {
1078
+ const t = le.current;
1079
+ if (!t) return;
1080
+ const e = setTimeout(() => {
1081
+ t.querySelectorAll(".recharts-cartesian-axis-tick").forEach((l) => {
1082
+ const x = l.querySelector("text"), c = l.querySelector(".recharts-cartesian-axis-tick-line");
1083
+ x?.textContent?.trim() === "0" && c && c.setAttribute("stroke-width", "2");
961
1084
  });
962
1085
  }, 100);
963
- return () => clearTimeout(a);
964
- }, [c, s]), /* @__PURE__ */ m(
1086
+ return () => clearTimeout(e);
1087
+ }, [f, n]), S.useEffect(() => {
1088
+ if (!E || !W || !b.current || !H) return;
1089
+ const t = y.findIndex((s) => s.name === W.xValue);
1090
+ if (t < 0) return;
1091
+ const e = setTimeout(() => {
1092
+ if (!b.current) return;
1093
+ const s = b.current.offsetWidth, l = t / (y.length - 1) * H;
1094
+ b.current.scrollLeft = Math.max(0, l - s / 2);
1095
+ }, 50);
1096
+ return () => clearTimeout(e);
1097
+ }, [E, W, H, y]), /* @__PURE__ */ d(
965
1098
  "div",
966
1099
  {
967
- ref: Z,
968
- className: jr("w-full", i),
969
- style: { minWidth: y },
1100
+ ref: le,
1101
+ className: or("w-full", p),
1102
+ style: { minWidth: w },
970
1103
  role: "img",
971
- "aria-label": S || `${s} chart`,
972
- "aria-describedby": ar ? `${Z.current?.id || "chart"}-desc` : void 0,
973
- ...zr,
1104
+ "aria-label": D || `${n} chart`,
1105
+ "aria-describedby": xe ? `${le.current?.id || "chart"}-desc` : void 0,
1106
+ ...Fe,
974
1107
  children: [
975
- S && /* @__PURE__ */ e("h3", { className: "sr-only", id: `${Z.current?.id || "chart"}-title`, children: S }),
976
- ar && /* @__PURE__ */ e("p", { className: "sr-only", id: `${Z.current?.id || "chart"}-desc`, children: ar }),
1108
+ D && /* @__PURE__ */ r("h3", { className: "sr-only", id: `${le.current?.id || "chart"}-title`, children: D }),
1109
+ xe && /* @__PURE__ */ r("p", { className: "sr-only", id: `${le.current?.id || "chart"}-desc`, children: xe }),
977
1110
  (() => {
978
- const r = N ? d - N : d, a = K ? /* @__PURE__ */ e(
979
- Tr,
1111
+ const t = A ? u - A : u;
1112
+ if (E && n !== "horizontal-bar" && n !== "scatter") {
1113
+ const s = Pe + (me().left ?? 0);
1114
+ return /* @__PURE__ */ d("div", { style: { height: m && A ? u : t }, children: [
1115
+ /* @__PURE__ */ d("div", { className: "flex w-full", style: { height: t }, children: [
1116
+ /* @__PURE__ */ r("div", { style: { width: s, flexShrink: 0, overflow: "hidden" }, children: /* @__PURE__ */ r(Ne, { width: s, height: t, children: ye("yaxis-only") || /* @__PURE__ */ r("div", { children: "Chart error" }) }) }),
1117
+ /* @__PURE__ */ r(
1118
+ "div",
1119
+ {
1120
+ ref: b,
1121
+ className: "flex-1 overflow-x-scroll overflow-y-hidden scrollbar-hide select-none",
1122
+ style: { cursor: "grab" },
1123
+ onMouseDown: Ue,
1124
+ onMouseMove: Ze,
1125
+ onMouseUp: We,
1126
+ onMouseLeave: We,
1127
+ children: /* @__PURE__ */ r("div", { style: { width: H, height: t }, children: /* @__PURE__ */ r(Ne, { width: H, height: t, children: ye("data-only") || /* @__PURE__ */ r("div", { children: "Chart error" }) }) })
1128
+ }
1129
+ )
1130
+ ] }),
1131
+ m && Je()
1132
+ ] });
1133
+ }
1134
+ const e = _ ? /* @__PURE__ */ r(
1135
+ Ne,
980
1136
  {
981
- width: b || "100%",
982
- height: r,
983
- children: Cr() || /* @__PURE__ */ e("div", { children: "Chart error" })
1137
+ width: g || "100%",
1138
+ height: t,
1139
+ children: ye() || /* @__PURE__ */ r("div", { children: "Chart error" })
984
1140
  }
985
- ) : /* @__PURE__ */ e("div", { style: { width: b || "100%", height: r, minWidth: y }, children: Cr() || /* @__PURE__ */ e("div", { children: "Chart error" }) });
986
- return N ? /* @__PURE__ */ e("div", { style: { width: b || "100%" }, children: a }) : a;
1141
+ ) : /* @__PURE__ */ r("div", { style: { width: g || "100%", height: t, minWidth: w }, children: ye() || /* @__PURE__ */ r("div", { children: "Chart error" }) });
1142
+ return A ? /* @__PURE__ */ r("div", { style: { width: g || "100%" }, children: e }) : e;
987
1143
  })(),
988
- /* @__PURE__ */ e(Wr, {})
1144
+ /* @__PURE__ */ r(Qe, {})
989
1145
  ]
990
1146
  }
991
1147
  );
992
1148
  }
993
- const Yr = (s, c = "bar") => {
994
- const t = A[c];
995
- return Array.from({ length: s }, (i, d) => t[d % t.length]);
996
- }, re = (s, c, t) => Array.isArray(s) ? s.reduce((d, b, y) => (d[b] = {
997
- label: c?.[y] || b,
998
- color: t?.[y]
999
- }, d), {}) : s;
1149
+ const xr = (n, f = "bar") => {
1150
+ const a = O[f];
1151
+ return Array.from({ length: n }, (p, u) => a[u % a.length]);
1152
+ }, mr = (n, f, a) => Array.isArray(n) ? n.reduce((u, g, w) => (u[g] = {
1153
+ label: f?.[w] || g,
1154
+ color: a?.[w]
1155
+ }, u), {}) : n;
1000
1156
  export {
1001
- Hr as Chart,
1002
- A as chartColorSchemes,
1003
- re as createChartConfig,
1004
- G as formatNumber,
1005
- Yr as generateChartColors
1157
+ pr as Chart,
1158
+ O as chartColorSchemes,
1159
+ mr as createChartConfig,
1160
+ ce as formatNumber,
1161
+ xr as generateChartColors
1006
1162
  };