@stackone/malachite 2.132.0 → 2.133.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 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) => {
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) => {
22
22
  if (typeof e != "object" || e === null)
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) => {
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) => {
33
33
  if (typeof e == "number")
34
34
  return e;
35
35
  if (typeof e == "string") {
@@ -37,257 +37,260 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
37
37
  if (n)
38
38
  return Number(n[1]);
39
39
  }
40
- }, nt = (e) => {
41
- const n = pe(e.width);
40
+ }, it = (e) => {
41
+ const n = be(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
- }, 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) => {
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
47
  const n = typeof e == "string" ? e.trim().toLowerCase() : e;
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);
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);
53
53
  if (d === void 0)
54
54
  return;
55
- d === 0 ? (n += 1, o = Math.max(o, v ?? 0)) : u += d;
55
+ d === 0 ? (n += 1, o = Math.max(o, x ?? 0)) : h += d;
56
56
  }
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 });
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 });
63
63
  },
64
64
  { right: 0, edge: void 0 }
65
65
  );
66
- return { offsets: u, edgeKey: p.edge, extent: p.right };
67
- }, In = { overflowX: "auto", scrollbarWidth: "none" }, On = {
66
+ return { offsets: h, edgeKey: b.edge, extent: b.right };
67
+ }, Ln = { overflowX: "auto", scrollbarWidth: "none" }, Fn = {
68
68
  position: "sticky",
69
69
  left: 0,
70
70
  width: "100%"
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 = {
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 = {
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, ${Ze(45)}, ${Ze(18)} 30%, ${Ze(5)} 65%, transparent)`
79
- }, Dn = (e, n) => e === void 0 ? {} : {
78
+ backgroundImage: `linear-gradient(to left, ${Xe(45)}, ${Xe(18)} 30%, ${Xe(5)} 65%, transparent)`
79
+ }, Hn = (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
- }, It = (e) => `linear-gradient(${e}, ${e})`, Wn = (e, n) => {
85
+ }, Dt = (e) => `linear-gradient(${e}, ${e})`, Bn = (e, n) => {
86
86
  if (!e && !n)
87
87
  return {};
88
88
  const o = [
89
- n ? It(Ke) : void 0,
90
- e ? It(`var(--malachite-table-row-variant-${e}-background)`) : void 0
91
- ].filter(rt);
89
+ n ? Dt(tt) : void 0,
90
+ e ? Dt(`var(--malachite-table-row-variant-${e}-background)`) : void 0
91
+ ].filter(lt);
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
- }, rt = (e) => typeof e == "string", Ln = {
96
+ }, lt = (e) => typeof e == "string", Pn = {
97
97
  default: 40,
98
98
  compact: 30,
99
99
  snug: 38
100
- }, Fn = {
100
+ }, Un = {
101
101
  default: 40,
102
102
  compact: 40,
103
103
  snug: 34
104
- }, zn = {
104
+ }, Gn = {
105
105
  default: "px-4 py-3",
106
106
  compact: "px-4 py-1",
107
107
  snug: "px-3 py-0"
108
- }, An = {
108
+ }, jn = {
109
109
  default: "px-4 py-3",
110
110
  compact: "px-4 py-3",
111
111
  snug: "px-3 py-[9px]"
112
- }, et = "text-[var(--malachite-text-primary,#0a0a0a)]", tt = "text-[var(--malachite-text-dimmed,#a1a1a1)]", fe = (e) => ({
112
+ }, nt = "text-[var(--malachite-text-primary,#0a0a0a)]", rt = "text-[var(--malachite-text-dimmed,#a1a1a1)]", ue = (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], Ot = {
116
+ })[e], Wt = {
117
117
  borderBottom: "1px solid var(--malachite-card-border, #e8e8e8)"
118
- }, Tt = (e, n) => {
118
+ }, Lt = (e, n) => {
119
119
  e && n && n.scrollLeft !== e.scrollLeft && (n.scrollLeft = e.scrollLeft);
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,
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,
122
122
  {
123
- radius: vn,
124
- surround: `var(${Gn}, var(--malachite-card-background, #ffffff))`
123
+ radius: $n,
124
+ surround: `var(${Vn}, var(--malachite-card-background, #ffffff))`
125
125
  }
126
- ), Yn = ({
126
+ ), Kn = ({
127
127
  records: e,
128
128
  startIndex: n,
129
129
  scrollElement: o,
130
- estimateRowHeight: u,
131
- style: p,
132
- renderRow: v,
130
+ estimateRowHeight: h,
131
+ style: b,
132
+ renderRow: x,
133
133
  registerHandle: d,
134
- cardKey: N,
135
- rovingIndex: S
134
+ cardKey: R,
135
+ rovingIndex: m
136
136
  }) => {
137
- const F = q(null), [M, I] = Z(0);
138
- Mt(() => {
139
- const O = F.current;
137
+ const C = q(null), [z, _] = K(0);
138
+ Ft(() => {
139
+ const O = C.current;
140
140
  if (!O || !o)
141
141
  return;
142
- const ne = () => {
143
- const W = O.getBoundingClientRect().top - o.getBoundingClientRect().top + o.scrollTop;
144
- I((H) => Math.abs(H - W) < 1 ? H : W);
142
+ const re = () => {
143
+ const L = O.getBoundingClientRect().top - o.getBoundingClientRect().top + o.scrollTop;
144
+ _((P) => Math.abs(P - L) < 1 ? P : L);
145
145
  };
146
- if (ne(), typeof ResizeObserver > "u")
146
+ if (re(), typeof ResizeObserver > "u")
147
147
  return;
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;
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
157
  else {
158
- const U = D.getRootNode();
159
- D = U instanceof ShadowRoot ? U.host : null;
158
+ const G = W.getRootNode();
159
+ W = G instanceof ShadowRoot ? G.host : null;
160
160
  }
161
161
  }
162
- return () => re.disconnect();
162
+ return () => ie.disconnect();
163
163
  }, [o, e.length, n]);
164
- const C = ln({
164
+ const I = cn({
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: () => u,
170
- overscan: Pn,
171
- scrollMargin: M
169
+ estimateSize: () => h,
170
+ overscan: qn,
171
+ scrollMargin: z
172
172
  });
173
- le(() => {
173
+ ae(() => {
174
174
  if (d)
175
- return d(N, {
175
+ return d(R, {
176
176
  startIndex: n,
177
177
  count: e.length,
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
- n + m[m.length - 1].index
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
- m.map(
188
- (O) => v(
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
189
  e[O.index],
190
190
  n + O.index,
191
191
  O.index === e.length - 1,
192
192
  O.index === 0,
193
- { measureRef: C.measureElement, index: O.index },
194
- Q
193
+ { measureRef: I.measureElement, index: O.index },
194
+ A
195
195
  )
196
196
  ),
197
- P > 0 && /* @__PURE__ */ r("div", { "aria-hidden": "true", style: { height: P, flexShrink: 0 } })
197
+ B > 0 && /* @__PURE__ */ r("div", { "aria-hidden": "true", style: { height: B, flexShrink: 0 } })
198
198
  ] });
199
- }, Jn = (e, n) => {
200
- const o = n ? Hn : 0;
199
+ }, Xn = (e, n) => {
200
+ const o = n ? Yn : 0;
201
201
  return typeof e == "number" ? `${Math.max(0, e - o)}px` : `calc(${e} - ${o}px)`;
202
- }, he = (e) => {
202
+ }, pe = (e) => {
203
203
  const n = e.width;
204
204
  if (n == null)
205
205
  return {};
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) => {
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
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
- }, 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) => {
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
215
  const n = e.find((o) => o.sorter && o.defaultSortOrder);
216
- return n != null && n.defaultSortOrder ? { key: n.key, direction: Xn[n.defaultSortOrder] } : null;
217
- }, Ht = (e, n) => ({
216
+ return n != null && n.defaultSortOrder ? { key: n.key, direction: rr[n.defaultSortOrder] } : null;
217
+ }, jt = (e, n) => ({
218
218
  type: "button",
219
219
  onClick: n,
220
220
  "aria-label": typeof e == "string" ? `Sort by ${e}` : "Sort column"
221
- }), er = ({
221
+ }), lr = ({
222
222
  column: e,
223
223
  record: n,
224
224
  index: o,
225
- size: u,
226
- paddingClass: p,
227
- height: v,
225
+ size: h,
226
+ paddingClass: b,
227
+ height: x,
228
228
  bordered: d,
229
- isFirstRow: N,
230
- isLastRow: S,
231
- isFirstColumn: F,
232
- isLastColumn: M,
233
- variantBackground: I,
234
- showSelectedAccent: C,
235
- isSelected: m,
236
- minWidth: z
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
237
238
  }) => {
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
+ 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;
239
240
  return /* @__PURE__ */ r(
240
241
  "td",
241
242
  {
243
+ id: V,
242
244
  className: `
243
- table-cell ${p} ${fe(u)}
245
+ table-cell ${b} ${ue(h)}
244
246
  ${e.ellipsis ? "truncate overflow-hidden whitespace-nowrap" : ""}
245
247
  ${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)}
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)}
254
256
  `,
255
257
  style: {
256
258
  width: e.width,
257
- minWidth: z,
258
- height: v,
259
- backgroundColor: I ?? // Mirror the row's background, or the tint composites over the wrong opaque
259
+ minWidth: D,
260
+ height: x,
261
+ backgroundColor: _ ?? // Mirror the row's background, or the tint composites over the wrong opaque
260
262
  // base — they differ in dark mode.
261
- (m ? d ? "var(--malachite-table-borderedRow-background, #fff)" : "var(--malachite-table-row-background, #fff)" : void 0),
263
+ (g ? d ? "var(--malachite-table-borderedRow-background, #fff)" : "var(--malachite-table-row-background, #fff)" : void 0),
262
264
  // Its own layer, so the tint composites over the cell instead of replacing it.
263
- backgroundImage: m ? `linear-gradient(${Ke}, ${Ke})` : void 0,
265
+ backgroundImage: g ? `linear-gradient(${tt}, ${tt})` : void 0,
264
266
  // Content pinning its own colour follows via the channel below.
265
- color: m ? Ft : "var(--malachite-table-row-foreground)",
266
- ...m ? Lt : {},
267
+ color: g ? Bt : "var(--malachite-table-row-foreground)",
268
+ ...g ? Ht : {},
267
269
  // Inset box-shadow, not `ring-*`: --tw-ring-* silently doesn't paint in a shadow root.
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
+ boxShadow: I ? `inset 2px 0 0 ${At}` : void 0,
271
+ borderBottom: d ? void 0 : m ? "none" : "1px solid var(--malachite-table-row-border)"
270
272
  },
271
- title: te,
272
- children: Q
273
+ title: B,
274
+ children: ne
273
275
  }
274
276
  );
275
- }, tr = ({
277
+ }, or = ({
276
278
  column: e,
277
279
  paddingClass: n,
278
280
  sortDirection: o,
279
- onSort: u,
280
- cellStyle: p
281
+ onSort: h,
282
+ cellStyle: b
281
283
  }) => {
282
- const v = !!e.sorter, d = e.title === "" || e.title == null;
284
+ const x = !!e.sorter, d = e.title === "" || e.title == null;
283
285
  if (d && e.width !== void 0)
284
286
  return /* @__PURE__ */ r(
285
287
  "div",
286
288
  {
289
+ role: "columnheader",
287
290
  className: "h-full shrink-0",
288
291
  style: {
289
- ...it(e),
290
- ...p
292
+ ...ot(e),
293
+ ...b
291
294
  }
292
295
  }
293
296
  );
@@ -295,36 +298,39 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
295
298
  return /* @__PURE__ */ r(
296
299
  "div",
297
300
  {
301
+ role: "columnheader",
298
302
  className: "flex flex-[1_0_0] h-full min-w-0",
299
303
  style: {
300
- ...he(e),
301
- ...p
304
+ ...pe(e),
305
+ ...b
302
306
  }
303
307
  }
304
308
  );
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,
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,
307
311
  {
308
312
  size: 13,
309
- className: `shrink-0 transition-transform ${o ? et : tt} ${o === "asc" ? "rotate-180" : ""}`
313
+ className: `shrink-0 transition-transform ${o ? nt : rt} ${o === "asc" ? "rotate-180" : ""}`
310
314
  }
311
315
  );
312
- return v ? /* @__PURE__ */ r(
316
+ return x ? /* @__PURE__ */ r(
313
317
  "div",
314
318
  {
319
+ role: "columnheader",
320
+ "aria-sort": Ut(o),
315
321
  className: "flex flex-[1_0_0] min-w-0 overflow-hidden",
316
- style: { ...he(e), ...p },
317
- children: /* @__PURE__ */ y(
322
+ style: { ...pe(e), ...b },
323
+ children: /* @__PURE__ */ $(
318
324
  "button",
319
325
  {
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)}`,
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)}`,
322
328
  children: [
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 })
329
+ /* @__PURE__ */ $("div", { className: "flex items-center gap-1 min-w-0", children: [
330
+ m,
331
+ e.info && /* @__PURE__ */ r(Ce, { info: e.info })
326
332
  ] }),
327
- F
333
+ C
328
334
  ]
329
335
  }
330
336
  )
@@ -332,295 +338,299 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
332
338
  ) : /* @__PURE__ */ r(
333
339
  "div",
334
340
  {
335
- className: `flex flex-[1_0_0] items-center ${ee(e.align)} min-w-0 overflow-hidden ${n}`,
341
+ role: "columnheader",
342
+ className: `flex flex-[1_0_0] items-center ${te(e.align)} min-w-0 overflow-hidden ${n}`,
336
343
  style: {
337
- ...he(e),
338
- ...p
344
+ ...pe(e),
345
+ ...b
339
346
  },
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 })
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 })
343
350
  ] })
344
351
  }
345
352
  );
346
- }, nr = ({
353
+ }, ar = ({
347
354
  column: e,
348
355
  record: n,
349
356
  index: o,
350
- size: u,
351
- paddingClass: p,
352
- isSelected: v = !1,
353
- cellStyle: d
357
+ size: h,
358
+ paddingClass: b,
359
+ isSelected: x = !1,
360
+ cellStyle: d,
361
+ id: R
354
362
  }) => {
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
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
358
366
  } : {};
359
- if (M)
367
+ if (_)
360
368
  return /* @__PURE__ */ r(
361
369
  "div",
362
370
  {
363
- className: `flex items-center ${At(e.align)} shrink-0 overflow-hidden ${p}`,
371
+ role: "cell",
372
+ id: R,
373
+ className: `flex items-center ${Gt(e.align)} shrink-0 overflow-hidden ${b}`,
364
374
  style: {
365
- ...it(e),
366
- ...C,
375
+ ...ot(e),
376
+ ...g,
367
377
  ...d
368
378
  },
369
- children: S
379
+ children: C
370
380
  }
371
381
  );
372
- const m = !e.render && I ? /* @__PURE__ */ r(un, { text: N, children: S }) : S;
382
+ const D = !e.render && I ? /* @__PURE__ */ r(mn, { text: m, children: C }) : C;
373
383
  return /* @__PURE__ */ r(
374
384
  "div",
375
385
  {
376
- className: `flex flex-[1_0_0] items-center min-w-0 overflow-hidden ${p} ${fe(u)} ${ee(e.align)}`,
386
+ 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)}`,
377
389
  style: {
378
- ...he(e),
379
- ...C,
390
+ ...pe(e),
391
+ ...g,
380
392
  ...d
381
393
  },
382
- children: m
394
+ children: D
383
395
  }
384
396
  );
385
- }, $r = ({
397
+ }, Cr = ({
386
398
  columns: e,
387
399
  data: n,
388
400
  loading: o = !1,
389
- loadingRowCount: u,
390
- "aria-label": p,
391
- "aria-labelledby": v,
401
+ loadingRowCount: h,
402
+ "aria-label": b,
403
+ "aria-labelledby": x,
392
404
  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
+ 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",
415
+ layout: ne = "auto",
416
+ headerVariant: B = "inline",
405
417
  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,
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,
415
427
  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
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
426
438
  }) => {
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(
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(
428
441
  (t, i) => {
429
- i ? Le.current.set(t, i) : Le.current.delete(t);
442
+ i ? ze.current.set(t, i) : ze.current.delete(t);
430
443
  },
431
444
  []
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,
436
- ge,
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,
437
450
  // The pager is only drawn once loaded, and takes its height out of the room.
438
451
  !!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(
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(
442
455
  t !== null && t.scrollLeft + t.clientWidth < t.scrollWidth - 1
443
- ), pt(t === null ? 0 : t.offsetWidth - t.clientWidth);
456
+ ), gt(t === null ? 0 : t.offsetWidth - t.clientWidth);
444
457
  }, []);
445
- le(() => {
446
- if (!me || !se) {
447
- ut(!1), pt(0);
458
+ ae(() => {
459
+ if (!Se || !ce) {
460
+ bt(!1), gt(0);
448
461
  return;
449
462
  }
450
- if (xe(), typeof ResizeObserver > "u")
463
+ if (ke(), typeof ResizeObserver > "u")
451
464
  return;
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);
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);
460
473
  return;
461
474
  }
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
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
467
480
  );
468
481
  });
469
482
  return i.observe(t), () => i.disconnect();
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();
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();
479
492
  }
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;
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;
484
497
  });
485
498
  };
486
- if (!_e)
499
+ if (!Oe)
487
500
  return {
488
501
  sortedData: t(n),
489
502
  sectionDividers: /* @__PURE__ */ new Map()
490
503
  };
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);
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);
496
509
  }
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);
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);
501
514
  }
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)
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)
511
524
  return;
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)
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)
518
531
  return -1;
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;
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;
529
542
  return;
530
543
  }
531
- if (!lt || L < 0)
544
+ if (!at || F < 0)
532
545
  return;
533
- const t = Ge.current;
534
- if (t && t.key === G && t.index === L || o || d || V && !ze)
546
+ const t = Ye.current;
547
+ if (t && t.key === j && t.index === F || o || d || Z && !He)
535
548
  return;
536
- const i = We.current;
549
+ const i = Fe.current;
537
550
  if (!i)
538
551
  return;
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);
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);
547
560
  return;
548
561
  }
549
- if (!V)
562
+ if (!Z)
550
563
  return;
551
- const g = [...Le.current.values()].find(
552
- (l) => L >= l.startIndex && L < l.startIndex + l.count
564
+ const v = [...ze.current.values()].find(
565
+ (l) => F >= l.startIndex && F < l.startIndex + l.count
553
566
  );
554
- if (!g)
567
+ if (!v)
555
568
  return;
556
- g.scrollToIndex(L - g.startIndex);
557
- let k = 0, B = 0;
558
- const s = () => {
559
- const l = a(L);
569
+ v.scrollToIndex(F - v.startIndex);
570
+ let S = 0, U = 0;
571
+ const M = () => {
572
+ const l = a(F);
560
573
  if (l) {
561
- b(l);
574
+ u(l);
562
575
  return;
563
576
  }
564
- ++B < Un && (k = requestAnimationFrame(s));
577
+ ++U < Qn && (S = requestAnimationFrame(M));
565
578
  };
566
- return k = requestAnimationFrame(s), () => cancelAnimationFrame(k);
579
+ return S = requestAnimationFrame(M), () => cancelAnimationFrame(S);
567
580
  }, [
568
- G,
569
- L,
570
- V,
571
- ze,
572
- be,
573
- Y,
574
- Be,
581
+ j,
582
+ F,
583
+ Z,
584
+ He,
585
+ ge,
586
+ J,
587
+ Ue,
575
588
  o,
576
589
  d,
577
- X,
578
- lt
590
+ Q,
591
+ at
579
592
  ]);
580
- const je = q(null), yt = (t, i) => {
581
- je.current = t, Fe(Math.min(Math.max(0, i), T.length - 1));
593
+ const Je = q(null), $t = (t, i) => {
594
+ Je.current = t, Ae(Math.min(Math.max(0, i), T.length - 1));
582
595
  };
583
- Mt(() => {
584
- const t = je.current;
596
+ Ft(() => {
597
+ const t = Je.current;
585
598
  if (!t)
586
599
  return;
587
- je.current = null;
588
- const i = t.getRootNode(), a = ((g) => i.querySelector(
589
- `[data-table-id="${X}"][data-row-index="${g}"]`
590
- ))(ie);
600
+ Je.current = null;
601
+ const i = t.getRootNode(), a = ((v) => i.querySelector(
602
+ `[data-table-id="${Q}"][data-row-index="${v}"]`
603
+ ))(le);
591
604
  if (a) {
592
605
  a.focus();
593
606
  return;
594
607
  }
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];
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];
602
615
  if (a !== void 0) {
603
- f.preventDefault(), yt(f.currentTarget, t + a);
616
+ c.preventDefault(), $t(c.currentTarget, t + a);
604
617
  return;
605
618
  }
606
- if (!V && (f.key === "Home" || f.key === "End")) {
607
- f.preventDefault(), yt(f.currentTarget, f.key === "Home" ? 0 : T.length - 1);
619
+ if (!Z && (c.key === "Home" || c.key === "End")) {
620
+ c.preventDefault(), $t(c.currentTarget, c.key === "Home" ? 0 : T.length - 1);
608
621
  return;
609
622
  }
610
- i && mn(f, i, "enter");
623
+ i && Nn(c, i, "enter");
611
624
  };
612
- P !== "detached" && Rt({ title: O, subtitle: ne, extra: re }) && Et(
625
+ B !== "detached" && Ot({ title: O, subtitle: re, extra: ie }) && xn(
613
626
  "table-title-inline",
614
627
  '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."
618
628
  );
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,
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,
624
634
  {
625
635
  current: w.current ?? 1,
626
636
  pageSize: w.pageSize ?? 10,
@@ -632,225 +642,235 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
632
642
  onChange: w.onChange,
633
643
  onShowSizeChange: w.onShowSizeChange,
634
644
  edge: t,
635
- align: kt[t]
645
+ align: wt[t]
636
646
  }
637
647
  ) : null;
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(
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(
643
653
  "span",
644
654
  {
645
655
  "aria-hidden": "true",
646
656
  className: "shrink-0",
647
657
  style: {
648
658
  position: "sticky",
649
- right: ve.extent,
659
+ right: ye.extent,
650
660
  zIndex: 1
651
661
  },
652
- children: /* @__PURE__ */ r("span", { style: Mn })
662
+ children: /* @__PURE__ */ r("span", { style: An })
653
663
  }
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,
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,
657
667
  overflow: "clip",
658
668
  flexShrink: 0,
659
669
  ...t
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(
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__ */ $(
666
676
  "div",
667
677
  {
668
- ref: E == null ? void 0 : E.measureRef,
669
- "data-index": E == null ? void 0 : E.index,
670
- "data-table-id": X,
671
- "data-row-index": l,
672
- "aria-current": ke ? "true" : void 0,
673
- tabIndex: Ne ? l === J ? 0 : -1 : void 0,
674
- onKeyDown: Ne ? St(l, $e) : void 0,
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,
682
+ 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,
675
687
  className: `
676
688
  group bg-[var(--malachite-table-row-background,#fff)] flex items-stretch relative w-full
677
- ${Ne ? `cursor-pointer hover:bg-[var(--malachite-table-row-hover-background,#fafafa)] ${wt}` : ""}
678
- ${(D == null ? void 0 : D(s, l)) || ""}
689
+ ${oe ? `cursor-pointer hover:bg-[var(--malachite-table-row-hover-background,#fafafa)] ${It}` : ""}
690
+ ${(W == null ? void 0 : W(l, s)) || ""}
679
691
  `,
680
692
  style: {
681
- ...rn,
693
+ ...dn,
682
694
  ...t,
683
- minHeight: Me,
684
- scrollMarginTop: Xt,
695
+ minHeight: We,
696
+ scrollMarginTop: rn,
685
697
  // Echo the card's clip, or it cuts the accent bar's end into a stub.
686
- ...R ? {
687
- borderTopLeftRadius: ce,
688
- borderTopRightRadius: ce
698
+ ...H ? {
699
+ borderTopLeftRadius: he,
700
+ borderTopRightRadius: he
689
701
  } : {},
690
- ...c ? {
691
- borderBottomLeftRadius: ce,
692
- borderBottomRightRadius: ce
702
+ ...f ? {
703
+ borderBottomLeftRadius: he,
704
+ borderBottomRightRadius: he
693
705
  } : {},
694
706
  // Set unconditionally it would beat `hover:bg-*` on every row.
695
- ...Wn(nn, ke),
696
- ...ke ? {
707
+ ...Bn(sn, we),
708
+ ...we ? {
697
709
  // Inset box-shadow, not `ring-*` — see the classic cell.
698
- boxShadow: `inset 2px 0 0 ${Wt}`
710
+ boxShadow: `inset 2px 0 0 ${At}`
699
711
  } : {}
700
712
  },
701
- onClick: $e ? ($) => {
702
- Ct($) || $e();
713
+ onClick: Ee ? (k) => {
714
+ Tt(k) || Ee();
703
715
  } : void 0,
704
- onDoubleClick: x.onDoubleClick ? () => {
705
- var $;
706
- return ($ = x.onDoubleClick) == null ? void 0 : $.call(x, s, l);
716
+ onDoubleClick: y.onDoubleClick ? () => {
717
+ var k;
718
+ return (k = y.onDoubleClick) == null ? void 0 : k.call(y, l, s);
707
719
  } : void 0,
708
- onContextMenu: x.onContextMenu ? () => {
709
- var $;
710
- return ($ = x.onContextMenu) == null ? void 0 : $.call(x, s, l);
720
+ onContextMenu: y.onContextMenu ? () => {
721
+ var k;
722
+ return (k = y.onContextMenu) == null ? void 0 : k.call(y, l, s);
711
723
  } : void 0,
712
- onMouseEnter: x.onMouseEnter ? () => {
713
- var $;
714
- return ($ = x.onMouseEnter) == null ? void 0 : $.call(x, s, l);
724
+ onMouseEnter: y.onMouseEnter ? () => {
725
+ var k;
726
+ return (k = y.onMouseEnter) == null ? void 0 : k.call(y, l, s);
715
727
  } : void 0,
716
- onMouseLeave: x.onMouseLeave ? () => {
717
- var $;
718
- return ($ = x.onMouseLeave) == null ? void 0 : $.call(x, s, l);
728
+ onMouseLeave: y.onMouseLeave ? () => {
729
+ var k;
730
+ return (k = y.onMouseLeave) == null ? void 0 : k.call(y, l, s);
719
731
  } : void 0,
720
732
  children: [
721
- e.map(($) => /* @__PURE__ */ y(Ee.Fragment, { children: [
722
- f($),
733
+ e.map((k) => /* @__PURE__ */ $(Re.Fragment, { children: [
734
+ c(k),
723
735
  /* @__PURE__ */ r(
724
- nr,
736
+ ar,
725
737
  {
726
- column: $,
727
- record: s,
728
- paddingClass: oe,
729
- index: l,
730
- size: A,
731
- isSelected: ke,
732
- cellStyle: i($, "row")
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")
733
746
  }
734
747
  )
735
- ] }, $.key)),
736
- Ne && me ? /* @__PURE__ */ r("span", { "aria-hidden": "true", className: pn }) : null
748
+ ] }, k.key)),
749
+ oe && Se ? /* @__PURE__ */ r("span", { "aria-hidden": "true", className: yn }) : null
737
750
  ]
738
751
  },
739
- K
752
+ ee
740
753
  );
741
- }, k = (s, l = !1) => /* @__PURE__ */ r(
754
+ }, U = (l, s = !1) => /* @__PURE__ */ r(
742
755
  "div",
743
756
  {
757
+ "aria-hidden": "true",
744
758
  className: "bg-[var(--malachite-table-row-background,#fff)] flex items-stretch w-full",
745
759
  style: {
746
- ...l ? {} : Ot,
760
+ ...s ? {} : Wt,
747
761
  ...t,
748
- minHeight: Me
762
+ minHeight: We
749
763
  },
750
- children: e.map((c) => {
751
- const J = (c.title === "" || c.title == null) && c.width !== void 0 ? /* @__PURE__ */ r(
764
+ children: e.map((f) => {
765
+ const X = (f.title === "" || f.title == null) && f.width !== void 0 ? /* @__PURE__ */ r(
752
766
  "div",
753
767
  {
754
- className: `flex items-center ${At(c.align)} shrink-0 overflow-clip ${oe}`,
768
+ className: `flex items-center ${Gt(f.align)} shrink-0 overflow-clip ${se}`,
755
769
  style: {
756
- ...it(c),
757
- ...i(c, "row")
770
+ ...ot(f),
771
+ ...i(f, "row")
758
772
  },
759
773
  children: /* @__PURE__ */ r("div", { className: "table-skeleton-bar h-3 rounded animate-pulse w-2/5" })
760
774
  }
761
775
  ) : /* @__PURE__ */ r(
762
776
  "div",
763
777
  {
764
- className: `flex flex-[1_0_0] items-center ${ee(c.align)} min-w-0 overflow-clip ${oe}`,
778
+ className: `flex flex-[1_0_0] items-center ${te(f.align)} min-w-0 overflow-clip ${se}`,
765
779
  style: {
766
- ...he(c),
767
- ...i(c, "row")
780
+ ...pe(f),
781
+ ...i(f, "row")
768
782
  },
769
783
  children: /* @__PURE__ */ r("div", { className: "table-skeleton-bar h-3 rounded animate-pulse w-3/5" })
770
784
  }
771
785
  );
772
- return /* @__PURE__ */ y(Ee.Fragment, { children: [
773
- f(c),
774
- J
775
- ] }, c.key);
786
+ return /* @__PURE__ */ $(Re.Fragment, { children: [
787
+ c(f),
788
+ X
789
+ ] }, f.key);
776
790
  })
777
791
  },
778
- `skeleton-${s}`
779
- ), B = C ? /* @__PURE__ */ r(
792
+ `skeleton-${l}`
793
+ ), M = I ? /* @__PURE__ */ r(
780
794
  "div",
781
795
  {
796
+ role: "row",
782
797
  className: "flex items-stretch w-full",
783
- style: { ...t, minHeight: Fn[Q] },
784
- children: e.map((s, l) => /* @__PURE__ */ y(Ee.Fragment, { children: [
785
- f(s),
798
+ style: { ...t, minHeight: Un[A] },
799
+ children: e.map((l, s) => /* @__PURE__ */ $(Re.Fragment, { children: [
800
+ c(l),
786
801
  /* @__PURE__ */ r(
787
- tr,
802
+ or,
788
803
  {
789
- column: s,
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)
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)
794
809
  }
795
810
  )
796
- ] }, s.key))
811
+ ] }, l.key))
797
812
  }
798
813
  ) : null;
799
- return /* @__PURE__ */ y(
814
+ return /* @__PURE__ */ $(
800
815
  "div",
801
816
  {
802
- ref: We,
803
- className: `w-full ${at}`,
804
- style: { ...Ve, ...Re },
817
+ ref: Fe,
818
+ className: `w-full ${dt}`,
819
+ style: { ...Ke, ..._e },
805
820
  children: [
806
- Se("top"),
807
- /* @__PURE__ */ y(
821
+ Ne("top"),
822
+ /* @__PURE__ */ $(
808
823
  "div",
809
824
  {
810
- className: `${bn} flex flex-col items-start ${Y ? "" : "overflow-clip"} relative w-full`,
825
+ 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`,
811
830
  children: [
812
- !C && a,
813
- C && /* @__PURE__ */ y(
831
+ !I && u,
832
+ I && /* @__PURE__ */ $(
814
833
  "div",
815
834
  {
816
- ref: dt,
835
+ ref: ft,
817
836
  style: {
818
- ...Y ? {
837
+ ...J ? {
819
838
  position: "sticky",
820
- top: Ce,
839
+ top: Ie,
821
840
  zIndex: 8,
822
841
  // A title row sits on the frame, as a framed Card's
823
842
  // does; the header colour goes behind the column
824
843
  // headers alone.
825
- backgroundColor: a ? "var(--malachite-table-background, #f7f7f7)" : Xe,
826
- marginInline: -de,
827
- width: `calc(100% + ${de * 2}px)`,
828
- paddingInline: de,
844
+ backgroundColor: u ? "var(--malachite-table-background, #f7f7f7)" : et,
845
+ marginInline: -fe,
846
+ width: `calc(100% + ${fe * 2}px)`,
847
+ paddingInline: fe,
829
848
  // Vertically too, or the card's top frame sits above
830
849
  // the docked header and rows scroll through it.
831
- marginTop: -de,
832
- paddingTop: de
850
+ marginTop: -fe,
851
+ paddingTop: fe
833
852
  } : { width: "100%" }
834
853
  },
835
854
  children: [
836
- Y && /* @__PURE__ */ r(jn, {}),
837
- a,
855
+ J && /* @__PURE__ */ r(Zn, {}),
856
+ u,
838
857
  /* @__PURE__ */ r(
839
858
  "div",
840
859
  {
841
- ref: De,
842
- onScroll: j ? () => Tt(
843
- De.current,
844
- ae.current
860
+ ref: Le,
861
+ role: "rowgroup",
862
+ onScroll: Y ? () => Lt(
863
+ Le.current,
864
+ de.current
845
865
  ) : void 0,
846
866
  style: {
847
- ...j ? {
848
- ...In,
849
- paddingRight: Zt
867
+ ...Y ? {
868
+ ...Ln,
869
+ paddingRight: nn
850
870
  } : {},
851
- ...Y && a ? { backgroundColor: Xe } : {}
871
+ ...J && u ? { backgroundColor: et } : {}
852
872
  },
853
- children: B
873
+ children: M
854
874
  }
855
875
  )
856
876
  ]
@@ -859,82 +879,114 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
859
879
  /* @__PURE__ */ r(
860
880
  "div",
861
881
  {
862
- ref: qt,
863
- onScroll: j ? () => {
864
- Tt(ae.current, De.current), me && xe();
882
+ ref: Xt,
883
+ role: "rowgroup",
884
+ onScroll: Y ? () => {
885
+ Lt(de.current, Le.current), Se && ke();
865
886
  } : void 0,
866
- className: `flex flex-col items-start ${j ? "overflow-x-auto" : "overflow-x-clip"} ${He ? "overflow-y-auto" : "overflow-y-visible"} w-full`,
887
+ className: `flex flex-col items-start ${Y ? "overflow-x-auto" : "overflow-x-clip"} ${Pe ? "overflow-y-auto" : "overflow-y-visible"} w-full`,
867
888
  style: {
868
889
  // Firefox + modern Chromium only; older Webkit keeps its default.
869
890
  scrollbarWidth: "thin",
870
891
  scrollbarColor: "var(--malachite-text-placeholder, rgb(187, 187, 187)) transparent",
871
892
  // With an external virtual scroller the body is overflow-visible and
872
893
  // a bounded box would overlap content below it.
873
- ...z && He ? {
874
- maxHeight: ge ? Ae : Jn(z, !!w)
894
+ ...D && Pe ? {
895
+ maxHeight: xe ? Be : Xn(D, !!w)
875
896
  } : {}
876
897
  },
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 px-4 py-12 text-center", 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 px-4 py-12 text-center", 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 })
885
- ] }) }) : (() => {
886
- const s = (c, R, E) => V ? /* @__PURE__ */ r(
887
- Yn,
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,
888
939
  {
889
- cardKey: E,
890
- records: c,
891
- startIndex: R,
892
- scrollElement: ze,
893
- estimateRowHeight: Yt,
894
- style: h,
895
- renderRow: g,
896
- registerHandle: Gt,
897
- rovingIndex: ie
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
898
949
  },
899
- `section-card-${E}`
950
+ `section-card-${N}`
900
951
  ) : /* @__PURE__ */ r(
901
952
  "div",
902
953
  {
903
954
  className: "flex flex-col w-full",
904
- style: h,
905
- children: c.map(
906
- (J, K) => g(
907
- J,
908
- R + K,
909
- K === c.length - 1,
910
- K === 0
955
+ style: v,
956
+ children: f.map(
957
+ (X, ee) => S(
958
+ X,
959
+ H + ee,
960
+ ee === f.length - 1,
961
+ ee === 0
911
962
  )
912
963
  )
913
964
  },
914
- `section-card-${E}`
965
+ `section-card-${N}`
915
966
  );
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);
921
- if (!E)
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)
922
973
  return null;
923
- const J = R + 1 < l.length ? l[R + 1] : T.length, K = T.slice(c, J), x = Ie == null ? void 0 : Ie(
924
- E.key,
925
- E.records
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
926
977
  );
927
- return /* @__PURE__ */ y(Ee.Fragment, { children: [
928
- x != null ? /* @__PURE__ */ r(
978
+ return /* @__PURE__ */ $(Re.Fragment, { children: [
979
+ y != null ? /* @__PURE__ */ r(
929
980
  "div",
930
981
  {
982
+ role: "row",
931
983
  className: "table-section-divider",
932
- style: j ? On : void 0,
933
- children: x
984
+ style: Y ? Fn : void 0,
985
+ children: /* @__PURE__ */ r("div", { role: "cell", "aria-colspan": e.length, children: y })
934
986
  }
935
987
  ) : null,
936
- s(K, c, E.key)
937
- ] }, `section-${E.key}`);
988
+ l(ee, f, N.key)
989
+ ] }, `section-${N.key}`);
938
990
  });
939
991
  })()
940
992
  }
@@ -942,28 +994,28 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
942
994
  ]
943
995
  }
944
996
  ),
945
- Se("bottom")
997
+ Ne("bottom")
946
998
  ]
947
999
  }
948
1000
  );
949
1001
  }
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: [
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: [
952
1004
  /* @__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: [
1005
+ t.info && /* @__PURE__ */ r(Ce, { info: t.info }),
1006
+ c && /* @__PURE__ */ $("div", { className: "flex flex-col", children: [
955
1007
  /* @__PURE__ */ r(
956
- an,
1008
+ hn,
957
1009
  {
958
1010
  size: 12,
959
- className: b === "asc" ? et : tt
1011
+ className: u === "asc" ? nt : rt
960
1012
  }
961
1013
  ),
962
1014
  /* @__PURE__ */ r(
963
- Dt,
1015
+ zt,
964
1016
  {
965
1017
  size: 12,
966
- className: `-mt-1 ${b === "desc" ? et : tt}`
1018
+ className: `-mt-1 ${u === "desc" ? nt : rt}`
967
1019
  }
968
1020
  )
969
1021
  ] })
@@ -972,58 +1024,58 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
972
1024
  "th",
973
1025
  {
974
1026
  className: `
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)}
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)}
978
1030
  `,
979
- style: { width: t.width, minWidth: qe(t) },
980
- "aria-sort": f ? qn(b) : void 0,
981
- children: f ? /* @__PURE__ */ r(
1031
+ style: { width: t.width, minWidth: Ve(t) },
1032
+ "aria-sort": c ? Ut(u) : void 0,
1033
+ children: c ? /* @__PURE__ */ r(
982
1034
  "button",
983
1035
  {
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
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
987
1039
  }
988
- ) : h
1040
+ ) : p
989
1041
  },
990
1042
  t.key
991
1043
  );
992
1044
  };
993
- return d ? /* @__PURE__ */ r("div", { className: "w-full", style: { ...Ve, ...Re }, children: /* @__PURE__ */ r(
1045
+ return d ? /* @__PURE__ */ r("div", { className: "w-full", style: { ...Ke, ..._e }, children: /* @__PURE__ */ r(
994
1046
  "div",
995
1047
  {
996
- ref: ct,
1048
+ ref: ut,
997
1049
  className: "overflow-x-auto",
998
1050
  style: {
999
- ...z ? { maxHeight: ge ? Ae : z } : {}
1051
+ ...D ? { maxHeight: xe ? Be : D } : {}
1000
1052
  },
1001
- children: /* @__PURE__ */ y(
1053
+ children: /* @__PURE__ */ $(
1002
1054
  "table",
1003
1055
  {
1004
- "aria-label": p,
1005
- "aria-labelledby": v,
1056
+ "aria-label": b,
1057
+ "aria-labelledby": x,
1006
1058
  className: "w-full border-collapse rounded-lg overflow-hidden",
1007
1059
  children: [
1008
- C && /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ r("tr", { children: e.map((t) => /* @__PURE__ */ r(
1060
+ I && /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ r("tr", { children: e.map((t) => /* @__PURE__ */ r(
1009
1061
  "th",
1010
1062
  {
1011
1063
  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)}
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)}
1018
1070
  `,
1019
1071
  style: { width: t.width },
1020
- children: /* @__PURE__ */ y(
1072
+ children: /* @__PURE__ */ $(
1021
1073
  "div",
1022
1074
  {
1023
- className: `flex items-center gap-2 ${ee(t.align)}`,
1075
+ className: `flex items-center gap-2 ${te(t.align)}`,
1024
1076
  children: [
1025
1077
  /* @__PURE__ */ r("span", { children: t.title }),
1026
- t.info && /* @__PURE__ */ r(we, { info: t.info })
1078
+ t.info && /* @__PURE__ */ r(Ce, { info: t.info })
1027
1079
  ]
1028
1080
  }
1029
1081
  )
@@ -1033,12 +1085,12 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
1033
1085
  /* @__PURE__ */ r("tbody", { children: /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r(
1034
1086
  "td",
1035
1087
  {
1036
- colSpan: e.length + (ot ? 1 : 0),
1088
+ colSpan: e.length + (st ? 1 : 0),
1037
1089
  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 })
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 })
1042
1094
  ] })
1043
1095
  }
1044
1096
  ) }) })
@@ -1046,73 +1098,73 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
1046
1098
  }
1047
1099
  )
1048
1100
  }
1049
- ) }) : /* @__PURE__ */ y(
1101
+ ) }) : /* @__PURE__ */ $(
1050
1102
  "div",
1051
1103
  {
1052
- ref: We,
1053
- className: `w-full ${at}`,
1054
- style: { ...Ve, ...Re },
1104
+ ref: Fe,
1105
+ className: `w-full ${dt}`,
1106
+ style: { ...Ke, ..._e },
1055
1107
  children: [
1056
- Se("top"),
1108
+ Ne("top"),
1057
1109
  /* @__PURE__ */ r(
1058
1110
  "div",
1059
1111
  {
1060
- className: `overflow-hidden rounded-lg ${I ? "table-bordered-container" : "table-container-border"}`,
1061
- "data-bordered": I ? "true" : "false",
1112
+ className: `overflow-hidden rounded-lg ${_ ? "table-bordered-container" : "table-container-border"}`,
1113
+ "data-bordered": _ ? "true" : "false",
1062
1114
  children: /* @__PURE__ */ r(
1063
1115
  "div",
1064
1116
  {
1065
- ref: ct,
1117
+ ref: ut,
1066
1118
  className: "overflow-x-auto",
1067
1119
  style: {
1068
- ...z ? { maxHeight: ge ? Ae : z } : {}
1120
+ ...D ? { maxHeight: xe ? Be : D } : {}
1069
1121
  },
1070
- children: /* @__PURE__ */ y(
1122
+ children: /* @__PURE__ */ $(
1071
1123
  "table",
1072
1124
  {
1073
- "aria-label": p,
1074
- "aria-labelledby": v,
1125
+ "aria-label": b,
1126
+ "aria-labelledby": x,
1075
1127
  "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`,
1128
+ className: `w-full ${Qe ? "table-fixed" : "table-auto"} ${_ ? "border-separate table-bordered" : "border-collapse"} rounded-lg overflow-hidden`,
1077
1129
  style: {
1078
1130
  borderSpacing: "0",
1079
- minWidth: en
1131
+ minWidth: on
1080
1132
  },
1081
1133
  children: [
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(
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(
1084
1136
  "tr",
1085
1137
  {
1086
- className: `table-row ${I ? "table-row-bordered" : ""}`,
1087
- children: e.map((f) => /* @__PURE__ */ r(
1138
+ className: `table-row ${_ ? "table-row-bordered" : ""}`,
1139
+ children: e.map((c) => /* @__PURE__ */ r(
1088
1140
  "td",
1089
1141
  {
1090
- className: `table-cell ${oe} text-left ${fe(A)}`,
1142
+ className: `table-cell ${se} text-left ${ue(V)}`,
1091
1143
  style: {
1092
- width: f.width,
1093
- minWidth: qe(f),
1094
- height: st
1144
+ width: c.width,
1145
+ minWidth: Ve(c),
1146
+ height: ct
1095
1147
  },
1096
1148
  children: /* @__PURE__ */ r("div", { className: "table-skeleton-bar h-4 rounded animate-pulse" })
1097
1149
  },
1098
- f.key
1150
+ c.key
1099
1151
  ))
1100
1152
  },
1101
1153
  i
1102
1154
  )) : T.length === 0 ? /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r(
1103
1155
  "td",
1104
1156
  {
1105
- colSpan: e.length + (ot ? 1 : 0),
1157
+ colSpan: e.length + (st ? 1 : 0),
1106
1158
  className: "px-4 py-12 text-center",
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 })
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 })
1110
1162
  ] })
1111
1163
  }
1112
1164
  ) }) : 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 ? () => {
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 ? () => {
1114
1166
  var l;
1115
- U == null || U(t, i), (l = a.onClick) == null || l.call(a, t, i);
1167
+ G == null || G(t, i), (l = a.onClick) == null || l.call(a, t, i);
1116
1168
  } : void 0;
1117
1169
  return (
1118
1170
  // Keeps `row` semantics: `role="button"` would strip the table
@@ -1120,18 +1172,19 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
1120
1172
  /* @__PURE__ */ r(
1121
1173
  "tr",
1122
1174
  {
1123
- "data-table-id": X,
1175
+ "data-table-id": Q,
1124
1176
  "data-row-index": i,
1125
- "aria-current": k ? "true" : void 0,
1126
- tabIndex: s ? i === ie ? 0 : -1 : void 0,
1127
- onKeyDown: s ? St(i, s) : void 0,
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,
1128
1181
  className: `
1129
- ${I ? "table-row-bordered" : `table-row ${k ? "" : "hover:opacity-80"}`}
1130
- ${(D == null ? void 0 : D(t, i)) || ""}
1131
- ${s ? `cursor-pointer ${wt}` : ""}
1182
+ ${_ ? "table-row-bordered" : `table-row ${S ? "" : "hover:opacity-80"}`}
1183
+ ${(W == null ? void 0 : W(t, i)) || ""}
1184
+ ${M ? `cursor-pointer ${It}` : ""}
1132
1185
  `,
1133
- onClick: s ? (l) => {
1134
- Ct(l) || s();
1186
+ onClick: M ? (l) => {
1187
+ Tt(l) || M();
1135
1188
  } : void 0,
1136
1189
  onDoubleClick: a.onDoubleClick ? () => {
1137
1190
  var l;
@@ -1150,31 +1203,32 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
1150
1203
  return (l = a.onMouseLeave) == null ? void 0 : l.call(a, t, i);
1151
1204
  } : void 0,
1152
1205
  children: e.map((l) => {
1153
- const c = l === e[0], R = l === e[e.length - 1];
1206
+ const s = l === e[0], f = l === e[e.length - 1];
1154
1207
  return /* @__PURE__ */ r(
1155
- er,
1208
+ lr,
1156
1209
  {
1157
1210
  column: l,
1158
1211
  record: t,
1159
1212
  index: i,
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)
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
1172
1226
  },
1173
1227
  l.key
1174
1228
  );
1175
1229
  })
1176
1230
  },
1177
- f
1231
+ c
1178
1232
  )
1179
1233
  );
1180
1234
  }) })
@@ -1185,12 +1239,12 @@ const zt = 160, kn = (e, n) => e.length === n.length && e.every((o, u) => o ===
1185
1239
  )
1186
1240
  }
1187
1241
  ),
1188
- Se("bottom")
1242
+ Ne("bottom")
1189
1243
  ]
1190
1244
  }
1191
1245
  );
1192
1246
  };
1193
1247
  export {
1194
- $r as default
1248
+ Cr as default
1195
1249
  };
1196
1250
  //# sourceMappingURL=Table.js.map