@townco/ui 0.1.6 → 0.1.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 (255) hide show
  1. package/README.md +11 -11
  2. package/dist/core/hooks/index.d.ts +1 -0
  3. package/dist/core/hooks/index.js +1 -0
  4. package/dist/core/hooks/use-chat-input.d.ts +17 -17
  5. package/dist/core/hooks/use-chat-input.js +55 -64
  6. package/dist/core/hooks/use-chat-messages.d.ts +11 -11
  7. package/dist/core/hooks/use-chat-messages.js +114 -121
  8. package/dist/core/hooks/use-chat-session.d.ts +5 -5
  9. package/dist/core/hooks/use-chat-session.js +80 -78
  10. package/dist/core/hooks/use-media-query.d.ts +5 -5
  11. package/dist/core/hooks/use-media-query.js +42 -38
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.js +1 -1
  14. package/dist/core/schemas/chat.d.ts +56 -83
  15. package/dist/core/schemas/chat.js +25 -27
  16. package/dist/core/store/chat-store.d.ts +22 -28
  17. package/dist/core/store/chat-store.js +50 -59
  18. package/dist/gui/components/Button.d.ts +7 -23
  19. package/dist/gui/components/Button.js +27 -40
  20. package/dist/gui/components/Card.d.ts +7 -26
  21. package/dist/gui/components/Card.js +8 -54
  22. package/dist/gui/components/ChatHeader.d.ts +31 -58
  23. package/dist/gui/components/ChatHeader.js +68 -171
  24. package/dist/gui/components/ChatInput.d.ts +54 -58
  25. package/dist/gui/components/ChatInput.js +207 -194
  26. package/dist/gui/components/ChatInputCommandMenu.d.ts +20 -0
  27. package/dist/gui/components/ChatInputCommandMenu.js +62 -0
  28. package/dist/gui/components/ChatLayout.d.ts +41 -71
  29. package/dist/gui/components/ChatLayout.js +87 -214
  30. package/dist/gui/components/ChatPanelTabContent.d.ts +9 -18
  31. package/dist/gui/components/ChatPanelTabContent.js +10 -88
  32. package/dist/gui/components/ChatSecondaryPanel.d.ts +11 -14
  33. package/dist/gui/components/ChatSecondaryPanel.js +38 -115
  34. package/dist/gui/components/ChatSidebar.d.ts +13 -26
  35. package/dist/gui/components/ChatSidebar.js +14 -48
  36. package/dist/gui/components/ChatStatus.d.ts +2 -4
  37. package/dist/gui/components/ChatStatus.js +34 -45
  38. package/dist/gui/components/Conversation.d.ts +14 -17
  39. package/dist/gui/components/Conversation.js +83 -143
  40. package/dist/gui/components/Dialog.d.ts +11 -57
  41. package/dist/gui/components/Dialog.js +8 -84
  42. package/dist/gui/components/DropdownMenu.d.ts +20 -101
  43. package/dist/gui/components/DropdownMenu.js +14 -161
  44. package/dist/gui/components/HeightTransition.d.ts +7 -12
  45. package/dist/gui/components/HeightTransition.js +77 -88
  46. package/dist/gui/components/Input.d.ts +6 -13
  47. package/dist/gui/components/Input.js +16 -27
  48. package/dist/gui/components/Label.d.ts +1 -7
  49. package/dist/gui/components/Label.js +2 -12
  50. package/dist/gui/components/MarkdownRenderer.d.ts +4 -6
  51. package/dist/gui/components/MarkdownRenderer.js +81 -178
  52. package/dist/gui/components/Message.d.ts +22 -25
  53. package/dist/gui/components/Message.js +97 -44
  54. package/dist/gui/components/MessageContent.d.ts +22 -29
  55. package/dist/gui/components/MessageContent.js +85 -157
  56. package/dist/gui/components/Reasoning.d.ts +24 -30
  57. package/dist/gui/components/Reasoning.js +60 -187
  58. package/dist/gui/components/Response.d.ts +9 -11
  59. package/dist/gui/components/Response.js +90 -229
  60. package/dist/gui/components/Select.d.ts +10 -69
  61. package/dist/gui/components/Select.js +12 -118
  62. package/dist/gui/components/Sonner.d.ts +1 -3
  63. package/dist/gui/components/Sonner.js +18 -29
  64. package/dist/gui/components/Tabs.d.ts +4 -24
  65. package/dist/gui/components/Tabs.js +4 -32
  66. package/dist/gui/components/Task.d.ts +24 -28
  67. package/dist/gui/components/Task.js +31 -164
  68. package/dist/gui/components/Textarea.d.ts +7 -15
  69. package/dist/gui/components/Textarea.js +46 -63
  70. package/dist/gui/components/ThinkingBlock.d.ts +10 -20
  71. package/dist/gui/components/ThinkingBlock.js +35 -134
  72. package/dist/gui/components/TodoList.d.ts +10 -12
  73. package/dist/gui/components/TodoList.js +7 -22
  74. package/dist/gui/components/TodoListItem.d.ts +6 -9
  75. package/dist/gui/components/TodoListItem.js +4 -18
  76. package/dist/gui/components/index.d.ts +16 -59
  77. package/dist/gui/components/index.js +18 -42
  78. package/dist/gui/lib/utils.js +1 -1
  79. package/dist/index.d.ts +1 -1
  80. package/dist/index.js +1 -1
  81. package/dist/index.test.js +1 -0
  82. package/dist/sdk/client/acp-client.d.ts +76 -88
  83. package/dist/sdk/client/acp-client.js +217 -215
  84. package/dist/sdk/index.d.ts +1 -1
  85. package/dist/sdk/index.js +1 -1
  86. package/dist/sdk/schemas/agent.d.ts +64 -111
  87. package/dist/sdk/schemas/agent.js +24 -24
  88. package/dist/sdk/schemas/message.d.ts +147 -245
  89. package/dist/sdk/schemas/message.js +40 -40
  90. package/dist/sdk/schemas/session.d.ts +135 -219
  91. package/dist/sdk/schemas/session.js +27 -27
  92. package/dist/sdk/transports/http.d.ts +55 -55
  93. package/dist/sdk/transports/http.js +469 -472
  94. package/dist/sdk/transports/stdio.d.ts +20 -20
  95. package/dist/sdk/transports/stdio.js +286 -289
  96. package/dist/sdk/transports/types.d.ts +42 -42
  97. package/dist/sdk/transports/websocket.d.ts +12 -12
  98. package/dist/sdk/transports/websocket.js +46 -52
  99. package/dist/tui/components/ChatView.d.ts +2 -4
  100. package/dist/tui/components/ChatView.js +18 -51
  101. package/dist/tui/components/GameOfLife.js +35 -64
  102. package/dist/tui/components/InputBox.d.ts +11 -18
  103. package/dist/tui/components/InputBox.js +10 -70
  104. package/dist/tui/components/MessageList.d.ts +2 -4
  105. package/dist/tui/components/MessageList.js +10 -37
  106. package/dist/tui/components/MultiSelect.d.ts +10 -15
  107. package/dist/tui/components/MultiSelect.js +73 -116
  108. package/dist/tui/components/ReadlineInput.d.ts +6 -12
  109. package/dist/tui/components/ReadlineInput.js +237 -252
  110. package/dist/tui/components/SingleSelect.d.ts +9 -15
  111. package/dist/tui/components/SingleSelect.js +43 -84
  112. package/dist/tui/components/StatusBar.d.ts +6 -11
  113. package/dist/tui/components/StatusBar.js +67 -102
  114. package/dist/tui/index.d.ts +1 -1
  115. package/dist/tui/index.js +1 -1
  116. package/package.json +6 -4
  117. package/src/styles/global.css +2 -0
  118. package/dist/core/hooks/index.d.ts.map +0 -1
  119. package/dist/core/hooks/index.js.map +0 -1
  120. package/dist/core/hooks/use-chat-input.d.ts.map +0 -1
  121. package/dist/core/hooks/use-chat-input.js.map +0 -1
  122. package/dist/core/hooks/use-chat-messages.d.ts.map +0 -1
  123. package/dist/core/hooks/use-chat-messages.js.map +0 -1
  124. package/dist/core/hooks/use-chat-session.d.ts.map +0 -1
  125. package/dist/core/hooks/use-chat-session.js.map +0 -1
  126. package/dist/core/index.d.ts.map +0 -1
  127. package/dist/core/index.js.map +0 -1
  128. package/dist/core/schemas/chat.d.ts.map +0 -1
  129. package/dist/core/schemas/chat.js.map +0 -1
  130. package/dist/core/schemas/index.d.ts.map +0 -1
  131. package/dist/core/schemas/index.js.map +0 -1
  132. package/dist/core/store/chat-store.d.ts.map +0 -1
  133. package/dist/core/store/chat-store.js.map +0 -1
  134. package/dist/gui/components/Button.d.ts.map +0 -1
  135. package/dist/gui/components/Button.js.map +0 -1
  136. package/dist/gui/components/Card.d.ts.map +0 -1
  137. package/dist/gui/components/Card.js.map +0 -1
  138. package/dist/gui/components/ChatInput.d.ts.map +0 -1
  139. package/dist/gui/components/ChatInput.js.map +0 -1
  140. package/dist/gui/components/ChatInterface.d.ts +0 -12
  141. package/dist/gui/components/ChatInterface.d.ts.map +0 -1
  142. package/dist/gui/components/ChatInterface.js +0 -204
  143. package/dist/gui/components/ChatInterface.js.map +0 -1
  144. package/dist/gui/components/ChatPreview.d.ts +0 -12
  145. package/dist/gui/components/ChatPreview.d.ts.map +0 -1
  146. package/dist/gui/components/ChatPreview.js +0 -214
  147. package/dist/gui/components/ChatPreview.js.map +0 -1
  148. package/dist/gui/components/ChatSecondaryPanel.d.ts.map +0 -1
  149. package/dist/gui/components/ChatSecondaryPanel.js.map +0 -1
  150. package/dist/gui/components/ChatStatus.d.ts.map +0 -1
  151. package/dist/gui/components/ChatStatus.js.map +0 -1
  152. package/dist/gui/components/ChatView.d.ts +0 -8
  153. package/dist/gui/components/ChatView.d.ts.map +0 -1
  154. package/dist/gui/components/ChatView.js +0 -42
  155. package/dist/gui/components/ChatView.js.map +0 -1
  156. package/dist/gui/components/ConfigPanel.d.ts +0 -20
  157. package/dist/gui/components/ConfigPanel.d.ts.map +0 -1
  158. package/dist/gui/components/ConfigPanel.js +0 -225
  159. package/dist/gui/components/ConfigPanel.js.map +0 -1
  160. package/dist/gui/components/Conversation.d.ts.map +0 -1
  161. package/dist/gui/components/Conversation.js.map +0 -1
  162. package/dist/gui/components/Dialog.d.ts.map +0 -1
  163. package/dist/gui/components/Dialog.js.map +0 -1
  164. package/dist/gui/components/HeightTransition.d.ts.map +0 -1
  165. package/dist/gui/components/HeightTransition.js.map +0 -1
  166. package/dist/gui/components/Input.d.ts.map +0 -1
  167. package/dist/gui/components/Input.js.map +0 -1
  168. package/dist/gui/components/InputBox.d.ts +0 -21
  169. package/dist/gui/components/InputBox.d.ts.map +0 -1
  170. package/dist/gui/components/InputBox.js +0 -90
  171. package/dist/gui/components/InputBox.js.map +0 -1
  172. package/dist/gui/components/Label.d.ts.map +0 -1
  173. package/dist/gui/components/Label.js.map +0 -1
  174. package/dist/gui/components/MarkdownRenderer.d.ts.map +0 -1
  175. package/dist/gui/components/MarkdownRenderer.js.map +0 -1
  176. package/dist/gui/components/Message.d.ts.map +0 -1
  177. package/dist/gui/components/Message.js.map +0 -1
  178. package/dist/gui/components/MessageContent.d.ts.map +0 -1
  179. package/dist/gui/components/MessageContent.js.map +0 -1
  180. package/dist/gui/components/MessageList.d.ts.map +0 -1
  181. package/dist/gui/components/MessageList.js.map +0 -1
  182. package/dist/gui/components/PlaygroundLayout.d.ts +0 -14
  183. package/dist/gui/components/PlaygroundLayout.d.ts.map +0 -1
  184. package/dist/gui/components/PlaygroundLayout.js +0 -49
  185. package/dist/gui/components/PlaygroundLayout.js.map +0 -1
  186. package/dist/gui/components/Reasoning.d.ts.map +0 -1
  187. package/dist/gui/components/Reasoning.js.map +0 -1
  188. package/dist/gui/components/Response.d.ts.map +0 -1
  189. package/dist/gui/components/Response.js.map +0 -1
  190. package/dist/gui/components/Select.d.ts.map +0 -1
  191. package/dist/gui/components/Select.js.map +0 -1
  192. package/dist/gui/components/StatusBar.d.ts +0 -12
  193. package/dist/gui/components/StatusBar.d.ts.map +0 -1
  194. package/dist/gui/components/StatusBar.js +0 -58
  195. package/dist/gui/components/StatusBar.js.map +0 -1
  196. package/dist/gui/components/Tabs.d.ts.map +0 -1
  197. package/dist/gui/components/Tabs.js.map +0 -1
  198. package/dist/gui/components/Task.d.ts.map +0 -1
  199. package/dist/gui/components/Task.js.map +0 -1
  200. package/dist/gui/components/Textarea.d.ts.map +0 -1
  201. package/dist/gui/components/Textarea.js.map +0 -1
  202. package/dist/gui/components/ThinkingBlock.d.ts.map +0 -1
  203. package/dist/gui/components/ThinkingBlock.js.map +0 -1
  204. package/dist/gui/components/TodoList.d.ts.map +0 -1
  205. package/dist/gui/components/TodoList.js.map +0 -1
  206. package/dist/gui/components/TodoListItem.d.ts.map +0 -1
  207. package/dist/gui/components/TodoListItem.js.map +0 -1
  208. package/dist/gui/components/index.d.ts.map +0 -1
  209. package/dist/gui/components/index.js.map +0 -1
  210. package/dist/gui/index.d.ts.map +0 -1
  211. package/dist/gui/index.js.map +0 -1
  212. package/dist/gui/lib/utils.d.ts.map +0 -1
  213. package/dist/gui/lib/utils.js.map +0 -1
  214. package/dist/index.d.ts.map +0 -1
  215. package/dist/index.js.map +0 -1
  216. package/dist/sdk/client/acp-client.d.ts.map +0 -1
  217. package/dist/sdk/client/acp-client.js.map +0 -1
  218. package/dist/sdk/client/index.d.ts.map +0 -1
  219. package/dist/sdk/client/index.js.map +0 -1
  220. package/dist/sdk/index.d.ts.map +0 -1
  221. package/dist/sdk/index.js.map +0 -1
  222. package/dist/sdk/schemas/agent.d.ts.map +0 -1
  223. package/dist/sdk/schemas/agent.js.map +0 -1
  224. package/dist/sdk/schemas/index.d.ts.map +0 -1
  225. package/dist/sdk/schemas/index.js.map +0 -1
  226. package/dist/sdk/schemas/message.d.ts.map +0 -1
  227. package/dist/sdk/schemas/message.js.map +0 -1
  228. package/dist/sdk/schemas/session.d.ts.map +0 -1
  229. package/dist/sdk/schemas/session.js.map +0 -1
  230. package/dist/sdk/transports/http.d.ts.map +0 -1
  231. package/dist/sdk/transports/http.js.map +0 -1
  232. package/dist/sdk/transports/index.d.ts.map +0 -1
  233. package/dist/sdk/transports/index.js.map +0 -1
  234. package/dist/sdk/transports/stdio.d.ts.map +0 -1
  235. package/dist/sdk/transports/stdio.js.map +0 -1
  236. package/dist/sdk/transports/types.d.ts.map +0 -1
  237. package/dist/sdk/transports/types.js.map +0 -1
  238. package/dist/sdk/transports/websocket.d.ts.map +0 -1
  239. package/dist/sdk/transports/websocket.js.map +0 -1
  240. package/dist/tui/components/ChatView.d.ts.map +0 -1
  241. package/dist/tui/components/ChatView.js.map +0 -1
  242. package/dist/tui/components/GameOfLife.d.ts.map +0 -1
  243. package/dist/tui/components/GameOfLife.js.map +0 -1
  244. package/dist/tui/components/InputBox.d.ts.map +0 -1
  245. package/dist/tui/components/InputBox.js.map +0 -1
  246. package/dist/tui/components/MessageList.d.ts.map +0 -1
  247. package/dist/tui/components/MessageList.js.map +0 -1
  248. package/dist/tui/components/ReadlineInput.d.ts.map +0 -1
  249. package/dist/tui/components/ReadlineInput.js.map +0 -1
  250. package/dist/tui/components/StatusBar.d.ts.map +0 -1
  251. package/dist/tui/components/StatusBar.js.map +0 -1
  252. package/dist/tui/components/index.d.ts.map +0 -1
  253. package/dist/tui/components/index.js.map +0 -1
  254. package/dist/tui/index.d.ts.map +0 -1
  255. package/dist/tui/index.js.map +0 -1
