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