@stackone/malachite 2.86.0 → 2.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.
Files changed (66) hide show
  1. package/COMPONENTS.md +5 -4
  2. package/dist/components/Accordion.js +206 -179
  3. package/dist/components/Accordion.js.map +1 -1
  4. package/dist/components/Button.js +118 -81
  5. package/dist/components/Button.js.map +1 -1
  6. package/dist/components/Card.js +128 -75
  7. package/dist/components/Card.js.map +1 -1
  8. package/dist/components/Chat/ChatModelPicker.js +70 -67
  9. package/dist/components/Chat/ChatModelPicker.js.map +1 -1
  10. package/dist/components/FilterSearch.js +237 -232
  11. package/dist/components/FilterSearch.js.map +1 -1
  12. package/dist/components/FrameHeader.js +36 -0
  13. package/dist/components/FrameHeader.js.map +1 -0
  14. package/dist/components/LoadingBar.js +5 -5
  15. package/dist/components/LoadingBar.js.map +1 -1
  16. package/dist/components/MultiSelect.js +438 -388
  17. package/dist/components/MultiSelect.js.map +1 -1
  18. package/dist/components/PinnedCornerCap.js +32 -19
  19. package/dist/components/PinnedCornerCap.js.map +1 -1
  20. package/dist/components/QueryInput.js +95 -92
  21. package/dist/components/QueryInput.js.map +1 -1
  22. package/dist/components/SplitButton.js +62 -61
  23. package/dist/components/SplitButton.js.map +1 -1
  24. package/dist/components/Surface.js +98 -94
  25. package/dist/components/Surface.js.map +1 -1
  26. package/dist/components/Table/Table.js +630 -606
  27. package/dist/components/Table/Table.js.map +1 -1
  28. package/dist/components/TimeBarChart/TimeBarChart.js +241 -0
  29. package/dist/components/TimeBarChart/TimeBarChart.js.map +1 -0
  30. package/dist/components/TimeBarChart/TimeBarChartAxes.js +49 -0
  31. package/dist/components/TimeBarChart/TimeBarChartAxes.js.map +1 -0
  32. package/dist/components/TimeBarChart/TimeBarChartBars.js +58 -0
  33. package/dist/components/TimeBarChart/TimeBarChartBars.js.map +1 -0
  34. package/dist/components/TimeBarChart/TimeBarChartLegend.js +29 -0
  35. package/dist/components/TimeBarChart/TimeBarChartLegend.js.map +1 -0
  36. package/dist/components/TimeBarChart/TimeBarChartTable.js +33 -0
  37. package/dist/components/TimeBarChart/TimeBarChartTable.js.map +1 -0
  38. package/dist/components/TimeBarChart/TimeBarChartTooltip.js +77 -0
  39. package/dist/components/TimeBarChart/TimeBarChartTooltip.js.map +1 -0
  40. package/dist/components/TimeBarChart/stackLayout.js +25 -0
  41. package/dist/components/TimeBarChart/stackLayout.js.map +1 -0
  42. package/dist/components/TimeBarChart/timeBuckets.js +133 -0
  43. package/dist/components/TimeBarChart/timeBuckets.js.map +1 -0
  44. package/dist/components/TimeBarChart/tones.js +10 -0
  45. package/dist/components/TimeBarChart/tones.js.map +1 -0
  46. package/dist/components/Tooltip.js +93 -90
  47. package/dist/components/Tooltip.js.map +1 -1
  48. package/dist/components/activeElement.js +5 -1
  49. package/dist/components/activeElement.js.map +1 -1
  50. package/dist/components/dateMath.js +1 -0
  51. package/dist/components/dateMath.js.map +1 -1
  52. package/dist/components/filterSearchModel.js +53 -45
  53. package/dist/components/filterSearchModel.js.map +1 -1
  54. package/dist/components/frameStyles.js +14 -0
  55. package/dist/components/frameStyles.js.map +1 -0
  56. package/dist/components/headerContent.js +10 -0
  57. package/dist/components/headerContent.js.map +1 -0
  58. package/dist/components/useFollowTrigger.js +28 -0
  59. package/dist/components/useFollowTrigger.js.map +1 -0
  60. package/dist/index.d.ts +131 -9
  61. package/dist/index.js +24 -22
  62. package/dist/index.js.map +1 -1
  63. package/dist/tailwind.css.js +1 -1
  64. package/dist/theme.js +340 -340
  65. package/dist/theme.js.map +1 -1
  66. package/package.json +1 -1