@@ -1,189 +1,86 @@
1
- import * as React from "react";
2
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
  import { cn } from "../lib/utils.js";
4
-
5
4
  const ChatHeaderContext = React.createContext(undefined);
6
5
  const useChatHeaderContext = () => {
7
- const context = React.useContext(ChatHeaderContext);
8
- if (!context) {
9
- throw new Error(
10
- "ChatHeader components must be used within ChatHeader.Root",
11
- );
12
- }
13
- return context;
6
+ const context = React.useContext(ChatHeaderContext);
7
+ if (!context) {
8
+ throw new Error("ChatHeader components must be used within ChatHeader.Root");
9
+ }
10
+ return context;
14
11
  };
15
- const ChatHeaderRoot = React.forwardRef(
16
- (
17
- {
18
- defaultExpanded = false,
19
- expanded: expandedProp,
20
- onExpandedChange,
21
- className,
22
- children,
23
- ...props
24
- },
25
- ref,
26
- ) => {
27
- const [isExpandedInternal, setIsExpandedInternal] =
28
- React.useState(defaultExpanded);
29
- const isExpanded = expandedProp ?? isExpandedInternal;
30
- const setIsExpanded = React.useCallback(
31
- (expanded) => {
32
- setIsExpandedInternal(expanded);
33
- onExpandedChange?.(expanded);
34
- },
35
- [onExpandedChange],
36
- );
37
- // Separate children into main content and expandable panel
38
- const childrenArray = React.Children.toArray(children);
39
- const expandablePanel = childrenArray.find(
40
- (child) =>
41
- React.isValidElement(child) &&
42
- child.type?.displayName === "ChatHeader.ExpandablePanel",
43
- );
44
- const mainContent = childrenArray.filter(
45
- (child) => child !== expandablePanel,
46
- );
47
- return _jsxs(ChatHeaderContext.Provider, {
48
- value: { isExpanded, setIsExpanded },
49
- children: [
50
- _jsx("div", {
51
- ref: ref,
52
- className: cn(
53
- "flex items-center justify-between px-6 py-4",
54
- className,
55
- ),
56
- ...props,
57
- children: mainContent,
58
- }),
59
- expandablePanel,
60
- ],
61
- });
62
- },
63
- );
12
+ const ChatHeaderRoot = React.forwardRef(({ defaultExpanded = false, expanded: expandedProp, onExpandedChange, className, children, ...props }, ref) => {
13
+ const [isExpandedInternal, setIsExpandedInternal] = React.useState(defaultExpanded);
14
+ const isExpanded = expandedProp ?? isExpandedInternal;
15
+ const setIsExpanded = React.useCallback((expanded) => {
16
+ setIsExpandedInternal(expanded);
17
+ onExpandedChange?.(expanded);
18
+ }, [onExpandedChange]);
19
+ // Separate children into main content and expandable panel
20
+ const childrenArray = React.Children.toArray(children);
21
+ const expandablePanel = childrenArray.find((child) => React.isValidElement(child) &&
22
+ typeof child.type === "function" &&
23
+ child.type.displayName ===
24
+ "ChatHeader.ExpandablePanel");
25
+ const mainContent = childrenArray.filter((child) => child !== expandablePanel);
26
+ return (_jsxs(ChatHeaderContext.Provider, { value: { isExpanded, setIsExpanded }, children: [_jsx("div", { ref: ref, className: cn("flex items-center justify-between px-6 py-4", className), ...props, children: mainContent }), expandablePanel] }));
27
+ });
64
28
  ChatHeaderRoot.displayName = "ChatHeader.Root";
