@actioneer/ads 0.5.1 → 0.5.2

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.
@@ -82,7 +82,7 @@ const H = t.forwardRef(
82
82
  {
83
83
  "aria-hidden": !0,
84
84
  className: f(
85
- "w-px bg-transparent",
85
+ "my-3 w-px rounded-full bg-transparent",
86
86
  "transition-colors duration-(--duration-fast) ease-out motion-reduce:transition-none",
87
87
  "group-hover/resize:bg-border-strong group-focus-visible/resize:bg-ring",
88
88
  c && "bg-ring"
@@ -23,6 +23,16 @@ export interface TableProps extends Omit<React.TableHTMLAttributes<HTMLTableElem
23
23
  onSelectionChange?: (keys: Set<string>) => void;
24
24
  /** All row keys on the current page — powers the header "select all". */
25
25
  rowKeys?: string[];
26
+ /**
27
+ * Turns the final `sticky="right"` column into a persistent action surface.
28
+ * Its cells stay on `bg-elevated` while one Table-level `shadow-elevation`
29
+ * spans the body below the muted header instead of repeating on every cell.
30
+ * The matching header cell stays transparent and scrolls normally, so it
31
+ * never becomes a blank sticky surface over the header labels.
32
+ */
33
+ elevatedActionColumn?: boolean;
34
+ /** Width shared by the sticky action cells and their elevation surface. */
35
+ actionColumnWidth?: string;
26
36
  sortDescriptor?: SortDescriptor;
27
37
  onSortChange?: (descriptor: SortDescriptor) => void;
28
38
  }
@@ -1,255 +1,318 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as y } from "react/jsx-runtime";
3
- import * as s from "react";
4
- import { cn as o } from "../lib/cn.js";
5
- import { Checkbox as _ } from "./checkbox.js";
6
- import { ChevronUp as F, ChevronDown as I, SortIcon as M } from "../lib/icons.js";
7
- const S = (e) => e === "center" ? "text-center" : e === "right" ? "text-right" : "text-left", P = (e) => e === "left" ? "sticky left-0 z-10 shadow-[8px_0_20px_-8px_rgba(0,0,0,0.08)]" : e === "right" ? "sticky right-0 z-10 shadow-[-8px_0_20px_-8px_rgba(0,0,0,0.08)]" : void 0, q = o(
2
+ import { jsx as o, jsxs as y } from "react/jsx-runtime";
3
+ import * as n from "react";
4
+ import { cn as t } from "../lib/cn.js";
5
+ import { Checkbox as A } from "./checkbox.js";
6
+ import { ChevronUp as I, ChevronDown as M, SortIcon as U } from "../lib/icons.js";
7
+ const P = (l) => l === "center" ? "text-center" : l === "right" ? "text-right" : "text-left", q = (l, r = !1) => l === "left" ? "sticky left-0 z-10 shadow-[8px_0_20px_-8px_rgba(0,0,0,0.08)]" : l === "right" ? t(
8
+ "sticky right-0 z-10",
9
+ // Backward-compatible fallback. Action columns should opt into the
10
+ // Table-level elevation so one shadow spans the complete column.
11
+ !r && "shadow-[-8px_0_20px_-8px_rgba(0,0,0,0.08)]"
12
+ ) : void 0, B = t(
8
13
  "bg-card align-middle transition-colors",
9
14
  // Row separators — functional hairline, none under the last row.
10
15
  "border-b border-border group-last/row:border-b-0",
11
- // Hover/selected: translucent white over the gray shell (HeroUI's trick —
12
- // the row "sinks" toward the shell instead of picking up a new tint).
13
- "group-hover/row:bg-card/40",
14
- "group-data-[selected]/row:bg-card/10"
15
- ), U = o(
16
+ // Restore the original quiet neutral hover: the row softly sinks toward the
17
+ // shell instead of picking up a brand tint or a new rounded silhouette. The
18
+ // wash is pre-composited so scrolled text cannot show through sticky cells.
19
+ "group-hover/row:bg-(--table-row-hover) group-focus-within/row:bg-(--table-row-hover)",
20
+ "group-data-[selected]/row:bg-(--table-row-selected)"
21
+ ), $ = t(
16
22
  "group-first/row:rounded-tl-[calc(var(--radius-2xl)-var(--spacing))]",
17
23
  "group-last/row:rounded-bl-[calc(var(--radius-2xl)-var(--spacing))]"
18
- ), $ = o(
24
+ ), G = t(
19
25
  "group-first/row:first:rounded-tl-[calc(var(--radius-2xl)-var(--spacing))]",
20
26
  "group-first/row:last:rounded-tr-[calc(var(--radius-2xl)-var(--spacing))]",
21
27
  "group-last/row:first:rounded-bl-[calc(var(--radius-2xl)-var(--spacing))]",
22
28
  "group-last/row:last:rounded-br-[calc(var(--radius-2xl)-var(--spacing))]"
23
- ), A = o(
29
+ ), j = t(
24
30
  "after:pointer-events-none after:absolute after:right-0 after:top-1/2",
25
31
  "after:h-4 after:w-px after:-translate-y-1/2 after:rounded-sm",
26
32
  "after:bg-border-strong last:after:hidden"
27
- ), B = s.createContext(null), j = () => s.useContext(B), C = s.createContext("body"), E = s.forwardRef(
33
+ ), H = n.createContext(null), T = () => n.useContext(H), z = n.createContext("body"), J = n.forwardRef(
28
34
  ({
29
- className: e,
30
- wrapperClassName: a,
31
- footer: l,
32
- children: b,
33
- selectionMode: p = "none",
34
- selectedKeys: d,
35
+ className: l,
36
+ wrapperClassName: r,
37
+ footer: s,
38
+ children: d,
39
+ selectionMode: m = "none",
40
+ selectedKeys: e,
35
41
  onSelectionChange: i,
36
- rowKeys: t,
37
- sortDescriptor: n,
38
- onSortChange: m,
39
- ...w
40
- }, h) => {
41
- const f = s.useMemo(() => t ?? [], [t]), g = d === "all", u = g ? null : d ?? /* @__PURE__ */ new Set(), N = s.useCallback(
42
- (c) => g || !!(u != null && u.has(c)),
43
- [g, u]
44
- ), v = f.length > 0 && (g || f.every((c) => u == null ? void 0 : u.has(c))), T = !v && (g || f.some((c) => u == null ? void 0 : u.has(c))), k = s.useCallback(
42
+ rowKeys: a,
43
+ elevatedActionColumn: p = !1,
44
+ actionColumnWidth: g = "4rem",
45
+ sortDescriptor: v,
46
+ onSortChange: b,
47
+ ...N
48
+ }, E) => {
49
+ const w = n.useMemo(() => a ?? [], [a]), f = e === "all", u = f ? null : e ?? /* @__PURE__ */ new Set(), C = n.useCallback(
50
+ (c) => f || !!(u != null && u.has(c)),
51
+ [f, u]
52
+ ), x = w.length > 0 && (f || w.every((c) => u == null ? void 0 : u.has(c))), R = !x && (f || w.some((c) => u == null ? void 0 : u.has(c))), _ = n.useCallback(
45
53
  (c) => {
46
54
  if (!i) return;
47
- if (p === "single") {
48
- i(N(c) ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([c]));
55
+ if (m === "single") {
56
+ i(C(c) ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([c]));
49
57
  return;
50
58
  }
51
- const x = new Set(g ? f : u ?? /* @__PURE__ */ new Set());
52
- x.has(c) ? x.delete(c) : x.add(c), i(x);
59
+ const h = new Set(f ? w : u ?? /* @__PURE__ */ new Set());
60
+ h.has(c) ? h.delete(c) : h.add(c), i(h);
53
61
  },
54
- [i, p, N, g, f, u]
55
- ), z = s.useCallback(() => {
56
- i && i(v ? /* @__PURE__ */ new Set() : new Set(f));
57
- }, [i, v, f]), R = s.useCallback(
62
+ [i, m, C, f, w, u]
63
+ ), k = n.useCallback(() => {
64
+ i && i(x ? /* @__PURE__ */ new Set() : new Set(w));
65
+ }, [i, x, w]), S = n.useCallback(
58
66
  (c) => {
59
- if (!m) return;
60
- const x = (n == null ? void 0 : n.column) === c && n.direction === "ascending" ? "descending" : "ascending";
61
- m({ column: c, direction: x });
67
+ if (!b) return;
68
+ const h = (v == null ? void 0 : v.column) === c && v.direction === "ascending" ? "descending" : "ascending";
69
+ b({ column: c, direction: h });
62
70
  },
63
- [m, n]
64
- ), H = s.useMemo(
71
+ [b, v]
72
+ ), F = n.useMemo(
65
73
  () => ({
66
- selectionMode: p,
67
- isSelected: N,
68
- toggleKey: k,
69
- toggleAll: z,
70
- allSelected: v,
71
- someSelected: T,
72
- sortDescriptor: n,
73
- requestSort: m ? R : void 0
74
+ selectionMode: m,
75
+ isSelected: C,
76
+ toggleKey: _,
77
+ toggleAll: k,
78
+ allSelected: x,
79
+ someSelected: R,
80
+ sortDescriptor: v,
81
+ requestSort: b ? S : void 0,
82
+ elevatedActionColumn: p
74
83
  }),
75
84
  [
76
- p,
77
- N,
85
+ m,
86
+ C,
87
+ _,
78
88
  k,
79
- z,
89
+ x,
90
+ R,
80
91
  v,
81
- T,
82
- n,
83
- m,
84
- R
92
+ b,
93
+ S,
94
+ p
85
95
  ]
86
96
  );
87
- return /* @__PURE__ */ r(B.Provider, { value: H, children: /* @__PURE__ */ y(
97
+ return /* @__PURE__ */ o(H.Provider, { value: F, children: /* @__PURE__ */ y(
88
98
  "div",
89
99
  {
90
- className: o(
100
+ className: t(
91
101
  "overflow-clip rounded-2xl bg-muted px-1 pb-1",
92
- a
102
+ r
93
103
  ),
94
104
  children: [
95
- /* @__PURE__ */ r("div", { className: "overflow-x-auto", children: /* @__PURE__ */ r(
96
- "table",
105
+ /* @__PURE__ */ y(
106
+ "div",
97
107
  {
98
- ref: h,
99
- "data-slot": "table",
100
- className: o(
101
- "w-full border-separate border-spacing-0 text-xs",
102
- e
103
- ),
104
- ...w,
105
- children: b
108
+ className: "relative",
109
+ style: p ? {
110
+ "--table-action-column-width": g
111
+ } : void 0,
112
+ children: [
113
+ /* @__PURE__ */ o("div", { className: "overflow-x-auto rounded-[calc(var(--radius-2xl)-var(--spacing))]", children: /* @__PURE__ */ o(
114
+ "table",
115
+ {
116
+ ref: E,
117
+ "data-slot": "table",
118
+ className: t(
119
+ "w-full border-separate border-spacing-0 text-xs",
120
+ l
121
+ ),
122
+ ...N,
123
+ children: d
124
+ }
125
+ ) }),
126
+ p && /* @__PURE__ */ o(
127
+ "div",
128
+ {
129
+ "aria-hidden": "true",
130
+ "data-slot": "table-action-column-elevation",
131
+ className: t(
132
+ "pointer-events-none absolute inset-y-0 right-0 z-20",
133
+ "w-[var(--table-action-column-width)]",
134
+ "rounded-br-[calc(var(--radius-2xl)-var(--spacing))]",
135
+ "shadow-elevation"
136
+ )
137
+ }
138
+ )
139
+ ]
106
140
  }
107
- ) }),
108
- l && /* @__PURE__ */ r("div", { className: "flex items-center px-4 py-2.5", children: l })
141
+ ),
142
+ s && /* @__PURE__ */ o("div", { className: "flex items-center px-4 py-2.5", children: s })
109
143
  ]
110
144
  }
111
145
  ) });
112
146
  }
113
147
  );
114
- E.displayName = "Table";
115
- const G = s.forwardRef(({ className: e, ...a }, l) => /* @__PURE__ */ r(C.Provider, { value: "header", children: /* @__PURE__ */ r(
116
- "thead",
117
- {
118
- ref: l,
119
- className: o("text-xs text-muted-foreground", e),
120
- ...a
121
- }
122
- ) }));
123
- G.displayName = "TableHeader";
124
- const J = s.forwardRef(({ className: e, ...a }, l) => /* @__PURE__ */ r(C.Provider, { value: "body", children: /* @__PURE__ */ r("tbody", { ref: l, className: o(e), ...a }) }));
125
- J.displayName = "TableBody";
126
- const L = s.forwardRef(
127
- ({ className: e, rowKey: a, children: l, ...b }, p) => {
128
- const d = j(), i = s.useContext(C), t = !!d && d.selectionMode !== "none", n = t && i === "body" && a !== void 0 ? d.isSelected(a) : !1;
148
+ J.displayName = "Table";
149
+ const L = n.forwardRef(({ className: l, ...r }, s) => {
150
+ const d = T();
151
+ return /* @__PURE__ */ o(z.Provider, { value: "header", children: /* @__PURE__ */ o(
152
+ "thead",
153
+ {
154
+ ref: s,
155
+ className: t(
156
+ "text-xs text-muted-foreground",
157
+ (d == null ? void 0 : d.elevatedActionColumn) && "relative z-30 bg-muted",
158
+ l
159
+ ),
160
+ ...r
161
+ }
162
+ ) });
163
+ });
164
+ L.displayName = "TableHeader";
165
+ const O = n.forwardRef(({ className: l, ...r }, s) => /* @__PURE__ */ o(z.Provider, { value: "body", children: /* @__PURE__ */ o("tbody", { ref: s, className: t(l), ...r }) }));
166
+ O.displayName = "TableBody";
167
+ const Q = n.forwardRef(
168
+ ({ className: l, rowKey: r, children: s, ...d }, m) => {
169
+ const e = T(), i = n.useContext(z), a = !!e && e.selectionMode !== "none", p = a && i === "body" && r !== void 0 ? e.isSelected(r) : !1;
129
170
  return /* @__PURE__ */ y(
130
171
  "tr",
131
172
  {
132
- ref: p,
133
- "data-selected": n || void 0,
134
- className: o("group/row", e),
135
- ...b,
173
+ ref: m,
174
+ "data-selected": p || void 0,
175
+ className: t("group/row", l),
176
+ ...d,
136
177
  children: [
137
- t && (i === "header" ? /* @__PURE__ */ r(
178
+ a && (i === "header" ? /* @__PURE__ */ o(
138
179
  "th",
139
180
  {
140
181
  scope: "col",
141
- className: o(
182
+ className: t(
142
183
  "w-10 px-4 py-2.5",
143
- A,
184
+ j,
144
185
  // Sticky without the baked shadow — an always-on smudge
145
186
  // muddies the shell's corners (elevation = actionability).
146
187
  // (sticky is positioned, so the ::after tick anchors to it —
147
188
  // no `relative` needed, and it would conflict with sticky.)
148
189
  "sticky left-0 z-10 bg-muted"
149
190
  ),
150
- children: d.selectionMode === "multiple" && /* @__PURE__ */ r(
151
- _,
191
+ children: e.selectionMode === "multiple" && /* @__PURE__ */ o(
192
+ A,
152
193
  {
153
194
  size: "sm",
154
195
  "aria-label": "Select all rows",
155
- checked: d.allSelected,
156
- indeterminate: d.someSelected,
157
- onChange: d.toggleAll
196
+ checked: e.allSelected,
197
+ indeterminate: e.someSelected,
198
+ onChange: e.toggleAll
158
199
  }
159
200
  )
160
201
  }
161
- ) : /* @__PURE__ */ r(
202
+ ) : /* @__PURE__ */ o(
162
203
  "td",
163
204
  {
164
- className: o(
205
+ className: t(
165
206
  "w-10 px-4 py-3",
166
- q,
167
- U,
207
+ B,
208
+ $,
168
209
  "sticky left-0 z-10"
169
210
  ),
170
- onClick: (m) => m.stopPropagation(),
171
- children: a !== void 0 && /* @__PURE__ */ r(
172
- _,
211
+ onClick: (g) => g.stopPropagation(),
212
+ children: r !== void 0 && /* @__PURE__ */ o(
213
+ A,
173
214
  {
174
215
  size: "sm",
175
- "aria-label": `Select ${a}`,
176
- checked: n,
177
- onChange: () => d.toggleKey(a)
216
+ "aria-label": `Select ${r}`,
217
+ checked: p,
218
+ onChange: () => e.toggleKey(r)
178
219
  }
179
220
  )
180
221
  }
181
222
  )),
182
- l
223
+ s
183
224
  ]
184
225
  }
185
226
  );
186
227
  }
187
228
  );
188
- L.displayName = "TableRow";
189
- const O = s.forwardRef(({ className: e, align: a, sticky: l, sortKey: b, children: p, ...d }, i) => {
190
- var h, f;
191
- const t = j(), n = !!b && !!(t != null && t.requestSort), m = n && ((h = t == null ? void 0 : t.sortDescriptor) == null ? void 0 : h.column) === b, w = (f = t == null ? void 0 : t.sortDescriptor) == null ? void 0 : f.direction;
192
- return /* @__PURE__ */ r(
229
+ Q.displayName = "TableRow";
230
+ const V = n.forwardRef(({ className: l, align: r, sticky: s, sortKey: d, children: m, ...e }, i) => {
231
+ var b, N;
232
+ const a = T(), p = !!d && !!(a != null && a.requestSort), g = p && ((b = a == null ? void 0 : a.sortDescriptor) == null ? void 0 : b.column) === d, v = (N = a == null ? void 0 : a.sortDescriptor) == null ? void 0 : N.direction;
233
+ return /* @__PURE__ */ o(
193
234
  "th",
194
235
  {
195
236
  ref: i,
196
237
  scope: "col",
197
- "aria-sort": m ? w === "ascending" ? "ascending" : "descending" : n ? "none" : void 0,
198
- className: o(
238
+ "aria-sort": g ? v === "ascending" ? "ascending" : "descending" : p ? "none" : void 0,
239
+ className: t(
199
240
  // whitespace-nowrap: header labels hug their content — the table
200
241
  // scrolls horizontally, so wrapping "Null %" to two lines only
201
242
  // wastes header height without saving any width.
202
243
  "relative whitespace-nowrap px-4 py-2.5 font-medium",
203
- A,
204
- S(a),
205
- l && o(P(l), "bg-muted"),
206
- e
244
+ j,
245
+ P(r),
246
+ s && (s === "right" && (a != null && a.elevatedActionColumn) ? t(
247
+ // Preserve the semantic column width, but do not pin or paint
248
+ // a blank header cell over the labels behind it. Only body
249
+ // action cells participate in the sticky elevated surface.
250
+ "w-[var(--table-action-column-width)]",
251
+ "min-w-[var(--table-action-column-width)]",
252
+ "max-w-[var(--table-action-column-width)]",
253
+ "bg-transparent"
254
+ ) : t(q(s), "bg-muted")),
255
+ l
207
256
  ),
208
- ...d,
209
- children: n ? /* @__PURE__ */ y(
257
+ ...e,
258
+ children: p ? /* @__PURE__ */ y(
210
259
  "button",
211
260
  {
212
261
  type: "button",
213
- onClick: () => t.requestSort(b),
214
- className: o(
262
+ onClick: () => a.requestSort(d),
263
+ className: t(
215
264
  "group/sort -mx-1 inline-flex items-center gap-1 rounded px-1 outline-none transition-colors",
216
265
  "hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
217
- a === "right" && "flex-row-reverse",
218
- m && "text-foreground"
266
+ r === "right" && "flex-row-reverse",
267
+ g && "text-foreground"
219
268
  ),
220
269
  children: [
221
- p,
222
- m ? w === "ascending" ? /* @__PURE__ */ r(F, { className: "size-3.5" }) : /* @__PURE__ */ r(I, { className: "size-3.5" }) : /* @__PURE__ */ r(M, { className: "size-3.5 opacity-0 transition-opacity group-hover/sort:opacity-60" })
270
+ m,
271
+ g ? v === "ascending" ? /* @__PURE__ */ o(I, { className: "size-3.5" }) : /* @__PURE__ */ o(M, { className: "size-3.5" }) : /* @__PURE__ */ o(U, { className: "size-3.5 opacity-0 transition-opacity group-hover/sort:opacity-60" })
223
272
  ]
224
273
  }
225
- ) : p
274
+ ) : m
226
275
  }
227
276
  );
228
277
  });
229
- O.displayName = "TableColumn";
230
- const Q = s.forwardRef(
231
- ({ className: e, align: a, sticky: l, ...b }, p) => /* @__PURE__ */ r(
232
- "td",
233
- {
234
- ref: p,
235
- className: o(
236
- "px-4 py-3",
237
- q,
238
- $,
239
- S(a),
240
- l && P(l),
241
- e
242
- ),
243
- ...b
244
- }
245
- )
278
+ V.displayName = "TableColumn";
279
+ const W = n.forwardRef(
280
+ ({ className: l, align: r, sticky: s, ...d }, m) => {
281
+ const e = T(), i = s === "right" && (e == null ? void 0 : e.elevatedActionColumn);
282
+ return /* @__PURE__ */ o(
283
+ "td",
284
+ {
285
+ ref: m,
286
+ className: t(
287
+ // whitespace-nowrap: cell content never wraps — the table's
288
+ // overflow-x-auto viewport scrolls horizontally instead, matching the
289
+ // header cells. Opt back into wrapping with `whitespace-normal` for
290
+ // deliberate multi-line content (e.g. an EmptyState in a colSpan cell).
291
+ "whitespace-nowrap px-4 py-3",
292
+ B,
293
+ G,
294
+ P(r),
295
+ s && q(s, e == null ? void 0 : e.elevatedActionColumn),
296
+ i && t(
297
+ "w-[var(--table-action-column-width)]",
298
+ "min-w-[var(--table-action-column-width)]",
299
+ "max-w-[var(--table-action-column-width)]",
300
+ "bg-elevated",
301
+ "group-hover/row:bg-elevated group-focus-within/row:bg-elevated"
302
+ ),
303
+ l
304
+ ),
305
+ ...d
306
+ }
307
+ );
308
+ }
246
309
  );
247
- Q.displayName = "TableCell";
310
+ W.displayName = "TableCell";
248
311
  export {
249
- E as Table,
250
- J as TableBody,
251
- Q as TableCell,
252
- O as TableColumn,
253
- G as TableHeader,
254
- L as TableRow
312
+ J as Table,
313
+ O as TableBody,
314
+ W as TableCell,
315
+ V as TableColumn,
316
+ L as TableHeader,
317
+ Q as TableRow
255
318
  };
package/lib/icons.d.ts CHANGED
@@ -388,6 +388,14 @@ export declare const Users: {
388
388
  (props: IconProps): React.JSX.Element;
389
389
  displayName: string;
390
390
  };
391
+ export declare const Play: {
392
+ (props: IconProps): React.JSX.Element;
393
+ displayName: string;
394
+ };
395
+ export declare const Pause: {
396
+ (props: IconProps): React.JSX.Element;
397
+ displayName: string;
398
+ };
391
399
  export declare const Paperclip: {
392
400
  (props: IconProps): React.JSX.Element;
393
401
  displayName: string;