@reportportal/ui-kit 0.0.1-alpha.162 → 0.0.1-alpha.163

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.
@@ -0,0 +1,1099 @@
1
+ import { jsx as h, jsxs as D, Fragment as At } from "react/jsx-runtime";
2
+ import { useMemo as Q, useState as q, useCallback as $, useEffect as B, useRef as P, useLayoutEffect as et, forwardRef as Mt } from "react";
3
+ import { Resizable as $t } from "react-resizable";
4
+ import { c as me } from "./bind-06a7ff84.js";
5
+ import { b as Wt, a as Ye, S as Ht } from "./resizeColumn-46b5b30f.js";
6
+ import { S as Je } from "./chevronDownDropdown-0260bb66.js";
7
+ import { C as ae } from "./checkbox-493fdc63.js";
8
+ import { Tooltip as Pt } from "./tooltip.js";
9
+ import { createPortal as Bt } from "react-dom";
10
+ import { i as St } from "./isEmpty-ccacb5ff.js";
11
+ const tt = (t) => typeof t == "string", Gt = "_table_1rtld_1", Ft = "_resizable_1rtld_67", qt = "_selectable_1rtld_84", Ut = "_expanded_1rtld_80", Dt = "_label_1rtld_353", jt = {
12
+ table: Gt,
13
+ "fixed-header": "_fixed-header_1rtld_10",
14
+ "external-scroll-container": "_external-scroll-container_1rtld_14",
15
+ "horizontally-scrollable-container": "_horizontally-scrollable-container_1rtld_21",
16
+ "table-header": "_table-header_1rtld_26",
17
+ "sticky-header": "_sticky-header_1rtld_34",
18
+ "pinned-header": "_pinned-header_1rtld_44",
19
+ "horizontally-scrollable": "_horizontally-scrollable_1rtld_21",
20
+ resizable: Ft,
21
+ "resizable-column": "_resizable-column_1rtld_67",
22
+ "table-row": "_table-row_1rtld_75",
23
+ "expanded-cell": "_expanded-cell_1rtld_80",
24
+ selectable: qt,
25
+ "row-content-wrapper": "_row-content-wrapper_1rtld_88",
26
+ "pinned-column": "_pinned-column_1rtld_96",
27
+ "has-scroll": "_has-scroll_1rtld_96",
28
+ "table-row-content": "_table-row-content_1rtld_99",
29
+ "expand-cell": "_expand-cell_1rtld_116",
30
+ "left-border-accent": "_left-border-accent_1rtld_119",
31
+ "size-small": "_size-small_1rtld_129",
32
+ "size-large": "_size-large_1rtld_140",
33
+ "table-body": "_table-body_1rtld_152",
34
+ "scrollable-body": "_scrollable-body_1rtld_158",
35
+ "table-header-cell": "_table-header-cell_1rtld_222",
36
+ "table-cell": "_table-cell_1rtld_223",
37
+ "action-menu-cell": "_action-menu-cell_1rtld_229",
38
+ "checkbox-cell": "_checkbox-cell_1rtld_257",
39
+ "expand-all-tooltip-wrapper": "_expand-all-tooltip-wrapper_1rtld_302",
40
+ "expand-all-tooltip-content": "_expand-all-tooltip-content_1rtld_311",
41
+ "expand-icon": "_expand-icon_1rtld_320",
42
+ expanded: Ut,
43
+ "primary-cell": "_primary-cell_1rtld_329",
44
+ label: Dt,
45
+ "sortable-cell": "_sortable-cell_1rtld_367",
46
+ "align-right": "_align-right_1rtld_370",
47
+ "align-center": "_align-center_1rtld_376",
48
+ "table-wrapper": "_table-wrapper_1rtld_430",
49
+ "checkbox-column": "_checkbox-column_1rtld_442",
50
+ "checkbox-header": "_checkbox-header_1rtld_454",
51
+ "checkbox-body": "_checkbox-body_1rtld_478",
52
+ "checkbox-row": "_checkbox-row_1rtld_485"
53
+ }, nt = "asc", Z = 32, rt = 100, Rt = 48, we = 48, Xt = (t) => t.toLowerCase() === nt, It = (t) => t.map((c) => c.key), C = (t) => "primary" in t && t.primary === !0, Qe = (t) => {
54
+ var o;
55
+ return `size-${((o = t.rowConfigs) == null ? void 0 : o.size) ?? "default"}`;
56
+ }, ye = (t) => tt(t) ? t : `${t}px`, Vt = (t, c, o, l, p, u = !1) => {
57
+ let d = 0;
58
+ l && (d += Z), p && !u && (d += Z);
59
+ for (let _ = 0; _ < t; _++) {
60
+ const i = c[_];
61
+ if (C(i)) {
62
+ const s = o.current.get(i.key) || rt;
63
+ d += s;
64
+ } else {
65
+ const s = i, a = tt(s.width) ? parseInt(s.width, 10) || 0 : s.width;
66
+ d += a;
67
+ }
68
+ }
69
+ return d;
70
+ }, de = (t, c, o, l, p, u, d, _ = !1) => {
71
+ const i = {};
72
+ if (!C(t)) {
73
+ const s = t;
74
+ i.textAlign = s.align;
75
+ }
76
+ if (c && o !== void 0) {
77
+ const s = Vt(
78
+ o,
79
+ l,
80
+ p,
81
+ u,
82
+ d,
83
+ _
84
+ );
85
+ i.left = `${s}px`;
86
+ }
87
+ return i;
88
+ }, Ze = (t, c, o, l, p, u = !1, d, _ = !1, i = !1) => {
89
+ const s = [];
90
+ o && s.push(`${Z}px`), u && l && !i && s.push(`${Z}px`);
91
+ const a = (b) => {
92
+ if ((d == null ? void 0 : d[b.key]) !== void 0) {
93
+ s.push(`${d[b.key]}px`);
94
+ return;
95
+ }
96
+ if (C(b)) {
97
+ const y = b;
98
+ if (_ && y.width) {
99
+ s.push(ye(y.width));
100
+ return;
101
+ }
102
+ const L = y.width ? ye(y.width) : `${rt}px`;
103
+ s.push(`minmax(${L}, 1fr)`);
104
+ } else {
105
+ const L = ye(b.width);
106
+ s.push(L);
107
+ }
108
+ };
109
+ return t.forEach(a), c.forEach(a), p && s.push(`${Rt}px`), s.join(" ");
110
+ }, Ct = ({
111
+ primaryColumns: t,
112
+ fixedColumns: c,
113
+ pinnedColumnKeys: o
114
+ }) => Q(() => {
115
+ const l = [], p = [];
116
+ return t.forEach((u) => {
117
+ const d = { ...u, primary: !0 };
118
+ o.includes(u.key) ? l.push(d) : p.push(d);
119
+ }), c.forEach((u) => {
120
+ o.includes(u.key) ? l.push(u) : p.push(u);
121
+ }), {
122
+ pinnedColumns: l,
123
+ scrollableColumns: p
124
+ };
125
+ }, [t, c, o]), Yt = () => {
126
+ const [t, c] = q(null), [o, l] = q(null), p = $((i) => {
127
+ c(i);
128
+ }, []), u = $(() => {
129
+ c(null);
130
+ }, []), d = $((i) => {
131
+ l(i);
132
+ }, []), _ = $(() => {
133
+ l(null);
134
+ }, []);
135
+ return {
136
+ hoveredColumn: t,
137
+ hoveredRow: o,
138
+ handleColumnMouseEnter: p,
139
+ handleColumnMouseLeave: u,
140
+ handleRowMouseEnter: d,
141
+ handleRowMouseLeave: _
142
+ };
143
+ }, Jt = ({
144
+ primaryColumns: t,
145
+ fixedColumns: c,
146
+ expandedRowIds: o,
147
+ onToggleRowExpansion: l
148
+ }) => {
149
+ const [p, u] = q(/* @__PURE__ */ new Set());
150
+ B(() => {
151
+ const i = [
152
+ ...t.map((a) => a.key),
153
+ ...c.map((a) => a.key)
154
+ ], s = /* @__PURE__ */ new Set();
155
+ o.forEach((a) => {
156
+ i.forEach((b) => {
157
+ s.add(`${a}-${b}`);
158
+ });
159
+ }), u((a) => {
160
+ if (a.size === s.size) {
161
+ let b = !0;
162
+ if (a.forEach((y) => {
163
+ s.has(y) || (b = !1);
164
+ }), b)
165
+ return a;
166
+ }
167
+ return s;
168
+ });
169
+ }, [o, t, c]);
170
+ const d = $(
171
+ (i) => {
172
+ const s = new Set(p), a = o.includes(i), b = [
173
+ ...t.map((y) => y.key),
174
+ ...c.map((y) => y.key)
175
+ ];
176
+ a ? b.forEach((y) => {
177
+ const L = `${i}-${y}`;
178
+ s.delete(L);
179
+ }) : b.forEach((y) => {
180
+ const L = `${i}-${y}`;
181
+ s.add(L);
182
+ }), u(s), l(i);
183
+ },
184
+ [p, o, t, c, l]
185
+ ), _ = $(
186
+ (i, s) => {
187
+ const a = `${i}-${s}`;
188
+ return p.has(a);
189
+ },
190
+ [p]
191
+ );
192
+ return {
193
+ expandedCells: p,
194
+ handleToggleRowExpansion: d,
195
+ isCellExpanded: _
196
+ };
197
+ }, Qt = () => {
198
+ const t = P(/* @__PURE__ */ new Map()), c = $(
199
+ (o) => (l) => {
200
+ if (!l)
201
+ return;
202
+ const p = l.getBoundingClientRect().width;
203
+ p > 0 && t.current.set(o, p);
204
+ },
205
+ []
206
+ );
207
+ return {
208
+ columnWidthsRef: t,
209
+ setCellRef: c
210
+ };
211
+ }, Zt = ({
212
+ enabled: t = !1,
213
+ minWidth: c = 50,
214
+ maxWidth: o = 500,
215
+ columns: l = [],
216
+ columnWidthsRef: p,
217
+ onColumnResize: u,
218
+ initialColumnWidths: d
219
+ }) => {
220
+ const [_, i] = q({}), s = P(l), a = P(void 0);
221
+ B(() => {
222
+ s.current = l;
223
+ }, [l]);
224
+ const b = $(
225
+ (g) => {
226
+ const T = l.find((k) => k.key === g);
227
+ return {
228
+ minWidth: (T == null ? void 0 : T.minWidth) ?? c,
229
+ maxWidth: (T == null ? void 0 : T.maxWidth) ?? o
230
+ };
231
+ },
232
+ [l, c, o]
233
+ );
234
+ B(() => {
235
+ if (d && a.current !== d) {
236
+ const T = {};
237
+ Object.entries(d).forEach(([k, M]) => {
238
+ const z = s.current.find((X) => X.key === k), S = (z == null ? void 0 : z.minWidth) ?? c, A = (z == null ? void 0 : z.maxWidth) ?? o;
239
+ T[k] = Math.min(A, Math.max(S, M));
240
+ }), i(T), a.current = d;
241
+ }
242
+ }, [d, c, o]);
243
+ const y = $(() => {
244
+ if (!t || Object.keys(_).length > 0 || !p)
245
+ return;
246
+ const g = {};
247
+ p.current.forEach((T, k) => {
248
+ g[k] = T;
249
+ }), i(g);
250
+ }, [t, _, p]), L = $(
251
+ (g) => (T, { size: k }) => {
252
+ if (!t)
253
+ return;
254
+ const { minWidth: M, maxWidth: z } = b(g), S = Math.min(z, Math.max(M, k.width));
255
+ i((A) => ({ ...A, [g]: S }));
256
+ },
257
+ [t, b]
258
+ ), W = $(
259
+ (g) => () => {
260
+ !t || !_[g] || u == null || u(g, _[g]);
261
+ },
262
+ [t, _, u]
263
+ );
264
+ return {
265
+ columnWidths: _,
266
+ handleResize: L,
267
+ handleResizeStop: W,
268
+ handleResizeStart: y
269
+ };
270
+ }, Ot = (t, c, o, l, p, u, d, _) => Q(() => {
271
+ if (!t)
272
+ return {
273
+ visible: !1,
274
+ position: { top: 0, left: 0 },
275
+ size: { width: 0, height: 0 }
276
+ };
277
+ if (!(p + t.clientWidth < d))
278
+ return {
279
+ visible: !1,
280
+ position: { top: 0, left: 0 },
281
+ size: { width: 0, height: 0 }
282
+ };
283
+ const s = t.getBoundingClientRect(), a = (c == null ? void 0 : c.offsetHeight) || 0, b = o == null ? void 0 : o.getBoundingClientRect(), y = Math.min(
284
+ s.bottom,
285
+ (b == null ? void 0 : b.bottom) || Number.MAX_SAFE_INTEGER
286
+ );
287
+ let L;
288
+ l && o && b ? L = b.top - s.top + a : L = a;
289
+ const W = s.top + L, T = t.scrollWidth > t.clientWidth ? t.offsetHeight - t.clientHeight : 0, k = y - W - T, z = t.scrollHeight > t.clientHeight ? t.offsetWidth - t.clientWidth : 0, S = s.right - we - z;
290
+ return {
291
+ visible: !0,
292
+ position: {
293
+ top: W,
294
+ left: S
295
+ },
296
+ size: {
297
+ width: we,
298
+ height: k
299
+ }
300
+ };
301
+ }, [
302
+ t,
303
+ c,
304
+ o,
305
+ l,
306
+ p,
307
+ u,
308
+ d,
309
+ _
310
+ ]), Kt = (t, c, o, l, p, u, d, _) => Q(() => {
311
+ if (!t)
312
+ return {
313
+ visible: !1,
314
+ position: { top: 0, left: 0 },
315
+ size: { width: 0, height: 0 }
316
+ };
317
+ if (!(c > 0))
318
+ return {
319
+ visible: !1,
320
+ position: { top: 0, left: 0 },
321
+ size: { width: 0, height: 0 }
322
+ };
323
+ const s = t.querySelector('[data-row-index="0"]');
324
+ if (!s)
325
+ return {
326
+ visible: !1,
327
+ position: { top: 0, left: 0 },
328
+ size: { width: 0, height: 0 }
329
+ };
330
+ const a = Array.from(s.querySelectorAll("[data-pinned-index]"));
331
+ if (a.length === 0)
332
+ return {
333
+ visible: !1,
334
+ position: { top: 0, left: 0 },
335
+ size: { width: 0, height: 0 }
336
+ };
337
+ const b = Math.max(
338
+ ...a.map(
339
+ (O) => parseInt(O.getAttribute("data-pinned-index") || "-1", 10)
340
+ )
341
+ );
342
+ if (b < 0)
343
+ return {
344
+ visible: !1,
345
+ position: { top: 0, left: 0 },
346
+ size: { width: 0, height: 0 }
347
+ };
348
+ const y = a.find(
349
+ (O) => parseInt(O.getAttribute("data-pinned-index") || "-1", 10) === b
350
+ );
351
+ if (!y)
352
+ return {
353
+ visible: !1,
354
+ position: { top: 0, left: 0 },
355
+ size: { width: 0, height: 0 }
356
+ };
357
+ const L = y.getBoundingClientRect(), W = t.getBoundingClientRect(), g = (o == null ? void 0 : o.offsetHeight) || 0, T = l == null ? void 0 : l.getBoundingClientRect(), k = L.right, M = Math.min(
358
+ W.bottom,
359
+ (T == null ? void 0 : T.bottom) || Number.MAX_SAFE_INTEGER
360
+ );
361
+ let z;
362
+ p && l && T ? z = T.top - W.top + g : z = g;
363
+ const S = W.top + z, X = t.scrollWidth > t.clientWidth ? t.offsetHeight - t.clientHeight : 0, ne = M - S - X;
364
+ return {
365
+ visible: !0,
366
+ position: {
367
+ top: S,
368
+ left: k
369
+ },
370
+ size: {
371
+ width: we,
372
+ height: ne
373
+ }
374
+ };
375
+ }, [
376
+ t,
377
+ c,
378
+ o,
379
+ l,
380
+ p,
381
+ u,
382
+ d,
383
+ _
384
+ ]), en = ({ enabled: t, rowCount: c }) => {
385
+ const o = P(/* @__PURE__ */ new Map()), l = P(/* @__PURE__ */ new Map()), p = $(
386
+ (i) => (s) => {
387
+ s ? o.current.set(i, s) : o.current.delete(i);
388
+ },
389
+ []
390
+ ), u = $(
391
+ (i) => (s) => {
392
+ s ? l.current.set(i, s) : l.current.delete(i);
393
+ },
394
+ []
395
+ ), d = $((i, s) => {
396
+ const a = `${i.offsetHeight}px`;
397
+ s.style.height !== a && (s.style.height = a);
398
+ }, []), _ = $(() => {
399
+ o.current.forEach((i, s) => {
400
+ const a = l.current.get(s);
401
+ a && d(i, a);
402
+ });
403
+ }, [d]);
404
+ return B(() => {
405
+ if (!t)
406
+ return;
407
+ const i = new ResizeObserver((s) => {
408
+ requestAnimationFrame(() => {
409
+ s.forEach((a) => {
410
+ const b = a.target, y = parseInt(b.dataset.rowIndex || "-1", 10), L = l.current.get(y);
411
+ L && y >= 0 && d(b, L);
412
+ });
413
+ });
414
+ });
415
+ return o.current.forEach((s) => i.observe(s)), () => i.disconnect();
416
+ }, [t, c, d]), et(() => {
417
+ t && _();
418
+ }, [t, c, _]), { setTableRowRef: p, setCheckboxRowRef: u, syncAllHeights: _ };
419
+ }, tn = {
420
+ "resize-handle": "_resize-handle_15uk3_1"
421
+ }, nn = me.bind(tn), rn = Mt(
422
+ (t, c) => /* @__PURE__ */ h("div", { ref: c, className: nn("resize-handle"), ...t, children: /* @__PURE__ */ h(Wt, {}) })
423
+ ), sn = {
424
+ "gradient-overlay": "_gradient-overlay_hx7m8_1",
425
+ "direction-right": "_direction-right_hx7m8_5",
426
+ "direction-left": "_direction-left_hx7m8_13"
427
+ }, on = me.bind(sn), Oe = ({
428
+ portalContainer: t,
429
+ visible: c,
430
+ position: o,
431
+ size: l,
432
+ direction: p,
433
+ className: u,
434
+ dataTestId: d
435
+ }) => {
436
+ if (!c || !t)
437
+ return null;
438
+ const _ = {
439
+ position: "fixed",
440
+ top: `${o.top}px`,
441
+ width: `${l.width}px`,
442
+ height: `${l.height}px`
443
+ };
444
+ return o.left !== void 0 && (_.left = `${o.left}px`), o.right !== void 0 && (_.right = `${o.right}px`), Bt(
445
+ /* @__PURE__ */ h(
446
+ "div",
447
+ {
448
+ className: on("gradient-overlay", `direction-${p}`, u),
449
+ style: _,
450
+ "data-gradient-type": d
451
+ }
452
+ ),
453
+ t
454
+ );
455
+ }, f = me.bind(jt), Ke = ({ column: t }) => {
456
+ const c = P(null), [o, l] = q(!1);
457
+ return B(() => {
458
+ if (c.current) {
459
+ const p = c.current.offsetWidth, u = c.current.scrollWidth;
460
+ l(u > p);
461
+ }
462
+ }, [t.header]), /* @__PURE__ */ h("span", { ref: c, title: o ? t.header : void 0, children: t.header });
463
+ }, bn = ({
464
+ data: t,
465
+ primaryColumn: c,
466
+ fixedColumns: o,
467
+ renderRowActions: l,
468
+ className: p = "",
469
+ wrapperClassName: u = "",
470
+ rowClassName: d = "",
471
+ headerClassName: _ = "",
472
+ bodyClassName: i = "",
473
+ selectable: s = !1,
474
+ selectedRowIds: a = [],
475
+ sortingDirection: b = nt,
476
+ sortingColumn: y,
477
+ sortableColumns: L,
478
+ isHeaderFixed: W = !1,
479
+ isHorizontallyScrollable: g = !1,
480
+ pinnedColumnKeys: T = [],
481
+ isRowsExpandable: k = !1,
482
+ expandedRowIds: M = [],
483
+ isAllExpandedByDefault: z,
484
+ expandAllTooltip: S,
485
+ isResizable: A = !1,
486
+ minColumnWidth: X = 50,
487
+ maxColumnWidth: ne = 500,
488
+ isSelectAllCheckboxAlwaysVisible: O = !1,
489
+ isCheckboxOutside: N = !1,
490
+ onChangeSorting: st = () => {
491
+ },
492
+ onToggleRowSelection: ot = () => {
493
+ },
494
+ onToggleAllRowsSelection: ct = () => {
495
+ },
496
+ onToggleRowExpansion: lt = () => {
497
+ },
498
+ onToggleAllRowsExpansion: it = () => {
499
+ },
500
+ onColumnResize: at = () => {
501
+ },
502
+ externalScrollContainerRef: w,
503
+ portalContainer: ke = typeof document < "u" ? document.body : null,
504
+ rightGradientClassName: dt,
505
+ pinnedGradientClassName: ht
506
+ }) => {
507
+ const Y = Q(
508
+ () => Array.isArray(c) ? c : [c],
509
+ [c]
510
+ ), U = y ?? Y[0], re = L ?? It([...Y, ...o]), { pinnedColumns: F, scrollableColumns: J } = Ct({
511
+ primaryColumns: Y,
512
+ fixedColumns: o,
513
+ pinnedColumnKeys: T
514
+ }), {
515
+ hoveredColumn: Ee,
516
+ hoveredRow: Te,
517
+ handleColumnMouseEnter: Le,
518
+ handleColumnMouseLeave: xe,
519
+ handleRowMouseEnter: Ne,
520
+ handleRowMouseLeave: ze
521
+ } = Yt(), { columnWidthsRef: K, setCellRef: Ae } = Qt(), pt = Q(() => {
522
+ const e = {};
523
+ return Y.forEach((n) => {
524
+ "width" in n && typeof n.width == "number" && (e[n.key] = n.width);
525
+ }), o.forEach((n) => {
526
+ "width" in n && typeof n.width == "number" && (e[n.key] = n.width);
527
+ }), Object.keys(e).length > 0 ? e : void 0;
528
+ }, [Y, o]), { handleToggleRowExpansion: ft, isCellExpanded: Me } = Jt({
529
+ primaryColumns: Y,
530
+ fixedColumns: o,
531
+ expandedRowIds: M,
532
+ onToggleRowExpansion: lt
533
+ }), ut = Q(
534
+ () => [...F, ...J],
535
+ [F, J]
536
+ ), { columnWidths: se, handleResize: _t, handleResizeStop: gt, handleResizeStart: vt } = Zt({
537
+ enabled: A,
538
+ minWidth: X,
539
+ maxWidth: ne,
540
+ columns: ut,
541
+ columnWidthsRef: K,
542
+ onColumnResize: at,
543
+ initialColumnWidths: pt
544
+ }), { setTableRowRef: bt, setCheckboxRowRef: yt } = en({
545
+ enabled: s && N,
546
+ rowCount: t.length
547
+ }), $e = (e, n) => {
548
+ const r = e.minWidth ?? X, v = e.maxWidth ?? ne;
549
+ return /* @__PURE__ */ h(
550
+ $t,
551
+ {
552
+ width: se[e.key] ?? (typeof e.width == "number" ? e.width : X),
553
+ height: 0,
554
+ axis: "x",
555
+ handle: /* @__PURE__ */ h(rn, {}),
556
+ onResizeStart: vt,
557
+ onResize: _t(e.key),
558
+ onResizeStop: gt(e.key),
559
+ minConstraints: [r, 0],
560
+ maxConstraints: [v, 0],
561
+ className: f("resizable-column"),
562
+ children: n
563
+ },
564
+ e.key
565
+ );
566
+ }, x = P(null), j = P(null), wt = P(null), ee = P(null), he = P(null), [I, mt] = q(!1), oe = $((e) => {
567
+ const n = j.current;
568
+ if (n && n.contains(e))
569
+ return;
570
+ const r = e.parentElement;
571
+ if (!r)
572
+ return;
573
+ const v = window.getComputedStyle(r), m = parseFloat(v.paddingTop) || 0, E = parseFloat(v.paddingBottom) || 0, G = e.offsetHeight + m + E;
574
+ e.style.setProperty("--expand-cell-top", `${m}px`), e.style.setProperty("--expand-cell-height", `${G}px`);
575
+ }, []), [We, pe] = q(0), [He, fe] = q(0), [Pe, ue] = q(0), [Be, Se] = q(0), ce = P(!1), _e = P(/* @__PURE__ */ new Set()), te = P(null), ge = Ot(
576
+ x.current,
577
+ j.current,
578
+ (w == null ? void 0 : w.current) instanceof HTMLElement ? w.current : null,
579
+ I,
580
+ We,
581
+ He,
582
+ Pe,
583
+ Be
584
+ ), ve = Kt(
585
+ x.current,
586
+ We,
587
+ j.current,
588
+ (w == null ? void 0 : w.current) instanceof HTMLElement ? w.current : null,
589
+ I,
590
+ He,
591
+ Pe,
592
+ Be
593
+ ), Ge = (e) => {
594
+ re.includes(e) && st({ key: e, direction: b });
595
+ }, Fe = (e) => {
596
+ ot(e);
597
+ }, qe = () => {
598
+ ct();
599
+ }, kt = () => {
600
+ it();
601
+ }, Ue = (e) => re.includes(e) ? (U == null ? void 0 : U.key) === e ? Xt(b) ? /* @__PURE__ */ h(Ye, {}) : /* @__PURE__ */ h(Ht, {}) : /* @__PURE__ */ h(Ye, {}) : null, De = t.every((e) => a.includes(e.id)), je = t.some((e) => a.includes(e.id)), be = (a == null ? void 0 : a.length) > 0, Et = !St(t), Re = O && Et || be, Tt = t.every((e) => M.includes(e.id)), Lt = z !== void 0 ? z : Tt, xt = Ze(
602
+ F,
603
+ J,
604
+ k,
605
+ s,
606
+ !!l,
607
+ !1,
608
+ A ? se : void 0,
609
+ A,
610
+ N
611
+ ), Nt = Ze(
612
+ F,
613
+ J,
614
+ k,
615
+ s,
616
+ !!l,
617
+ !0,
618
+ A ? se : void 0,
619
+ A,
620
+ N
621
+ ), Xe = /* @__PURE__ */ h("button", { onClick: kt, "aria-label": "Toggle all rows expansion", children: /* @__PURE__ */ h("span", { className: f("expand-icon", { expanded: Lt }), children: /* @__PURE__ */ h(Je, {}) }) });
622
+ B(() => {
623
+ if (!(w != null && w.current) || !x.current || !j.current)
624
+ return;
625
+ const e = w.current, n = x.current, r = j.current, v = he.current, m = () => {
626
+ const H = n.getBoundingClientRect(), G = e.getBoundingClientRect(), V = r.offsetHeight, R = H.top - G.top, le = H.bottom - G.top, Ve = e.scrollTop > 0 && R <= 0 && le > V;
627
+ if (mt(Ve), Ve) {
628
+ const ie = H.left, Ce = G.top;
629
+ r.classList.add(f("pinned-header")), g && (r.style.overflow = "hidden", r.style.overflowX = "hidden"), r.style.left = `${ie}px`, r.style.top = `${Ce}px`, r.style.width = `${H.width}px`, v && N && (v.style.top = `${Ce}px`);
630
+ } else {
631
+ const ie = n.scrollLeft;
632
+ ce.current = !0, r.classList.remove(f("pinned-header")), g && (r.scrollLeft = 0), r.style.left = "", r.style.top = "", r.style.width = "", g && (r.style.overflow = "", r.style.overflowX = ""), v && N && (v.style.top = "", v.classList.remove(f("pinned-header"))), g && ie > 0 ? requestAnimationFrame(() => {
633
+ n.scrollLeft = ie, setTimeout(() => {
634
+ ce.current = !1;
635
+ }, 0);
636
+ }) : ce.current = !1;
637
+ }
638
+ }, E = requestAnimationFrame(() => {
639
+ m();
640
+ });
641
+ return e.addEventListener("scroll", m), window.addEventListener("resize", m), () => {
642
+ cancelAnimationFrame(E), e.removeEventListener("scroll", m), window.removeEventListener("resize", m);
643
+ };
644
+ }, [w, g, N]), B(() => {
645
+ if (!(w != null && w.current) || !x.current || !j.current || !I)
646
+ return;
647
+ const e = w.current, n = x.current, r = j.current, v = he.current, m = () => {
648
+ const R = n.getBoundingClientRect(), le = e.getBoundingClientRect();
649
+ r.style.left = `${R.left}px`, r.style.top = `${le.top}px`, r.style.width = `${R.width}px`, v && N && (v.style.top = `${le.top}px`);
650
+ }, E = (R) => {
651
+ ce.current || (R === r ? n.scrollLeft = r.scrollLeft : r.scrollLeft = n.scrollLeft, te.current && te.current());
652
+ }, H = () => {
653
+ E(n), m();
654
+ }, G = () => {
655
+ E(r);
656
+ }, V = () => {
657
+ m();
658
+ };
659
+ return n.addEventListener("scroll", H), g && r.addEventListener("scroll", G), e.addEventListener("scroll", V), window.addEventListener("resize", m), E(n), m(), () => {
660
+ n.removeEventListener("scroll", H), g && r.removeEventListener("scroll", G), e.removeEventListener("scroll", V), window.removeEventListener("resize", m);
661
+ };
662
+ }, [I, w, g, N]), B(() => {
663
+ if (!x.current || !g)
664
+ return;
665
+ const e = x.current, n = w == null ? void 0 : w.current;
666
+ pe(e.scrollLeft), fe((n == null ? void 0 : n.scrollTop) || e.scrollTop || 0), ue(e.scrollWidth);
667
+ const r = () => {
668
+ e && (pe(e.scrollLeft), fe((n == null ? void 0 : n.scrollTop) || e.scrollTop || 0), ue(e.scrollWidth));
669
+ };
670
+ let v = null;
671
+ const m = () => {
672
+ v === null && (v = requestAnimationFrame(() => {
673
+ r(), v = null;
674
+ }));
675
+ }, E = () => {
676
+ m();
677
+ }, H = () => {
678
+ m();
679
+ };
680
+ e.addEventListener("scroll", E, { passive: !0 }), n && n.addEventListener("scroll", H, {
681
+ passive: !0
682
+ });
683
+ const G = () => {
684
+ r(), Se((R) => R + 1);
685
+ };
686
+ window.addEventListener("resize", G), te.current = r, r();
687
+ const V = new ResizeObserver(() => {
688
+ r();
689
+ });
690
+ return e && V.observe(e), () => {
691
+ e.removeEventListener("scroll", E), n && n.removeEventListener("scroll", H), window.removeEventListener("resize", G), V.disconnect(), v !== null && (cancelAnimationFrame(v), v = null);
692
+ };
693
+ }, [g, w, I, M]), B(() => {
694
+ if (!x.current || !g)
695
+ return;
696
+ const e = x.current, n = w == null ? void 0 : w.current;
697
+ requestAnimationFrame(() => {
698
+ e && (pe(e.scrollLeft), fe((n == null ? void 0 : n.scrollTop) || e.scrollTop || 0), ue(e.scrollWidth), te.current && te.current());
699
+ });
700
+ }, [se, g, w]), B(() => {
701
+ if (!x.current)
702
+ return;
703
+ const e = x.current, n = () => {
704
+ Array.from(e.querySelectorAll('[data-base-left="0"]')).forEach(oe);
705
+ };
706
+ requestAnimationFrame(() => {
707
+ n();
708
+ });
709
+ }, [k, t, oe]), B(() => {
710
+ if (!x.current)
711
+ return;
712
+ const e = x.current, n = new Set(M), r = _e.current, v = /* @__PURE__ */ new Set();
713
+ if (M.forEach((E) => {
714
+ r.has(E) || v.add(E);
715
+ }), r.forEach((E) => {
716
+ n.has(E) || v.add(E);
717
+ }), v.size === 0) {
718
+ _e.current = n;
719
+ return;
720
+ }
721
+ const m = setTimeout(() => {
722
+ v.forEach((E) => {
723
+ const H = e.querySelector(
724
+ `[data-base-left="0"][data-row-id="${E}"]`
725
+ );
726
+ H && oe(H);
727
+ }), Se((E) => E + 1);
728
+ }, 0);
729
+ return _e.current = n, () => clearTimeout(m);
730
+ }, [k, M, oe]), B(() => {
731
+ if (!ee.current || !x.current || !N)
732
+ return;
733
+ const e = ee.current, n = x.current, r = () => {
734
+ requestAnimationFrame(() => {
735
+ e.scrollTop = n.scrollTop;
736
+ });
737
+ };
738
+ return n.addEventListener("scroll", r), () => {
739
+ n.removeEventListener("scroll", r);
740
+ };
741
+ }, [t, N]), et(() => {
742
+ if (!x.current || !ee.current)
743
+ return;
744
+ const e = x.current, n = ee.current, r = () => {
745
+ const m = `${e.clientHeight}px`;
746
+ n.style.height !== m && (n.style.height = m);
747
+ };
748
+ r();
749
+ const v = new ResizeObserver(() => {
750
+ requestAnimationFrame(r);
751
+ });
752
+ return v.observe(e), () => v.disconnect();
753
+ }, []);
754
+ const zt = () => /* @__PURE__ */ D("div", { className: f("checkbox-column"), ref: ee, children: [
755
+ /* @__PURE__ */ h(
756
+ "div",
757
+ {
758
+ ref: he,
759
+ className: f(
760
+ "table-header",
761
+ "checkbox-header",
762
+ { "pinned-header": I },
763
+ _
764
+ ),
765
+ children: Re && /* @__PURE__ */ h(
766
+ ae,
767
+ {
768
+ value: De,
769
+ partiallyChecked: je,
770
+ onChange: qe,
771
+ className: f("checkbox-cell")
772
+ }
773
+ )
774
+ }
775
+ ),
776
+ /* @__PURE__ */ h("div", { className: f("checkbox-body", i), children: t.map((e, n) => /* @__PURE__ */ h(
777
+ "div",
778
+ {
779
+ ref: yt(n),
780
+ className: f("checkbox-row", "table-row", Qe(e), d),
781
+ onMouseEnter: () => Ne(n),
782
+ onMouseLeave: ze,
783
+ children: (be || Te === n) && /* @__PURE__ */ h(
784
+ ae,
785
+ {
786
+ value: a.includes(e.id),
787
+ onChange: () => Fe(e.id),
788
+ className: f("checkbox-cell")
789
+ }
790
+ )
791
+ },
792
+ e.id
793
+ )) })
794
+ ] }), Ie = () => /* @__PURE__ */ D(
795
+ "div",
796
+ {
797
+ ref: x,
798
+ className: f(
799
+ "table",
800
+ {
801
+ "fixed-header": W,
802
+ "horizontally-scrollable-container": W && (g || A),
803
+ "external-scroll-container": W && !!w
804
+ },
805
+ p
806
+ ),
807
+ children: [
808
+ /* @__PURE__ */ D(
809
+ "div",
810
+ {
811
+ ref: j,
812
+ className: f(
813
+ "table-header",
814
+ {
815
+ "sticky-header": W && !I,
816
+ "horizontally-scrollable": g,
817
+ resizable: A
818
+ },
819
+ _
820
+ ),
821
+ style: { gridTemplateColumns: Nt },
822
+ children: [
823
+ s && !N && /* @__PURE__ */ h(
824
+ "div",
825
+ {
826
+ className: f("table-header-cell", "checkbox-cell"),
827
+ "data-base-left": k ? Z : 0,
828
+ children: Re && /* @__PURE__ */ h(
829
+ ae,
830
+ {
831
+ value: De,
832
+ partiallyChecked: je,
833
+ onChange: qe,
834
+ className: f("checkbox-cell")
835
+ }
836
+ )
837
+ }
838
+ ),
839
+ k && /* @__PURE__ */ h(
840
+ "div",
841
+ {
842
+ className: f("table-header-cell", "expand-cell", "left-border-accent"),
843
+ "data-base-left": "0",
844
+ children: S ? /* @__PURE__ */ h(
845
+ Pt,
846
+ {
847
+ content: S,
848
+ placement: "top",
849
+ wrapperClassName: f("expand-all-tooltip-wrapper"),
850
+ contentClassName: f("expand-all-tooltip-content"),
851
+ children: Xe
852
+ }
853
+ ) : Xe
854
+ }
855
+ ),
856
+ F.map((e, n) => {
857
+ const r = /* @__PURE__ */ h(
858
+ "button",
859
+ {
860
+ "data-column-key": e.key,
861
+ "data-pinned-index": n,
862
+ className: f("table-header-cell", "pinned-column", {
863
+ [`align-${e.align}`]: "align" in e,
864
+ "primary-cell": C(e),
865
+ "sortable-cell": re.includes(e.key),
866
+ resizable: A
867
+ }),
868
+ style: de(
869
+ e,
870
+ !0,
871
+ n,
872
+ F,
873
+ K,
874
+ k,
875
+ s,
876
+ N
877
+ ),
878
+ children: /* @__PURE__ */ D(
879
+ "div",
880
+ {
881
+ className: f("label"),
882
+ onClick: () => Ge(e.key),
883
+ onMouseEnter: () => Le(e.key),
884
+ onMouseLeave: xe,
885
+ children: [
886
+ /* @__PURE__ */ h(Ke, { column: e }),
887
+ (Ee === e.key || (U == null ? void 0 : U.key) === e.key) && Ue(e.key)
888
+ ]
889
+ }
890
+ )
891
+ },
892
+ e.key
893
+ );
894
+ return A ? $e(e, r) : r;
895
+ }),
896
+ J.map((e) => {
897
+ const n = /* @__PURE__ */ h(
898
+ "button",
899
+ {
900
+ className: f("table-header-cell", {
901
+ [`align-${e.align}`]: "align" in e,
902
+ "primary-cell": C(e),
903
+ "sortable-cell": re.includes(e.key),
904
+ resizable: A
905
+ }),
906
+ style: de(
907
+ e,
908
+ !1,
909
+ void 0,
910
+ F,
911
+ K,
912
+ k,
913
+ s,
914
+ N
915
+ ),
916
+ children: /* @__PURE__ */ D(
917
+ "div",
918
+ {
919
+ className: f("label"),
920
+ onClick: () => Ge(e.key),
921
+ onMouseEnter: () => Le(e.key),
922
+ onMouseLeave: xe,
923
+ children: [
924
+ /* @__PURE__ */ h(Ke, { column: e }),
925
+ (Ee === e.key || (U == null ? void 0 : U.key) === e.key) && Ue(e.key)
926
+ ]
927
+ }
928
+ )
929
+ },
930
+ e.key
931
+ );
932
+ return A ? $e(e, n) : n;
933
+ }),
934
+ l && /* @__PURE__ */ h("div", { className: f("table-header-cell", "action-menu-cell") })
935
+ ]
936
+ }
937
+ ),
938
+ /* @__PURE__ */ h(
939
+ "div",
940
+ {
941
+ ref: wt,
942
+ className: f(
943
+ "table-body",
944
+ {
945
+ "scrollable-body": W,
946
+ "horizontally-scrollable": g,
947
+ resizable: A
948
+ },
949
+ i
950
+ ),
951
+ children: t.map((e, n) => /* @__PURE__ */ D(
952
+ "div",
953
+ {
954
+ "data-row-index": n,
955
+ ref: bt(n),
956
+ className: f("table-row", Qe(e), d, {
957
+ selectable: s && !N
958
+ }),
959
+ onMouseEnter: () => Ne(n),
960
+ onMouseLeave: ze,
961
+ children: [
962
+ s && !N && /* @__PURE__ */ h(
963
+ "div",
964
+ {
965
+ className: f("table-cell", "checkbox-cell"),
966
+ "data-base-left": k ? Z : 0,
967
+ children: (be || Te === n) && /* @__PURE__ */ h(
968
+ ae,
969
+ {
970
+ value: a.includes(e.id),
971
+ onChange: () => Fe(e.id),
972
+ className: f("checkbox-cell")
973
+ }
974
+ )
975
+ }
976
+ ),
977
+ /* @__PURE__ */ h("div", { className: f("row-content-wrapper"), children: /* @__PURE__ */ D("div", { className: f("table-row-content"), style: { gridTemplateColumns: xt }, children: [
978
+ k && /* @__PURE__ */ h(
979
+ "div",
980
+ {
981
+ className: f("table-cell", "expand-cell", "left-border-accent"),
982
+ "data-base-left": "0",
983
+ "data-row-id": e.id,
984
+ children: /* @__PURE__ */ h(
985
+ "button",
986
+ {
987
+ onClick: () => ft(e.id),
988
+ "aria-label": M.includes(e.id) ? "Collapse row" : "Expand row",
989
+ "aria-expanded": M.includes(e.id),
990
+ children: /* @__PURE__ */ h(
991
+ "span",
992
+ {
993
+ className: f("expand-icon", {
994
+ expanded: M.includes(e.id)
995
+ }),
996
+ children: /* @__PURE__ */ h(Je, {})
997
+ }
998
+ )
999
+ }
1000
+ )
1001
+ }
1002
+ ),
1003
+ F.map((r, v) => {
1004
+ const m = Me(e.id, r.key), E = C(r);
1005
+ return /* @__PURE__ */ h(
1006
+ "div",
1007
+ {
1008
+ "data-column-key": r.key,
1009
+ "data-pinned-index": v,
1010
+ ref: E ? Ae(r.key) : void 0,
1011
+ className: f("table-cell", "pinned-column", {
1012
+ "primary-cell": E,
1013
+ "expanded-cell": m
1014
+ }),
1015
+ style: de(
1016
+ r,
1017
+ !0,
1018
+ v,
1019
+ F,
1020
+ K,
1021
+ k,
1022
+ s,
1023
+ N
1024
+ ),
1025
+ children: e[r.key].component || e[r.key].content || e[r.key]
1026
+ },
1027
+ r.key
1028
+ );
1029
+ }),
1030
+ J.map((r) => {
1031
+ const v = Me(e.id, r.key), m = C(r);
1032
+ return /* @__PURE__ */ h(
1033
+ "div",
1034
+ {
1035
+ ref: m ? Ae(r.key) : void 0,
1036
+ className: f("table-cell", {
1037
+ "primary-cell": m,
1038
+ "expanded-cell": v
1039
+ }),
1040
+ style: de(
1041
+ r,
1042
+ !1,
1043
+ void 0,
1044
+ F,
1045
+ K,
1046
+ k,
1047
+ s,
1048
+ N
1049
+ ),
1050
+ children: e[r.key].component || e[r.key].content || e[r.key]
1051
+ },
1052
+ r.key
1053
+ );
1054
+ }),
1055
+ l && /* @__PURE__ */ h("div", { className: f("table-cell", "action-menu-cell"), children: l(e.metaData) })
1056
+ ] }) })
1057
+ ]
1058
+ },
1059
+ e.id
1060
+ ))
1061
+ }
1062
+ ),
1063
+ g && /* @__PURE__ */ D(At, { children: [
1064
+ /* @__PURE__ */ h(
1065
+ Oe,
1066
+ {
1067
+ portalContainer: ke,
1068
+ visible: ge.visible,
1069
+ position: ge.position,
1070
+ size: ge.size,
1071
+ direction: "right",
1072
+ className: dt,
1073
+ dataTestId: "right-gradient"
1074
+ }
1075
+ ),
1076
+ /* @__PURE__ */ h(
1077
+ Oe,
1078
+ {
1079
+ portalContainer: ke,
1080
+ visible: ve.visible,
1081
+ position: ve.position,
1082
+ size: ve.size,
1083
+ direction: "left",
1084
+ className: ht,
1085
+ dataTestId: "pinned-gradient"
1086
+ }
1087
+ )
1088
+ ] })
1089
+ ]
1090
+ }
1091
+ );
1092
+ return N ? /* @__PURE__ */ D("div", { className: f("table-wrapper", { "fixed-header": W }, u), children: [
1093
+ zt(),
1094
+ Ie()
1095
+ ] }) : Ie();
1096
+ };
1097
+ export {
1098
+ bn as T
1099
+ };