65
- const ChatHeaderTitle = React.forwardRef(
66
- ({ className, children, ...props }, ref) => {
67
- return _jsx("h1", {
68
- ref: ref,
69
- className: cn("m-0 text-xl font-semibold", className),
70
- ...props,
71
- children: children,
72
- });
73
- },
74
- );
29
+ const ChatHeaderTitle = React.forwardRef(({ className, children, ...props }, ref) => {
30
+ return (_jsx("h1", { ref: ref, className: cn("m-0 text-xl font-semibold", className), ...props, children: children }));
31
+ });
75
32
  ChatHeaderTitle.displayName = "ChatHeader.Title";
76
- const ChatHeaderActions = React.forwardRef(
77
- ({ className, children, ...props }, ref) => {
78
- return _jsx("div", {
79
- ref: ref,
80
- className: cn("flex items-center gap-3", className),
81
- ...props,
82
- children: children,
83
- });
84
- },
85
- );
33
+ const ChatHeaderActions = React.forwardRef(({ className, children, ...props }, ref) => {
34
+ return (_jsx("div", { ref: ref, className: cn("flex items-center gap-3", className), ...props, children: children }));
35
+ });
86
36
  ChatHeaderActions.displayName = "ChatHeader.Actions";
87
37
  const getStatusColor = (status) => {
88
- switch (status) {
89
- case "connected":
90
- return "bg-green-500";
91
- case "connecting":
92
- return "bg-yellow-500";
93
- case "error":
94
- return "bg-red-500";
95
- default:
96
- return "bg-gray-500";
97
- }
38
+ switch (status) {
39
+ case "connected":
40
+ return "bg-green-500";
41
+ case "connecting":
42
+ return "bg-yellow-500";
43
+ case "error":
44
+ return "bg-red-500";
45
+ default:
46
+ return "bg-gray-500";
47
+ }
98
48
  };