@@ -1,29 +1,33 @@
1
- import { jsx as n, jsxs as k } from "react/jsx-runtime";
2
- import { useVirtualizer as Ot } from "@tanstack/react-virtual";
3
- import me, { useState as V, useRef as B, useCallback as We, useId as zt, useEffect as ee, useMemo as rt, useLayoutEffect as ft } from "react";
4
- import ht from "../CustomIcons/CaretDownIcon.js";
5
- import Lt from "../CustomIcons/CaretUpIcon.js";
6
- import Mt from "../CustomIcons/InfoIcon.js";
7
- import Wt from "../CustomIcons/WarningTriangleIcon.js";
8
- import Ft from "../PinnedCornerCap.js";
9
- import At from "../Tooltip.js";
10
- import Bt from "../TruncatedTooltip.js";
11
- import { FOCUS_RING_INSET as it, FOCUS_RING_INSET_OVERLAY as Ut } from "../focusRing.js";
12
- import { isFromInteractiveDescendant as lt, activateOnEnterOrSpace as jt } from "../keyboardActivation.js";
13
- import { FOREGROUND_RESET as Fe, SELECTED_ROW_ACCENT as ut, SELECTED_TEXT_CONTEXT as pt, SELECTED_ROW_FOREGROUND as gt, SELECTED_ROW_BACKGROUND as Be } from "../selectedRow.js";
14
- import at from "./TablePagination.js";
15
- const vt = 160, Pt = (e, r) => e.length === r.length && e.every((a, c) => a === r[c]), st = "\0", Ht = (e, r, a) => {
1
+ import { jsx as n, jsxs as y } from "react/jsx-runtime";
2
+ import { useVirtualizer as Bt } from "@tanstack/react-virtual";
3
+ import Se, { useState as V, useRef as U, useCallback as Be, useId as Ut, useEffect as te, useMemo as ot, useLayoutEffect as bt } from "react";
4
+ import xt from "../CustomIcons/CaretDownIcon.js";
5
+ import Pt from "../CustomIcons/CaretUpIcon.js";
6
+ import jt from "../CustomIcons/InfoIcon.js";
7
+ import Ht from "../CustomIcons/WarningTriangleIcon.js";
8
+ import Gt from "../FrameHeader.js";
9
+ import Yt from "../PinnedCornerCap.js";
10
+ import Jt from "../Tooltip.js";
11
+ import qt from "../TruncatedTooltip.js";
12
+ import { devWarning as Qt } from "../devWarning.js";
13
+ import { FOCUS_RING_INSET as dt, FOCUS_RING_INSET_OVERLAY as Vt } from "../focusRing.js";
14
+ import { FRAME_CLASS as Zt, FRAME_PADDING as se, FRAME_SECTION_RADIUS as oe, FRAME_SECTION_BORDER as Xt, FRAME_RADIUS as Kt } from "../frameStyles.js";
15
+ import { hasHeaderContent as ct } from "../headerContent.js";
16
+ import { isFromInteractiveDescendant as ft, activateOnEnterOrSpace as er } from "../keyboardActivation.js";
17
+ import { FOREGROUND_RESET as Ue, SELECTED_ROW_ACCENT as mt, SELECTED_TEXT_CONTEXT as yt, SELECTED_ROW_FOREGROUND as St, SELECTED_ROW_BACKGROUND as He } from "../selectedRow.js";
18
+ import ht from "./TablePagination.js";
19
+ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l === r[c]), ut = "\0", rr = (e, r, l) => {
16
20
  if (typeof e != "object" || e === null)
17
- return `${st}i${a}`;
21
+ return `${ut}i${l}`;
18
22
  const c = r.ids.get(e);
19
23
  if (c !== void 0)
20
24
  return c;
21
- const R = `${st}${r.next++}`;
22
- return r.ids.set(e, R), R;
23
- }, Gt = (e, r, a) => typeof r == "function" ? e.map((c) => r(c)) : e.map((c, R) => {
24
- const h = c[r];
25
- return h == null ? Ht(c, a, R) : String(h);
26
- }), Se = (e) => {
25
+ const C = `${ut}${r.next++}`;
26
+ return r.ids.set(e, C), C;
27
+ }, nr = (e, r, l) => typeof r == "function" ? e.map((c) => r(c)) : e.map((c, C) => {
28
+ const u = c[r];
29
+ return u == null ? rr(c, l, C) : String(u);
30
+ }), we = (e) => {
27
31
  if (typeof e == "number")
28
32
  return e;
29
33
  if (typeof e == "string") {
@@ -31,258 +35,261 @@ const vt = 160, Pt = (e, r) => e.length === r.length && e.every((a, c) => a ===
31
35
  if (r)
32
36
  return Number(r[1]);
33
37
  }
34
- }, Pe = (e) => {
35
- const r = Se(e.width);
38
+ }, Je = (e) => {
39
+ const r = we(e.width);
36
40
  return !(e.title === "" || e.title == null) && r !== void 0 && typeof e.minWidth == "number" && e.minWidth < r ? e.minWidth : void 0;
37
- }, Jt = (e) => e.reduce((r, a) => {
38
- const c = Pe(a) ?? Se(a.width);
39
- return c !== void 0 ? r + c : typeof a.minWidth == "number" ? r + a.minWidth : r + vt;
40
- }, 0), Yt = (e) => (e.title === "" || e.title == null) && Se(e.width) !== void 0, qt = (e) => {
41
- const r = [...e].reverse().findIndex((h) => !Yt(h)), a = r === -1 ? 0 : e.length - r, c = /* @__PURE__ */ new Map(), R = e.reduceRight(
42
- (h, w, b) => {
43
- const u = Pe(w) ?? Se(w.width);
44
- return !(w.fixed === "right" || b >= a) || u === void 0 ? h : (c.set(w.key, h.right), { right: h.right + u, edge: w.key });
41
+ }, ir = (e) => e.reduce((r, l) => {
42
+ const c = Je(l) ?? we(l.width);
43
+ return c !== void 0 ? r + c : typeof l.minWidth == "number" ? r + l.minWidth : r + kt;
44
+ }, 0), ar = (e) => (e.title === "" || e.title == null) && we(e.width) !== void 0, lr = (e) => {
45
+ const r = [...e].reverse().findIndex((u) => !ar(u)), l = r === -1 ? 0 : e.length - r, c = /* @__PURE__ */ new Map(), C = e.reduceRight(
46
+ (u, S, x) => {
47
+ const p = Je(S) ?? we(S.width);
48
+ return !(S.fixed === "right" || x >= l) || p === void 0 ? u : (c.set(S.key, u.right), { right: u.right + p, edge: S.key });
45
49
  },
46
50
  { right: 0, edge: void 0 }
47
51
  );
48
- return { offsets: c, edgeKey: R.edge, extent: R.right };
49
- }, Qt = { overflowX: "auto", scrollbarWidth: "none" }, Vt = {
52
+ return { offsets: c, edgeKey: C.edge, extent: C.right };
53
+ }, sr = { overflowX: "auto", scrollbarWidth: "none" }, or = {
50
54
  position: "sticky",
51
55
  left: 0,
52
56
  width: "100%"
53
- }, Zt = { offsets: /* @__PURE__ */ new Map(), edgeKey: void 0, extent: 0 }, Ae = (e) => `color-mix(in srgb, var(--malachite-card-shadow, rgba(0, 0, 0, 0.1)) ${e}%, transparent)`, Xt = {
57
+ }, dr = { offsets: /* @__PURE__ */ new Map(), edgeKey: void 0, extent: 0 }, Pe = (e) => `color-mix(in srgb, var(--malachite-card-shadow, rgba(0, 0, 0, 0.1)) ${e}%, transparent)`, cr = {
54
58
  position: "absolute",
55
59
  top: 0,
56
60
  bottom: 0,
57
61
  right: 0,
58
62
  width: 24,
59
63
  pointerEvents: "none",
60
- backgroundImage: `linear-gradient(to left, ${Ae(45)}, ${Ae(18)} 30%, ${Ae(5)} 65%, transparent)`
61
- }, Kt = (e, r) => e === void 0 ? {} : {
64
+ backgroundImage: `linear-gradient(to left, ${Pe(45)}, ${Pe(18)} 30%, ${Pe(5)} 65%, transparent)`
65
+ }, fr = (e, r) => e === void 0 ? {} : {
62
66
  position: "sticky",
63
67
  right: e,
64
68
  zIndex: 1,
65
69
  height: "auto",
66
70
  ...r === "row" ? { backgroundColor: "inherit", backgroundImage: "inherit" } : { backgroundColor: r }
67
- }, ot = (e) => `linear-gradient(${e}, ${e})`, en = (e, r) => {
71
+ }, pt = (e) => `linear-gradient(${e}, ${e})`, hr = (e, r) => {
68
72
  if (!e && !r)
69
73
  return {};
70
- const a = [
71
- r ? ot(Be) : void 0,
72
- e ? ot(`var(--malachite-table-row-variant-${e}-background)`) : void 0
73
- ].filter(He);
74
+ const l = [
75
+ r ? pt(He) : void 0,
76
+ e ? pt(`var(--malachite-table-row-variant-${e}-background)`) : void 0
77
+ ].filter(qe);
74
78
  return {
75
79
  backgroundColor: e ? "var(--malachite-table-background, #f7f7f7)" : "var(--malachite-table-row-background, #fff)",
76
- backgroundImage: a.join(", ")
80
+ backgroundImage: l.join(", ")
77
81
  };
78
- }, He = (e) => typeof e == "string", Ue = "text-[var(--malachite-text-primary,#0a0a0a)]", je = "text-[var(--malachite-text-dimmed,#a1a1a1)]", se = (e) => ({
82
+ }, qe = (e) => typeof e == "string", Ge = "text-[var(--malachite-text-primary,#0a0a0a)]", Ye = "text-[var(--malachite-text-dimmed,#a1a1a1)]", de = (e) => ({
79
83
  small: "text-[length:var(--malachite-font-size-small)]",
80
84
  medium: "text-[length:var(--malachite-font-size-medium)]",
81
85
  large: "text-[length:var(--malachite-font-size-large)]"
82
- })[e], dt = {
86
+ })[e], gt = {
83
87
  borderBottom: "1px solid var(--malachite-card-border, #e8e8e8)"
84
- }, ct = (e, r) => {
88
+ }, vt = (e, r) => {
85
89
  e && r && r.scrollLeft !== e.scrollLeft && (r.scrollLeft = e.scrollLeft);
86
- }, tn = 56, nn = 44, rn = 8, ln = 10, le = 8, an = "var(--malachite-radius-xl, 12px)", ae = 4, sn = "--malachite-ctx-table-surround", on = () => /* @__PURE__ */ n(
87
- Ft,
90
+ }, ur = 56, pr = 44, gr = 8, vr = 10, br = "--malachite-ctx-table-surround", je = "var(--malachite-table-header-background, #f7f7f7)", xr = () => /* @__PURE__ */ n(
91
+ Yt,
88
92
  {
89
- radius: an,
90
- surround: `var(${sn}, var(--malachite-card-background, #ffffff))`
93
+ radius: Kt,
94
+ surround: `var(${br}, var(--malachite-card-background, #ffffff))`
91
95
  }
92
- ), dn = ({
96
+ ), mr = ({
93
97
  records: e,
94
98
  startIndex: r,
95
- scrollElement: a,
99
+ scrollElement: l,
96
100
  estimateRowHeight: c,
97
- style: R,
98
- renderRow: h,
99
- registerHandle: w,
100
- cardKey: b,
101
- rovingIndex: u
101
+ style: C,
102
+ renderRow: u,
103
+ registerHandle: S,
104
+ cardKey: x,
105
+ rovingIndex: p
102
106
  }) => {
103
- const D = B(null), [T, M] = V(0);
104
- ft(() => {
105
- const E = D.current;
106
- if (!E || !a)
107
+ const D = U(null), [M, W] = V(0);
108
+ bt(() => {
109
+ const _ = D.current;
110
+ if (!_ || !l)
107
111
  return;
108
- const O = () => {
109
- const f = E.getBoundingClientRect().top - a.getBoundingClientRect().top + a.scrollTop;
110
- M((J) => Math.abs(J - f) < 1 ? J : f);
112
+ const P = () => {
113
+ const R = _.getBoundingClientRect().top - l.getBoundingClientRect().top + l.scrollTop;
114
+ W((Y) => Math.abs(Y - R) < 1 ? Y : R);
111
115
  };
112
- if (O(), typeof ResizeObserver > "u")
116
+ if (P(), typeof ResizeObserver > "u")
113
117
  return;
114
- const ne = new ResizeObserver(O);
115
- let W = E;
116
- for (; W && W !== a; ) {
117
- let f = W.previousElementSibling;
118
- for (; f; )
119
- ne.observe(f), f = f.previousElementSibling;
120
- const J = W.parentElement;
121
- if (J)
122
- W = J;
118
+ const j = new ResizeObserver(P);
119
+ let T = _;
120
+ for (; T && T !== l; ) {
121
+ let R = T.previousElementSibling;
122
+ for (; R; )
123
+ j.observe(R), R = R.previousElementSibling;
124
+ const Y = T.parentElement;
125
+ if (Y)
126
+ T = Y;
123
127
  else {
124
- const X = W.getRootNode();
125
- W = X instanceof ShadowRoot ? X.host : null;
128
+ const ie = T.getRootNode();
129
+ T = ie instanceof ShadowRoot ? ie.host : null;
126
130
  }
127
131
  }
128
- return () => ne.disconnect();
129
- }, [a, e.length, r]);
130
- const _ = Ot({
132
+ return () => j.disconnect();
133
+ }, [l, e.length, r]);
134
+ const E = Bt({
131
135
  count: e.length,
132
136
  // State, not a ref: an ancestor's ref is not attached when this child's layout effects
133
137
  // run, so a ref would leave the virtualizer without a scroll element.
134
- getScrollElement: () => a,
138
+ getScrollElement: () => l,
135
139
  estimateSize: () => c,
136
- overscan: rn,
137
- scrollMargin: T
140
+ overscan: gr,
141
+ scrollMargin: M
138
142
  });
139
- ee(() => {
140
- if (w)
141
- return w(b, {
143
+ te(() => {
144
+ if (S)
145
+ return S(x, {
142
146
  startIndex: r,
143
147
  count: e.length,
144
- scrollToIndex: (E) => _.scrollToIndex(E, { align: "center" })
145
- }), () => w(b, null);
146
- }, [w, b, r, e.length, _]);
147
- const C = _.getVirtualItems(), te = _.getTotalSize(), G = u >= r && u < r + e.length && C.length > 0 ? Math.min(
148
- Math.max(u, r + C[0].index),
149
- r + C[C.length - 1].index
150
- ) : u, U = C.length > 0 ? C[0].start - T : 0, j = C.length > 0 ? te - (C[C.length - 1].end - T) : 0;
151
- return /* @__PURE__ */ k("div", { ref: D, className: "flex flex-col w-full", style: R, children: [
152
- U > 0 && /* @__PURE__ */ n("div", { "aria-hidden": "true", style: { height: U, flexShrink: 0 } }),
153
- C.map(
154
- (E) => h(
155
- e[E.index],
156
- r + E.index,
157
- E.index === e.length - 1,
158
- E.index === 0,
159
- { measureRef: _.measureElement, index: E.index },
160
- G
148
+ scrollToIndex: (_) => E.scrollToIndex(_, { align: "center" })
149
+ }), () => S(x, null);
150
+ }, [S, x, r, e.length, E]);
151
+ const $ = E.getVirtualItems(), re = E.getTotalSize(), ne = p >= r && p < r + e.length && $.length > 0 ? Math.min(
152
+ Math.max(p, r + $[0].index),
153
+ r + $[$.length - 1].index
154
+ ) : p, X = $.length > 0 ? $[0].start - M : 0, K = $.length > 0 ? re - ($[$.length - 1].end - M) : 0;
155
+ return /* @__PURE__ */ y("div", { ref: D, className: "flex flex-col w-full", style: C, children: [
156
+ X > 0 && /* @__PURE__ */ n("div", { "aria-hidden": "true", style: { height: X, flexShrink: 0 } }),
157
+ $.map(
158
+ (_) => u(
159
+ e[_.index],
160
+ r + _.index,
161
+ _.index === e.length - 1,
162
+ _.index === 0,
163
+ { measureRef: E.measureElement, index: _.index },
164
+ ne
161
165
  )
162
166
  ),
163
- j > 0 && /* @__PURE__ */ n("div", { "aria-hidden": "true", style: { height: j, flexShrink: 0 } })
167
+ K > 0 && /* @__PURE__ */ n("div", { "aria-hidden": "true", style: { height: K, flexShrink: 0 } })
164
168
  ] });
165
- }, cn = (e, r) => {
166
- const a = r ? tn : 0;
167
- return typeof e == "number" ? `${Math.max(0, e - a)}px` : `calc(${e} - ${a}px)`;
168
- }, oe = (e) => {
169
+ }, yr = (e, r) => {
170
+ const l = r ? ur : 0;
171
+ return typeof e == "number" ? `${Math.max(0, e - l)}px` : `calc(${e} - ${l}px)`;
172
+ }, ce = (e) => {
169
173
  const r = e.width;
170
174
  if (r == null)
171
175
  return {};
172
- const a = typeof r == "number" ? `${r}px` : r, c = Pe(e);
173
- return c === void 0 ? { flexBasis: a, maxWidth: a } : { flexBasis: a, maxWidth: a, minWidth: c, flexShrink: 1 };
174
- }, Ge = (e) => {
176
+ const l = typeof r == "number" ? `${r}px` : r, c = Je(e);
177
+ return c === void 0 ? { flexBasis: l, maxWidth: l } : { flexBasis: l, maxWidth: l, minWidth: c, flexShrink: 1 };
178
+ }, Qe = (e) => {
175
179
  const r = e.width;
176
180
  if (r == null)
177
181
  return {};
178
- const a = typeof r == "number" ? `${r}px` : r;
179
- return { width: a, flexBasis: a };
180
- }, fn = (e) => e === "asc" ? "ascending" : e === "desc" ? "descending" : "none", Z = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-start", hn = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-between", de = (e) => e === "center" ? "text-center" : e === "right" ? "text-right" : "text-left", bt = (e) => e ? Z(e) : "justify-end", ye = ({ info: e }) => /* @__PURE__ */ n(At, { text: e, placement: "top", children: /* @__PURE__ */ n(Mt, { size: 13, className: "shrink-0 text-[var(--malachite-text-secondary,#bbb)]" }) }), xt = (e, r) => ({
182
+ const l = typeof r == "number" ? `${r}px` : r;
183
+ return { width: l, flexBasis: l };
184
+ }, Sr = (e) => e === "asc" ? "ascending" : e === "desc" ? "descending" : "none", Z = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-start", kr = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-between", fe = (e) => e === "center" ? "text-center" : e === "right" ? "text-right" : "text-left", wt = (e) => e ? Z(e) : "justify-end", ke = ({ info: e }) => /* @__PURE__ */ n(Jt, { text: e, placement: "top", children: /* @__PURE__ */ n(jt, { size: 13, className: "shrink-0 text-[var(--malachite-text-secondary,#bbb)]" }) }), wr = { ascend: "asc", descend: "desc" }, $r = (e) => {
185
+ const r = e.find((l) => l.sorter && l.defaultSortOrder);
186
+ return r != null && r.defaultSortOrder ? { key: r.key, direction: wr[r.defaultSortOrder] } : null;
187
+ }, $t = (e, r) => ({
181
188
  type: "button",
182
189
  onClick: r,
183
190
  "aria-label": typeof e == "string" ? `Sort by ${e}` : "Sort column"
184
- }), un = ({
191
+ }), Nr = ({
185
192
  column: e,
186
193
  record: r,
187
- index: a,
194
+ index: l,
188
195
  size: c,
189
- paddingYClass: R,
190
- bordered: h,
191
- isFirstRow: w,
192
- isLastRow: b,
193
- isFirstColumn: u,
196
+ paddingYClass: C,
197
+ bordered: u,
198
+ isFirstRow: S,
199
+ isLastRow: x,
200
+ isFirstColumn: p,
194
201
  isLastColumn: D,
195
- variantBackground: T,
196
- showSelectedAccent: M,
197
- isSelected: _
202
+ variantBackground: M,
203
+ showSelectedAccent: W,
204
+ isSelected: E
198
205
  }) => {
199
- const C = r[e.dataIndex], te = e.render ? e.render(C, r, a) : C == null ? "" : String(C), q = e.ellipsis && He(C) ? C : void 0;
206
+ const $ = r[e.dataIndex], re = e.render ? e.render($, r, l) : $ == null ? "" : String($), G = e.ellipsis && qe($) ? $ : void 0;
200
207
  return /* @__PURE__ */ n(
201
208
  "td",
202
209
  {
203
210
  className: `
204
- table-cell px-4 ${R} ${se(c)}
211
+ table-cell px-4 ${C} ${de(c)}
205
212
  ${e.ellipsis ? "truncate overflow-hidden whitespace-nowrap" : ""}
206
- ${h ? "table-cell-bordered" : ""}
207
- ${h && w ? "table-cell-bordered-top" : ""}
208
- ${h && u ? "table-cell-bordered-left" : ""}
209
- ${h && D ? "table-cell-bordered-right" : ""}
210
- ${h && u && w ? "rounded-tl-lg" : ""}
211
- ${h && D && w ? "rounded-tr-lg" : ""}
212
- ${h && u && b ? "rounded-bl-lg" : ""}
213
- ${h && D && b ? "rounded-br-lg" : ""}
214
- ${de(e.align)}
213
+ ${u ? "table-cell-bordered" : ""}
214
+ ${u && S ? "table-cell-bordered-top" : ""}
215
+ ${u && p ? "table-cell-bordered-left" : ""}
216
+ ${u && D ? "table-cell-bordered-right" : ""}
217
+ ${u && p && S ? "rounded-tl-lg" : ""}
218
+ ${u && D && S ? "rounded-tr-lg" : ""}
219
+ ${u && p && x ? "rounded-bl-lg" : ""}
220
+ ${u && D && x ? "rounded-br-lg" : ""}
221
+ ${fe(e.align)}
215
222
  `,
216
223
  style: {
217
224
  width: e.width,
218
- backgroundColor: T ?? // Mirror the row's background, or the tint composites over the wrong opaque
225
+ backgroundColor: M ?? // Mirror the row's background, or the tint composites over the wrong opaque
219
226
  // base — they differ in dark mode.
220
- (_ ? h ? "var(--malachite-table-borderedRow-background, #fff)" : "var(--malachite-table-row-background, #fff)" : void 0),
227
+ (E ? u ? "var(--malachite-table-borderedRow-background, #fff)" : "var(--malachite-table-row-background, #fff)" : void 0),
221
228
  // Its own layer, so the tint composites over the cell instead of replacing it.
222
- backgroundImage: _ ? `linear-gradient(${Be}, ${Be})` : void 0,
229
+ backgroundImage: E ? `linear-gradient(${He}, ${He})` : void 0,
223
230
  // Content pinning its own colour follows via the channel below.
224
- color: _ ? gt : "var(--malachite-table-row-foreground)",
225
- ..._ ? pt : {},
231
+ color: E ? St : "var(--malachite-table-row-foreground)",
232
+ ...E ? yt : {},
226
233
  // Inset box-shadow, not `ring-*`: --tw-ring-* silently doesn't paint in a shadow root.
227
- boxShadow: M ? `inset 2px 0 0 ${ut}` : void 0,
228
- borderBottom: h ? void 0 : b ? "none" : "1px solid var(--malachite-table-row-border)"
234
+ boxShadow: W ? `inset 2px 0 0 ${mt}` : void 0,
235
+ borderBottom: u ? void 0 : x ? "none" : "1px solid var(--malachite-table-row-border)"
229
236
  },
230
- title: q,
231
- children: te
237
+ title: G,
238
+ children: re
232
239
  }
233
240
  );
234
- }, pn = ({
241
+ }, Cr = ({
235
242
  column: e,
236
243
  sortDirection: r,
237
- onSort: a,
244
+ onSort: l,
238
245
  cellStyle: c
239
246
  }) => {
240
- const R = !!e.sorter, h = e.title === "" || e.title == null;
241
- if (h && e.width !== void 0)
247
+ const C = !!e.sorter, u = e.title === "" || e.title == null;
248
+ if (u && e.width !== void 0)
242
249
  return /* @__PURE__ */ n(
243
250
  "div",
244
251
  {
245
252
  className: "h-full shrink-0",
246
253
  style: {
247
- ...Ge(e),
254
+ ...Qe(e),
248
255
  ...c
249
256
  }
250
257
  }
251
258
  );
252
- if (h)
259
+ if (u)
253
260
  return /* @__PURE__ */ n(
254
261
  "div",
255
262
  {
256
263
  className: "flex flex-[1_0_0] h-full min-w-0",
257
264
  style: {
258
- ...oe(e),
265
+ ...ce(e),
259
266
  ...c
260
267
  }
261
268
  }
262
269
  );
263
- const b = typeof e.title == "string" ? /* @__PURE__ */ n("p", { className: "font-medium text-[13px] text-[var(--malachite-text-primary,#0a0a0a)] tracking-[0.13px] whitespace-nowrap truncate", children: e.title }) : e.title, u = /* @__PURE__ */ n(
264
- ht,
270
+ const x = typeof e.title == "string" ? /* @__PURE__ */ n("p", { className: "font-medium text-[13px] text-[var(--malachite-text-primary,#0a0a0a)] tracking-[0.13px] whitespace-nowrap truncate", children: e.title }) : e.title, p = /* @__PURE__ */ n(
271
+ xt,
265
272
  {
266
273
  size: 13,
267
- className: `shrink-0 transition-transform ${r ? Ue : je} ${r === "asc" ? "rotate-180" : ""}`
274
+ className: `shrink-0 transition-transform ${r ? Ge : Ye} ${r === "asc" ? "rotate-180" : ""}`
268
275
  }
269
276
  );
270
- return R ? /* @__PURE__ */ n(
277
+ return C ? /* @__PURE__ */ n(
271
278
  "div",
272
279
  {
273
280
  className: "flex flex-[1_0_0] min-w-0 overflow-hidden",
274
- style: { ...oe(e), ...c },
275
- children: /* @__PURE__ */ k(
281
+ style: { ...ce(e), ...c },
282
+ children: /* @__PURE__ */ y(
276
283
  "button",
277
284
  {
278
- ...xt(e.title, a),
279
- className: `flex flex-1 items-center ${hn(e.align)} gap-1 min-w-0 px-4 py-3 cursor-pointer appearance-none bg-transparent border-0 ${de(e.align)}`,
285
+ ...$t(e.title, l),
286
+ className: `flex flex-1 items-center ${kr(e.align)} gap-1 min-w-0 px-4 py-3 cursor-pointer appearance-none bg-transparent border-0 ${fe(e.align)}`,
280
287
  children: [
281
- /* @__PURE__ */ k("div", { className: "flex items-center gap-1 min-w-0", children: [
282
- b,
283
- e.info && /* @__PURE__ */ n(ye, { info: e.info })
288
+ /* @__PURE__ */ y("div", { className: "flex items-center gap-1 min-w-0", children: [
289
+ x,
290
+ e.info && /* @__PURE__ */ n(ke, { info: e.info })
284
291
  ] }),
285
- u
292
+ p
286
293
  ]
287
294
  }
288
295
  )
@@ -292,461 +299,478 @@ const vt = 160, Pt = (e, r) => e.length === r.length && e.every((a, c) => a ===
292
299
  {
293
300
  className: `flex flex-[1_0_0] items-center ${Z(e.align)} min-w-0 overflow-hidden px-4 py-3`,
294
301
  style: {
295
- ...oe(e),
302
+ ...ce(e),
296
303
  ...c
297
304
  },
298
- children: /* @__PURE__ */ k("div", { className: "flex items-center gap-1 min-w-0", children: [
299
- b,
300
- e.info && /* @__PURE__ */ n(ye, { info: e.info })
305
+ children: /* @__PURE__ */ y("div", { className: "flex items-center gap-1 min-w-0", children: [
306
+ x,
307
+ e.info && /* @__PURE__ */ n(ke, { info: e.info })
301
308
  ] })
302
309
  }
303
310
  );
304
- }, gn = ({
311
+ }, Er = ({
305
312
  column: e,
306
313
  record: r,
307
- index: a,
314
+ index: l,
308
315
  size: c,
309
- paddingYClass: R,
310
- isSelected: h = !1,
311
- cellStyle: w
316
+ paddingYClass: C,
317
+ isSelected: u = !1,
318
+ cellStyle: S
312
319
  }) => {
313
- const b = r[e.dataIndex], u = e.render ? e.render(b, r, a) : b == null ? "" : String(b), T = (e.title === "" || e.title == null) && e.width !== void 0, M = He(b) && b.length > 0, _ = h ? {
314
- color: gt,
315
- ...pt
320
+ const x = r[e.dataIndex], p = e.render ? e.render(x, r, l) : x == null ? "" : String(x), M = (e.title === "" || e.title == null) && e.width !== void 0, W = qe(x) && x.length > 0, E = u ? {
321
+ color: St,
322
+ ...yt
316
323
  } : {};
317
- if (T)
324
+ if (M)
318
325
  return /* @__PURE__ */ n(
319
326
  "div",
320
327
  {
321
- className: `flex items-center ${bt(e.align)} shrink-0 overflow-hidden px-4 ${R}`,
328
+ className: `flex items-center ${wt(e.align)} shrink-0 overflow-hidden px-4 ${C}`,
322
329
  style: {
323
- ...Ge(e),
324
- ..._,
325
- ...w
330
+ ...Qe(e),
331
+ ...E,
332
+ ...S
326
333
  },
327
- children: u
334
+ children: p
328
335
  }
329
336
  );
330
- const C = !e.render && M ? /* @__PURE__ */ n(Bt, { text: b, children: u }) : u;
337
+ const $ = !e.render && W ? /* @__PURE__ */ n(qt, { text: x, children: p }) : p;
331
338
  return /* @__PURE__ */ n(
332
339
  "div",
333
340
  {
334
- className: `flex flex-[1_0_0] items-center min-w-0 overflow-hidden px-4 ${R} ${se(c)} ${Z(e.align)}`,
341
+ className: `flex flex-[1_0_0] items-center min-w-0 overflow-hidden px-4 ${C} ${de(c)} ${Z(e.align)}`,
335
342
  style: {
336
- ...oe(e),
337
- ..._,
338
- ...w
343
+ ...ce(e),
344
+ ...E,
345
+ ...S
339
346
  },
340
- children: C
347
+ children: $
341
348
  }
342
349
  );
343
- }, In = ({
350
+ }, Yr = ({
344
351
  columns: e,
345
352
  data: r,
346
- loading: a = !1,
353
+ loading: l = !1,
347
354
  error: c = !1,
348
- errorTitle: R = "Data unavailable",
349
- errorSubTitle: h = "There was an issue retrieving the data. Please try again.",
350
- emptyTitle: w = "No data",
351
- emptySubTitle: b = "",
352
- bordered: u = !1,
355
+ errorTitle: C = "Data unavailable",
356
+ errorSubTitle: u = "There was an issue retrieving the data. Please try again.",
357
+ emptyTitle: S = "No data",
358
+ emptySubTitle: x = "",
359
+ bordered: p = !1,
353
360
  showHeader: D = !0,
354
- rowKey: T = "key",
355
- scrollHeight: M,
356
- size: _ = "small",
357
- rowDensity: C = "default",
358
- layout: te = "auto",
359
- headerVariant: q = "inline",
360
- rowClassName: G,
361
- rowVariant: U,
361
+ rowKey: M = "key",
362
+ scrollHeight: W,
363
+ size: E = "small",
364
+ rowDensity: $ = "default",
365
+ layout: re = "auto",
366
+ headerVariant: G = "inline",
367
+ title: ne,
368
+ subtitle: X,
369
+ extra: K,
370
+ rowClassName: _,
371
+ rowVariant: P,
362
372
  onRow: j,
363
- onClickRow: E,
364
- selectedRowKey: O,
365
- scrollSelectedIntoView: ne = !0,
366
- rowSelection: W,
367
- pagination: f,
368
- className: J = "",
369
- style: X,
370
- stickyHeaderTop: ke,
371
- scrollX: P = !1,
372
- rowSection: we,
373
- renderSectionDivider: $e,
374
- onVisibleOrderChange: Ne,
375
- virtual: mt = !1,
376
- virtualRowHeightEstimate: yt,
377
- virtualScrollElement: ce = null
373
+ onClickRow: T,
374
+ selectedRowKey: R,
375
+ scrollSelectedIntoView: Y = !0,
376
+ rowSelection: ie,
377
+ pagination: b,
378
+ className: Ve = "",
379
+ style: $e,
380
+ stickyHeaderTop: Ne,
381
+ scrollX: H = !1,
382
+ rowSection: Ce,
383
+ renderSectionDivider: Ee,
384
+ onVisibleOrderChange: Re,
385
+ virtual: Nt = !1,
386
+ virtualRowHeightEstimate: Ct,
387
+ virtualScrollElement: he = null
378
388
  }) => {
379
- const re = C === "compact" ? "py-1.5" : "py-3", [I, St] = V(null), Je = B(null), Ce = B(null), ie = B(null), Ee = B(null), Re = B(/* @__PURE__ */ new Map()), kt = We(
389
+ const ae = $ === "compact" ? "py-1.5" : "py-3", [O, Et] = V(() => $r(e)), Ze = U(null), _e = U(null), le = U(null), Ie = U(null), Oe = U(/* @__PURE__ */ new Map()), Rt = Be(
380
390
  (t, i) => {
381
- i ? Re.current.set(t, i) : Re.current.delete(t);
391
+ i ? Oe.current.set(t, i) : Oe.current.delete(t);
382
392
  },
383
393
  []
384
- ), Q = zt(), [wt, _e] = V(0), Y = mt && q === "detached", $t = yt ?? nn, [fe, Nt] = V(null), Ct = We((t) => {
385
- ie.current = t, t && Nt((i) => i === t ? i : t);
386
- }, []), Ie = Y ? ce ?? fe : null, Ye = P ? Jt(e) : 0, he = P && q === "detached" ? qt(e) : Zt, ue = he.edgeKey !== void 0, [Et, qe] = V(!1), [Rt, Qe] = V(0), pe = We(() => {
387
- const t = ie.current;
388
- qe(
394
+ ), q = Ut(), [_t, Te] = V(0), J = Nt && G === "detached", It = Ct ?? pr, [ue, Ot] = V(null), Tt = Be((t) => {
395
+ le.current = t, t && Ot((i) => i === t ? i : t);
396
+ }, []), De = J ? he ?? ue : null, Xe = H ? ir(e) : 0, pe = H && G === "detached" ? lr(e) : dr, ge = pe.edgeKey !== void 0, [Dt, Ke] = V(!1), [Mt, et] = V(0), ve = Be(() => {
397
+ const t = le.current;
398
+ Ke(
389
399
  t !== null && t.scrollLeft + t.clientWidth < t.scrollWidth - 1
390
- ), Qe(t === null ? 0 : t.offsetWidth - t.clientWidth);
400
+ ), et(t === null ? 0 : t.offsetWidth - t.clientWidth);
391
401
  }, []);
392
- ee(() => {
393
- if (!ue || !fe) {
394
- qe(!1), Qe(0);
402
+ te(() => {
403
+ if (!ge || !ue) {
404
+ Ke(!1), et(0);
395
405
  return;
396
406
  }
397
- if (pe(), typeof ResizeObserver > "u")
407
+ if (ve(), typeof ResizeObserver > "u")
398
408
  return;
399
- const t = new ResizeObserver(pe);
400
- return t.observe(fe), () => t.disconnect();
401
- }, [ue, fe, Ye, pe]);
402
- const De = !(Y && ce), H = q === "detached" && ke !== void 0 && D && !M && (!Y || !De), Ve = O != null, [Te, Ze] = V(0);
403
- ee(() => {
404
- const t = Je.current;
405
- if (!t || !H || !Ve || typeof ResizeObserver > "u") {
406
- Ze(0);
409
+ const t = new ResizeObserver(ve);
410
+ return t.observe(ue), () => t.disconnect();
411
+ }, [ge, ue, Xe, ve]);
412
+ const Me = !(J && he), A = G === "detached" && Ne !== void 0 && D && !W && (!J || !Me), tt = R != null, [ze, rt] = V(0);
413
+ te(() => {
414
+ const t = Ze.current;
415
+ if (!t || !A || !tt || typeof ResizeObserver > "u") {
416
+ rt(0);
407
417
  return;
408
418
  }
409
- const i = new ResizeObserver((p) => {
410
- var g, m;
411
- const s = p[0], x = ((m = (g = s == null ? void 0 : s.borderBoxSize) == null ? void 0 : g[0]) == null ? void 0 : m.blockSize) ?? (s == null ? void 0 : s.contentRect.height) ?? 0;
412
- Ze(
413
- ($) => Math.abs($ - x) < 1 ? $ : x
419
+ const i = new ResizeObserver((f) => {
420
+ var h, v;
421
+ const s = f[0], g = ((v = (h = s == null ? void 0 : s.borderBoxSize) == null ? void 0 : h[0]) == null ? void 0 : v.blockSize) ?? (s == null ? void 0 : s.contentRect.height) ?? 0;
422
+ rt(
423
+ (k) => Math.abs(k - g) < 1 ? k : g
414
424
  );
415
425
  });
416
426
  return i.observe(t), () => i.disconnect();
417
- }, [H, Ve]);
418
- const _t = H ? (ke ?? 0) + Te : void 0, { sortedData: z, sectionDividers: Oe } = rt(() => {
419
- const t = (g) => {
420
- if (!I) return g;
421
- const m = e.find((o) => o.key === I.key);
422
- if (!m) return g;
423
- if (typeof m.sorter == "function") {
424
- const o = [...g].sort(m.sorter);
425
- return I.direction === "asc" ? o : o.reverse();
427
+ }, [A, tt]);
428
+ const zt = A ? (Ne ?? 0) + ze : void 0, { sortedData: z, sectionDividers: Le } = ot(() => {
429
+ const t = (h) => {
430
+ if (!O) return h;
431
+ const v = e.find((F) => F.key === O.key);
432
+ if (!v || v.sorter === "server") return h;
433
+ if (typeof v.sorter == "function") {
434
+ const F = [...h].sort(v.sorter);
435
+ return O.direction === "asc" ? F : F.reverse();
426
436
  }
427
- const $ = m.dataIndex ?? I.key;
428
- return [...g].sort((o, d) => {
429
- const l = o[$], S = d[$];
430
- return l < S ? I.direction === "asc" ? -1 : 1 : l > S ? I.direction === "asc" ? 1 : -1 : 0;
437
+ const k = v.dataIndex ?? O.key;
438
+ return [...h].sort((F, o) => {
439
+ const a = F[k], d = o[k];
440
+ return a < d ? O.direction === "asc" ? -1 : 1 : a > d ? O.direction === "asc" ? 1 : -1 : 0;
431
441
  });
432
442
  };
433
- if (!we)
443
+ if (!Ce)
434
444
  return {
435
445
  sortedData: t(r),
436
446
  sectionDividers: /* @__PURE__ */ new Map()
437
447
  };
438
- const i = [], p = /* @__PURE__ */ new Map();
439
- for (const g of r) {
440
- const m = we(g);
441
- let $ = p.get(m);
442
- $ === void 0 && ($ = i.length, p.set(m, $), i.push({ key: m, records: [] })), i[$].records.push(g);
448
+ const i = [], f = /* @__PURE__ */ new Map();
449
+ for (const h of r) {
450
+ const v = Ce(h);
451
+ let k = f.get(v);
452
+ k === void 0 && (k = i.length, f.set(v, k), i.push({ key: v, records: [] })), i[k].records.push(h);
443
453
  }
444
- const s = [], x = /* @__PURE__ */ new Map();
445
- for (const g of i) {
446
- const m = t(g.records);
447
- x.set(s.length, { key: g.key, records: m }), s.push(...m);
454
+ const s = [], g = /* @__PURE__ */ new Map();
455
+ for (const h of i) {
456
+ const v = t(h.records);
457
+ g.set(s.length, { key: h.key, records: v }), s.push(...v);
448
458
  }
449
- return { sortedData: s, sectionDividers: x };
450
- }, [r, I, e, we]), Xe = (t) => {
451
- St((i) => (i == null ? void 0 : i.key) === t ? i.direction === "asc" ? { key: t, direction: "desc" } : null : { key: t, direction: "asc" });
452
- }, ze = (t, i) => typeof T == "function" ? T(t) : String(t[T] ?? i), Ke = typeof T == "function" ? null : T, et = B(void 0), ge = B(void 0);
453
- ee(() => {
454
- if (!Ne)
459
+ return { sortedData: s, sectionDividers: g };
460
+ }, [r, O, e, Ce]), Lt = (t) => {
461
+ Et((i) => (i == null ? void 0 : i.key) === t ? i.direction === "asc" ? { key: t, direction: "desc" } : null : { key: t, direction: "asc" });
462
+ }, nt = (t, i) => (f) => {
463
+ var s, g, h;
464
+ Lt(t.key), (h = (g = (s = t.onHeaderCell) == null ? void 0 : s.call(t, t, i)) == null ? void 0 : g.onClick) == null || h.call(g, f);
465
+ }, We = (t, i) => typeof M == "function" ? M(t) : String(t[M] ?? i), it = typeof M == "function" ? null : M, at = U(void 0), be = U(void 0);
466
+ te(() => {
467
+ if (!Re)
455
468
  return;
456
- ge.current ?? (ge.current = { ids: /* @__PURE__ */ new WeakMap(), next: 0 });
457
- const t = Gt(z, T, ge.current), i = et.current;
458
- i && Pt(i, t) || (et.current = t, Ne(z));
459
- }, [z, Ke, Ne]);
460
- const K = Math.min(wt, Math.max(0, z.length - 1)), L = rt(() => {
461
- if (O == null)
469
+ be.current ?? (be.current = { ids: /* @__PURE__ */ new WeakMap(), next: 0 });
470
+ const t = nr(z, M, be.current), i = at.current;
471
+ i && tr(i, t) || (at.current = t, Re(z));
472
+ }, [z, it, Re]);
473
+ const ee = Math.min(_t, Math.max(0, z.length - 1)), L = ot(() => {
474
+ if (R == null)
462
475
  return -1;
463
- const t = String(O);
464
- return z.findIndex((i, p) => ze(i, p) === t);
465
- }, [O, z, Ke]);
466
- ee(() => {
467
- L >= 0 && _e(L);
476
+ const t = String(R);
477
+ return z.findIndex((i, f) => We(i, f) === t);
478
+ }, [R, z, it]);
479
+ te(() => {
480
+ L >= 0 && Te(L);
468
481
  }, [L]);
469
- const Le = B(void 0);
470
- ee(() => {
471
- if (O == null) {
472
- Le.current = void 0;
482
+ const Fe = U(void 0);
483
+ te(() => {
484
+ if (R == null) {
485
+ Fe.current = void 0;
473
486
  return;
474
487
  }
475
- if (!ne || L < 0)
488
+ if (!Y || L < 0)
476
489
  return;
477
- const t = Le.current;
478
- if (t && t.key === O && t.index === L || a || c || Y && !Ie)
490
+ const t = Fe.current;
491
+ if (t && t.key === R && t.index === L || l || c || J && !De)
479
492
  return;
480
- const i = Ee.current;
493
+ const i = Ie.current;
481
494
  if (!i)
482
495
  return;
483
- const p = H && Te === 0, s = (l) => i.querySelector(
484
- `[data-table-id="${Q}"][data-row-index="${l}"]`
485
- ), x = (l) => {
486
- const S = ie.current, v = ce, F = S == null ? void 0 : S.scrollLeft, A = v == null ? void 0 : v.scrollLeft;
487
- l.scrollIntoView({ block: "nearest", inline: "nearest" }), S && F !== void 0 && (S.scrollLeft = F), v && A !== void 0 && (v.scrollLeft = A), p || (Le.current = { key: O, index: L });
488
- }, g = s(L);
489
- if (g) {
490
- x(g);
496
+ const f = A && ze === 0, s = (a) => i.querySelector(
497
+ `[data-table-id="${q}"][data-row-index="${a}"]`
498
+ ), g = (a) => {
499
+ const d = le.current, I = he, N = d == null ? void 0 : d.scrollLeft, B = I == null ? void 0 : I.scrollLeft;
500
+ a.scrollIntoView({ block: "nearest", inline: "nearest" }), d && N !== void 0 && (d.scrollLeft = N), I && B !== void 0 && (I.scrollLeft = B), f || (Fe.current = { key: R, index: L });
501
+ }, h = s(L);
502
+ if (h) {
503
+ g(h);
491
504
  return;
492
505
  }
493
- if (!Y)
506
+ if (!J)
494
507
  return;
495
- const m = [...Re.current.values()].find(
496
- (l) => L >= l.startIndex && L < l.startIndex + l.count
508
+ const v = [...Oe.current.values()].find(
509
+ (a) => L >= a.startIndex && L < a.startIndex + a.count
497
510
  );
498
- if (!m)
511
+ if (!v)
499
512
  return;
500
- m.scrollToIndex(L - m.startIndex);
501
- let $ = 0, o = 0;
502
- const d = () => {
503
- const l = s(L);
504
- if (l) {
505
- x(l);
513
+ v.scrollToIndex(L - v.startIndex);
514
+ let k = 0, F = 0;
515
+ const o = () => {
516
+ const a = s(L);
517
+ if (a) {
518
+ g(a);
506
519
  return;
507
520
  }
508
- ++o < ln && ($ = requestAnimationFrame(d));
521
+ ++F < vr && (k = requestAnimationFrame(o));
509
522
  };
510
- return $ = requestAnimationFrame(d), () => cancelAnimationFrame($);
523
+ return k = requestAnimationFrame(o), () => cancelAnimationFrame(k);
511
524
  }, [
512
- O,
525
+ R,
513
526
  L,
514
- Y,
515
- Ie,
516
- ce,
517
- H,
518
- Te,
519
- a,
527
+ J,
528
+ De,
529
+ he,
530
+ A,
531
+ ze,
532
+ l,
520
533
  c,
521
- Q,
522
- ne
534
+ q,
535
+ Y
523
536
  ]);
524
- const Me = B(null), tt = (t, i) => {
525
- Me.current = t, _e(Math.min(Math.max(0, i), z.length - 1));
537
+ const Ae = U(null), lt = (t, i) => {
538
+ Ae.current = t, Te(Math.min(Math.max(0, i), z.length - 1));
526
539
  };
527
- ft(() => {
528
- const t = Me.current;
540
+ bt(() => {
541
+ const t = Ae.current;
529
542
  if (!t)
530
543
  return;
531
- Me.current = null;
532
- const i = t.getRootNode(), s = ((m) => i.querySelector(
533
- `[data-table-id="${Q}"][data-row-index="${m}"]`
534
- ))(K);
544
+ Ae.current = null;
545
+ const i = t.getRootNode(), s = ((v) => i.querySelector(
546
+ `[data-table-id="${q}"][data-row-index="${v}"]`
547
+ ))(ee);
535
548
  if (s) {
536
549
  s.focus();
537
550
  return;
538
551
  }
539
- const x = i.querySelectorAll(
540
- `[data-table-id="${Q}"][data-row-index]`
541
- ), g = K > 0 ? x[x.length - 1] : x[0];
542
- g && (_e(Number(g.dataset.rowIndex)), g.focus());
543
- }, [K, Q]);
544
- const nt = (t, i) => (p) => {
545
- const s = { ArrowDown: 1, ArrowUp: -1 }[p.key];
552
+ const g = i.querySelectorAll(
553
+ `[data-table-id="${q}"][data-row-index]`
554
+ ), h = ee > 0 ? g[g.length - 1] : g[0];
555
+ h && (Te(Number(h.dataset.rowIndex)), h.focus());
556
+ }, [ee, q]);
557
+ const st = (t, i) => (f) => {
558
+ const s = { ArrowDown: 1, ArrowUp: -1 }[f.key];
546
559
  if (s !== void 0) {
547
- p.preventDefault(), tt(p.currentTarget, t + s);
560
+ f.preventDefault(), lt(f.currentTarget, t + s);
548
561
  return;
549
562
  }
550
- if (!Y && (p.key === "Home" || p.key === "End")) {
551
- p.preventDefault(), tt(p.currentTarget, p.key === "Home" ? 0 : z.length - 1);
563
+ if (!J && (f.key === "Home" || f.key === "End")) {
564
+ f.preventDefault(), lt(f.currentTarget, f.key === "Home" ? 0 : z.length - 1);
552
565
  return;
553
566
  }
554
- i && jt(p, i, "enter");
567
+ i && er(f, i, "enter");
555
568
  };
556
- if (q === "detached") {
557
- const t = P ? { minWidth: Ye } : {}, i = (o, d) => ({
558
- ...P && o.width === void 0 ? { minWidth: o.minWidth ?? vt } : {},
559
- ...Kt(he.offsets.get(o.key), d)
560
- }), p = (o) => o.key === he.edgeKey && Et ? /* @__PURE__ */ n(
569
+ if (G !== "detached" && ct({ title: ne, subtitle: X, extra: K }) && Qt(
570
+ "table-title-inline",
571
+ 'Table `title`, `subtitle` and `extra` draw only on the detached header. Pass `headerVariant="detached"` or leave them out.'
572
+ ), G === "detached") {
573
+ const t = H ? { minWidth: Xe } : {}, i = (o, a) => ({
574
+ ...H && o.width === void 0 ? { minWidth: o.minWidth ?? kt } : {},
575
+ ...fr(pe.offsets.get(o.key), a)
576
+ }), f = (o) => o.key === pe.edgeKey && Dt ? /* @__PURE__ */ n(
561
577
  "span",
562
578
  {
563
579
  "aria-hidden": "true",
564
580
  className: "shrink-0",
565
581
  style: {
566
582
  position: "sticky",
567
- right: he.extent,
583
+ right: pe.extent,
568
584
  zIndex: 1
569
585
  },
570
- children: /* @__PURE__ */ n("span", { style: Xt })
586
+ children: /* @__PURE__ */ n("span", { style: cr })
571
587
  }
572
- ) : null, s = H ? "var(--malachite-table-header-background, #f7f7f7)" : "var(--malachite-table-background, #f7f7f7)", x = {
573
- border: "1px solid var(--malachite-card-border, #e8e8e8)",
574
- borderRadius: le,
588
+ ) : null, s = ct({ title: ne, subtitle: X, extra: K }) ? /* @__PURE__ */ n(Gt, { title: ne, subtitle: X, extra: K }) : null, g = A ? je : "var(--malachite-table-background, #f7f7f7)", h = {
589
+ border: Xt,
590
+ borderRadius: oe,
575
591
  overflow: "clip",
576
592
  flexShrink: 0,
577
593
  ...t
578
- }, g = (o, d, l = !1, S = !1, v, F = K) => {
579
- const A = ze(o, d), y = (j == null ? void 0 : j(o, d)) || {}, Dt = U == null ? void 0 : U(o, d), ve = d === L, be = E || y.onClick ? () => {
580
- var N;
581
- E == null || E(o, d), (N = y.onClick) == null || N.call(y, o, d);
582
- } : void 0, xe = !!be, Tt = l ? {} : dt;
583
- return /* @__PURE__ */ k(
594
+ }, v = (o, a, d = !1, I = !1, N, B = ee) => {
595
+ const Q = We(o, a), m = (j == null ? void 0 : j(o, a)) || {}, Ft = P == null ? void 0 : P(o, a), xe = a === L, me = T || m.onClick ? () => {
596
+ var w;
597
+ T == null || T(o, a), (w = m.onClick) == null || w.call(m, o, a);
598
+ } : void 0, ye = !!me, At = d ? {} : gt;
599
+ return /* @__PURE__ */ y(
584
600
  "div",
585
601
  {
586
- ref: v == null ? void 0 : v.measureRef,
587
- "data-index": v == null ? void 0 : v.index,
588
- "data-table-id": Q,
589
- "data-row-index": d,
590
- "aria-current": ve ? "true" : void 0,
591
- tabIndex: xe ? d === F ? 0 : -1 : void 0,
592
- onKeyDown: xe ? nt(d, be) : void 0,
602
+ ref: N == null ? void 0 : N.measureRef,
603
+ "data-index": N == null ? void 0 : N.index,
604
+ "data-table-id": q,
605
+ "data-row-index": a,
606
+ "aria-current": xe ? "true" : void 0,
607
+ tabIndex: ye ? a === B ? 0 : -1 : void 0,
608
+ onKeyDown: ye ? st(a, me) : void 0,
593
609
  className: `
594
610
  group bg-[var(--malachite-table-row-background,#fff)] flex min-h-10 items-stretch relative w-full
595
- ${xe ? `cursor-pointer hover:bg-[var(--malachite-table-row-hover-background,#fafafa)] ${it}` : ""}
596
- ${(G == null ? void 0 : G(o, d)) || ""}
611
+ ${ye ? `cursor-pointer hover:bg-[var(--malachite-table-row-hover-background,#fafafa)] ${dt}` : ""}
612
+ ${(_ == null ? void 0 : _(o, a)) || ""}
597
613
  `,
598
614
  style: {
599
- ...Tt,
615
+ ...At,
600
616
  ...t,
601
- scrollMarginTop: _t,
617
+ scrollMarginTop: zt,
602
618
  // Echo the card's clip, or it cuts the accent bar's end into a stub.
603
- ...S ? {
604
- borderTopLeftRadius: le,
605
- borderTopRightRadius: le
619
+ ...I ? {
620
+ borderTopLeftRadius: oe,
621
+ borderTopRightRadius: oe
606
622
  } : {},
607
- ...l ? {
608
- borderBottomLeftRadius: le,
609
- borderBottomRightRadius: le
623
+ ...d ? {
624
+ borderBottomLeftRadius: oe,
625
+ borderBottomRightRadius: oe
610
626
  } : {},
611
627
  // Set unconditionally it would beat `hover:bg-*` on every row.
612
- ...en(Dt, ve),
613
- ...ve ? {
628
+ ...hr(Ft, xe),
629
+ ...xe ? {
614
630
  // Inset box-shadow, not `ring-*` — see the classic cell.
615
- boxShadow: `inset 2px 0 0 ${ut}`
631
+ boxShadow: `inset 2px 0 0 ${mt}`
616
632
  } : {}
617
633
  },
618
- onClick: be ? (N) => {
619
- lt(N) || be();
634
+ onClick: me ? (w) => {
635
+ ft(w) || me();
620
636
  } : void 0,
621
- onDoubleClick: y.onDoubleClick ? () => {
622
- var N;
623
- return (N = y.onDoubleClick) == null ? void 0 : N.call(y, o, d);
637
+ onDoubleClick: m.onDoubleClick ? () => {
638
+ var w;
639
+ return (w = m.onDoubleClick) == null ? void 0 : w.call(m, o, a);
624
640
  } : void 0,
625
- onContextMenu: y.onContextMenu ? () => {
626
- var N;
627
- return (N = y.onContextMenu) == null ? void 0 : N.call(y, o, d);
641
+ onContextMenu: m.onContextMenu ? () => {
642
+ var w;
643
+ return (w = m.onContextMenu) == null ? void 0 : w.call(m, o, a);
628
644
  } : void 0,
629
- onMouseEnter: y.onMouseEnter ? () => {
630
- var N;
631
- return (N = y.onMouseEnter) == null ? void 0 : N.call(y, o, d);
645
+ onMouseEnter: m.onMouseEnter ? () => {
646
+ var w;
647
+ return (w = m.onMouseEnter) == null ? void 0 : w.call(m, o, a);
632
648
  } : void 0,
633
- onMouseLeave: y.onMouseLeave ? () => {
634
- var N;
635
- return (N = y.onMouseLeave) == null ? void 0 : N.call(y, o, d);
649
+ onMouseLeave: m.onMouseLeave ? () => {
650
+ var w;
651
+ return (w = m.onMouseLeave) == null ? void 0 : w.call(m, o, a);
636
652
  } : void 0,
637
653
  children: [
638
- e.map((N) => /* @__PURE__ */ k(me.Fragment, { children: [
639
- p(N),
654
+ e.map((w) => /* @__PURE__ */ y(Se.Fragment, { children: [
655
+ f(w),
640
656
  /* @__PURE__ */ n(
641
- gn,
657
+ Er,
642
658
  {
643
- column: N,
659
+ column: w,
644
660
  record: o,
645
- paddingYClass: re,
646
- index: d,
647
- size: _,
648
- isSelected: ve,
649
- cellStyle: i(N, "row")
661
+ paddingYClass: ae,
662
+ index: a,
663
+ size: E,
664
+ isSelected: xe,
665
+ cellStyle: i(w, "row")
650
666
  }
651
667
  )
652
- ] }, N.key)),
653
- xe && ue ? /* @__PURE__ */ n("span", { "aria-hidden": "true", className: Ut }) : null
668
+ ] }, w.key)),
669
+ ye && ge ? /* @__PURE__ */ n("span", { "aria-hidden": "true", className: Vt }) : null
654
670
  ]
655
671
  },
656
- A
672
+ Q
657
673
  );
658
- }, m = (o, d = !1) => /* @__PURE__ */ n(
674
+ }, k = (o, a = !1) => /* @__PURE__ */ n(
659
675
  "div",
660
676
  {
661
677
  className: "bg-[var(--malachite-table-row-background,#fff)] flex min-h-10 items-stretch w-full",
662
- style: { ...d ? {} : dt, ...t },
663
- children: e.map((l) => {
664
- const F = (l.title === "" || l.title == null) && l.width !== void 0 ? /* @__PURE__ */ n(
678
+ style: { ...a ? {} : gt, ...t },
679
+ children: e.map((d) => {
680
+ const B = (d.title === "" || d.title == null) && d.width !== void 0 ? /* @__PURE__ */ n(
665
681
  "div",
666
682
  {
667
- className: `flex items-center ${bt(l.align)} shrink-0 overflow-clip px-4 ${re}`,
683
+ className: `flex items-center ${wt(d.align)} shrink-0 overflow-clip px-4 ${ae}`,
668
684
  style: {
669
- ...Ge(l),
670
- ...i(l, "row")
685
+ ...Qe(d),
686
+ ...i(d, "row")
671
687
  },
672
688
  children: /* @__PURE__ */ n("div", { className: "table-skeleton-bar h-3 rounded animate-pulse w-2/5" })
673
689
  }
674
690
  ) : /* @__PURE__ */ n(
675
691
  "div",
676
692
  {
677
- className: `flex flex-[1_0_0] items-center ${Z(l.align)} min-w-0 overflow-clip px-4 ${re}`,
693
+ className: `flex flex-[1_0_0] items-center ${Z(d.align)} min-w-0 overflow-clip px-4 ${ae}`,
678
694
  style: {
679
- ...oe(l),
680
- ...i(l, "row")
695
+ ...ce(d),
696
+ ...i(d, "row")
681
697
  },
682
698
  children: /* @__PURE__ */ n("div", { className: "table-skeleton-bar h-3 rounded animate-pulse w-3/5" })
683
699
  }
684
700
  );
685
- return /* @__PURE__ */ k(me.Fragment, { children: [
686
- p(l),
687
- F
688
- ] }, l.key);
701
+ return /* @__PURE__ */ y(Se.Fragment, { children: [
702
+ f(d),
703
+ B
704
+ ] }, d.key);
689
705
  })
690
706
  },
691
707
  `skeleton-${o}`
692
- ), $ = D ? /* @__PURE__ */ n("div", { className: "flex min-h-10 items-stretch w-full", style: t, children: e.map((o) => /* @__PURE__ */ k(me.Fragment, { children: [
693
- p(o),
708
+ ), F = D ? /* @__PURE__ */ n("div", { className: "flex min-h-10 items-stretch w-full", style: t, children: e.map((o, a) => /* @__PURE__ */ y(Se.Fragment, { children: [
709
+ f(o),
694
710
  /* @__PURE__ */ n(
695
- pn,
711
+ Cr,
696
712
  {
697
713
  column: o,
698
- sortDirection: (I == null ? void 0 : I.key) === o.key ? I.direction : null,
699
- onSort: o.sorter ? () => Xe(o.key) : void 0,
700
- cellStyle: i(o, s)
714
+ sortDirection: (O == null ? void 0 : O.key) === o.key ? O.direction : null,
715
+ onSort: o.sorter ? nt(o, a) : void 0,
716
+ cellStyle: i(o, g)
701
717
  }
702
718
  )
703
719
  ] }, o.key)) }) : null;
704
- return /* @__PURE__ */ k(
720
+ return /* @__PURE__ */ y(
705
721
  "div",
706
722
  {
707
- ref: Ee,
708
- className: `w-full ${J}`,
709
- style: { ...Fe, ...X },
723
+ ref: Ie,
724
+ className: `w-full ${Ve}`,
725
+ style: { ...Ue, ...$e },
710
726
  children: [
711
- /* @__PURE__ */ k(
727
+ /* @__PURE__ */ y(
712
728
  "div",
713
729
  {
714
- className: `bg-[var(--malachite-table-background,#f7f7f7)] flex flex-col items-start ${H ? "" : "overflow-clip"} p-[4px] relative rounded-xl w-full`,
730
+ className: `${Zt} flex flex-col items-start ${A ? "" : "overflow-clip"} relative w-full`,
715
731
  children: [
716
- D && /* @__PURE__ */ k(
732
+ !D && s,
733
+ D && /* @__PURE__ */ y(
717
734
  "div",
718
735
  {
719
- ref: Je,
736
+ ref: Ze,
720
737
  style: {
721
- ...H ? {
738
+ ...A ? {
722
739
  position: "sticky",
723
- top: ke,
740
+ top: Ne,
724
741
  zIndex: 8,
725
- backgroundColor: "var(--malachite-table-header-background, #f7f7f7)",
726
- marginInline: -ae,
727
- width: `calc(100% + ${ae * 2}px)`,
728
- paddingInline: ae,
742
+ // A title row sits on the frame, as a framed Card's
743
+ // does; the header colour goes behind the column
744
+ // headers alone.
745
+ backgroundColor: s ? "var(--malachite-table-background, #f7f7f7)" : je,
746
+ marginInline: -se,
747
+ width: `calc(100% + ${se * 2}px)`,
748
+ paddingInline: se,
729
749
  // Vertically too, or the card's top frame sits above
730
750
  // the docked header and rows scroll through it.
731
- marginTop: -ae,
732
- paddingTop: ae
751
+ marginTop: -se,
752
+ paddingTop: se
733
753
  } : { width: "100%" }
734
754
  },
735
755
  children: [
736
- H && /* @__PURE__ */ n(on, {}),
756
+ A && /* @__PURE__ */ n(xr, {}),
757
+ s,
737
758
  /* @__PURE__ */ n(
738
759
  "div",
739
760
  {
740
- ref: Ce,
741
- onScroll: P ? () => ct(
742
- Ce.current,
743
- ie.current
761
+ ref: _e,
762
+ onScroll: H ? () => vt(
763
+ _e.current,
764
+ le.current
744
765
  ) : void 0,
745
- style: P ? {
746
- ...Qt,
747
- paddingRight: Rt
748
- } : void 0,
749
- children: $
766
+ style: {
767
+ ...H ? {
768
+ ...sr,
769
+ paddingRight: Mt
770
+ } : {},
771
+ ...A && s ? { backgroundColor: je } : {}
772
+ },
773
+ children: F
750
774
  }
751
775
  )
752
776
  ]
@@ -755,88 +779,88 @@ const vt = 160, Pt = (e, r) => e.length === r.length && e.every((a, c) => a ===
755
779
  /* @__PURE__ */ n(
756
780
  "div",
757
781
  {
758
- ref: Ct,
759
- onScroll: P ? () => {
760
- ct(ie.current, Ce.current), ue && pe();
782
+ ref: Tt,
783
+ onScroll: H ? () => {
784
+ vt(le.current, _e.current), ge && ve();
761
785
  } : void 0,
762
- className: `flex flex-col items-start ${P ? "overflow-x-auto" : "overflow-x-clip"} ${De ? "overflow-y-auto" : "overflow-y-visible"} w-full`,
786
+ className: `flex flex-col items-start ${H ? "overflow-x-auto" : "overflow-x-clip"} ${Me ? "overflow-y-auto" : "overflow-y-visible"} w-full`,
763
787
  style: {
764
788
  // Firefox + modern Chromium only; older Webkit keeps its default.
765
789
  scrollbarWidth: "thin",
766
790
  scrollbarColor: "var(--malachite-text-placeholder, rgb(187, 187, 187)) transparent",
767
791
  // With an external virtual scroller the body is overflow-visible and
768
792
  // a bounded box would overlap content below it.
769
- ...M && De ? {
770
- maxHeight: cn(
771
- M,
772
- !!f
793
+ ...W && Me ? {
794
+ maxHeight: yr(
795
+ W,
796
+ !!b
773
797
  )
774
798
  } : {}
775
799
  },
776
- children: c ? /* @__PURE__ */ n("div", { className: "flex flex-col w-full", style: x, children: /* @__PURE__ */ k("div", { className: "flex flex-col items-center justify-center bg-[var(--malachite-table-row-background,#fff)] w-full py-12", children: [
777
- /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium mb-1", children: R }),
778
- /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[13px]", children: h })
779
- ] }) }) : a ? /* @__PURE__ */ n("div", { className: "flex flex-col w-full", style: x, children: (() => {
780
- const o = f != null && f.pageSize ? Math.min(f.pageSize, 10) : 5;
800
+ children: c ? /* @__PURE__ */ n("div", { className: "flex flex-col w-full", style: h, children: /* @__PURE__ */ y("div", { className: "flex flex-col items-center justify-center bg-[var(--malachite-table-row-background,#fff)] w-full py-12", children: [
801
+ /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium mb-1", children: C }),
802
+ /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[13px]", children: u })
803
+ ] }) }) : l ? /* @__PURE__ */ n("div", { className: "flex flex-col w-full", style: h, children: (() => {
804
+ const o = b != null && b.pageSize ? Math.min(b.pageSize, 10) : 5;
781
805
  return Array.from({ length: o }).map(
782
- (d, l) => m(l, l === o - 1)
806
+ (a, d) => k(d, d === o - 1)
783
807
  );
784
- })() }) : z.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col w-full", style: x, children: /* @__PURE__ */ k("div", { className: "flex flex-col items-center justify-center bg-[var(--malachite-table-row-background,#fff)] w-full py-12", children: [
785
- /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium", children: w }),
786
- b && /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[13px] mt-1", children: b })
808
+ })() }) : z.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col w-full", style: h, children: /* @__PURE__ */ y("div", { className: "flex flex-col items-center justify-center bg-[var(--malachite-table-row-background,#fff)] w-full py-12", children: [
809
+ /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium", children: S }),
810
+ x && /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[13px] mt-1", children: x })
787
811
  ] }) }) : (() => {
788
- const o = (l, S, v) => Y ? /* @__PURE__ */ n(
789
- dn,
812
+ const o = (d, I, N) => J ? /* @__PURE__ */ n(
813
+ mr,
790
814
  {
791
- cardKey: v,
792
- records: l,
793
- startIndex: S,
794
- scrollElement: Ie,
795
- estimateRowHeight: $t,
796
- style: x,
797
- renderRow: g,
798
- registerHandle: kt,
799
- rovingIndex: K
815
+ cardKey: N,
816
+ records: d,
817
+ startIndex: I,
818
+ scrollElement: De,
819
+ estimateRowHeight: It,
820
+ style: h,
821
+ renderRow: v,
822
+ registerHandle: Rt,
823
+ rovingIndex: ee
800
824
  },
801
- `section-card-${v}`
825
+ `section-card-${N}`
802
826
  ) : /* @__PURE__ */ n(
803
827
  "div",
804
828
  {
805
829
  className: "flex flex-col w-full",
806
- style: x,
807
- children: l.map(
808
- (F, A) => g(
809
- F,
810
- S + A,
811
- A === l.length - 1,
812
- A === 0
830
+ style: h,
831
+ children: d.map(
832
+ (B, Q) => v(
833
+ B,
834
+ I + Q,
835
+ Q === d.length - 1,
836
+ Q === 0
813
837
  )
814
838
  )
815
839
  },
816
- `section-card-${v}`
840
+ `section-card-${N}`
817
841
  );
818
- if (Oe.size === 0)
842
+ if (Le.size === 0)
819
843
  return o(z, 0, "all");
820
- const d = [...Oe.keys()].sort((l, S) => l - S);
821
- return d.map((l, S) => {
822
- const v = Oe.get(l);
823
- if (!v)
844
+ const a = [...Le.keys()].sort((d, I) => d - I);
845
+ return a.map((d, I) => {
846
+ const N = Le.get(d);
847
+ if (!N)
824
848
  return null;
825
- const F = S + 1 < d.length ? d[S + 1] : z.length, A = z.slice(l, F), y = $e == null ? void 0 : $e(
826
- v.key,
827
- v.records
849
+ const B = I + 1 < a.length ? a[I + 1] : z.length, Q = z.slice(d, B), m = Ee == null ? void 0 : Ee(
850
+ N.key,
851
+ N.records
828
852
  );
829
- return /* @__PURE__ */ k(me.Fragment, { children: [
830
- y != null ? /* @__PURE__ */ n(
853
+ return /* @__PURE__ */ y(Se.Fragment, { children: [
854
+ m != null ? /* @__PURE__ */ n(
831
855
  "div",
832
856
  {
833
857
  className: "table-section-divider",
834
- style: P ? Vt : void 0,
835
- children: y
858
+ style: H ? or : void 0,
859
+ children: m
836
860
  }
837
861
  ) : null,
838
- o(A, l, v.key)
839
- ] }, `section-${v.key}`);
862
+ o(Q, d, N.key)
863
+ ] }, `section-${N.key}`);
840
864
  });
841
865
  })()
842
866
  }
@@ -844,41 +868,41 @@ const vt = 160, Pt = (e, r) => e.length === r.length && e.every((a, c) => a ===
844
868
  ]
845
869
  }
846
870
  ),
847
- f && !a && /* @__PURE__ */ n(
848
- at,
871
+ b && !l && /* @__PURE__ */ n(
872
+ ht,
849
873
  {
850
- current: f.current ?? 1,
851
- pageSize: f.pageSize ?? 10,
852
- total: f.total ?? 0,
853
- showSizeChanger: f.showSizeChanger,
854
- showQuickJumper: f.showQuickJumper,
855
- showTotal: f.showTotal,
856
- pageSizeOptions: f.pageSizeOptions,
857
- onChange: f.onChange,
858
- onShowSizeChange: f.onShowSizeChange
874
+ current: b.current ?? 1,
875
+ pageSize: b.pageSize ?? 10,
876
+ total: b.total ?? 0,
877
+ showSizeChanger: b.showSizeChanger,
878
+ showQuickJumper: b.showQuickJumper,
879
+ showTotal: b.showTotal,
880
+ pageSizeOptions: b.pageSizeOptions,
881
+ onChange: b.onChange,
882
+ onShowSizeChange: b.onShowSizeChange
859
883
  }
860
884
  )
861
885
  ]
862
886
  }
863
887
  );
864
888
  }
865
- const It = (t) => {
866
- const i = t.sorter, s = (I == null ? void 0 : I.key) === t.key ? I == null ? void 0 : I.direction : null, x = /* @__PURE__ */ k("div", { className: `flex items-center gap-2 ${Z(t.align)}`, children: [
889
+ const Wt = (t, i) => {
890
+ const f = t.sorter, g = (O == null ? void 0 : O.key) === t.key ? O == null ? void 0 : O.direction : null, h = /* @__PURE__ */ y("div", { className: `flex items-center gap-2 ${Z(t.align)}`, children: [
867
891
  /* @__PURE__ */ n("span", { children: t.title }),
868
- t.info && /* @__PURE__ */ n(ye, { info: t.info }),
869
- i && /* @__PURE__ */ k("div", { className: "flex flex-col", children: [
892
+ t.info && /* @__PURE__ */ n(ke, { info: t.info }),
893
+ f && /* @__PURE__ */ y("div", { className: "flex flex-col", children: [
870
894
  /* @__PURE__ */ n(
871
- Lt,
895
+ Pt,
872
896
  {
873
897
  size: 12,
874
- className: s === "asc" ? Ue : je
898
+ className: g === "asc" ? Ge : Ye
875
899
  }
876
900
  ),
877
901
  /* @__PURE__ */ n(
878
- ht,
902
+ xt,
879
903
  {
880
904
  size: 12,
881
- className: `-mt-1 ${s === "desc" ? Ue : je}`
905
+ className: `-mt-1 ${g === "desc" ? Ge : Ye}`
882
906
  }
883
907
  )
884
908
  ] })
@@ -888,50 +912,50 @@ const vt = 160, Pt = (e, r) => e.length === r.length && e.every((a, c) => a ===
888
912
  {
889
913
  className: `
890
914
  table-header table-cell px-4 py-3 font-semibold border-0 first:rounded-tl-lg last:rounded-tr-lg
891
- ${se(_)}
892
- ${de(t.align)}
915
+ ${de(E)}
916
+ ${fe(t.align)}
893
917
  `,
894
918
  style: { width: t.width },
895
- "aria-sort": i ? fn(s) : void 0,
896
- children: i ? /* @__PURE__ */ n(
919
+ "aria-sort": f ? Sr(g) : void 0,
920
+ children: f ? /* @__PURE__ */ n(
897
921
  "button",
898
922
  {
899
- ...xt(t.title, () => Xe(t.key)),
900
- className: `flex w-full items-center ${Z(t.align)} cursor-pointer hover:opacity-80 appearance-none bg-transparent border-0 p-0 font-semibold text-inherit ${de(t.align)}`,
901
- children: x
923
+ ...$t(t.title, nt(t, i)),
924
+ className: `flex w-full items-center ${Z(t.align)} cursor-pointer hover:opacity-80 appearance-none bg-transparent border-0 p-0 font-semibold text-inherit ${fe(t.align)}`,
925
+ children: h
902
926
  }
903
- ) : x
927
+ ) : h
904
928
  },
905
929
  t.key
906
930
  );
907
931
  };
908
- return c ? /* @__PURE__ */ n("div", { className: "w-full", style: { ...Fe, ...X }, children: /* @__PURE__ */ n(
932
+ return c ? /* @__PURE__ */ n("div", { className: "w-full", style: { ...Ue, ...$e }, children: /* @__PURE__ */ n(
909
933
  "div",
910
934
  {
911
935
  className: "overflow-x-auto",
912
936
  style: {
913
- ...M ? { maxHeight: M } : {}
937
+ ...W ? { maxHeight: W } : {}
914
938
  },
915
- children: /* @__PURE__ */ k("table", { className: "w-full border-collapse rounded-lg overflow-hidden", children: [
939
+ children: /* @__PURE__ */ y("table", { className: "w-full border-collapse rounded-lg overflow-hidden", children: [
916
940
  D && /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ n("tr", { children: e.map((t) => /* @__PURE__ */ n(
917
941
  "th",
918
942
  {
919
943
  className: `
920
944
  table-header table-cell px-4 py-3 font-semibold border-0 first:rounded-tl-lg last:rounded-tr-lg
921
- ${u ? "table-cell-bordered table-cell-bordered-top" : ""}
922
- ${u && t === e[0] ? "table-cell-bordered-left" : ""}
923
- ${u && t === e[e.length - 1] ? "table-cell-bordered-right" : ""}
924
- ${se(_)}
925
- ${de(t.align)}
945
+ ${p ? "table-cell-bordered table-cell-bordered-top" : ""}
946
+ ${p && t === e[0] ? "table-cell-bordered-left" : ""}
947
+ ${p && t === e[e.length - 1] ? "table-cell-bordered-right" : ""}
948
+ ${de(E)}
949
+ ${fe(t.align)}
926
950
  `,
927
951
  style: { width: t.width },
928
- children: /* @__PURE__ */ k(
952
+ children: /* @__PURE__ */ y(
929
953
  "div",
930
954
  {
931
955
  className: `flex items-center gap-2 ${Z(t.align)}`,
932
956
  children: [
933
957
  /* @__PURE__ */ n("span", { children: t.title }),
934
- t.info && /* @__PURE__ */ n(ye, { info: t.info })
958
+ t.info && /* @__PURE__ */ n(ke, { info: t.info })
935
959
  ]
936
960
  }
937
961
  )
@@ -941,72 +965,72 @@ const vt = 160, Pt = (e, r) => e.length === r.length && e.every((a, c) => a ===
941
965
  /* @__PURE__ */ n("tbody", { children: /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n(
942
966
  "td",
943
967
  {
944
- colSpan: e.length + (W ? 1 : 0),
968
+ colSpan: e.length + (ie ? 1 : 0),
945
969
  className: "px-4 py-12 text-center",
946
- children: /* @__PURE__ */ k("div", { className: "flex flex-col items-center justify-center", children: [
947
- /* @__PURE__ */ n("div", { className: "table-error-icon w-12 h-12 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ n(Wt, { size: 24 }) }),
948
- /* @__PURE__ */ n("div", { className: "table-error-title text-lg font-semibold mb-2", children: R }),
949
- /* @__PURE__ */ n("div", { className: "table-error-subtitle text-sm", children: h })
970
+ children: /* @__PURE__ */ y("div", { className: "flex flex-col items-center justify-center", children: [
971
+ /* @__PURE__ */ n("div", { className: "table-error-icon w-12 h-12 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ n(Ht, { size: 24 }) }),
972
+ /* @__PURE__ */ n("div", { className: "table-error-title text-lg font-semibold mb-2", children: C }),
973
+ /* @__PURE__ */ n("div", { className: "table-error-subtitle text-sm", children: u })
950
974
  ] })
951
975
  }
952
976
  ) }) })
953
977
  ] })
954
978
  }
955
- ) }) : /* @__PURE__ */ k(
979
+ ) }) : /* @__PURE__ */ y(
956
980
  "div",
957
981
  {
958
- ref: Ee,
959
- className: `w-full ${J}`,
960
- style: { ...Fe, ...X },
982
+ ref: Ie,
983
+ className: `w-full ${Ve}`,
984
+ style: { ...Ue, ...$e },
961
985
  children: [
962
986
  /* @__PURE__ */ n(
963
987
  "div",
964
988
  {
965
- className: `overflow-hidden rounded-lg ${u ? "table-bordered-container" : "table-container-border"}`,
966
- "data-bordered": u ? "true" : "false",
989
+ className: `overflow-hidden rounded-lg ${p ? "table-bordered-container" : "table-container-border"}`,
990
+ "data-bordered": p ? "true" : "false",
967
991
  children: /* @__PURE__ */ n(
968
992
  "div",
969
993
  {
970
994
  className: "overflow-x-auto",
971
995
  style: {
972
- ...M ? { maxHeight: M } : {}
996
+ ...W ? { maxHeight: W } : {}
973
997
  },
974
- children: /* @__PURE__ */ k(
998
+ children: /* @__PURE__ */ y(
975
999
  "table",
976
1000
  {
977
- className: `w-full ${te === "fixed" || e.some((t) => t.width) ? "table-fixed" : "table-auto"} ${u ? "border-separate table-bordered" : "border-collapse"} rounded-lg overflow-hidden`,
1001
+ className: `w-full ${re === "fixed" || e.some((t) => t.width) ? "table-fixed" : "table-auto"} ${p ? "border-separate table-bordered" : "border-collapse"} rounded-lg overflow-hidden`,
978
1002
  style: { borderSpacing: "0" },
979
1003
  children: [
980
- D && /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ n("tr", { children: e.map((t) => It(t)) }) }),
981
- /* @__PURE__ */ n("tbody", { children: a ? Array.from({ length: 5 }).map((t, i) => /* @__PURE__ */ n(
1004
+ D && /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ n("tr", { children: e.map((t, i) => Wt(t, i)) }) }),
1005
+ /* @__PURE__ */ n("tbody", { children: l ? Array.from({ length: 5 }).map((t, i) => /* @__PURE__ */ n(
982
1006
  "tr",
983
1007
  {
984
- className: `table-row ${u ? "table-row-bordered" : ""}`,
985
- children: e.map((p) => /* @__PURE__ */ n(
1008
+ className: `table-row ${p ? "table-row-bordered" : ""}`,
1009
+ children: e.map((f) => /* @__PURE__ */ n(
986
1010
  "td",
987
1011
  {
988
- className: `table-cell px-4 ${re} text-left ${se(_)}`,
989
- style: { width: p.width },
1012
+ className: `table-cell px-4 ${ae} text-left ${de(E)}`,
1013
+ style: { width: f.width },
990
1014
  children: /* @__PURE__ */ n("div", { className: "table-skeleton-bar h-4 rounded animate-pulse" })
991
1015
  },
992
- p.key
1016
+ f.key
993
1017
  ))
994
1018
  },
995
1019
  i
996
1020
  )) : z.length === 0 ? /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n(
997
1021
  "td",
998
1022
  {
999
- colSpan: e.length + (W ? 1 : 0),
1023
+ colSpan: e.length + (ie ? 1 : 0),
1000
1024
  className: "px-4 py-12 text-center",
1001
- children: /* @__PURE__ */ k("div", { className: "flex flex-col items-center justify-center", children: [
1002
- /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium", children: w }),
1003
- b && /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[13px] mt-1", children: b })
1025
+ children: /* @__PURE__ */ y("div", { className: "flex flex-col items-center justify-center", children: [
1026
+ /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium", children: S }),
1027
+ x && /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[13px] mt-1", children: x })
1004
1028
  ] })
1005
1029
  }
1006
1030
  ) }) : z.map((t, i) => {
1007
- const p = ze(t, i), s = (j == null ? void 0 : j(t, i)) || {}, x = U == null ? void 0 : U(t, i), g = i === 0, m = i === r.length - 1, $ = i === L, o = x ? `var(--malachite-table-row-variant-${x}-background)` : void 0, d = E || s.onClick ? () => {
1008
- var l;
1009
- E == null || E(t, i), (l = s.onClick) == null || l.call(s, t, i);
1031
+ const f = We(t, i), s = (j == null ? void 0 : j(t, i)) || {}, g = P == null ? void 0 : P(t, i), h = i === 0, v = i === r.length - 1, k = i === L, F = g ? `var(--malachite-table-row-variant-${g}-background)` : void 0, o = T || s.onClick ? () => {
1032
+ var a;
1033
+ T == null || T(t, i), (a = s.onClick) == null || a.call(s, t, i);
1010
1034
  } : void 0;
1011
1035
  return (
1012
1036
  // Keeps `row` semantics: `role="button"` would strip the table
@@ -1014,59 +1038,59 @@ const vt = 160, Pt = (e, r) => e.length === r.length && e.every((a, c) => a ===
1014
1038
  /* @__PURE__ */ n(
1015
1039
  "tr",
1016
1040
  {
1017
- "data-table-id": Q,
1041
+ "data-table-id": q,
1018
1042
  "data-row-index": i,
1019
- "aria-current": $ ? "true" : void 0,
1020
- tabIndex: d ? i === K ? 0 : -1 : void 0,
1021
- onKeyDown: d ? nt(i, d) : void 0,
1043
+ "aria-current": k ? "true" : void 0,
1044
+ tabIndex: o ? i === ee ? 0 : -1 : void 0,
1045
+ onKeyDown: o ? st(i, o) : void 0,
1022
1046
  className: `
1023
- ${u ? "table-row-bordered" : `table-row ${$ ? "" : "hover:opacity-80"}`}
1024
- ${(G == null ? void 0 : G(t, i)) || ""}
1025
- ${d ? `cursor-pointer ${it}` : ""}
1047
+ ${p ? "table-row-bordered" : `table-row ${k ? "" : "hover:opacity-80"}`}
1048
+ ${(_ == null ? void 0 : _(t, i)) || ""}
1049
+ ${o ? `cursor-pointer ${dt}` : ""}
1026
1050
  `,
1027
- onClick: d ? (l) => {
1028
- lt(l) || d();
1051
+ onClick: o ? (a) => {
1052
+ ft(a) || o();
1029
1053
  } : void 0,
1030
1054
  onDoubleClick: s.onDoubleClick ? () => {
1031
- var l;
1032
- return (l = s.onDoubleClick) == null ? void 0 : l.call(s, t, i);
1055
+ var a;
1056
+ return (a = s.onDoubleClick) == null ? void 0 : a.call(s, t, i);
1033
1057
  } : void 0,
1034
1058
  onContextMenu: s.onContextMenu ? () => {
1035
- var l;
1036
- return (l = s.onContextMenu) == null ? void 0 : l.call(s, t, i);
1059
+ var a;
1060
+ return (a = s.onContextMenu) == null ? void 0 : a.call(s, t, i);
1037
1061
  } : void 0,
1038
1062
  onMouseEnter: s.onMouseEnter ? () => {
1039
- var l;
1040
- return (l = s.onMouseEnter) == null ? void 0 : l.call(s, t, i);
1063
+ var a;
1064
+ return (a = s.onMouseEnter) == null ? void 0 : a.call(s, t, i);
1041
1065
  } : void 0,
1042
1066
  onMouseLeave: s.onMouseLeave ? () => {
1043
- var l;
1044
- return (l = s.onMouseLeave) == null ? void 0 : l.call(s, t, i);
1067
+ var a;
1068
+ return (a = s.onMouseLeave) == null ? void 0 : a.call(s, t, i);
1045
1069
  } : void 0,
1046
- children: e.map((l) => {
1047
- const S = l === e[0], v = l === e[e.length - 1];
1070
+ children: e.map((a) => {
1071
+ const d = a === e[0], I = a === e[e.length - 1];
1048
1072
  return /* @__PURE__ */ n(
1049
- un,
1073
+ Nr,
1050
1074
  {
1051
- column: l,
1075
+ column: a,
1052
1076
  record: t,
1053
1077
  index: i,
1054
- size: _,
1055
- paddingYClass: re,
1056
- bordered: u,
1057
- isFirstRow: g,
1058
- isLastRow: m,
1059
- isFirstColumn: S,
1060
- isLastColumn: v,
1061
- variantBackground: o,
1062
- isSelected: $,
1063
- showSelectedAccent: $ && S
1078
+ size: E,
1079
+ paddingYClass: ae,
1080
+ bordered: p,
1081
+ isFirstRow: h,
1082
+ isLastRow: v,
1083
+ isFirstColumn: d,
1084
+ isLastColumn: I,
1085
+ variantBackground: F,
1086
+ isSelected: k,
1087
+ showSelectedAccent: k && d
1064
1088
  },
1065
- l.key
1089
+ a.key
1066
1090
  );
1067
1091
  })
1068
1092
  },
1069
- p
1093
+ f
1070
1094
  )
1071
1095
  );
1072
1096
  }) })
@@ -1077,18 +1101,18 @@ const vt = 160, Pt = (e, r) => e.length === r.length && e.every((a, c) => a ===
1077
1101
  )
1078
1102
  }
1079
1103
  ),
1080
- f && !a && /* @__PURE__ */ n(
1081
- at,
1104
+ b && !l && /* @__PURE__ */ n(
1105
+ ht,
1082
1106
  {
1083
- current: f.current ?? 1,
1084
- pageSize: f.pageSize ?? 10,
1085
- total: f.total ?? 0,
1086
- showSizeChanger: f.showSizeChanger,
1087
- showQuickJumper: f.showQuickJumper,
1088
- showTotal: f.showTotal,
1089
- pageSizeOptions: f.pageSizeOptions,
1090
- onChange: f.onChange,
1091
- onShowSizeChange: f.onShowSizeChange
1107
+ current: b.current ?? 1,
1108
+ pageSize: b.pageSize ?? 10,
1109
+ total: b.total ?? 0,
1110
+ showSizeChanger: b.showSizeChanger,
1111
+ showQuickJumper: b.showQuickJumper,
1112
+ showTotal: b.showTotal,
1113
+ pageSizeOptions: b.pageSizeOptions,
1114
+ onChange: b.onChange,
1115
+ onShowSizeChange: b.onShowSizeChange
1092
1116
  }
1093
1117
  )
1094
1118
  ]
@@ -1096,6 +1120,6 @@ const vt = 160, Pt = (e, r) => e.length === r.length && e.every((a, c) => a ===
1096
1120
  );
1097
1121
  };
1098
1122
  export {
1099
- In as default
1123
+ Yr as default
1100
1124
  };
1101
1125
  //# sourceMappingURL=Table.js.map