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