@actioneer/ads 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/components/ai-elements/chain-of-thought.d.ts +64 -2
  2. package/components/ai-elements/chain-of-thought.js +319 -100
  3. package/components/ai-elements/chart.d.ts +30 -0
  4. package/components/ai-elements/chart.js +303 -0
  5. package/components/ai-elements/index.d.ts +2 -0
  6. package/components/ai-elements/message.d.ts +12 -2
  7. package/components/ai-elements/message.js +133 -100
  8. package/components/ai-elements/research-activity.d.ts +45 -0
  9. package/components/ai-elements/research-activity.js +260 -0
  10. package/components/ai-elements/tool.js +42 -38
  11. package/components/answer.d.ts +16 -0
  12. package/components/answer.js +273 -249
  13. package/components/assistant-ui/attachment.js +5 -1
  14. package/components/assistant-ui/composer-deep-research.js +44 -29
  15. package/components/assistant-ui/composer-harness.js +45 -27
  16. package/components/assistant-ui/composer.js +16 -16
  17. package/components/assistant-ui/index.d.ts +0 -1
  18. package/components/assistant-ui/message.d.ts +7 -0
  19. package/components/assistant-ui/message.js +36 -36
  20. package/components/assistant-ui/thread.js +1 -1
  21. package/components/brand-texture.d.ts +37 -0
  22. package/components/brand-texture.js +54 -0
  23. package/components/code-block.d.ts +36 -0
  24. package/components/code-block.js +136 -0
  25. package/components/drawer.d.ts +1 -1
  26. package/components/file-dropzone.d.ts +32 -0
  27. package/components/file-dropzone.js +134 -0
  28. package/components/index.d.ts +10 -0
  29. package/components/index.js +482 -433
  30. package/components/infinite-canvas.d.ts +50 -0
  31. package/components/infinite-canvas.js +215 -0
  32. package/components/page-header.d.ts +22 -0
  33. package/components/page-header.js +52 -0
  34. package/components/resizable-panel.d.ts +29 -0
  35. package/components/resizable-panel.js +102 -0
  36. package/components/reveal.d.ts +36 -0
  37. package/components/reveal.js +35 -0
  38. package/components/scroll-area.d.ts +19 -0
  39. package/components/scroll-area.js +57 -0
  40. package/components/setting-row.d.ts +35 -0
  41. package/components/setting-row.js +86 -0
  42. package/components/sidebar.js +131 -131
  43. package/components/stepper.d.ts +32 -0
  44. package/components/stepper.js +113 -0
  45. package/components/table.js +16 -15
  46. package/components/tabs.js +1 -1
  47. package/lib/icons.d.ts +12 -0
  48. package/lib/icons.js +98 -95
  49. package/lib/motion.d.ts +5 -3
  50. package/lib/motion.js +28 -27
  51. package/llms.txt +122 -28
  52. package/manifest.json +871 -73
  53. package/package.json +2 -2
  54. package/styles.css +71 -28
  55. package/theme.css +19 -15
  56. package/components/assistant-ui/smart-message-text.d.ts +0 -15
  57. package/components/assistant-ui/smart-message-text.js +0 -29
