@townco/ui 0.1.7 → 0.1.9
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/dist/core/hooks/index.d.ts +1 -0
- package/dist/core/hooks/index.d.ts.map +1 -0
- package/dist/core/hooks/index.js +1 -0
- package/dist/core/hooks/index.js.map +1 -0
- package/dist/core/hooks/use-chat-input.d.ts +17 -17
- package/dist/core/hooks/use-chat-input.d.ts.map +1 -0
- package/dist/core/hooks/use-chat-input.js +64 -55
- package/dist/core/hooks/use-chat-input.js.map +1 -0
- package/dist/core/hooks/use-chat-messages.d.ts +11 -11
- package/dist/core/hooks/use-chat-messages.d.ts.map +1 -0
- package/dist/core/hooks/use-chat-messages.js +121 -114
- package/dist/core/hooks/use-chat-messages.js.map +1 -0
- package/dist/core/hooks/use-chat-session.d.ts +5 -5
- package/dist/core/hooks/use-chat-session.d.ts.map +1 -0
- package/dist/core/hooks/use-chat-session.js +78 -80
- package/dist/core/hooks/use-chat-session.js.map +1 -0
- package/dist/core/hooks/use-media-query.d.ts +39 -0
- package/dist/core/hooks/use-media-query.js +84 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/schemas/chat.d.ts +83 -56
- package/dist/core/schemas/chat.d.ts.map +1 -0
- package/dist/core/schemas/chat.js +27 -25
- package/dist/core/schemas/chat.js.map +1 -0
- package/dist/core/schemas/index.d.ts.map +1 -0
- package/dist/core/schemas/index.js.map +1 -0
- package/dist/core/store/chat-store.d.ts +28 -22
- package/dist/core/store/chat-store.d.ts.map +1 -0
- package/dist/core/store/chat-store.js +59 -50
- package/dist/core/store/chat-store.js.map +1 -0
- package/dist/gui/components/Button.d.ts +23 -7
- package/dist/gui/components/Button.d.ts.map +1 -0
- package/dist/gui/components/Button.js +40 -27
- package/dist/gui/components/Button.js.map +1 -0
- package/dist/gui/components/Card.d.ts +26 -7
- package/dist/gui/components/Card.d.ts.map +1 -0
- package/dist/gui/components/Card.js +54 -8
- package/dist/gui/components/Card.js.map +1 -0
- package/dist/gui/components/ChatHeader.d.ts +38 -0
- package/dist/gui/components/ChatHeader.js +86 -0
- package/dist/gui/components/ChatInput.d.ts +19 -1
- package/dist/gui/components/ChatInput.d.ts.map +1 -0
- package/dist/gui/components/ChatInput.js +94 -11
- package/dist/gui/components/ChatInput.js.map +1 -0
- package/dist/gui/components/ChatInputCommandMenu.d.ts +20 -0
- package/dist/gui/components/ChatInputCommandMenu.js +62 -0
- package/dist/gui/components/ChatInterface.d.ts +12 -0
- package/dist/gui/components/ChatInterface.d.ts.map +1 -0
- package/dist/gui/components/ChatInterface.js +204 -0
- package/dist/gui/components/ChatInterface.js.map +1 -0
- package/dist/gui/components/ChatLayout.d.ts +52 -0
- package/dist/gui/components/ChatLayout.js +105 -0
- package/dist/gui/components/ChatPanelTabContent.d.ts +18 -0
- package/dist/gui/components/ChatPanelTabContent.js +15 -0
- package/dist/gui/components/ChatPreview.d.ts +12 -0
- package/dist/gui/components/ChatPreview.d.ts.map +1 -0
- package/dist/gui/components/ChatPreview.js +214 -0
- package/dist/gui/components/ChatPreview.js.map +1 -0
- package/dist/gui/components/ChatSecondaryPanel.d.ts +14 -11
- package/dist/gui/components/ChatSecondaryPanel.d.ts.map +1 -0
- package/dist/gui/components/ChatSecondaryPanel.js +115 -38
- package/dist/gui/components/ChatSecondaryPanel.js.map +1 -0
- package/dist/gui/components/ChatSidebar.d.ts +14 -0
- package/dist/gui/components/ChatSidebar.js +23 -0
- package/dist/gui/components/ChatStatus.d.ts +4 -2
- package/dist/gui/components/ChatStatus.d.ts.map +1 -0
- package/dist/gui/components/ChatStatus.js +45 -34
- package/dist/gui/components/ChatStatus.js.map +1 -0
- package/dist/gui/components/ChatView.d.ts +8 -0
- package/dist/gui/components/ChatView.d.ts.map +1 -0
- package/dist/gui/components/ChatView.js +42 -0
- package/dist/gui/components/ChatView.js.map +1 -0
- package/dist/gui/components/ConfigPanel.d.ts +20 -0
- package/dist/gui/components/ConfigPanel.d.ts.map +1 -0
- package/dist/gui/components/ConfigPanel.js +225 -0
- package/dist/gui/components/ConfigPanel.js.map +1 -0
- package/dist/gui/components/Conversation.d.ts +17 -14
- package/dist/gui/components/Conversation.d.ts.map +1 -0
- package/dist/gui/components/Conversation.js +143 -83
- package/dist/gui/components/Conversation.js.map +1 -0
- package/dist/gui/components/Dialog.d.ts +57 -11
- package/dist/gui/components/Dialog.d.ts.map +1 -0
- package/dist/gui/components/Dialog.js +84 -8
- package/dist/gui/components/Dialog.js.map +1 -0
- package/dist/gui/components/DropdownMenu.d.ts +27 -0
- package/dist/gui/components/DropdownMenu.js +68 -0
- package/dist/gui/components/HeightTransition.d.ts +12 -7
- package/dist/gui/components/HeightTransition.d.ts.map +1 -0
- package/dist/gui/components/HeightTransition.js +88 -77
- package/dist/gui/components/HeightTransition.js.map +1 -0
- package/dist/gui/components/Input.d.ts +13 -6
- package/dist/gui/components/Input.d.ts.map +1 -0
- package/dist/gui/components/Input.js +27 -16
- package/dist/gui/components/Input.js.map +1 -0
- package/dist/gui/components/InputBox.d.ts +21 -0
- package/dist/gui/components/InputBox.d.ts.map +1 -0
- package/dist/gui/components/InputBox.js +90 -0
- package/dist/gui/components/InputBox.js.map +1 -0
- package/dist/gui/components/Label.d.ts +7 -1
- package/dist/gui/components/Label.d.ts.map +1 -0
- package/dist/gui/components/Label.js +12 -2
- package/dist/gui/components/Label.js.map +1 -0
- package/dist/gui/components/MarkdownRenderer.d.ts +6 -4
- package/dist/gui/components/MarkdownRenderer.d.ts.map +1 -0
- package/dist/gui/components/MarkdownRenderer.js +178 -81
- package/dist/gui/components/MarkdownRenderer.js.map +1 -0
- package/dist/gui/components/Message.d.ts +4 -0
- package/dist/gui/components/Message.d.ts.map +1 -0
- package/dist/gui/components/Message.js +77 -3
- package/dist/gui/components/Message.js.map +1 -0
- package/dist/gui/components/MessageContent.d.ts +29 -22
- package/dist/gui/components/MessageContent.d.ts.map +1 -0
- package/dist/gui/components/MessageContent.js +1 -1
- package/dist/gui/components/MessageContent.js.map +1 -0
- package/dist/gui/components/MessageList.d.ts.map +1 -0
- package/dist/gui/components/MessageList.js.map +1 -0
- package/dist/gui/components/PlaygroundLayout.d.ts +14 -0
- package/dist/gui/components/PlaygroundLayout.d.ts.map +1 -0
- package/dist/gui/components/PlaygroundLayout.js +49 -0
- package/dist/gui/components/PlaygroundLayout.js.map +1 -0
- package/dist/gui/components/Reasoning.d.ts +30 -24
- package/dist/gui/components/Reasoning.d.ts.map +1 -0
- package/dist/gui/components/Reasoning.js +187 -60
- package/dist/gui/components/Reasoning.js.map +1 -0
- package/dist/gui/components/Response.d.ts +11 -9
- package/dist/gui/components/Response.d.ts.map +1 -0
- package/dist/gui/components/Response.js +229 -90
- package/dist/gui/components/Response.js.map +1 -0
- package/dist/gui/components/Select.d.ts +69 -10
- package/dist/gui/components/Select.d.ts.map +1 -0
- package/dist/gui/components/Select.js +118 -12
- package/dist/gui/components/Select.js.map +1 -0
- package/dist/gui/components/Sonner.d.ts +5 -0
- package/dist/gui/components/Sonner.js +23 -0
- package/dist/gui/components/StatusBar.d.ts +12 -0
- package/dist/gui/components/StatusBar.d.ts.map +1 -0
- package/dist/gui/components/StatusBar.js +58 -0
- package/dist/gui/components/StatusBar.js.map +1 -0
- package/dist/gui/components/Tabs.d.ts +24 -4
- package/dist/gui/components/Tabs.d.ts.map +1 -0
- package/dist/gui/components/Tabs.js +32 -4
- package/dist/gui/components/Tabs.js.map +1 -0
- package/dist/gui/components/Task.d.ts +28 -24
- package/dist/gui/components/Task.d.ts.map +1 -0
- package/dist/gui/components/Task.js +164 -31
- package/dist/gui/components/Task.js.map +1 -0
- package/dist/gui/components/Textarea.d.ts +15 -7
- package/dist/gui/components/Textarea.d.ts.map +1 -0
- package/dist/gui/components/Textarea.js +63 -46
- package/dist/gui/components/Textarea.js.map +1 -0
- package/dist/gui/components/ThinkingBlock.d.ts +20 -10
- package/dist/gui/components/ThinkingBlock.d.ts.map +1 -0
- package/dist/gui/components/ThinkingBlock.js +134 -35
- package/dist/gui/components/ThinkingBlock.js.map +1 -0
- package/dist/gui/components/TodoList.d.ts +12 -10
- package/dist/gui/components/TodoList.d.ts.map +1 -0
- package/dist/gui/components/TodoList.js +22 -7
- package/dist/gui/components/TodoList.js.map +1 -0
- package/dist/gui/components/TodoListItem.d.ts +9 -6
- package/dist/gui/components/TodoListItem.d.ts.map +1 -0
- package/dist/gui/components/TodoListItem.js +18 -4
- package/dist/gui/components/TodoListItem.js.map +1 -0
- package/dist/gui/components/index.d.ts +9 -1
- package/dist/gui/components/index.d.ts.map +1 -0
- package/dist/gui/components/index.js +11 -1
- package/dist/gui/components/index.js.map +1 -0
- package/dist/gui/index.d.ts.map +1 -0
- package/dist/gui/index.js.map +1 -0
- package/dist/gui/lib/utils.d.ts.map +1 -0
- package/dist/gui/lib/utils.js +1 -1
- package/dist/gui/lib/utils.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.js +0 -1
- package/dist/sdk/client/acp-client.d.ts +88 -76
- package/dist/sdk/client/acp-client.d.ts.map +1 -0
- package/dist/sdk/client/acp-client.js +215 -217
- package/dist/sdk/client/acp-client.js.map +1 -0
- package/dist/sdk/client/index.d.ts.map +1 -0
- package/dist/sdk/client/index.js.map +1 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/schemas/agent.d.ts +111 -64
- package/dist/sdk/schemas/agent.d.ts.map +1 -0
- package/dist/sdk/schemas/agent.js +24 -24
- package/dist/sdk/schemas/agent.js.map +1 -0
- package/dist/sdk/schemas/index.d.ts.map +1 -0
- package/dist/sdk/schemas/index.js.map +1 -0
- package/dist/sdk/schemas/message.d.ts +245 -147
- package/dist/sdk/schemas/message.d.ts.map +1 -0
- package/dist/sdk/schemas/message.js +40 -40
- package/dist/sdk/schemas/message.js.map +1 -0
- package/dist/sdk/schemas/session.d.ts +219 -135
- package/dist/sdk/schemas/session.d.ts.map +1 -0
- package/dist/sdk/schemas/session.js +27 -27
- package/dist/sdk/schemas/session.js.map +1 -0
- package/dist/sdk/transports/http.d.ts +55 -55
- package/dist/sdk/transports/http.d.ts.map +1 -0
- package/dist/sdk/transports/http.js +472 -469
- package/dist/sdk/transports/http.js.map +1 -0
- package/dist/sdk/transports/index.d.ts.map +1 -0
- package/dist/sdk/transports/index.js.map +1 -0
- package/dist/sdk/transports/stdio.d.ts +20 -20
- package/dist/sdk/transports/stdio.d.ts.map +1 -0
- package/dist/sdk/transports/stdio.js.map +1 -0
- package/dist/sdk/transports/types.d.ts +42 -42
- package/dist/sdk/transports/types.d.ts.map +1 -0
- package/dist/sdk/transports/types.js.map +1 -0
- package/dist/sdk/transports/websocket.d.ts +12 -12
- package/dist/sdk/transports/websocket.d.ts.map +1 -0
- package/dist/sdk/transports/websocket.js +52 -46
- package/dist/sdk/transports/websocket.js.map +1 -0
- package/dist/tui/components/ChatView.d.ts +4 -2
- package/dist/tui/components/ChatView.d.ts.map +1 -0
- package/dist/tui/components/ChatView.js +51 -18
- package/dist/tui/components/ChatView.js.map +1 -0
- package/dist/tui/components/GameOfLife.d.ts.map +1 -0
- package/dist/tui/components/GameOfLife.js +64 -35
- package/dist/tui/components/GameOfLife.js.map +1 -0
- package/dist/tui/components/InputBox.d.ts +18 -11
- package/dist/tui/components/InputBox.d.ts.map +1 -0
- package/dist/tui/components/InputBox.js +70 -10
- package/dist/tui/components/InputBox.js.map +1 -0
- package/dist/tui/components/MessageList.d.ts +4 -2
- package/dist/tui/components/MessageList.d.ts.map +1 -0
- package/dist/tui/components/MessageList.js +37 -10
- package/dist/tui/components/MessageList.js.map +1 -0
- package/dist/tui/components/ReadlineInput.d.ts +12 -6
- package/dist/tui/components/ReadlineInput.d.ts.map +1 -0
- package/dist/tui/components/ReadlineInput.js +252 -237
- package/dist/tui/components/ReadlineInput.js.map +1 -0
- package/dist/tui/components/SingleSelect.d.ts +15 -9
- package/dist/tui/components/SingleSelect.js +84 -43
- package/dist/tui/components/StatusBar.d.ts +11 -6
- package/dist/tui/components/StatusBar.d.ts.map +1 -0
- package/dist/tui/components/StatusBar.js +102 -67
- package/dist/tui/components/StatusBar.js.map +1 -0
- package/dist/tui/components/index.d.ts.map +1 -0
- package/dist/tui/components/index.js.map +1 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js.map +1 -0
- package/package.json +6 -4
- package/src/styles/global.css +2 -0
|
@@ -3,54 +3,63 @@ import { create } from "zustand";
|
|
|
3
3
|
* Create chat store
|
|
4
4
|
*/
|
|
5
5
|
export const useChatStore = create((set) => ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
6
|
+
// Initial state
|
|
7
|
+
connectionStatus: "disconnected",
|
|
8
|
+
sessionId: null,
|
|
9
|
+
error: null,
|
|
10
|
+
messages: [],
|
|
11
|
+
isStreaming: false,
|
|
12
|
+
streamingStartTime: null,
|
|
13
|
+
input: {
|
|
14
|
+
value: "",
|
|
15
|
+
isSubmitting: false,
|
|
16
|
+
attachedFiles: [],
|
|
17
|
+
},
|
|
18
|
+
// Actions
|
|
19
|
+
setConnectionStatus: (status) => set({ connectionStatus: status }),
|
|
20
|
+
setSessionId: (id) => set({ sessionId: id }),
|
|
21
|
+
setError: (error) => set({ error }),
|
|
22
|
+
addMessage: (message) =>
|
|
23
|
+
set((state) => ({
|
|
24
|
+
messages: [...state.messages, message],
|
|
25
|
+
})),
|
|
26
|
+
updateMessage: (id, updates) =>
|
|
27
|
+
set((state) => ({
|
|
28
|
+
messages: state.messages.map((msg) =>
|
|
29
|
+
msg.id === id ? { ...msg, ...updates } : msg,
|
|
30
|
+
),
|
|
31
|
+
})),
|
|
32
|
+
clearMessages: () => set({ messages: [] }),
|
|
33
|
+
setIsStreaming: (streaming) => set({ isStreaming: streaming }),
|
|
34
|
+
setStreamingStartTime: (time) => set({ streamingStartTime: time }),
|
|
35
|
+
setInputValue: (value) =>
|
|
36
|
+
set((state) => ({
|
|
37
|
+
input: { ...state.input, value },
|
|
38
|
+
})),
|
|
39
|
+
setInputSubmitting: (submitting) =>
|
|
40
|
+
set((state) => ({
|
|
41
|
+
input: { ...state.input, isSubmitting: submitting },
|
|
42
|
+
})),
|
|
43
|
+
addFileAttachment: (file) =>
|
|
44
|
+
set((state) => ({
|
|
45
|
+
input: {
|
|
46
|
+
...state.input,
|
|
47
|
+
attachedFiles: [...state.input.attachedFiles, file],
|
|
48
|
+
},
|
|
49
|
+
})),
|
|
50
|
+
removeFileAttachment: (index) =>
|
|
51
|
+
set((state) => ({
|
|
52
|
+
input: {
|
|
53
|
+
...state.input,
|
|
54
|
+
attachedFiles: state.input.attachedFiles.filter((_, i) => i !== index),
|
|
55
|
+
},
|
|
56
|
+
})),
|
|
57
|
+
clearInput: () =>
|
|
58
|
+
set((_state) => ({
|
|
59
|
+
input: {
|
|
60
|
+
value: "",
|
|
61
|
+
isSubmitting: false,
|
|
62
|
+
attachedFiles: [],
|
|
63
|
+
},
|
|
64
|
+
})),
|
|
56
65
|
}));
|
|
@@ -0,0 +1 @@
|
|
|
1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CAAC;SACvE;KACF,CAAC,CAAC;IAEL,UAAU,EAAE,GAAG,EAAE,CACf,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACf,KAAK,EAAE;YACL,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,EAAE;SAClB;KACF,CAAC,CAAC;CACN,CAAC,CAAC,CAAC"}
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
declare const buttonVariants: (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
declare const buttonVariants: (
|
|
4
|
+
props?:
|
|
5
|
+
| ({
|
|
6
|
+
variant?:
|
|
7
|
+
| "default"
|
|
8
|
+
| "destructive"
|
|
9
|
+
| "outline"
|
|
10
|
+
| "secondary"
|
|
11
|
+
| "ghost"
|
|
12
|
+
| "link"
|
|
13
|
+
| null
|
|
14
|
+
| undefined;
|
|
15
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
16
|
+
} & import("class-variance-authority/types").ClassProp)
|
|
17
|
+
| undefined,
|
|
18
|
+
) => string;
|
|
19
|
+
export interface ButtonProps
|
|
20
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
21
|
+
VariantProps<typeof buttonVariants> {
|
|
22
|
+
asChild?: boolean;
|
|
9
23
|
}
|
|
10
|
-
declare const Button: React.ForwardRefExoticComponent<
|
|
24
|
+
declare const Button: React.ForwardRefExoticComponent<
|
|
25
|
+
ButtonProps & React.RefAttributes<HTMLButtonElement>
|
|
26
|
+
>;
|
|
11
27
|
export { Button, buttonVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/gui/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,cAAc;;;8EA2BnB,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,MAAM,uFAWX,CAAC;AAGF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,33 +1,46 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
2
|
import { cva } from "class-variance-authority";
|
|
4
3
|
import * as React from "react";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
import { cn } from "../lib/utils.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13
|
+
destructive:
|
|
14
|
+
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
15
|
+
outline:
|
|
16
|
+
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
17
|
+
secondary:
|
|
18
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
19
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
20
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default: "h-10 px-4 py-2",
|
|
24
|
+
sm: "h-9 rounded-md px-3",
|
|
25
|
+
lg: "h-11 rounded-md px-8",
|
|
26
|
+
icon: "h-10 w-10",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
variant: "default",
|
|
31
|
+
size: "default",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
const Button = React.forwardRef(
|
|
36
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
37
|
+
const Comp = asChild ? Slot : "button";
|
|
38
|
+
return _jsx(Comp, {
|
|
39
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
40
|
+
ref: ref,
|
|
41
|
+
...props,
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
);
|
|
32
45
|
Button.displayName = "Button";
|
|
33
46
|
export { Button, buttonVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/gui/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,MAAM,cAAc,GAAG,GAAG,CACxB,0VAA0V,EAC1V;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,wDAAwD;YACjE,WAAW,EACT,oEAAoE;YACtE,OAAO,EACL,gFAAgF;YAClF,SAAS,EACP,8DAA8D;YAChE,KAAK,EAAE,8CAA8C;YACrD,IAAI,EAAE,iDAAiD;SACxD;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,gBAAgB;YACzB,EAAE,EAAE,qBAAqB;YACzB,EAAE,EAAE,sBAAsB;YAC1B,IAAI,EAAE,WAAW;SAClB;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAC;AAQF,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAC7B,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IACvC,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAC3D,GAAG,EAAE,GAAG,KACJ,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AACF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const Card: React.ForwardRefExoticComponent<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
declare const Card: React.ForwardRefExoticComponent<
|
|
3
|
+
React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>
|
|
4
|
+
>;
|
|
5
|
+
declare const CardHeader: React.ForwardRefExoticComponent<
|
|
6
|
+
React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>
|
|
7
|
+
>;
|
|
8
|
+
declare const CardTitle: React.ForwardRefExoticComponent<
|
|
9
|
+
React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>
|
|
10
|
+
>;
|
|
11
|
+
declare const CardDescription: React.ForwardRefExoticComponent<
|
|
12
|
+
React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>
|
|
13
|
+
>;
|
|
14
|
+
declare const CardContent: React.ForwardRefExoticComponent<
|
|
15
|
+
React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>
|
|
16
|
+
>;
|
|
17
|
+
declare const CardFooter: React.ForwardRefExoticComponent<
|
|
18
|
+
React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>
|
|
19
|
+
>;
|
|
20
|
+
export {
|
|
21
|
+
Card,
|
|
22
|
+
CardHeader,
|
|
23
|
+
CardFooter,
|
|
24
|
+
CardTitle,
|
|
25
|
+
CardDescription,
|
|
26
|
+
CardContent,
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/gui/components/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,IAAI,6GAYR,CAAC;AAGH,QAAA,MAAM,UAAU,6GASd,CAAC;AAGH,QAAA,MAAM,SAAS,6GAYb,CAAC;AAGH,QAAA,MAAM,eAAe,6GASnB,CAAC;AAGH,QAAA,MAAM,WAAW,6GAKf,CAAC;AAGH,QAAA,MAAM,UAAU,6GASd,CAAC;AAGH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,16 +1,62 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
const Card = React.forwardRef(({ className, ...props }, ref) =>
|
|
6
|
+
_jsx("div", {
|
|
7
|
+
ref: ref,
|
|
8
|
+
className: cn(
|
|
9
|
+
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
10
|
+
className,
|
|
11
|
+
),
|
|
12
|
+
...props,
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
5
15
|
Card.displayName = "Card";
|
|
6
|
-
const CardHeader = React.forwardRef(({ className, ...props }, ref) =>
|
|
16
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) =>
|
|
17
|
+
_jsx("div", {
|
|
18
|
+
ref: ref,
|
|
19
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
20
|
+
...props,
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
7
23
|
CardHeader.displayName = "CardHeader";
|
|
8
|
-
const CardTitle = React.forwardRef(({ className, ...props }, ref) =>
|
|
24
|
+
const CardTitle = React.forwardRef(({ className, ...props }, ref) =>
|
|
25
|
+
_jsx("div", {
|
|
26
|
+
ref: ref,
|
|
27
|
+
className: cn(
|
|
28
|
+
"text-2xl font-semibold leading-none tracking-tight",
|
|
29
|
+
className,
|
|
30
|
+
),
|
|
31
|
+
...props,
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
9
34
|
CardTitle.displayName = "CardTitle";
|
|
10
|
-
const CardDescription = React.forwardRef(({ className, ...props }, ref) =>
|
|
35
|
+
const CardDescription = React.forwardRef(({ className, ...props }, ref) =>
|
|
36
|
+
_jsx("div", {
|
|
37
|
+
ref: ref,
|
|
38
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
39
|
+
...props,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
11
42
|
CardDescription.displayName = "CardDescription";
|
|
12
|
-
const CardContent = React.forwardRef(({ className, ...props }, ref) =>
|
|
43
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) =>
|
|
44
|
+
_jsx("div", { ref: ref, className: cn("p-6 pt-0", className), ...props }),
|
|
45
|
+
);
|
|
13
46
|
CardContent.displayName = "CardContent";
|
|
14
|
-
const CardFooter = React.forwardRef(({ className, ...props }, ref) =>
|
|
47
|
+
const CardFooter = React.forwardRef(({ className, ...props }, ref) =>
|
|
48
|
+
_jsx("div", {
|
|
49
|
+
ref: ref,
|
|
50
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
51
|
+
...props,
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
15
54
|
CardFooter.displayName = "CardFooter";
|
|
16
|
-
export {
|
|
55
|
+
export {
|
|
56
|
+
Card,
|
|
57
|
+
CardHeader,
|
|
58
|
+
CardFooter,
|
|
59
|
+
CardTitle,
|
|
60
|
+
CardDescription,
|
|
61
|
+
CardContent,
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../src/gui/components/Card.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAG3B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,0DAA0D,EAC1D,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AACH,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;AAE1B,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAGjC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,cACE,GAA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H,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface ChatHeaderContextValue {
|
|
3
|
+
isExpanded: boolean;
|
|
4
|
+
setIsExpanded: (expanded: boolean) => void;
|
|
5
|
+
}
|
|
6
|
+
declare const useChatHeaderContext: () => ChatHeaderContextValue;
|
|
7
|
+
export interface ChatHeaderRootProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/** Initial expanded state */
|
|
9
|
+
defaultExpanded?: boolean;
|
|
10
|
+
/** Controlled expanded state */
|
|
11
|
+
expanded?: boolean;
|
|
12
|
+
/** Callback when expanded state changes */
|
|
13
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
declare const ChatHeaderRoot: React.ForwardRefExoticComponent<ChatHeaderRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export interface ChatHeaderTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
17
|
+
}
|
|
18
|
+
declare const ChatHeaderTitle: React.ForwardRefExoticComponent<ChatHeaderTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
19
|
+
export interface ChatHeaderActionsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
}
|
|
21
|
+
declare const ChatHeaderActions: React.ForwardRefExoticComponent<ChatHeaderActionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
export type ConnectionStatus = "connected" | "connecting" | "error" | "disconnected";
|
|
23
|
+
export interface ChatHeaderStatusIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
24
|
+
/** Connection status */
|
|
25
|
+
status: ConnectionStatus;
|
|
26
|
+
/** Optional status text override */
|
|
27
|
+
statusText?: string;
|
|
28
|
+
}
|
|
29
|
+
declare const ChatHeaderStatusIndicator: React.ForwardRefExoticComponent<ChatHeaderStatusIndicatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
export interface ChatHeaderToggleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
31
|
+
/** Icon to display (should rotate based on expanded state) */
|
|
32
|
+
icon?: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
declare const ChatHeaderToggle: React.ForwardRefExoticComponent<ChatHeaderToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
35
|
+
export interface ChatHeaderExpandablePanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
36
|
+
}
|
|
37
|
+
declare const ChatHeaderExpandablePanel: React.ForwardRefExoticComponent<ChatHeaderExpandablePanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
38
|
+
export { ChatHeaderRoot as Root, ChatHeaderTitle as Title, ChatHeaderActions as Actions, ChatHeaderStatusIndicator as StatusIndicator, ChatHeaderToggle as Toggle, ChatHeaderExpandablePanel as ExpandablePanel, useChatHeaderContext, };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../lib/utils.js";
|
|
4
|
+
const ChatHeaderContext = React.createContext(undefined);
|
|
5
|
+
const useChatHeaderContext = () => {
|
|
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;
|
|
11
|
+
};
|
|
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
|
+
});
|
|
28
|
+
ChatHeaderRoot.displayName = "ChatHeader.Root";
|
|
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
|
+
});
|
|
32
|
+
ChatHeaderTitle.displayName = "ChatHeader.Title";
|
|
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
|
+
});
|
|
36
|
+
ChatHeaderActions.displayName = "ChatHeader.Actions";
|
|
37
|
+
const getStatusColor = (status) => {
|
|
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
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const getDefaultStatusText = (status) => {
|
|
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
|
+
}
|
|
60
|
+
};
|
|
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
|
+
});
|
|
66
|
+
ChatHeaderStatusIndicator.displayName = "ChatHeader.StatusIndicator";
|
|
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
|
+
});
|
|
75
|
+
ChatHeaderToggle.displayName = "ChatHeader.Toggle";
|
|
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
|
+
});
|
|
82
|
+
ChatHeaderExpandablePanel.displayName = "ChatHeader.ExpandablePanel";
|
|
83
|
+
/* -------------------------------------------------------------------------------------------------
|
|
84
|
+
* Exports
|
|
85
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
86
|
+
export { ChatHeaderRoot as Root, ChatHeaderTitle as Title, ChatHeaderActions as Actions, ChatHeaderStatusIndicator as StatusIndicator, ChatHeaderToggle as Toggle, ChatHeaderExpandablePanel as ExpandablePanel, useChatHeaderContext, };
|
|
@@ -1,5 +1,6 @@
|
|
|
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
5
|
export interface ChatInputRootProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, "onChange" | "onSubmit"> {
|
|
5
6
|
/**
|
|
@@ -39,4 +40,21 @@ declare const ChatInputSubmit: React.ForwardRefExoticComponent<ChatInputSubmitPr
|
|
|
39
40
|
export interface ChatInputToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
40
41
|
}
|
|
41
42
|
declare const ChatInputToolbar: React.ForwardRefExoticComponent<ChatInputToolbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
-
export
|
|
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, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatInput.d.ts","sourceRoot":"","sources":["../../../src/gui/components/ChatInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAoC3D,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAChF;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAE1B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC,gCAAgC;IAChC,QAAQ,CAAC,EA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