99
49
  const getDefaultStatusText = (status) => {
100
- switch (status) {
101
- case "connected":
102
- return "Connected";
103
- case "connecting":
104
- return "Connecting...";
105
- case "error":
106
- return "Connection Error";
107
- default:
108
- return "No Server";
109
- }
50
+ switch (status) {
51
+ case "connected":
52
+ return "Connected";
53
+ case "connecting":
54
+ return "Connecting...";
55
+ case "error":
56
+ return "Connection Error";
57
+ default:
58
+ return "No Server";
59
+ }
110
60
  };
111
- const ChatHeaderStatusIndicator = React.forwardRef(
112
- ({ status, statusText, className, ...props }, ref) => {
113
- const text = statusText ?? getDefaultStatusText(status);
114
- const colorClass = getStatusColor(status);
115
- return _jsxs("div", {
116
- ref: ref,
117
- className: cn("flex items-center gap-2", className),
118
- ...props,
119
- children: [
120
- _jsx("div", { className: cn("h-2 w-2 rounded-full", colorClass) }),
121
- _jsx("span", {
122
- className: "text-sm text-muted-foreground",
123
- children: text,
124
- }),
125
- ],
126
- });
127
- },
128
- );
61
+ const ChatHeaderStatusIndicator = React.forwardRef(({ status, statusText, className, ...props }, ref) => {
62
+ const text = statusText ?? getDefaultStatusText(status);
63
+ const colorClass = getStatusColor(status);
64
+ return (_jsxs("div", { ref: ref, className: cn("flex items-center gap-2", className), ...props, children: [_jsx("div", { className: cn("h-2 w-2 rounded-full", colorClass) }), _jsx("span", { className: "text-sm text-muted-foreground", children: text })] }));
65
+ });
129
66
  ChatHeaderStatusIndicator.displayName = "ChatHeader.StatusIndicator";
