chordia-ui 3.7.2 → 3.7.4

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 (36) hide show
  1. package/dist/CustomFilterChips.cjs.js +1 -1
  2. package/dist/CustomFilterChips.cjs.js.map +1 -1
  3. package/dist/CustomFilterChips.es.js +239 -125
  4. package/dist/CustomFilterChips.es.js.map +1 -1
  5. package/dist/DataTable2.cjs.js +2 -0
  6. package/dist/DataTable2.cjs.js.map +1 -0
  7. package/dist/DataTable2.es.js +1863 -0
  8. package/dist/DataTable2.es.js.map +1 -0
  9. package/dist/components/UpdatedInteractionDetails.cjs.js +2 -2
  10. package/dist/components/UpdatedInteractionDetails.cjs.js.map +1 -1
  11. package/dist/components/UpdatedInteractionDetails.es.js +14 -13
  12. package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
  13. package/dist/components/data.cjs.js +1 -1
  14. package/dist/components/data.cjs.js.map +1 -1
  15. package/dist/components/data.es.js +157 -153
  16. package/dist/components/data.es.js.map +1 -1
  17. package/dist/components/performance.cjs.js +1 -1
  18. package/dist/components/performance.cjs.js.map +1 -1
  19. package/dist/components/performance.es.js +1900 -480
  20. package/dist/components/performance.es.js.map +1 -1
  21. package/dist/index.cjs.js +1 -1
  22. package/dist/index.es.js +94 -89
  23. package/dist/index.es.js.map +1 -1
  24. package/package.json +1 -1
  25. package/src/components/UpdatedInteractionDetails/UpdatedInteractionDetails.jsx +13 -13
  26. package/src/components/UpdatedInteractionDetails/UpdatedThreads.jsx +1 -0
  27. package/src/components/common/CustomFilterChips.jsx +5 -1
  28. package/src/components/common/Pagination.jsx +152 -39
  29. package/src/components/data/DataTable2.jsx +2449 -0
  30. package/src/components/data/DataTableFilters2.jsx +186 -0
  31. package/src/components/data/index.js +2 -0
  32. package/src/components/index.js +2 -2
  33. package/src/components/performance/PerformanceDetailsPage.jsx +940 -0
  34. package/src/components/performance/PerformancePanel.jsx +423 -297
  35. package/src/components/performance/SupervisorSelect.jsx +386 -0
  36. package/src/components/performance/index.js +3 -1
@@ -1,120 +1,14 @@
1
- import { jsxs as c, jsx as n, Fragment as ot } from "react/jsx-runtime";
2
- import Oe, { useState as h, useRef as T, useEffect as O, Suspense as Mt, useMemo as re, useCallback as z } from "react";
1
+ import { jsx as n, jsxs as c, Fragment as ot } from "react/jsx-runtime";
2
+ import Oe, { useRef as T, useState as h, useEffect as O, useMemo as re, useCallback as z, Suspense as Mt } from "react";
3
3
  import { u as zt, a as Ze, D as Ft, c as Et, S as Wt, h as Ot, b as Tt, s as $t, K as Rt, P as Pt, d as Te, e as jt, C as It } from "../sortable.esm.es.js";
4
- import { CalendarClock as et, Download as _t, ChevronDown as Re, ChevronUp as tt, Filter as rt, GripVertical as nt } from "lucide-react";
4
+ import { ChevronUp as et, ChevronDown as Re, Filter as tt, GripVertical as rt, CalendarClock as nt, Download as _t } from "lucide-react";
5
5
  import { createPortal as st } from "react-dom";
6
- import { C as At, P as Bt } from "../CustomFilterChips.es.js";
6
+ import { P as At, C as Bt } from "../CustomFilterChips.es.js";
7
+ import { a as Ht } from "../DataTable2.es.js";
8
+ import { D as cr } from "../DataTable2.es.js";
7
9
  import "motion/react";
8
10
  import "recharts";
9
11
  import "../TourGuideTooltip.es.js";
