@stackone/malachite 2.137.0 → 2.138.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,1096 +1,1416 @@
1
- import { jsx as r, jsxs as $ } from "react/jsx-runtime";
2
- import { useVirtualizer as cn } from "@tanstack/react-virtual";
3
- import Re, { useState as K, useRef as q, useCallback as Ze, useId as fn, useEffect as ae, useMemo as _t, useLayoutEffect as Ft } from "react";
4
- import zt from "../CustomIcons/CaretDownIcon.js";
5
- import hn from "../CustomIcons/CaretUpIcon.js";
6
- import un from "../CustomIcons/InfoIcon.js";
7
- import pn from "../CustomIcons/WarningTriangleIcon.js";
8
- import vn from "../FrameHeader.js";
9
- import bn from "../PinnedCornerCap.js";
10
- import gn from "../Tooltip.js";
11
- import mn from "../TruncatedTooltip.js";
12
- import { devWarning as xn } from "../devWarning.js";
13
- import { FOCUS_RING_INSET as It, FOCUS_RING_INSET_OVERLAY as yn } from "../focusRing.js";
14
- import { FRAME_CLASS as Sn, FRAME_PADDING as fe, FRAME_SECTION_RADIUS as he, FRAME_SECTION_BORDER as kn, FRAME_RADIUS as $n } from "../frameStyles.js";
15
- import { hasHeaderContent as Ot } from "../headerContent.js";
16
- import { isFromInteractiveDescendant as Tt, activateOnEnterOrSpace as Nn } from "../keyboardActivation.js";
17
- import { FOREGROUND_RESET as Ke, SELECTED_ROW_ACCENT as At, SELECTED_TEXT_CONTEXT as Ht, SELECTED_ROW_FOREGROUND as Bt, SELECTED_ROW_BACKGROUND as tt } from "../selectedRow.js";
18
- import wn from "./TablePagination.js";
19
- import { paginationPlacement as En } from "./paginationPlacement.js";
20
- import { useFillHeight as Rn } from "./useFillHeight.js";
21
- const Pt = 160, Cn = (e, n) => e.length === n.length && e.every((o, h) => o === n[h]), Mt = "\0", _n = (e, n, o) => {
1
+ import { jsxs as y, jsx as i } from "react/jsx-runtime";
2
+ import { useVirtualizer as ar } from "@tanstack/react-virtual";
3
+ import je, { useState as te, useRef as j, useCallback as Nt, useId as cr, useEffect as le, useMemo as Ue, useLayoutEffect as Nn } from "react";
4
+ import Rn from "../CustomIcons/CaretDownIcon.js";
5
+ import dr from "../CustomIcons/CaretUpIcon.js";
6
+ import fr from "../CustomIcons/InfoIcon.js";
7
+ import hr from "../CustomIcons/WarningTriangleIcon.js";
8
+ import { DisclosureArrow as ur } from "../DisclosureArrow.js";
9
+ import pr from "../FrameHeader.js";
10
+ import vr from "../PinnedCornerCap.js";
11
+ import { Spinner as br } from "../Spinner.js";
12
+ import _n from "../Tooltip.js";
13
+ import mr from "../TruncatedTooltip.js";
14
+ import { devWarning as Ye } from "../devWarning.js";
15
+ import { FOCUS_RING_INSET as un, FOCUS_RING as In, FOCUS_RING_INSET_OVERLAY as gr } from "../focusRing.js";
16
+ import { FRAME_CLASS as yr, FRAME_PADDING as Se, FRAME_SECTION_RADIUS as we, FRAME_SECTION_BORDER as xr, FRAME_RADIUS as kr } from "../frameStyles.js";
17
+ import { hasHeaderContent as pn } from "../headerContent.js";
18
+ import { isFromInteractiveDescendant as vn, activateOnEnterOrSpace as Sr } from "../keyboardActivation.js";
19
+ import { FOREGROUND_RESET as Rt, SELECTED_ROW_ACCENT as Cn, SELECTED_TEXT_CONTEXT as Tn, SELECTED_ROW_FOREGROUND as On, SELECTED_ROW_BACKGROUND as Ct } from "../selectedRow.js";
20
+ import { VISUALLY_HIDDEN_STYLE as wr } from "../visuallyHiddenStyle.js";
21
+ import $r from "./TablePagination.js";
22
+ import { paginationPlacement as Er } from "./paginationPlacement.js";
23
+ import { useFillHeight as Nr } from "./useFillHeight.js";
24
+ const Rr = "200px", _r = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), Ir = (e) => {
25
+ const r = (l) => l.parentElement ?? (l.getRootNode().host || null);
26
+ for (let l = r(e); l; l = r(l))
27
+ if (_r.has(getComputedStyle(l).overflowY))
28
+ return l;
29
+ return null;
30
+ }, Je = 16, Cr = 8, Tr = Je * 2 + Cr, Dn = 160, Or = (e, r) => e.length === r.length && e.every((l, v) => l === r[v]), bn = "\0", Dr = (e, r, l) => {
22
31
  if (typeof e != "object" || e === null)
23
- return `${Mt}i${o}`;
24
- const h = n.ids.get(e);
25
- if (h !== void 0)
26
- return h;
27
- const b = `${Mt}${n.next++}`;
28
- return n.ids.set(e, b), b;
29
- }, In = (e, n, o) => typeof n == "function" ? e.map((h) => n(h)) : e.map((h, b) => {
30
- const x = h[n];
31
- return x == null ? _n(h, o, b) : String(x);
32
- }), be = (e) => {
32
+ return `${bn}i${l}`;
33
+ const v = r.ids.get(e);
34
+ if (v !== void 0)
35
+ return v;
36
+ const g = `${bn}${r.next++}`;
37
+ return r.ids.set(e, g), g;
38
+ }, Lr = (e, r, l) => typeof r == "function" ? e.map((v) => r(v)) : e.map((v, g) => {
39
+ const k = v[r];
40
+ return k == null ? Dr(v, l, g) : String(k);
41
+ }), Re = (e) => {
33
42
  if (typeof e == "number")
34
43
  return e;
35
44
  if (typeof e == "string") {
36
- const n = e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)px$/i);
37
- if (n)
38
- return Number(n[1]);
45
+ const r = e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)px$/i);
46
+ if (r)
47
+ return Number(r[1]);
39
48
  }