@@ -0,0 +1,303 @@
1
+ "use client";
2
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
3
+ import * as x from "react";
4
+ import { cva as M } from "class-variance-authority";
5
+ import { Badge as Q } from "../badge.js";
6
+ import { Button as T } from "../button.js";
7
+ import { Collapsible as V, CollapsibleTrigger as W, CollapsibleContent as E } from "../collapsible.js";
8
+ import { Skeleton as g } from "../skeleton.js";
9
+ import { Spinner as v } from "../spinner.js";
10
+ import { Database as O, ChevronDown as P, WarningCircle as S, Refresh as F, CloseCircle as G } from "../../lib/icons.js";
11
+ import { cn as d } from "../../lib/cn.js";
12
+ const H = M(
13
+ "w-full overflow-hidden rounded-lg text-foreground",
14
+ {
15
+ variants: {
16
+ status: {
17
+ pending: "[&_[data-slot=ai-chart-icon]]:text-tertiary [&_[data-slot=ai-chart-meta]]:text-tertiary",
18
+ querying: "[&_[data-slot=ai-chart-icon]]:text-info-700 [&_[data-slot=ai-chart-meta]]:text-info-700",
19
+ partial: "[&_[data-slot=ai-chart-icon]]:text-info-700 [&_[data-slot=ai-chart-meta]]:text-info-700",
20
+ rendering: "[&_[data-slot=ai-chart-icon]]:text-info-700 [&_[data-slot=ai-chart-meta]]:text-info-700",
21
+ ready: "[&_[data-slot=ai-chart-icon]]:text-secondary [&_[data-slot=ai-chart-meta]]:text-tertiary",
22
+ error: "[&_[data-slot=ai-chart-icon]]:text-danger-700 [&_[data-slot=ai-chart-meta]]:text-danger-700",
23
+ cancelled: "[&_[data-slot=ai-chart-icon]]:text-tertiary [&_[data-slot=ai-chart-meta]]:text-tertiary"
24
+ }
25
+ },
26
+ defaultVariants: { status: "ready" }
27
+ }
28
+ ), J = {
29
+ pending: "Pending",
30
+ querying: "Querying",
31
+ partial: "Receiving",
32
+ rendering: "Rendering",
33
+ ready: "Chart",
34
+ error: "Error",
35
+ cancelled: "Cancelled"
36
+ }, K = {
37
+ pending: "Chart pending",
38
+ querying: "Querying chart data",
39
+ partial: "Chart data partially received",
40
+ rendering: "Rendering chart",
41
+ ready: "Chart ready",
42
+ error: "Chart failed",
43
+ cancelled: "Chart cancelled"
44
+ }, L = {
45
+ pending: "Waiting for chart data",
46
+ querying: "Querying chart data",
47
+ rendering: "Rendering chart"
48
+ };
49
+ function U(t) {
50
+ if (t)
51
+ return t.total == null ? `${t.received} received` : `${t.received} of ${t.total} received`;
52
+ }
53
+ function X(t, r, n) {
54
+ const o = [
55
+ r ? r.total == null ? `${r.received} received` : `${r.received} / ${r.total}` : J[t]
56
+ ];
57
+ return n && o.push(n), o.join(" · ");
58
+ }
59
+ function Y({
60
+ status: t
61
+ }) {
62
+ return /* @__PURE__ */ a(
63
+ "div",
64
+ {
65
+ className: "relative h-40 overflow-hidden rounded-md",
66
+ "data-slot": "ai-chart-skeleton",
67
+ children: [
68
+ /* @__PURE__ */ e(g, { className: "absolute inset-0 h-full w-full" }),
69
+ /* @__PURE__ */ a("div", { className: "absolute inset-0 flex items-center justify-center gap-2 text-xs text-tertiary", children: [
70
+ t !== "pending" && /* @__PURE__ */ e(
71
+ v,
72
+ {
73
+ "aria-hidden": !0,
74
+ role: "presentation",
75
+ size: "sm",
76
+ color: "muted"
77
+ }
78
+ ),
79
+ /* @__PURE__ */ e("span", { children: L[t] })
80
+ ] })
81
+ ]
82
+ }
83
+ );
84
+ }
85
+ function Z({
86
+ status: t,
87
+ progress: r,
88
+ errorContent: n,
89
+ onRetry: o,
90
+ children: s
91
+ }) {
92
+ return t === "error" ? /* @__PURE__ */ a(
93
+ "div",
94
+ {
95
+ className: "flex min-h-40 flex-col items-center justify-center gap-3 rounded-md bg-surface p-4 text-center",
96
+ "data-slot": "ai-chart-error",
97
+ children: [
98
+ /* @__PURE__ */ e(S, { className: "size-5 text-danger-700", "aria-hidden": !0 }),
99
+ /* @__PURE__ */ e("div", { className: "text-xs text-secondary", children: n ?? "The chart could not be generated." }),
100
+ o && /* @__PURE__ */ e(
101
+ T,
102
+ {
103
+ type: "button",
104
+ size: "sm",
105
+ variant: "secondary",
106
+ startContent: /* @__PURE__ */ e(F, { "aria-hidden": !0 }),
107
+ onClick: o,
108
+ children: "Retry"
109
+ }
110
+ )
111
+ ]
112
+ }
113
+ ) : t === "cancelled" ? /* @__PURE__ */ a(
114
+ "div",
115
+ {
116
+ className: "flex min-h-40 flex-col items-center justify-center gap-2 rounded-md bg-surface p-4 text-center",
117
+ "data-slot": "ai-chart-cancelled",
118
+ children: [
119
+ /* @__PURE__ */ e(G, { className: "size-5 text-tertiary", "aria-hidden": !0 }),
120
+ /* @__PURE__ */ e("p", { className: "text-xs text-secondary", children: "Chart generation was cancelled." })
121
+ ]
122
+ }
123
+ ) : t === "partial" ? /* @__PURE__ */ a("div", { className: "space-y-2", "data-slot": "ai-chart-partial", children: [
124
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-2 text-xs text-info-700", children: [
125
+ /* @__PURE__ */ e(
126
+ v,
127
+ {
128
+ "aria-hidden": !0,
129
+ role: "presentation",
130
+ size: "sm",
131
+ color: "current"
132
+ }
133
+ ),
134
+ /* @__PURE__ */ e("span", { children: U(r) ?? "Receiving chart data" })
135
+ ] }),
136
+ /* @__PURE__ */ e("div", { className: "min-h-40", children: s ?? /* @__PURE__ */ e(g, { className: "h-40 w-full" }) })
137
+ ] }) : t !== "ready" ? /* @__PURE__ */ e(Y, { status: t }) : (
138
+ // The ready chart draws itself in left→right (the reveal wipe) instead of
139
+ // popping after the loading state — data entrance, not chrome.
140
+ /* @__PURE__ */ e("div", { className: "ads-reveal ads-reveal-wipe min-h-40", "data-slot": "ai-chart-visual", children: s })
141
+ );
142
+ }
143
+ const ee = x.forwardRef(
144
+ ({
145
+ className: t,
146
+ status: r,
147
+ title: n,
148
+ tag: o,
149
+ source: s,
150
+ progress: l,
151
+ elapsed: y,
152
+ meta: c,
153
+ accessibleSummary: u,
154
+ open: b,
155
+ defaultOpen: N = !1,
156
+ onOpenChange: C,
157
+ onSourceSelect: m,
158
+ errorContent: _,
159
+ onRetry: w,
160
+ children: k,
161
+ role: A = "region",
162
+ "aria-label": R,
163
+ "aria-describedby": j,
164
+ "aria-busy": z,
165
+ ...I
166
+ }, $) => {
167
+ const i = r ?? "ready", B = i === "querying" || i === "partial" || i === "rendering", h = c !== void 0 ? c : X(i, l, y), q = K[i], f = x.useId(), p = i === "ready" && u != null, D = [
168
+ j,
169
+ p ? f : void 0
170
+ ].filter(Boolean).join(" ") || void 0;
171
+ return /* @__PURE__ */ a(
172
+ V,
173
+ {
174
+ ref: $,
175
+ open: b,
176
+ defaultOpen: N,
177
+ onOpenChange: C,
178
+ role: A,
179
+ "aria-label": R ?? (typeof n == "string" ? n : "AI chart evidence"),
180
+ "aria-describedby": D,
181
+ "data-slot": "ai-chart",
182
+ "data-status": i,
183
+ className: d(H({ status: i }), t),
184
+ ...I,
185
+ children: [
186
+ /* @__PURE__ */ e(
187
+ "span",
188
+ {
189
+ className: "sr-only",
190
+ role: "status",
191
+ "aria-live": "polite",
192
+ "aria-atomic": "true",
193
+ children: q
194
+ }
195
+ ),
196
+ p && /* @__PURE__ */ e("span", { id: f, className: "sr-only", children: u }),
197
+ /* @__PURE__ */ e(W, { asChild: !0, children: /* @__PURE__ */ a(
198
+ "button",
199
+ {
200
+ type: "button",
201
+ className: d(
202
+ "group/ai-chart-trigger flex min-h-9 w-full items-center gap-2 rounded-md px-1 py-1 text-left",
203
+ "outline-none transition-[background,color,transform] duration-(--duration-fast) ease-out hover:bg-muted active:scale-(--scale-press)",
204
+ "focus-visible:ring-3 focus-visible:ring-inset focus-visible:ring-ring motion-reduce:transition-none"
205
+ ),
206
+ children: [
207
+ /* @__PURE__ */ e(
208
+ O,
209
+ {
210
+ "data-slot": "ai-chart-icon",
211
+ className: "size-4 shrink-0",
212
+ "aria-hidden": !0
213
+ }
214
+ ),
215
+ /* @__PURE__ */ e("span", { className: "min-w-0 truncate text-xs font-medium text-secondary", children: n }),
216
+ o != null && /* @__PURE__ */ e(
217
+ Q,
218
+ {
219
+ className: "shrink-0 rounded-sm px-1.5 font-normal",
220
+ color: "default",
221
+ variant: "solid",
222
+ children: o
223
+ }
224
+ ),
225
+ h != null && /* @__PURE__ */ e(
226
+ "span",
227
+ {
228
+ "data-slot": "ai-chart-meta",
229
+ className: "ml-auto shrink-0 text-xs tabular-nums",
230
+ children: h
231
+ }
232
+ ),
233
+ /* @__PURE__ */ e(
234
+ P,
235
+ {
236
+ className: "size-4 shrink-0 text-tertiary transition-transform duration-(--duration-normal) ease-out group-data-[state=open]/ai-chart-trigger:rotate-180 motion-reduce:transition-none",
237
+ "aria-hidden": !0
238
+ }
239
+ )
240
+ ]
241
+ }
242
+ ) }),
243
+ /* @__PURE__ */ a(
244
+ E,
245
+ {
246
+ className: d(
247
+ "overflow-hidden px-2.5 pb-2.5 outline-none",
248
+ "data-[state=closed]:pointer-events-none data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:animate-none"
249
+ ),
250
+ children: [
251
+ /* @__PURE__ */ e(
252
+ "div",
253
+ {
254
+ "data-slot": "ai-chart-body",
255
+ "aria-busy": z ?? (B || void 0),
256
+ children: /* @__PURE__ */ e(
257
+ Z,
258
+ {
259
+ status: i,
260
+ progress: l,
261
+ errorContent: _,
262
+ onRetry: w,
263
+ children: k
264
+ }
265
+ )
266
+ }
267
+ ),
268
+ s && /* @__PURE__ */ e(
269
+ "div",
270
+ {
271
+ className: "mt-2 text-xs text-tertiary",
272
+ "data-slot": "ai-chart-source",
273
+ children: m ? /* @__PURE__ */ a(
274
+ "button",
275
+ {
276
+ type: "button",
277
+ className: "rounded-sm text-left outline-none transition-colors duration-(--duration-fast) ease-out hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring motion-reduce:transition-none",
278
+ "aria-label": `Open source ${s}`,
279
+ onClick: () => m(s),
280
+ children: [
281
+ "from ",
282
+ /* @__PURE__ */ e("span", { className: "font-medium tabular-nums", children: s })
283
+ ]
284
+ }
285
+ ) : /* @__PURE__ */ a("p", { children: [
286
+ "from ",
287
+ /* @__PURE__ */ e("span", { className: "font-medium tabular-nums", children: s })
288
+ ] })
289
+ }
290
+ )
291
+ ]
292
+ }
293
+ )
294
+ ]
295
+ }
296
+ );
297
+ }
298
+ );
299
+ ee.displayName = "AIChart";
300
+ export {
301
+ ee as AIChart,
302
+ H as aiChartVariants
303
+ };
@@ -1,7 +1,9 @@
1
1
  export * from './chain-of-thought';
