@stackone/malachite 2.29.0 → 2.31.0

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