40
- }, it = (e) => {
41
- const n = be(e.width);
42
- return !(e.title === "" || e.title == null) && n !== void 0 && typeof e.minWidth == "number" && e.minWidth < n ? e.minWidth : void 0;
43
- }, On = (e) => e.reduce((n, o) => {
44
- const h = it(o) ?? be(o.width);
45
- return h !== void 0 ? n + h : typeof o.minWidth == "number" ? n + o.minWidth : n + Pt;
46
- }, 0), Tn = (e) => {
47
- const n = typeof e == "string" ? e.trim().toLowerCase() : e;
48
- return !n || n === "auto" || n === "0" ? 0 : be(e);
49
- }, Mn = (e) => {
50
- let n = 0, o = 0, h = 0;
51
- for (const { width: b, minWidth: x } of e) {
52
- const d = Tn(b);
49
+ }, At = (e) => {
50
+ const r = Re(e.width);
51
+ return !(e.title === "" || e.title == null) && r !== void 0 && typeof e.minWidth == "number" && e.minWidth < r ? e.minWidth : void 0;
52
+ }, Ar = (e) => e.reduce((r, l) => {
53
+ const v = At(l) ?? Re(l.width);
54
+ return v !== void 0 ? r + v : typeof l.minWidth == "number" ? r + l.minWidth : r + Dn;
55
+ }, 0), Mr = (e) => {
56
+ const r = typeof e == "string" ? e.trim().toLowerCase() : e;
57
+ return !r || r === "auto" || r === "0" ? 0 : Re(e);
58
+ }, Wr = (e) => {
59
+ let r = 0, l = 0, v = 0;
60
+ for (const { width: g, minWidth: k } of e) {
61
+ const d = Mr(g);
53
62
  if (d === void 0)
54
63
  return;
55
- d === 0 ? (n += 1, o = Math.max(o, x ?? 0)) : h += d;
64
+ d === 0 ? (r += 1, l = Math.max(l, k ?? 0)) : v += d;
56
65
  }
57
- return o === 0 ? void 0 : h + n * o;
58
- }, Dn = (e) => (e.title === "" || e.title == null) && be(e.width) !== void 0, Wn = (e) => {
59
- const n = [...e].reverse().findIndex((x) => !Dn(x)), o = n === -1 ? 0 : e.length - n, h = /* @__PURE__ */ new Map(), b = e.reduceRight(
60
- (x, d, R) => {
61
- const m = it(d) ?? be(d.width);
62
- return !(d.fixed === "right" || R >= o) || m === void 0 ? x : (h.set(d.key, x.right), { right: x.right + m, edge: d.key });
66
+ return l === 0 ? void 0 : v + r * l;
67
+ }, Hr = (e) => (e.title === "" || e.title == null) && Re(e.width) !== void 0, Fr = (e) => {
68
+ const r = [...e].reverse().findIndex((k) => !Hr(k)), l = r === -1 ? 0 : e.length - r, v = /* @__PURE__ */ new Map(), g = e.reduceRight(
69
+ (k, d, O) => {
70
+ const $ = At(d) ?? Re(d.width);
71
+ return !(d.fixed === "right" || O >= l) || $ === void 0 ? k : (v.set(d.key, k.right), { right: k.right + $, edge: d.key });
63
72
  },
64
73
  { right: 0, edge: void 0 }
65
74
  );
66
- return { offsets: h, edgeKey: b.edge, extent: b.right };
67
- }, Ln = { overflowX: "auto", scrollbarWidth: "none" }, Fn = {
75
+ return { offsets: v, edgeKey: g.edge, extent: g.right };
76
+ }, zr = { overflowX: "auto", scrollbarWidth: "none" }, mn = {
68
77
  position: "sticky",
69
78
  left: 0,
70
79
  width: "100%"
71
- }, zn = { offsets: /* @__PURE__ */ new Map(), edgeKey: void 0, extent: 0 }, Xe = (e) => `color-mix(in srgb, var(--malachite-card-shadow, rgba(0, 0, 0, 0.1)) ${e}%, transparent)`, An = {
80
+ }, Br = { offsets: /* @__PURE__ */ new Map(), edgeKey: void 0, extent: 0 }, _t = (e) => `color-mix(in srgb, var(--malachite-card-shadow, rgba(0, 0, 0, 0.1)) ${e}%, transparent)`, Gr = {
72
81
  position: "absolute",
73
82
  top: 0,
74
83
  bottom: 0,
75
84
  right: 0,
76
85
  width: 24,
77
86
  pointerEvents: "none",
78
- backgroundImage: `linear-gradient(to left, ${Xe(45)}, ${Xe(18)} 30%, ${Xe(5)} 65%, transparent)`
79
- }, Hn = (e, n) => e === void 0 ? {} : {
87
+ backgroundImage: `linear-gradient(to left, ${_t(45)}, ${_t(18)} 30%, ${_t(5)} 65%, transparent)`
88
+ }, Pr = (e, r) => e === void 0 ? {} : {
80
89
  position: "sticky",
81
90
  right: e,
82
91
  zIndex: 1,
83
92
  height: "auto",
84
- ...n === "row" ? { backgroundColor: "inherit", backgroundImage: "inherit" } : { backgroundColor: n }
85
- }, Dt = (e) => `linear-gradient(${e}, ${e})`, Bn = (e, n) => {
86
- if (!e && !n)
93
+ ...r === "row" ? { backgroundColor: "inherit", backgroundImage: "inherit" } : { backgroundColor: r }
94
+ }, gn = (e) => `linear-gradient(${e}, ${e})`, jr = (e, r) => {
95
+ if (!e && !r)
87
96
  return {};
88
- const o = [
89
- n ? Dt(tt) : void 0,
90
- e ? Dt(`var(--malachite-table-row-variant-${e}-background)`) : void 0
91
- ].filter(lt);
97
+ const l = [
98
+ r ? gn(Ct) : void 0,
99
+ e ? gn(`var(--malachite-table-row-variant-${e}-background)`) : void 0
100
+ ].filter(Mt);
92
101
  return {
93
102
  backgroundColor: e ? "var(--malachite-table-background, #f7f7f7)" : "var(--malachite-table-row-background, #fff)",
94
- backgroundImage: o.join(", ")
103
+ backgroundImage: l.join(", ")
95
104
  };
96
- }, lt = (e) => typeof e == "string", Pn = {
105
+ }, Mt = (e) => typeof e == "string", Ur = (e) => e == null, Yr = {
97
106
  default: 40,
98
107
  compact: 30,
99
108
  snug: 38
100
- }, Un = {
109
+ }, Jr = {
101
110
  default: 40,
102
111
  compact: 40,
103
112
  snug: 34
104
- }, Gn = {
113
+ }, qr = {
105
114
  default: "px-4 py-3",
106
115
  compact: "px-4 py-1",
107
116
  snug: "px-3 py-0"
108
- }, jn = {
117
+ }, Zr = {
109
118
  default: "px-4 py-3",
110
119
  compact: "px-4 py-3",
111
120
  snug: "px-3 py-[9px]"
112
- }, nt = "text-[var(--malachite-text-primary,#0a0a0a)]", rt = "text-[var(--malachite-text-dimmed,#a1a1a1)]", ue = (e) => ({
121
+ }, Tt = "text-[var(--malachite-text-primary,#0a0a0a)]", Ot = "text-[var(--malachite-text-dimmed,#a1a1a1)]", $e = (e) => ({
113
122
  small: "text-[length:var(--malachite-font-size-small)]",
114
123
  medium: "text-[length:var(--malachite-font-size-medium)]",
115
124
  large: "text-[length:var(--malachite-font-size-large)]"
116
- })[e], Wt = {
125
+ })[e], yn = {
117
126
  borderBottom: "1px solid var(--malachite-card-border, #e8e8e8)"
118
- }, Lt = (e, n) => {
119
- e && n && n.scrollLeft !== e.scrollLeft && (n.scrollLeft = e.scrollLeft);
120
- }, Yn = 56, Jn = 44, qn = 8, Qn = 10, Vn = "--malachite-ctx-table-surround", et = "var(--malachite-table-header-background, #f7f7f7)", Zn = () => /* @__PURE__ */ r(
121
- bn,
127
+ }, xn = (e, r) => {
128
+ e && r && r.scrollLeft !== e.scrollLeft && (r.scrollLeft = e.scrollLeft);
129
+ }, Qr = 56, Vr = 44, Kr = 8, Xr = 10, ei = "--malachite-ctx-table-surround", It = "var(--malachite-table-header-background, #f7f7f7)", ti = () => /* @__PURE__ */ i(
130
+ vr,
122
131
  {
123
- radius: $n,
124
- surround: `var(${Vn}, var(--malachite-card-background, #ffffff))`
132
+ radius: kr,
133
+ surround: `var(${ei}, var(--malachite-card-background, #ffffff))`
125
134
  }
126
- ), Kn = ({
135
+ ), ni = ({
127
136
  records: e,
128
- startIndex: n,
129
- scrollElement: o,
130
- estimateRowHeight: h,
131
- style: b,
132
- renderRow: x,
137
+ startIndex: r,
138
+ scrollElement: l,
139
+ estimateRowHeight: v,
140
+ style: g,
141
+ renderRow: k,
133
142
  registerHandle: d,
134
- cardKey: R,
135
- rovingIndex: m
143
+ cardKey: O,
144
+ rovingIndex: $
136
145
  }) => {
137
- const C = q(null), [z, _] = K(0);
138
- Ft(() => {
139
- const O = C.current;
140
- if (!O || !o)
146
+ const D = j(null), [R, I] = te(0);
147
+ Nn(() => {
148
+ const z = D.current;
149
+ if (!z || !l)
141
150
  return;
142
- const re = () => {
143
- const L = O.getBoundingClientRect().top - o.getBoundingClientRect().top + o.scrollTop;
144
- _((P) => Math.abs(P - L) < 1 ? P : L);
151
+ const de = () => {
152
+ const Y = z.getBoundingClientRect().top - l.getBoundingClientRect().top + l.scrollTop;
153
+ I((q) => Math.abs(q - Y) < 1 ? q : Y);
145
154
  };
146
- if (re(), typeof ResizeObserver > "u")
155
+ if (de(), typeof ResizeObserver > "u")
147
156
  return;
148
- const ie = new ResizeObserver(re);
149
- let W = O;
150
- for (; W && W !== o; ) {
151
- let L = W.previousElementSibling;
152
- for (; L; )
153
- ie.observe(L), L = L.previousElementSibling;
154
- const P = W.parentElement;
155
- if (P)
156
- W = P;
157
+ const fe = new ResizeObserver(de);
158
+ let U = z;
159
+ for (; U && U !== l; ) {
160
+ let Y = U.previousElementSibling;
161
+ for (; Y; )
162
+ fe.observe(Y), Y = Y.previousElementSibling;
163
+ const q = U.parentElement;
164
+ if (q)
165
+ U = q;
157
166
  else {
158
- const G = W.getRootNode();
159
- W = G instanceof ShadowRoot ? G.host : null;
167
+ const Q = U.getRootNode();
168
+ U = Q instanceof ShadowRoot ? Q.host : null;
160
169
  }
161
170
  }
162
- return () => ie.disconnect();
163
- }, [o, e.length, n]);
164
- const I = cn({
171
+ return () => fe.disconnect();
172
+ }, [l, e.length, r]);
173
+ const H = ar({
165
174
  count: e.length,
166
175
  // State, not a ref: an ancestor's ref is not attached when this child's layout effects
167
176
  // run, so a ref would leave the virtualizer without a scroll element.
168
- getScrollElement: () => o,
169
- estimateSize: () => h,
170
- overscan: qn,
171
- scrollMargin: z
177
+ getScrollElement: () => l,
178
+ estimateSize: () => v,
179
+ overscan: Kr,
180
+ scrollMargin: R
172
181
  });
173
- ae(() => {
182
+ le(() => {
174
183
  if (d)
175
- return d(R, {
176
- startIndex: n,
184
+ return d(O, {
185
+ startIndex: r,
177
186
  count: e.length,
178
- scrollToIndex: (O) => I.scrollToIndex(O, { align: "center" })
179
- }), () => d(R, null);
180
- }, [d, R, n, e.length, I]);
181
- const g = I.getVirtualItems(), D = I.getTotalSize(), A = m >= n && m < n + e.length && g.length > 0 ? Math.min(
182
- Math.max(m, n + g[0].index),
183
- n + g[g.length - 1].index
184
- ) : m, ne = g.length > 0 ? g[0].start - z : 0, B = g.length > 0 ? D - (g[g.length - 1].end - z) : 0;
185
- return /* @__PURE__ */ $("div", { ref: C, className: "flex flex-col w-full", style: b, children: [
186
- ne > 0 && /* @__PURE__ */ r("div", { "aria-hidden": "true", style: { height: ne, flexShrink: 0 } }),
187
- g.map(
188
- (O) => x(
189
- e[O.index],
190
- n + O.index,
191
- O.index === e.length - 1,
192
- O.index === 0,
193
- { measureRef: I.measureElement, index: O.index },
194
- A
187
+ scrollToIndex: (z) => H.scrollToIndex(z, { align: "center" })
188
+ }), () => d(O, null);
189
+ }, [d, O, r, e.length, H]);
190
+ const b = H.getVirtualItems(), F = H.getTotalSize(), M = $ >= r && $ < r + e.length && b.length > 0 ? Math.min(
191
+ Math.max($, r + b[0].index),
192
+ r + b[b.length - 1].index
193
+ ) : $, ne = b.length > 0 ? b[0].start - R : 0, C = b.length > 0 ? F - (b[b.length - 1].end - R) : 0;
194
+ return /* @__PURE__ */ y("div", { ref: D, className: "flex flex-col w-full", style: g, children: [
195
+ ne > 0 && /* @__PURE__ */ i("div", { "aria-hidden": "true", style: { height: ne, flexShrink: 0 } }),
196
+ b.map(
197
+ (z) => k(
198
+ e[z.index],
199
+ r + z.index,
200
+ z.index === e.length - 1,
201
+ z.index === 0,
202
+ { measureRef: H.measureElement, index: z.index },
203
+ M
195
204
  )
196
205
  ),
197
- B > 0 && /* @__PURE__ */ r("div", { "aria-hidden": "true", style: { height: B, flexShrink: 0 } })
206
+ C > 0 && /* @__PURE__ */ i("div", { "aria-hidden": "true", style: { height: C, flexShrink: 0 } })
198
207
  ] });
199
- }, Xn = (e, n) => {
200
- const o = n ? Yn : 0;
201
- return typeof e == "number" ? `${Math.max(0, e - o)}px` : `calc(${e} - ${o}px)`;
202
- }, pe = (e) => {
203
- const n = e.width;
204
- if (n == null)
208
+ }, ri = (e, r) => {
209
+ const l = r ? Qr : 0;
210
+ return typeof e == "number" ? `${Math.max(0, e - l)}px` : `calc(${e} - ${l}px)`;
211
+ }, Ee = (e) => {
212
+ const r = e.width;
213
+ if (r == null)
205
214
  return {};
206
- const o = typeof n == "number" ? `${n}px` : n, h = it(e);
207
- return h === void 0 ? { flexBasis: o, maxWidth: o } : { flexBasis: o, maxWidth: o, minWidth: h, flexShrink: 1 };
208
- }, ot = (e) => {
209
- const n = e.width;
210
- if (n == null)
215
+ const l = typeof r == "number" ? `${r}px` : r, v = At(e);
216
+ return v === void 0 ? { flexBasis: l, maxWidth: l } : { flexBasis: l, maxWidth: l, minWidth: v, flexShrink: 1 };
217
+ }, Wt = (e) => {
218
+ const r = e.width;
219
+ if (r == null)
211
220
  return {};
212
- const o = typeof n == "number" ? `${n}px` : n;
213
- return { width: o, flexBasis: o };
214
- }, Ut = (e) => e === "asc" ? "ascending" : e === "desc" ? "descending" : "none", er = 50, tr = (e, n) => e !== void 0 && Number.isFinite(e) && e >= 1 ? Math.min(Math.floor(e), er) : n, te = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-start", nr = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-between", ve = (e) => e === "center" ? "text-center" : e === "right" ? "text-right" : "text-left", Gt = (e) => e ? te(e) : "justify-end", Ce = ({ info: e }) => /* @__PURE__ */ r(gn, { text: e, placement: "top", children: /* @__PURE__ */ r(un, { size: 13, className: "shrink-0 text-[var(--malachite-text-secondary,#bbb)]" }) }), rr = { ascend: "asc", descend: "desc" }, ir = (e) => {
215
- const n = e.find((o) => o.sorter && o.defaultSortOrder);
216
- return n != null && n.defaultSortOrder ? { key: n.key, direction: rr[n.defaultSortOrder] } : null;
217
- }, jt = (e, n) => ({
221
+ const l = typeof r == "number" ? `${r}px` : r;
222
+ return { width: l, flexBasis: l };
223
+ }, Ln = (e) => e === "asc" ? "ascending" : e === "desc" ? "descending" : "none", ii = 50, li = (e, r) => e !== void 0 && Number.isFinite(e) && e >= 1 ? Math.min(Math.floor(e), ii) : r, ce = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-start", oi = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-between", Ne = (e) => e === "center" ? "text-center" : e === "right" ? "text-right" : "text-left", An = (e) => e ? ce(e) : "justify-end", qe = ({ info: e }) => /* @__PURE__ */ i(_n, { text: e, placement: "top", children: /* @__PURE__ */ i(fr, { size: 13, className: "shrink-0 text-[var(--malachite-text-secondary,#bbb)]" }) }), si = { ascend: "asc", descend: "desc" }, ai = (e) => {
224
+ const r = e.find((l) => l.sorter && l.defaultSortOrder);
225
+ return r != null && r.defaultSortOrder ? { key: r.key, direction: si[r.defaultSortOrder] } : null;
226
+ }, Mn = (e, r) => ({
218
227
  type: "button",
219
- onClick: n,
228
+ onClick: r,
220
229
  "aria-label": typeof e == "string" ? `Sort by ${e}` : "Sort column"
221
- }), lr = ({
230
+ }), ci = ({
222
231
  column: e,
223
- record: n,
224
- index: o,
225
- size: h,
226
- paddingClass: b,
227
- height: x,
232
+ record: r,
233
+ index: l,
234
+ size: v,
235
+ paddingClass: g,
236
+ height: k,
228
237
  bordered: d,
229
- isFirstRow: R,
230
- isLastRow: m,
231
- isFirstColumn: C,
232
- isLastColumn: z,
233
- variantBackground: _,
234
- showSelectedAccent: I,
235
- isSelected: g,
236
- minWidth: D,
237
- id: V
238
+ isFirstRow: O,
239
+ isLastRow: $,
240
+ isFirstColumn: D,
241
+ isLastColumn: R,
242
+ variantBackground: I,
243
+ showSelectedAccent: H,
244
+ isSelected: b,
245
+ minWidth: F,
246
+ id: Z
238
247
  }) => {
239
- const A = n[e.dataIndex], ne = e.render ? e.render(A, n, o) : A == null ? "" : String(A), B = e.ellipsis && lt(A) ? A : void 0;
240
- return /* @__PURE__ */ r(
248
+ const M = r[e.dataIndex], ne = e.render ? e.render(M, r, l) : M == null ? "" : String(M), C = e.ellipsis && Mt(M) ? M : void 0;
249
+ return /* @__PURE__ */ i(
241
250
  "td",
242
251
  {
243
- id: V,
252
+ id: Z,
244
253
  className: `
245
- table-cell ${b} ${ue(h)}
254
+ table-cell ${g} ${$e(v)}
246
255
  ${e.ellipsis ? "truncate overflow-hidden whitespace-nowrap" : ""}
247
256
  ${d ? "table-cell-bordered" : ""}
248
- ${d && R ? "table-cell-bordered-top" : ""}
249
- ${d && C ? "table-cell-bordered-left" : ""}
250
- ${d && z ? "table-cell-bordered-right" : ""}
251
- ${d && C && R ? "rounded-tl-lg" : ""}
252
- ${d && z && R ? "rounded-tr-lg" : ""}
253
- ${d && C && m ? "rounded-bl-lg" : ""}
254
- ${d && z && m ? "rounded-br-lg" : ""}
255
- ${ve(e.align)}
257
+ ${d && O ? "table-cell-bordered-top" : ""}
258
+ ${d && D ? "table-cell-bordered-left" : ""}
259
+ ${d && R ? "table-cell-bordered-right" : ""}
260
+ ${d && D && O ? "rounded-tl-lg" : ""}
261
+ ${d && R && O ? "rounded-tr-lg" : ""}
262
+ ${d && D && $ ? "rounded-bl-lg" : ""}
263
+ ${d && R && $ ? "rounded-br-lg" : ""}
264
+ ${Ne(e.align)}
256
265
  `,
257
266
  style: {
258
267
  width: e.width,
259
- minWidth: D,
260
- height: x,
261
- backgroundColor: _ ?? // Mirror the row's background, or the tint composites over the wrong opaque
268
+ minWidth: F,
269
+ height: k,
270
+ backgroundColor: I ?? // Mirror the row's background, or the tint composites over the wrong opaque
262
271
  // base — they differ in dark mode.
263
- (g ? d ? "var(--malachite-table-borderedRow-background, #fff)" : "var(--malachite-table-row-background, #fff)" : void 0),
272
+ (b ? d ? "var(--malachite-table-borderedRow-background, #fff)" : "var(--malachite-table-row-background, #fff)" : void 0),
264
273
  // Its own layer, so the tint composites over the cell instead of replacing it.
265
- backgroundImage: g ? `linear-gradient(${tt}, ${tt})` : void 0,
274
+ backgroundImage: b ? `linear-gradient(${Ct}, ${Ct})` : void 0,
266
275
  // Content pinning its own colour follows via the channel below.
267
- color: g ? Bt : "var(--malachite-table-row-foreground)",
268
- ...g ? Ht : {},
276
+ color: b ? On : "var(--malachite-table-row-foreground)",
277
+ ...b ? Tn : {},
269
278
  // Inset box-shadow, not `ring-*`: --tw-ring-* silently doesn't paint in a shadow root.
270
- boxShadow: I ? `inset 2px 0 0 ${At}` : void 0,
271
- borderBottom: d ? void 0 : m ? "none" : "1px solid var(--malachite-table-row-border)"
279
+ boxShadow: H ? `inset 2px 0 0 ${Cn}` : void 0,
280
+ borderBottom: d ? void 0 : $ ? "none" : "1px solid var(--malachite-table-row-border)"
272
281
  },
273
- title: B,
282
+ title: C,
274
283
  children: ne
275
284
  }
276
285
  );
277
- }, or = ({
286
+ }, di = ({
278
287
  column: e,
279
- paddingClass: n,
280
- sortDirection: o,
281
- onSort: h,
282
- cellStyle: b
288
+ paddingClass: r,
289
+ sortDirection: l,
290
+ onSort: v,
291
+ cellStyle: g
283
292
  }) => {
284
- const x = !!e.sorter, d = e.title === "" || e.title == null;
293
+ const k = !!e.sorter, d = e.title === "" || e.title == null;
285
294
  if (d && e.width !== void 0)
286
- return /* @__PURE__ */ r(
295
+ return /* @__PURE__ */ i(
287
296
  "div",
288
297
  {
289
298
  role: "columnheader",
290
299
  className: "h-full shrink-0",
291
300
  style: {
292
- ...ot(e),
293
- ...b
301
+ ...Wt(e),
302
+ ...g
294
303
  }
295
304
  }
296
305
  );
297
306
  if (d)
298
- return /* @__PURE__ */ r(
307
+ return /* @__PURE__ */ i(
299
308
  "div",
300
309
  {
301
310
  role: "columnheader",
302
311
  className: "flex flex-[1_0_0] h-full min-w-0",
303
312
  style: {
304
- ...pe(e),
305
- ...b
313
+ ...Ee(e),
314
+ ...g
306
315
  }
307
316
  }
308
317
  );
309
- const m = typeof e.title == "string" ? /* @__PURE__ */ r("p", { className: "font-medium text-[13px] text-[var(--malachite-text-primary,#0a0a0a)] tracking-[0.13px] whitespace-nowrap truncate", children: e.title }) : e.title, C = /* @__PURE__ */ r(
310
- zt,
318
+ const $ = typeof e.title == "string" ? /* @__PURE__ */ i("p", { className: "font-medium text-[13px] text-[var(--malachite-text-primary,#0a0a0a)] tracking-[0.13px] whitespace-nowrap truncate", children: e.title }) : e.title, D = /* @__PURE__ */ i(
319
+ Rn,
311
320
  {
312
321
  size: 13,
313
- className: `shrink-0 transition-transform ${o ? nt : rt} ${o === "asc" ? "rotate-180" : ""}`
322
+ className: `shrink-0 transition-transform ${l ? Tt : Ot} ${l === "asc" ? "rotate-180" : ""}`
314
323
  }
315
324
  );
316
- return x ? /* @__PURE__ */ r(
325
+ return k ? /* @__PURE__ */ i(
317
326
  "div",
318
327
  {
319
328
  role: "columnheader",
320
- "aria-sort": Ut(o),
329
+ "aria-sort": Ln(l),
321
330
  className: "flex flex-[1_0_0] min-w-0 overflow-hidden",
322
- style: { ...pe(e), ...b },
323
- children: /* @__PURE__ */ $(
331
+ style: { ...Ee(e), ...g },
332
+ children: /* @__PURE__ */ y(
324
333
  "button",
325
334
  {
326
- ...jt(e.title, h),
327
- className: `flex flex-1 items-center ${nr(e.align)} gap-1 min-w-0 ${n} cursor-pointer appearance-none bg-transparent border-0 ${ve(e.align)}`,
335
+ ...Mn(e.title, v),
336
+ className: `flex flex-1 items-center ${oi(e.align)} gap-1 min-w-0 ${r} cursor-pointer appearance-none bg-transparent border-0 ${Ne(e.align)}`,
328
337
  children: [
329
- /* @__PURE__ */ $("div", { className: "flex items-center gap-1 min-w-0", children: [
330
- m,
331
- e.info && /* @__PURE__ */ r(Ce, { info: e.info })
338
+ /* @__PURE__ */ y("div", { className: "flex items-center gap-1 min-w-0", children: [
339
+ $,
340
+ e.info && /* @__PURE__ */ i(qe, { info: e.info })
332
341
  ] }),
333
- C
342
+ D
334
343
  ]
335
344
  }
336
345
  )
337
346
  }
338
- ) : /* @__PURE__ */ r(
347
+ ) : /* @__PURE__ */ i(
339
348
  "div",
340
349
  {
341
350
  role: "columnheader",
342
- className: `flex flex-[1_0_0] items-center ${te(e.align)} min-w-0 overflow-hidden ${n}`,
351
+ className: `flex flex-[1_0_0] items-center ${ce(e.align)} min-w-0 overflow-hidden ${r}`,
343
352
  style: {
344
- ...pe(e),
345
- ...b
353
+ ...Ee(e),
354
+ ...g
346
355
  },
347
- children: /* @__PURE__ */ $("div", { className: "flex items-center gap-1 min-w-0", children: [
348
- m,
349
- e.info && /* @__PURE__ */ r(Ce, { info: e.info })
356
+ children: /* @__PURE__ */ y("div", { className: "flex items-center gap-1 min-w-0", children: [
357
+ $,
358
+ e.info && /* @__PURE__ */ i(qe, { info: e.info })
350
359
  ] })
351
360
  }
352
361
  );
353
- }, ar = ({
362
+ }, fi = ({
354
363
  column: e,
355
- record: n,
356
- index: o,
357
- size: h,
358
- paddingClass: b,
359
- isSelected: x = !1,
364
+ record: r,
365
+ index: l,
366
+ size: v,
367
+ paddingClass: g,
368
+ isSelected: k = !1,
360
369
  cellStyle: d,
361
- id: R
370
+ id: O,
371
+ leading: $,
372
+ trailing: D
362
373
  }) => {
363
- const m = n[e.dataIndex], C = e.render ? e.render(m, n, o) : m == null ? "" : String(m), _ = (e.title === "" || e.title == null) && e.width !== void 0, I = lt(m) && m.length > 0, g = x ? {
364
- color: Bt,
365
- ...Ht
374
+ const R = r[e.dataIndex], I = e.render ? e.render(R, r, l) : R == null ? "" : String(R), b = (e.title === "" || e.title == null) && e.width !== void 0, F = Mt(R) && R.length > 0, Z = k ? {
375
+ color: On,
376
+ ...Tn
366
377
  } : {};
367
- if (_)
368
- return /* @__PURE__ */ r(
378
+ if (b && !$ && !D)
379
+ return /* @__PURE__ */ i(
369
380
  "div",
370
381
  {
371
382
  role: "cell",
372
- id: R,
373
- className: `flex items-center ${Gt(e.align)} shrink-0 overflow-hidden ${b}`,
383
+ id: O,
384
+ className: `flex items-center ${An(e.align)} shrink-0 overflow-hidden ${g}`,
374
385
  style: {
375
- ...ot(e),
376
- ...g,
386
+ ...Wt(e),
387
+ ...Z,
377
388
  ...d
378
389
  },
379
- children: C
390
+ children: I
380
391
  }
381
392
  );
382
- const D = !e.render && I ? /* @__PURE__ */ r(mn, { text: m, children: C }) : C;
383
- return /* @__PURE__ */ r(
393
+ const M = !e.render && F ? /* @__PURE__ */ i(mr, { text: R, children: I }) : I, ne = !!($ || D), C = ne ? /* @__PURE__ */ y("div", { className: "flex items-center gap-2 min-w-0", children: [
394
+ $,
395
+ /* @__PURE__ */ i("div", { id: O, className: "flex items-center min-w-0", children: M }),
396
+ D ? /* @__PURE__ */ i("span", { className: "shrink-0 whitespace-nowrap", children: D }) : null
397
+ ] }) : M;
398
+ return /* @__PURE__ */ i(
384
399
  "div",
385
400
  {
386
401
  role: "cell",
387
- id: R,
388
- className: `flex flex-[1_0_0] items-center min-w-0 overflow-hidden ${b} ${ue(h)} ${te(e.align)}`,
402
+ id: ne ? void 0 : O,
403
+ className: `flex flex-[1_0_0] items-center min-w-0 overflow-hidden ${g} ${$e(v)} ${ce(e.align)}`,
389
404
  style: {
390
- ...pe(e),
391
- ...g,
405
+ ...Ee(e),
406
+ ...Z,
392
407
  ...d
393
408
  },
394
- children: D
409
+ children: C
395
410
  }
396
411
  );
397
- }, Cr = ({
412
+ }, Dt = 32, kn = 8, Sn = 16, Wn = 2, hi = Wn + 1.5, Lt = {
413
+ width: Dt,
414
+ flexBasis: Dt
415
+ }, wn = {
416
+ lead: "var(--malachite-text-dimmed, #a1a1a1)",
417
+ follow: "var(--malachite-text-placeholder, #bbbbbb)",
418
+ current: "var(--malachite-text-primary, #0a0a0a)"
419
+ }, $n = `0 0 0 ${Wn}px var(--malachite-table-row-background, #fff)`, En = (e) => ({
420
+ position: "absolute",
421
+ left: "50%",
422
+ width: 2,
423
+ marginLeft: -1,
424
+ top: e === "above" ? 0 : "50%",
425
+ bottom: e === "above" ? "50%" : 0,
426
+ backgroundColor: "var(--malachite-card-border, #e8e8e8)"
427
+ }), ui = ({
428
+ thread: e,
429
+ tabIndex: r
430
+ }) => {
431
+ const l = (e == null ? void 0 : e.emphasis) ?? "follow", v = /* @__PURE__ */ i(
432
+ "span",
433
+ {
434
+ "aria-hidden": "true",
435
+ className: "block rounded-full",
436
+ style: {
437
+ width: kn,
438
+ height: kn,
439
+ backgroundColor: wn[l],
440
+ boxShadow: l === "current" ? `${$n}, 0 0 0 ${hi}px ${wn.current}` : $n
441
+ }
442
+ }
443
+ ), g = e != null && e.onClick ? /* @__PURE__ */ i(
444
+ "button",
445
+ {
446
+ type: "button",
447
+ "aria-label": e.label,
448
+ onClick: e.onClick,
449
+ tabIndex: r,
450
+ className: `relative flex items-center justify-center rounded-full cursor-pointer appearance-none bg-transparent border-0 p-0 ${In}`,
451
+ style: { width: Sn, height: Sn },
452
+ children: v
453
+ }
454
+ ) : /* @__PURE__ */ i(
455
+ "span",
456
+ {
457
+ className: "relative",
458
+ role: e != null && e.label ? "img" : void 0,
459
+ "aria-label": e == null ? void 0 : e.label,
460
+ children: v
461
+ }
462
+ );
463
+ return /* @__PURE__ */ y(
464
+ "div",
465
+ {
466
+ role: "cell",
467
+ className: "relative flex items-center justify-center shrink-0",
468
+ style: Lt,
469
+ children: [
470
+ e != null && e.joinsAbove ? /* @__PURE__ */ i(
471
+ "span",
472
+ {
473
+ "aria-hidden": "true",
474
+ "data-thread-line": "above",
475
+ style: En("above")
476
+ }
477
+ ) : null,
478
+ e != null && e.joinsBelow ? /* @__PURE__ */ i(
479
+ "span",
480
+ {
481
+ "aria-hidden": "true",
482
+ "data-thread-line": "below",
483
+ style: En("below")
484
+ }
485
+ ) : null,
486
+ e ? e.label ? (
487
+ // The label already names the dot; describing it again reads it twice.
488
+ /* @__PURE__ */ i(_n, { text: e.label, placement: "top", describesTrigger: !1, children: g })
489
+ ) : g : null
490
+ ]
491
+ }
492
+ );
493
+ }, Hi = ({
398
494
  columns: e,
399
- data: n,
400
- loading: o = !1,
401
- loadingRowCount: h,
402
- "aria-label": b,
403
- "aria-labelledby": x,
495
+ data: r,
496
+ loading: l = !1,
497
+ loadingRowCount: v,
498
+ "aria-label": g,
499
+ "aria-labelledby": k,
404
500
  error: d = !1,
405
- errorTitle: R = "Data unavailable",
406
- errorSubTitle: m = "There was an issue retrieving the data. Please try again.",
407
- emptyTitle: C = "No data",
408
- emptySubTitle: z = "",
409
- bordered: _ = !1,
410
- showHeader: I = !0,
411
- rowKey: g = "key",
412
- scrollHeight: D,
413
- size: V = "small",
414
- rowDensity: A = "default",
501
+ errorTitle: O = "Data unavailable",
502
+ errorSubTitle: $ = "There was an issue retrieving the data. Please try again.",
503
+ emptyTitle: D = "No data",
504
+ emptySubTitle: R = "",
505
+ bordered: I = !1,
506
+ showHeader: H = !0,
507
+ rowKey: b = "key",
508
+ scrollHeight: F,
509
+ size: Z = "small",
510
+ rowDensity: M = "default",
415
511
  layout: ne = "auto",
416
- headerVariant: B = "inline",
417
- title: O,
418
- subtitle: re,
419
- extra: ie,
420
- rowClassName: W,
421
- rowVariant: L,
422
- onRow: P,
423
- onClickRow: G,
424
- selectedRowKey: j,
425
- scrollSelectedIntoView: at = !0,
426
- rowSelection: st,
427
- pagination: w,
428
- className: dt = "",
429
- style: _e,
430
- stickyHeaderTop: Ie,
431
- scrollX: Y = !1,
432
- rowSection: Oe,
433
- renderSectionDivider: Te,
434
- onVisibleOrderChange: Me,
435
- virtual: Yt = !1,
436
- virtualRowHeightEstimate: Jt,
437
- virtualScrollElement: ge = null
512
+ headerVariant: C = "inline",
513
+ title: z,
514
+ subtitle: de,
515
+ extra: fe,
516
+ rowClassName: U,
517
+ rowVariant: Y,
518
+ onRow: q,
519
+ onClickRow: Q,
520
+ selectedRowKey: W,
521
+ scrollSelectedIntoView: Ht = !0,
522
+ rowSelection: Ft,
523
+ pagination: _,
524
+ className: zt = "",
525
+ style: Ze,
526
+ stickyHeaderTop: Qe,
527
+ scrollX: V = !1,
528
+ rowSection: Ve,
529
+ renderSectionDivider: Ke,
530
+ onVisibleOrderChange: Xe,
531
+ virtual: Hn = !1,
532
+ virtualRowHeightEstimate: Fn,
533
+ virtualScrollElement: _e = null,
534
+ expandable: Bt,
535
+ onReachEnd: be,
536
+ loadingMore: he = !1,
537
+ loadingMoreText: Gt = "Loading more",
538
+ rowThread: Pt,
539
+ rowThreadTitle: zn = "Thread"
438
540
  }) => {
439
- var Rt, Ct;
440
- const se = Gn[A], De = jn[A], We = Pn[A], ct = A === "snug" ? We : void 0, [E, qt] = K(() => ir(e)), ft = q(null), Le = q(null), de = q(null), Fe = q(null), ze = q(/* @__PURE__ */ new Map()), Qt = Ze(
441
- (t, i) => {
442
- i ? ze.current.set(t, i) : ze.current.delete(t);
541
+ var dn, fn;
542
+ const ue = C === "detached" ? Pt : void 0, Ie = e.length + (ue ? 1 : 0), B = C === "detached" ? Bt : void 0, me = qr[M], et = Zr[M], tt = Yr[M], jt = M === "snug" ? tt : void 0, [L, Bn] = te(() => ai(e)), Ut = j(null), nt = j(null), ge = j(null), rt = j(null), it = j(/* @__PURE__ */ new Map()), Gn = Nt(
543
+ (t, n) => {
544
+ n ? it.current.set(t, n) : it.current.delete(t);
443
545
  },
444
546
  []
445
- ), Q = fn(), ht = ((Rt = e.find((t) => t.title !== "" && t.title != null)) == null ? void 0 : Rt.key) ?? ((Ct = e[0]) == null ? void 0 : Ct.key), me = (t) => `${Q}-row-${t}-label`, [Vt, Ae] = K(0), Z = Yt && B === "detached", Zt = Jt ?? Jn, [ce, Kt] = K(null), Xt = Ze((t) => {
446
- de.current = t, t && Kt((i) => i === t ? i : t);
447
- }, []), He = Z ? ge ?? ce : null, [en, ut] = K(null), xe = D === "fill", pt = Rn(
448
- B === "detached" ? ce : en,
449
- xe,
547
+ ), K = cr(), Ce = ((dn = e.find((t) => t.title !== "" && t.title != null)) == null ? void 0 : dn.key) ?? ((fn = e[0]) == null ? void 0 : fn.key), ye = (t) => `${K}-row-${t}-label`, Yt = (t) => `${K}-row-${t}-toggle`, [pe, Pn] = te({
548
+ index: 0
549
+ }), re = Hn && C === "detached", jn = Fn ?? Vr, [ve, Un] = te(null), Yn = Nt((t) => {
550
+ ge.current = t, t && Un((n) => n === t ? n : t);
551
+ }, []), Te = re ? _e ?? ve : null, [Jn, Jt] = te(null), Oe = F === "fill", qt = Nr(
552
+ C === "detached" ? ve : Jn,
553
+ Oe,
450
554
  // The pager is only drawn once loaded, and takes its height out of the room.
451
- !!w && !o
452
- ), Be = pt === void 0 ? void 0 : `${pt}px`, vt = Y ? On(e) : 0, ye = Y && B === "detached" ? Wn(e) : zn, Se = ye.edgeKey !== void 0, [tn, bt] = K(!1), [nn, gt] = K(0), ke = Ze(() => {
453
- const t = de.current;
454
- bt(
555
+ !!_ && !l
556
+ ), lt = qt === void 0 ? void 0 : `${qt}px`, Zt = V ? Ar(e) + (ue ? Dt : 0) : 0, De = V && C === "detached" ? Fr(e) : Br, Le = De.edgeKey !== void 0, [qn, Qt] = te(!1), [Zn, Vt] = te(0), Ae = Nt(() => {
557
+ const t = ge.current;
558
+ Qt(
455
559
  t !== null && t.scrollLeft + t.clientWidth < t.scrollWidth - 1
456
- ), gt(t === null ? 0 : t.offsetWidth - t.clientWidth);
560
+ ), Vt(t === null ? 0 : t.offsetWidth - t.clientWidth);
457
561
  }, []);
458
- ae(() => {
459
- if (!Se || !ce) {
460
- bt(!1), gt(0);
562
+ le(() => {
563
+ if (!Le || !ve) {
564
+ Qt(!1), Vt(0);
461
565
  return;
462
566
  }
463
- if (ke(), typeof ResizeObserver > "u")
567
+ if (Ae(), typeof ResizeObserver > "u")
464
568
  return;
465
- const t = new ResizeObserver(ke);
466
- return t.observe(ce), () => t.disconnect();
467
- }, [Se, ce, vt, ke]);
468
- const Pe = !(Z && ge), J = B === "detached" && Ie !== void 0 && I && !D && (!Z || !Pe), mt = j != null, [Ue, xt] = K(0);
469
- ae(() => {
470
- const t = ft.current;
471
- if (!t || !J || !mt || typeof ResizeObserver > "u") {
472
- xt(0);
569
+ const t = new ResizeObserver(Ae);
570
+ return t.observe(ve), () => t.disconnect();
571
+ }, [Le, ve, Zt, Ae]);
572
+ const ot = !(re && _e), ee = C === "detached" && Qe !== void 0 && H && !F && (!re || !ot), Kt = W != null, [st, Xt] = te(0);
573
+ le(() => {
574
+ const t = Ut.current;
575
+ if (!t || !ee || !Kt || typeof ResizeObserver > "u") {
576
+ Xt(0);
473
577
  return;
474
578
  }
475
- const i = new ResizeObserver((c) => {
476
- var p, v;
477
- const a = c[0], u = ((v = (p = a == null ? void 0 : a.borderBoxSize) == null ? void 0 : p[0]) == null ? void 0 : v.blockSize) ?? (a == null ? void 0 : a.contentRect.height) ?? 0;
478
- xt(
479
- (S) => Math.abs(S - u) < 1 ? S : u
579
+ const n = new ResizeObserver((s) => {
580
+ var h, u;
581
+ const a = s[0], f = ((u = (h = a == null ? void 0 : a.borderBoxSize) == null ? void 0 : h[0]) == null ? void 0 : u.blockSize) ?? (a == null ? void 0 : a.contentRect.height) ?? 0;
582
+ Xt(
583
+ (m) => Math.abs(m - f) < 1 ? m : f
480
584
  );
481
585
  });
482
- return i.observe(t), () => i.disconnect();
483
- }, [J, mt]);
484
- const rn = J ? (Ie ?? 0) + Ue : void 0, { sortedData: T, sectionDividers: Ge } = _t(() => {
485
- const t = (p) => {
486
- if (!E) return p;
487
- const v = e.find((U) => U.key === E.key);
488
- if (!v || v.sorter === "server") return p;
489
- if (typeof v.sorter == "function") {
490
- const U = [...p].sort(v.sorter);
491
- return E.direction === "asc" ? U : U.reverse();
586
+ return n.observe(t), () => n.disconnect();
587
+ }, [ee, Kt]);
588
+ const Qn = ee ? (Qe ?? 0) + st : void 0, { sortedData: Me, sectionDividers: at } = Ue(() => {
589
+ const t = (h) => {
590
+ if (!L) return h;
591
+ const u = e.find((A) => A.key === L.key);
592
+ if (!u || u.sorter === "server") return h;
593
+ if (typeof u.sorter == "function") {
594
+ const A = [...h].sort(u.sorter);
595
+ return L.direction === "asc" ? A : A.reverse();
492
596
  }
493
- const S = v.dataIndex ?? E.key;
494
- return [...p].sort((U, M) => {
495
- const l = U[S], s = M[S];
496
- return l < s ? E.direction === "asc" ? -1 : 1 : l > s ? E.direction === "asc" ? 1 : -1 : 0;
597
+ const m = u.dataIndex ?? L.key;
598
+ return [...h].sort((A, N) => {
599
+ const o = A[m], c = N[m];
600
+ return o < c ? L.direction === "asc" ? -1 : 1 : o > c ? L.direction === "asc" ? 1 : -1 : 0;
497
601
  });
498
602
  };
499
- if (!Oe)
603
+ if (!Ve)
500
604
  return {
501
- sortedData: t(n),
605
+ sortedData: t(r),
502
606
  sectionDividers: /* @__PURE__ */ new Map()
503
607
  };
504
- const i = [], c = /* @__PURE__ */ new Map();
505
- for (const p of n) {
506
- const v = Oe(p);
507
- let S = c.get(v);
508
- S === void 0 && (S = i.length, c.set(v, S), i.push({ key: v, records: [] })), i[S].records.push(p);
608
+ const n = [], s = /* @__PURE__ */ new Map();
609
+ for (const h of r) {
610
+ const u = Ve(h);
611
+ let m = s.get(u);
612
+ m === void 0 && (m = n.length, s.set(u, m), n.push({ key: u, records: [] })), n[m].records.push(h);
509
613
  }
510
- const a = [], u = /* @__PURE__ */ new Map();
511
- for (const p of i) {
512
- const v = t(p.records);
513
- u.set(a.length, { key: p.key, records: v }), a.push(...v);
614
+ const a = [], f = /* @__PURE__ */ new Map();
615
+ for (const h of n) {
616
+ const u = t(h.records);
617
+ f.set(a.length, { key: h.key, records: u }), a.push(...u);
514
618
  }
515
- return { sortedData: a, sectionDividers: u };
516
- }, [n, E, e, Oe]), ln = (t) => {
517
- qt((i) => (i == null ? void 0 : i.key) === t ? i.direction === "asc" ? { key: t, direction: "desc" } : null : { key: t, direction: "asc" });
518
- }, yt = (t, i) => (c) => {
519
- var a, u, p;
520
- ln(t.key), (p = (u = (a = t.onHeaderCell) == null ? void 0 : a.call(t, t, i)) == null ? void 0 : u.onClick) == null || p.call(u, c);
521
- }, je = (t, i) => typeof g == "function" ? g(t) : String(t[g] ?? i), St = typeof g == "function" ? null : g, kt = q(void 0), $e = q(void 0);
522
- ae(() => {
523
- if (!Me)
619
+ return { sortedData: a, sectionDividers: f };
620
+ }, [r, L, e, Ve]), Vn = (t) => {
621
+ Bn((n) => (n == null ? void 0 : n.key) === t ? n.direction === "asc" ? { key: t, direction: "desc" } : null : { key: t, direction: "asc" });
622
+ }, en = (t, n) => (s) => {
623
+ var a, f, h;
624
+ Vn(t.key), (h = (f = (a = t.onHeaderCell) == null ? void 0 : a.call(t, t, n)) == null ? void 0 : f.onClick) == null || h.call(f, s);
625
+ }, xe = (t, n) => typeof b == "function" ? b(t) : String(t[b] ?? n), Kn = (t, n) => {
626
+ if (typeof b == "function")
627
+ return b(t);
628
+ const s = t[b];
629
+ return typeof s == "number" || typeof s == "string" ? s : String(s ?? n);
630
+ }, ct = typeof b == "function" ? null : b, dt = (t) => {
631
+ if (typeof b == "function")
632
+ return b(t);
633
+ const n = t[b];
634
+ return n == null ? void 0 : String(n);
635
+ }, ft = B == null ? void 0 : B.expandedRowKeys.map(String).join("\0"), ht = B == null ? void 0 : B.childRows, Xn = !!ht, { sortedData: G, sectionDividers: ut, rowNesting: E, rowAnchors: pt, rowIds: oe } = Ue(() => {
636
+ if (!ht) {
637
+ const u = Me.map((m, A) => xe(m, A));
638
+ return {
639
+ sortedData: Me,
640
+ sectionDividers: at,
641
+ rowNesting: void 0,
642
+ rowAnchors: void 0,
643
+ rowIds: u
644
+ };
645
+ }
646
+ const t = new Set(ft ? ft.split("\0") : []), n = [], s = [], a = [], f = [], h = /* @__PURE__ */ new Map();
647
+ return Me.forEach((u, m) => {
648
+ const A = at.get(m);
649
+ A && h.set(n.length, A);
650
+ const N = ht(u) ?? [], o = xe(u, m), c = Kn(u, m), p = N.length > 0 && t.has(o), P = n.length;
651
+ n.push(u), a.push(String(m)), f.push(o), s.push(
652
+ N.length > 0 ? { kind: "parent", key: o, rawKey: c, children: N, isOpen: p } : { kind: "leaf" }
653
+ ), p && N.forEach((S, X) => {
654
+ const ie = dt(S);
655
+ n.push(S), a.push(`${m}.${X}`), f.push(`${o}\0${ie ?? `#${X}`}`), s.push({ kind: "child", parentIndex: P });
656
+ });
657
+ }), {
658
+ sortedData: n,
659
+ sectionDividers: h,
660
+ rowNesting: s,
661
+ rowAnchors: a,
662
+ rowIds: f
663
+ };
664
+ }, [Me, at, Xn, ft, ct]);
665
+ (E == null ? void 0 : E.some(
666
+ (t, n) => t.kind === "child" && dt(G[n]) === void 0
667
+ )) && Ye(
668
+ "table-expandable-child-rowkey",
669
+ "Table `expandable` child rows need a `rowKey` of their own to be selected; one without is never matched by `selectedRowKey`."
670
+ );
671
+ const tn = (t, n) => {
672
+ const s = E == null ? void 0 : E[t];
673
+ if (!B || (s == null ? void 0 : s.kind) !== "parent" || s.isOpen === n)
674
+ return;
675
+ He.current = n;
676
+ const a = B.expandedRowKeys.filter(
677
+ (f) => String(f) !== s.key
678
+ );
679
+ B.onExpandedRowKeysChange(n ? [...a, s.rawKey] : a);
680
+ }, nn = j(void 0), We = j(void 0);
681
+ le(() => {
682
+ if (!Xe)
524
683
  return;
525
- $e.current ?? ($e.current = { ids: /* @__PURE__ */ new WeakMap(), next: 0 });
526
- const t = In(T, g, $e.current), i = kt.current;
527
- i && Cn(i, t) || (kt.current = t, Me(T));
528
- }, [T, St, Me]);
529
- const le = Math.min(Vt, Math.max(0, T.length - 1)), F = _t(() => {
530
- if (j == null)
684
+ We.current ?? (We.current = { ids: /* @__PURE__ */ new WeakMap(), next: 0 });
685
+ const t = Lr(G, b, We.current), n = nn.current;
686
+ n && Or(n, t) || (nn.current = t, Xe(G));
687
+ }, [G, ct, Xe]);
688
+ const J = Ue(() => {
689
+ if (W == null)
531
690
  return -1;
532
- const t = String(j);
533
- return T.findIndex((i, c) => je(i, c) === t);
534
- }, [j, T, St]);
535
- ae(() => {
536
- F >= 0 && Ae(F);
537
- }, [F]);
538
- const Ye = q(void 0);
539
- ae(() => {
540
- if (j == null) {
541
- Ye.current = void 0;
691
+ const t = String(W);
692
+ return G.findIndex(
693
+ (n, s) => {
694
+ var a;
695
+ return (((a = E == null ? void 0 : E[s]) == null ? void 0 : a.kind) === "child" ? dt(n) : xe(n, s)) === t;
696
+ }
697
+ );
698
+ }, [W, G, E, ct]), vt = (pt == null ? void 0 : pt[J]) ?? String(J), ae = Ue(() => {
699
+ const t = pe.id === void 0 ? -1 : oe.indexOf(pe.id);
700
+ if (t >= 0)
701
+ return t;
702
+ const n = pe.parentId === void 0 ? -1 : oe.indexOf(pe.parentId);
703
+ return n >= 0 ? n : Math.min(pe.index, Math.max(0, oe.length - 1));
704
+ }, [pe, oe]), bt = (t) => {
705
+ const n = E == null ? void 0 : E[t];
706
+ Pn({
707
+ id: oe[t],
708
+ parentId: (n == null ? void 0 : n.kind) === "child" ? oe[n.parentIndex] : void 0,
709
+ index: t
710
+ });
711
+ }, mt = j(!1), He = j(!1), gt = J >= 0 ? oe[J] : void 0, rn = j({
712
+ key: void 0
713
+ });
714
+ le(() => {
715
+ const t = rn.current, n = He.current;
716
+ He.current = !1, t.key !== W && (mt.current = !1);
717
+ const s = t.key !== W || t.id === void 0;
718
+ rn.current = { key: W, id: gt }, !(gt === void 0 || !s) && (t.key === W && (mt.current || n) || bt(J));
719
+ }, [W, gt]), le(() => {
720
+ He.current = !1;
721
+ });
722
+ const yt = j(void 0);
723
+ le(() => {
724
+ if (W == null) {
725
+ yt.current = void 0;
542
726
  return;
543
727
  }
544
- if (!at || F < 0)
728
+ if (!Ht || J < 0)
545
729
  return;
546
- const t = Ye.current;
547
- if (t && t.key === j && t.index === F || o || d || Z && !He)
730
+ const t = yt.current;
731
+ if (t && t.key === W && t.anchor === vt || l || d || re && !Te)
548
732
  return;
549
- const i = Fe.current;
550
- if (!i)
733
+ const n = rt.current;
734
+ if (!n)
551
735
  return;
552
- const c = J && Ue === 0, a = (l) => i.querySelector(
553
- `[data-table-id="${Q}"][data-row-index="${l}"]`
554
- ), u = (l) => {
555
- const s = de.current, f = ge, H = s == null ? void 0 : s.scrollLeft, N = f == null ? void 0 : f.scrollLeft;
556
- l.scrollIntoView({ block: "nearest", inline: "nearest" }), s && H !== void 0 && (s.scrollLeft = H), f && N !== void 0 && (f.scrollLeft = N), c || (Ye.current = { key: j, index: F });
557
- }, p = a(F);
558
- if (p) {
559
- u(p);
736
+ const s = ee && st === 0, a = (o) => n.querySelector(
737
+ `[data-table-id="${K}"][data-row-index="${o}"]`
738
+ ), f = (o) => {
739
+ const c = ge.current, p = _e, P = c == null ? void 0 : c.scrollLeft, S = p == null ? void 0 : p.scrollLeft;
740
+ o.scrollIntoView({ block: "nearest", inline: "nearest" }), c && P !== void 0 && (c.scrollLeft = P), p && S !== void 0 && (p.scrollLeft = S), s || (yt.current = { key: W, anchor: vt });
741
+ }, h = a(J);
742
+ if (h) {
743
+ f(h);
560
744
  return;
561
745
  }
562
- if (!Z)
746
+ if (!re)
563
747
  return;
564
- const v = [...ze.current.values()].find(
565
- (l) => F >= l.startIndex && F < l.startIndex + l.count
748
+ const u = [...it.current.values()].find(
749
+ (o) => J >= o.startIndex && J < o.startIndex + o.count
566
750
  );
567
- if (!v)
751
+ if (!u)
568
752
  return;
569
- v.scrollToIndex(F - v.startIndex);
570
- let S = 0, U = 0;
571
- const M = () => {
572
- const l = a(F);
573
- if (l) {
574
- u(l);
753
+ u.scrollToIndex(J - u.startIndex);
754
+ let m = 0, A = 0;
755
+ const N = () => {
756
+ const o = a(J);
757
+ if (o) {
758
+ f(o);
575
759
  return;
576
760
  }
577
- ++U < Qn && (S = requestAnimationFrame(M));
761
+ ++A < Xr && (m = requestAnimationFrame(N));
578
762
  };
579
- return S = requestAnimationFrame(M), () => cancelAnimationFrame(S);
763
+ return m = requestAnimationFrame(N), () => cancelAnimationFrame(m);
580
764
  }, [
581
- j,
582
- F,
583
- Z,
584
- He,
585
- ge,
765
+ W,
586
766
  J,
587
- Ue,
588
- o,
767
+ vt,
768
+ re,
769
+ Te,
770
+ _e,
771
+ ee,
772
+ st,
773
+ l,
589
774
  d,
590
- Q,
591
- at
775
+ K,
776
+ Ht
592
777
  ]);
593
- const Je = q(null), $t = (t, i) => {
594
- Je.current = t, Ae(Math.min(Math.max(0, i), T.length - 1));
778
+ const xt = j(null), kt = (t, n) => {
779
+ var a;
780
+ const s = Math.min(Math.max(0, n), G.length - 1);
781
+ if (mt.current = !0, s === ae) {
782
+ (a = t.getRootNode().querySelector(
783
+ `[data-table-id="${K}"][data-row-index="${s}"]`
784
+ )) == null || a.focus();
785
+ return;
786
+ }
787
+ xt.current = t, bt(s);
595
788
  };
596
- Ft(() => {
597
- const t = Je.current;
789
+ Nn(() => {
790
+ const t = xt.current;
598
791
  if (!t)
599
792
  return;
600
- Je.current = null;
601
- const i = t.getRootNode(), a = ((v) => i.querySelector(
602
- `[data-table-id="${Q}"][data-row-index="${v}"]`
603
- ))(le);
793
+ xt.current = null;
794
+ const n = t.getRootNode(), a = ((u) => n.querySelector(
795
+ `[data-table-id="${K}"][data-row-index="${u}"]`
796
+ ))(ae);
604
797
  if (a) {
605
798
  a.focus();
606
799
  return;
607
800
  }
608
- const u = i.querySelectorAll(
609
- `[data-table-id="${Q}"][data-row-index]`
610
- ), p = le > 0 ? u[u.length - 1] : u[0];
611
- p && (Ae(Number(p.dataset.rowIndex)), p.focus());
612
- }, [le, Q]);
613
- const Nt = (t, i) => (c) => {
614
- const a = { ArrowDown: 1, ArrowUp: -1 }[c.key];
615
- if (a !== void 0) {
616
- c.preventDefault(), $t(c.currentTarget, t + a);
801
+ const f = n.querySelectorAll(
802
+ `[data-table-id="${K}"][data-row-index]`
803
+ ), h = ae > 0 ? f[f.length - 1] : f[0];
804
+ h && (bt(Number(h.dataset.rowIndex)), h.focus());
805
+ }, [ae, K]);
806
+ const ln = (t, n) => (s) => {
807
+ const a = E == null ? void 0 : E[t], f = { ArrowRight: !0, ArrowLeft: !1 }[s.key];
808
+ if ((a == null ? void 0 : a.kind) === "parent" && f !== void 0 && a.isOpen !== f && s.target === s.currentTarget) {
809
+ s.preventDefault(), tn(t, f);
617
810
  return;
618
811
  }
619
- if (!Z && (c.key === "Home" || c.key === "End")) {
620
- c.preventDefault(), $t(c.currentTarget, c.key === "Home" ? 0 : T.length - 1);
812
+ if ((a == null ? void 0 : a.kind) === "child" && s.key === "ArrowLeft" && s.target === s.currentTarget) {
813
+ s.preventDefault(), kt(s.currentTarget, a.parentIndex);
621
814
  return;
622
815
  }
623
- i && Nn(c, i, "enter");
624
- };
625
- B !== "detached" && Ot({ title: O, subtitle: re, extra: ie }) && xn(
816
+ const h = { ArrowDown: 1, ArrowUp: -1 }[s.key];
817
+ if (h !== void 0) {
818
+ s.preventDefault(), kt(s.currentTarget, t + h);
819
+ return;
820
+ }
821
+ if (!re && (s.key === "Home" || s.key === "End")) {
822
+ s.preventDefault(), kt(s.currentTarget, s.key === "Home" ? 0 : G.length - 1);
823
+ return;
824
+ }
825
+ n && Sr(s, n, "enter");
826
+ }, St = C === "detached" && !!be, [Fe, er] = te(null), [ke, tr] = te(), on = j(0), sn = re ? Te : F ? ve : null;
827
+ le(() => {
828
+ const t = ++on.current;
829
+ if (!St || !Fe || typeof IntersectionObserver > "u")
830
+ return;
831
+ const n = new IntersectionObserver(
832
+ (s) => tr({
833
+ inView: s.some((a) => a.isIntersecting),
834
+ observer: t
835
+ }),
836
+ {
837
+ root: sn ?? Ir(Fe),
838
+ rootMargin: `0px 0px ${Rr} 0px`
839
+ }
840
+ );
841
+ return n.observe(Fe), () => n.disconnect();
842
+ }, [St, Fe, sn, r.length, l, he, d]);
843
+ const ze = j(void 0);
844
+ le(() => {
845
+ if (l || d) {
846
+ ze.current = void 0;
847
+ return;
848
+ }
849
+ if ((ke == null ? void 0 : ke.observer) === on.current) {
850
+ if (!ke.inView) {
851
+ ze.current = void 0;
852
+ return;
853
+ }
854
+ !be || he || r.length === 0 || ze.current !== r.length && (ze.current = r.length, be());
855
+ }
856
+ }, [ke, be, l, he, d, r.length]), B && typeof b == "string" && r.length > 0 && Ur(r[0][b]) && Ye(
857
+ "table-expandable-rowkey",
858
+ `Table \`expandable\` resolves \`expandedRowKeys\` against \`rowKey\`, and the rows have no \`${b}\`. Pass a \`rowKey\` they carry.`
859
+ ), C !== "detached" && (Bt || Pt || be || he) && Ye(
860
+ "table-detached-only",
861
+ 'Table `expandable`, `rowThread`, `onReachEnd` and `loadingMore` work on the detached header only. Pass `headerVariant="detached"`.'
862
+ ), C !== "detached" && pn({ title: z, subtitle: de, extra: fe }) && Ye(
626
863
  "table-title-inline",
627
864
  'Table `title`, `subtitle` and `extra` draw only on the detached header. Pass `headerVariant="detached"` or leave them out.'
628
865
  );
629
- const qe = tr(
630
- h,
631
- B === "detached" && (w != null && w.pageSize) ? Math.min(w.pageSize, 10) : 5
632
- ), wt = En(w == null ? void 0 : w.position), Ne = (t) => w && !o && wt[t] ? /* @__PURE__ */ r(
633
- wn,
866
+ const wt = li(
867
+ v,
868
+ C === "detached" && (_ != null && _.pageSize) ? Math.min(_.pageSize, 10) : 5
869
+ ), an = Er(_ == null ? void 0 : _.position), Be = (t) => _ && !l && an[t] ? /* @__PURE__ */ i(
870
+ $r,
634
871
  {
635
- current: w.current ?? 1,
636
- pageSize: w.pageSize ?? 10,
637
- total: w.total ?? 0,
638
- showSizeChanger: w.showSizeChanger,
639
- showQuickJumper: w.showQuickJumper,
640
- showTotal: w.showTotal,
641
- pageSizeOptions: w.pageSizeOptions,
642
- onChange: w.onChange,
643
- onShowSizeChange: w.onShowSizeChange,
872
+ current: _.current ?? 1,
873
+ pageSize: _.pageSize ?? 10,
874
+ total: _.total ?? 0,
875
+ showSizeChanger: _.showSizeChanger,
876
+ showQuickJumper: _.showQuickJumper,
877
+ showTotal: _.showTotal,
878
+ pageSizeOptions: _.pageSizeOptions,
879
+ onChange: _.onChange,
880
+ onShowSizeChange: _.onShowSizeChange,
644
881
  edge: t,
645
- align: wt[t]
882
+ align: an[t]
646
883
  }
647
884
  ) : null;
648
- if (B === "detached") {
649
- const t = Y ? { minWidth: vt } : {}, i = (l, s) => ({
650
- ...Y && l.width === void 0 ? { minWidth: l.minWidth ?? Pt } : {},
651
- ...Hn(ye.offsets.get(l.key), s)
652
- }), c = (l) => l.key === ye.edgeKey && tn ? /* @__PURE__ */ r(
885
+ if (C === "detached") {
886
+ const t = V ? { minWidth: Zt } : {}, n = (o, c) => ({
887
+ ...V && o.width === void 0 ? { minWidth: o.minWidth ?? Dn } : {},
888
+ ...Pr(De.offsets.get(o.key), c)
889
+ }), s = (o) => o.key === De.edgeKey && qn ? /* @__PURE__ */ i(
653
890
  "span",
654
891
  {
655
892
  "aria-hidden": "true",
656
893
  className: "shrink-0",
657
894
  style: {
658
895
  position: "sticky",
659
- right: ye.extent,
896
+ right: De.extent,
660
897
  zIndex: 1
661
898
  },
662
- children: /* @__PURE__ */ r("span", { style: An })
899
+ children: /* @__PURE__ */ i("span", { style: Gr })
663
900
  }
664
- ) : null, a = `${Q}-caption`, u = Ot({ title: O, subtitle: re, extra: ie }) ? /* @__PURE__ */ r("div", { role: "caption", id: a, className: "w-full", children: /* @__PURE__ */ r(vn, { title: O, subtitle: re, extra: ie }) }) : null, p = J ? et : "var(--malachite-table-background, #f7f7f7)", v = {
665
- border: kn,
666
- borderRadius: he,
901
+ ) : null, a = `${K}-caption`, f = pn({ title: z, subtitle: de, extra: fe }) ? /* @__PURE__ */ i("div", { role: "caption", id: a, className: "w-full", children: /* @__PURE__ */ i(pr, { title: z, subtitle: de, extra: fe }) }) : null, h = ee ? It : "var(--malachite-table-background, #f7f7f7)", u = {
902
+ border: xr,
903
+ borderRadius: we,
667
904
  overflow: "clip",
668
905
  flexShrink: 0,
669
906
  ...t
670
- }, S = (l, s, f = !1, H = !1, N, X = le) => {
671
- const ee = je(l, s), y = (P == null ? void 0 : P(l, s)) || {}, sn = L == null ? void 0 : L(l, s), we = s === F, Ee = G || y.onClick ? () => {
672
- var k;
673
- G == null || G(l, s), (k = y.onClick) == null || k.call(y, l, s);
674
- } : void 0, oe = !!Ee, dn = f ? {} : Wt;
675
- return /* @__PURE__ */ $(
907
+ }, m = (o, c, p = !1, P = !1, S, X = ae) => {
908
+ var hn;
909
+ const ie = oe[c] ?? xe(o, c), w = (q == null ? void 0 : q(o, c)) || {}, ir = Y == null ? void 0 : Y(o, c), Ge = c === J, Pe = Q || w.onClick ? () => {
910
+ var x;
911
+ Q == null || Q(o, c), (x = w.onClick) == null || x.call(w, o, c);
912
+ } : void 0, se = !!Pe, lr = p ? {} : yn, T = E == null ? void 0 : E[c], or = (T == null ? void 0 : T.kind) === "parent" ? /* @__PURE__ */ i(
913
+ "button",
914
+ {
915
+ type: "button",
916
+ id: Yt(c),
917
+ "aria-expanded": T.isOpen,
918
+ "aria-label": `${T.children.length} ${T.children.length === 1 ? "row" : "rows"}`,
919
+ "aria-labelledby": `${Yt(c)} ${ye(c)}`,
920
+ onClick: () => tn(c, !T.isOpen),
921
+ tabIndex: se ? -1 : void 0,
922
+ className: `flex items-center justify-center shrink-0 rounded cursor-pointer appearance-none bg-transparent border-0 p-0 ${In}`,
923
+ style: { width: Je, height: Je },
924
+ children: /* @__PURE__ */ i(ur, { expanded: T.isOpen })
925
+ }
926
+ ) : E ? (
927
+ // Lines a row's content up with its parents' past their toggles, and indents a
928
+ // child one step further.
929
+ /* @__PURE__ */ i(
930
+ "span",
931
+ {
932
+ "aria-hidden": "true",
933
+ className: "shrink-0",
934
+ style: {
935
+ width: (T == null ? void 0 : T.kind) === "child" ? Tr : Je
936
+ }
937
+ }
938
+ )
939
+ ) : void 0, sr = (T == null ? void 0 : T.kind) === "parent" ? (hn = B == null ? void 0 : B.summary) == null ? void 0 : hn.call(B, o, T.children) : void 0;
940
+ return /* @__PURE__ */ y(
676
941
  "div",
677
942
  {
678
- ref: N == null ? void 0 : N.measureRef,
679
- "data-index": N == null ? void 0 : N.index,
680
- "data-table-id": Q,
681
- "data-row-index": s,
943
+ ref: S == null ? void 0 : S.measureRef,
944
+ "data-index": S == null ? void 0 : S.index,
945
+ "data-table-id": K,
946
+ "data-row-index": c,
682
947
  role: "row",
683
- "aria-labelledby": oe ? me(s) : void 0,
684
- "aria-current": we ? "true" : void 0,
685
- tabIndex: oe ? s === X ? 0 : -1 : void 0,
686
- onKeyDown: oe ? Nt(s, Ee) : void 0,
948
+ "aria-labelledby": se ? ye(c) : void 0,
949
+ "aria-current": Ge ? "true" : void 0,
950
+ tabIndex: se ? c === X ? 0 : -1 : void 0,
951
+ onKeyDown: se ? ln(c, Pe) : void 0,
687
952
  className: `
688
953
  group bg-[var(--malachite-table-row-background,#fff)] flex items-stretch relative w-full
689
- ${oe ? `cursor-pointer hover:bg-[var(--malachite-table-row-hover-background,#fafafa)] ${It}` : ""}
690
- ${(W == null ? void 0 : W(l, s)) || ""}
954
+ ${se ? `cursor-pointer hover:bg-[var(--malachite-table-row-hover-background,#fafafa)] ${un}` : ""}
955
+ ${(U == null ? void 0 : U(o, c)) || ""}
691
956
  `,
692
957
  style: {
693
- ...dn,
958
+ ...lr,
694
959
  ...t,
695
- minHeight: We,
696
- scrollMarginTop: rn,
960
+ minHeight: tt,
961
+ scrollMarginTop: Qn,
697
962
  // Echo the card's clip, or it cuts the accent bar's end into a stub.
698
- ...H ? {
699
- borderTopLeftRadius: he,
700
- borderTopRightRadius: he
963
+ ...P ? {
964
+ borderTopLeftRadius: we,
965
+ borderTopRightRadius: we
701
966
  } : {},
702
- ...f ? {
703
- borderBottomLeftRadius: he,
704
- borderBottomRightRadius: he
967
+ ...p ? {
968
+ borderBottomLeftRadius: we,
969
+ borderBottomRightRadius: we
705
970
  } : {},
706
971
  // Set unconditionally it would beat `hover:bg-*` on every row.
707
- ...Bn(sn, we),
708
- ...we ? {
972
+ ...jr(ir, Ge),
973
+ ...Ge ? {
709
974
  // Inset box-shadow, not `ring-*` — see the classic cell.
710
- boxShadow: `inset 2px 0 0 ${At}`
975
+ boxShadow: `inset 2px 0 0 ${Cn}`
711
976
  } : {}
712
977
  },
713
- onClick: Ee ? (k) => {
714
- Tt(k) || Ee();
978
+ onClick: Pe ? (x) => {
979
+ vn(x) || Pe();
715
980
  } : void 0,
716
- onDoubleClick: y.onDoubleClick ? () => {
717
- var k;
718
- return (k = y.onDoubleClick) == null ? void 0 : k.call(y, l, s);
981
+ onDoubleClick: w.onDoubleClick ? () => {
982
+ var x;
983
+ return (x = w.onDoubleClick) == null ? void 0 : x.call(w, o, c);
719
984
  } : void 0,
720
- onContextMenu: y.onContextMenu ? () => {
721
- var k;
722
- return (k = y.onContextMenu) == null ? void 0 : k.call(y, l, s);
985
+ onContextMenu: w.onContextMenu ? () => {
986
+ var x;
987
+ return (x = w.onContextMenu) == null ? void 0 : x.call(w, o, c);
723
988
  } : void 0,
724
- onMouseEnter: y.onMouseEnter ? () => {
725
- var k;
726
- return (k = y.onMouseEnter) == null ? void 0 : k.call(y, l, s);
989
+ onMouseEnter: w.onMouseEnter ? () => {
990
+ var x;
991
+ return (x = w.onMouseEnter) == null ? void 0 : x.call(w, o, c);
727
992
  } : void 0,
728
- onMouseLeave: y.onMouseLeave ? () => {
729
- var k;
730
- return (k = y.onMouseLeave) == null ? void 0 : k.call(y, l, s);
993
+ onMouseLeave: w.onMouseLeave ? () => {
994
+ var x;
995
+ return (x = w.onMouseLeave) == null ? void 0 : x.call(w, o, c);
731
996
  } : void 0,
732
997
  children: [
733
- e.map((k) => /* @__PURE__ */ $(Re.Fragment, { children: [
734
- c(k),
735
- /* @__PURE__ */ r(
736
- ar,
998
+ ue ? /* @__PURE__ */ i(
999
+ ui,
1000
+ {
1001
+ thread: ue(o, c),
1002
+ tabIndex: se ? c === X ? 0 : -1 : void 0
1003
+ }
1004
+ ) : null,
1005
+ e.map((x) => /* @__PURE__ */ y(je.Fragment, { children: [
1006
+ s(x),
1007
+ /* @__PURE__ */ i(
1008
+ fi,
737
1009
  {
738
- column: k,
739
- record: l,
740
- id: oe && k.key === ht ? me(s) : void 0,
741
- paddingClass: se,
742
- index: s,
743
- size: V,
744
- isSelected: we,
745
- cellStyle: i(k, "row")
1010
+ column: x,
1011
+ record: o,
1012
+ id: (se || (T == null ? void 0 : T.kind) === "parent") && x.key === Ce ? ye(c) : void 0,
1013
+ paddingClass: me,
1014
+ index: c,
1015
+ size: Z,
1016
+ isSelected: Ge,
1017
+ cellStyle: n(x, "row"),
1018
+ leading: x.key === Ce ? or : void 0,
1019
+ trailing: x.key === Ce ? sr : void 0
746
1020
  }
747
1021
  )
748
- ] }, k.key)),
749
- oe && Se ? /* @__PURE__ */ r("span", { "aria-hidden": "true", className: yn }) : null
1022
+ ] }, x.key)),
1023
+ se && Le ? /* @__PURE__ */ i("span", { "aria-hidden": "true", className: gr }) : null
750
1024
  ]
751
1025
  },
752
- ee
1026
+ ie
753
1027
  );
754
- }, U = (l, s = !1) => /* @__PURE__ */ r(
1028
+ }, A = (o, c = !1) => /* @__PURE__ */ y(
755
1029
  "div",
756
1030
  {
757
1031
  "aria-hidden": "true",
758
1032
  className: "bg-[var(--malachite-table-row-background,#fff)] flex items-stretch w-full",
759
1033
  style: {
760
- ...s ? {} : Wt,
1034
+ ...c ? {} : yn,
761
1035
  ...t,
762
- minHeight: We
1036
+ minHeight: tt
763
1037
  },
764
- children: e.map((f) => {
765
- const X = (f.title === "" || f.title == null) && f.width !== void 0 ? /* @__PURE__ */ r(
766
- "div",
767
- {
768
- className: `flex items-center ${Gt(f.align)} shrink-0 overflow-clip ${se}`,
769
- style: {
770
- ...ot(f),
771
- ...i(f, "row")
772
- },
773
- children: /* @__PURE__ */ r("div", { className: "table-skeleton-bar h-3 rounded animate-pulse w-2/5" })
774
- }
775
- ) : /* @__PURE__ */ r(
776
- "div",
777
- {
778
- className: `flex flex-[1_0_0] items-center ${te(f.align)} min-w-0 overflow-clip ${se}`,
779
- style: {
780
- ...pe(f),
781
- ...i(f, "row")
782
- },
783
- children: /* @__PURE__ */ r("div", { className: "table-skeleton-bar h-3 rounded animate-pulse w-3/5" })
784
- }
785
- );
786
- return /* @__PURE__ */ $(Re.Fragment, { children: [
787
- c(f),
788
- X
789
- ] }, f.key);
790
- })
1038
+ children: [
1039
+ ue ? /* @__PURE__ */ i("div", { className: "shrink-0", style: Lt }) : null,
1040
+ e.map((p) => {
1041
+ const X = (p.title === "" || p.title == null) && p.width !== void 0 ? /* @__PURE__ */ i(
1042
+ "div",
1043
+ {
1044
+ className: `flex items-center ${An(p.align)} shrink-0 overflow-clip ${me}`,
1045
+ style: {
1046
+ ...Wt(p),
1047
+ ...n(p, "row")
1048
+ },
1049
+ children: /* @__PURE__ */ i("div", { className: "table-skeleton-bar h-3 rounded animate-pulse w-2/5" })
1050
+ }
1051
+ ) : /* @__PURE__ */ i(
1052
+ "div",
1053
+ {
1054
+ className: `flex flex-[1_0_0] items-center ${ce(p.align)} min-w-0 overflow-clip ${me}`,
1055
+ style: {
1056
+ ...Ee(p),
1057
+ ...n(p, "row")
1058
+ },
1059
+ children: /* @__PURE__ */ i("div", { className: "table-skeleton-bar h-3 rounded animate-pulse w-3/5" })
1060
+ }
1061
+ );
1062
+ return /* @__PURE__ */ y(je.Fragment, { children: [
1063
+ s(p),
1064
+ X
1065
+ ] }, p.key);
1066
+ })
1067
+ ]
791
1068
  },
792
- `skeleton-${l}`
793
- ), M = I ? /* @__PURE__ */ r(
1069
+ `skeleton-${o}`
1070
+ ), N = H ? /* @__PURE__ */ y(
794
1071
  "div",
795
1072
  {
796
1073
  role: "row",
797
1074
  className: "flex items-stretch w-full",
798
- style: { ...t, minHeight: Un[A] },
799
- children: e.map((l, s) => /* @__PURE__ */ $(Re.Fragment, { children: [
800
- c(l),
801
- /* @__PURE__ */ r(
802
- or,
1075
+ style: { ...t, minHeight: Jr[M] },
1076
+ children: [
1077
+ ue ? /* @__PURE__ */ i(
1078
+ "div",
803
1079
  {
804
- column: l,
805
- paddingClass: De,
806
- sortDirection: (E == null ? void 0 : E.key) === l.key ? E.direction : null,
807
- onSort: l.sorter ? yt(l, s) : void 0,
808
- cellStyle: i(l, p)
1080
+ role: "columnheader",
1081
+ "aria-label": zn,
1082
+ className: "shrink-0",
1083
+ style: Lt
809
1084
  }
810
- )
811
- ] }, l.key))
1085
+ ) : null,
1086
+ e.map((o, c) => /* @__PURE__ */ y(je.Fragment, { children: [
1087
+ s(o),
1088
+ /* @__PURE__ */ i(
1089
+ di,
1090
+ {
1091
+ column: o,
1092
+ paddingClass: et,
1093
+ sortDirection: (L == null ? void 0 : L.key) === o.key ? L.direction : null,
1094
+ onSort: o.sorter ? en(o, c) : void 0,
1095
+ cellStyle: n(o, h)
1096
+ }
1097
+ )
1098
+ ] }, o.key))
1099
+ ]
812
1100
  }
813
1101
  ) : null;
814
- return /* @__PURE__ */ $(
1102
+ return /* @__PURE__ */ y(
815
1103
  "div",
816
1104
  {
817
- ref: Fe,
818
- className: `w-full ${dt}`,
819
- style: { ...Ke, ..._e },
1105
+ ref: rt,
1106
+ className: `w-full ${zt}`,
1107
+ style: { ...Rt, ...Ze },
820
1108
  children: [
821
- Ne("top"),
822
- /* @__PURE__ */ $(
1109
+ Be("top"),
1110
+ /* @__PURE__ */ y(
823
1111
  "div",
824
1112
  {
825
1113
  role: "table",
826
- "aria-label": b,
827
- "aria-labelledby": x ?? (b || !u ? void 0 : a),
828
- "aria-busy": o || void 0,
829
- className: `${Sn} flex flex-col items-start ${J ? "" : "overflow-clip"} relative w-full`,
1114
+ "aria-label": g,
1115
+ "aria-labelledby": k ?? (g || !f ? void 0 : a),
1116
+ "aria-busy": l || void 0,
1117
+ className: `${yr} flex flex-col items-start ${ee ? "" : "overflow-clip"} relative w-full`,
830
1118
  children: [
831
- !I && u,
832
- I && /* @__PURE__ */ $(
1119
+ !H && f,
1120
+ H && /* @__PURE__ */ y(
833
1121
  "div",
834
1122
  {
835
- ref: ft,
1123
+ ref: Ut,
836
1124
  style: {
837
- ...J ? {
1125
+ ...ee ? {
838
1126
  position: "sticky",
839
- top: Ie,
1127
+ top: Qe,
840
1128
  zIndex: 8,
841
1129
  // A title row sits on the frame, as a framed Card's
842
1130
  // does; the header colour goes behind the column
843
1131
  // headers alone.
844
- backgroundColor: u ? "var(--malachite-table-background, #f7f7f7)" : et,
845
- marginInline: -fe,
846
- width: `calc(100% + ${fe * 2}px)`,
847
- paddingInline: fe,
1132
+ backgroundColor: f ? "var(--malachite-table-background, #f7f7f7)" : It,
1133
+ marginInline: -Se,
1134
+ width: `calc(100% + ${Se * 2}px)`,
1135
+ paddingInline: Se,
848
1136
  // Vertically too, or the card's top frame sits above
849
1137
  // the docked header and rows scroll through it.
850
- marginTop: -fe,
851
- paddingTop: fe
1138
+ marginTop: -Se,
1139
+ paddingTop: Se
852
1140
  } : { width: "100%" }
853
1141
  },
854
1142
  children: [
855
- J && /* @__PURE__ */ r(Zn, {}),
856
- u,
857
- /* @__PURE__ */ r(
1143
+ ee && /* @__PURE__ */ i(ti, {}),
1144
+ f,
1145
+ /* @__PURE__ */ i(
858
1146
  "div",
859
1147
  {
860
- ref: Le,
1148
+ ref: nt,
861
1149
  role: "rowgroup",
862
- onScroll: Y ? () => Lt(
863
- Le.current,
864
- de.current
1150
+ onScroll: V ? () => xn(
1151
+ nt.current,
1152
+ ge.current
865
1153
  ) : void 0,
866
1154
  style: {
867
- ...Y ? {
868
- ...Ln,
869
- paddingRight: nn
1155
+ ...V ? {
1156
+ ...zr,
1157
+ paddingRight: Zn
870
1158
  } : {},
871
- ...J && u ? { backgroundColor: et } : {}
1159
+ ...ee && f ? { backgroundColor: It } : {}
872
1160
  },
873
- children: M
1161
+ children: N
874
1162
  }
875
1163
  )
876
1164
  ]
877
1165
  }
878
1166
  ),
879
- /* @__PURE__ */ r(
1167
+ /* @__PURE__ */ y(
880
1168
  "div",
881
1169
  {
882
- ref: Xt,
1170
+ ref: Yn,
883
1171
  role: "rowgroup",
884
- onScroll: Y ? () => {
885
- Lt(de.current, Le.current), Se && ke();
1172
+ onScroll: V ? () => {
1173
+ xn(ge.current, nt.current), Le && Ae();
886
1174
  } : void 0,
887
- className: `flex flex-col items-start ${Y ? "overflow-x-auto" : "overflow-x-clip"} ${Pe ? "overflow-y-auto" : "overflow-y-visible"} w-full`,
1175
+ className: `flex flex-col items-start ${V ? "overflow-x-auto" : "overflow-x-clip"} ${ot ? "overflow-y-auto" : "overflow-y-visible"} w-full`,
888
1176
  style: {
889
1177
  // Firefox + modern Chromium only; older Webkit keeps its default.
890
1178
  scrollbarWidth: "thin",
891
1179
  scrollbarColor: "var(--malachite-text-placeholder, rgb(187, 187, 187)) transparent",
892
1180
  // With an external virtual scroller the body is overflow-visible and
893
1181
  // a bounded box would overlap content below it.
894
- ...D && Pe ? {
895
- maxHeight: xe ? Be : Xn(D, !!w)
1182
+ ...F && ot ? {
1183
+ maxHeight: Oe ? lt : ri(F, !!_)
896
1184
  } : {}
897
1185
  },
898
- children: d ? /* @__PURE__ */ r("div", { className: "flex flex-col w-full", style: v, children: /* @__PURE__ */ r(
899
- "div",
900
- {
901
- role: "row",
902
- className: "flex flex-col items-center justify-center bg-[var(--malachite-table-row-background,#fff)] w-full px-4 py-12 text-center",
903
- children: /* @__PURE__ */ $(
904
- "div",
905
- {
906
- role: "cell",
907
- "aria-colspan": e.length,
908
- className: "flex flex-col items-center",
909
- children: [
910
- /* @__PURE__ */ r("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium mb-1", children: R }),
911
- /* @__PURE__ */ r("div", { className: "text-[var(--malachite-text-secondary)] text-[13px]", children: m })
912
- ]
913
- }
914
- )
915
- }
916
- ) }) : o ? /* @__PURE__ */ r("div", { className: "flex flex-col w-full", style: v, children: Array.from({ length: qe }).map(
917
- (l, s) => U(s, s === qe - 1)
918
- ) }) : T.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col w-full", style: v, children: /* @__PURE__ */ r(
919
- "div",
920
- {
921
- role: "row",
922
- className: "flex flex-col items-center justify-center bg-[var(--malachite-table-row-background,#fff)] w-full px-4 py-12 text-center",
923
- children: /* @__PURE__ */ $(
924
- "div",
925
- {
926
- role: "cell",
927
- "aria-colspan": e.length,
928
- className: "flex flex-col items-center",
929
- children: [
930
- /* @__PURE__ */ r("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium", children: C }),
931
- z && /* @__PURE__ */ r("div", { className: "text-[var(--malachite-text-secondary)] text-[13px] mt-1", children: z })
932
- ]
933
- }
934
- )
935
- }
936
- ) }) : (() => {
937
- const l = (f, H, N) => Z ? /* @__PURE__ */ r(
938
- Kn,
1186
+ children: [
1187
+ d ? /* @__PURE__ */ i("div", { className: "flex flex-col w-full", style: u, children: /* @__PURE__ */ i(
1188
+ "div",
939
1189
  {
940
- cardKey: N,
941
- records: f,
942
- startIndex: H,
943
- scrollElement: He,
944
- estimateRowHeight: Zt,
945
- style: v,
946
- renderRow: S,
947
- registerHandle: Qt,
948
- rovingIndex: le
949
- },
950
- `section-card-${N}`
951
- ) : /* @__PURE__ */ r(
1190
+ role: "row",
1191
+ className: "flex flex-col items-center justify-center bg-[var(--malachite-table-row-background,#fff)] w-full px-4 py-12 text-center",
1192
+ children: /* @__PURE__ */ y(
1193
+ "div",
1194
+ {
1195
+ role: "cell",
1196
+ "aria-colspan": Ie,
1197
+ className: "flex flex-col items-center",
1198
+ children: [
1199
+ /* @__PURE__ */ i("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium mb-1", children: O }),
1200
+ /* @__PURE__ */ i("div", { className: "text-[var(--malachite-text-secondary)] text-[13px]", children: $ })
1201
+ ]
1202
+ }
1203
+ )
1204
+ }
1205
+ ) }) : l ? /* @__PURE__ */ i("div", { className: "flex flex-col w-full", style: u, children: Array.from({ length: wt }).map(
1206
+ (o, c) => A(c, c === wt - 1)
1207
+ ) }) : G.length === 0 ? /* @__PURE__ */ i("div", { className: "flex flex-col w-full", style: u, children: /* @__PURE__ */ i(
952
1208
  "div",
953
1209
  {
954
- className: "flex flex-col w-full",
955
- style: v,
956
- children: f.map(
957
- (X, ee) => S(
958
- X,
959
- H + ee,
960
- ee === f.length - 1,
961
- ee === 0
962
- )
1210
+ role: "row",
1211
+ className: "flex flex-col items-center justify-center bg-[var(--malachite-table-row-background,#fff)] w-full px-4 py-12 text-center",
1212
+ children: /* @__PURE__ */ y(
1213
+ "div",
1214
+ {
1215
+ role: "cell",
1216
+ "aria-colspan": Ie,
1217
+ className: "flex flex-col items-center",
1218
+ children: [
1219
+ /* @__PURE__ */ i("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium", children: D }),
1220
+ R && /* @__PURE__ */ i("div", { className: "text-[var(--malachite-text-secondary)] text-[13px] mt-1", children: R })
1221
+ ]
1222
+ }
963
1223
  )
964
- },
965
- `section-card-${N}`
966
- );
967
- if (Ge.size === 0)
968
- return l(T, 0, "all");
969
- const s = [...Ge.keys()].sort((f, H) => f - H);
970
- return s.map((f, H) => {
971
- const N = Ge.get(f);
972
- if (!N)
973
- return null;
974
- const X = H + 1 < s.length ? s[H + 1] : T.length, ee = T.slice(f, X), y = Te == null ? void 0 : Te(
975
- N.key,
976
- N.records
1224
+ }
1225
+ ) }) : (() => {
1226
+ const o = (p, P, S) => re ? /* @__PURE__ */ i(
1227
+ ni,
1228
+ {
1229
+ cardKey: S,
1230
+ records: p,
1231
+ startIndex: P,
1232
+ scrollElement: Te,
1233
+ estimateRowHeight: jn,
1234
+ style: u,
1235
+ renderRow: m,
1236
+ registerHandle: Gn,
1237
+ rovingIndex: ae
1238
+ },
1239
+ `section-card-${S}`
1240
+ ) : /* @__PURE__ */ i(
1241
+ "div",
1242
+ {
1243
+ className: "flex flex-col w-full",
1244
+ style: u,
1245
+ children: p.map(
1246
+ (X, ie) => m(
1247
+ X,
1248
+ P + ie,
1249
+ ie === p.length - 1,
1250
+ ie === 0
1251
+ )
1252
+ )
1253
+ },
1254
+ `section-card-${S}`
977
1255
  );
978
- return /* @__PURE__ */ $(Re.Fragment, { children: [
979
- y != null ? /* @__PURE__ */ r(
1256
+ if (ut.size === 0)
1257
+ return o(G, 0, "all");
1258
+ const c = [...ut.keys()].sort((p, P) => p - P);
1259
+ return c.map((p, P) => {
1260
+ const S = ut.get(p);
1261
+ if (!S)
1262
+ return null;
1263
+ const X = P + 1 < c.length ? c[P + 1] : G.length, ie = G.slice(p, X), w = Ke == null ? void 0 : Ke(
1264
+ S.key,
1265
+ S.records
1266
+ );
1267
+ return /* @__PURE__ */ y(je.Fragment, { children: [
1268
+ w != null ? /* @__PURE__ */ i(
1269
+ "div",
1270
+ {
1271
+ role: "row",
1272
+ className: "table-section-divider",
1273
+ style: V ? mn : void 0,
1274
+ children: /* @__PURE__ */ i("div", { role: "cell", "aria-colspan": Ie, children: w })
1275
+ }
1276
+ ) : null,
1277
+ o(ie, p, S.key)
1278
+ ] }, `section-${S.key}`);
1279
+ });
1280
+ })(),
1281
+ he && !l && !d ? /* @__PURE__ */ i(
1282
+ "div",
1283
+ {
1284
+ role: "row",
1285
+ className: "flex items-center justify-center w-full py-3",
1286
+ style: V ? mn : void 0,
1287
+ children: /* @__PURE__ */ y(
980
1288
  "div",
981
1289
  {
982
- role: "row",
983
- className: "table-section-divider",
984
- style: Y ? Fn : void 0,
985
- children: /* @__PURE__ */ r("div", { role: "cell", "aria-colspan": e.length, children: y })
1290
+ role: "cell",
1291
+ "aria-colspan": Ie,
1292
+ className: "flex items-center gap-2 text-[length:var(--malachite-font-size-small,13px)] text-[var(--malachite-text-secondary)]",
1293
+ children: [
1294
+ /* @__PURE__ */ i(br, { size: "xxxsmall" }),
1295
+ /* @__PURE__ */ i("span", { "aria-hidden": "true", children: Gt })
1296
+ ]
986
1297
  }
987
- ) : null,
988
- l(ee, f, N.key)
989
- ] }, `section-${N.key}`);
990
- });
991
- })()
1298
+ )
1299
+ }
1300
+ ) : null,
1301
+ St ? /* @__PURE__ */ i(
1302
+ "div",
1303
+ {
1304
+ ref: er,
1305
+ "aria-hidden": "true",
1306
+ className: "w-full shrink-0",
1307
+ style: { height: 1 }
1308
+ }
1309
+ ) : null
1310
+ ]
992
1311
  }
993
1312
  )
994
1313
  ]
995
1314
  }
996
1315
  ),
997
- Ne("bottom")
1316
+ /* @__PURE__ */ i("span", { role: "status", style: wr, children: he && !l && !d ? Gt : "" }),
1317
+ Be("bottom")
998
1318
  ]
999
1319
  }
1000
1320
  );
1001
1321
  }
1002
- const Qe = ne === "fixed" || e.some((t) => t.width), Et = Y && (o || T.length > 0), on = Et && Qe ? Mn(e) : void 0, Ve = (t) => Et && !Qe ? t.minWidth : void 0, an = (t, i) => {
1003
- const c = t.sorter, u = (E == null ? void 0 : E.key) === t.key ? E == null ? void 0 : E.direction : null, p = /* @__PURE__ */ $("div", { className: `flex min-w-0 items-center gap-2 ${te(t.align)}`, children: [
1004
- /* @__PURE__ */ r("span", { className: t.titleShrinks ? "min-w-0" : void 0, children: t.title }),
1005
- t.info && /* @__PURE__ */ r(Ce, { info: t.info }),
1006
- c && /* @__PURE__ */ $("div", { className: "flex flex-col", children: [
1007
- /* @__PURE__ */ r(
1008
- hn,
1322
+ const $t = ne === "fixed" || e.some((t) => t.width), cn = V && (l || G.length > 0), nr = cn && $t ? Wr(e) : void 0, Et = (t) => cn && !$t ? t.minWidth : void 0, rr = (t, n) => {
1323
+ const s = t.sorter, f = (L == null ? void 0 : L.key) === t.key ? L == null ? void 0 : L.direction : null, h = /* @__PURE__ */ y("div", { className: `flex min-w-0 items-center gap-2 ${ce(t.align)}`, children: [
1324
+ /* @__PURE__ */ i("span", { className: t.titleShrinks ? "min-w-0" : void 0, children: t.title }),
1325
+ t.info && /* @__PURE__ */ i(qe, { info: t.info }),
1326
+ s && /* @__PURE__ */ y("div", { className: "flex flex-col", children: [
1327
+ /* @__PURE__ */ i(
1328
+ dr,
1009
1329
  {
1010
1330
  size: 12,
1011
- className: u === "asc" ? nt : rt
1331
+ className: f === "asc" ? Tt : Ot
1012
1332
  }
1013
1333
  ),
1014
- /* @__PURE__ */ r(
1015
- zt,
1334
+ /* @__PURE__ */ i(
1335
+ Rn,
1016
1336
  {
1017
1337
  size: 12,
1018
- className: `-mt-1 ${u === "desc" ? nt : rt}`
1338
+ className: `-mt-1 ${f === "desc" ? Tt : Ot}`
1019
1339
  }
1020
1340
  )
1021
1341
  ] })
1022
1342
  ] });
1023
- return /* @__PURE__ */ r(
1343
+ return /* @__PURE__ */ i(
1024
1344
  "th",
1025
1345
  {
1026
1346
  className: `
1027
- table-header table-cell ${De} font-semibold border-0 first:rounded-tl-lg last:rounded-tr-lg
1028
- ${ue(V)}
1029
- ${ve(t.align)}
1347
+ table-header table-cell ${et} font-semibold border-0 first:rounded-tl-lg last:rounded-tr-lg
1348
+ ${$e(Z)}
1349
+ ${Ne(t.align)}
1030
1350
  `,
1031
- style: { width: t.width, minWidth: Ve(t) },
1032
- "aria-sort": c ? Ut(u) : void 0,
1033
- children: c ? /* @__PURE__ */ r(
1351
+ style: { width: t.width, minWidth: Et(t) },
1352
+ "aria-sort": s ? Ln(f) : void 0,
1353
+ children: s ? /* @__PURE__ */ i(
1034
1354
  "button",
1035
1355
  {
1036
- ...jt(t.title, yt(t, i)),
1037
- className: `flex w-full items-center ${te(t.align)} cursor-pointer hover:opacity-80 appearance-none bg-transparent border-0 p-0 font-semibold text-inherit ${ve(t.align)}`,
1038
- children: p
1356
+ ...Mn(t.title, en(t, n)),
1357
+ className: `flex w-full items-center ${ce(t.align)} cursor-pointer hover:opacity-80 appearance-none bg-transparent border-0 p-0 font-semibold text-inherit ${Ne(t.align)}`,
1358
+ children: h
1039
1359
  }
1040
- ) : p
1360
+ ) : h
1041
1361
  },
1042
1362
  t.key
1043
1363
  );
1044
1364
  };
1045
- return d ? /* @__PURE__ */ r("div", { className: "w-full", style: { ...Ke, ..._e }, children: /* @__PURE__ */ r(
1365
+ return d ? /* @__PURE__ */ i("div", { className: "w-full", style: { ...Rt, ...Ze }, children: /* @__PURE__ */ i(
1046
1366
  "div",
1047
1367
  {
1048
- ref: ut,
1368
+ ref: Jt,
1049
1369
  className: "overflow-x-auto",
1050
1370
  style: {
1051
- ...D ? { maxHeight: xe ? Be : D } : {}
1371
+ ...F ? { maxHeight: Oe ? lt : F } : {}
1052
1372
  },
1053
- children: /* @__PURE__ */ $(
1373
+ children: /* @__PURE__ */ y(
1054
1374
  "table",
1055
1375
  {
1056
- "aria-label": b,
1057
- "aria-labelledby": x,
1376
+ "aria-label": g,
1377
+ "aria-labelledby": k,
1058
1378
  className: "w-full border-collapse rounded-lg overflow-hidden",
1059
1379
  children: [
1060
- I && /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ r("tr", { children: e.map((t) => /* @__PURE__ */ r(
1380
+ H && /* @__PURE__ */ i("thead", { children: /* @__PURE__ */ i("tr", { children: e.map((t) => /* @__PURE__ */ i(
1061
1381
  "th",
1062
1382
  {
1063
1383
  className: `
1064
- table-header table-cell ${De} font-semibold border-0 first:rounded-tl-lg last:rounded-tr-lg
1065
- ${_ ? "table-cell-bordered table-cell-bordered-top" : ""}
1066
- ${_ && t === e[0] ? "table-cell-bordered-left" : ""}
1067
- ${_ && t === e[e.length - 1] ? "table-cell-bordered-right" : ""}
1068
- ${ue(V)}
1069
- ${ve(t.align)}
1384
+ table-header table-cell ${et} font-semibold border-0 first:rounded-tl-lg last:rounded-tr-lg
1385
+ ${I ? "table-cell-bordered table-cell-bordered-top" : ""}
1386
+ ${I && t === e[0] ? "table-cell-bordered-left" : ""}
1387
+ ${I && t === e[e.length - 1] ? "table-cell-bordered-right" : ""}
1388
+ ${$e(Z)}
1389
+ ${Ne(t.align)}
1070
1390
  `,
1071
1391
  style: { width: t.width },
1072
- children: /* @__PURE__ */ $(
1392
+ children: /* @__PURE__ */ y(
1073
1393
  "div",
1074
1394
  {
1075
- className: `flex items-center gap-2 ${te(t.align)}`,
1395
+ className: `flex items-center gap-2 ${ce(t.align)}`,
1076
1396
  children: [
1077
- /* @__PURE__ */ r("span", { children: t.title }),
1078
- t.info && /* @__PURE__ */ r(Ce, { info: t.info })
1397
+ /* @__PURE__ */ i("span", { children: t.title }),
1398
+ t.info && /* @__PURE__ */ i(qe, { info: t.info })
1079
1399
  ]
1080
1400
  }
1081
1401
  )
1082
1402
  },
1083
1403
  t.key
1084
1404
  )) }) }),
1085
- /* @__PURE__ */ r("tbody", { children: /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r(
1405
+ /* @__PURE__ */ i("tbody", { children: /* @__PURE__ */ i("tr", { children: /* @__PURE__ */ i(
1086
1406
  "td",
1087
1407
  {
1088
- colSpan: e.length + (st ? 1 : 0),
1408
+ colSpan: e.length + (Ft ? 1 : 0),
1089
1409
  className: "px-4 py-12 text-center",
1090
- children: /* @__PURE__ */ $("div", { className: "flex flex-col items-center justify-center", children: [
1091
- /* @__PURE__ */ r("div", { className: "table-error-icon w-12 h-12 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ r(pn, { size: 24 }) }),
1092
- /* @__PURE__ */ r("div", { className: "table-error-title text-lg font-semibold mb-2", children: R }),
1093
- /* @__PURE__ */ r("div", { className: "table-error-subtitle text-sm", children: m })
1410
+ children: /* @__PURE__ */ y("div", { className: "flex flex-col items-center justify-center", children: [
1411
+ /* @__PURE__ */ i("div", { className: "table-error-icon w-12 h-12 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ i(hr, { size: 24 }) }),
1412
+ /* @__PURE__ */ i("div", { className: "table-error-title text-lg font-semibold mb-2", children: O }),
1413
+ /* @__PURE__ */ i("div", { className: "table-error-subtitle text-sm", children: $ })
1094
1414
  ] })
1095
1415
  }
1096
1416
  ) }) })
@@ -1098,137 +1418,137 @@ const Pt = 160, Cn = (e, n) => e.length === n.length && e.every((o, h) => o ===
1098
1418
  }
1099
1419
  )
1100
1420
  }
1101
- ) }) : /* @__PURE__ */ $(
1421
+ ) }) : /* @__PURE__ */ y(
1102
1422
  "div",
1103
1423
  {
1104
- ref: Fe,
1105
- className: `w-full ${dt}`,
1106
- style: { ...Ke, ..._e },
1424
+ ref: rt,
1425
+ className: `w-full ${zt}`,
1426
+ style: { ...Rt, ...Ze },
1107
1427
  children: [
1108
- Ne("top"),
1109
- /* @__PURE__ */ r(
1428
+ Be("top"),
1429
+ /* @__PURE__ */ i(
1110
1430
  "div",
1111
1431
  {
1112
- className: `overflow-hidden rounded-lg ${_ ? "table-bordered-container" : "table-container-border"}`,
1113
- "data-bordered": _ ? "true" : "false",
1114
- children: /* @__PURE__ */ r(
1432
+ className: `overflow-hidden rounded-lg ${I ? "table-bordered-container" : "table-container-border"}`,
1433
+ "data-bordered": I ? "true" : "false",
1434
+ children: /* @__PURE__ */ i(
1115
1435
  "div",
1116
1436
  {
1117
- ref: ut,
1437
+ ref: Jt,
1118
1438
  className: "overflow-x-auto",
1119
1439
  style: {
1120
- ...D ? { maxHeight: xe ? Be : D } : {}
1440
+ ...F ? { maxHeight: Oe ? lt : F } : {}
1121
1441
  },
1122
- children: /* @__PURE__ */ $(
1442
+ children: /* @__PURE__ */ y(
1123
1443
  "table",
1124
1444
  {
1125
- "aria-label": b,
1126
- "aria-labelledby": x,
1127
- "aria-busy": o || void 0,
1128
- className: `w-full ${Qe ? "table-fixed" : "table-auto"} ${_ ? "border-separate table-bordered" : "border-collapse"} rounded-lg overflow-hidden`,
1445
+ "aria-label": g,
1446
+ "aria-labelledby": k,
1447
+ "aria-busy": l || void 0,
1448
+ className: `w-full ${$t ? "table-fixed" : "table-auto"} ${I ? "border-separate table-bordered" : "border-collapse"} rounded-lg overflow-hidden`,
1129
1449
  style: {
1130
1450
  borderSpacing: "0",
1131
- minWidth: on
1451
+ minWidth: nr
1132
1452
  },
1133
1453
  children: [
1134
- I && /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ r("tr", { children: e.map((t, i) => an(t, i)) }) }),
1135
- /* @__PURE__ */ r("tbody", { children: o ? Array.from({ length: qe }).map((t, i) => /* @__PURE__ */ r(
1454
+ H && /* @__PURE__ */ i("thead", { children: /* @__PURE__ */ i("tr", { children: e.map((t, n) => rr(t, n)) }) }),
1455
+ /* @__PURE__ */ i("tbody", { children: l ? Array.from({ length: wt }).map((t, n) => /* @__PURE__ */ i(
1136
1456
  "tr",
1137
1457
  {
1138
- className: `table-row ${_ ? "table-row-bordered" : ""}`,
1139
- children: e.map((c) => /* @__PURE__ */ r(
1458
+ className: `table-row ${I ? "table-row-bordered" : ""}`,
1459
+ children: e.map((s) => /* @__PURE__ */ i(
1140
1460
  "td",
1141
1461
  {
1142
- className: `table-cell ${se} text-left ${ue(V)}`,
1462
+ className: `table-cell ${me} text-left ${$e(Z)}`,
1143
1463
  style: {
1144
- width: c.width,
1145
- minWidth: Ve(c),
1146
- height: ct
1464
+ width: s.width,
1465
+ minWidth: Et(s),
1466
+ height: jt
1147
1467
  },
1148
- children: /* @__PURE__ */ r("div", { className: "table-skeleton-bar h-4 rounded animate-pulse" })
1468
+ children: /* @__PURE__ */ i("div", { className: "table-skeleton-bar h-4 rounded animate-pulse" })
1149
1469
  },
1150
- c.key
1470
+ s.key
1151
1471
  ))
1152
1472
  },
1153
- i
1154
- )) : T.length === 0 ? /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r(
1473
+ n
1474
+ )) : G.length === 0 ? /* @__PURE__ */ i("tr", { children: /* @__PURE__ */ i(
1155
1475
  "td",
1156
1476
  {
1157
- colSpan: e.length + (st ? 1 : 0),
1477
+ colSpan: e.length + (Ft ? 1 : 0),
1158
1478
  className: "px-4 py-12 text-center",
1159
- children: /* @__PURE__ */ $("div", { className: "flex flex-col items-center justify-center", children: [
1160
- /* @__PURE__ */ r("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium", children: C }),
1161
- z && /* @__PURE__ */ r("div", { className: "text-[var(--malachite-text-secondary)] text-[13px] mt-1", children: z })
1479
+ children: /* @__PURE__ */ y("div", { className: "flex flex-col items-center justify-center", children: [
1480
+ /* @__PURE__ */ i("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium", children: D }),
1481
+ R && /* @__PURE__ */ i("div", { className: "text-[var(--malachite-text-secondary)] text-[13px] mt-1", children: R })
1162
1482
  ] })
1163
1483
  }
1164
- ) }) : T.map((t, i) => {
1165
- const c = je(t, i), a = (P == null ? void 0 : P(t, i)) || {}, u = L == null ? void 0 : L(t, i), p = i === 0, v = i === n.length - 1, S = i === F, U = u ? `var(--malachite-table-row-variant-${u}-background)` : void 0, M = G || a.onClick ? () => {
1166
- var l;
1167
- G == null || G(t, i), (l = a.onClick) == null || l.call(a, t, i);
1484
+ ) }) : G.map((t, n) => {
1485
+ const s = xe(t, n), a = (q == null ? void 0 : q(t, n)) || {}, f = Y == null ? void 0 : Y(t, n), h = n === 0, u = n === r.length - 1, m = n === J, A = f ? `var(--malachite-table-row-variant-${f}-background)` : void 0, N = Q || a.onClick ? () => {
1486
+ var o;
1487
+ Q == null || Q(t, n), (o = a.onClick) == null || o.call(a, t, n);
1168
1488
  } : void 0;
1169
1489
  return (
1170
1490
  // Keeps `row` semantics: `role="button"` would strip the table
1171
1491
  // structure from screen readers.
1172
- /* @__PURE__ */ r(
1492
+ /* @__PURE__ */ i(
1173
1493
  "tr",
1174
1494
  {
1175
- "data-table-id": Q,
1176
- "data-row-index": i,
1177
- "aria-current": S ? "true" : void 0,
1178
- "aria-labelledby": M ? me(i) : void 0,
1179
- tabIndex: M ? i === le ? 0 : -1 : void 0,
1180
- onKeyDown: M ? Nt(i, M) : void 0,
1495
+ "data-table-id": K,
1496
+ "data-row-index": n,
1497
+ "aria-current": m ? "true" : void 0,
1498
+ "aria-labelledby": N ? ye(n) : void 0,
1499
+ tabIndex: N ? n === ae ? 0 : -1 : void 0,
1500
+ onKeyDown: N ? ln(n, N) : void 0,
1181
1501
  className: `
1182
- ${_ ? "table-row-bordered" : `table-row ${S ? "" : "hover:opacity-80"}`}
1183
- ${(W == null ? void 0 : W(t, i)) || ""}
1184
- ${M ? `cursor-pointer ${It}` : ""}
1502
+ ${I ? "table-row-bordered" : `table-row ${m ? "" : "hover:opacity-80"}`}
1503
+ ${(U == null ? void 0 : U(t, n)) || ""}
1504
+ ${N ? `cursor-pointer ${un}` : ""}
1185
1505
  `,
1186
- onClick: M ? (l) => {
1187
- Tt(l) || M();
1506
+ onClick: N ? (o) => {
1507
+ vn(o) || N();
1188
1508
  } : void 0,
1189
1509
  onDoubleClick: a.onDoubleClick ? () => {
1190
- var l;
1191
- return (l = a.onDoubleClick) == null ? void 0 : l.call(a, t, i);
1510
+ var o;
1511
+ return (o = a.onDoubleClick) == null ? void 0 : o.call(a, t, n);
1192
1512
  } : void 0,
1193
1513
  onContextMenu: a.onContextMenu ? () => {
1194
- var l;
1195
- return (l = a.onContextMenu) == null ? void 0 : l.call(a, t, i);
1514
+ var o;
1515
+ return (o = a.onContextMenu) == null ? void 0 : o.call(a, t, n);
1196
1516
  } : void 0,
1197
1517
  onMouseEnter: a.onMouseEnter ? () => {
1198
- var l;
1199
- return (l = a.onMouseEnter) == null ? void 0 : l.call(a, t, i);
1518
+ var o;
1519
+ return (o = a.onMouseEnter) == null ? void 0 : o.call(a, t, n);
1200
1520
  } : void 0,
1201
1521
  onMouseLeave: a.onMouseLeave ? () => {
1202
- var l;
1203
- return (l = a.onMouseLeave) == null ? void 0 : l.call(a, t, i);
1522
+ var o;
1523
+ return (o = a.onMouseLeave) == null ? void 0 : o.call(a, t, n);
1204
1524
  } : void 0,
1205
- children: e.map((l) => {
1206
- const s = l === e[0], f = l === e[e.length - 1];
1207
- return /* @__PURE__ */ r(
1208
- lr,
1525
+ children: e.map((o) => {
1526
+ const c = o === e[0], p = o === e[e.length - 1];
1527
+ return /* @__PURE__ */ i(
1528
+ ci,
1209
1529
  {
1210
- column: l,
1530
+ column: o,
1211
1531
  record: t,
1212
- index: i,
1213
- size: V,
1214
- paddingClass: se,
1215
- height: ct,
1216
- bordered: _,
1217
- isFirstRow: p,
1218
- isLastRow: v,
1219
- isFirstColumn: s,
1220
- isLastColumn: f,
1221
- variantBackground: U,
1222
- isSelected: S,
1223
- showSelectedAccent: S && s,
1224
- minWidth: Ve(l),
1225
- id: M && l.key === ht ? me(i) : void 0
1532
+ index: n,
1533
+ size: Z,
1534
+ paddingClass: me,
1535
+ height: jt,
1536
+ bordered: I,
1537
+ isFirstRow: h,
1538
+ isLastRow: u,
1539
+ isFirstColumn: c,
1540
+ isLastColumn: p,
1541
+ variantBackground: A,
1542
+ isSelected: m,
1543
+ showSelectedAccent: m && c,
1544
+ minWidth: Et(o),
1545
+ id: N && o.key === Ce ? ye(n) : void 0
1226
1546
  },
1227
- l.key
1547
+ o.key
1228
1548
  );
1229
1549
  })
1230
1550
  },
1231
- c
1551
+ s
1232
1552
  )
1233
1553
  );
1234
1554
  }) })
@@ -1239,12 +1559,12 @@ const Pt = 160, Cn = (e, n) => e.length === n.length && e.every((o, h) => o ===
1239
1559
  )
1240
1560
  }
1241
1561
  ),
1242
- Ne("bottom")
1562
+ Be("bottom")
1243
1563
  ]
1244
1564
  }
1245
1565
  );
1246
1566
  };
1247
1567
  export {
1248
- Cr as default
1568
+ Hi as default
1249
1569
  };
1250
1570
  //# sourceMappingURL=Table.js.map