10
- function Ht({
11
- dateRangePicker: g,
12
- onWeekToDate: l,
13
- exportConfig: b,
14
- filterChipsConfig: u,
15
- trailingActions: N
16
- // Optional extra actions rendered after Export (e.g., Add Users button)
17
- }) {
18
- const [k, j] = h(!1), v = T(null), F = T(null);
19
- O(() => {
20
- const m = (f) => {
21
- F.current && !F.current.contains(f.target) && v.current && !v.current.contains(f.target) && j(!1);
22
- };
23
- if (k)
24
- return document.addEventListener("mousedown", m), () => {
25
- document.removeEventListener("mousedown", m);
26
- };
27
- }, [k]);
28
- const G = () => {
29
- j((m) => !m);
30
- }, I = (m) => {
31
- j(!1), b != null && b.onExport && b.onExport(m);
32
- }, L = (() => {
33
- if (!(u != null && u.filters))
34
- return !1;
35
- const m = u.filters, f = u.customFilters || [], _ = Object.entries(m).some(([x, w]) => !!(Array.isArray(w) && w.length || typeof w == "string" && w.trim() !== "" || w && typeof w == "object" && (w.min != null || w.max != null))), M = f.some((x) => x.active);
36
- return _ || M;
37
- })();
38
- return /* @__PURE__ */ c("div", { className: "flex items-center gap-3 flex-wrap", children: [
39
- l && /* @__PURE__ */ c(
40
- "button",
41
- {
42
- onClick: l,
43
- className: "inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900",
44
- style: { fontFamily: "var(--font-sans)" },
45
- children: [
46
- /* @__PURE__ */ n(et, { size: 16 }),
47
- /* @__PURE__ */ n("span", { children: "Week to Date" })
48
- ]
49
- }
50
- ),
51
- g && /* @__PURE__ */ n(
52
- Mt,
53
- {
54
- fallback: /* @__PURE__ */ c("div", { className: "inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 text-sm font-medium text-gray-400", children: [
55
- /* @__PURE__ */ n(et, { size: 16 }),
56
- /* @__PURE__ */ n("span", { children: "Loading..." })
57
- ] }),
58
- children: g
59
- }
60
- ),
61
- b && /* @__PURE__ */ c("div", { className: "relative", children: [
62
- /* @__PURE__ */ c(
63
- "button",
64
- {
65
- ref: v,
66
- onClick: G,
67
- disabled: b.isExporting,
68
- className: "inline-flex items-center justify-between gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900 disabled:opacity-50 disabled:cursor-not-allowed min-w-[120px]",
69
- style: { fontFamily: "var(--font-sans)" },
70
- children: [
71
- /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
72
- /* @__PURE__ */ n(_t, { size: 16 }),
73
- /* @__PURE__ */ n("span", { children: b.isExporting ? "Exporting..." : "Export" })
74
- ] }),
75
- /* @__PURE__ */ n(Re, { size: 16 })
76
- ]
77
- }
78
- ),
79
- k && /* @__PURE__ */ n(
80
- "div",
81
- {
82
- ref: F,
83
- className: "absolute top-full right-0 mt-2 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50 min-w-[120px]",
84
- children: (b.types || ["csv"]).map((m) => /* @__PURE__ */ c(
85
- "button",
86
- {
87
- onClick: () => I(m),
88
- className: "w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",
89
- style: { fontFamily: "var(--font-sans)" },
90
- children: [
91
- "Export ",
92
- m.toUpperCase()
93
- ]
94
- },
95
- m
96
- ))
97
- }
98
- )
99
- ] }),
100
- (L || N) && /* @__PURE__ */ c(ot, { children: [
101
- L && /* @__PURE__ */ n("div", { className: "h-9 mt-1 w-px bg-gray-300 flex-shrink-0" }),
102
- /* @__PURE__ */ c("div", { className: "flex items-center gap-3 justify-end", children: [
103
- L && u && /* @__PURE__ */ n(
104
- At,
105
- {
106
- filters: u.filters,
107
- onChange: u.onChange,
108
- onClear: u.onClear,
109
- customFilters: u.customFilters || [],
110
- fieldOptions: u.fieldOptions || {}
111
- }
112
- ),
113
- N && /* @__PURE__ */ n("div", { className: "flex-shrink-0", children: N })
114
- ] })
115
- ] })
116
- ] });
117
- }
118
12
  function $e() {
119
13
  return /* @__PURE__ */ n("div", { style: { height: 1, background: "rgba(52,58,64,0.08)" } });
120
14
  }
