@actioneer/ads 0.5.8 → 0.5.9
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/components/avatar.d.ts +1 -0
- package/components/avatar.js +5 -4
- package/components/breadcrumbs.d.ts +2 -0
- package/components/breadcrumbs.js +50 -48
- package/components/chart.d.ts +6 -0
- package/components/chart.js +737 -668
- package/components/drawer.d.ts +3 -1
- package/components/drawer.js +74 -72
- package/components/modal.d.ts +5 -1
- package/components/modal.js +74 -61
- package/components/pixel-icon.d.ts +4 -0
- package/components/pixel-icon.js +210 -163
- package/components/segmented.d.ts +1 -0
- package/components/segmented.js +31 -28
- package/components/select.d.ts +5 -0
- package/components/select.js +177 -132
- package/components/table.d.ts +7 -0
- package/components/table.js +183 -173
- package/demo/components/add-to-artifact.js +129 -107
- package/demo/lib/artifact-library.js +37 -29
- package/demo/lib/artifact-pin-guard.js +12 -0
- package/lib/icons.d.ts +20 -0
- package/lib/icons.js +112 -107
- package/llms.txt +1 -1
- package/manifest.json +20 -7
- package/package.json +1 -1
package/components/table.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as p, jsxs as T } from "react/jsx-runtime";
|
|
3
3
|
import * as o from "react";
|
|
4
4
|
import { cn as u } from "../lib/cn.js";
|
|
5
5
|
import { Checkbox as re } from "./checkbox.js";
|
|
6
|
-
import { ChevronUp as
|
|
6
|
+
import { ChevronUp as ge, ChevronDown as he, SortIcon as we } from "../lib/icons.js";
|
|
7
7
|
const ne = (e) => e === "center" ? "text-center" : e === "right" ? "text-right" : "text-left", ae = (e, t = !1) => e === "left" ? u(
|
|
8
8
|
"sticky left-0 z-10",
|
|
9
9
|
// Scroll-aware: the smudge only appears once content is actually
|
|
@@ -21,7 +21,7 @@ const ne = (e) => e === "center" ? "text-center" : e === "right" ? "text-right"
|
|
|
21
21
|
) : u(
|
|
22
22
|
"group-first/row:before:pointer-events-none group-first/row:before:absolute group-first/row:before:left-0 group-first/row:before:top-0 group-first/row:before:size-3 group-first/row:before:content-[''] group-first/row:before:[background:radial-gradient(circle_at_100%_100%,transparent_11.5px,var(--table-shell)_12px)]",
|
|
23
23
|
"group-last/row:after:pointer-events-none group-last/row:after:absolute group-last/row:after:left-0 group-last/row:after:bottom-0 group-last/row:after:size-3 group-last/row:after:content-[''] group-last/row:after:[background:radial-gradient(circle_at_100%_0%,transparent_11.5px,var(--table-shell)_12px)]"
|
|
24
|
-
),
|
|
24
|
+
), le = (e) => u(
|
|
25
25
|
"bg-card align-middle transition-colors",
|
|
26
26
|
// Row separators — functional hairline, none under the last row.
|
|
27
27
|
"border-b border-border group-last/row:border-b-0",
|
|
@@ -33,15 +33,15 @@ const ne = (e) => e === "center" ? "text-center" : e === "right" ? "text-right"
|
|
|
33
33
|
"group-hover/row:bg-(--table-row-hover) group-focus-within/row:bg-(--table-row-hover)",
|
|
34
34
|
"group-data-[selected]/row:bg-(--table-row-selected)"
|
|
35
35
|
)
|
|
36
|
-
),
|
|
36
|
+
), ve = u(
|
|
37
37
|
"group-first/row:rounded-tl-(--table-card-radius)",
|
|
38
38
|
"group-last/row:rounded-bl-(--table-card-radius)"
|
|
39
|
-
),
|
|
39
|
+
), ye = u(
|
|
40
40
|
"group-first/row:first:rounded-tl-(--table-card-radius)",
|
|
41
41
|
"group-first/row:last:rounded-tr-(--table-card-radius)",
|
|
42
42
|
"group-last/row:first:rounded-bl-(--table-card-radius)",
|
|
43
43
|
"group-last/row:last:rounded-br-(--table-card-radius)"
|
|
44
|
-
),
|
|
44
|
+
), ie = u(
|
|
45
45
|
"after:pointer-events-none after:absolute after:right-0 after:top-1/2",
|
|
46
46
|
"after:h-4 after:w-px after:-translate-y-1/2 after:rounded-sm",
|
|
47
47
|
"after:bg-border-strong last:after:hidden"
|
|
@@ -59,17 +59,17 @@ function V(e) {
|
|
|
59
59
|
t.push(a);
|
|
60
60
|
}), t;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function X(e) {
|
|
63
63
|
if (e == null || typeof e == "boolean")
|
|
64
64
|
return "";
|
|
65
65
|
if (typeof e == "number" || typeof e == "string") return e;
|
|
66
66
|
if (Array.isArray(e))
|
|
67
|
-
return e.map((n) => String(
|
|
67
|
+
return e.map((n) => String(X(n))).join(" ").trim();
|
|
68
68
|
if (!o.isValidElement(e)) return "";
|
|
69
69
|
const t = e.props.sortValue;
|
|
70
70
|
if (typeof t == "string" || typeof t == "number" || t instanceof Date)
|
|
71
71
|
return t;
|
|
72
|
-
const a =
|
|
72
|
+
const a = X(e.props.children);
|
|
73
73
|
if (String(a).trim()) return a;
|
|
74
74
|
for (const n of [
|
|
75
75
|
"value",
|
|
@@ -98,47 +98,47 @@ function oe(e) {
|
|
|
98
98
|
const s = /^\d{4}[-/]\d{1,2}[-/]\d{1,2}/.test(t) || /\b(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\b/i.test(t) ? Date.parse(t) : Number.NaN;
|
|
99
99
|
return Number.isNaN(s) ? { kind: "text", value: t } : { kind: "number", value: s };
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function Ce(e, t, a) {
|
|
102
102
|
const n = oe(e), s = oe(t);
|
|
103
103
|
if (n.kind === "empty") return s.kind === "empty" ? 0 : 1;
|
|
104
104
|
if (s.kind === "empty") return -1;
|
|
105
|
-
const
|
|
106
|
-
return a === "ascending" ?
|
|
105
|
+
const i = n.kind === "number" && s.kind === "number" ? n.value - s.value : xe.compare(String(n.value), String(s.value));
|
|
106
|
+
return a === "ascending" ? i : -i;
|
|
107
107
|
}
|
|
108
|
-
const ce = o.createContext(null),
|
|
109
|
-
function
|
|
110
|
-
const t = [], n = V(e.props.children).map((s,
|
|
108
|
+
const ce = o.createContext(null), j = () => o.useContext(ce), Q = o.createContext("body");
|
|
109
|
+
function Ne(e) {
|
|
110
|
+
const t = [], n = V(e.props.children).map((s, i) => {
|
|
111
111
|
if (!o.isValidElement(s) || s.type !== Y)
|
|
112
112
|
return s;
|
|
113
|
-
let
|
|
113
|
+
let l = 0;
|
|
114
114
|
const w = V(s.props.children).map((r) => {
|
|
115
115
|
if (!o.isValidElement(r)) return r;
|
|
116
|
-
for (; (t[
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
for (let C = 0; C <
|
|
116
|
+
for (; (t[l] ?? 0) > i; )
|
|
117
|
+
l += 1;
|
|
118
|
+
const E = Math.max(1, Number(r.props.colSpan ?? 1)), x = Math.max(1, Number(r.props.rowSpan ?? 1)), v = l;
|
|
119
|
+
for (let C = 0; C < E; C += 1)
|
|
120
120
|
t[v + C] = Math.max(
|
|
121
121
|
t[v + C] ?? 0,
|
|
122
|
-
|
|
122
|
+
i + x
|
|
123
123
|
);
|
|
124
|
-
return
|
|
124
|
+
return l += E, r.type !== fe ? r : o.cloneElement(r, { _sortColumnIndex: v });
|
|
125
125
|
});
|
|
126
126
|
return o.cloneElement(s, void 0, w);
|
|
127
127
|
});
|
|
128
128
|
return o.cloneElement(e, void 0, n);
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
const n = V(e.props.children).map((s,
|
|
130
|
+
function ze(e, t, a) {
|
|
131
|
+
const n = V(e.props.children).map((s, i) => {
|
|
132
132
|
if (!o.isValidElement(s) || s.type !== Y)
|
|
133
|
-
return { row: s, index:
|
|
134
|
-
const
|
|
133
|
+
return { row: s, index: i, value: "" };
|
|
134
|
+
const l = V(s.props.children);
|
|
135
135
|
return {
|
|
136
136
|
row: s,
|
|
137
|
-
index:
|
|
138
|
-
value:
|
|
137
|
+
index: i,
|
|
138
|
+
value: X(l[t])
|
|
139
139
|
};
|
|
140
140
|
});
|
|
141
|
-
return n.sort((s,
|
|
141
|
+
return n.sort((s, i) => Ce(s.value, i.value, a) || s.index - i.index), o.cloneElement(
|
|
142
142
|
e,
|
|
143
143
|
void 0,
|
|
144
144
|
n.map(({ row: s }) => s)
|
|
@@ -150,78 +150,79 @@ function ue(e, t) {
|
|
|
150
150
|
n,
|
|
151
151
|
void 0,
|
|
152
152
|
ue(n.props.children, t)
|
|
153
|
-
) : n.type === de ?
|
|
153
|
+
) : n.type === de ? Ne(n) : n.type === pe && t && Number.isInteger(a) && a >= 0 ? ze(n, a, t.direction) : n : n);
|
|
154
154
|
}
|
|
155
|
-
const
|
|
155
|
+
const Se = o.forwardRef(
|
|
156
156
|
({
|
|
157
157
|
className: e,
|
|
158
158
|
wrapperClassName: t,
|
|
159
159
|
footer: a,
|
|
160
160
|
children: n,
|
|
161
161
|
selectionMode: s = "none",
|
|
162
|
-
selectedKeys:
|
|
163
|
-
onSelectionChange:
|
|
162
|
+
selectedKeys: i,
|
|
163
|
+
onSelectionChange: l,
|
|
164
164
|
rowKeys: h,
|
|
165
165
|
elevatedActionColumn: w = !1,
|
|
166
166
|
actionColumnWidth: r = "4rem",
|
|
167
|
-
sortDescriptor:
|
|
168
|
-
onSortChange:
|
|
167
|
+
sortDescriptor: E,
|
|
168
|
+
onSortChange: x,
|
|
169
169
|
allowsSorting: v = !0,
|
|
170
170
|
isStatic: C = !1,
|
|
171
171
|
resizableColumns: A = !0,
|
|
172
|
+
maxBodyHeight: z,
|
|
172
173
|
...W
|
|
173
|
-
},
|
|
174
|
-
const N = o.useMemo(() => h ?? [], [h]),
|
|
175
|
-
(c) =>
|
|
176
|
-
[
|
|
177
|
-
),
|
|
174
|
+
}, O) => {
|
|
175
|
+
const N = o.useMemo(() => h ?? [], [h]), y = i === "all", b = y ? null : i ?? /* @__PURE__ */ new Set(), k = o.useCallback(
|
|
176
|
+
(c) => y || !!(b != null && b.has(c)),
|
|
177
|
+
[y, b]
|
|
178
|
+
), R = N.length > 0 && (y || N.every((c) => b == null ? void 0 : b.has(c))), $ = !R && (y || N.some((c) => b == null ? void 0 : b.has(c))), M = o.useCallback(
|
|
178
179
|
(c) => {
|
|
179
|
-
if (!
|
|
180
|
+
if (!l) return;
|
|
180
181
|
if (s === "single") {
|
|
181
|
-
|
|
182
|
+
l(k(c) ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([c]));
|
|
182
183
|
return;
|
|
183
184
|
}
|
|
184
|
-
const m = new Set(
|
|
185
|
-
m.has(c) ? m.delete(c) : m.add(c),
|
|
185
|
+
const m = new Set(y ? N : b ?? /* @__PURE__ */ new Set());
|
|
186
|
+
m.has(c) ? m.delete(c) : m.add(c), l(m);
|
|
186
187
|
},
|
|
187
|
-
[
|
|
188
|
-
),
|
|
189
|
-
|
|
190
|
-
}, [
|
|
188
|
+
[l, s, k, y, N, b]
|
|
189
|
+
), H = o.useCallback(() => {
|
|
190
|
+
l && l(R ? /* @__PURE__ */ new Set() : new Set(N));
|
|
191
|
+
}, [l, R, N]), [U, q] = o.useState(), S = v && !x, d = S ? U ?? E : E, f = o.useCallback(
|
|
191
192
|
(c) => {
|
|
192
193
|
if (!v) return;
|
|
193
|
-
const m = (
|
|
194
|
-
|
|
194
|
+
const m = (d == null ? void 0 : d.column) === c && d.direction === "ascending" ? "descending" : "ascending", g = { column: c, direction: m };
|
|
195
|
+
x ? x(g) : q(g);
|
|
195
196
|
},
|
|
196
|
-
[
|
|
197
|
-
),
|
|
198
|
-
() =>
|
|
199
|
-
[
|
|
200
|
-
),
|
|
197
|
+
[d, v, x]
|
|
198
|
+
), _ = o.useMemo(
|
|
199
|
+
() => S ? ue(n, d) : n,
|
|
200
|
+
[d, S, n]
|
|
201
|
+
), D = o.useRef(null), [I, me] = o.useState({
|
|
201
202
|
left: !1,
|
|
202
203
|
right: !1
|
|
203
|
-
}),
|
|
204
|
-
const c =
|
|
204
|
+
}), F = o.useCallback(() => {
|
|
205
|
+
const c = D.current;
|
|
205
206
|
if (!c) return;
|
|
206
207
|
const m = c.scrollWidth - c.clientWidth, g = c.scrollLeft > 1, L = c.scrollLeft < m - 1;
|
|
207
|
-
|
|
208
|
+
me(
|
|
208
209
|
(J) => J.left === g && J.right === L ? J : { left: g, right: L }
|
|
209
210
|
);
|
|
210
211
|
}, []);
|
|
211
212
|
o.useEffect(() => {
|
|
212
|
-
|
|
213
|
-
const c =
|
|
213
|
+
F();
|
|
214
|
+
const c = D.current;
|
|
214
215
|
if (!c || typeof ResizeObserver > "u") return;
|
|
215
|
-
const m = new ResizeObserver(
|
|
216
|
+
const m = new ResizeObserver(F);
|
|
216
217
|
m.observe(c);
|
|
217
218
|
const g = c.querySelector("table");
|
|
218
219
|
return g && m.observe(g), () => m.disconnect();
|
|
219
|
-
}, [
|
|
220
|
-
const [P,
|
|
220
|
+
}, [F]);
|
|
221
|
+
const [P, B] = o.useState(
|
|
221
222
|
null
|
|
222
223
|
), Z = o.useCallback(
|
|
223
224
|
(c) => {
|
|
224
|
-
|
|
225
|
+
B(
|
|
225
226
|
(m) => m ?? Array.from(
|
|
226
227
|
c.cells,
|
|
227
228
|
(g) => g.getBoundingClientRect().width
|
|
@@ -231,7 +232,7 @@ const ze = o.forwardRef(
|
|
|
231
232
|
[]
|
|
232
233
|
), ee = o.useCallback(
|
|
233
234
|
(c, m) => {
|
|
234
|
-
|
|
235
|
+
B((g) => {
|
|
235
236
|
if (!g) return g;
|
|
236
237
|
const L = [...g];
|
|
237
238
|
return L[c] = Math.max(G, m), L;
|
|
@@ -239,52 +240,54 @@ const ze = o.forwardRef(
|
|
|
239
240
|
},
|
|
240
241
|
[]
|
|
241
242
|
), te = o.useCallback(
|
|
242
|
-
() =>
|
|
243
|
+
() => B(null),
|
|
243
244
|
[]
|
|
244
|
-
),
|
|
245
|
+
), be = o.useMemo(
|
|
245
246
|
() => ({
|
|
246
247
|
selectionMode: s,
|
|
247
|
-
isSelected:
|
|
248
|
-
toggleKey:
|
|
249
|
-
toggleAll:
|
|
250
|
-
allSelected:
|
|
251
|
-
someSelected:
|
|
248
|
+
isSelected: k,
|
|
249
|
+
toggleKey: M,
|
|
250
|
+
toggleAll: H,
|
|
251
|
+
allSelected: R,
|
|
252
|
+
someSelected: $,
|
|
252
253
|
isStatic: C,
|
|
253
|
-
sortDescriptor:
|
|
254
|
+
sortDescriptor: d,
|
|
254
255
|
requestSort: v ? f : void 0,
|
|
255
|
-
automaticSorting:
|
|
256
|
+
automaticSorting: S,
|
|
256
257
|
elevatedActionColumn: w,
|
|
257
258
|
resizableColumns: A,
|
|
258
259
|
columnWidths: P,
|
|
259
260
|
snapshotColumnWidths: Z,
|
|
260
261
|
setColumnWidth: ee,
|
|
261
|
-
resetColumnWidths: te
|
|
262
|
+
resetColumnWidths: te,
|
|
263
|
+
stickyHeader: z != null
|
|
262
264
|
}),
|
|
263
265
|
[
|
|
264
266
|
s,
|
|
265
|
-
E,
|
|
266
|
-
O,
|
|
267
|
-
I,
|
|
268
267
|
k,
|
|
269
|
-
|
|
268
|
+
M,
|
|
269
|
+
H,
|
|
270
|
+
R,
|
|
271
|
+
$,
|
|
270
272
|
C,
|
|
271
|
-
|
|
273
|
+
d,
|
|
272
274
|
v,
|
|
273
|
-
|
|
275
|
+
S,
|
|
274
276
|
f,
|
|
275
277
|
w,
|
|
276
278
|
A,
|
|
277
279
|
P,
|
|
278
280
|
Z,
|
|
279
281
|
ee,
|
|
280
|
-
te
|
|
282
|
+
te,
|
|
283
|
+
z
|
|
281
284
|
]
|
|
282
285
|
);
|
|
283
|
-
return /* @__PURE__ */
|
|
286
|
+
return /* @__PURE__ */ p(ce.Provider, { value: be, children: /* @__PURE__ */ T(
|
|
284
287
|
"div",
|
|
285
288
|
{
|
|
286
|
-
"data-scroll-left":
|
|
287
|
-
"data-scroll-right":
|
|
289
|
+
"data-scroll-left": I.left ? "true" : "false",
|
|
290
|
+
"data-scroll-right": I.right ? "true" : "false",
|
|
288
291
|
className: u(
|
|
289
292
|
"group/table-shell overflow-clip rounded-2xl bg-table-shell px-1 pb-1",
|
|
290
293
|
// Concentric inner radius for the white body card: shell radius
|
|
@@ -294,7 +297,7 @@ const ze = o.forwardRef(
|
|
|
294
297
|
t
|
|
295
298
|
),
|
|
296
299
|
children: [
|
|
297
|
-
/* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ T(
|
|
298
301
|
"div",
|
|
299
302
|
{
|
|
300
303
|
className: "relative",
|
|
@@ -302,16 +305,20 @@ const ze = o.forwardRef(
|
|
|
302
305
|
"--table-action-column-width": r
|
|
303
306
|
} : void 0,
|
|
304
307
|
children: [
|
|
305
|
-
/* @__PURE__ */
|
|
308
|
+
/* @__PURE__ */ p(
|
|
306
309
|
"div",
|
|
307
310
|
{
|
|
308
|
-
ref:
|
|
309
|
-
onScroll:
|
|
310
|
-
className:
|
|
311
|
-
|
|
311
|
+
ref: D,
|
|
312
|
+
onScroll: F,
|
|
313
|
+
className: u(
|
|
314
|
+
"overflow-x-auto rounded-(--table-card-radius)",
|
|
315
|
+
z != null && "overflow-y-auto"
|
|
316
|
+
),
|
|
317
|
+
style: z != null ? { maxHeight: z } : void 0,
|
|
318
|
+
children: /* @__PURE__ */ T(
|
|
312
319
|
"table",
|
|
313
320
|
{
|
|
314
|
-
ref:
|
|
321
|
+
ref: O,
|
|
315
322
|
"data-slot": "table",
|
|
316
323
|
className: u(
|
|
317
324
|
"w-full border-separate border-spacing-0 text-base",
|
|
@@ -322,14 +329,14 @@ const ze = o.forwardRef(
|
|
|
322
329
|
),
|
|
323
330
|
...W,
|
|
324
331
|
children: [
|
|
325
|
-
P && /* @__PURE__ */
|
|
326
|
-
|
|
332
|
+
P && /* @__PURE__ */ p("colgroup", { children: P.map((c, m) => /* @__PURE__ */ p("col", { style: { width: c } }, m)) }),
|
|
333
|
+
_
|
|
327
334
|
]
|
|
328
335
|
}
|
|
329
336
|
)
|
|
330
337
|
}
|
|
331
338
|
),
|
|
332
|
-
/* @__PURE__ */
|
|
339
|
+
/* @__PURE__ */ p(
|
|
333
340
|
"div",
|
|
334
341
|
{
|
|
335
342
|
"aria-hidden": "true",
|
|
@@ -338,12 +345,12 @@ const ze = o.forwardRef(
|
|
|
338
345
|
"pointer-events-none absolute inset-y-0 z-20 w-10",
|
|
339
346
|
"bg-gradient-to-l from-(--table-scroll-hint) to-transparent",
|
|
340
347
|
"opacity-0 transition-opacity duration-150 ease-out motion-reduce:transition-none",
|
|
341
|
-
|
|
348
|
+
I.right && "opacity-100",
|
|
342
349
|
w ? "right-[var(--table-action-column-width)]" : "right-0"
|
|
343
350
|
)
|
|
344
351
|
}
|
|
345
352
|
),
|
|
346
|
-
w && /* @__PURE__ */
|
|
353
|
+
w && /* @__PURE__ */ p(
|
|
347
354
|
"div",
|
|
348
355
|
{
|
|
349
356
|
"aria-hidden": "true",
|
|
@@ -362,16 +369,16 @@ const ze = o.forwardRef(
|
|
|
362
369
|
]
|
|
363
370
|
}
|
|
364
371
|
),
|
|
365
|
-
a && /* @__PURE__ */
|
|
372
|
+
a && /* @__PURE__ */ p("div", { className: "flex items-center px-4 py-2.5", children: a })
|
|
366
373
|
]
|
|
367
374
|
}
|
|
368
375
|
) });
|
|
369
376
|
}
|
|
370
377
|
);
|
|
371
|
-
|
|
378
|
+
Se.displayName = "Table";
|
|
372
379
|
const de = o.forwardRef(({ className: e, ...t }, a) => {
|
|
373
|
-
const n =
|
|
374
|
-
return /* @__PURE__ */
|
|
380
|
+
const n = j();
|
|
381
|
+
return /* @__PURE__ */ p(Q.Provider, { value: "header", children: /* @__PURE__ */ p(
|
|
375
382
|
"thead",
|
|
376
383
|
{
|
|
377
384
|
ref: a,
|
|
@@ -385,12 +392,12 @@ const de = o.forwardRef(({ className: e, ...t }, a) => {
|
|
|
385
392
|
) });
|
|
386
393
|
});
|
|
387
394
|
de.displayName = "TableHeader";
|
|
388
|
-
const pe = o.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */
|
|
395
|
+
const pe = o.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */ p(Q.Provider, { value: "body", children: /* @__PURE__ */ p("tbody", { ref: a, className: u(e), ...t }) }));
|
|
389
396
|
pe.displayName = "TableBody";
|
|
390
397
|
const Y = o.forwardRef(
|
|
391
398
|
({ className: e, rowKey: t, children: a, ...n }, s) => {
|
|
392
|
-
const
|
|
393
|
-
return /* @__PURE__ */
|
|
399
|
+
const i = j(), l = o.useContext(Q), h = !!i && i.selectionMode !== "none", w = h && l === "body" && t !== void 0 ? i.isSelected(t) : !1;
|
|
400
|
+
return /* @__PURE__ */ T(
|
|
394
401
|
"tr",
|
|
395
402
|
{
|
|
396
403
|
ref: s,
|
|
@@ -398,13 +405,13 @@ const Y = o.forwardRef(
|
|
|
398
405
|
className: u("group/row", e),
|
|
399
406
|
...n,
|
|
400
407
|
children: [
|
|
401
|
-
h && (
|
|
408
|
+
h && (l === "header" ? /* @__PURE__ */ T(
|
|
402
409
|
"th",
|
|
403
410
|
{
|
|
404
411
|
scope: "col",
|
|
405
412
|
className: u(
|
|
406
413
|
"w-10 px-4 py-2.5",
|
|
407
|
-
|
|
414
|
+
ie,
|
|
408
415
|
// Sticky without the baked shadow — an always-on smudge
|
|
409
416
|
// muddies the shell's corners (elevation = actionability).
|
|
410
417
|
// (sticky is positioned, so the ::after tick anchors to it —
|
|
@@ -412,38 +419,38 @@ const Y = o.forwardRef(
|
|
|
412
419
|
"sticky left-0 z-10 bg-table-shell"
|
|
413
420
|
),
|
|
414
421
|
children: [
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
|
|
422
|
+
/* @__PURE__ */ p("span", { className: "sr-only", children: "Row selection" }),
|
|
423
|
+
i.selectionMode === "multiple" && /* @__PURE__ */ p(
|
|
417
424
|
re,
|
|
418
425
|
{
|
|
419
426
|
size: "sm",
|
|
420
427
|
"aria-label": "Select all rows",
|
|
421
|
-
checked:
|
|
422
|
-
indeterminate:
|
|
423
|
-
onChange:
|
|
428
|
+
checked: i.allSelected,
|
|
429
|
+
indeterminate: i.someSelected,
|
|
430
|
+
onChange: i.toggleAll
|
|
424
431
|
}
|
|
425
432
|
)
|
|
426
433
|
]
|
|
427
434
|
}
|
|
428
|
-
) : /* @__PURE__ */
|
|
435
|
+
) : /* @__PURE__ */ p(
|
|
429
436
|
"td",
|
|
430
437
|
{
|
|
431
438
|
className: u(
|
|
432
439
|
"w-10 px-4 py-3",
|
|
433
|
-
|
|
434
|
-
|
|
440
|
+
le(i.isStatic),
|
|
441
|
+
ve,
|
|
435
442
|
"sticky left-0 z-10",
|
|
436
443
|
// Same white-behind-white corner problem as pinned data cells.
|
|
437
444
|
se("left")
|
|
438
445
|
),
|
|
439
446
|
onClick: (r) => r.stopPropagation(),
|
|
440
|
-
children: t !== void 0 && /* @__PURE__ */
|
|
447
|
+
children: t !== void 0 && /* @__PURE__ */ p(
|
|
441
448
|
re,
|
|
442
449
|
{
|
|
443
450
|
size: "sm",
|
|
444
451
|
"aria-label": `Select ${t}`,
|
|
445
452
|
checked: w,
|
|
446
|
-
onChange: () =>
|
|
453
|
+
onChange: () => i.toggleKey(t)
|
|
447
454
|
}
|
|
448
455
|
)
|
|
449
456
|
}
|
|
@@ -455,55 +462,58 @@ const Y = o.forwardRef(
|
|
|
455
462
|
}
|
|
456
463
|
);
|
|
457
464
|
Y.displayName = "TableRow";
|
|
458
|
-
const fe = o.forwardRef(({ className: e, align: t, sticky: a, sortKey: n, allowsSorting: s = !0, _sortColumnIndex:
|
|
459
|
-
var
|
|
460
|
-
const r =
|
|
461
|
-
if (
|
|
462
|
-
const
|
|
463
|
-
if (!(!
|
|
464
|
-
r.snapshotColumnWidths(
|
|
465
|
-
index:
|
|
466
|
-
startX:
|
|
467
|
-
startWidth:
|
|
465
|
+
const fe = o.forwardRef(({ className: e, align: t, sticky: a, sortKey: n, allowsSorting: s = !0, _sortColumnIndex: i, children: l, ...h }, w) => {
|
|
466
|
+
var U, q, S;
|
|
467
|
+
const r = j(), x = (r != null && r.automaticSorting && i !== void 0 ? `${K}${i}` : void 0) ?? n, v = Number(h.colSpan ?? 1) === 1, C = String(X(l)).trim(), A = C.length > 0, z = s && v && a !== "right" && A && !!x && !!(r != null && r.requestSort), W = z && ((U = r == null ? void 0 : r.sortDescriptor) == null ? void 0 : U.column) === x, O = (q = r == null ? void 0 : r.sortDescriptor) == null ? void 0 : q.direction, N = !!(r != null && r.resizableColumns) && v && a !== "right", y = o.useRef(null), [b, k] = o.useState(!1), R = (d) => {
|
|
468
|
+
if (d.button !== 0 || !r) return;
|
|
469
|
+
const f = d.currentTarget.parentElement, _ = f == null ? void 0 : f.parentElement;
|
|
470
|
+
if (!(!f || !_)) {
|
|
471
|
+
r.snapshotColumnWidths(_), y.current = {
|
|
472
|
+
index: f.cellIndex,
|
|
473
|
+
startX: d.clientX,
|
|
474
|
+
startWidth: f.getBoundingClientRect().width
|
|
468
475
|
}, k(!0);
|
|
469
476
|
try {
|
|
470
|
-
|
|
477
|
+
d.currentTarget.setPointerCapture(d.pointerId);
|
|
471
478
|
} catch {
|
|
472
479
|
}
|
|
473
|
-
|
|
480
|
+
d.preventDefault();
|
|
474
481
|
}
|
|
475
|
-
},
|
|
476
|
-
const
|
|
477
|
-
!
|
|
478
|
-
|
|
479
|
-
|
|
482
|
+
}, $ = (d) => {
|
|
483
|
+
const f = y.current;
|
|
484
|
+
!f || !r || r.setColumnWidth(
|
|
485
|
+
f.index,
|
|
486
|
+
f.startWidth + (d.clientX - f.startX)
|
|
480
487
|
);
|
|
481
|
-
},
|
|
482
|
-
|
|
483
|
-
},
|
|
484
|
-
if (
|
|
485
|
-
|
|
486
|
-
const
|
|
487
|
-
if (!
|
|
488
|
-
r.snapshotColumnWidths(
|
|
489
|
-
const D =
|
|
490
|
-
r.setColumnWidth(
|
|
488
|
+
}, M = () => {
|
|
489
|
+
y.current = null, k(!1);
|
|
490
|
+
}, H = (d) => {
|
|
491
|
+
if (d.key !== "ArrowLeft" && d.key !== "ArrowRight" || !r) return;
|
|
492
|
+
d.preventDefault();
|
|
493
|
+
const f = d.currentTarget.parentElement, _ = f == null ? void 0 : f.parentElement;
|
|
494
|
+
if (!f || !_) return;
|
|
495
|
+
r.snapshotColumnWidths(_);
|
|
496
|
+
const D = d.shiftKey ? 32 : 8, I = d.key === "ArrowRight" ? D : -D;
|
|
497
|
+
r.setColumnWidth(f.cellIndex, f.getBoundingClientRect().width + I);
|
|
491
498
|
};
|
|
492
|
-
return /* @__PURE__ */
|
|
499
|
+
return /* @__PURE__ */ T(
|
|
493
500
|
"th",
|
|
494
501
|
{
|
|
495
502
|
ref: w,
|
|
496
503
|
scope: "col",
|
|
497
|
-
"aria-sort":
|
|
504
|
+
"aria-sort": W ? O === "ascending" ? "ascending" : "descending" : z ? "none" : void 0,
|
|
498
505
|
className: u(
|
|
499
506
|
// whitespace-nowrap: header labels hug their content — the table
|
|
500
507
|
// scrolls horizontally, so wrapping "Null %" to two lines only
|
|
501
508
|
// wastes header height without saving any width.
|
|
502
509
|
"relative whitespace-nowrap px-4 py-2.5 font-normal",
|
|
503
|
-
|
|
510
|
+
ie,
|
|
504
511
|
// The resize handle carries its own tick visual, so drop the
|
|
505
512
|
// decorative one; the last column never shows a handle.
|
|
506
|
-
|
|
513
|
+
N && "after:hidden [&:last-child>[data-slot=resize-handle]]:hidden",
|
|
514
|
+
// Capped-height tables scroll under the header: pin it to the
|
|
515
|
+
// viewport top, painted on the shell gray so rows pass beneath.
|
|
516
|
+
(r == null ? void 0 : r.stickyHeader) && "sticky top-0 z-30 bg-table-shell",
|
|
507
517
|
ne(t),
|
|
508
518
|
a && (a === "right" && (r != null && r.elevatedActionColumn) ? u(
|
|
509
519
|
// Preserve the semantic column width, but do not pin or paint
|
|
@@ -518,24 +528,24 @@ const fe = o.forwardRef(({ className: e, align: t, sticky: a, sortKey: n, allows
|
|
|
518
528
|
),
|
|
519
529
|
...h,
|
|
520
530
|
children: [
|
|
521
|
-
|
|
531
|
+
z ? /* @__PURE__ */ T(
|
|
522
532
|
"button",
|
|
523
533
|
{
|
|
524
534
|
type: "button",
|
|
525
|
-
onClick: () => r.requestSort(
|
|
535
|
+
onClick: () => r.requestSort(x),
|
|
526
536
|
className: u(
|
|
527
537
|
"group/sort -mx-1 inline-flex items-center gap-1 rounded px-1 outline-none transition-colors",
|
|
528
538
|
"hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
529
539
|
t === "right" && "flex-row-reverse",
|
|
530
|
-
|
|
540
|
+
W && "text-foreground"
|
|
531
541
|
),
|
|
532
542
|
children: [
|
|
533
|
-
|
|
534
|
-
|
|
543
|
+
l,
|
|
544
|
+
W ? O === "ascending" ? /* @__PURE__ */ p(ge, { className: "size-3.5" }) : /* @__PURE__ */ p(he, { className: "size-3.5" }) : /* @__PURE__ */ p(we, { className: "size-3.5 opacity-0 transition-opacity group-hover/sort:opacity-60" })
|
|
535
545
|
]
|
|
536
546
|
}
|
|
537
|
-
) : A ?
|
|
538
|
-
|
|
547
|
+
) : A ? l : /* @__PURE__ */ p("span", { className: "sr-only", children: h["aria-label"] ?? "Table column" }),
|
|
548
|
+
N && /* @__PURE__ */ p(
|
|
539
549
|
"span",
|
|
540
550
|
{
|
|
541
551
|
"data-slot": "resize-handle",
|
|
@@ -544,14 +554,14 @@ const fe = o.forwardRef(({ className: e, align: t, sticky: a, sortKey: n, allows
|
|
|
544
554
|
"aria-label": `Resize ${C || "this"} column`,
|
|
545
555
|
"aria-valuemin": G,
|
|
546
556
|
"aria-valuemax": 2e3,
|
|
547
|
-
"aria-valuenow": ((
|
|
557
|
+
"aria-valuenow": ((S = r == null ? void 0 : r.columnWidths) == null ? void 0 : S[i ?? -1]) ?? G,
|
|
548
558
|
tabIndex: 0,
|
|
549
|
-
"data-resizing":
|
|
550
|
-
onPointerDown:
|
|
551
|
-
onPointerMove:
|
|
552
|
-
onPointerUp:
|
|
553
|
-
onPointerCancel:
|
|
554
|
-
onKeyDown:
|
|
559
|
+
"data-resizing": b ? "true" : void 0,
|
|
560
|
+
onPointerDown: R,
|
|
561
|
+
onPointerMove: $,
|
|
562
|
+
onPointerUp: M,
|
|
563
|
+
onPointerCancel: M,
|
|
564
|
+
onKeyDown: H,
|
|
555
565
|
onDoubleClick: () => r == null ? void 0 : r.resetColumnWidths(),
|
|
556
566
|
className: u(
|
|
557
567
|
// 12px hit area straddling the column edge; the 1px tick inside
|
|
@@ -559,7 +569,7 @@ const fe = o.forwardRef(({ className: e, align: t, sticky: a, sortKey: n, allows
|
|
|
559
569
|
"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",
|
|
560
570
|
"focus-visible:ring-2 focus-visible:ring-ring"
|
|
561
571
|
),
|
|
562
|
-
children: /* @__PURE__ */
|
|
572
|
+
children: /* @__PURE__ */ p(
|
|
563
573
|
"span",
|
|
564
574
|
{
|
|
565
575
|
"aria-hidden": "true",
|
|
@@ -579,13 +589,13 @@ const fe = o.forwardRef(({ className: e, align: t, sticky: a, sortKey: n, allows
|
|
|
579
589
|
);
|
|
580
590
|
});
|
|
581
591
|
fe.displayName = "TableColumn";
|
|
582
|
-
const
|
|
583
|
-
({ className: e, align: t, sticky: a, sortValue: n, ...s },
|
|
584
|
-
const
|
|
585
|
-
return /* @__PURE__ */
|
|
592
|
+
const ke = o.forwardRef(
|
|
593
|
+
({ className: e, align: t, sticky: a, sortValue: n, ...s }, i) => {
|
|
594
|
+
const l = j(), h = a === "right" && (l == null ? void 0 : l.elevatedActionColumn);
|
|
595
|
+
return /* @__PURE__ */ p(
|
|
586
596
|
"td",
|
|
587
597
|
{
|
|
588
|
-
ref:
|
|
598
|
+
ref: i,
|
|
589
599
|
"data-sort-value": n instanceof Date ? n.toISOString() : n,
|
|
590
600
|
className: u(
|
|
591
601
|
// whitespace-nowrap: cell content never wraps — the table's
|
|
@@ -593,10 +603,10 @@ const Se = o.forwardRef(
|
|
|
593
603
|
// header cells. Opt back into wrapping with `whitespace-normal` for
|
|
594
604
|
// deliberate multi-line content (e.g. an EmptyState in a colSpan cell).
|
|
595
605
|
"whitespace-nowrap px-4 py-3",
|
|
596
|
-
|
|
597
|
-
|
|
606
|
+
le((l == null ? void 0 : l.isStatic) ?? !1),
|
|
607
|
+
ye,
|
|
598
608
|
ne(t),
|
|
599
|
-
a && ae(a,
|
|
609
|
+
a && ae(a, l == null ? void 0 : l.elevatedActionColumn),
|
|
600
610
|
a && se(a),
|
|
601
611
|
h && u(
|
|
602
612
|
"w-[var(--table-action-column-width)]",
|
|
@@ -612,11 +622,11 @@ const Se = o.forwardRef(
|
|
|
612
622
|
);
|
|
613
623
|
}
|
|
614
624
|
);
|
|
615
|
-
|
|
625
|
+
ke.displayName = "TableCell";
|
|
616
626
|
export {
|
|
617
|
-
|
|
627
|
+
Se as Table,
|
|
618
628
|
pe as TableBody,
|
|
619
|
-
|
|
629
|
+
ke as TableCell,
|
|
620
630
|
fe as TableColumn,
|
|
621
631
|
de as TableHeader,
|
|
622
632
|
Y as TableRow
|