@actioneer/ads 0.5.9 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ai-elements/agent-trace.d.ts +2 -2
- package/components/ai-elements/agent-trace.js +163 -104
- package/components/ai-elements/chain-of-thought.d.ts +2 -2
- package/components/ai-elements/chain-of-thought.js +1 -1
- package/components/ai-elements/index.d.ts +0 -5
- package/components/ai-elements/inline-citation.js +1 -1
- package/components/alert.d.ts +6 -6
- package/components/alert.js +89 -53
- package/components/answer-sources.d.ts +2 -6
- package/components/answer-sources.js +58 -60
- package/components/answer.d.ts +5 -0
- package/components/answer.js +311 -271
- package/components/assistant-ui/composer-harness.js +11 -14
- package/components/assistant-ui/composer.d.ts +3 -1
- package/components/assistant-ui/composer.js +148 -144
- package/components/assistant-ui/index.d.ts +0 -3
- package/components/assistant-ui/thread-context.d.ts +3 -1
- package/components/assistant-ui/thread.js +50 -42
- package/components/avatar.js +42 -42
- package/components/badge.d.ts +5 -6
- package/components/badge.js +13 -76
- package/components/body-page-header.d.ts +15 -0
- package/components/body-page-header.js +24 -0
- package/components/brand-loader.d.ts +0 -3
- package/components/brand-loader.js +10 -32
- package/components/breadcrumbs.d.ts +1 -8
- package/components/breadcrumbs.js +65 -78
- package/components/button.d.ts +1 -1
- package/components/button.js +55 -49
- package/components/card.js +19 -18
- package/components/chart.js +526 -503
- package/components/chip.d.ts +13 -1
- package/components/chip.js +93 -80
- package/components/collection-header.d.ts +17 -0
- package/components/collection-header.js +31 -0
- package/components/connector-card.d.ts +6 -6
- package/components/connector-card.js +31 -32
- package/components/date-range-picker.d.ts +26 -0
- package/components/date-range-picker.js +223 -0
- package/components/drawer.d.ts +19 -3
- package/components/drawer.js +143 -116
- package/components/dropdown.d.ts +1 -2
- package/components/dropdown.js +88 -89
- package/components/field.js +39 -34
- package/components/file-dropzone.js +1 -1
- package/components/index.d.ts +5 -4
- package/components/index.js +501 -546
- package/components/infinite-canvas.js +24 -24
- package/components/input-field.d.ts +18 -3
- package/components/input-field.js +88 -72
- package/components/input.js +16 -15
- package/components/modal.d.ts +31 -3
- package/components/modal.js +243 -169
- package/components/number-field.js +45 -42
- package/components/page-body.d.ts +12 -0
- package/components/page-body.js +18 -0
- package/components/pagination.js +36 -36
- package/components/panel.js +31 -28
- package/components/select.d.ts +21 -0
- package/components/select.js +189 -148
- package/components/setting-row.d.ts +6 -5
- package/components/setting-row.js +33 -32
- package/components/sidebar.d.ts +2 -0
- package/components/sidebar.js +165 -155
- package/components/skeleton.js +8 -7
- package/components/slider.js +1 -1
- package/components/surface-loader.d.ts +11 -0
- package/components/surface-loader.js +35 -0
- package/components/table.d.ts +16 -10
- package/components/table.js +426 -410
- package/components/tabs.d.ts +2 -0
- package/components/tabs.js +159 -294
- package/components/textarea.js +9 -9
- package/components/toast.d.ts +1 -1
- package/components/toast.js +181 -118
- package/components/tree.d.ts +5 -1
- package/components/tree.js +96 -63
- package/components/typography.d.ts +4 -4
- package/components/typography.js +13 -13
- package/components/ui/button.d.ts +1 -1
- package/components/ui/dialog.js +33 -33
- package/components/viz-charts.js +186 -183
- package/demo/components/add-to-artifact.js +8 -10
- package/fonts.css +2 -0
- package/lib/cn.js +11 -4
- package/lib/icons.d.ts +4 -0
- package/lib/icons.js +107 -106
- package/lib/interactive.d.ts +1 -1
- package/llms.txt +115 -152
- package/manifest.json +13730 -1084
- package/package.json +4 -2
- package/styles.css +365 -225
- package/theme.css +315 -176
- package/components/agent-icon.d.ts +0 -76
- package/components/agent-icon.js +0 -265
- package/components/ai-elements/queue.d.ts +0 -60
- package/components/ai-elements/queue.js +0 -193
- package/components/ai-elements/speech-input.d.ts +0 -16
- package/components/ai-elements/speech-input.js +0 -151
- package/components/ai-elements/task-progress.d.ts +0 -41
- package/components/ai-elements/task-progress.js +0 -224
- package/components/ai-elements/task.d.ts +0 -39
- package/components/ai-elements/task.js +0 -105
- package/components/ai-elements/voice.d.ts +0 -90
- package/components/ai-elements/voice.js +0 -496
- package/components/assistant-ui/follow-up-suggestions.d.ts +0 -11
- package/components/assistant-ui/follow-up-suggestions.js +0 -72
- package/components/assistant-ui/suggestions.d.ts +0 -7
- package/components/assistant-ui/suggestions.js +0 -19
- package/components/assistant-ui/voice.d.ts +0 -18
- package/components/link.d.ts +0 -14
- package/components/link.js +0 -72
- package/components/navbar.d.ts +0 -15
- package/components/navbar.js +0 -68
- package/components/pixel-icon.d.ts +0 -37
- package/components/pixel-icon.js +0 -859
package/components/table.js
CHANGED
|
@@ -1,77 +1,64 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import * as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Checkbox as
|
|
6
|
-
import { ChevronUp as
|
|
7
|
-
const
|
|
2
|
+
import { jsx as d, jsxs as T } from "react/jsx-runtime";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
import { cn as m } from "../lib/cn.js";
|
|
5
|
+
import { Checkbox as ne } from "./checkbox.js";
|
|
6
|
+
import { ChevronUp as ve, ChevronDown as we, SortIcon as ye } from "../lib/icons.js";
|
|
7
|
+
const se = (r) => r === "center" ? "text-center" : r === "right" ? "text-right" : "text-left", ae = (r, t = !1) => r === "left" ? m(
|
|
8
8
|
"sticky left-0 z-10",
|
|
9
9
|
// Scroll-aware: the smudge only appears once content is actually
|
|
10
10
|
// hidden behind the pinned column (nothing to scroll back to at the
|
|
11
11
|
// far left → no shadow).
|
|
12
12
|
"group-data-[scroll-left=true]/table-shell:shadow-table-smudge-left"
|
|
13
|
-
) :
|
|
13
|
+
) : r === "right" ? m(
|
|
14
14
|
"sticky right-0 z-10",
|
|
15
15
|
// Backward-compatible fallback. Action columns should opt into the
|
|
16
16
|
// Table-level elevation so one shadow spans the complete column.
|
|
17
17
|
!t && "group-data-[scroll-right=true]/table-shell:shadow-table-smudge-right"
|
|
18
|
-
) : void 0,
|
|
19
|
-
"group-first/row:before:pointer-events-none group-first/row:before:absolute group-first/row:before:right-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_0%_100%,transparent_11.5px,var(--table-shell)_12px)]",
|
|
20
|
-
"group-last/row:after:pointer-events-none group-last/row:after:absolute group-last/row:after:right-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_0%_0%,transparent_11.5px,var(--table-shell)_12px)]"
|
|
21
|
-
) : u(
|
|
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
|
-
"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
|
-
), le = (e) => u(
|
|
18
|
+
) : void 0, ie = n.createContext(!1), le = (r) => m(
|
|
25
19
|
"bg-card align-middle transition-colors",
|
|
26
|
-
//
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
// The header is the first NG1 band, so the first body row stays white.
|
|
21
|
+
"group-even/row:bg-ng1",
|
|
22
|
+
// Functional row hairline; the table shell carries the outer stroke.
|
|
23
|
+
"border-b border-table-stroke group-last/row:border-b-0",
|
|
24
|
+
r && m(
|
|
25
|
+
// Use NG2 without introducing a new
|
|
31
26
|
// rounded silhouette. The wash is pre-composited so scrolled text
|
|
32
27
|
// cannot show through sticky cells.
|
|
33
28
|
"group-hover/row:bg-(--table-row-hover) group-focus-within/row:bg-(--table-row-hover)",
|
|
34
29
|
"group-data-[selected]/row:bg-(--table-row-selected)"
|
|
35
30
|
)
|
|
36
|
-
),
|
|
37
|
-
"group-first/row:rounded-tl-(--table-card-radius)",
|
|
38
|
-
"group-last/row:rounded-bl-(--table-card-radius)"
|
|
39
|
-
), ye = u(
|
|
40
|
-
"group-first/row:first:rounded-tl-(--table-card-radius)",
|
|
41
|
-
"group-first/row:last:rounded-tr-(--table-card-radius)",
|
|
42
|
-
"group-last/row:first:rounded-bl-(--table-card-radius)",
|
|
43
|
-
"group-last/row:last:rounded-br-(--table-card-radius)"
|
|
44
|
-
), ie = u(
|
|
31
|
+
), ce = "bg-ng1", ue = m(
|
|
45
32
|
"after:pointer-events-none after:absolute after:right-0 after:top-1/2",
|
|
46
33
|
"after:h-4 after:w-px after:-translate-y-1/2 after:rounded-sm",
|
|
47
34
|
"after:bg-border-strong last:after:hidden"
|
|
48
|
-
),
|
|
35
|
+
), G = "__ads_table_column_", Q = 64, xe = new Intl.Collator(void 0, {
|
|
49
36
|
numeric: !0,
|
|
50
37
|
sensitivity: "base"
|
|
51
38
|
});
|
|
52
|
-
function V(
|
|
39
|
+
function V(r) {
|
|
53
40
|
const t = [];
|
|
54
|
-
return
|
|
55
|
-
if (
|
|
41
|
+
return n.Children.forEach(r, (a) => {
|
|
42
|
+
if (n.isValidElement(a) && a.type === n.Fragment) {
|
|
56
43
|
t.push(...V(a.props.children));
|
|
57
44
|
return;
|
|
58
45
|
}
|
|
59
46
|
t.push(a);
|
|
60
47
|
}), t;
|
|
61
48
|
}
|
|
62
|
-
function X(
|
|
63
|
-
if (
|
|
49
|
+
function X(r) {
|
|
50
|
+
if (r == null || typeof r == "boolean")
|
|
64
51
|
return "";
|
|
65
|
-
if (typeof
|
|
66
|
-
if (Array.isArray(
|
|
67
|
-
return
|
|
68
|
-
if (!
|
|
69
|
-
const t =
|
|
52
|
+
if (typeof r == "number" || typeof r == "string") return r;
|
|
53
|
+
if (Array.isArray(r))
|
|
54
|
+
return r.map((o) => String(X(o))).join(" ").trim();
|
|
55
|
+
if (!n.isValidElement(r)) return "";
|
|
56
|
+
const t = r.props.sortValue;
|
|
70
57
|
if (typeof t == "string" || typeof t == "number" || t instanceof Date)
|
|
71
58
|
return t;
|
|
72
|
-
const a = X(
|
|
59
|
+
const a = X(r.props.children);
|
|
73
60
|
if (String(a).trim()) return a;
|
|
74
|
-
for (const
|
|
61
|
+
for (const o of [
|
|
75
62
|
"value",
|
|
76
63
|
"label",
|
|
77
64
|
"status",
|
|
@@ -79,17 +66,17 @@ function X(e) {
|
|
|
79
66
|
"title",
|
|
80
67
|
"health"
|
|
81
68
|
]) {
|
|
82
|
-
const s =
|
|
69
|
+
const s = r.props[o];
|
|
83
70
|
if (typeof s == "string" || typeof s == "number") return s;
|
|
84
71
|
}
|
|
85
72
|
return "";
|
|
86
73
|
}
|
|
87
|
-
function oe(
|
|
88
|
-
if (
|
|
89
|
-
return { kind: "number", value:
|
|
90
|
-
if (typeof
|
|
91
|
-
return { kind: "number", value:
|
|
92
|
-
const t =
|
|
74
|
+
function oe(r) {
|
|
75
|
+
if (r instanceof Date)
|
|
76
|
+
return { kind: "number", value: r.getTime() };
|
|
77
|
+
if (typeof r == "number")
|
|
78
|
+
return { kind: "number", value: r };
|
|
79
|
+
const t = r.trim();
|
|
93
80
|
if (!t || t === "—" || t === "-")
|
|
94
81
|
return { kind: "empty", value: "" };
|
|
95
82
|
const a = t.replace(/[,\s]/g, "").replace(/^[₹$€£]/, "").replace(/%$/, "");
|
|
@@ -98,267 +85,270 @@ function oe(e) {
|
|
|
98
85
|
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
86
|
return Number.isNaN(s) ? { kind: "text", value: t } : { kind: "number", value: s };
|
|
100
87
|
}
|
|
101
|
-
function Ce(
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
88
|
+
function Ce(r, t, a) {
|
|
89
|
+
const o = oe(r), s = oe(t);
|
|
90
|
+
if (o.kind === "empty") return s.kind === "empty" ? 0 : 1;
|
|
104
91
|
if (s.kind === "empty") return -1;
|
|
105
|
-
const
|
|
106
|
-
return a === "ascending" ?
|
|
92
|
+
const c = o.kind === "number" && s.kind === "number" ? o.value - s.value : xe.compare(String(o.value), String(s.value));
|
|
93
|
+
return a === "ascending" ? c : -c;
|
|
107
94
|
}
|
|
108
|
-
const
|
|
109
|
-
function Ne(
|
|
110
|
-
const t = [],
|
|
111
|
-
if (!
|
|
95
|
+
const de = n.createContext(null), B = () => n.useContext(de), Y = n.createContext("body");
|
|
96
|
+
function Ne(r) {
|
|
97
|
+
const t = [], o = V(r.props.children).map((s, c) => {
|
|
98
|
+
if (!n.isValidElement(s) || s.type !== Z)
|
|
112
99
|
return s;
|
|
113
|
-
let
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
116
|
-
for (; (t[
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
for (let
|
|
120
|
-
t[
|
|
121
|
-
t[
|
|
122
|
-
|
|
100
|
+
let u = 0;
|
|
101
|
+
const f = V(s.props.children).map((e) => {
|
|
102
|
+
if (!n.isValidElement(e)) return e;
|
|
103
|
+
for (; (t[u] ?? 0) > c; )
|
|
104
|
+
u += 1;
|
|
105
|
+
const N = Math.max(1, Number(e.props.colSpan ?? 1)), x = Math.max(1, Number(e.props.rowSpan ?? 1)), w = u;
|
|
106
|
+
for (let g = 0; g < N; g += 1)
|
|
107
|
+
t[w + g] = Math.max(
|
|
108
|
+
t[w + g] ?? 0,
|
|
109
|
+
c + x
|
|
123
110
|
);
|
|
124
|
-
return
|
|
111
|
+
return u += N, e.type !== be ? e : n.cloneElement(e, { _sortColumnIndex: w });
|
|
125
112
|
});
|
|
126
|
-
return
|
|
113
|
+
return n.cloneElement(s, void 0, f);
|
|
127
114
|
});
|
|
128
|
-
return
|
|
115
|
+
return n.cloneElement(r, void 0, o);
|
|
129
116
|
}
|
|
130
|
-
function
|
|
131
|
-
const
|
|
132
|
-
if (!
|
|
133
|
-
return { row: s, index:
|
|
134
|
-
const
|
|
117
|
+
function ke(r, t, a) {
|
|
118
|
+
const o = V(r.props.children).map((s, c) => {
|
|
119
|
+
if (!n.isValidElement(s) || s.type !== Z)
|
|
120
|
+
return { row: s, index: c, value: "" };
|
|
121
|
+
const u = V(s.props.children);
|
|
135
122
|
return {
|
|
136
123
|
row: s,
|
|
137
|
-
index:
|
|
138
|
-
value: X(
|
|
124
|
+
index: c,
|
|
125
|
+
value: X(u[t])
|
|
139
126
|
};
|
|
140
127
|
});
|
|
141
|
-
return
|
|
142
|
-
|
|
128
|
+
return o.sort((s, c) => Ce(s.value, c.value, a) || s.index - c.index), n.cloneElement(
|
|
129
|
+
r,
|
|
143
130
|
void 0,
|
|
144
|
-
|
|
131
|
+
o.map(({ row: s }) => s)
|
|
145
132
|
);
|
|
146
133
|
}
|
|
147
|
-
function
|
|
148
|
-
const a = t != null && t.column.startsWith(
|
|
149
|
-
return
|
|
150
|
-
|
|
134
|
+
function me(r, t) {
|
|
135
|
+
const a = t != null && t.column.startsWith(G) ? Number(t.column.slice(G.length)) : Number.NaN;
|
|
136
|
+
return n.Children.map(r, (o) => n.isValidElement(o) ? o.type === n.Fragment ? n.cloneElement(
|
|
137
|
+
o,
|
|
151
138
|
void 0,
|
|
152
|
-
|
|
153
|
-
) :
|
|
139
|
+
me(o.props.children, t)
|
|
140
|
+
) : o.type === pe ? Ne(o) : o.type === fe && t && Number.isInteger(a) && a >= 0 ? ke(o, a, t.direction) : o : o);
|
|
154
141
|
}
|
|
155
|
-
const
|
|
142
|
+
const ze = n.forwardRef(
|
|
156
143
|
({
|
|
157
|
-
className:
|
|
144
|
+
className: r,
|
|
158
145
|
wrapperClassName: t,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
146
|
+
toolbar: a,
|
|
147
|
+
footer: o,
|
|
148
|
+
children: s,
|
|
149
|
+
selectionMode: c = "none",
|
|
150
|
+
selectedKeys: u,
|
|
151
|
+
onSelectionChange: h,
|
|
152
|
+
rowKeys: f,
|
|
153
|
+
elevatedActionColumn: e = !1,
|
|
154
|
+
actionColumnWidth: N = "3rem",
|
|
155
|
+
sortDescriptor: x,
|
|
156
|
+
onSortChange: w,
|
|
157
|
+
allowsSorting: g = !0,
|
|
158
|
+
isStatic: A = !1,
|
|
159
|
+
resizableColumns: E = !0,
|
|
160
|
+
maxBodyHeight: k,
|
|
161
|
+
..._
|
|
174
162
|
}, O) => {
|
|
175
|
-
const
|
|
176
|
-
(
|
|
177
|
-
[
|
|
178
|
-
), R =
|
|
179
|
-
(
|
|
180
|
-
if (!
|
|
181
|
-
if (
|
|
182
|
-
|
|
163
|
+
const C = n.useMemo(() => f ?? [], [f]), z = u === "all", v = z ? null : u ?? /* @__PURE__ */ new Set(), D = n.useCallback(
|
|
164
|
+
(i) => z || !!(v != null && v.has(i)),
|
|
165
|
+
[z, v]
|
|
166
|
+
), R = C.length > 0 && (z || C.every((i) => v == null ? void 0 : v.has(i))), W = !R && (z || C.some((i) => v == null ? void 0 : v.has(i))), $ = n.useCallback(
|
|
167
|
+
(i) => {
|
|
168
|
+
if (!h) return;
|
|
169
|
+
if (c === "single") {
|
|
170
|
+
h(D(i) ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([i]));
|
|
183
171
|
return;
|
|
184
172
|
}
|
|
185
|
-
const
|
|
186
|
-
|
|
173
|
+
const b = new Set(z ? C : v ?? /* @__PURE__ */ new Set());
|
|
174
|
+
b.has(i) ? b.delete(i) : b.add(i), h(b);
|
|
187
175
|
},
|
|
188
|
-
[
|
|
189
|
-
),
|
|
190
|
-
|
|
191
|
-
}, [
|
|
192
|
-
(
|
|
193
|
-
if (!
|
|
194
|
-
const
|
|
195
|
-
|
|
176
|
+
[h, c, D, z, C, v]
|
|
177
|
+
), I = n.useCallback(() => {
|
|
178
|
+
h && h(R ? /* @__PURE__ */ new Set() : new Set(C));
|
|
179
|
+
}, [h, R, C]), [H, U] = n.useState(), p = g && !w, l = p ? H ?? x : x, S = n.useCallback(
|
|
180
|
+
(i) => {
|
|
181
|
+
if (!g) return;
|
|
182
|
+
const b = (l == null ? void 0 : l.column) === i && l.direction === "ascending" ? "descending" : "ascending", y = { column: i, direction: b };
|
|
183
|
+
w ? w(y) : U(y);
|
|
196
184
|
},
|
|
197
|
-
[
|
|
198
|
-
),
|
|
199
|
-
() =>
|
|
200
|
-
[
|
|
201
|
-
),
|
|
185
|
+
[l, g, w]
|
|
186
|
+
), j = n.useMemo(
|
|
187
|
+
() => p ? me(s, l) : s,
|
|
188
|
+
[l, p, s]
|
|
189
|
+
), M = n.useRef(null), [F, he] = n.useState({
|
|
202
190
|
left: !1,
|
|
203
191
|
right: !1
|
|
204
|
-
}),
|
|
205
|
-
const
|
|
206
|
-
if (!
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
(
|
|
192
|
+
}), q = n.useCallback(() => {
|
|
193
|
+
const i = M.current;
|
|
194
|
+
if (!i) return;
|
|
195
|
+
const b = i.scrollWidth - i.clientWidth, y = i.scrollLeft > 1, L = i.scrollLeft < b - 1;
|
|
196
|
+
he(
|
|
197
|
+
(K) => K.left === y && K.right === L ? K : { left: y, right: L }
|
|
210
198
|
);
|
|
211
199
|
}, []);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
const
|
|
215
|
-
if (!
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
const
|
|
219
|
-
return
|
|
220
|
-
}, [
|
|
221
|
-
const [P,
|
|
200
|
+
n.useEffect(() => {
|
|
201
|
+
q();
|
|
202
|
+
const i = M.current;
|
|
203
|
+
if (!i || typeof ResizeObserver > "u") return;
|
|
204
|
+
const b = new ResizeObserver(q);
|
|
205
|
+
b.observe(i);
|
|
206
|
+
const y = i.querySelector("table");
|
|
207
|
+
return y && b.observe(y), () => b.disconnect();
|
|
208
|
+
}, [q]);
|
|
209
|
+
const [P, J] = n.useState(
|
|
222
210
|
null
|
|
223
|
-
),
|
|
224
|
-
(
|
|
225
|
-
|
|
226
|
-
(
|
|
227
|
-
|
|
228
|
-
(
|
|
211
|
+
), ee = n.useCallback(
|
|
212
|
+
(i) => {
|
|
213
|
+
J(
|
|
214
|
+
(b) => b ?? Array.from(
|
|
215
|
+
i.cells,
|
|
216
|
+
(y) => y.getBoundingClientRect().width
|
|
229
217
|
)
|
|
230
218
|
);
|
|
231
219
|
},
|
|
232
220
|
[]
|
|
233
|
-
),
|
|
234
|
-
(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
[]
|
|
242
|
-
), te = o.useCallback(
|
|
243
|
-
() => B(null),
|
|
221
|
+
), te = n.useCallback((i, b) => {
|
|
222
|
+
J((y) => {
|
|
223
|
+
if (!y) return y;
|
|
224
|
+
const L = [...y];
|
|
225
|
+
return L[i] = Math.max(Q, b), L;
|
|
226
|
+
});
|
|
227
|
+
}, []), re = n.useCallback(
|
|
228
|
+
() => J(null),
|
|
244
229
|
[]
|
|
245
|
-
),
|
|
230
|
+
), ge = n.useMemo(
|
|
246
231
|
() => ({
|
|
247
|
-
selectionMode:
|
|
248
|
-
isSelected:
|
|
249
|
-
toggleKey:
|
|
250
|
-
toggleAll:
|
|
232
|
+
selectionMode: c,
|
|
233
|
+
isSelected: D,
|
|
234
|
+
toggleKey: $,
|
|
235
|
+
toggleAll: I,
|
|
251
236
|
allSelected: R,
|
|
252
|
-
someSelected:
|
|
253
|
-
isStatic:
|
|
254
|
-
sortDescriptor:
|
|
255
|
-
requestSort:
|
|
256
|
-
automaticSorting:
|
|
257
|
-
elevatedActionColumn:
|
|
258
|
-
resizableColumns:
|
|
237
|
+
someSelected: W,
|
|
238
|
+
isStatic: A,
|
|
239
|
+
sortDescriptor: l,
|
|
240
|
+
requestSort: g ? S : void 0,
|
|
241
|
+
automaticSorting: p,
|
|
242
|
+
elevatedActionColumn: e,
|
|
243
|
+
resizableColumns: E,
|
|
259
244
|
columnWidths: P,
|
|
260
|
-
snapshotColumnWidths:
|
|
261
|
-
setColumnWidth:
|
|
262
|
-
resetColumnWidths:
|
|
263
|
-
stickyHeader:
|
|
245
|
+
snapshotColumnWidths: ee,
|
|
246
|
+
setColumnWidth: te,
|
|
247
|
+
resetColumnWidths: re,
|
|
248
|
+
stickyHeader: k != null
|
|
264
249
|
}),
|
|
265
250
|
[
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
M,
|
|
269
|
-
H,
|
|
270
|
-
R,
|
|
251
|
+
c,
|
|
252
|
+
D,
|
|
271
253
|
$,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
S,
|
|
276
|
-
f,
|
|
277
|
-
w,
|
|
254
|
+
I,
|
|
255
|
+
R,
|
|
256
|
+
W,
|
|
278
257
|
A,
|
|
258
|
+
l,
|
|
259
|
+
g,
|
|
260
|
+
p,
|
|
261
|
+
S,
|
|
262
|
+
e,
|
|
263
|
+
E,
|
|
279
264
|
P,
|
|
280
|
-
Z,
|
|
281
265
|
ee,
|
|
282
266
|
te,
|
|
283
|
-
|
|
267
|
+
re,
|
|
268
|
+
k
|
|
284
269
|
]
|
|
285
270
|
);
|
|
286
|
-
return /* @__PURE__ */
|
|
271
|
+
return /* @__PURE__ */ d(de.Provider, { value: ge, children: /* @__PURE__ */ T(
|
|
287
272
|
"div",
|
|
288
273
|
{
|
|
289
|
-
"data-
|
|
290
|
-
"data-scroll-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
// pinned caps) derives from this one value.
|
|
296
|
-
"[--table-card-radius:calc(var(--radius-2xl)-0.25rem)]",
|
|
274
|
+
"data-slot": "table-container",
|
|
275
|
+
"data-scroll-left": F.left ? "true" : "false",
|
|
276
|
+
"data-scroll-right": F.right ? "true" : "false",
|
|
277
|
+
className: m(
|
|
278
|
+
"group/table-shell overflow-clip rounded-m border border-table-stroke bg-white",
|
|
279
|
+
"[--table-card-radius:var(--radius-m)]",
|
|
297
280
|
t
|
|
298
281
|
),
|
|
299
282
|
children: [
|
|
283
|
+
a && /* @__PURE__ */ d(
|
|
284
|
+
"div",
|
|
285
|
+
{
|
|
286
|
+
"data-slot": "table-toolbar",
|
|
287
|
+
className: "flex min-h-12 items-center justify-end border-b border-table-stroke px-4 py-2",
|
|
288
|
+
children: a
|
|
289
|
+
}
|
|
290
|
+
),
|
|
300
291
|
/* @__PURE__ */ T(
|
|
301
292
|
"div",
|
|
302
293
|
{
|
|
303
294
|
className: "relative",
|
|
304
|
-
style:
|
|
305
|
-
"--table-action-column-width":
|
|
295
|
+
style: e ? {
|
|
296
|
+
"--table-action-column-width": N
|
|
306
297
|
} : void 0,
|
|
307
298
|
children: [
|
|
308
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ d(
|
|
309
300
|
"div",
|
|
310
301
|
{
|
|
311
|
-
ref:
|
|
312
|
-
onScroll:
|
|
313
|
-
className:
|
|
302
|
+
ref: M,
|
|
303
|
+
onScroll: q,
|
|
304
|
+
className: m(
|
|
314
305
|
"overflow-x-auto rounded-(--table-card-radius)",
|
|
315
|
-
|
|
306
|
+
k != null && "overflow-y-auto"
|
|
316
307
|
),
|
|
317
|
-
style:
|
|
308
|
+
style: k != null ? { maxHeight: k } : void 0,
|
|
318
309
|
children: /* @__PURE__ */ T(
|
|
319
310
|
"table",
|
|
320
311
|
{
|
|
321
312
|
ref: O,
|
|
322
313
|
"data-slot": "table",
|
|
323
|
-
className:
|
|
324
|
-
"w-full border-separate border-spacing-0 text-
|
|
314
|
+
className: m(
|
|
315
|
+
"w-full border-separate border-spacing-0 text-m font-normal",
|
|
325
316
|
// Manual widths need fixed layout so the <colgroup> wins;
|
|
326
317
|
// until the first resize the automatic layout is untouched.
|
|
327
318
|
P && "table-fixed",
|
|
328
|
-
|
|
319
|
+
r
|
|
329
320
|
),
|
|
330
|
-
...
|
|
321
|
+
..._,
|
|
331
322
|
children: [
|
|
332
|
-
P && /* @__PURE__ */
|
|
333
|
-
|
|
323
|
+
P && /* @__PURE__ */ d("colgroup", { children: P.map((i, b) => /* @__PURE__ */ d("col", { style: { width: i } }, b)) }),
|
|
324
|
+
j
|
|
334
325
|
]
|
|
335
326
|
}
|
|
336
327
|
)
|
|
337
328
|
}
|
|
338
329
|
),
|
|
339
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ d(
|
|
340
331
|
"div",
|
|
341
332
|
{
|
|
342
333
|
"aria-hidden": "true",
|
|
343
334
|
"data-slot": "table-scroll-hint",
|
|
344
|
-
className:
|
|
335
|
+
className: m(
|
|
345
336
|
"pointer-events-none absolute inset-y-0 z-20 w-10",
|
|
346
337
|
"bg-gradient-to-l from-(--table-scroll-hint) to-transparent",
|
|
347
338
|
"opacity-0 transition-opacity duration-150 ease-out motion-reduce:transition-none",
|
|
348
|
-
|
|
349
|
-
|
|
339
|
+
F.right && "opacity-100",
|
|
340
|
+
e ? "right-[var(--table-action-column-width)]" : "right-0"
|
|
350
341
|
)
|
|
351
342
|
}
|
|
352
343
|
),
|
|
353
|
-
|
|
344
|
+
e && /* @__PURE__ */ d(
|
|
354
345
|
"div",
|
|
355
346
|
{
|
|
356
347
|
"aria-hidden": "true",
|
|
357
348
|
"data-slot": "table-action-column-elevation",
|
|
358
|
-
className:
|
|
349
|
+
className: m(
|
|
359
350
|
"pointer-events-none absolute inset-y-0 right-0 z-20",
|
|
360
|
-
"w-[var(--table-action-column-width)]"
|
|
361
|
-
"rounded-br-(--table-card-radius)"
|
|
351
|
+
"w-[var(--table-action-column-width)]"
|
|
362
352
|
// No shadow of its own: while columns hide behind the pinned
|
|
363
353
|
// surface the scroll-hint gradient is already washing the
|
|
364
354
|
// seam — stacking a cast on top of it read harsh. The hint
|
|
@@ -369,88 +359,97 @@ const Se = o.forwardRef(
|
|
|
369
359
|
]
|
|
370
360
|
}
|
|
371
361
|
),
|
|
372
|
-
|
|
362
|
+
o && /* @__PURE__ */ d("div", { className: "flex items-center border-t border-table-stroke px-4 py-2.5", children: o })
|
|
373
363
|
]
|
|
374
364
|
}
|
|
375
365
|
) });
|
|
376
366
|
}
|
|
377
367
|
);
|
|
378
|
-
|
|
379
|
-
const
|
|
380
|
-
const
|
|
381
|
-
return /* @__PURE__ */
|
|
368
|
+
ze.displayName = "Table";
|
|
369
|
+
const pe = n.forwardRef(({ className: r, ...t }, a) => {
|
|
370
|
+
const o = B();
|
|
371
|
+
return /* @__PURE__ */ d(Y.Provider, { value: "header", children: /* @__PURE__ */ d(
|
|
382
372
|
"thead",
|
|
383
373
|
{
|
|
384
374
|
ref: a,
|
|
385
|
-
className:
|
|
386
|
-
"text-
|
|
387
|
-
(
|
|
388
|
-
|
|
375
|
+
className: m(
|
|
376
|
+
"text-s font-medium uppercase text-table-header-foreground",
|
|
377
|
+
(o == null ? void 0 : o.elevatedActionColumn) && "relative z-30 bg-ng1",
|
|
378
|
+
r
|
|
389
379
|
),
|
|
390
380
|
...t
|
|
391
381
|
}
|
|
392
382
|
) });
|
|
393
383
|
});
|
|
394
|
-
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
({
|
|
399
|
-
|
|
400
|
-
|
|
384
|
+
pe.displayName = "TableHeader";
|
|
385
|
+
const fe = n.forwardRef(({ className: r, ...t }, a) => /* @__PURE__ */ d(Y.Provider, { value: "body", children: /* @__PURE__ */ d("tbody", { ref: a, className: m(r), ...t }) }));
|
|
386
|
+
fe.displayName = "TableBody";
|
|
387
|
+
const Z = n.forwardRef(
|
|
388
|
+
({
|
|
389
|
+
className: r,
|
|
390
|
+
rowKey: t,
|
|
391
|
+
children: a,
|
|
392
|
+
isInteractive: o = !1,
|
|
393
|
+
onClick: s,
|
|
394
|
+
role: c,
|
|
395
|
+
...u
|
|
396
|
+
}, h) => {
|
|
397
|
+
const f = B(), e = n.useContext(Y), N = !!f && f.selectionMode !== "none", x = e === "body" && !(f != null && f.isStatic) && (o || N || typeof s == "function" || c === "button" || u["aria-expanded"] !== void 0), w = N && e === "body" && t !== void 0 ? f.isSelected(t) : !1;
|
|
398
|
+
return /* @__PURE__ */ d(ie.Provider, { value: x, children: /* @__PURE__ */ T(
|
|
401
399
|
"tr",
|
|
402
400
|
{
|
|
403
|
-
ref:
|
|
401
|
+
ref: h,
|
|
402
|
+
"data-interactive": x || void 0,
|
|
404
403
|
"data-selected": w || void 0,
|
|
405
|
-
className:
|
|
406
|
-
|
|
404
|
+
className: m("group/row", e === "body" && "h-12", r),
|
|
405
|
+
onClick: s,
|
|
406
|
+
role: c,
|
|
407
|
+
...u,
|
|
407
408
|
children: [
|
|
408
|
-
|
|
409
|
+
N && (e === "header" ? /* @__PURE__ */ T(
|
|
409
410
|
"th",
|
|
410
411
|
{
|
|
411
412
|
scope: "col",
|
|
412
|
-
className:
|
|
413
|
-
"w-10 px-4 py-2.5",
|
|
414
|
-
|
|
413
|
+
className: m(
|
|
414
|
+
"w-10 border-b border-table-stroke px-4 py-2.5",
|
|
415
|
+
ue,
|
|
415
416
|
// Sticky without the baked shadow — an always-on smudge
|
|
416
417
|
// muddies the shell's corners (elevation = actionability).
|
|
417
418
|
// (sticky is positioned, so the ::after tick anchors to it —
|
|
418
419
|
// no `relative` needed, and it would conflict with sticky.)
|
|
419
|
-
"sticky left-0 z-10
|
|
420
|
+
"sticky left-0 z-10",
|
|
421
|
+
ce
|
|
420
422
|
),
|
|
421
423
|
children: [
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
|
|
424
|
-
|
|
424
|
+
/* @__PURE__ */ d("span", { className: "sr-only", children: "Row selection" }),
|
|
425
|
+
f.selectionMode === "multiple" && /* @__PURE__ */ d(
|
|
426
|
+
ne,
|
|
425
427
|
{
|
|
426
428
|
size: "sm",
|
|
427
429
|
"aria-label": "Select all rows",
|
|
428
|
-
checked:
|
|
429
|
-
indeterminate:
|
|
430
|
-
onChange:
|
|
430
|
+
checked: f.allSelected,
|
|
431
|
+
indeterminate: f.someSelected,
|
|
432
|
+
onChange: f.toggleAll
|
|
431
433
|
}
|
|
432
434
|
)
|
|
433
435
|
]
|
|
434
436
|
}
|
|
435
|
-
) : /* @__PURE__ */
|
|
437
|
+
) : /* @__PURE__ */ d(
|
|
436
438
|
"td",
|
|
437
439
|
{
|
|
438
|
-
className:
|
|
439
|
-
"w-10 px-4 py-
|
|
440
|
-
le(
|
|
441
|
-
|
|
442
|
-
"sticky left-0 z-10",
|
|
443
|
-
// Same white-behind-white corner problem as pinned data cells.
|
|
444
|
-
se("left")
|
|
440
|
+
className: m(
|
|
441
|
+
"h-12 w-10 px-4 py-2",
|
|
442
|
+
le(x),
|
|
443
|
+
"sticky left-0 z-10"
|
|
445
444
|
),
|
|
446
|
-
onClick: (
|
|
447
|
-
children: t !== void 0 && /* @__PURE__ */
|
|
448
|
-
|
|
445
|
+
onClick: (g) => g.stopPropagation(),
|
|
446
|
+
children: t !== void 0 && /* @__PURE__ */ d(
|
|
447
|
+
ne,
|
|
449
448
|
{
|
|
450
449
|
size: "sm",
|
|
451
450
|
"aria-label": `Select ${t}`,
|
|
452
451
|
checked: w,
|
|
453
|
-
onChange: () =>
|
|
452
|
+
onChange: () => f.toggleKey(t)
|
|
454
453
|
}
|
|
455
454
|
)
|
|
456
455
|
}
|
|
@@ -458,176 +457,193 @@ const Y = o.forwardRef(
|
|
|
458
457
|
a
|
|
459
458
|
]
|
|
460
459
|
}
|
|
461
|
-
);
|
|
460
|
+
) });
|
|
462
461
|
}
|
|
463
462
|
);
|
|
464
|
-
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
463
|
+
Z.displayName = "TableRow";
|
|
464
|
+
const be = n.forwardRef(
|
|
465
|
+
({
|
|
466
|
+
className: r,
|
|
467
|
+
align: t,
|
|
468
|
+
sticky: a,
|
|
469
|
+
sortKey: o,
|
|
470
|
+
allowsSorting: s = !0,
|
|
471
|
+
_sortColumnIndex: c,
|
|
472
|
+
children: u,
|
|
473
|
+
...h
|
|
474
|
+
}, f) => {
|
|
475
|
+
var I, H, U;
|
|
476
|
+
const e = B(), x = (e != null && e.automaticSorting && c !== void 0 ? `${G}${c}` : void 0) ?? o, w = Number(h.colSpan ?? 1) === 1, g = String(X(u)).trim(), A = g.length > 0, E = s && w && a !== "right" && A && !!x && !!(e != null && e.requestSort), k = E && ((I = e == null ? void 0 : e.sortDescriptor) == null ? void 0 : I.column) === x, _ = (H = e == null ? void 0 : e.sortDescriptor) == null ? void 0 : H.direction, O = !!(e != null && e.resizableColumns) && w && a !== "right", C = n.useRef(null), [z, v] = n.useState(!1), D = (p) => {
|
|
477
|
+
if (p.button !== 0 || !e) return;
|
|
478
|
+
const l = p.currentTarget.parentElement, S = l == null ? void 0 : l.parentElement;
|
|
479
|
+
if (!(!l || !S)) {
|
|
480
|
+
e.snapshotColumnWidths(S), C.current = {
|
|
481
|
+
index: l.cellIndex,
|
|
482
|
+
startX: p.clientX,
|
|
483
|
+
startWidth: l.getBoundingClientRect().width
|
|
484
|
+
}, v(!0);
|
|
485
|
+
try {
|
|
486
|
+
p.currentTarget.setPointerCapture(p.pointerId);
|
|
487
|
+
} catch {
|
|
488
|
+
}
|
|
489
|
+
p.preventDefault();
|
|
490
|
+
}
|
|
491
|
+
}, R = (p) => {
|
|
492
|
+
const l = C.current;
|
|
493
|
+
!l || !e || e.setColumnWidth(
|
|
494
|
+
l.index,
|
|
495
|
+
l.startWidth + (p.clientX - l.startX)
|
|
496
|
+
);
|
|
497
|
+
}, W = () => {
|
|
498
|
+
C.current = null, v(!1);
|
|
499
|
+
}, $ = (p) => {
|
|
500
|
+
if (p.key !== "ArrowLeft" && p.key !== "ArrowRight" || !e) return;
|
|
501
|
+
p.preventDefault();
|
|
502
|
+
const l = p.currentTarget.parentElement, S = l == null ? void 0 : l.parentElement;
|
|
503
|
+
if (!l || !S) return;
|
|
504
|
+
e.snapshotColumnWidths(S);
|
|
505
|
+
const j = p.shiftKey ? 32 : 8, M = p.key === "ArrowRight" ? j : -j;
|
|
506
|
+
e.setColumnWidth(
|
|
507
|
+
l.cellIndex,
|
|
508
|
+
l.getBoundingClientRect().width + M
|
|
509
|
+
);
|
|
510
|
+
};
|
|
511
|
+
return /* @__PURE__ */ T(
|
|
512
|
+
"th",
|
|
513
|
+
{
|
|
514
|
+
ref: f,
|
|
515
|
+
scope: "col",
|
|
516
|
+
"aria-sort": k ? _ === "ascending" ? "ascending" : "descending" : E ? "none" : void 0,
|
|
517
|
+
className: m(
|
|
518
|
+
// whitespace-nowrap: header labels hug their content — the table
|
|
519
|
+
// scrolls horizontally, so wrapping "Null %" to two lines only
|
|
520
|
+
// wastes header height without saving any width.
|
|
521
|
+
"relative whitespace-nowrap border-b border-table-stroke px-4 py-2.5 font-medium uppercase",
|
|
522
|
+
ce,
|
|
523
|
+
ue,
|
|
524
|
+
// The resize handle carries its own tick visual, so drop the
|
|
525
|
+
// decorative one; the last column never shows a handle.
|
|
526
|
+
O && "after:hidden [&:last-child>[data-slot=resize-handle]]:hidden",
|
|
527
|
+
// Capped-height tables scroll under the header: pin it to the
|
|
528
|
+
// viewport top, painted NG1 so rows pass beneath.
|
|
529
|
+
(e == null ? void 0 : e.stickyHeader) && "sticky top-0 z-30",
|
|
530
|
+
se(t),
|
|
531
|
+
a && (a === "right" && (e != null && e.elevatedActionColumn) ? m(
|
|
532
|
+
// Preserve the semantic column width, but do not pin or paint
|
|
533
|
+
// a blank header cell over the labels behind it. Only body
|
|
534
|
+
// action cells participate in the sticky elevated surface.
|
|
535
|
+
"w-[var(--table-action-column-width)]",
|
|
536
|
+
"min-w-[var(--table-action-column-width)]",
|
|
537
|
+
"max-w-[var(--table-action-column-width)]",
|
|
538
|
+
"px-2",
|
|
539
|
+
"bg-transparent"
|
|
540
|
+
) : ae(a)),
|
|
541
|
+
r
|
|
542
|
+
),
|
|
543
|
+
...h,
|
|
544
|
+
children: [
|
|
545
|
+
E ? /* @__PURE__ */ T(
|
|
546
|
+
"button",
|
|
547
|
+
{
|
|
548
|
+
type: "button",
|
|
549
|
+
onClick: () => e.requestSort(x),
|
|
550
|
+
className: m(
|
|
551
|
+
"group/sort -mx-1 inline-flex items-center gap-1 rounded px-1 uppercase outline-none transition-colors",
|
|
552
|
+
"hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
553
|
+
t === "right" && "flex-row-reverse",
|
|
554
|
+
k && "font-medium"
|
|
555
|
+
),
|
|
556
|
+
children: [
|
|
557
|
+
u,
|
|
558
|
+
k ? _ === "ascending" ? /* @__PURE__ */ d(ve, { className: "size-3.5" }) : /* @__PURE__ */ d(we, { className: "size-3.5" }) : /* @__PURE__ */ d(ye, { className: "size-3.5 opacity-0 transition-opacity group-hover/sort:opacity-60" })
|
|
559
|
+
]
|
|
560
|
+
}
|
|
561
|
+
) : A ? u : /* @__PURE__ */ d("span", { className: "sr-only", children: h["aria-label"] ?? "Table column" }),
|
|
562
|
+
O && /* @__PURE__ */ d(
|
|
563
|
+
"span",
|
|
564
|
+
{
|
|
565
|
+
"data-slot": "resize-handle",
|
|
566
|
+
role: "separator",
|
|
567
|
+
"aria-orientation": "vertical",
|
|
568
|
+
"aria-label": `Resize ${g || "this"} column`,
|
|
569
|
+
"aria-valuemin": Q,
|
|
570
|
+
"aria-valuemax": 2e3,
|
|
571
|
+
"aria-valuenow": ((U = e == null ? void 0 : e.columnWidths) == null ? void 0 : U[c ?? -1]) ?? Q,
|
|
572
|
+
tabIndex: 0,
|
|
573
|
+
"data-resizing": z ? "true" : void 0,
|
|
574
|
+
onPointerDown: D,
|
|
575
|
+
onPointerMove: R,
|
|
576
|
+
onPointerUp: W,
|
|
577
|
+
onPointerCancel: W,
|
|
578
|
+
onKeyDown: $,
|
|
579
|
+
onDoubleClick: () => e == null ? void 0 : e.resetColumnWidths(),
|
|
580
|
+
className: m(
|
|
581
|
+
// 12px hit area straddling the column edge; the 1px tick inside
|
|
582
|
+
// is the visible affordance (it replaces the decorative one).
|
|
583
|
+
"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",
|
|
584
|
+
"focus-visible:ring-2 focus-visible:ring-ring"
|
|
585
|
+
),
|
|
586
|
+
children: /* @__PURE__ */ d(
|
|
587
|
+
"span",
|
|
588
|
+
{
|
|
589
|
+
"aria-hidden": "true",
|
|
590
|
+
className: m(
|
|
591
|
+
"h-4 w-px rounded-sm bg-border-strong",
|
|
592
|
+
"transition-[transform,background-color] duration-150 ease-out motion-reduce:transition-none",
|
|
593
|
+
"group-hover/resize:scale-y-125 group-hover/resize:bg-foreground/60",
|
|
594
|
+
"group-focus-visible/resize:scale-y-125 group-focus-visible/resize:bg-foreground/60",
|
|
595
|
+
"group-data-[resizing]/resize:scale-y-125 group-data-[resizing]/resize:bg-foreground/60"
|
|
596
|
+
)
|
|
597
|
+
}
|
|
598
|
+
)
|
|
599
|
+
}
|
|
600
|
+
)
|
|
601
|
+
]
|
|
479
602
|
}
|
|
480
|
-
d.preventDefault();
|
|
481
|
-
}
|
|
482
|
-
}, $ = (d) => {
|
|
483
|
-
const f = y.current;
|
|
484
|
-
!f || !r || r.setColumnWidth(
|
|
485
|
-
f.index,
|
|
486
|
-
f.startWidth + (d.clientX - f.startX)
|
|
487
603
|
);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
const
|
|
494
|
-
|
|
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);
|
|
498
|
-
};
|
|
499
|
-
return /* @__PURE__ */ T(
|
|
500
|
-
"th",
|
|
501
|
-
{
|
|
502
|
-
ref: w,
|
|
503
|
-
scope: "col",
|
|
504
|
-
"aria-sort": W ? O === "ascending" ? "ascending" : "descending" : z ? "none" : void 0,
|
|
505
|
-
className: u(
|
|
506
|
-
// whitespace-nowrap: header labels hug their content — the table
|
|
507
|
-
// scrolls horizontally, so wrapping "Null %" to two lines only
|
|
508
|
-
// wastes header height without saving any width.
|
|
509
|
-
"relative whitespace-nowrap px-4 py-2.5 font-normal",
|
|
510
|
-
ie,
|
|
511
|
-
// The resize handle carries its own tick visual, so drop the
|
|
512
|
-
// decorative one; the last column never shows a handle.
|
|
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",
|
|
517
|
-
ne(t),
|
|
518
|
-
a && (a === "right" && (r != null && r.elevatedActionColumn) ? u(
|
|
519
|
-
// Preserve the semantic column width, but do not pin or paint
|
|
520
|
-
// a blank header cell over the labels behind it. Only body
|
|
521
|
-
// action cells participate in the sticky elevated surface.
|
|
522
|
-
"w-[var(--table-action-column-width)]",
|
|
523
|
-
"min-w-[var(--table-action-column-width)]",
|
|
524
|
-
"max-w-[var(--table-action-column-width)]",
|
|
525
|
-
"bg-transparent"
|
|
526
|
-
) : u(ae(a), "bg-table-shell")),
|
|
527
|
-
e
|
|
528
|
-
),
|
|
529
|
-
...h,
|
|
530
|
-
children: [
|
|
531
|
-
z ? /* @__PURE__ */ T(
|
|
532
|
-
"button",
|
|
533
|
-
{
|
|
534
|
-
type: "button",
|
|
535
|
-
onClick: () => r.requestSort(x),
|
|
536
|
-
className: u(
|
|
537
|
-
"group/sort -mx-1 inline-flex items-center gap-1 rounded px-1 outline-none transition-colors",
|
|
538
|
-
"hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
539
|
-
t === "right" && "flex-row-reverse",
|
|
540
|
-
W && "text-foreground"
|
|
541
|
-
),
|
|
542
|
-
children: [
|
|
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" })
|
|
545
|
-
]
|
|
546
|
-
}
|
|
547
|
-
) : A ? l : /* @__PURE__ */ p("span", { className: "sr-only", children: h["aria-label"] ?? "Table column" }),
|
|
548
|
-
N && /* @__PURE__ */ p(
|
|
549
|
-
"span",
|
|
550
|
-
{
|
|
551
|
-
"data-slot": "resize-handle",
|
|
552
|
-
role: "separator",
|
|
553
|
-
"aria-orientation": "vertical",
|
|
554
|
-
"aria-label": `Resize ${C || "this"} column`,
|
|
555
|
-
"aria-valuemin": G,
|
|
556
|
-
"aria-valuemax": 2e3,
|
|
557
|
-
"aria-valuenow": ((S = r == null ? void 0 : r.columnWidths) == null ? void 0 : S[i ?? -1]) ?? G,
|
|
558
|
-
tabIndex: 0,
|
|
559
|
-
"data-resizing": b ? "true" : void 0,
|
|
560
|
-
onPointerDown: R,
|
|
561
|
-
onPointerMove: $,
|
|
562
|
-
onPointerUp: M,
|
|
563
|
-
onPointerCancel: M,
|
|
564
|
-
onKeyDown: H,
|
|
565
|
-
onDoubleClick: () => r == null ? void 0 : r.resetColumnWidths(),
|
|
566
|
-
className: u(
|
|
567
|
-
// 12px hit area straddling the column edge; the 1px tick inside
|
|
568
|
-
// is the visible affordance (it replaces the decorative one).
|
|
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",
|
|
570
|
-
"focus-visible:ring-2 focus-visible:ring-ring"
|
|
571
|
-
),
|
|
572
|
-
children: /* @__PURE__ */ p(
|
|
573
|
-
"span",
|
|
574
|
-
{
|
|
575
|
-
"aria-hidden": "true",
|
|
576
|
-
className: u(
|
|
577
|
-
"h-4 w-px rounded-sm bg-border-strong",
|
|
578
|
-
"transition-[transform,background-color] duration-150 ease-out motion-reduce:transition-none",
|
|
579
|
-
"group-hover/resize:scale-y-125 group-hover/resize:bg-foreground/60",
|
|
580
|
-
"group-focus-visible/resize:scale-y-125 group-focus-visible/resize:bg-foreground/60",
|
|
581
|
-
"group-data-[resizing]/resize:scale-y-125 group-data-[resizing]/resize:bg-foreground/60"
|
|
582
|
-
)
|
|
583
|
-
}
|
|
584
|
-
)
|
|
585
|
-
}
|
|
586
|
-
)
|
|
587
|
-
]
|
|
588
|
-
}
|
|
589
|
-
);
|
|
590
|
-
});
|
|
591
|
-
fe.displayName = "TableColumn";
|
|
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(
|
|
604
|
+
}
|
|
605
|
+
);
|
|
606
|
+
be.displayName = "TableColumn";
|
|
607
|
+
const Se = n.forwardRef(
|
|
608
|
+
({ className: r, align: t, sticky: a, sortValue: o, ...s }, c) => {
|
|
609
|
+
const u = B(), h = n.useContext(ie), f = a === "right" && (u == null ? void 0 : u.elevatedActionColumn);
|
|
610
|
+
return /* @__PURE__ */ d(
|
|
596
611
|
"td",
|
|
597
612
|
{
|
|
598
|
-
ref:
|
|
599
|
-
"data-sort-value":
|
|
600
|
-
className:
|
|
613
|
+
ref: c,
|
|
614
|
+
"data-sort-value": o instanceof Date ? o.toISOString() : o,
|
|
615
|
+
className: m(
|
|
601
616
|
// whitespace-nowrap: cell content never wraps — the table's
|
|
602
617
|
// overflow-x-auto viewport scrolls horizontally instead, matching the
|
|
603
618
|
// header cells. Opt back into wrapping with `whitespace-normal` for
|
|
604
619
|
// deliberate multi-line content (e.g. an EmptyState in a colSpan cell).
|
|
605
|
-
"whitespace-nowrap px-4 py-
|
|
606
|
-
le(
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
a && se(a),
|
|
611
|
-
h && u(
|
|
620
|
+
"h-12 whitespace-nowrap px-4 py-2",
|
|
621
|
+
le(h),
|
|
622
|
+
se(t),
|
|
623
|
+
a && ae(a, u == null ? void 0 : u.elevatedActionColumn),
|
|
624
|
+
f && m(
|
|
612
625
|
"w-[var(--table-action-column-width)]",
|
|
613
626
|
"min-w-[var(--table-action-column-width)]",
|
|
614
627
|
"max-w-[var(--table-action-column-width)]",
|
|
628
|
+
"px-2",
|
|
615
629
|
"bg-elevated",
|
|
630
|
+
// Keep the action column off the zebra wash.
|
|
631
|
+
"group-even/row:bg-elevated",
|
|
616
632
|
"group-hover/row:bg-elevated group-focus-within/row:bg-elevated"
|
|
617
633
|
),
|
|
618
|
-
|
|
634
|
+
r
|
|
619
635
|
),
|
|
620
636
|
...s
|
|
621
637
|
}
|
|
622
638
|
);
|
|
623
639
|
}
|
|
624
640
|
);
|
|
625
|
-
|
|
641
|
+
Se.displayName = "TableCell";
|
|
626
642
|
export {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
643
|
+
ze as Table,
|
|
644
|
+
fe as TableBody,
|
|
645
|
+
Se as TableCell,
|
|
646
|
+
be as TableColumn,
|
|
647
|
+
pe as TableHeader,
|
|
648
|
+
Z as TableRow
|
|
633
649
|
};
|