@actioneer/ads 0.2.3 → 0.2.4

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.
@@ -1,29 +1,36 @@
1
1
  import { Badge } from '../badge';
2
- import { CollapsibleContent, CollapsibleTrigger } from '../collapsible';
3
- import { ComponentProps, ComponentType, ReactNode } from 'react';
4
- export type ChainOfThoughtProps = ComponentProps<"div"> & {
5
- open?: boolean;
6
- defaultOpen?: boolean;
7
- onOpenChange?: (open: boolean) => void;
2
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../collapsible';
3
+ import { ComponentProps, ReactNode } from 'react';
4
+ /**
5
+ * A step-first reasoning trace. The root is intentionally only a list: each
6
+ * step owns its own disclosure so the trace does not need a redundant global
7
+ * "Chain of Thought" trigger above it.
8
+ */
9
+ export type ChainOfThoughtProps = ComponentProps<"div">;
10
+ export declare const ChainOfThought: import('react').MemoExoticComponent<({ className, role, ...props }: ChainOfThoughtProps) => import("react").JSX.Element>;
11
+ export type ChainOfThoughtStatus = "complete" | "active" | "pending";
12
+ export type ChainOfThoughtStepProps = ComponentProps<typeof Collapsible> & {
13
+ status?: ChainOfThoughtStatus;
8
14
  };
9
- export declare const ChainOfThought: import('react').MemoExoticComponent<({ className, open, defaultOpen, onOpenChange, children, ...props }: ChainOfThoughtProps) => import("react").JSX.Element>;
10
- export type ChainOfThoughtHeaderProps = ComponentProps<typeof CollapsibleTrigger>;
11
- export declare const ChainOfThoughtHeader: import('react').MemoExoticComponent<({ className, children, ...props }: ChainOfThoughtHeaderProps) => import("react").JSX.Element>;
12
- export type ChainOfThoughtStepProps = ComponentProps<"div"> & {
13
- icon?: ComponentType<{
14
- className?: string;
15
- }>;
16
- label: ReactNode;
17
- description?: ReactNode;
18
- status?: "complete" | "active" | "pending";
15
+ export declare const ChainOfThoughtStep: import('react').MemoExoticComponent<({ className, defaultOpen, status, role, ...props }: ChainOfThoughtStepProps) => import("react").JSX.Element>;
16
+ export type ChainOfThoughtTriggerProps = Omit<ComponentProps<typeof CollapsibleTrigger>, "asChild" | "children"> & {
17
+ children: ReactNode;
18
+ /** Semantic icon rendered on the reasoning rail. */
19
+ leftIcon?: ReactNode;
20
+ /** Optional trailing metadata such as elapsed time. */
21
+ endContent?: ReactNode;
22
+ /** Swap the semantic icon for a disclosure affordance on hover. */
23
+ swapIconOnHover?: boolean;
19
24
  };
20
- export declare const ChainOfThoughtStep: import('react').MemoExoticComponent<({ className, icon: Icon, label, description, status, children, ...props }: ChainOfThoughtStepProps) => import("react").JSX.Element>;
25
+ export declare const ChainOfThoughtTrigger: import('react').MemoExoticComponent<({ className, children, leftIcon, endContent, swapIconOnHover, ...props }: ChainOfThoughtTriggerProps) => import("react").JSX.Element>;
26
+ export type ChainOfThoughtContentProps = ComponentProps<typeof CollapsibleContent>;
27
+ export declare const ChainOfThoughtContent: import('react').MemoExoticComponent<({ className, children, ...props }: ChainOfThoughtContentProps) => import("react").JSX.Element>;
28
+ export type ChainOfThoughtItemProps = ComponentProps<"div">;
29
+ export declare const ChainOfThoughtItem: import('react').MemoExoticComponent<({ className, ...props }: ChainOfThoughtItemProps) => import("react").JSX.Element>;
21
30
  export type ChainOfThoughtSearchResultsProps = ComponentProps<"div">;
22
31
  export declare const ChainOfThoughtSearchResults: import('react').MemoExoticComponent<({ className, ...props }: ChainOfThoughtSearchResultsProps) => import("react").JSX.Element>;
23
32
  export type ChainOfThoughtSearchResultProps = ComponentProps<typeof Badge>;
24
33
  export declare const ChainOfThoughtSearchResult: import('react').MemoExoticComponent<({ className, children, ...props }: ChainOfThoughtSearchResultProps) => import("react").JSX.Element>;
25
- export type ChainOfThoughtContentProps = ComponentProps<typeof CollapsibleContent>;
26
- export declare const ChainOfThoughtContent: import('react').MemoExoticComponent<({ className, children, ...props }: ChainOfThoughtContentProps) => import("react").JSX.Element>;
27
34
  export type ChainOfThoughtImageProps = ComponentProps<"div"> & {
28
35
  caption?: string;
29
36
  };
@@ -1,182 +1,172 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as d } from "react/jsx-runtime";
3
- import { Badge as C } from "../badge.js";
4
- import { Collapsible as p, CollapsibleTrigger as N, CollapsibleContent as O } from "../collapsible.js";
5
- import { Brain as v, ChevronDown as y } from "../../lib/icons.js";
2
+ import { jsx as o, jsxs as l, Fragment as c } from "react/jsx-runtime";
3
+ import { Badge as d } from "../badge.js";
4
+ import { Collapsible as u, CollapsibleTrigger as p, CollapsibleContent as f } from "../collapsible.js";
5
+ import { ChevronRight as g } from "../../lib/icons.js";
6
6
  import { cn as i } from "../../lib/cn.js";
7
- import { createContext as T, memo as c, useMemo as b, useState as w, useRef as S, useCallback as z, useContext as j } from "react";
8
- function R({
9
- prop: e,
10
- defaultProp: a,
11
- onChange: n
12
- }) {
13
- const [s, r] = w(a), l = e !== void 0, h = l ? e : s, o = S(n);
14
- o.current = n;
15
- const u = z(
16
- (m) => {
17
- var f;
18
- l || r(m), (f = o.current) == null || f.call(o, m);
19
- },
20
- [l]
21
- );
22
- return [h, u];
23
- }
24
- const g = T(
25
- null
26
- ), x = () => {
27
- const e = j(g);
28
- if (!e)
29
- throw new Error(
30
- "ChainOfThought components must be used within ChainOfThought"
31
- );
32
- return e;
33
- }, I = c(
7
+ import { memo as r } from "react";
8
+ const m = r(
9
+ ({ className: e, role: a = "list", ...t }) => /* @__PURE__ */ o(
10
+ "div",
11
+ {
12
+ "data-slot": "chain-of-thought",
13
+ role: a,
14
+ className: i(
15
+ "w-full",
16
+ "[&>[data-slot=chain-of-thought-step]:not(:has(~_[data-slot=chain-of-thought-step]))]:pb-0",
17
+ "[&>[data-slot=chain-of-thought-step]:not(:has(~_[data-slot=chain-of-thought-step]))]:before:hidden",
18
+ e
19
+ ),
20
+ ...t
21
+ }
22
+ )
23
+ ), b = r(
34
24
  ({
35
25
  className: e,
36
- open: a,
37
- defaultOpen: n = !1,
38
- onOpenChange: s,
39
- children: r,
40
- ...l
41
- }) => {
42
- const [h, o] = R({
43
- prop: a,
44
- defaultProp: n,
45
- onChange: s
46
- }), u = b(
47
- () => ({ isOpen: h, setIsOpen: o }),
48
- [h, o]
49
- );
50
- return /* @__PURE__ */ t(g.Provider, { value: u, children: /* @__PURE__ */ t("div", { className: i("max-w-prose space-y-4", e), ...l, children: r }) });
51
- }
52
- ), B = c(
53
- ({ className: e, children: a, ...n }) => {
54
- const { isOpen: s, setIsOpen: r } = x();
55
- return /* @__PURE__ */ t(p, { onOpenChange: r, open: s, children: /* @__PURE__ */ d(
56
- N,
57
- {
58
- className: i(
59
- "flex w-full items-center gap-2 text-base text-secondary transition-colors hover:text-foreground",
60
- e
61
- ),
62
- ...n,
63
- children: [
64
- /* @__PURE__ */ t(v, { className: "size-4" }),
65
- /* @__PURE__ */ t("span", { className: "flex-1 text-left", children: a ?? "Chain of Thought" }),
66
- /* @__PURE__ */ t(
67
- y,
68
- {
69
- className: i(
70
- "size-4 transition-transform duration-(--duration-fast) ease-out motion-reduce:transition-none",
71
- s ? "rotate-180" : "rotate-0"
72
- )
73
- }
74
- )
75
- ]
76
- }
77
- ) });
78
- }
79
- ), H = c(
26
+ defaultOpen: a = !1,
27
+ status: t = "complete",
28
+ role: n = "listitem",
29
+ ...s
30
+ }) => /* @__PURE__ */ o(
31
+ u,
32
+ {
33
+ "data-slot": "chain-of-thought-step",
34
+ "data-status": t,
35
+ defaultOpen: a,
36
+ role: n,
37
+ "aria-current": t === "active" ? "step" : void 0,
38
+ className: i(
39
+ "group/cot-step relative pb-2",
40
+ "before:absolute before:top-7 before:-bottom-2 before:left-2 before:w-px before:bg-border before:content-['']",
41
+ t === "complete" && "text-secondary",
42
+ t === "active" && "text-primary",
43
+ t === "pending" && "text-tertiary/60",
44
+ e
45
+ ),
46
+ ...s
47
+ }
48
+ )
49
+ ), x = r(
80
50
  ({
81
51
  className: e,
82
- icon: a,
83
- label: n,
84
- description: s,
85
- status: r = "complete",
86
- children: l,
52
+ children: a,
53
+ leftIcon: t,
54
+ endContent: n,
55
+ swapIconOnHover: s = !0,
87
56
  ...h
88
- }) => /* @__PURE__ */ d(
89
- "div",
57
+ }) => /* @__PURE__ */ o(p, { asChild: !0, ...h, children: /* @__PURE__ */ l(
58
+ "button",
90
59
  {
60
+ type: "button",
61
+ "data-slot": "chain-of-thought-trigger",
91
62
  className: i(
92
- "flex gap-2 text-base",
93
- {
94
- complete: "text-secondary",
95
- active: "text-primary",
96
- pending: "text-tertiary/60"
97
- }[r],
98
- "fade-in-0 slide-in-from-top-2 animate-in motion-reduce:animate-none",
63
+ "group/cot-trigger flex min-h-9 w-full cursor-pointer items-center gap-3 rounded-sm text-left text-base text-current outline-none",
64
+ "transition-colors duration-(--duration-fast) ease-out hover:text-primary",
65
+ "focus-visible:ring-3 focus-visible:ring-ring motion-reduce:transition-none",
99
66
  e
100
67
  ),
101
- ...h,
102
68
  children: [
103
- /* @__PURE__ */ d("div", { className: "relative mt-0.5", children: [
104
- a ? /* @__PURE__ */ t(a, { className: "size-4" }) : (
105
- // ADS status markers are square (principle 6), not a filled dot.
106
- /* @__PURE__ */ t(
107
- "span",
108
- {
109
- "aria-hidden": !0,
110
- className: "flex size-4 items-center justify-center",
111
- children: /* @__PURE__ */ t("span", { className: "size-1.5 rounded-dot bg-current" })
112
- }
113
- )
114
- ),
115
- /* @__PURE__ */ t("div", { className: "absolute bottom-0 left-1/2 top-7 w-px -translate-x-1/2 bg-border" })
116
- ] }),
117
- /* @__PURE__ */ d("div", { className: "flex-1 space-y-2 overflow-hidden", children: [
118
- /* @__PURE__ */ t("div", { children: n }),
119
- s && /* @__PURE__ */ t("div", { className: "text-xs text-tertiary", children: s }),
120
- l
121
- ] })
69
+ /* @__PURE__ */ o(
70
+ "span",
71
+ {
72
+ "aria-hidden": !0,
73
+ className: "relative z-10 block size-4 shrink-0",
74
+ children: t ? /* @__PURE__ */ l(c, { children: [
75
+ /* @__PURE__ */ o(
76
+ "span",
77
+ {
78
+ className: i(
79
+ "absolute inset-0 flex items-center justify-center transition-opacity duration-(--duration-fast) ease-out [&>svg]:size-4 motion-reduce:transition-none",
80
+ s && "group-hover/cot-trigger:opacity-0 group-data-[state=open]/cot-trigger:opacity-0"
81
+ ),
82
+ children: t
83
+ }
84
+ ),
85
+ s && /* @__PURE__ */ o(
86
+ g,
87
+ {
88
+ className: i(
89
+ "absolute inset-0 size-4 opacity-0 transition-[opacity,transform] duration-(--duration-fast) ease-out motion-reduce:transition-none",
90
+ "group-hover/cot-trigger:opacity-100 group-data-[state=open]/cot-trigger:opacity-100",
91
+ "group-data-[state=open]/cot-trigger:rotate-90"
92
+ )
93
+ }
94
+ )
95
+ ] }) : /* @__PURE__ */ o("span", { className: "absolute top-1/2 left-1/2 size-1.5 -translate-x-1/2 -translate-y-1/2 rounded-dot bg-current" })
96
+ }
97
+ ),
98
+ /* @__PURE__ */ o("span", { className: "min-w-0 flex-1", children: a }),
99
+ n != null && /* @__PURE__ */ o("span", { className: "shrink-0 text-xs text-tertiary tabular-nums", children: n })
122
100
  ]
123
101
  }
102
+ ) })
103
+ ), y = r(
104
+ ({ className: e, children: a, ...t }) => /* @__PURE__ */ o(
105
+ f,
106
+ {
107
+ "data-slot": "chain-of-thought-content",
108
+ className: i(
109
+ "overflow-hidden pl-7 pt-2 pb-1 text-foreground outline-none",
110
+ "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",
111
+ e
112
+ ),
113
+ ...t,
114
+ children: a
115
+ }
116
+ )
117
+ ), N = r(
118
+ ({ className: e, ...a }) => /* @__PURE__ */ o(
119
+ "div",
120
+ {
121
+ "data-slot": "chain-of-thought-item",
122
+ className: i(
123
+ "relative pl-4 text-base text-secondary",
124
+ "before:absolute before:top-2 before:left-0 before:size-1.5 before:rounded-dot before:bg-current before:content-['']",
125
+ e
126
+ ),
127
+ ...a
128
+ }
124
129
  )
125
- ), P = c(
126
- ({ className: e, ...a }) => /* @__PURE__ */ t(
130
+ ), C = r(
131
+ ({ className: e, ...a }) => /* @__PURE__ */ o(
127
132
  "div",
128
133
  {
129
134
  className: i("flex flex-wrap items-center gap-2", e),
130
135
  ...a
131
136
  }
132
137
  )
133
- ), k = c(
134
- ({ className: e, children: a, ...n }) => /* @__PURE__ */ t(
135
- C,
138
+ ), v = r(
139
+ ({ className: e, children: a, ...t }) => /* @__PURE__ */ o(
140
+ d,
136
141
  {
137
142
  className: i("gap-1 font-normal", e),
138
143
  color: "default",
139
144
  variant: "soft",
140
- ...n,
145
+ ...t,
141
146
  children: a
142
147
  }
143
148
  )
144
- ), D = c(
145
- ({ className: e, children: a, ...n }) => {
146
- const { isOpen: s } = x();
147
- return /* @__PURE__ */ t(p, { open: s, children: /* @__PURE__ */ t(
148
- O,
149
- {
150
- className: i(
151
- "mt-2 space-y-3",
152
- "text-foreground outline-none",
153
- "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",
154
- e
155
- ),
156
- ...n,
157
- children: a
158
- }
159
- ) });
160
- }
161
- ), E = c(
162
- ({ className: e, children: a, caption: n, ...s }) => /* @__PURE__ */ d("div", { className: i("mt-2 space-y-2", e), ...s, children: [
163
- /* @__PURE__ */ t("div", { className: "relative flex max-h-88 items-center justify-center overflow-hidden rounded-lg bg-muted p-3", children: a }),
164
- n && /* @__PURE__ */ t("p", { className: "text-xs text-tertiary", children: n })
149
+ ), T = r(
150
+ ({ className: e, children: a, caption: t, ...n }) => /* @__PURE__ */ l("div", { className: i("space-y-2", e), ...n, children: [
151
+ /* @__PURE__ */ o("div", { className: "relative flex max-h-88 items-center justify-center overflow-hidden rounded-lg bg-muted p-3", children: a }),
152
+ t && /* @__PURE__ */ o("p", { className: "text-xs text-tertiary", children: t })
165
153
  ] })
166
154
  );
167
- I.displayName = "ChainOfThought";
168
- B.displayName = "ChainOfThoughtHeader";
169
- H.displayName = "ChainOfThoughtStep";
170
- P.displayName = "ChainOfThoughtSearchResults";
171
- k.displayName = "ChainOfThoughtSearchResult";
172
- D.displayName = "ChainOfThoughtContent";
173
- E.displayName = "ChainOfThoughtImage";
155
+ m.displayName = "ChainOfThought";
156
+ b.displayName = "ChainOfThoughtStep";
157
+ x.displayName = "ChainOfThoughtTrigger";
158
+ y.displayName = "ChainOfThoughtContent";
159
+ N.displayName = "ChainOfThoughtItem";
160
+ C.displayName = "ChainOfThoughtSearchResults";
161
+ v.displayName = "ChainOfThoughtSearchResult";
162
+ T.displayName = "ChainOfThoughtImage";
174
163
  export {
175
- I as ChainOfThought,
176
- D as ChainOfThoughtContent,
177
- B as ChainOfThoughtHeader,
178
- E as ChainOfThoughtImage,
179
- k as ChainOfThoughtSearchResult,
180
- P as ChainOfThoughtSearchResults,
181
- H as ChainOfThoughtStep
164
+ m as ChainOfThought,
165
+ y as ChainOfThoughtContent,
166
+ T as ChainOfThoughtImage,
167
+ N as ChainOfThoughtItem,
168
+ v as ChainOfThoughtSearchResult,
169
+ C as ChainOfThoughtSearchResults,
170
+ b as ChainOfThoughtStep,
171
+ x as ChainOfThoughtTrigger
182
172
  };
@@ -2,7 +2,6 @@ export * from './chain-of-thought';
2
2
  export * from './inline-citation';
3
3
  export * from './message';
4
4
  export * from './queue';
5
- export * from './reasoning';
6
5
  export * from './shimmer';
7
6
  export * from './speech-input';
8
7
  export * from './task';
@@ -19,18 +19,23 @@ export type MessageFilePart = {
19
19
  mediaType?: string;
20
20
  filename?: string;
21
21
  };
22
- export type MessageProps = React.HTMLAttributes<HTMLDivElement> & {
22
+ declare const messageVariants: (props?: ({
23
+ align?: "end" | "start" | null | undefined;
24
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
25
+ export type MessageProps = Omit<React.HTMLAttributes<HTMLDivElement>, "align"> & VariantProps<typeof messageVariants> & {
23
26
  from: MessageRole;
24
27
  };
25
- export declare const Message: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
28
+ export declare const Message: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "align"> & VariantProps<(props?: ({
29
+ align?: "end" | "start" | null | undefined;
30
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string> & {
26
31
  from: MessageRole;
27
32
  } & React.RefAttributes<HTMLDivElement>>;
28
33
  declare const messageContentVariants: (props?: ({
29
- variant?: "flat" | "contained" | null | undefined;
34
+ variant?: "flat" | "contained" | "plain" | null | undefined;
30
35
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
31
36
  export type MessageContentProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof messageContentVariants>;
32
37
  export declare const MessageContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
33
- variant?: "flat" | "contained" | null | undefined;
38
+ variant?: "flat" | "contained" | "plain" | null | undefined;
34
39
  } & import('class-variance-authority/types').ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
35
40
  export type MessageAvatarProps = React.HTMLAttributes<HTMLSpanElement> & {
36
41
  src: string;