@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.
Files changed (74) hide show
  1. package/DESIGN.md +80 -86
  2. package/README.md +6 -0
  3. package/components/ai-elements/chart.js +20 -20
  4. package/components/ai-elements/inline-citation.js +50 -50
  5. package/components/ai-elements/message.js +1 -1
  6. package/components/ai-elements/tool.js +5 -5
  7. package/components/alert.d.ts +5 -4
  8. package/components/alert.js +91 -79
  9. package/components/answer.js +1 -1
  10. package/components/assistant-ui/action-bar.js +1 -1
  11. package/components/assistant-ui/attachment.js +68 -49
  12. package/components/assistant-ui/composer-add-context.js +1 -1
  13. package/components/assistant-ui/composer-trigger-popover.js +1 -1
  14. package/components/assistant-ui/composer.js +13 -13
  15. package/components/assistant-ui/message-timing.js +6 -6
  16. package/components/assistant-ui/selection-toolbar.js +5 -5
  17. package/components/assistant-ui/sources.js +15 -15
  18. package/components/assistant-ui/tooltip-icon-button.js +18 -14
  19. package/components/audio-waveform.d.ts +21 -8
  20. package/components/audio-waveform.js +371 -94
  21. package/components/autocomplete.js +9 -9
  22. package/components/breadcrumbs.js +32 -38
  23. package/components/button.js +83 -73
  24. package/components/card.js +1 -1
  25. package/components/chart.js +732 -673
  26. package/components/chip.js +37 -35
  27. package/components/command-palette.js +12 -12
  28. package/components/connector-card.d.ts +1 -2
  29. package/components/connector-card.js +17 -17
  30. package/components/date-range-picker.js +1 -2
  31. package/components/drawer.js +9 -10
  32. package/components/dropdown.js +1 -1
  33. package/components/empty-state.d.ts +2 -0
  34. package/components/empty-state.js +17 -15
  35. package/components/field.js +9 -10
  36. package/components/file-dropzone.d.ts +6 -3
  37. package/components/file-dropzone.js +72 -60
  38. package/components/infinite-canvas.js +9 -9
  39. package/components/modal.js +1 -1
  40. package/components/page-body.js +8 -8
  41. package/components/popover.js +11 -11
  42. package/components/progress-circle.d.ts +1 -1
  43. package/components/progress-circle.js +57 -48
  44. package/components/radio.d.ts +1 -1
  45. package/components/radio.js +53 -53
  46. package/components/segmented.d.ts +1 -0
  47. package/components/segmented.js +34 -36
  48. package/components/select.js +2 -2
  49. package/components/selection-action-bar.js +32 -31
  50. package/components/setting-row.js +10 -10
  51. package/components/sidebar.js +74 -73
  52. package/components/slider.js +5 -5
  53. package/components/stepper.d.ts +1 -1
  54. package/components/stepper.js +1 -1
  55. package/components/switch.js +10 -10
  56. package/components/table.d.ts +17 -5
  57. package/components/table.js +559 -405
  58. package/components/tabs.js +41 -35
  59. package/components/timeline.js +3 -3
  60. package/components/toast.js +53 -56
  61. package/components/ui/button.js +4 -4
  62. package/components/ui/dialog.js +1 -1
  63. package/components/viz-charts.js +263 -221
  64. package/examples/README.md +30 -0
  65. package/examples/agents-screen.tsx +477 -0
  66. package/examples/settings-screen.tsx +90 -0
  67. package/examples/workspace-header.tsx +71 -0
  68. package/lib/icons.d.ts +8 -0
  69. package/lib/icons.js +171 -118
  70. package/llms.txt +16 -16
  71. package/manifest.json +178 -54
  72. package/package.json +1 -1
  73. package/styles.css +60 -72
  74. package/theme.css +55 -63
@@ -1,62 +1,99 @@
1
1
  "use client";