2
+ export * from './chart';
2
3
  export * from './inline-citation';
3
4
  export * from './message';
4
5
  export * from './queue';
6
+ export * from './research-activity';
5
7
  export * from './shimmer';
6
8
  export * from './speech-input';
7
9
  export * from './task';
@@ -31,12 +31,22 @@ export declare const Message: React.ForwardRefExoticComponent<Omit<React.HTMLAtt
31
31
  from: MessageRole;
32
32
  } & React.RefAttributes<HTMLDivElement>>;
33
33
  declare const messageContentVariants: (props?: ({
34
- variant?: "flat" | "contained" | "plain" | null | undefined;
34
+ variant?: "flat" | "plain" | "contained" | "request" | null | undefined;
35
35
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
36
36
  export type MessageContentProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof messageContentVariants>;
37
37
  export declare const MessageContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
38
- variant?: "flat" | "contained" | "plain" | null | undefined;
38
+ variant?: "flat" | "plain" | "contained" | "request" | null | undefined;
39
39
  } & import('class-variance-authority/types').ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
40
+ export type MessageMetaProps = React.HTMLAttributes<HTMLDivElement>;
41
+ /**
42
+ * The quiet line beneath a request — when it was sent, and the parameters it
43
+ * carried (harness, research mode, sources). Place it after the question so
44
+ * the question leads and the metadata supports it.
45
+ *
46
+ * It resets the display typography the `request` variant applies to the user
47
+ * turn; without that reset the metadata inherits the question's size.
48
+ */
49
+ export declare const MessageMeta: React.ForwardRefExoticComponent<MessageMetaProps & React.RefAttributes<HTMLDivElement>>;
40
50
  export type MessageAvatarProps = React.HTMLAttributes<HTMLSpanElement> & {
41
51
  src: string;
42
52
  name?: string;