130
- const ChatHeaderToggle = React.forwardRef(
131
- ({ icon, className, children, onClick, ...props }, ref) => {
132
- const { isExpanded, setIsExpanded } = useChatHeaderContext();
133
- const handleClick = (e) => {
134
- setIsExpanded(!isExpanded);
135
- onClick?.(e);
136
- };
137
- return _jsxs("button", {
138
- ref: ref,
139
- type: "button",
140
- onClick: handleClick,
141
- className: cn(
142
- "rounded p-1 transition-colors hover:bg-background lg:hidden",
143
- className,
144
- ),
145
- "aria-label": isExpanded ? "Collapse header" : "Expand header",
146
- ...props,
147
- children: [
148
- icon &&
149
- _jsx("div", {
150
- className: cn(
151
- "transition-transform duration-200",
152
- isExpanded && "rotate-180",
153
- ),
154
- children: icon,
155
- }),
156
- children,
157
- ],
158
- });
159
- },
160
- );
67
+ const ChatHeaderToggle = React.forwardRef(({ icon, className, children, onClick, ...props }, ref) => {
68
+ const { isExpanded, setIsExpanded } = useChatHeaderContext();
69
+ const handleClick = (e) => {
70
+ setIsExpanded(!isExpanded);
71
+ onClick?.(e);
72
+ };
73
+ return (_jsxs("button", { ref: ref, type: "button", onClick: handleClick, className: cn("rounded p-1 transition-colors hover:bg-background lg:hidden", className), "aria-label": isExpanded ? "Collapse header" : "Expand header", ...props, children: [icon && (_jsx("div", { className: cn("transition-transform duration-200", isExpanded && "rotate-180"), children: icon })), children] }));
74
+ });
161
75
  ChatHeaderToggle.displayName = "ChatHeader.Toggle";