2
- import { jsx as u, jsxs as W } from "react/jsx-runtime";
3
- import * as n from "react";
4
- import { cn as f } from "../lib/cn.js";
5
- import { Checkbox as ne } from "./checkbox.js";
6
- import { ChevronUp as ve, ChevronDown as ye, SortIcon as we } from "../lib/icons.js";
7
- const se = (r) => r === "center" ? "text-center" : r === "right" ? "text-right" : "text-left", ae = (r, e = !1) => r === "left" ? f(
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
- ) : r === "right" ? f(
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, ie = n.createContext(!1), le = (r) => f(
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
- r && f(
23
- // Use WG3 without introducing a new
24
- // rounded silhouette. The wash is pre-composited so scrolled text
25
- // cannot show through sticky cells.
26
- "group-hover/row:bg-(--table-row-hover) group-focus-within/row:bg-(--table-row-hover)",
27
- "group-data-[selected]/row:bg-(--table-row-selected)"
28
- )
29
- ), ce = "bg-wg1", ue = f(
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
- ), Q = "__ads_table_column_", Y = 64, xe = new Intl.Collator(void 0, {
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 _(r) {
53
+ function L(t) {
38
54
  const e = [];
39
- return n.Children.forEach(r, (a) => {
40
- if (n.isValidElement(a) && a.type === n.Fragment) {
41
- e.push(..._(a.props.children));
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(a);
60
+ e.push(s);
45
61
  }), e;
46
62
  }
47
- function X(r) {
48
- if (r == null || typeof r == "boolean")
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 r == "number" || typeof r == "string") return r;
51
- if (Array.isArray(r))
52
- return r.map((s) => String(X(s))).join(" ").trim();
53
- if (!n.isValidElement(r)) return "";
54
- const e = r.props.sortValue;
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 a = X(r.props.children);
58
- if (String(a).trim()) return a;
59
- for (const s of [
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 o = r.props[s];
68
- if (typeof o == "string" || typeof o == "number") return o;
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 oe(r) {
73
- if (r instanceof Date)
74
- return { kind: "number", value: r.getTime() };
75
- if (typeof r == "number")
76
- return { kind: "number", value: r };
77
- const e = r.trim();
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 a = e.replace(/[,\s]/g, "").replace(/^[₹$€£]/, "").replace(/%$/, "");
81
- if (/^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(a))
82
- return { kind: "number", value: Number(a) };
83
- const o = /^\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;
84
- return Number.isNaN(o) ? { kind: "text", value: e } : { kind: "number", value: o };
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 Ce(r, e, a) {
87
- const s = oe(r), o = oe(e);
88
- if (s.kind === "empty") return o.kind === "empty" ? 0 : 1;
89
- if (o.kind === "empty") return -1;
90
- const c = s.kind === "number" && o.kind === "number" ? s.value - o.value : xe.compare(String(s.value), String(o.value));
91
- return a === "ascending" ? c : -c;
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 de = n.createContext(null), B = () => n.useContext(de), Z = n.createContext("body");
94
- function Ne(r) {
95
- const e = [], s = _(r.props.children).map((o, c) => {
96
- if (!n.isValidElement(o) || o.type !== K)
97
- return o;
98
- let d = 0;
99
- const k = _(o.props.children).map((t) => {
100
- if (!n.isValidElement(t)) return t;
101
- for (; (e[d] ?? 0) > c; )
102
- d += 1;
103
- const b = Math.max(1, Number(t.props.colSpan ?? 1)), x = Math.max(1, Number(t.props.rowSpan ?? 1)), y = d;
104
- for (let g = 0; g < b; g += 1)
105
- e[y + g] = Math.max(
106
- e[y + g] ?? 0,
107
- c + x
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 d += b, t.type !== be ? t : n.cloneElement(t, { _sortColumnIndex: y });
146
+ return b += _, z(o.type, pe) ? r.cloneElement(o, { _sortColumnIndex: x }) : o;
110
147
  });
111
- return n.cloneElement(o, void 0, k);
148
+ return r.cloneElement(n, void 0, A);
112
149
  });
113
- return n.cloneElement(r, void 0, s);
150
+ return r.cloneElement(t, void 0, i);
114
151
  }
115
- function ke(r, e, a) {
116
- const s = _(r.props.children).map((o, c) => {
117
- if (!n.isValidElement(o) || o.type !== K)
118
- return { row: o, index: c, value: "" };
119
- const d = _(o.props.children);
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: o,
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: X(d[e])
163
+ value: e === void 0 ? "" : ee(b[e])
124
164
  };
125
165
  });
126
- return s.sort((o, c) => Ce(o.value, c.value, a) || o.index - c.index), n.cloneElement(
127
- r,
128
- void 0,
129
- s.map(({ row: o }) => o)
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 me(r, e) {
133
- const a = e != null && e.column.startsWith(Q) ? Number(e.column.slice(Q.length)) : Number.NaN;
134
- return n.Children.map(r, (s) => n.isValidElement(s) ? s.type === n.Fragment ? n.cloneElement(
135
- s,
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
- me(s.props.children, e)
138
- ) : s.type === fe ? Ne(s) : s.type === pe && e && Number.isInteger(a) && a >= 0 ? ke(s, a, e.direction) : s : s);
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 ze = n.forwardRef(
179
+ const de = r.forwardRef(
141
180
  ({
142
- className: r,
181
+ className: t,
143
182
  wrapperClassName: e,
144
- toolbar: a,
145
- footer: s,
146
- children: o,
183
+ toolbar: s,
184
+ footer: i,
185
+ children: n,
147
186
  selectionMode: c = "none",
148
- selectedKeys: d,
187
+ selectedKeys: b,
149
188
  onSelectionChange: v,
150
- rowKeys: k,
151
- elevatedActionColumn: t = !1,
152
- actionColumnWidth: b = "3rem",
153
- sortDescriptor: x,
154
- onSortChange: y,
155
- allowsSorting: g = !0,
156
- isStatic: z = !1,
157
- resizableColumns: S = !0,
158
- maxBodyHeight: m,
159
- ...E
160
- }, O) => {
161
- const N = n.useMemo(() => k ?? [], [k]), R = d === "all", w = R ? null : d ?? /* @__PURE__ */ new Set(), D = n.useCallback(
162
- (i) => R || !!(w != null && w.has(i)),
163
- [R, w]
164
- ), A = N.length > 0 && (R || N.every((i) => w == null ? void 0 : w.has(i))), I = !A && (R || N.some((i) => w == null ? void 0 : w.has(i))), $ = n.useCallback(
165
- (i) => {
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
- v(D(i) ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([i]));
219
+ S(a) || v(/* @__PURE__ */ new Set([a]));
169
220
  return;
170
221
  }
171
- const h = new Set(R ? N : w ?? /* @__PURE__ */ new Set());
172
- h.has(i) ? h.delete(i) : h.add(i), v(h);
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, D, R, N, w]
175
- ), M = n.useCallback(() => {
176
- v && v(A ? /* @__PURE__ */ new Set() : new Set(N));
177
- }, [v, A, N]), [H, U] = n.useState(), p = g && !y, l = p ? H ?? x : x, T = n.useCallback(
178
- (i) => {
179
- if (!g) return;
180
- const h = (l == null ? void 0 : l.column) === i && l.direction === "ascending" ? "descending" : "ascending", C = { column: i, direction: h };
181
- y ? y(C) : U(C);
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
- [l, g, y]
184
- ), j = n.useMemo(
185
- () => p ? me(o, l) : o,
186
- [l, p, o]
187
- ), P = n.useRef(null), [F, ge] = n.useState({
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
- }), q = n.useCallback(() => {
191
- const i = P.current;
192
- if (!i) return;
193
- const h = i.scrollWidth - i.clientWidth, C = i.scrollLeft > 1, V = i.scrollLeft < h - 1;
194
- ge(
195
- (G) => G.left === C && G.right === V ? G : { left: C, right: V }
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
- n.useEffect(() => {
199
- q();
200
- const i = P.current;
201
- if (!i || typeof ResizeObserver > "u") return;
202
- const h = new ResizeObserver(q);
203
- h.observe(i);
204
- const C = i.querySelector("table");
205
- return C && h.observe(C), () => h.disconnect();
206
- }, [q]);
207
- const [L, J] = n.useState(
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
- ), ee = n.useCallback(
210
- (i) => {
211
- J(
212
- (h) => h ?? Array.from(
213
- i.cells,
214
- (C) => C.getBoundingClientRect().width
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
- ), te = n.useCallback((i, h) => {
220
- J((C) => {
221
- if (!C) return C;
222
- const V = [...C];
223
- return V[i] = Math.max(Y, h), V;
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
- }, []), re = n.useCallback(
226
- () => J(null),
286
+ }, []), me = r.useCallback(
287
+ () => Y(null),
227
288
  []
228
- ), he = n.useMemo(
289
+ ), Pe = r.useMemo(
229
290
  () => ({
230
291
  selectionMode: c,
231
- isSelected: D,
232
- toggleKey: $,
233
- toggleAll: M,
234
- allSelected: A,
235
- someSelected: I,
236
- isStatic: z,
237
- sortDescriptor: l,
238
- requestSort: g ? T : void 0,
239
- automaticSorting: p,
240
- elevatedActionColumn: t,
241
- resizableColumns: S,
242
- columnWidths: L,
243
- snapshotColumnWidths: ee,
244
- setColumnWidth: te,
245
- resetColumnWidths: re,
246
- stickyHeader: m != null
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
- D,
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
- L,
263
- ee,
264
- te,
265
- re,
266
- m
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__ */ u(de.Provider, { value: he, children: /* @__PURE__ */ W(
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": F.left ? "true" : "false",
274
- "data-scroll-right": F.right ? "true" : "false",
275
- className: f(
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
- a && /* @__PURE__ */ u(
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: a
353
+ children: s
287
354
  }
288
355
  ),
289
- /* @__PURE__ */ W(
356
+ /* @__PURE__ */ $(
290
357
  "div",
291
358
  {
292
359
  className: "relative",
293
- style: t ? {
294
- "--table-action-column-width": b
360
+ style: o ? {
361
+ "--table-action-column-width": _
295
362
  } : void 0,
296
363
  children: [
297
- /* @__PURE__ */ u(
364
+ /* @__PURE__ */ d(
298
365
  "div",
299
366
  {
300
- ref: P,
301
- onScroll: q,
302
- className: f(
367
+ ref: G,
368
+ onScroll: P,
369
+ className: h(
303
370
  "overflow-x-auto rounded-(--table-card-radius)",
304
- m != null && "overflow-y-auto"
371
+ D != null && "overflow-y-auto"
305
372
  ),
306
- style: m != null ? { maxHeight: m } : void 0,
307
- children: /* @__PURE__ */ W(
373
+ style: D != null ? { maxHeight: D } : void 0,
374
+ children: /* @__PURE__ */ $(
308
375
  "table",
309
376
  {
310
- ref: O,
377
+ ref: u,
311
378
  "data-slot": "table",
312
- className: f(
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
- L && "table-fixed",
317
- r
383
+ H && "table-fixed",
384
+ t
318
385
  ),
319
- ...E,
386
+ ...q,
320
387
  children: [
321
- L && /* @__PURE__ */ u("colgroup", { children: L.map((i, h) => /* @__PURE__ */ u("col", { style: { width: i } }, h)) }),
322
- j
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__ */ u(
395
+ /* @__PURE__ */ d(
329
396
  "div",
330
397
  {
331
398
  "aria-hidden": "true",
332
399
  "data-slot": "table-scroll-hint",
333
- className: f(
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
- F.right && "opacity-100",
338
- t ? "right-[var(--table-action-column-width)]" : "right-0"
404
+ Q.right && "opacity-100",
405
+ o ? "right-[var(--table-action-column-width)]" : "right-0"
339
406
  )
340
407
  }
341
408
  ),
342
- t && /* @__PURE__ */ u(
409
+ o && /* @__PURE__ */ d(
343
410
  "div",
344
411
  {
345
412
  "aria-hidden": "true",
346
413
  "data-slot": "table-action-column-elevation",
347
- className: f(
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
- s && /* @__PURE__ */ u("div", { className: "flex items-center border-t border-table-stroke px-4 py-2.5", children: s })
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
- ze.displayName = "Table";
367
- const fe = n.forwardRef(({ className: r, ...e }, a) => {
368
- const s = B();
369
- return /* @__PURE__ */ u(Z.Provider, { value: "header", children: /* @__PURE__ */ u(
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: a,
373
- className: f(
439
+ ref: s,
440
+ className: h(
374
441
  "text-s font-medium text-table-header-foreground",
375
- (s == null ? void 0 : s.elevatedActionColumn) && "relative z-30 bg-wg1",
376
- r
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
- fe.displayName = "TableHeader";
383
- const pe = n.forwardRef(({ className: r, ...e }, a) => /* @__PURE__ */ u(Z.Provider, { value: "body", children: /* @__PURE__ */ u("tbody", { ref: a, className: f(r), ...e }) }));
384
- pe.displayName = "TableBody";
385
- const K = n.forwardRef(
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: r,
454
+ className: t,
388
455
  rowKey: e,
389
- children: a,
390
- isInteractive: s = !1,
391
- onClick: o,
392
- onKeyDown: c,
393
- role: d,
394
- tabIndex: v,
395
- ...k
396
- }, t) => {
397
- const b = B(), x = n.useContext(Z), y = !!b && b.selectionMode !== "none", g = x === "body" && (typeof o == "function" || y && e !== void 0), z = x === "body" && !(b != null && b.isStatic) && (g || s), S = y && x === "body" && e !== void 0 ? b.isSelected(e) : !1;
398
- return /* @__PURE__ */ u(ie.Provider, { value: z, children: /* @__PURE__ */ W(
399
- "tr",
400
- {
401
- ref: t,
402
- "data-interactive": z || void 0,
403
- "data-selected": S || void 0,
404
- className: f(
405
- "group/row",
406
- x === "body" && "h-16",
407
- g && "cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
408
- r
409
- ),
410
- onClick: (m) => {
411
- const E = m.target;
412
- E instanceof Element && E.closest(
413
- "a, button, input, select, textarea, [role='button'], [role='link'], [contenteditable='true']"
414
- ) || (o ? o(m) : y && e !== void 0 && (b == null || b.toggleKey(e)));
415
- },
416
- onKeyDown: (m) => {
417
- c == null || c(m), !m.defaultPrevented && g && m.target === m.currentTarget && (m.key === "Enter" || m.key === " ") && (m.preventDefault(), m.currentTarget.click());
418
- },
419
- role: d,
420
- tabIndex: v ?? (g ? 0 : void 0),
421
- ...k,
422
- children: [
423
- y && (x === "header" ? /* @__PURE__ */ W(
424
- "th",
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
- scope: "col",
427
- className: f(
428
- "w-10 border-b border-table-stroke px-4 py-2.5",
429
- ue,
430
- // Sticky without the baked shadow — an always-on smudge
431
- // muddies the shell's corners (elevation = actionability).
432
- // (sticky is positioned, so the ::after tick anchors to it —
433
- // no `relative` needed, and it would conflict with sticky.)
434
- "sticky left-0 z-10",
435
- ce
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__ */ u("span", { className: "sr-only", children: "Row selection" }),
439
- b.selectionMode === "multiple" && /* @__PURE__ */ u(
440
- ne,
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": "Select all rows",
444
- checked: b.allSelected,
445
- indeterminate: b.someSelected,
446
- onChange: b.toggleAll
611
+ "aria-label": `Select ${e}`,
612
+ checked: M,
613
+ indeterminate: u.isIndeterminate(e),
614
+ onChange: () => u.toggleKey(e)
447
615
  }
448
- )
449
- ]
450
- }
451
- ) : /* @__PURE__ */ u(
452
- "td",
453
- {
454
- className: f(
455
- "h-16 w-10 px-4 py-2",
456
- le(z),
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 be = n.forwardRef(
628
+ const pe = r.forwardRef(
479
629
  ({
480
- className: r,
630
+ className: t,
481
631
  align: e,
482
- sticky: a,
483
- sortKey: s,
484
- allowsSorting: o = !0,
632
+ sticky: s,
633
+ sortKey: i,
634
+ allowsSorting: n = !0,
485
635
  _sortColumnIndex: c,
486
- children: d,
636
+ children: b,
487
637
  ...v
488
- }, k) => {
489
- var M, H, U;
490
- const t = B(), x = (t != null && t.automaticSorting && c !== void 0 ? `${Q}${c}` : void 0) ?? s, y = Number(v.colSpan ?? 1) === 1, g = String(X(d)).trim(), z = g.length > 0, S = o && y && a !== "right" && z && !!x && !!(t != null && t.requestSort), m = S && ((M = t == null ? void 0 : t.sortDescriptor) == null ? void 0 : M.column) === x, E = (H = t == null ? void 0 : t.sortDescriptor) == null ? void 0 : H.direction, O = !!(t != null && t.resizableColumns) && y && a !== "right", N = n.useRef(null), [R, w] = n.useState(!1), D = (p) => {
491
- if (p.button !== 0 || !t) return;
492
- const l = p.currentTarget.parentElement, T = l == null ? void 0 : l.parentElement;
493
- if (!(!l || !T)) {
494
- t.snapshotColumnWidths(T), N.current = {
495
- index: l.cellIndex,
496
- startX: p.clientX,
497
- startWidth: l.getBoundingClientRect().width
498
- }, w(!0);
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
- p.currentTarget.setPointerCapture(p.pointerId);
650
+ f.currentTarget.setPointerCapture(f.pointerId);
501
651
  } catch {
502
652
  }
503
- p.preventDefault();
653
+ f.preventDefault();
504
654
  }
505
- }, A = (p) => {
506
- const l = N.current;
507
- !l || !t || t.setColumnWidth(
508
- l.index,
509
- l.startWidth + (p.clientX - l.startX)
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
- }, I = () => {
512
- N.current = null, w(!1);
513
- }, $ = (p) => {
514
- if (p.key !== "ArrowLeft" && p.key !== "ArrowRight" || !t) return;
515
- p.preventDefault();
516
- const l = p.currentTarget.parentElement, T = l == null ? void 0 : l.parentElement;
517
- if (!l || !T) return;
518
- t.snapshotColumnWidths(T);
519
- const j = p.shiftKey ? 32 : 8, P = p.key === "ArrowRight" ? j : -j;
520
- t.setColumnWidth(
521
- l.cellIndex,
522
- l.getBoundingClientRect().width + P
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__ */ W(
675
+ return /* @__PURE__ */ $(
526
676
  "th",
527
677
  {
528
- ref: k,
678
+ ref: A,
529
679
  scope: "col",
530
- "aria-sort": m ? E === "ascending" ? "ascending" : "descending" : S ? "none" : void 0,
531
- className: f(
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
- ce,
537
- ue,
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
- O && "after:hidden [&:last-child>[data-slot=resize-handle]]:hidden",
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 WG1 so rows pass beneath.
543
- (t == null ? void 0 : t.stickyHeader) && "sticky top-0 z-30",
544
- se(e),
545
- a && (a === "right" && (t != null && t.elevatedActionColumn) ? f(
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
- ) : ae(a)),
555
- r
704
+ ) : ve(s)),
705
+ t
556
706
  ),
557
707
  ...v,
558
708
  children: [
559
- S ? /* @__PURE__ */ W(
709
+ F ? /* @__PURE__ */ $(
560
710
  "button",
561
711
  {
562
712
  type: "button",
563
- onClick: () => t.requestSort(x),
564
- className: f(
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
- m && "font-medium"
718
+ D && "font-medium"
569
719
  ),
570
720
  children: [
571
- d,
572
- m ? E === "ascending" ? /* @__PURE__ */ u(ve, { className: "size-3.5" }) : /* @__PURE__ */ u(ye, { className: "size-3.5" }) : /* @__PURE__ */ u(we, { className: "size-3.5 opacity-0 transition-opacity group-hover/sort:opacity-60" })
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
- ) : z ? d : /* @__PURE__ */ u("span", { className: "sr-only", children: v["aria-label"] ?? "Table column" }),
576
- O && /* @__PURE__ */ u(
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 ${g || "this"} column`,
583
- "aria-valuemin": Y,
732
+ "aria-label": `Resize ${N || "this"} column`,
733
+ "aria-valuemin": le,
584
734
  "aria-valuemax": 2e3,
585
- "aria-valuenow": ((U = t == null ? void 0 : t.columnWidths) == null ? void 0 : U[c ?? -1]) ?? Y,
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: D,
589
- onPointerMove: A,
590
- onPointerUp: I,
591
- onPointerCancel: I,
592
- onKeyDown: $,
593
- onDoubleClick: () => t == null ? void 0 : t.resetColumnWidths(),
594
- className: f(
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__ */ u(
750
+ children: /* @__PURE__ */ d(
601
751
  "span",
602
752
  {
603
753
  "aria-hidden": "true",
604
- className: f(
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
- be.displayName = "TableColumn";
621
- const Se = n.forwardRef(
622
- ({ className: r, align: e, sticky: a, sortValue: s, ...o }, c) => {
623
- const d = B(), v = n.useContext(ie), k = a === "right" && (d == null ? void 0 : d.elevatedActionColumn);
624
- return /* @__PURE__ */ u(
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: c,
628
- "data-sort-value": s instanceof Date ? s.toISOString() : s,
629
- className: f(
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
- le(v),
638
- se(e),
639
- a && ae(a, d == null ? void 0 : d.elevatedActionColumn),
640
- k && f(
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
- "bg-elevated",
646
- // Keep the action column on its elevated surface during hover.
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
- r
803
+ t
650
804
  ),
651
- ...o
805
+ ...c
652
806
  }
653
807
  );
654
808
  }
655
809
  );
656
- Se.displayName = "TableCell";
810
+ Ie.displayName = "TableCell";
657
811
  export {
658
- ze as Table,
659
- pe as TableBody,
660
- Se as TableCell,
661
- be as TableColumn,
662
- fe as TableHeader,
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
  };