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