@@ -143,7 +37,7 @@ const Kt = () => ({ userData: { email: "anonymous" } }), Ut = (g) => /* @__PURE_
143
37
  function Xt({
144
38
  children: g,
145
39
  content: l,
146
- direction: b = "top",
40
+ direction: y = "top",
147
41
  align: u = "center",
148
42
  styling: N,
149
43
  indicatorColor: k
@@ -157,7 +51,7 @@ function Xt({
157
51
  const M = z(() => {
158
52
  if (!f.current || !_.current || typeof window > "u")
159
53
  return;
160
- const x = f.current.getBoundingClientRect(), w = _.current.getBoundingClientRect(), de = window.innerWidth, C = window.innerHeight, A = 8, B = 10, $ = w.width, E = w.height, ce = x.top, Y = C - x.bottom, ue = b === "bottom" ? "bottom" : "top";
54
+ const x = f.current.getBoundingClientRect(), w = _.current.getBoundingClientRect(), de = window.innerWidth, C = window.innerHeight, A = 8, B = 10, $ = w.width, E = w.height, ce = x.top, Y = C - x.bottom, ue = y === "bottom" ? "bottom" : "top";
161
55
  let ne = ue;
162
56
  ue === "top" && ce < E + B + A && Y > ce ? ne = "bottom" : ue === "bottom" && Y < E + B + A && ce > Y && (ne = "top");
163
57
  let R = x.left + x.width / 2;
@@ -166,7 +60,7 @@ function Xt({
166
60
  J = Math.max(A, Math.min(J, C - E - A)), H = Math.max(A, Math.min(H, de - $ - A));
167
61
  const ge = Math.max(10, Math.min(R - H, $ - 10));
168
62
  m({ top: J, left: H, arrowLeft: ge, placement: ne });
169
- }, [u, b]);
63
+ }, [u, y]);
170
64
  return O(() => {
171
65
  if (!F || !I)
172
66
  return;
@@ -240,10 +134,10 @@ function Xt({
240
134
  }
241
135
  );
242
136
  }
243
- function or({
137
+ function sr({
244
138
  data: g = [],
245
139
  columns: l = [],
246
- initialPageSize: b = 10,
140
+ initialPageSize: y = 10,
247
141
  onRowClick: u,
248
142
  // Server-side pagination props (optional)
249
143
  totalCount: N = null,
@@ -307,7 +201,7 @@ function or({
307
201
  ) : i;
308
202
  });
309
203
  A.displayName = "TruncatedCell";
310
- const B = N !== null && v !== null, $ = G !== null, E = L !== null, [ce, Y] = h(1), [ue, ne] = h(b), R = k !== null ? k : ce, J = j !== null ? j : ue, H = (e) => {
204
+ const B = N !== null && v !== null, $ = G !== null, E = L !== null, [ce, Y] = h(1), [ue, ne] = h(y), R = k !== null ? k : ce, J = j !== null ? j : ue, H = (e) => {
311
205
  v ? v(e) : Y(e);
312
206
  }, ge = (e) => {
313
207
  F ? F(e) : ne(e);
@@ -372,7 +266,7 @@ function or({
372
266
  }
373
267
  const t = l.map((r) => r.id || r.key).slice(0, V);
374
268
  return K(t);
375
- }), [P, Ve] = h(!1), [De, at] = h({ top: 0, left: 0, width: 0 }), [lt, Ke] = h(/* @__PURE__ */ new Set()), [Ue, Xe] = h(/* @__PURE__ */ new Set()), [U, Ne] = h(null), [dt, xe] = h(null), ie = T(null), Le = T(null), ae = T(null), [Ge, Me] = h(null), [ze, ct] = h({}), ut = T(null), ye = T(null), D = (e) => e.id || e.key, be = z((e) => {
269
+ }), [P, Ve] = h(!1), [De, at] = h({ top: 0, left: 0, width: 0 }), [lt, Ke] = h(/* @__PURE__ */ new Set()), [Ue, Xe] = h(/* @__PURE__ */ new Set()), [U, Ne] = h(null), [dt, xe] = h(null), ie = T(null), Le = T(null), ae = T(null), [Ge, Me] = h(null), [ze, ct] = h({}), ut = T(null), be = T(null), D = (e) => e.id || e.key, ye = z((e) => {
376
270
  if (typeof e == "number" && Number.isFinite(e))
377
271
  return e;
378
272
  if (typeof e == "string") {
@@ -386,18 +280,18 @@ function or({
386
280
  }
387
281
  return null;
388
282
  }, []), Fe = z((e, t) => ze[e] != null ? `${ze[e]}px` : typeof t == "number" ? `${t}px` : t || "auto", [ze]), ve = z((e) => {
389
- if (!ye.current)
283
+ if (!be.current)
390
284
  return;
391
- const { columnId: t, startX: r, startWidth: o, minWidth: s, maxWidth: a } = ye.current, i = e.clientX - r, d = Math.round(o + i), X = Math.min(a, Math.max(s, d));
285
+ const { columnId: t, startX: r, startWidth: o, minWidth: s, maxWidth: a } = be.current, i = e.clientX - r, d = Math.round(o + i), X = Math.min(a, Math.max(s, d));
392
286
  ct((W) => ({ ...W, [t]: X }));
393
287
  }, []), fe = z(() => {
394
- ye.current = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", ve), document.removeEventListener("mouseup", fe);
288
+ be.current = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", ve), document.removeEventListener("mouseup", fe);
395
289
  }, [ve]), pt = z((e, t, r) => {
396
290
  var te;
397
291
  e.preventDefault(), e.stopPropagation();
398
- const o = t.id || t.key, s = be(t.minWidth) ?? x, a = be(t.maxWidth) ?? w, i = Math.min(s, a), d = Math.max(s, a), X = ((te = e.currentTarget.closest("th")) == null ? void 0 : te.getBoundingClientRect().width) || 0, W = be(r), me = W ?? Math.max(i, Math.round(X) || i), We = Math.min(d, Math.max(i, me));
399
- ye.current = { columnId: o, startX: e.clientX, startWidth: We, minWidth: i, maxWidth: d }, document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", ve), document.addEventListener("mouseup", fe);
400
- }, [w, x, ve, fe, be]);
292
+ const o = t.id || t.key, s = ye(t.minWidth) ?? x, a = ye(t.maxWidth) ?? w, i = Math.min(s, a), d = Math.max(s, a), X = ((te = e.currentTarget.closest("th")) == null ? void 0 : te.getBoundingClientRect().width) || 0, W = ye(r), me = W ?? Math.max(i, Math.round(X) || i), We = Math.min(d, Math.max(i, me));
293
+ be.current = { columnId: o, startX: e.clientX, startWidth: We, minWidth: i, maxWidth: d }, document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", ve), document.addEventListener("mouseup", fe);
294
+ }, [w, x, ve, fe, ye]);
401
295
  O(() => () => fe(), [fe]);
