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