162
- const ChatHeaderExpandablePanel = React.forwardRef(
163
- ({ className, children, ...props }, ref) => {
164
- const { isExpanded } = useChatHeaderContext();
165
- if (!isExpanded) return null;
166
- return _jsx("div", {
167
- ref: ref,
168
- className: cn(
169
- "absolute top-full left-0 right-0 z-50 border-b border-border bg-card px-6 py-4 shadow-lg lg:hidden",
170
- className,
171
- ),
172
- ...props,
173
- children: children,
174
- });
175
- },
176
- );
76
+ const ChatHeaderExpandablePanel = React.forwardRef(({ className, children, ...props }, ref) => {
77
+ const { isExpanded } = useChatHeaderContext();
78
+ if (!isExpanded)
79
+ return null;
80
+ return (_jsx("div", { ref: ref, className: cn("absolute top-full left-0 right-0 z-50 border-b border-border bg-card px-6 py-4 shadow-lg lg:hidden", className), ...props, children: children }));
81
+ });
177
82
  ChatHeaderExpandablePanel.displayName = "ChatHeader.ExpandablePanel";
178
83
  /* -------------------------------------------------------------------------------------------------
179
84
  * Exports
180
85
  * -----------------------------------------------------------------------------------------------*/
181
- export {
182
- ChatHeaderRoot as Root,
183
- ChatHeaderTitle as Title,
184
- ChatHeaderActions as Actions,
185
- ChatHeaderStatusIndicator as StatusIndicator,
186
- ChatHeaderToggle as Toggle,
187
- ChatHeaderExpandablePanel as ExpandablePanel,
188
- useChatHeaderContext,
189
- };
86
+ export { ChatHeaderRoot as Root, ChatHeaderTitle as Title, ChatHeaderActions as Actions, ChatHeaderStatusIndicator as StatusIndicator, ChatHeaderToggle as Toggle, ChatHeaderExpandablePanel as ExpandablePanel, useChatHeaderContext, };
@@ -1,64 +1,60 @@
1
1
  import * as React from "react";