402
296
  const ft = zt(
403
297
  Ze(Pt),
@@ -488,9 +382,9 @@ function or({
488
382
  }, 200), t)));
489
383
  }, xt = (e, t) => {
490
384
  p[t] !== S && Ne(t);
491
- }, yt = () => {
385
+ }, bt = () => {
492
386
  Ne(null), xe(null);
493
- }, bt = (e, t) => {
387
+ }, yt = (e, t) => {
494
388
  e.preventDefault(), U !== null && U !== t && xe(t);
495
389
  }, vt = () => {
496
390
  xe(null);
@@ -587,8 +481,8 @@ function or({
587
481
  };
588
482
  let te = !1;
589
483
  if (E && m.length > 0) {
590
- const y = m[0][0];
591
- (y === r || y === "csat_score" && r === "evaluation.csat_score") && (te = !0);
484
+ const b = m[0][0];
485
+ (b === r || b === "csat_score" && r === "evaluation.csat_score") && (te = !0);
592
486
  } else
593
487
  te = pe === r;
594
488
  const Nt = he === "asc", Lt = e.filterable === !0;
@@ -634,7 +528,7 @@ function or({
634
528
  ...a,
635
529
  ...i,
636
530
  style: { cursor: "grab", color: "rgba(30, 33, 37, 0.32)" },
637
- children: /* @__PURE__ */ n(nt, { size: 12 })
531
+ children: /* @__PURE__ */ n(rt, { size: 12 })
638
532
  }
639
533
  ),
640
534
  /* @__PURE__ */ n(
@@ -645,7 +539,7 @@ function or({
645
539
  children: e.label.toUpperCase()
646
540
  }
647
541
  ),
648
- e.sortable !== !1 && te && /* @__PURE__ */ n("span", { children: Nt ? /* @__PURE__ */ n(tt, { size: 12 }) : /* @__PURE__ */ n(Re, { size: 12 }) }),
542
+ e.sortable !== !1 && te && /* @__PURE__ */ n("span", { children: Nt ? /* @__PURE__ */ n(et, { size: 12 }) : /* @__PURE__ */ n(Re, { size: 12 }) }),
649
543
  !o && /* @__PURE__ */ n(
650
544
  "div",
651
545
  {
@@ -653,8 +547,8 @@ function or({
653
547
  "aria-orientation": "vertical",
654
548
  "aria-label": `Resize ${e.label || r} column`,
655
549
  title: "Drag to resize column",
656
- onMouseDown: (y) => pt(y, e, s),
657
- onClick: (y) => y.stopPropagation(),
550
+ onMouseDown: (b) => pt(b, e, s),
551
+ onClick: (b) => b.stopPropagation(),
658
552
  style: {
659
553
  position: "absolute",
660
554
  top: 0,
@@ -668,11 +562,11 @@ function or({
668
562
  justifyContent: "center",
669
563
  color: "rgba(30, 33, 37, 0.56)"
670
564
  },
671
- onMouseEnter: (y) => {
672
- y.currentTarget.style.background = "rgba(30, 33, 37, 0.08)", y.currentTarget.style.color = "rgba(30, 33, 37, 0.86)";
565
+ onMouseEnter: (b) => {
566
+ b.currentTarget.style.background = "rgba(30, 33, 37, 0.08)", b.currentTarget.style.color = "rgba(30, 33, 37, 0.86)";
673
567
  },
674
- onMouseLeave: (y) => {
675
- y.currentTarget.style.background = "transparent", y.currentTarget.style.color = "rgba(30, 33, 37, 0.56)";
568
+ onMouseLeave: (b) => {
569
+ b.currentTarget.style.background = "transparent", b.currentTarget.style.color = "rgba(30, 33, 37, 0.56)";
676
570
  },
677
571
  children: /* @__PURE__ */ n(Vt, { size: 10, color: "currentColor" })
678
572
  }
@@ -692,7 +586,7 @@ function or({
692
586
  className: "sticky top-[57px] z-10 border-b border-[var(--border-strong)] px-4 py-2 text-left",
693
587
  children: Lt ? /* @__PURE__ */ c("div", { className: "relative", children: [
694
588
  /* @__PURE__ */ n(
695
- rt,
589
+ tt,
696
590
  {
697
591
  size: 12,
698
592
  className: "absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-faint)] pointer-events-none"
@@ -704,11 +598,11 @@ function or({
704
598
  type: "text",
705
599
  placeholder: "Filter...",
706
600
  value: Q[r] || "",
707
- onChange: (y) => {
708
- y.stopPropagation(), Je(r, y.target.value);
601
+ onChange: (b) => {
602
+ b.stopPropagation(), Je(r, b.target.value);
709
603
  },
710
- onKeyDown: (y) => y.stopPropagation(),
711
- onMouseDown: (y) => y.stopPropagation(),
604
+ onKeyDown: (b) => b.stopPropagation(),
605
+ onMouseDown: (b) => b.stopPropagation(),
712
606
  className: "w-full pl-7 pr-2 py-1.5 text-xs border border-[var(--border)] rounded text-[var(--text-ink)] placeholder:text-[var(--text-faint)] focus:outline-none focus:border-[var(--border-hover)] focus:ring-1 focus:ring-[var(--focus)] transition-colors",
713
607
  style: { fontFamily: "var(--font-sans)", backgroundColor: "var(--primary-foreground)" },
714
608
  autoComplete: "off"
@@ -750,8 +644,8 @@ function or({
750
644
  {
751
645
  draggable: !i,
752
646
  onDragStart: i ? void 0 : (d) => xt(d, o),
753
- onDragEnd: i ? void 0 : yt,
754
- onDragOver: i ? void 0 : (d) => bt(d, o),
647
+ onDragEnd: i ? void 0 : bt,
648
+ onDragOver: i ? void 0 : (d) => yt(d, o),
755
649
  onDragLeave: i ? void 0 : vt,
756
650
  onDrop: i ? void 0 : (d) => wt(d, o),
757
651
  className: `flex items-center gap-2 px-3 py-2 rounded transition-all ${i ? "cursor-default opacity-100" : "cursor-move"} ${!i && s ? "opacity-50" : ""} ${!i && a && U !== null && U !== o ? "ring-2 ring-green-2 ring-offset-1" : ""}`,
@@ -888,7 +782,7 @@ function or({
888
782
  },
889
783
  children: [
890
784
  /* @__PURE__ */ n("span", { children: kt }),
891
- P ? /* @__PURE__ */ n(tt, { size: 16 }) : /* @__PURE__ */ n(Re, { size: 16 })
785
+ P ? /* @__PURE__ */ n(et, { size: 16 }) : /* @__PURE__ */ n(Re, { size: 16 })
892
786
  ]
893
787
  }
894
788
  ),
@@ -1023,7 +917,7 @@ function or({
1023
917
  }
1024
918
  ),
1025
919
  /* @__PURE__ */ n(
1026
- rt,
920
+ tt,
1027
921
  {
1028
922
  size: 11,
1029
923
  style: {
@@ -1098,14 +992,14 @@ function or({
1098
992
  ] }) })
1099
993
  ] }),
1100
994
  /* @__PURE__ */ n(Tt, { children: qe ? /* @__PURE__ */ n("div", { className: "bg-[var(--paper-high)] border border-[var(--border-strong)] rounded px-4 py-2 shadow-lg", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
1101
- /* @__PURE__ */ n(nt, { size: 14, className: "text-[var(--text-faint)]" }),
995
+ /* @__PURE__ */ n(rt, { size: 14, className: "text-[var(--text-faint)]" }),
1102
996
  /* @__PURE__ */ n("span", { className: "text-sm font-semibold text-[var(--text-ink)]", children: qe.label })
1103
997
  ] }) }) : null })
1104
998
  ]
1105
999
  }
1106
1000
  ) : null,
1107
1001
  (B ? N > 0 : Se.length > 0) && /* @__PURE__ */ n("div", { className: "border-t border-gray-200 rounded-b-[14px]", style: { backgroundColor: "var(--primary-foreground)" }, children: /* @__PURE__ */ n(
1108
- Bt,
1002
+ At,
1109
1003
  {
1110
1004
  page: R,
1111
1005
  pageSizeOptions: [5, 10, 20, 50, 100],
@@ -1123,10 +1017,118 @@ function or({
1123
1017
  ) })
1124
1018
  ] });
1125
1019
  }
1126
- function sr({
1020
+ function ir({
1021
+ dateRangePicker: g,
1022
+ onWeekToDate: l,
1023
+ exportConfig: y,
1024
+ filterChipsConfig: u,
1025
+ trailingActions: N
1026
+ // Optional extra actions rendered after Export (e.g., Add Users button)
1027
+ }) {
1028
+ const [k, j] = h(!1), v = T(null), F = T(null);
1029
+ O(() => {
1030
+ const m = (f) => {
1031
+ F.current && !F.current.contains(f.target) && v.current && !v.current.contains(f.target) && j(!1);
1032
+ };
1033
+ if (k)
1034
+ return document.addEventListener("mousedown", m), () => {
1035
+ document.removeEventListener("mousedown", m);
1036
+ };
1037
+ }, [k]);
1038
+ const G = () => {
1039
+ j((m) => !m);
1040
+ }, I = (m) => {
1041
+ j(!1), y != null && y.onExport && y.onExport(m);
1042
+ }, L = (() => {
1043
+ if (!(u != null && u.filters))
1044
+ return !1;
1045
+ const m = u.filters, f = u.customFilters || [], _ = Object.entries(m).some(([x, w]) => !!(Array.isArray(w) && w.length || typeof w == "string" && w.trim() !== "" || w && typeof w == "object" && (w.min != null || w.max != null))), M = f.some((x) => x.active);
1046
+ return _ || M;
1047
+ })();
1048
+ return /* @__PURE__ */ c("div", { className: "flex items-center gap-3 flex-wrap", children: [
1049
+ l && /* @__PURE__ */ c(
1050
+ "button",
1051
+ {
1052
+ onClick: l,
1053
+ className: "inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900",
1054
+ style: { fontFamily: "var(--font-sans)" },
1055
+ children: [
1056
+ /* @__PURE__ */ n(nt, { size: 16 }),
1057
+ /* @__PURE__ */ n("span", { children: "Week to Date" })
1058
+ ]
1059
+ }
1060
+ ),
1061
+ g && /* @__PURE__ */ n(
1062
+ Mt,
1063
+ {
1064
+ fallback: /* @__PURE__ */ c("div", { className: "inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 text-sm font-medium text-gray-400", children: [
1065
+ /* @__PURE__ */ n(nt, { size: 16 }),
1066
+ /* @__PURE__ */ n("span", { children: "Loading..." })
1067
+ ] }),
1068
+ children: g
1069
+ }
1070
+ ),
1071
+ y && /* @__PURE__ */ c("div", { className: "relative", children: [
1072
+ /* @__PURE__ */ c(
1073
+ "button",
1074
+ {
1075
+ ref: v,
1076
+ onClick: G,
1077
+ disabled: y.isExporting,
1078
+ className: "inline-flex items-center justify-between gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900 disabled:opacity-50 disabled:cursor-not-allowed min-w-[120px]",
1079
+ style: { fontFamily: "var(--font-sans)" },
1080
+ children: [
1081
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
1082
+ /* @__PURE__ */ n(_t, { size: 16 }),
1083
+ /* @__PURE__ */ n("span", { children: y.isExporting ? "Exporting..." : "Export" })
1084
+ ] }),
1085
+ /* @__PURE__ */ n(Re, { size: 16 })
1086
+ ]
1087
+ }
1088
+ ),
1089
+ k && /* @__PURE__ */ n(
1090
+ "div",
1091
+ {
1092
+ ref: F,
1093
+ className: "absolute top-full right-0 mt-2 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50 min-w-[120px]",
1094
+ children: (y.types || ["csv"]).map((m) => /* @__PURE__ */ c(
1095
+ "button",
1096
+ {
1097
+ onClick: () => I(m),
1098
+ className: "w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",
1099
+ style: { fontFamily: "var(--font-sans)" },
1100
+ children: [
1101
+ "Export ",
1102
+ m.toUpperCase()
1103
+ ]
1104
+ },
1105
+ m
1106
+ ))
1107
+ }
1108
+ )
1109
+ ] }),
1110
+ (L || N) && /* @__PURE__ */ c(ot, { children: [
1111
+ L && /* @__PURE__ */ n("div", { className: "h-9 mt-1 w-px bg-gray-300 flex-shrink-0" }),
1112
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-3 justify-end", children: [
1113
+ L && u && /* @__PURE__ */ n(
1114
+ Bt,
1115
+ {
1116
+ filters: u.filters,
1117
+ onChange: u.onChange,
1118
+ onClear: u.onClear,
1119
+ customFilters: u.customFilters || [],
1120
+ fieldOptions: u.fieldOptions || {}
1121
+ }
1122
+ ),
1123
+ N && /* @__PURE__ */ n("div", { className: "flex-shrink-0", children: N })
1124
+ ] })
1125
+ ] })
1126
+ ] });
1127
+ }
1128
+ function ar({
1127
1129
  title: g = "Summary stats",
1128
1130
  stats: l = [],
1129
- columns: b = 2
1131
+ columns: y = 2
1130
1132
  }) {
1131
1133
  return /* @__PURE__ */ c("div", { style: { fontFamily: "system-ui, -apple-system, sans-serif" }, children: [
1132
1134
  /* @__PURE__ */ n(
@@ -1142,7 +1144,7 @@ function sr({
1142
1144
  {
1143
1145
  style: {
1144
1146
  display: "grid",
1145
- gridTemplateColumns: `repeat(${b}, minmax(0, 1fr))`,
1147
+ gridTemplateColumns: `repeat(${y}, minmax(0, 1fr))`,
1146
1148
  gap: "10px"
1147
1149
  },
1148
1150
  children: l.map((u, N) => /* @__PURE__ */ c(
@@ -1231,8 +1233,10 @@ function sr({
1231
1233
  ] });
1232
1234
  }
1233
1235
  export {
1234
- or as DataTable,
1236
+ sr as DataTable,
1237
+ cr as DataTable2,
1235
1238
  Ht as DataTableFilters,
1236
- sr as SummaryStatsPanel
1239
+ ir as DataTableFilters2,
1240
+ ar as SummaryStatsPanel
1237
1241
  };
1238
1242
  //# sourceMappingURL=data.es.js.map