@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.
@@ -27,12 +27,13 @@ import "../autocomplete.js";
27
27
  import "../slider.js";
28
28
  import "../segmented.js";
29
29
  import "../modal.js";
30
- import "../drawer.js";
31
- import "../popover.js";
32
30
  import "react";
33
31
  import "react-dom";
32
+ import { Bolt as s, CheckList as f, Sparkles as h } from "../../lib/icons.js";
33
+ import "../drawer.js";
34
+ import "../popover.js";
34
35
  import "motion/react";
35
- import { Dropdown as f, DropdownTrigger as h, DropdownContent as g, DropdownLabel as b, DropdownItem as v } from "../dropdown.js";
36
+ import { Dropdown as g, DropdownTrigger as b, DropdownContent as v, DropdownLabel as x, DropdownItem as y } from "../dropdown.js";
36
37
  import "../toast.js";
37
38
  import "../answer.js";
38
39
  import "../card.js";
@@ -63,8 +64,6 @@ import "../selection-action-bar.js";
63
64
  import "../ai-elements/chain-of-thought.js";
64
65
  import "../ai-elements/inline-citation.js";
65
66
  import "../ai-elements/message.js";
66
- import { Bolt as s, CheckList as x, Sparkles as y } from "../../lib/icons.js";
67
- import "../ai-elements/reasoning.js";
68
67
  import "../ai-elements/shimmer.js";
69
68
  import "../ai-elements/task.js";
70
69
  import "../ai-elements/task-progress.js";
@@ -73,24 +72,24 @@ import "../ai-elements/voice.js";
73
72
  import "./composer.js";
74
73
  import "./answer-tool-ui.js";
75
74
  import "./follow-up-suggestions.js";
76
- import "./composer-add-context.js";
77
- import "zustand/shallow";
75
+ import "./message.js";
76
+ import "./selection-toolbar.js";
78
77
  import "../ui/button.js";
79
- import "./tooltip-icon-button.js";
80
- import "./quote.js";
81
- import "./reasoning.js";
82
- import "./smart-message-text.js";
83
78
  import "./thread-context.js";
84
- import "./tool-fallback.js";
85
- import "./tool-group.js";
86
- import "./selection-toolbar.js";
79
+ import "./tooltip-icon-button.js";
80
+ import "./composer-add-context.js";
81
+ import "zustand/shallow";
87
82
  import "./composer-deep-research.js";
88
83
  import "./composer-trigger-popover.js";
89
84
  import "./directive-text.js";
90
85
  import "./file.js";
91
86
  import "./image.js";
92
87
  import "./markdown-text.js";
88
+ import "./quote.js";
89
+ import "./smart-message-text.js";
93
90
  import "./sources.js";
