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