@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.
- package/README.md +11 -11
- package/dist/core/hooks/index.d.ts +1 -0
- package/dist/core/hooks/index.js +1 -0
- package/dist/core/hooks/use-chat-input.d.ts +17 -17
- package/dist/core/hooks/use-chat-input.js +55 -64
- package/dist/core/hooks/use-chat-messages.d.ts +11 -11
- package/dist/core/hooks/use-chat-messages.js +114 -121
- package/dist/core/hooks/use-chat-session.d.ts +5 -5
- package/dist/core/hooks/use-chat-session.js +80 -78
- package/dist/core/hooks/use-media-query.d.ts +5 -5
- package/dist/core/hooks/use-media-query.js +42 -38
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/schemas/chat.d.ts +56 -83
- package/dist/core/schemas/chat.js +25 -27
- package/dist/core/store/chat-store.d.ts +22 -28
- package/dist/core/store/chat-store.js +50 -59
- package/dist/gui/components/Button.d.ts +7 -23
- package/dist/gui/components/Button.js +27 -40
- package/dist/gui/components/Card.d.ts +7 -26
- package/dist/gui/components/Card.js +8 -54
- package/dist/gui/components/ChatHeader.d.ts +31 -58
- package/dist/gui/components/ChatHeader.js +68 -171
- package/dist/gui/components/ChatInput.d.ts +54 -58
- package/dist/gui/components/ChatInput.js +207 -194
- package/dist/gui/components/ChatInputCommandMenu.d.ts +20 -0
- package/dist/gui/components/ChatInputCommandMenu.js +62 -0
- package/dist/gui/components/ChatLayout.d.ts +41 -71
- package/dist/gui/components/ChatLayout.js +87 -214
- package/dist/gui/components/ChatPanelTabContent.d.ts +9 -18
- package/dist/gui/components/ChatPanelTabContent.js +10 -88
- package/dist/gui/components/ChatSecondaryPanel.d.ts +11 -14
- package/dist/gui/components/ChatSecondaryPanel.js +38 -115
- package/dist/gui/components/ChatSidebar.d.ts +13 -26
- package/dist/gui/components/ChatSidebar.js +14 -48
- package/dist/gui/components/ChatStatus.d.ts +2 -4
- package/dist/gui/components/ChatStatus.js +34 -45
- package/dist/gui/components/Conversation.d.ts +14 -17
- package/dist/gui/components/Conversation.js +83 -143
- package/dist/gui/components/Dialog.d.ts +11 -57
- package/dist/gui/components/Dialog.js +8 -84
- package/dist/gui/components/DropdownMenu.d.ts +20 -101
- package/dist/gui/components/DropdownMenu.js +14 -161
- package/dist/gui/components/HeightTransition.d.ts +7 -12
- package/dist/gui/components/HeightTransition.js +77 -88
- package/dist/gui/components/Input.d.ts +6 -13
- package/dist/gui/components/Input.js +16 -27
- package/dist/gui/components/Label.d.ts +1 -7
- package/dist/gui/components/Label.js +2 -12
- package/dist/gui/components/MarkdownRenderer.d.ts +4 -6
- package/dist/gui/components/MarkdownRenderer.js +81 -178
- package/dist/gui/components/Message.d.ts +22 -25
- package/dist/gui/components/Message.js +97 -44
- package/dist/gui/components/MessageContent.d.ts +22 -29
- package/dist/gui/components/MessageContent.js +85 -157
- package/dist/gui/components/Reasoning.d.ts +24 -30
- package/dist/gui/components/Reasoning.js +60 -187
- package/dist/gui/components/Response.d.ts +9 -11
- package/dist/gui/components/Response.js +90 -229
- package/dist/gui/components/Select.d.ts +10 -69
- package/dist/gui/components/Select.js +12 -118
- package/dist/gui/components/Sonner.d.ts +1 -3
- package/dist/gui/components/Sonner.js +18 -29
- package/dist/gui/components/Tabs.d.ts +4 -24
- package/dist/gui/components/Tabs.js +4 -32
- package/dist/gui/components/Task.d.ts +24 -28
- package/dist/gui/components/Task.js +31 -164
- package/dist/gui/components/Textarea.d.ts +7 -15
- package/dist/gui/components/Textarea.js +46 -63
- package/dist/gui/components/ThinkingBlock.d.ts +10 -20
- package/dist/gui/components/ThinkingBlock.js +35 -134
- package/dist/gui/components/TodoList.d.ts +10 -12
- package/dist/gui/components/TodoList.js +7 -22
- package/dist/gui/components/TodoListItem.d.ts +6 -9
- package/dist/gui/components/TodoListItem.js +4 -18
- package/dist/gui/components/index.d.ts +16 -59
- package/dist/gui/components/index.js +18 -42
- package/dist/gui/lib/utils.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.test.js +1 -0
- package/dist/sdk/client/acp-client.d.ts +76 -88
- package/dist/sdk/client/acp-client.js +217 -215
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/schemas/agent.d.ts +64 -111
- package/dist/sdk/schemas/agent.js +24 -24
- package/dist/sdk/schemas/message.d.ts +147 -245
- package/dist/sdk/schemas/message.js +40 -40
- package/dist/sdk/schemas/session.d.ts +135 -219
- package/dist/sdk/schemas/session.js +27 -27
- package/dist/sdk/transports/http.d.ts +55 -55
- package/dist/sdk/transports/http.js +469 -472
- package/dist/sdk/transports/stdio.d.ts +20 -20
- package/dist/sdk/transports/stdio.js +286 -289
- package/dist/sdk/transports/types.d.ts +42 -42
- package/dist/sdk/transports/websocket.d.ts +12 -12
- package/dist/sdk/transports/websocket.js +46 -52
- package/dist/tui/components/ChatView.d.ts +2 -4
- package/dist/tui/components/ChatView.js +18 -51
- package/dist/tui/components/GameOfLife.js +35 -64
- package/dist/tui/components/InputBox.d.ts +11 -18
- package/dist/tui/components/InputBox.js +10 -70
- package/dist/tui/components/MessageList.d.ts +2 -4
- package/dist/tui/components/MessageList.js +10 -37
- package/dist/tui/components/MultiSelect.d.ts +10 -15
- package/dist/tui/components/MultiSelect.js +73 -116
- package/dist/tui/components/ReadlineInput.d.ts +6 -12
- package/dist/tui/components/ReadlineInput.js +237 -252
- package/dist/tui/components/SingleSelect.d.ts +9 -15
- package/dist/tui/components/SingleSelect.js +43 -84
- package/dist/tui/components/StatusBar.d.ts +6 -11
- package/dist/tui/components/StatusBar.js +67 -102
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/package.json +6 -4
- package/src/styles/global.css +2 -0
- package/dist/core/hooks/index.d.ts.map +0 -1
- package/dist/core/hooks/index.js.map +0 -1
- package/dist/core/hooks/use-chat-input.d.ts.map +0 -1
- package/dist/core/hooks/use-chat-input.js.map +0 -1
- package/dist/core/hooks/use-chat-messages.d.ts.map +0 -1
- package/dist/core/hooks/use-chat-messages.js.map +0 -1
- package/dist/core/hooks/use-chat-session.d.ts.map +0 -1
- package/dist/core/hooks/use-chat-session.js.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/schemas/chat.d.ts.map +0 -1
- package/dist/core/schemas/chat.js.map +0 -1
- package/dist/core/schemas/index.d.ts.map +0 -1
- package/dist/core/schemas/index.js.map +0 -1
- package/dist/core/store/chat-store.d.ts.map +0 -1
- package/dist/core/store/chat-store.js.map +0 -1
- package/dist/gui/components/Button.d.ts.map +0 -1
- package/dist/gui/components/Button.js.map +0 -1
- package/dist/gui/components/Card.d.ts.map +0 -1
- package/dist/gui/components/Card.js.map +0 -1
- package/dist/gui/components/ChatInput.d.ts.map +0 -1
- package/dist/gui/components/ChatInput.js.map +0 -1
- package/dist/gui/components/ChatInterface.d.ts +0 -12
- package/dist/gui/components/ChatInterface.d.ts.map +0 -1
- package/dist/gui/components/ChatInterface.js +0 -204
- package/dist/gui/components/ChatInterface.js.map +0 -1
- package/dist/gui/components/ChatPreview.d.ts +0 -12
- package/dist/gui/components/ChatPreview.d.ts.map +0 -1
- package/dist/gui/components/ChatPreview.js +0 -214
- package/dist/gui/components/ChatPreview.js.map +0 -1
- package/dist/gui/components/ChatSecondaryPanel.d.ts.map +0 -1
- package/dist/gui/components/ChatSecondaryPanel.js.map +0 -1
- package/dist/gui/components/ChatStatus.d.ts.map +0 -1
- package/dist/gui/components/ChatStatus.js.map +0 -1
- package/dist/gui/components/ChatView.d.ts +0 -8
- package/dist/gui/components/ChatView.d.ts.map +0 -1
- package/dist/gui/components/ChatView.js +0 -42
- package/dist/gui/components/ChatView.js.map +0 -1
- package/dist/gui/components/ConfigPanel.d.ts +0 -20
- package/dist/gui/components/ConfigPanel.d.ts.map +0 -1
- package/dist/gui/components/ConfigPanel.js +0 -225
- package/dist/gui/components/ConfigPanel.js.map +0 -1
- package/dist/gui/components/Conversation.d.ts.map +0 -1
- package/dist/gui/components/Conversation.js.map +0 -1
- package/dist/gui/components/Dialog.d.ts.map +0 -1
- package/dist/gui/components/Dialog.js.map +0 -1
- package/dist/gui/components/HeightTransition.d.ts.map +0 -1
- package/dist/gui/components/HeightTransition.js.map +0 -1
- package/dist/gui/components/Input.d.ts.map +0 -1
- package/dist/gui/components/Input.js.map +0 -1
- package/dist/gui/components/InputBox.d.ts +0 -21
- package/dist/gui/components/InputBox.d.ts.map +0 -1
- package/dist/gui/components/InputBox.js +0 -90
- package/dist/gui/components/InputBox.js.map +0 -1
- package/dist/gui/components/Label.d.ts.map +0 -1
- package/dist/gui/components/Label.js.map +0 -1
- package/dist/gui/components/MarkdownRenderer.d.ts.map +0 -1
- package/dist/gui/components/MarkdownRenderer.js.map +0 -1
- package/dist/gui/components/Message.d.ts.map +0 -1
- package/dist/gui/components/Message.js.map +0 -1
- package/dist/gui/components/MessageContent.d.ts.map +0 -1
- package/dist/gui/components/MessageContent.js.map +0 -1
- package/dist/gui/components/MessageList.d.ts.map +0 -1
- package/dist/gui/components/MessageList.js.map +0 -1
- package/dist/gui/components/PlaygroundLayout.d.ts +0 -14
- package/dist/gui/components/PlaygroundLayout.d.ts.map +0 -1
- package/dist/gui/components/PlaygroundLayout.js +0 -49
- package/dist/gui/components/PlaygroundLayout.js.map +0 -1
- package/dist/gui/components/Reasoning.d.ts.map +0 -1
- package/dist/gui/components/Reasoning.js.map +0 -1
- package/dist/gui/components/Response.d.ts.map +0 -1
- package/dist/gui/components/Response.js.map +0 -1
- package/dist/gui/components/Select.d.ts.map +0 -1
- package/dist/gui/components/Select.js.map +0 -1
- package/dist/gui/components/StatusBar.d.ts +0 -12
- package/dist/gui/components/StatusBar.d.ts.map +0 -1
- package/dist/gui/components/StatusBar.js +0 -58
- package/dist/gui/components/StatusBar.js.map +0 -1
- package/dist/gui/components/Tabs.d.ts.map +0 -1
- package/dist/gui/components/Tabs.js.map +0 -1
- package/dist/gui/components/Task.d.ts.map +0 -1
- package/dist/gui/components/Task.js.map +0 -1
- package/dist/gui/components/Textarea.d.ts.map +0 -1
- package/dist/gui/components/Textarea.js.map +0 -1
- package/dist/gui/components/ThinkingBlock.d.ts.map +0 -1
- package/dist/gui/components/ThinkingBlock.js.map +0 -1
- package/dist/gui/components/TodoList.d.ts.map +0 -1
- package/dist/gui/components/TodoList.js.map +0 -1
- package/dist/gui/components/TodoListItem.d.ts.map +0 -1
- package/dist/gui/components/TodoListItem.js.map +0 -1
- package/dist/gui/components/index.d.ts.map +0 -1
- package/dist/gui/components/index.js.map +0 -1
- package/dist/gui/index.d.ts.map +0 -1
- package/dist/gui/index.js.map +0 -1
- package/dist/gui/lib/utils.d.ts.map +0 -1
- package/dist/gui/lib/utils.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/sdk/client/acp-client.d.ts.map +0 -1
- package/dist/sdk/client/acp-client.js.map +0 -1
- package/dist/sdk/client/index.d.ts.map +0 -1
- package/dist/sdk/client/index.js.map +0 -1
- package/dist/sdk/index.d.ts.map +0 -1
- package/dist/sdk/index.js.map +0 -1
- package/dist/sdk/schemas/agent.d.ts.map +0 -1
- package/dist/sdk/schemas/agent.js.map +0 -1
- package/dist/sdk/schemas/index.d.ts.map +0 -1
- package/dist/sdk/schemas/index.js.map +0 -1
- package/dist/sdk/schemas/message.d.ts.map +0 -1
- package/dist/sdk/schemas/message.js.map +0 -1
- package/dist/sdk/schemas/session.d.ts.map +0 -1
- package/dist/sdk/schemas/session.js.map +0 -1
- package/dist/sdk/transports/http.d.ts.map +0 -1
- package/dist/sdk/transports/http.js.map +0 -1
- package/dist/sdk/transports/index.d.ts.map +0 -1
- package/dist/sdk/transports/index.js.map +0 -1
- package/dist/sdk/transports/stdio.d.ts.map +0 -1
- package/dist/sdk/transports/stdio.js.map +0 -1
- package/dist/sdk/transports/types.d.ts.map +0 -1
- package/dist/sdk/transports/types.js.map +0 -1
- package/dist/sdk/transports/websocket.d.ts.map +0 -1
- package/dist/sdk/transports/websocket.js.map +0 -1
- package/dist/tui/components/ChatView.d.ts.map +0 -1
- package/dist/tui/components/ChatView.js.map +0 -1
- package/dist/tui/components/GameOfLife.d.ts.map +0 -1
- package/dist/tui/components/GameOfLife.js.map +0 -1
- package/dist/tui/components/InputBox.d.ts.map +0 -1
- package/dist/tui/components/InputBox.js.map +0 -1
- package/dist/tui/components/MessageList.d.ts.map +0 -1
- package/dist/tui/components/MessageList.js.map +0 -1
- package/dist/tui/components/ReadlineInput.d.ts.map +0 -1
- package/dist/tui/components/ReadlineInput.js.map +0 -1
- package/dist/tui/components/StatusBar.d.ts.map +0 -1
- package/dist/tui/components/StatusBar.js.map +0 -1
- package/dist/tui/components/index.d.ts.map +0 -1
- package/dist/tui/components/index.js.map +0 -1
- package/dist/tui/index.d.ts.map +0 -1
- 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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
67
|
-
|
|
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
|
-
|
|
78
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
export {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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, };
|