91
+ import "./tool-fallback.js";
92
+ import "./tool-group.js";
94
93
  const n = "application/x-actioneer-harness", w = [
95
94
  {
96
95
  id: "investigate",
@@ -101,17 +100,17 @@ const n = "application/x-actioneer-harness", w = [
101
100
  {
102
101
  id: "metric",
103
102
  label: "Metric analysis",
104
- icon: /* @__PURE__ */ r(x, {}),
103
+ icon: /* @__PURE__ */ r(f, {}),
105
104
  instructions: "Define the metric, grain, population, and time window before calculating. Call out comparisons, denominator changes, and any data-quality caveats."
106
105
  },
107
106
  {
108
107
  id: "brief",
109
108
  label: "Executive brief",
110
- icon: /* @__PURE__ */ r(y, {}),
109
+ icon: /* @__PURE__ */ r(h, {}),
111
110
  instructions: "Write a concise executive brief: lead with the decision or insight, use only decision-relevant evidence, and end with the recommended next action."
112
111
  }
113
112
  ];
114
- function ri() {
113
+ function ei() {
115
114
  const e = d(), t = u((i) => i.attachments), o = new Set(
116
115
  t.filter((i) => i.contentType === n).map((i) => i.name)
117
116
  ), a = (i) => {
@@ -119,8 +118,8 @@ function ri() {
119
118
  new File([i.instructions], `${i.label}.harness`, { type: n })
120
119
  );
121
120
  };
122
- return /* @__PURE__ */ m(f, { children: [
123
- /* @__PURE__ */ r(h, { children: /* @__PURE__ */ m(
121
+ return /* @__PURE__ */ m(g, { children: [
122
+ /* @__PURE__ */ r(b, { children: /* @__PURE__ */ m(
124
123
  "button",
125
124
  {
126
125
  type: "button",
@@ -132,10 +131,10 @@ function ri() {
132
131
  ]
133
132
  }
134
133
  ) }),
135
- /* @__PURE__ */ m(g, { side: "top", align: "start", className: "w-56", autoFocusFirstItem: !1, children: [
136
- /* @__PURE__ */ r(b, { children: "Add a harness" }),
134
+ /* @__PURE__ */ m(v, { side: "top", align: "start", className: "w-56", autoFocusFirstItem: !1, children: [
135
+ /* @__PURE__ */ r(x, { children: "Add a harness" }),
137
136
  w.map((i) => /* @__PURE__ */ r(
138
- v,
137
+ y,
139
138
  {
140
139
  startContent: i.icon,
141
140
  disabled: o.has(i.label),
@@ -147,7 +146,7 @@ function ri() {
147
146
  ] })
148
147
  ] });
149
148
  }
150
- class ni {
149
+ class ri {
151
150
  constructor() {
152
151
  p(this, "accept", n);
153
152
  }
@@ -180,7 +179,7 @@ ${o}
180
179
  }
181
180
  }
182
181
  export {
183
- ri as ComposerHarness,
182
+ ei as ComposerHarness,
184
183
  n as HARNESS_MIME,
185
- ni as HarnessAttachmentAdapter
184
+ ri as HarnessAttachmentAdapter
186
185
  };
@@ -1,32 +1,40 @@
1
1
  "use client";
2
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ import { jsxs as o, jsx as t } from "react/jsx-runtime";
3
3
  import { UserMessageAttachments as h } from "./attachment.js";
4
4
  import { AssistantActionBar as T, UserActionBar as x } from "./action-bar.js";
5
5
  import { BranchPicker as d } from "./branch-picker.js";
6
- import { EditComposer as _ } from "./composer.js";
7
- import { MessageError as A } from "./error.js";
8
- import { QuoteBlock as b } from "./quote.js";
9
- import { Reasoning as v, ReasoningRoot as y, ReasoningTrigger as w, ReasoningContent as R, ReasoningText as N } from "./reasoning.js";
6
+ import { EditComposer as b } from "./composer.js";
7
+ import { MessageError as _ } from "./error.js";
8
+ import { QuoteBlock as v } from "./quote.js";
9
+ import { Reasoning as A, ReasoningRoot as y, ReasoningTrigger as w, ReasoningContent as R, ReasoningText as N } from "./reasoning.js";
10
10
  import { SmartMessageText as C } from "./smart-message-text.js";
11
11
  import { ThreadComponentsContext as p } from "./thread-context.js";
12
- import { ToolFallback as B } from "./tool-fallback.js";
13
- import { ToolGroupRoot as k, ToolGroupTrigger as G, ToolGroupContent as M } from "./tool-group.js";
12
+ import { ToolFallback as k } from "./tool-fallback.js";
13
+ import { ToolGroupRoot as B, ToolGroupTrigger as M, ToolGroupContent as G } from "./tool-group.js";
14
+ import { createDirectiveText as I } from "./directive-text.js";
14
15
  import { cn as c } from "../../lib/cn.js";
15
- import { MessagePrimitive as n, groupPartByType as I, useAuiState as g } from "@assistant-ui/react";
16
+ import { At as O, FileText as E, Bolt as P, Table as U } from "../../lib/icons.js";
17
+ import { unstable_defaultDirectiveFormatter as F, MessagePrimitive as i, groupPartByType as j, useAuiState as g } from "@assistant-ui/react";
16
18
  import { useContext as f } from "react";
17
- const Y = () => {
18
- const { AssistantMessage: a = O } = f(p), i = g((o) => o.message.role);
19
- return g((o) => o.message.composer.isEditing) ? /* @__PURE__ */ t(_, {}) : i === "user" ? /* @__PURE__ */ t(E, {}) : /* @__PURE__ */ t(a, {});
20
- }, O = () => {
19
+ const H = I(
20
+ F,
21
+ {
22
+ iconMap: { table: U, skill: P, file: E },
23
+ fallbackIcon: O
24
+ }
25
+ ), nt = () => {
26
+ const { AssistantMessage: a = z } = f(p), n = g((s) => s.message.role);
27
+ return g((s) => s.message.composer.isEditing) ? /* @__PURE__ */ t(b, {}) : n === "user" ? /* @__PURE__ */ t(D, {}) : /* @__PURE__ */ t(a, {});
28
+ }, z = () => {
21
29
  const {
22
30
  AssistantAvatar: a,
23
- ToolFallback: i = B,
31
+ ToolFallback: n = k,
24
32
  ToolGroup: l,
25
- ReasoningGroup: o,
33
+ ReasoningGroup: s,
26
34
  ChainOfThoughtGroup: m
27
35
  } = f(p);
28
- return /* @__PURE__ */ s(
29
- n.Root,
36
+ return /* @__PURE__ */ o(
37
+ i.Root,
30
38
  {
31
39
  "data-slot": "aui_assistant-message-root",
32
40
  "data-role": "assistant",
@@ -43,7 +51,7 @@ const Y = () => {
43
51
  children: /* @__PURE__ */ t(a, {})
44
52
  }
45
53
  ),
46
- /* @__PURE__ */ s(
54
+ /* @__PURE__ */ o(
47
55
  "div",
48
56
  {
49
57
  "data-slot": "aui_assistant-message-content",
@@ -53,9 +61,9 @@ const Y = () => {
53
61
  ),
54
62
  children: [
55
63
  /* @__PURE__ */ t(
56
- n.GroupedParts,
64
+ i.GroupedParts,
57
65
  {
58
- groupBy: I({
66
+ groupBy: j({
59
67
  reasoning: ["group-chainOfThought", "group-reasoning"],
60
68
  "tool-call": ["group-chainOfThought", "group-tool"],
61
69
  "standalone-tool-call": []
@@ -65,21 +73,21 @@ const Y = () => {
65
73
  case "group-chainOfThought":
66
74
  return m ? /* @__PURE__ */ t(m, { group: e, children: r }) : /* @__PURE__ */ t("div", { "data-slot": "aui_chain-of-thought", children: r });
67
75
  case "group-tool":
68
- return l ? /* @__PURE__ */ t(l, { group: e, children: r }) : /* @__PURE__ */ s(k, { variant: "ghost", children: [
76
+ return l ? /* @__PURE__ */ t(l, { group: e, children: r }) : /* @__PURE__ */ o(B, { variant: "ghost", children: [
69
77
  /* @__PURE__ */ t(
70
- G,
78
+ M,
71
79
  {
72
80
  count: e.indices.length,
73
81
  active: e.status.type === "running"
74
82
  }
75
83
  ),
76
- /* @__PURE__ */ t(M, { children: r })
84
+ /* @__PURE__ */ t(G, { children: r })
77
85
  ] });
78
86
  case "group-reasoning": {
79
- if (o)
80
- return /* @__PURE__ */ t(o, { group: e, children: r });
87
+ if (s)
88
+ return /* @__PURE__ */ t(s, { group: e, children: r });
81
89
  const u = e.status.type === "running";
82
- return /* @__PURE__ */ s(y, { streaming: u, children: [
90
+ return /* @__PURE__ */ o(y, { streaming: u, children: [
83
91
  /* @__PURE__ */ t(w, { active: u }),
84
92
  /* @__PURE__ */ t(R, { "aria-busy": u, children: /* @__PURE__ */ t(N, { children: r }) })
85
93
  ] });
@@ -87,9 +95,9 @@ const Y = () => {
87
95
  case "text":
88
96
  return /* @__PURE__ */ t(C, {});
89
97
  case "reasoning":
90
- return /* @__PURE__ */ t(v, { ...e });
98
+ return /* @__PURE__ */ t(A, { ...e });
91
99
  case "tool-call":
92
- return e.toolUI ?? /* @__PURE__ */ t(i, { ...e });
100
+ return e.toolUI ?? /* @__PURE__ */ t(n, { ...e });
93
101
  case "data":
94
102
  return e.dataRendererUI;
95
103
  case "indicator":
@@ -108,11 +116,11 @@ const Y = () => {
108
116
  }
109
117
  }
110
118
  ),
111
- /* @__PURE__ */ t(A, {})
119
+ /* @__PURE__ */ t(_, {})
112
120
  ]
113
121
  }
114
122
  ),
115
- /* @__PURE__ */ s(
123
+ /* @__PURE__ */ o(
116
124
  "div",
117
125
  {
118
126
  "data-slot": "aui_assistant-message-footer",
@@ -130,16 +138,21 @@ const Y = () => {
130
138
  ]
131
139
  }
132
140
  );
133
- }, E = () => /* @__PURE__ */ s(
134
- n.Root,
141
+ }, D = () => /* @__PURE__ */ o(
142
+ i.Root,
135
143
  {
136
144
  "data-slot": "aui_user-message-root",
137
145
  className: "fade-in slide-in-from-bottom-1 animate-in grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] content-start gap-y-2 px-2 duration-(--duration-fast) [contain-intrinsic-size:auto_200px] [content-visibility:auto] [&:where(>*)]:col-start-2",
138
146
  "data-role": "user",
139
147
  children: [
140
148
  /* @__PURE__ */ t(h, {}),
141
- /* @__PURE__ */ s("div", { className: "aui-user-message-content-wrapper relative col-start-2 min-w-0", children: [
142
- /* @__PURE__ */ t("div", { className: "aui-user-message-content peer bg-muted text-foreground rounded-xl px-4 py-2 wrap-break-word empty:hidden", children: /* @__PURE__ */ t(n.Parts, { components: { Quote: b } }) }),
149
+ /* @__PURE__ */ o("div", { className: "aui-user-message-content-wrapper relative col-start-2 min-w-0", children: [
150
+ /* @__PURE__ */ t("div", { className: "aui-user-message-content peer bg-muted text-foreground rounded-xl px-4 py-2 wrap-break-word empty:hidden", children: /* @__PURE__ */ t(
151
+ i.Parts,
152
+ {
153
+ components: { Quote: v, Text: H }
154
+ }
155
+ ) }),
143
156
  /* @__PURE__ */ t("div", { className: "aui-user-action-bar-wrapper absolute start-0 top-1/2 -translate-x-full -translate-y-1/2 pe-2 peer-empty:hidden rtl:translate-x-full", children: /* @__PURE__ */ t(x, {}) })
144
157
  ] }),
145
158
  /* @__PURE__ */ t(
@@ -153,7 +166,7 @@ const Y = () => {
153
166
  }
154
167
  );
155
168
  export {
156
- O as AssistantMessage,
157
- Y as ThreadMessage,
158
- E as UserMessage
169
+ z as AssistantMessage,
170
+ nt as ThreadMessage,
171
+ D as UserMessage
159
172
  };
@@ -1,2 +1,2 @@
1
- export { AssistantRuntimeProvider, AttachmentPrimitive, CompositeAttachmentAdapter, ComposerPrimitive, MessagePrimitive, SelectionToolbarPrimitive, SimpleImageAttachmentAdapter, ThreadPrimitive, makeAssistantToolUI, useAssistantRuntime, useAuiState, useLocalRuntime, } from '@assistant-ui/react';
1
+ export { AssistantRuntimeProvider, AttachmentPrimitive, CompositeAttachmentAdapter, ComposerPrimitive, MessagePrimitive, SelectionToolbarPrimitive, SimpleImageAttachmentAdapter, ThreadPrimitive, makeAssistantToolUI, unstable_useSlashCommandAdapter, useAssistantRuntime, useAuiState, useComposer, useComposerRuntime, useLocalRuntime, } from '@assistant-ui/react';
2
2
  export type { ChatModelAdapter, LocalRuntimeOptions, ThreadMessageLike, ToolCallMessagePartProps, } from '@assistant-ui/react';
@@ -13,6 +13,8 @@ export type ThreadComponents = {
13
13
  /** Optional identity shown beside every assistant turn. */
14
14
  AssistantAvatar?: ComponentType | undefined;
15
15
  Welcome?: ComponentType | undefined;
16
+ /** Wraps the default Composer, e.g. with TaskProgressDock. */
17
+ ComposerDock?: ComponentType<PropsWithChildren> | undefined;
16
18
  /** Replaces the left-side composer controls (context, upload, harness). */
17
19
  ComposerAccessories?: ComponentType | undefined;
18
20
  ToolFallback?: ToolCallMessagePartComponent | undefined;
@@ -1,29 +1,31 @@
1
1
  "use client";
2
2
  import { jsxs as l, jsx as o } from "react/jsx-runtime";
3
- import { Composer as d } from "./composer.js";
3
+ import { Composer as m } from "./composer.js";
4
4
  import { ComposerPlaceholdersProvider as z } from "./composer.js";
5
- import { RenderAnswerToolUI as s } from "./answer-tool-ui.js";
6
- import { ThreadFollowupSuggestions as c } from "./follow-up-suggestions.js";
7
- import { ThreadMessage as f } from "./message.js";
8
- import { SelectionToolbar as u } from "./selection-toolbar.js";
9
- import { ThreadSuggestions as h } from "./suggestions.js";
10
- import { isNewChatView as a, ThreadComponentsContext as m, EMPTY_COMPONENTS as p } from "./thread-context.js";
11
- import { TooltipIconButton as x } from "./tooltip-icon-button.js";
12
- import { cn as b } from "../../lib/cn.js";
13
- import { useAuiState as w, ThreadPrimitive as e, AuiIf as n } from "@assistant-ui/react";
14
- import { ArrowDown as g } from "../../lib/icons.js";
15
- import { useContext as v } from "react";
5
+ import { RenderAnswerToolUI as c } from "./answer-tool-ui.js";
6
+ import { ThreadFollowupSuggestions as f } from "./follow-up-suggestions.js";
7
+ import { ThreadMessage as u } from "./message.js";
8
+ import { SelectionToolbar as h } from "./selection-toolbar.js";
9
+ import { ThreadSuggestions as p } from "./suggestions.js";
10
+ import { isNewChatView as a, ThreadComponentsContext as s, EMPTY_COMPONENTS as x } from "./thread-context.js";
11
+ import { TooltipIconButton as b } from "./tooltip-icon-button.js";
12
+ import { cn as w } from "../../lib/cn.js";
13
+ import { useAuiState as g, ThreadPrimitive as e, AuiIf as d } from "@assistant-ui/react";
14
+ import { ArrowDown as v } from "../../lib/icons.js";
15
+ import { useContext as T } from "react";
16
16
  const F = ({
17
- components: r = p,
17
+ components: r = x,
18
18
  isAnswerToolEnabled: i = !0
19
19
  }) => {
20
- const t = w(a);
21
- return /* @__PURE__ */ l(m.Provider, { value: r, children: [
22
- i && /* @__PURE__ */ o(s, {}),
23
- /* @__PURE__ */ o(T, { isEmpty: t })
20
+ const t = g(a);
21
+ return /* @__PURE__ */ l(s.Provider, { value: r, children: [
22
+ i && /* @__PURE__ */ o(c, {}),
23
+ /* @__PURE__ */ o(N, { isEmpty: t })
24
24
  ] });
25
- }, T = ({ isEmpty: r }) => {
26
- const { Welcome: i = y } = v(m);
25
+ }, N = ({ isEmpty: r }) => {
26
+ const { Welcome: i = k, ComposerDock: t } = T(
27
+ s
28
+ );
27
29
  return /* @__PURE__ */ l(e.Root, { className: "aui-root aui-thread-root bg-background @container flex h-full flex-col", children: [
28
30
  /* @__PURE__ */ o(
29
31
  e.Viewport,
@@ -32,45 +34,45 @@ const F = ({
32
34
  "data-slot": "aui_thread-viewport",
33
35
  className: "relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth",
34
36
  children: /* @__PURE__ */ l("div", { className: "mx-auto flex w-full max-w-(--thread-max-width) flex-1 flex-col px-4 pt-4", children: [
35
- /* @__PURE__ */ o(n, { condition: a, children: /* @__PURE__ */ o("div", { className: "flex flex-1 flex-col items-center justify-end", children: /* @__PURE__ */ o(i, {}) }) }),
37
+ /* @__PURE__ */ o(d, { condition: a, children: /* @__PURE__ */ o("div", { className: "flex flex-1 flex-col items-center justify-end", children: /* @__PURE__ */ o(i, {}) }) }),
36
38
  /* @__PURE__ */ o(
37
39
  "div",
38
40
  {
39
41
  "data-slot": "aui_message-group",
40
42
  className: "mb-14 flex flex-col gap-y-6 empty:hidden",
41
- children: /* @__PURE__ */ o(e.Messages, { children: () => /* @__PURE__ */ o(f, {}) })
43
+ children: /* @__PURE__ */ o(e.Messages, { children: () => /* @__PURE__ */ o(u, {}) })
42
44
  }
43
45
  ),
44
46
  /* @__PURE__ */ l(
45
47
  e.ViewportFooter,
46
48
  {
47
- className: b(
49
+ className: w(
48
50
  "aui-thread-viewport-footer bg-background flex flex-col gap-4 overflow-visible pb-4 md:pb-6",
49
51
  r && "flex-1",
50
52
  !r && "sticky bottom-0 mt-auto rounded-t-(--composer-radius)"
51
53
  ),
52
54
  children: [
53
- /* @__PURE__ */ o(N, {}),
54
- /* @__PURE__ */ o(c, {}),
55
- /* @__PURE__ */ o(d, {}),
56
- /* @__PURE__ */ o(n, { condition: (t) => a(t) && t.composer.isEmpty, children: /* @__PURE__ */ o(h, {}) })
55
+ /* @__PURE__ */ o(C, {}),
56
+ /* @__PURE__ */ o(f, {}),
57
+ t ? /* @__PURE__ */ o(t, { children: /* @__PURE__ */ o(m, {}) }) : /* @__PURE__ */ o(m, {}),
58
+ /* @__PURE__ */ o(d, { condition: (n) => a(n) && n.composer.isEmpty, children: /* @__PURE__ */ o(p, {}) })
57
59
  ]
58
60
  }
59
61
  )
60
62
  ] })
61
63
  }
62
64
  ),
63
- /* @__PURE__ */ o(u, {})
65
+ /* @__PURE__ */ o(h, {})
64
66
  ] });
65
- }, N = () => /* @__PURE__ */ o(e.ScrollToBottom, { asChild: !0, children: /* @__PURE__ */ o(
66
- x,
67
+ }, C = () => /* @__PURE__ */ o(e.ScrollToBottom, { asChild: !0, children: /* @__PURE__ */ o(
68
+ b,
67
69
  {
68
70
  tooltip: "Scroll to bottom",
69
71
  variant: "outline",
70
72
  className: "aui-thread-scroll-to-bottom dark:border-border dark:bg-background dark:hover:bg-accent absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible",
71
- children: /* @__PURE__ */ o(g, {})
73
+ children: /* @__PURE__ */ o(v, {})
72
74
  }
73
- ) }), y = () => /* @__PURE__ */ o("div", { className: "aui-thread-welcome-root mb-6 flex flex-col items-center px-4 text-center", children: /* @__PURE__ */ o("h1", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-xl font-semibold duration-(--duration-normal)", children: "How can I help you today?" }) });
75
+ ) }), k = () => /* @__PURE__ */ o("div", { className: "aui-thread-welcome-root mb-6 flex flex-col items-center px-4 text-center", children: /* @__PURE__ */ o("h1", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-xl font-semibold duration-(--duration-normal)", children: "How can I help you today?" }) });
74
76
  export {
75
77
  z as ComposerPlaceholdersProvider,
76
78
  F as Thread
@@ -2,6 +2,41 @@ import * as React from "react";
2
2
  /** One row of chart data. Gaps (null/undefined) render as breaks in the series. */
3
3
  export type ChartDatum = Record<string, string | number | null | undefined>;
4
4
  export type ChartColor = "primary" | "success" | "warning" | "danger" | "info";
5
+ /** Bounded Recharts domain surface — enough for fixed and data-driven axes. */
6
+ export type ChartAxisDomain = [string | number, string | number];
7
+ export type ChartTickFormatter = (value: string | number) => string | number;
8
+ export type ChartXScale = "category" | "time";
9
+ export interface ChartTooltipItem {
10
+ key: string | number;
11
+ name: string | number;
12
+ value: unknown;
13
+ color?: string;
14
+ /** Original row supplied to the chart. */
15
+ datum?: ChartDatum;
16
+ }
17
+ export interface ChartTooltipContext {
18
+ active: boolean;
19
+ label?: string | number;
20
+ items: ChartTooltipItem[];
21
+ formatValue: (value: number) => string;
22
+ }
23
+ /** Return custom tooltip content, or pass `false` to disable tooltips. */
24
+ export type ChartTooltipRenderer = (context: ChartTooltipContext) => React.ReactNode;
25
+ export interface FunnelLabelContext {
26
+ datum: ChartDatum;
27
+ index: number;
28
+ name: string;
29
+ value: number;
30
+ conversionFromFirst: number;
31
+ conversionFromPrevious: number;
32
+ dropOffFromPrevious: number;
33
+ x: number;
34
+ y: number;
35
+ width: number;
36
+ height: number;
37
+ formatValue: (value: number) => string;
38
+ }
39
+ export type FunnelLabelRenderer = (context: FunnelLabelContext) => React.ReactNode;
5
40
  export type ChartAnnotation = {
6
41
  /** A goal / threshold line. `axis: "y"` (default) draws horizontal at a value; `axis: "x"` marks an event at a category. */
7
42
  kind: "line";
@@ -48,6 +83,16 @@ interface BaseChartProps {
48
83
  legend?: boolean;
49
84
  showYAxis?: boolean;
50
85
  formatValue?: (value: number) => string;
86
+ /** Numeric/time x-axis scale. Time data must use numeric timestamps. */
87
+ xScale?: ChartXScale;
88
+ /** Explicit screen-axis domains; e.g. `yDomain={[0, 100]}`. */
89
+ xDomain?: ChartAxisDomain;
90
+ yDomain?: ChartAxisDomain;
91
+ xTickFormatter?: ChartTickFormatter;
92
+ yTickFormatter?: ChartTickFormatter;
93
+ /** Width reserved for the y axis (useful for long horizontal-bar labels). */
94
+ yAxisWidth?: number;
95
+ tooltip?: ChartTooltipRenderer | false;
51
96
  className?: string;
52
97
  }
53
98
  export interface LineChartProps extends BaseChartProps {
@@ -63,6 +108,8 @@ export interface AreaChartProps extends BaseChartProps {
63
108
  }
64
109
  export interface BarChartProps extends BaseChartProps {
65
110
  stacked?: boolean;
111
+ /** Visual bar direction: vertical columns (default) or horizontal bars. */
112
+ layout?: "vertical" | "horizontal";
66
113
  }
67
114
  export interface ComboChartProps extends BaseChartProps {
68
115
  /** Series keys drawn as lines; the rest draw as bars. */
@@ -89,9 +136,10 @@ export interface PieChartProps {
89
136
  height?: number;
90
137
  legend?: boolean;
91
138
  formatValue?: (value: number) => string;
139
+ tooltip?: ChartTooltipRenderer | false;
92
140
  className?: string;
93
141
  }
94
- export type RadarChartProps = Omit<BaseChartProps, "annotations" | "grid" | "showYAxis"> & {
142
+ export type RadarChartProps = Omit<BaseChartProps, "annotations" | "grid" | "showYAxis" | "xScale" | "xDomain" | "yDomain" | "xTickFormatter" | "yTickFormatter" | "yAxisWidth"> & {
95
143
  /** Maximum ring value. Defaults to the largest value in the provided series. */
96
144
  maxValue?: number;
97
145
  };
@@ -107,6 +155,7 @@ export interface RadialBarChartProps {
107
155
  height?: number;
108
156
  legend?: boolean;
109
157
  formatValue?: (value: number) => string;
158
+ tooltip?: ChartTooltipRenderer | false;
110
159
  className?: string;
111
160
  }
112
161
  export interface TreemapDatum {
@@ -121,6 +170,7 @@ export interface TreemapChartProps {
121
170
  valueKey: string;
122
171
  height?: number;
123
172
  formatValue?: (value: number) => string;
173
+ tooltip?: ChartTooltipRenderer | false;
124
174
  className?: string;
125
175
  }
126
176
  export interface ScatterChartProps {
@@ -136,6 +186,13 @@ export interface ScatterChartProps {
136
186
  grid?: boolean;
137
187
  showYAxis?: boolean;
138
188
  formatValue?: (value: number) => string;
189
+ xScale?: Exclude<ChartXScale, "category"> | "number";
190
+ xDomain?: ChartAxisDomain;
191
+ yDomain?: ChartAxisDomain;
192
+ xTickFormatter?: ChartTickFormatter;
193
+ yTickFormatter?: ChartTickFormatter;
194
+ yAxisWidth?: number;
195
+ tooltip?: ChartTooltipRenderer | false;
139
196
  className?: string;
140
197
  }
141
198
  export interface FunnelChartProps {
@@ -146,6 +203,11 @@ export interface FunnelChartProps {
146
203
  valueKey: string;
147
204
  height?: number;
148
205
  formatValue?: (value: number) => string;
206
+ /** Custom data-bearing stage label, or false to hide labels. */
207
+ label?: FunnelLabelRenderer | false;
208
+ /** Space reserved on the right for the label channel. */
209
+ labelWidth?: number;
210
+ tooltip?: ChartTooltipRenderer | false;
149
211
  className?: string;
150
212
  }
151
213
  export declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<HTMLDivElement>>;
@@ -155,7 +217,7 @@ export declare const ComboChart: React.ForwardRefExoticComponent<ComboChartProps
155
217
  export declare const ComposedChart: React.ForwardRefExoticComponent<ComboChartProps & React.RefAttributes<HTMLDivElement>>;
156
218
  export declare const ScatterChart: React.ForwardRefExoticComponent<ScatterChartProps & React.RefAttributes<HTMLDivElement>>;
157
219
  export declare const PieChart: React.ForwardRefExoticComponent<PieChartProps & React.RefAttributes<HTMLDivElement>>;
158
- export declare const RadarChart: React.ForwardRefExoticComponent<Omit<BaseChartProps, "grid" | "annotations" | "showYAxis"> & {
220
+ export declare const RadarChart: React.ForwardRefExoticComponent<Omit<BaseChartProps, "grid" | "annotations" | "showYAxis" | "xScale" | "xDomain" | "yDomain" | "xTickFormatter" | "yTickFormatter" | "yAxisWidth"> & {
159
221
  /** Maximum ring value. Defaults to the largest value in the provided series. */
160
222
  maxValue?: number;
161
223
  } & React.RefAttributes<HTMLDivElement>>;