2
2
  import type { AcpClient } from "../../sdk/client/index.js";
3
+ import { type CommandMenuItem } from "./ChatInputCommandMenu.js";
3
4
  import type { Textarea } from "./Textarea.js";
4
- export interface ChatInputRootProps
5
- extends Omit<
6
- React.FormHTMLAttributes<HTMLFormElement>,
7
- "onChange" | "onSubmit"
8
- > {
9
- /**
10
- * ACP Client for hook-based input management (recommended pattern)
11
- * Either client or value/onChange/onSubmit must be provided
12
- */
13
- client?: AcpClient | null;
14
- /**
15
- * Input value (legacy prop-based pattern)
16
- * Either client or value/onChange/onSubmit must be provided
17
- */
18
- value?: string;
19
- /**
20
- * Input change handler (legacy prop-based pattern)
21
- */
22
- onChange?: (value: string) => void;
23
- /**
24
- * Submit handler (legacy prop-based pattern)
25
- */
26
- onSubmit?: () => void | Promise<void>;
27
- /** Whether input is disabled */
28
- disabled?: boolean;
29
- /** Whether input is currently submitting */
30
- isSubmitting?: boolean;
31
- /** Whether to submit on Enter key (default: true) */
32
- submitOnEnter?: boolean;
5
+ export interface ChatInputRootProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, "onChange" | "onSubmit"> {
6
+ /**
7
+ * ACP Client for hook-based input management (recommended pattern)
8
+ * Either client or value/onChange/onSubmit must be provided
9
+ */
10
+ client?: AcpClient | null;
11
+ /**
12
+ * Input value (legacy prop-based pattern)
13
+ * Either client or value/onChange/onSubmit must be provided
14
+ */
15
+ value?: string;
16
+ /**
17
+ * Input change handler (legacy prop-based pattern)
18
+ */
19
+ onChange?: (value: string) => void;
20
+ /**
21
+ * Submit handler (legacy prop-based pattern)
22
+ */
23
+ onSubmit?: () => void | Promise<void>;
24
+ /** Whether input is disabled */
25
+ disabled?: boolean;
26
+ /** Whether input is currently submitting */
27
+ isSubmitting?: boolean;
28
+ /** Whether to submit on Enter key (default: true) */
29
+ submitOnEnter?: boolean;
33
30
  }
34
- declare const ChatInputRoot: React.ForwardRefExoticComponent<
35
- ChatInputRootProps & React.RefAttributes<HTMLFormElement>
36
- >;
37
- export interface ChatInputFieldProps
38
- extends Omit<
39
- React.ComponentPropsWithoutRef<typeof Textarea>,
40
- "value" | "onChange"
41
- > {
42
- asChild?: boolean;
31
+ declare const ChatInputRoot: React.ForwardRefExoticComponent<ChatInputRootProps & React.RefAttributes<HTMLFormElement>>;
32
+ export interface ChatInputFieldProps extends Omit<React.ComponentPropsWithoutRef<typeof Textarea>, "value" | "onChange"> {
33
+ asChild?: boolean;
43
34
  }
44
- declare const ChatInputField: React.ForwardRefExoticComponent<
45
- ChatInputFieldProps & React.RefAttributes<HTMLTextAreaElement>
46
- >;
47
- export interface ChatInputSubmitProps
48
- extends React.ButtonHTMLAttributes<HTMLButtonElement> {
49
- asChild?: boolean;
35
+ declare const ChatInputField: React.ForwardRefExoticComponent<ChatInputFieldProps & React.RefAttributes<HTMLTextAreaElement>>;
36
+ export interface ChatInputSubmitProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
37
+ asChild?: boolean;
50
38
  }
51
- declare const ChatInputSubmit: React.ForwardRefExoticComponent<
52
- ChatInputSubmitProps & React.RefAttributes<HTMLButtonElement>
53
- >;
54
- export interface ChatInputToolbarProps
55
- extends React.HTMLAttributes<HTMLDivElement> {}
56
- declare const ChatInputToolbar: React.ForwardRefExoticComponent<
57
- ChatInputToolbarProps & React.RefAttributes<HTMLDivElement>
58
- >;
59
- export {
60
- ChatInputRoot as Root,
61
- ChatInputField as Field,
62
- ChatInputSubmit as Submit,
63
- ChatInputToolbar as Toolbar,
64
- };
39
+ declare const ChatInputSubmit: React.ForwardRefExoticComponent<ChatInputSubmitProps & React.RefAttributes<HTMLButtonElement>>;
40
+ export interface ChatInputToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
41
+ }
42
+ declare const ChatInputToolbar: React.ForwardRefExoticComponent<ChatInputToolbarProps & React.RefAttributes<HTMLDivElement>>;
43
+ export interface ChatInputActionsProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
44
+ asChild?: boolean;
45
+ }
46
+ declare const ChatInputActions: React.ForwardRefExoticComponent<ChatInputActionsProps & React.RefAttributes<HTMLButtonElement>>;
47
+ export interface ChatInputAttachmentProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
48
+ asChild?: boolean;
49
+ }
50
+ declare const ChatInputAttachment: React.ForwardRefExoticComponent<ChatInputAttachmentProps & React.RefAttributes<HTMLButtonElement>>;
51
+ export interface ChatInputVoiceInputProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
52
+ asChild?: boolean;
53
+ }
54
+ declare const ChatInputVoiceInput: React.ForwardRefExoticComponent<ChatInputVoiceInputProps & React.RefAttributes<HTMLButtonElement>>;
55
+ export interface ChatInputCommandMenuProps extends React.HTMLAttributes<HTMLDivElement> {
56
+ commands?: CommandMenuItem[];
57
+ }
58
+ declare const ChatInputCommandMenu: React.ForwardRefExoticComponent<ChatInputCommandMenuProps & React.RefAttributes<HTMLDivElement>>;
59
+ export type { CommandMenuItem };
60
+ export { ChatInputRoot as Root, ChatInputField as Field, ChatInputSubmit as Submit, ChatInputToolbar as Toolbar, ChatInputActions as Actions, ChatInputAttachment as Attachment, ChatInputVoiceInput as VoiceInput, ChatInputCommandMenu as CommandMenu, };