@stackone/malachite 2.88.3 → 2.89.1

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