@actioneer/ads 1.0.6 → 1.0.7
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.
- package/DESIGN.md +1 -1
- package/components/alert.d.ts +4 -4
- package/components/alert.js +91 -79
- package/components/radio.d.ts +1 -1
- package/components/radio.js +53 -53
- package/components/sidebar.js +74 -73
- package/components/table.d.ts +16 -4
- package/components/table.js +548 -401
- package/lib/icons.js +2 -2
- package/llms.txt +2 -2
- package/manifest.json +107 -12
- package/package.json +1 -1
- package/styles.css +5 -4
- package/theme.css +5 -4
package/components/table.js
CHANGED
|
@@ -1,62 +1,92 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
2
|
+
import { jsx as d, jsxs as $, Fragment as Pe } from "react/jsx-runtime";
|
|
3
|
+
import * as r from "react";
|
|
4
|
+
import { MotionConfig as Ae, motion as De } from "motion/react";
|
|
5
|
+
import { cn as g } from "../lib/cn.js";
|
|
6
|
+
import { Button as We } from "./button.js";
|
|
7
|
+
import { Checkbox as be } from "./checkbox.js";
|
|
8
|
+
import { Radio as Me } from "./radio.js";
|
|
9
|
+
import { ChevronRight as Ve, ChevronUp as $e, ChevronDown as Le, SortIcon as _e } from "../lib/icons.js";
|
|
10
|
+
import { springDisclosure as je } from "../lib/motion.js";
|
|
11
|
+
const ge = (t) => t === "center" ? "text-center" : t === "right" ? "text-right" : "text-left", ve = (t, e = !1) => t === "left" ? g(
|
|
8
12
|
"sticky left-0 z-10",
|
|
9
13
|
// Scroll-aware: the smudge only appears once content is actually
|
|
10
14
|
// hidden behind the pinned column (nothing to scroll back to at the
|
|
11
15
|
// far left → no shadow).
|
|
12
16
|
"group-data-[scroll-left=true]/table-shell:shadow-table-smudge-left"
|
|
13
|
-
) :
|
|
17
|
+
) : t === "right" ? g(
|
|
14
18
|
"sticky right-0 z-10",
|
|
15
19
|
// Backward-compatible fallback. Action columns should opt into the
|
|
16
20
|
// Table-level elevation so one shadow spans the complete column.
|
|
17
21
|
!e && "group-data-[scroll-right=true]/table-shell:shadow-table-smudge-right"
|
|
18
|
-
) : void 0,
|
|
22
|
+
) : void 0, ye = r.createContext({ interactive: !1, selected: !1 }), we = { depth: 0, hidden: !1 }, se = r.createContext(we), ae = {
|
|
23
|
+
backgroundColor: "var(--card)",
|
|
24
|
+
backgroundImage: "linear-gradient(to right, var(--table-row-selected), var(--card))",
|
|
25
|
+
backgroundSize: "var(--table-selection-width, 100%) 100%",
|
|
26
|
+
backgroundRepeat: "no-repeat"
|
|
27
|
+
}, xe = (t) => g(
|
|
19
28
|
"bg-card align-middle transition-colors",
|
|
20
29
|
// Functional row hairline; the table shell carries the outer stroke.
|
|
21
30
|
"border-b border-table-stroke group-last/row:border-b-0",
|
|
22
|
-
|
|
23
|
-
// Use
|
|
31
|
+
t && g(
|
|
32
|
+
// Use WG1 without introducing a new
|
|
24
33
|
// rounded silhouette. The wash is pre-composited so scrolled text
|
|
25
34
|
// cannot show through sticky cells.
|
|
26
35
|
"group-hover/row:bg-(--table-row-hover) group-focus-within/row:bg-(--table-row-hover)",
|
|
27
|
-
"group-data-[selected]/row:bg-
|
|
36
|
+
"group-data-[selected]/row:bg-transparent"
|
|
28
37
|
)
|
|
29
|
-
),
|
|
38
|
+
), Ne = "bg-table-shell", Ce = g(
|
|
30
39
|
"after:pointer-events-none after:absolute after:right-0 after:top-1/2",
|
|
31
40
|
"after:h-4 after:w-px after:-translate-y-1/2 after:rounded-sm",
|
|
32
41
|
"after:bg-border-strong last:after:hidden"
|
|
33
|
-
),
|
|
42
|
+
), ie = "__ads_table_column_", le = 64, Oe = new Intl.Collator(void 0, {
|
|
34
43
|
numeric: !0,
|
|
35
44
|
sensitivity: "base"
|
|
36
45
|
});
|
|
37
|
-
function
|
|
46
|
+
function L(t) {
|
|
38
47
|
const e = [];
|
|
39
|
-
return
|
|
40
|
-
if (
|
|
41
|
-
e.push(...
|
|
48
|
+
return r.Children.forEach(t, (s) => {
|
|
49
|
+
if (r.isValidElement(s) && s.type === r.Fragment) {
|
|
50
|
+
e.push(...L(s.props.children));
|
|
42
51
|
return;
|
|
43
52
|
}
|
|
44
|
-
e.push(
|
|
53
|
+
e.push(s);
|
|
45
54
|
}), e;
|
|
46
55
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
56
|
+
function z(t, e) {
|
|
57
|
+
return t === e || !!(e.displayName && t && (typeof t == "object" || typeof t == "function") && "displayName" in t && t.displayName === e.displayName);
|
|
58
|
+
}
|
|
59
|
+
function ke(t) {
|
|
60
|
+
return L(t).some((e) => !r.isValidElement(e) || z(e.type, de) ? !1 : z(e.type, K) && L(e.props.childRows).some(r.isValidElement) || ke(e.props.children));
|
|
61
|
+
}
|
|
62
|
+
function Xe(t) {
|
|
63
|
+
const e = /* @__PURE__ */ new Map(), s = (i) => L(i).flatMap((n) => {
|
|
64
|
+
if (!r.isValidElement(n)) return [];
|
|
65
|
+
if (z(n.type, de) || z(n.type, ue)) return [];
|
|
66
|
+
if (!z(n.type, K)) return s(n.props.children);
|
|
67
|
+
const c = s(n.props.childRows);
|
|
68
|
+
return n.props.rowKey === void 0 ? c : (c.length > 0 && e.set(n.props.rowKey, c), [n.props.rowKey, ...c]);
|
|
69
|
+
});
|
|
70
|
+
return { keys: s(t), descendants: e };
|
|
71
|
+
}
|
|
72
|
+
function oe(t, e) {
|
|
73
|
+
for (const [s, i] of e)
|
|
74
|
+
i.every((n) => t.has(n)) ? t.add(s) : t.delete(s);
|
|
75
|
+
return t;
|
|
76
|
+
}
|
|
77
|
+
function ee(t) {
|
|
78
|
+
if (t == null || typeof t == "boolean")
|
|
49
79
|
return "";
|
|
50
|
-
if (typeof
|
|
51
|
-
if (Array.isArray(
|
|
52
|
-
return
|
|
53
|
-
if (!
|
|
54
|
-
const e =
|
|
80
|
+
if (typeof t == "number" || typeof t == "string") return t;
|
|
81
|
+
if (Array.isArray(t))
|
|
82
|
+
return t.map((i) => String(ee(i))).join(" ").trim();
|
|
83
|
+
if (!r.isValidElement(t)) return "";
|
|
84
|
+
const e = t.props.sortValue;
|
|
55
85
|
if (typeof e == "string" || typeof e == "number" || e instanceof Date)
|
|
56
86
|
return e;
|
|
57
|
-
const
|
|
58
|
-
if (String(
|
|
59
|
-
for (const
|
|
87
|
+
const s = ee(t.props.children);
|
|
88
|
+
if (String(s).trim()) return s;
|
|
89
|
+
for (const i of [
|
|
60
90
|
"value",
|
|
61
91
|
"label",
|
|
62
92
|
"status",
|
|
@@ -64,287 +94,317 @@ function X(r) {
|
|
|
64
94
|
"title",
|
|
65
95
|
"health"
|
|
66
96
|
]) {
|
|
67
|
-
const
|
|
68
|
-
if (typeof
|
|
97
|
+
const n = t.props[i];
|
|
98
|
+
if (typeof n == "string" || typeof n == "number") return n;
|
|
69
99
|
}
|
|
70
100
|
return "";
|
|
71
101
|
}
|
|
72
|
-
function
|
|
73
|
-
if (
|
|
74
|
-
return { kind: "number", value:
|
|
75
|
-
if (typeof
|
|
76
|
-
return { kind: "number", value:
|
|
77
|
-
const e =
|
|
102
|
+
function he(t) {
|
|
103
|
+
if (t instanceof Date)
|
|
104
|
+
return { kind: "number", value: t.getTime() };
|
|
105
|
+
if (typeof t == "number")
|
|
106
|
+
return { kind: "number", value: t };
|
|
107
|
+
const e = t.trim();
|
|
78
108
|
if (!e || e === "—" || e === "-")
|
|
79
109
|
return { kind: "empty", value: "" };
|
|
80
|
-
const
|
|
81
|
-
if (/^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(
|
|
82
|
-
return { kind: "number", value: Number(
|
|
83
|
-
const
|
|
84
|
-
return Number.isNaN(
|
|
110
|
+
const s = e.replace(/[,\s]/g, "").replace(/^[₹$€£]/, "").replace(/%$/, "");
|
|
111
|
+
if (/^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(s))
|
|
112
|
+
return { kind: "number", value: Number(s) };
|
|
113
|
+
const n = /^\d{4}[-/]\d{1,2}[-/]\d{1,2}/.test(e) || /\b(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\b/i.test(e) ? Date.parse(e) : Number.NaN;
|
|
114
|
+
return Number.isNaN(n) ? { kind: "text", value: e } : { kind: "number", value: n };
|
|
85
115
|
}
|
|
86
|
-
function
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
if (
|
|
90
|
-
const c =
|
|
91
|
-
return
|
|
116
|
+
function Be(t, e, s) {
|
|
117
|
+
const i = he(t), n = he(e);
|
|
118
|
+
if (i.kind === "empty") return n.kind === "empty" ? 0 : 1;
|
|
119
|
+
if (n.kind === "empty") return -1;
|
|
120
|
+
const c = i.kind === "number" && n.kind === "number" ? i.value - n.value : Oe.compare(String(i.value), String(n.value));
|
|
121
|
+
return s === "ascending" ? c : -c;
|
|
92
122
|
}
|
|
93
|
-
const
|
|
94
|
-
function
|
|
95
|
-
const e = [],
|
|
96
|
-
if (!
|
|
97
|
-
return
|
|
98
|
-
let
|
|
99
|
-
const
|
|
100
|
-
if (!
|
|
101
|
-
for (; (e[
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
for (let
|
|
105
|
-
e[
|
|
106
|
-
e[
|
|
107
|
-
c +
|
|
123
|
+
const Re = r.createContext(null), te = () => r.useContext(Re), ce = r.createContext("body");
|
|
124
|
+
function Ue(t) {
|
|
125
|
+
const e = [], i = L(t.props.children).map((n, c) => {
|
|
126
|
+
if (!r.isValidElement(n) || !z(n.type, K))
|
|
127
|
+
return n;
|
|
128
|
+
let b = 0;
|
|
129
|
+
const A = L(n.props.children).map((o) => {
|
|
130
|
+
if (!r.isValidElement(o)) return o;
|
|
131
|
+
for (; (e[b] ?? 0) > c; )
|
|
132
|
+
b += 1;
|
|
133
|
+
const _ = Math.max(1, Number(o.props.colSpan ?? 1)), E = Math.max(1, Number(o.props.rowSpan ?? 1)), x = b;
|
|
134
|
+
for (let N = 0; N < _; N += 1)
|
|
135
|
+
e[x + N] = Math.max(
|
|
136
|
+
e[x + N] ?? 0,
|
|
137
|
+
c + E
|
|
108
138
|
);
|
|
109
|
-
return
|
|
139
|
+
return b += _, z(o.type, pe) ? r.cloneElement(o, { _sortColumnIndex: x }) : o;
|
|
110
140
|
});
|
|
111
|
-
return
|
|
141
|
+
return r.cloneElement(n, void 0, A);
|
|
112
142
|
});
|
|
113
|
-
return
|
|
143
|
+
return r.cloneElement(t, void 0, i);
|
|
114
144
|
}
|
|
115
|
-
function
|
|
116
|
-
const
|
|
117
|
-
if (!
|
|
118
|
-
return { row:
|
|
119
|
-
const
|
|
145
|
+
function Se(t, e, s = "ascending") {
|
|
146
|
+
const i = L(t).map((n, c) => {
|
|
147
|
+
if (!r.isValidElement(n) || !z(n.type, K))
|
|
148
|
+
return { row: n, index: c, value: "" };
|
|
149
|
+
const b = L(n.props.children);
|
|
120
150
|
return {
|
|
121
|
-
row:
|
|
151
|
+
row: r.cloneElement(n, {
|
|
152
|
+
key: n.key ?? n.props.rowKey ?? c,
|
|
153
|
+
...n.props.childRows ? { childRows: Se(n.props.childRows, e, s) } : {}
|
|
154
|
+
}),
|
|
122
155
|
index: c,
|
|
123
|
-
value:
|
|
156
|
+
value: e === void 0 ? "" : ee(b[e])
|
|
124
157
|
};
|
|
125
158
|
});
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
);
|
|
159
|
+
return e !== void 0 && i.sort((n, c) => Be(n.value, c.value, s) || n.index - c.index), i.map(({ row: n }) => n);
|
|
160
|
+
}
|
|
161
|
+
function Fe(t, e, s) {
|
|
162
|
+
return r.cloneElement(t, void 0, Se(t.props.children, e, s));
|
|
131
163
|
}
|
|
132
|
-
function
|
|
133
|
-
const
|
|
134
|
-
return
|
|
135
|
-
|
|
164
|
+
function ze(t, e) {
|
|
165
|
+
const s = e != null && e.column.startsWith(ie) ? Number(e.column.slice(ie.length)) : Number.NaN;
|
|
166
|
+
return r.Children.map(t, (i) => r.isValidElement(i) ? i.type === r.Fragment ? r.cloneElement(
|
|
167
|
+
i,
|
|
136
168
|
void 0,
|
|
137
|
-
|
|
138
|
-
) :
|
|
169
|
+
ze(i.props.children, e)
|
|
170
|
+
) : z(i.type, ue) ? Ue(i) : z(i.type, Ee) ? Fe(i, Number.isInteger(s) && s >= 0 ? s : void 0, e == null ? void 0 : e.direction) : i : i);
|
|
139
171
|
}
|
|
140
|
-
const
|
|
172
|
+
const de = r.forwardRef(
|
|
141
173
|
({
|
|
142
|
-
className:
|
|
174
|
+
className: t,
|
|
143
175
|
wrapperClassName: e,
|
|
144
|
-
toolbar:
|
|
145
|
-
footer:
|
|
146
|
-
children:
|
|
176
|
+
toolbar: s,
|
|
177
|
+
footer: i,
|
|
178
|
+
children: n,
|
|
147
179
|
selectionMode: c = "none",
|
|
148
|
-
selectedKeys:
|
|
180
|
+
selectedKeys: b,
|
|
149
181
|
onSelectionChange: v,
|
|
150
|
-
rowKeys:
|
|
151
|
-
elevatedActionColumn:
|
|
152
|
-
actionColumnWidth:
|
|
153
|
-
sortDescriptor:
|
|
154
|
-
onSortChange:
|
|
155
|
-
allowsSorting:
|
|
156
|
-
isStatic:
|
|
157
|
-
resizableColumns:
|
|
158
|
-
maxBodyHeight:
|
|
159
|
-
...
|
|
160
|
-
},
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
182
|
+
rowKeys: A,
|
|
183
|
+
elevatedActionColumn: o = !1,
|
|
184
|
+
actionColumnWidth: _ = "3rem",
|
|
185
|
+
sortDescriptor: E,
|
|
186
|
+
onSortChange: x,
|
|
187
|
+
allowsSorting: N = !0,
|
|
188
|
+
isStatic: F = !1,
|
|
189
|
+
resizableColumns: j = !0,
|
|
190
|
+
maxBodyHeight: D,
|
|
191
|
+
...q
|
|
192
|
+
}, u) => {
|
|
193
|
+
const k = r.useId(), R = r.useMemo(() => ke(n), [n]), y = r.useMemo(() => Xe(n), [n]), T = r.useMemo(() => A ?? [], [A]), J = b === "all", W = r.useMemo(() => {
|
|
194
|
+
const a = new Set(b === "all" ? [...T, ...y.keys] : b);
|
|
195
|
+
if (c !== "multiple") return a;
|
|
196
|
+
for (const p of [...a])
|
|
197
|
+
for (const h of y.descendants.get(p) ?? []) a.add(h);
|
|
198
|
+
return oe(a, y.descendants);
|
|
199
|
+
}, [b, c, T, y]), S = r.useCallback(
|
|
200
|
+
(a) => J || W.has(a),
|
|
201
|
+
[J, W]
|
|
202
|
+
), B = r.useCallback(
|
|
203
|
+
(a) => {
|
|
204
|
+
var p;
|
|
205
|
+
return c === "multiple" && !S(a) && (((p = y.descendants.get(a)) == null ? void 0 : p.some((h) => W.has(h))) ?? !1);
|
|
206
|
+
},
|
|
207
|
+
[c, S, y, W]
|
|
208
|
+
), C = T.length > 0 && T.every(S), O = !C && T.some((a) => S(a) || B(a)), m = r.useCallback(
|
|
209
|
+
(a) => {
|
|
166
210
|
if (!v) return;
|
|
167
211
|
if (c === "single") {
|
|
168
|
-
|
|
212
|
+
S(a) || v(/* @__PURE__ */ new Set([a]));
|
|
169
213
|
return;
|
|
170
214
|
}
|
|
171
|
-
const
|
|
172
|
-
|
|
215
|
+
const p = new Set(W), h = !S(a);
|
|
216
|
+
for (const U of [a, ...y.descendants.get(a) ?? []])
|
|
217
|
+
h ? p.add(U) : p.delete(U);
|
|
218
|
+
v(oe(p, y.descendants));
|
|
173
219
|
},
|
|
174
|
-
[v, c,
|
|
175
|
-
),
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
220
|
+
[v, c, S, W, y]
|
|
221
|
+
), f = r.useCallback(() => {
|
|
222
|
+
if (!v) return;
|
|
223
|
+
const a = /* @__PURE__ */ new Set();
|
|
224
|
+
if (!C)
|
|
225
|
+
for (const p of T) {
|
|
226
|
+
a.add(p);
|
|
227
|
+
for (const h of y.descendants.get(p) ?? []) a.add(h);
|
|
228
|
+
}
|
|
229
|
+
v(oe(a, y.descendants));
|
|
230
|
+
}, [v, C, T, y]), [M, X] = r.useState(), I = N && !x, w = I ? M ?? E : E, V = r.useCallback(
|
|
231
|
+
(a) => {
|
|
232
|
+
if (!N) return;
|
|
233
|
+
const p = (w == null ? void 0 : w.column) === a && w.direction === "ascending" ? "descending" : "ascending", h = { column: a, direction: p };
|
|
234
|
+
x ? x(h) : X(h);
|
|
182
235
|
},
|
|
183
|
-
[
|
|
184
|
-
),
|
|
185
|
-
() =>
|
|
186
|
-
[
|
|
187
|
-
),
|
|
236
|
+
[w, N, x]
|
|
237
|
+
), re = r.useMemo(
|
|
238
|
+
() => I ? ze(n, w) : n,
|
|
239
|
+
[w, I, n]
|
|
240
|
+
), G = r.useRef(null), [Q, l] = r.useState({
|
|
188
241
|
left: !1,
|
|
189
242
|
right: !1
|
|
190
|
-
}),
|
|
191
|
-
const
|
|
192
|
-
if (!
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
243
|
+
}), P = r.useCallback(() => {
|
|
244
|
+
const a = G.current;
|
|
245
|
+
if (!a) return;
|
|
246
|
+
a.style.setProperty("--table-selection-width", `${a.clientWidth}px`), a.style.setProperty("--table-selection-scroll", `${a.scrollLeft}px`);
|
|
247
|
+
const p = a.scrollWidth - a.clientWidth, h = a.scrollLeft > 1, U = a.scrollLeft < p - 1;
|
|
248
|
+
l(
|
|
249
|
+
(ne) => ne.left === h && ne.right === U ? ne : { left: h, right: U }
|
|
196
250
|
);
|
|
197
251
|
}, []);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
if (!
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
return
|
|
206
|
-
}, [
|
|
207
|
-
const [
|
|
252
|
+
r.useLayoutEffect(() => {
|
|
253
|
+
P();
|
|
254
|
+
const a = G.current;
|
|
255
|
+
if (!a || typeof ResizeObserver > "u") return;
|
|
256
|
+
const p = new ResizeObserver(P);
|
|
257
|
+
p.observe(a);
|
|
258
|
+
const h = a.querySelector("table");
|
|
259
|
+
return h && p.observe(h), () => p.disconnect();
|
|
260
|
+
}, [P]);
|
|
261
|
+
const [H, Y] = r.useState(
|
|
208
262
|
null
|
|
209
|
-
),
|
|
210
|
-
(
|
|
211
|
-
|
|
212
|
-
(
|
|
213
|
-
|
|
214
|
-
(
|
|
263
|
+
), Z = r.useCallback(
|
|
264
|
+
(a) => {
|
|
265
|
+
Y(
|
|
266
|
+
(p) => p ?? Array.from(
|
|
267
|
+
a.cells,
|
|
268
|
+
(h) => h.getBoundingClientRect().width
|
|
215
269
|
)
|
|
216
270
|
);
|
|
217
271
|
},
|
|
218
272
|
[]
|
|
219
|
-
),
|
|
220
|
-
|
|
221
|
-
if (!
|
|
222
|
-
const
|
|
223
|
-
return
|
|
273
|
+
), me = r.useCallback((a, p) => {
|
|
274
|
+
Y((h) => {
|
|
275
|
+
if (!h) return h;
|
|
276
|
+
const U = [...h];
|
|
277
|
+
return U[a] = Math.max(le, p), U;
|
|
224
278
|
});
|
|
225
|
-
}, []),
|
|
226
|
-
() =>
|
|
279
|
+
}, []), fe = r.useCallback(
|
|
280
|
+
() => Y(null),
|
|
227
281
|
[]
|
|
228
|
-
),
|
|
282
|
+
), Ie = r.useMemo(
|
|
229
283
|
() => ({
|
|
230
284
|
selectionMode: c,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
285
|
+
selectionName: k,
|
|
286
|
+
hasNestedRows: R,
|
|
287
|
+
isSelected: S,
|
|
288
|
+
isIndeterminate: B,
|
|
289
|
+
toggleKey: m,
|
|
290
|
+
toggleAll: f,
|
|
291
|
+
allSelected: C,
|
|
292
|
+
someSelected: O,
|
|
293
|
+
isStatic: F,
|
|
294
|
+
sortDescriptor: w,
|
|
295
|
+
requestSort: N ? V : void 0,
|
|
296
|
+
automaticSorting: I,
|
|
297
|
+
elevatedActionColumn: o,
|
|
298
|
+
resizableColumns: j,
|
|
299
|
+
columnWidths: H,
|
|
300
|
+
snapshotColumnWidths: Z,
|
|
301
|
+
setColumnWidth: me,
|
|
302
|
+
resetColumnWidths: fe,
|
|
303
|
+
stickyHeader: D != null
|
|
247
304
|
}),
|
|
248
305
|
[
|
|
249
306
|
c,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
M,
|
|
253
|
-
A,
|
|
254
|
-
I,
|
|
255
|
-
z,
|
|
256
|
-
l,
|
|
257
|
-
g,
|
|
258
|
-
p,
|
|
259
|
-
T,
|
|
260
|
-
t,
|
|
307
|
+
k,
|
|
308
|
+
R,
|
|
261
309
|
S,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
310
|
+
B,
|
|
311
|
+
m,
|
|
312
|
+
f,
|
|
313
|
+
C,
|
|
314
|
+
O,
|
|
315
|
+
F,
|
|
316
|
+
w,
|
|
317
|
+
N,
|
|
318
|
+
I,
|
|
319
|
+
V,
|
|
320
|
+
o,
|
|
321
|
+
j,
|
|
322
|
+
H,
|
|
323
|
+
Z,
|
|
324
|
+
me,
|
|
325
|
+
fe,
|
|
326
|
+
D
|
|
267
327
|
]
|
|
268
328
|
);
|
|
269
|
-
return /* @__PURE__ */
|
|
329
|
+
return /* @__PURE__ */ d(Re.Provider, { value: Ie, children: /* @__PURE__ */ d(se.Provider, { value: we, children: /* @__PURE__ */ $(
|
|
270
330
|
"div",
|
|
271
331
|
{
|
|
272
332
|
"data-slot": "table-container",
|
|
273
|
-
"data-scroll-left":
|
|
274
|
-
"data-scroll-right":
|
|
275
|
-
className:
|
|
276
|
-
"group/table-shell overflow-clip rounded-m border border-table-stroke bg-table-shell",
|
|
333
|
+
"data-scroll-left": Q.left ? "true" : "false",
|
|
334
|
+
"data-scroll-right": Q.right ? "true" : "false",
|
|
335
|
+
className: g(
|
|
336
|
+
"group/table-shell w-full min-w-0 overflow-clip rounded-m border border-table-stroke bg-table-shell",
|
|
277
337
|
"[--table-card-radius:var(--radius-m)]",
|
|
278
338
|
e
|
|
279
339
|
),
|
|
280
340
|
children: [
|
|
281
|
-
|
|
341
|
+
s && /* @__PURE__ */ d(
|
|
282
342
|
"div",
|
|
283
343
|
{
|
|
284
344
|
"data-slot": "table-toolbar",
|
|
285
345
|
className: "flex min-h-12 items-center justify-end border-b border-table-stroke px-4 py-2",
|
|
286
|
-
children:
|
|
346
|
+
children: s
|
|
287
347
|
}
|
|
288
348
|
),
|
|
289
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ $(
|
|
290
350
|
"div",
|
|
291
351
|
{
|
|
292
352
|
className: "relative",
|
|
293
|
-
style:
|
|
294
|
-
"--table-action-column-width":
|
|
353
|
+
style: o ? {
|
|
354
|
+
"--table-action-column-width": _
|
|
295
355
|
} : void 0,
|
|
296
356
|
children: [
|
|
297
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ d(
|
|
298
358
|
"div",
|
|
299
359
|
{
|
|
300
|
-
ref:
|
|
301
|
-
onScroll:
|
|
302
|
-
className:
|
|
360
|
+
ref: G,
|
|
361
|
+
onScroll: P,
|
|
362
|
+
className: g(
|
|
303
363
|
"overflow-x-auto rounded-(--table-card-radius)",
|
|
304
|
-
|
|
364
|
+
D != null && "overflow-y-auto"
|
|
305
365
|
),
|
|
306
|
-
style:
|
|
307
|
-
children: /* @__PURE__ */
|
|
366
|
+
style: D != null ? { maxHeight: D } : void 0,
|
|
367
|
+
children: /* @__PURE__ */ $(
|
|
308
368
|
"table",
|
|
309
369
|
{
|
|
310
|
-
ref:
|
|
370
|
+
ref: u,
|
|
311
371
|
"data-slot": "table",
|
|
312
|
-
className:
|
|
372
|
+
className: g(
|
|
313
373
|
"w-full border-separate border-spacing-0 text-m font-normal",
|
|
314
374
|
// Manual widths need fixed layout so the <colgroup> wins;
|
|
315
375
|
// until the first resize the automatic layout is untouched.
|
|
316
|
-
|
|
317
|
-
|
|
376
|
+
H && "table-fixed",
|
|
377
|
+
t
|
|
318
378
|
),
|
|
319
|
-
...
|
|
379
|
+
...q,
|
|
320
380
|
children: [
|
|
321
|
-
|
|
322
|
-
|
|
381
|
+
H && /* @__PURE__ */ d("colgroup", { children: H.map((a, p) => /* @__PURE__ */ d("col", { style: { width: a } }, p)) }),
|
|
382
|
+
re
|
|
323
383
|
]
|
|
324
384
|
}
|
|
325
385
|
)
|
|
326
386
|
}
|
|
327
387
|
),
|
|
328
|
-
/* @__PURE__ */
|
|
388
|
+
/* @__PURE__ */ d(
|
|
329
389
|
"div",
|
|
330
390
|
{
|
|
331
391
|
"aria-hidden": "true",
|
|
332
392
|
"data-slot": "table-scroll-hint",
|
|
333
|
-
className:
|
|
393
|
+
className: g(
|
|
334
394
|
"pointer-events-none absolute inset-y-0 z-20 w-10",
|
|
335
395
|
"bg-gradient-to-l from-(--table-scroll-hint) to-transparent",
|
|
336
396
|
"opacity-0 transition-opacity duration-150 ease-out motion-reduce:transition-none",
|
|
337
|
-
|
|
338
|
-
|
|
397
|
+
Q.right && "opacity-100",
|
|
398
|
+
o ? "right-[var(--table-action-column-width)]" : "right-0"
|
|
339
399
|
)
|
|
340
400
|
}
|
|
341
401
|
),
|
|
342
|
-
|
|
402
|
+
o && /* @__PURE__ */ d(
|
|
343
403
|
"div",
|
|
344
404
|
{
|
|
345
405
|
"aria-hidden": "true",
|
|
346
406
|
"data-slot": "table-action-column-elevation",
|
|
347
|
-
className:
|
|
407
|
+
className: g(
|
|
348
408
|
"pointer-events-none absolute inset-y-0 right-0 z-20",
|
|
349
409
|
"w-[var(--table-action-column-width)]"
|
|
350
410
|
// No shadow of its own: while columns hide behind the pinned
|
|
@@ -357,192 +417,275 @@ const ze = n.forwardRef(
|
|
|
357
417
|
]
|
|
358
418
|
}
|
|
359
419
|
),
|
|
360
|
-
|
|
420
|
+
i && /* @__PURE__ */ d("div", { className: "flex items-center border-t border-table-stroke px-4 py-2.5", children: i })
|
|
361
421
|
]
|
|
362
422
|
}
|
|
363
|
-
) });
|
|
423
|
+
) }) });
|
|
364
424
|
}
|
|
365
425
|
);
|
|
366
|
-
|
|
367
|
-
const
|
|
368
|
-
const
|
|
369
|
-
return /* @__PURE__ */
|
|
426
|
+
de.displayName = "Table";
|
|
427
|
+
const ue = r.forwardRef(({ className: t, ...e }, s) => {
|
|
428
|
+
const i = te();
|
|
429
|
+
return /* @__PURE__ */ d(ce.Provider, { value: "header", children: /* @__PURE__ */ d(
|
|
370
430
|
"thead",
|
|
371
431
|
{
|
|
372
|
-
ref:
|
|
373
|
-
className:
|
|
432
|
+
ref: s,
|
|
433
|
+
className: g(
|
|
374
434
|
"text-s font-medium text-table-header-foreground",
|
|
375
|
-
(
|
|
376
|
-
|
|
435
|
+
(i == null ? void 0 : i.elevatedActionColumn) && "relative z-30 bg-table-shell",
|
|
436
|
+
t
|
|
377
437
|
),
|
|
378
438
|
...e
|
|
379
439
|
}
|
|
380
440
|
) });
|
|
381
441
|
});
|
|
382
|
-
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
const K =
|
|
442
|
+
ue.displayName = "TableHeader";
|
|
443
|
+
const Ee = r.forwardRef(({ className: t, ...e }, s) => /* @__PURE__ */ d(ce.Provider, { value: "body", children: /* @__PURE__ */ d("tbody", { ref: s, className: g("[&>tr:not([hidden],[data-collapsed]):not(:has(~tr:not([hidden],[data-collapsed])))>td]:border-b-0", t), ...e }) }));
|
|
444
|
+
Ee.displayName = "TableBody";
|
|
445
|
+
const K = r.forwardRef(
|
|
386
446
|
({
|
|
387
|
-
className:
|
|
447
|
+
className: t,
|
|
388
448
|
rowKey: e,
|
|
389
|
-
children:
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
449
|
+
children: s,
|
|
450
|
+
childRows: i,
|
|
451
|
+
expanded: n,
|
|
452
|
+
defaultExpanded: c = !1,
|
|
453
|
+
onExpandedChange: b,
|
|
454
|
+
disclosureLabel: v,
|
|
455
|
+
id: A,
|
|
456
|
+
hidden: o,
|
|
457
|
+
isInteractive: _ = !1,
|
|
458
|
+
onClick: E,
|
|
459
|
+
onKeyDown: x,
|
|
460
|
+
role: N,
|
|
461
|
+
tabIndex: F,
|
|
462
|
+
style: j,
|
|
463
|
+
...D
|
|
464
|
+
}, q) => {
|
|
465
|
+
const u = te(), k = r.useContext(ce), R = r.useContext(se), y = r.useId(), T = A ?? y, [J, W] = r.useState(c), [S, B] = r.useState(!1), C = n ?? J, O = L(i).map((l, P) => !r.isValidElement(l) || !z(l.type, K) ? l : r.cloneElement(l, {
|
|
466
|
+
key: l.key ?? l.props.rowKey ?? P,
|
|
467
|
+
id: l.props.id ?? `${T}-child-${encodeURIComponent(String(l.props.rowKey ?? P))}`
|
|
468
|
+
})), m = k === "body" && O.some(r.isValidElement), f = O.flatMap((l) => r.isValidElement(l) && l.props.id ? [l.props.id] : []), M = (l) => {
|
|
469
|
+
B(l), n === void 0 && W(!C), b == null || b(!C);
|
|
470
|
+
}, X = !!u && u.selectionMode !== "none", I = k === "body" && (typeof E == "function" || m || X && e !== void 0), w = k === "body" && !(u != null && u.isStatic) && (I || _), V = X && k === "body" && e !== void 0 ? u.isSelected(e) : !1, re = r.useMemo(
|
|
471
|
+
() => ({ interactive: w, selected: V }),
|
|
472
|
+
[w, V]
|
|
473
|
+
);
|
|
474
|
+
let G = !0;
|
|
475
|
+
const Q = u != null && u.hasNestedRows || m || R.depth > 0 ? L(s).map((l, P) => {
|
|
476
|
+
if (!G || !r.isValidElement(l) || !z(l.type, Te) && !z(l.type, pe)) return l;
|
|
477
|
+
G = !1;
|
|
478
|
+
const H = v ?? String(ee(l.props.children)).trim(), Y = k === "header" ? "span" : "div";
|
|
479
|
+
return r.cloneElement(l, { key: l.key ?? P }, /* @__PURE__ */ d(
|
|
480
|
+
Y,
|
|
481
|
+
{
|
|
482
|
+
className: "inline-flex items-center gap-2",
|
|
483
|
+
style: R.depth > 0 ? { paddingInlineStart: `calc(var(--spacing) * 6 * ${R.depth})` } : void 0,
|
|
484
|
+
children: m ? /* @__PURE__ */ $(
|
|
485
|
+
We,
|
|
425
486
|
{
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
487
|
+
type: "button",
|
|
488
|
+
variant: "ghost",
|
|
489
|
+
size: "sm",
|
|
490
|
+
className: "-mx-2 h-8 shrink-0 border-0 px-2 text-left text-inherit enabled:hover:bg-transparent enabled:hover:text-action-primary-text enabled:active:bg-transparent enabled:active:text-action-primary-text [&>span]:gap-2",
|
|
491
|
+
style: { fontWeight: "inherit" },
|
|
492
|
+
"aria-label": `${C ? "Collapse" : "Expand"} ${H || "row"}`,
|
|
493
|
+
"aria-expanded": C,
|
|
494
|
+
"aria-controls": f.join(" ") || void 0,
|
|
495
|
+
onClick: (Z) => {
|
|
496
|
+
Z.stopPropagation(), M(Z.detail === 0);
|
|
497
|
+
},
|
|
437
498
|
children: [
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
|
|
440
|
-
|
|
499
|
+
/* @__PURE__ */ d(Ae, { reducedMotion: "user", children: /* @__PURE__ */ d(De.span, { initial: !1, animate: { rotate: C ? 90 : 0 }, transition: S ? { duration: 0 } : je, className: "inline-flex size-6 shrink-0 items-center justify-center", children: /* @__PURE__ */ d(Ve, { "aria-hidden": !0 }) }) }),
|
|
500
|
+
l.props.children
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
) : /* @__PURE__ */ $(Pe, { children: [
|
|
504
|
+
/* @__PURE__ */ d("span", { "aria-hidden": !0, className: "size-6 shrink-0" }),
|
|
505
|
+
l.props.children
|
|
506
|
+
] })
|
|
507
|
+
}
|
|
508
|
+
));
|
|
509
|
+
}) : s;
|
|
510
|
+
return /* @__PURE__ */ $(ye.Provider, { value: re, children: [
|
|
511
|
+
/* @__PURE__ */ $(
|
|
512
|
+
"tr",
|
|
513
|
+
{
|
|
514
|
+
ref: q,
|
|
515
|
+
id: T,
|
|
516
|
+
hidden: o,
|
|
517
|
+
"aria-hidden": R.hidden || void 0,
|
|
518
|
+
"data-collapsed": R.hidden || void 0,
|
|
519
|
+
"data-depth": u != null && u.hasNestedRows ? R.depth : void 0,
|
|
520
|
+
"data-interactive": w || void 0,
|
|
521
|
+
"data-selected": V || void 0,
|
|
522
|
+
className: g(
|
|
523
|
+
"group/row",
|
|
524
|
+
k === "body" && "h-16",
|
|
525
|
+
// Native table-row collapse removes height while preserving the
|
|
526
|
+
// intrinsic column widths. `hidden` / display:none would make
|
|
527
|
+
// every column shift when longer descendants become visible.
|
|
528
|
+
R.hidden && "collapse",
|
|
529
|
+
I && "cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
|
|
530
|
+
t
|
|
531
|
+
),
|
|
532
|
+
style: w && V ? {
|
|
533
|
+
...ae,
|
|
534
|
+
backgroundPositionX: "var(--table-selection-scroll, 0px)",
|
|
535
|
+
...j
|
|
536
|
+
} : j,
|
|
537
|
+
onClick: (l) => {
|
|
538
|
+
const P = l.target;
|
|
539
|
+
P instanceof Element && P.closest(
|
|
540
|
+
"a, button, input, select, textarea, [role='button'], [role='link'], [contenteditable='true']"
|
|
541
|
+
) || (E ? E(l) : X && e !== void 0 ? u == null || u.toggleKey(e) : m && M(l.detail === 0));
|
|
542
|
+
},
|
|
543
|
+
onKeyDown: (l) => {
|
|
544
|
+
x == null || x(l), !l.defaultPrevented && I && l.target === l.currentTarget && (l.key === "Enter" || l.key === " ") && (l.preventDefault(), l.currentTarget.click());
|
|
545
|
+
},
|
|
546
|
+
role: N,
|
|
547
|
+
tabIndex: F ?? (I ? 0 : void 0),
|
|
548
|
+
...D,
|
|
549
|
+
children: [
|
|
550
|
+
X && (k === "header" ? /* @__PURE__ */ $(
|
|
551
|
+
"th",
|
|
552
|
+
{
|
|
553
|
+
scope: "col",
|
|
554
|
+
className: g(
|
|
555
|
+
"w-10 border-b border-table-stroke px-4 py-2.5",
|
|
556
|
+
Ce,
|
|
557
|
+
// Sticky without the baked shadow — an always-on smudge
|
|
558
|
+
// muddies the shell's corners (elevation = actionability).
|
|
559
|
+
// (sticky is positioned, so the ::after tick anchors to it —
|
|
560
|
+
// no `relative` needed, and it would conflict with sticky.)
|
|
561
|
+
"sticky left-0 z-10",
|
|
562
|
+
Ne
|
|
563
|
+
),
|
|
564
|
+
children: [
|
|
565
|
+
/* @__PURE__ */ d("span", { className: "sr-only", children: "Row selection" }),
|
|
566
|
+
u.selectionMode === "multiple" && /* @__PURE__ */ d(
|
|
567
|
+
be,
|
|
568
|
+
{
|
|
569
|
+
size: "sm",
|
|
570
|
+
"aria-label": "Select all rows",
|
|
571
|
+
checked: u.allSelected,
|
|
572
|
+
indeterminate: u.someSelected,
|
|
573
|
+
onChange: u.toggleAll
|
|
574
|
+
}
|
|
575
|
+
)
|
|
576
|
+
]
|
|
577
|
+
}
|
|
578
|
+
) : /* @__PURE__ */ d(
|
|
579
|
+
"td",
|
|
580
|
+
{
|
|
581
|
+
className: g(
|
|
582
|
+
"h-16 w-10 px-4 py-2",
|
|
583
|
+
xe(w),
|
|
584
|
+
"sticky left-0 z-10"
|
|
585
|
+
),
|
|
586
|
+
style: w && V ? {
|
|
587
|
+
...ae,
|
|
588
|
+
backgroundPositionX: "left"
|
|
589
|
+
} : void 0,
|
|
590
|
+
onClick: (l) => l.stopPropagation(),
|
|
591
|
+
children: e !== void 0 && (u.selectionMode === "single" ? /* @__PURE__ */ d(
|
|
592
|
+
Me,
|
|
593
|
+
{
|
|
594
|
+
name: u.selectionName,
|
|
595
|
+
value: e,
|
|
596
|
+
"aria-label": `Select ${e}`,
|
|
597
|
+
checked: V,
|
|
598
|
+
onChange: () => u.toggleKey(e)
|
|
599
|
+
}
|
|
600
|
+
) : /* @__PURE__ */ d(
|
|
601
|
+
be,
|
|
441
602
|
{
|
|
442
603
|
size: "sm",
|
|
443
|
-
"aria-label":
|
|
444
|
-
checked:
|
|
445
|
-
indeterminate:
|
|
446
|
-
onChange:
|
|
604
|
+
"aria-label": `Select ${e}`,
|
|
605
|
+
checked: V,
|
|
606
|
+
indeterminate: u.isIndeterminate(e),
|
|
607
|
+
onChange: () => u.toggleKey(e)
|
|
447
608
|
}
|
|
448
|
-
)
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
"sticky left-0 z-10"
|
|
458
|
-
),
|
|
459
|
-
onClick: (m) => m.stopPropagation(),
|
|
460
|
-
children: e !== void 0 && /* @__PURE__ */ u(
|
|
461
|
-
ne,
|
|
462
|
-
{
|
|
463
|
-
size: "sm",
|
|
464
|
-
"aria-label": `Select ${e}`,
|
|
465
|
-
checked: S,
|
|
466
|
-
onChange: () => b.toggleKey(e)
|
|
467
|
-
}
|
|
468
|
-
)
|
|
469
|
-
}
|
|
470
|
-
)),
|
|
471
|
-
a
|
|
472
|
-
]
|
|
473
|
-
}
|
|
474
|
-
) });
|
|
609
|
+
))
|
|
610
|
+
}
|
|
611
|
+
)),
|
|
612
|
+
Q
|
|
613
|
+
]
|
|
614
|
+
}
|
|
615
|
+
),
|
|
616
|
+
m && /* @__PURE__ */ d(se.Provider, { value: { depth: R.depth + 1, hidden: R.hidden || !C || !!o }, children: O })
|
|
617
|
+
] });
|
|
475
618
|
}
|
|
476
619
|
);
|
|
477
620
|
K.displayName = "TableRow";
|
|
478
|
-
const
|
|
621
|
+
const pe = r.forwardRef(
|
|
479
622
|
({
|
|
480
|
-
className:
|
|
623
|
+
className: t,
|
|
481
624
|
align: e,
|
|
482
|
-
sticky:
|
|
483
|
-
sortKey:
|
|
484
|
-
allowsSorting:
|
|
625
|
+
sticky: s,
|
|
626
|
+
sortKey: i,
|
|
627
|
+
allowsSorting: n = !0,
|
|
485
628
|
_sortColumnIndex: c,
|
|
486
|
-
children:
|
|
629
|
+
children: b,
|
|
487
630
|
...v
|
|
488
|
-
},
|
|
489
|
-
var
|
|
490
|
-
const
|
|
491
|
-
if (
|
|
492
|
-
const
|
|
493
|
-
if (!(!
|
|
494
|
-
|
|
495
|
-
index:
|
|
496
|
-
startX:
|
|
497
|
-
startWidth:
|
|
498
|
-
},
|
|
631
|
+
}, A) => {
|
|
632
|
+
var B, C, O;
|
|
633
|
+
const o = te(), E = (o != null && o.automaticSorting && c !== void 0 ? `${ie}${c}` : void 0) ?? i, x = Number(v.colSpan ?? 1) === 1, N = String(ee(b)).trim(), F = N.length > 0, j = n && x && s !== "right" && F && !!E && !!(o != null && o.requestSort), D = j && ((B = o == null ? void 0 : o.sortDescriptor) == null ? void 0 : B.column) === E, q = (C = o == null ? void 0 : o.sortDescriptor) == null ? void 0 : C.direction, u = !!(o != null && o.resizableColumns) && x && s !== "right", k = r.useRef(null), [R, y] = r.useState(!1), T = (m) => {
|
|
634
|
+
if (m.button !== 0 || !o) return;
|
|
635
|
+
const f = m.currentTarget.parentElement, M = f == null ? void 0 : f.parentElement;
|
|
636
|
+
if (!(!f || !M)) {
|
|
637
|
+
o.snapshotColumnWidths(M), k.current = {
|
|
638
|
+
index: f.cellIndex,
|
|
639
|
+
startX: m.clientX,
|
|
640
|
+
startWidth: f.getBoundingClientRect().width
|
|
641
|
+
}, y(!0);
|
|
499
642
|
try {
|
|
500
|
-
|
|
643
|
+
m.currentTarget.setPointerCapture(m.pointerId);
|
|
501
644
|
} catch {
|
|
502
645
|
}
|
|
503
|
-
|
|
646
|
+
m.preventDefault();
|
|
504
647
|
}
|
|
505
|
-
},
|
|
506
|
-
const
|
|
507
|
-
!
|
|
508
|
-
|
|
509
|
-
|
|
648
|
+
}, J = (m) => {
|
|
649
|
+
const f = k.current;
|
|
650
|
+
!f || !o || o.setColumnWidth(
|
|
651
|
+
f.index,
|
|
652
|
+
f.startWidth + (m.clientX - f.startX)
|
|
510
653
|
);
|
|
511
|
-
},
|
|
512
|
-
|
|
513
|
-
},
|
|
514
|
-
if (
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
if (!
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
654
|
+
}, W = () => {
|
|
655
|
+
k.current = null, y(!1);
|
|
656
|
+
}, S = (m) => {
|
|
657
|
+
if (m.key !== "ArrowLeft" && m.key !== "ArrowRight" || !o) return;
|
|
658
|
+
m.preventDefault();
|
|
659
|
+
const f = m.currentTarget.parentElement, M = f == null ? void 0 : f.parentElement;
|
|
660
|
+
if (!f || !M) return;
|
|
661
|
+
o.snapshotColumnWidths(M);
|
|
662
|
+
const X = m.shiftKey ? 32 : 8, I = m.key === "ArrowRight" ? X : -X;
|
|
663
|
+
o.setColumnWidth(
|
|
664
|
+
f.cellIndex,
|
|
665
|
+
f.getBoundingClientRect().width + I
|
|
523
666
|
);
|
|
524
667
|
};
|
|
525
|
-
return /* @__PURE__ */
|
|
668
|
+
return /* @__PURE__ */ $(
|
|
526
669
|
"th",
|
|
527
670
|
{
|
|
528
|
-
ref:
|
|
671
|
+
ref: A,
|
|
529
672
|
scope: "col",
|
|
530
|
-
"aria-sort":
|
|
531
|
-
className:
|
|
673
|
+
"aria-sort": D ? q === "ascending" ? "ascending" : "descending" : j ? "none" : void 0,
|
|
674
|
+
className: g(
|
|
532
675
|
// whitespace-nowrap: header labels hug their content — the table
|
|
533
676
|
// scrolls horizontally, so wrapping "Null %" to two lines only
|
|
534
677
|
// wastes header height without saving any width.
|
|
535
678
|
"relative whitespace-nowrap border-b border-table-stroke px-4 py-2.5 text-s font-medium text-table-header-foreground",
|
|
536
|
-
|
|
537
|
-
|
|
679
|
+
Ne,
|
|
680
|
+
Ce,
|
|
538
681
|
// The resize handle carries its own tick visual, so drop the
|
|
539
682
|
// decorative one; the last column never shows a handle.
|
|
540
|
-
|
|
683
|
+
u && "after:hidden [&:last-child>[data-slot=resize-handle]]:hidden",
|
|
541
684
|
// Capped-height tables scroll under the header: pin it to the
|
|
542
|
-
// viewport top, painted
|
|
543
|
-
(
|
|
544
|
-
|
|
545
|
-
|
|
685
|
+
// viewport top, painted like the table surface so rows pass beneath.
|
|
686
|
+
(o == null ? void 0 : o.stickyHeader) && "sticky top-0 z-30",
|
|
687
|
+
ge(e),
|
|
688
|
+
s && (s === "right" && (o != null && o.elevatedActionColumn) ? g(
|
|
546
689
|
// Preserve the semantic column width, but do not pin or paint
|
|
547
690
|
// a blank header cell over the labels behind it. Only body
|
|
548
691
|
// action cells participate in the sticky elevated surface.
|
|
@@ -551,57 +694,57 @@ const be = n.forwardRef(
|
|
|
551
694
|
"max-w-[var(--table-action-column-width)]",
|
|
552
695
|
"px-2",
|
|
553
696
|
"bg-transparent"
|
|
554
|
-
) :
|
|
555
|
-
|
|
697
|
+
) : ve(s)),
|
|
698
|
+
t
|
|
556
699
|
),
|
|
557
700
|
...v,
|
|
558
701
|
children: [
|
|
559
|
-
|
|
702
|
+
j ? /* @__PURE__ */ $(
|
|
560
703
|
"button",
|
|
561
704
|
{
|
|
562
705
|
type: "button",
|
|
563
|
-
onClick: () =>
|
|
564
|
-
className:
|
|
706
|
+
onClick: () => o.requestSort(E),
|
|
707
|
+
className: g(
|
|
565
708
|
"group/sort -mx-1 inline-flex items-center gap-1 rounded px-1 outline-none transition-colors",
|
|
566
709
|
"hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
567
710
|
e === "right" && "flex-row-reverse",
|
|
568
|
-
|
|
711
|
+
D && "font-medium"
|
|
569
712
|
),
|
|
570
713
|
children: [
|
|
571
|
-
|
|
572
|
-
|
|
714
|
+
b,
|
|
715
|
+
D ? q === "ascending" ? /* @__PURE__ */ d($e, { className: "size-3.5" }) : /* @__PURE__ */ d(Le, { className: "size-3.5" }) : /* @__PURE__ */ d(_e, { className: "size-3.5 opacity-0 transition-opacity group-hover/sort:opacity-60" })
|
|
573
716
|
]
|
|
574
717
|
}
|
|
575
|
-
) :
|
|
576
|
-
|
|
718
|
+
) : F ? b : /* @__PURE__ */ d("span", { className: "sr-only", children: v["aria-label"] ?? "Table column" }),
|
|
719
|
+
u && /* @__PURE__ */ d(
|
|
577
720
|
"span",
|
|
578
721
|
{
|
|
579
722
|
"data-slot": "resize-handle",
|
|
580
723
|
role: "separator",
|
|
581
724
|
"aria-orientation": "vertical",
|
|
582
|
-
"aria-label": `Resize ${
|
|
583
|
-
"aria-valuemin":
|
|
725
|
+
"aria-label": `Resize ${N || "this"} column`,
|
|
726
|
+
"aria-valuemin": le,
|
|
584
727
|
"aria-valuemax": 2e3,
|
|
585
|
-
"aria-valuenow": ((
|
|
728
|
+
"aria-valuenow": ((O = o == null ? void 0 : o.columnWidths) == null ? void 0 : O[c ?? -1]) ?? le,
|
|
586
729
|
tabIndex: 0,
|
|
587
730
|
"data-resizing": R ? "true" : void 0,
|
|
588
|
-
onPointerDown:
|
|
589
|
-
onPointerMove:
|
|
590
|
-
onPointerUp:
|
|
591
|
-
onPointerCancel:
|
|
592
|
-
onKeyDown:
|
|
593
|
-
onDoubleClick: () =>
|
|
594
|
-
className:
|
|
731
|
+
onPointerDown: T,
|
|
732
|
+
onPointerMove: J,
|
|
733
|
+
onPointerUp: W,
|
|
734
|
+
onPointerCancel: W,
|
|
735
|
+
onKeyDown: S,
|
|
736
|
+
onDoubleClick: () => o == null ? void 0 : o.resetColumnWidths(),
|
|
737
|
+
className: g(
|
|
595
738
|
// 12px hit area straddling the column edge; the 1px tick inside
|
|
596
739
|
// is the visible affordance (it replaces the decorative one).
|
|
597
740
|
"group/resize absolute -right-1.5 top-0 z-10 flex h-full w-3 cursor-col-resize touch-none select-none items-center justify-center rounded-sm outline-none",
|
|
598
741
|
"focus-visible:ring-2 focus-visible:ring-ring"
|
|
599
742
|
),
|
|
600
|
-
children: /* @__PURE__ */
|
|
743
|
+
children: /* @__PURE__ */ d(
|
|
601
744
|
"span",
|
|
602
745
|
{
|
|
603
746
|
"aria-hidden": "true",
|
|
604
|
-
className:
|
|
747
|
+
className: g(
|
|
605
748
|
"h-4 w-px rounded-sm bg-border-strong",
|
|
606
749
|
"transition-[transform,background-color] duration-150 ease-out motion-reduce:transition-none",
|
|
607
750
|
"group-hover/resize:scale-y-125 group-hover/resize:bg-foreground/60",
|
|
@@ -617,16 +760,21 @@ const be = n.forwardRef(
|
|
|
617
760
|
);
|
|
618
761
|
}
|
|
619
762
|
);
|
|
620
|
-
|
|
621
|
-
const
|
|
622
|
-
({ className:
|
|
623
|
-
const
|
|
624
|
-
return /* @__PURE__ */
|
|
763
|
+
pe.displayName = "TableColumn";
|
|
764
|
+
const Te = r.forwardRef(
|
|
765
|
+
({ className: t, align: e, sticky: s, sortValue: i, style: n, ...c }, b) => {
|
|
766
|
+
const v = te(), { interactive: A, selected: o } = r.useContext(ye), _ = s === "right" && (v == null ? void 0 : v.elevatedActionColumn);
|
|
767
|
+
return /* @__PURE__ */ d(
|
|
625
768
|
"td",
|
|
626
769
|
{
|
|
627
|
-
ref:
|
|
628
|
-
"data-sort-value":
|
|
629
|
-
|
|
770
|
+
ref: b,
|
|
771
|
+
"data-sort-value": i instanceof Date ? i.toISOString() : i,
|
|
772
|
+
style: A && o && s ? {
|
|
773
|
+
...ae,
|
|
774
|
+
backgroundPositionX: s,
|
|
775
|
+
...n
|
|
776
|
+
} : n,
|
|
777
|
+
className: g(
|
|
630
778
|
// whitespace-nowrap: cell content never wraps — the table's
|
|
631
779
|
// overflow-x-auto viewport scrolls horizontally instead, matching the
|
|
632
780
|
// header cells. Opt back into wrapping with `whitespace-normal` for
|
|
@@ -634,31 +782,30 @@ const Se = n.forwardRef(
|
|
|
634
782
|
// Cell values own the ADS 14px body-text contract instead of relying
|
|
635
783
|
// on inheritance from <Table>; nested content stays 14px by default.
|
|
636
784
|
"h-16 whitespace-nowrap px-4 py-2 text-m",
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
785
|
+
xe(A),
|
|
786
|
+
ge(e),
|
|
787
|
+
s && ve(s, v == null ? void 0 : v.elevatedActionColumn),
|
|
788
|
+
_ && g(
|
|
641
789
|
"w-[var(--table-action-column-width)]",
|
|
642
790
|
"min-w-[var(--table-action-column-width)]",
|
|
643
791
|
"max-w-[var(--table-action-column-width)]",
|
|
644
792
|
"px-2",
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
"group-hover/row:bg-elevated group-focus-within/row:bg-elevated"
|
|
793
|
+
// Pinned actions follow the same opaque row hover/selection fill.
|
|
794
|
+
"bg-elevated"
|
|
648
795
|
),
|
|
649
|
-
|
|
796
|
+
t
|
|
650
797
|
),
|
|
651
|
-
...
|
|
798
|
+
...c
|
|
652
799
|
}
|
|
653
800
|
);
|
|
654
801
|
}
|
|
655
802
|
);
|
|
656
|
-
|
|
803
|
+
Te.displayName = "TableCell";
|
|
657
804
|
export {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
805
|
+
de as Table,
|
|
806
|
+
Ee as TableBody,
|
|
807
|
+
Te as TableCell,
|
|
808
|
+
pe as TableColumn,
|
|
809
|
+
ue as TableHeader,
|
|
663
810
|
K as TableRow
|
|
664
811
|
};
|