@townco/ui 0.1.6 → 0.1.7
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/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/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/ChatInput.d.ts +36 -58
- package/dist/gui/components/ChatInput.js +121 -191
- package/dist/gui/components/ChatSecondaryPanel.d.ts +11 -14
- package/dist/gui/components/ChatSecondaryPanel.js +38 -115
- 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/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 +18 -25
- package/dist/gui/components/Message.js +23 -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/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 +8 -59
- package/dist/gui/components/index.js +8 -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 +2 -2
- 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/hooks/use-media-query.d.ts +0 -39
- package/dist/core/hooks/use-media-query.js +0 -80
- 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/ChatHeader.d.ts +0 -65
- package/dist/gui/components/ChatHeader.js +0 -189
- 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/ChatLayout.d.ts +0 -82
- package/dist/gui/components/ChatLayout.js +0 -232
- package/dist/gui/components/ChatPanelTabContent.d.ts +0 -27
- package/dist/gui/components/ChatPanelTabContent.js +0 -93
- 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/ChatSidebar.d.ts +0 -27
- package/dist/gui/components/ChatSidebar.js +0 -57
- 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/DropdownMenu.d.ts +0 -108
- package/dist/gui/components/DropdownMenu.js +0 -215
- 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/Sonner.d.ts +0 -7
- package/dist/gui/components/Sonner.js +0 -34
- 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,46 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
2
3
|
import { cva } from "class-variance-authority";
|
|
3
4
|
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
|
-
|
|
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
|
-
);
|
|
6
|
+
const buttonVariants = cva("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", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
10
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
11
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
12
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
13
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
14
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
default: "h-10 px-4 py-2",
|
|
18
|
+
sm: "h-9 rounded-md px-3",
|
|
19
|
+
lg: "h-11 rounded-md px-8",
|
|
20
|
+
icon: "h-10 w-10",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
variant: "default",
|
|
25
|
+
size: "default",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
29
|
+
const Comp = asChild ? Slot : "button";
|
|
30
|
+
return (_jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
|
|
31
|
+
});
|
|
45
32
|
Button.displayName = "Button";
|
|
46
33
|
export { Button, buttonVariants };
|
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const Card: React.ForwardRefExoticComponent<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
};
|
|
2
|
+
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent, };
|
|
@@ -1,62 +1,16 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
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
|
-
);
|
|
4
|
+
const Card = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("rounded-lg border bg-card text-card-foreground shadow-sm", className), ...props })));
|
|
15
5
|
Card.displayName = "Card";
|
|
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
|
-
);
|
|
6
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })));
|
|
23
7
|
CardHeader.displayName = "CardHeader";
|
|
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
|
-
);
|
|
8
|
+
const CardTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("text-2xl font-semibold leading-none tracking-tight", className), ...props })));
|
|
34
9
|
CardTitle.displayName = "CardTitle";
|
|
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
|
-
);
|
|
10
|
+
const CardDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("text-sm text-muted-foreground", className), ...props })));
|
|
42
11
|
CardDescription.displayName = "CardDescription";
|
|
43
|
-
const CardContent = React.forwardRef(({ className, ...props }, ref) =>
|
|
44
|
-
_jsx("div", { ref: ref, className: cn("p-6 pt-0", className), ...props }),
|
|
45
|
-
);
|
|
12
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("p-6 pt-0", className), ...props })));
|
|
46
13
|
CardContent.displayName = "CardContent";
|
|
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
|
-
);
|
|
14
|
+
const CardFooter = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("flex items-center p-6 pt-0", className), ...props })));
|
|
54
15
|
CardFooter.displayName = "CardFooter";
|
|
55
|
-
export {
|
|
56
|
-
Card,
|
|
57
|
-
CardHeader,
|
|
58
|
-
CardFooter,
|
|
59
|
-
CardTitle,
|
|
60
|
-
CardDescription,
|
|
61
|
-
CardContent,
|
|
62
|
-
};
|
|
16
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent, };
|
|
@@ -1,64 +1,42 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { AcpClient } from "../../sdk/client/index.js";
|
|
3
3
|
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;
|
|
4
|
+
export interface ChatInputRootProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, "onChange" | "onSubmit"> {
|
|
5
|
+
/**
|
|
6
|
+
* ACP Client for hook-based input management (recommended pattern)
|
|
7
|
+
* Either client or value/onChange/onSubmit must be provided
|
|
8
|
+
*/
|
|
9
|
+
client?: AcpClient | null;
|
|
10
|
+
/**
|
|
11
|
+
* Input value (legacy prop-based pattern)
|
|
12
|
+
* Either client or value/onChange/onSubmit must be provided
|
|
13
|
+
*/
|
|
14
|
+
value?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Input change handler (legacy prop-based pattern)
|
|
17
|
+
*/
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Submit handler (legacy prop-based pattern)
|
|
21
|
+
*/
|
|
22
|
+
onSubmit?: () => void | Promise<void>;
|
|
23
|
+
/** Whether input is disabled */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** Whether input is currently submitting */
|
|
26
|
+
isSubmitting?: boolean;
|
|
27
|
+
/** Whether to submit on Enter key (default: true) */
|
|
28
|
+
submitOnEnter?: boolean;
|
|
33
29
|
}
|
|
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;
|
|
30
|
+
declare const ChatInputRoot: React.ForwardRefExoticComponent<ChatInputRootProps & React.RefAttributes<HTMLFormElement>>;
|
|
31
|
+
export interface ChatInputFieldProps extends Omit<React.ComponentPropsWithoutRef<typeof Textarea>, "value" | "onChange"> {
|
|
32
|
+
asChild?: boolean;
|
|
43
33
|
}
|
|
44
|
-
declare const ChatInputField: React.ForwardRefExoticComponent<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export interface ChatInputSubmitProps
|
|
48
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
49
|
-
asChild?: boolean;
|
|
34
|
+
declare const ChatInputField: React.ForwardRefExoticComponent<ChatInputFieldProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
35
|
+
export interface ChatInputSubmitProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
36
|
+
asChild?: boolean;
|
|
50
37
|
}
|
|
51
|
-
declare const ChatInputSubmit: React.ForwardRefExoticComponent<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
};
|
|
38
|
+
declare const ChatInputSubmit: React.ForwardRefExoticComponent<ChatInputSubmitProps & React.RefAttributes<HTMLButtonElement>>;
|
|
39
|
+
export interface ChatInputToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
40
|
+
}
|
|
41
|
+
declare const ChatInputToolbar: React.ForwardRefExoticComponent<ChatInputToolbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
export { ChatInputRoot as Root, ChatInputField as Field, ChatInputSubmit as Submit, ChatInputToolbar as Toolbar, };
|
|
@@ -1,207 +1,137 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
2
3
|
import * as React from "react";
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
import { useChatInput as useCoreChatInput } from "../../core/hooks/use-chat-input.js";
|
|
5
5
|
import { useChatStore } from "../../core/store/chat-store.js";
|
|
6
6
|
import { cn } from "../lib/utils.js";
|
|
7
7
|
import { Button } from "./Button.js";
|
|
8
|
-
|
|
9
8
|
const ChatInputContext = React.createContext(undefined);
|
|
10
9
|
const useChatInputContext = () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const context = React.useContext(ChatInputContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error("ChatInput components must be used within ChatInput.Root");
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
16
15
|
};
|
|
17
|
-
const ChatInputRoot = React.forwardRef(
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
React.useEffect(() => {
|
|
65
|
-
if (!value && textareaRef.current) {
|
|
66
|
-
textareaRef.current.style.height = "auto";
|
|
67
|
-
textareaRef.current.style.overflowY = "hidden";
|
|
68
|
-
}
|
|
69
|
-
}, [value]);
|
|
70
|
-
return _jsx(ChatInputContext.Provider, {
|
|
71
|
-
value: {
|
|
72
|
-
value,
|
|
73
|
-
onChange,
|
|
74
|
-
onSubmit,
|
|
75
|
-
disabled,
|
|
76
|
-
isSubmitting,
|
|
77
|
-
submitOnEnter,
|
|
78
|
-
},
|
|
79
|
-
children: _jsx("form", {
|
|
80
|
-
ref: ref,
|
|
81
|
-
onSubmit: handleSubmit,
|
|
82
|
-
className: cn(
|
|
83
|
-
"w-full divide-y overflow-hidden rounded-xl border bg-background shadow-sm",
|
|
84
|
-
className,
|
|
85
|
-
),
|
|
86
|
-
...props,
|
|
87
|
-
children: children,
|
|
88
|
-
}),
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
);
|
|
16
|
+
const ChatInputRoot = React.forwardRef(({ client, value: valueProp, onChange: onChangeProp, onSubmit: onSubmitProp, disabled = false, isSubmitting: isSubmittingProp, submitOnEnter = true, className, children, ...props }, ref) => {
|
|
17
|
+
const textareaRef = React.useRef(null);
|
|
18
|
+
// Always call hooks unconditionally (React rules)
|
|
19
|
+
const hookData = useCoreChatInput(client ?? null);
|
|
20
|
+
const storeIsStreaming = useChatStore((state) => state.isStreaming);
|
|
21
|
+
// Choose data source based on whether client is provided
|
|
22
|
+
const value = hookData ? hookData.value : valueProp || "";
|
|
23
|
+
const onChange = hookData ? hookData.onChange : onChangeProp || (() => { });
|
|
24
|
+
const onSubmit = hookData
|
|
25
|
+
? hookData.onSubmit
|
|
26
|
+
: onSubmitProp || (async () => { });
|
|
27
|
+
const isSubmitting = hookData
|
|
28
|
+
? hookData.isSubmitting || storeIsStreaming
|
|
29
|
+
: isSubmittingProp || false;
|
|
30
|
+
const handleSubmit = async (e) => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
if (value.trim() && !isSubmitting && !disabled) {
|
|
33
|
+
await onSubmit();
|
|
34
|
+
// Restore focus to textarea after submit
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
textareaRef.current?.focus();
|
|
37
|
+
}, 0);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
// Expose textarea ref to children via context
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
const textarea = document.querySelector('textarea[name="chat-input"]');
|
|
43
|
+
if (textarea && textareaRef.current !== textarea) {
|
|
44
|
+
textareaRef.current = textarea;
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
// Reset textarea height when value becomes empty (after submit)
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
if (!value && textareaRef.current) {
|
|
50
|
+
textareaRef.current.style.height = "auto";
|
|
51
|
+
textareaRef.current.style.overflowY = "hidden";
|
|
52
|
+
}
|
|
53
|
+
}, [value]);
|
|
54
|
+
return (_jsx(ChatInputContext.Provider, { value: {
|
|
55
|
+
value,
|
|
56
|
+
onChange,
|
|
57
|
+
onSubmit,
|
|
58
|
+
disabled,
|
|
59
|
+
isSubmitting,
|
|
60
|
+
submitOnEnter,
|
|
61
|
+
}, children: _jsx("form", { ref: ref, onSubmit: handleSubmit, className: cn("w-full divide-y overflow-hidden rounded-xl border bg-background shadow-sm", className), ...props, children: children }) }));
|
|
62
|
+
});
|
|
92
63
|
ChatInputRoot.displayName = "ChatInput.Root";
|
|
93
|
-
const ChatInputField = React.forwardRef(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
...fieldProps,
|
|
151
|
-
className: cn(
|
|
152
|
-
"w-full resize-none rounded-none border-none p-3 shadow-none",
|
|
153
|
-
"outline-none ring-0 field-sizing-content max-h-[6lh]",
|
|
154
|
-
"bg-transparent dark:bg-transparent focus-visible:ring-0",
|
|
155
|
-
"text-sm placeholder:text-muted-foreground",
|
|
156
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
157
|
-
className,
|
|
158
|
-
),
|
|
159
|
-
});
|
|
160
|
-
},
|
|
161
|
-
);
|
|
64
|
+
const ChatInputField = React.forwardRef(({ asChild = false, className, onKeyDown, children, ...props }, ref) => {
|
|
65
|
+
const { value, onChange, onSubmit, disabled, isSubmitting, submitOnEnter } = useChatInputContext();
|
|
66
|
+
const textareaRef = React.useRef(null);
|
|
67
|
+
const handleRef = React.useCallback((node) => {
|
|
68
|
+
textareaRef.current = node;
|
|
69
|
+
if (typeof ref === "function") {
|
|
70
|
+
ref(node);
|
|
71
|
+
}
|
|
72
|
+
else if (ref) {
|
|
73
|
+
ref.current = node;
|
|
74
|
+
}
|
|
75
|
+
}, [ref]);
|
|
76
|
+
const handleKeyDown = (e) => {
|
|
77
|
+
// Handle Enter without Shift - only submit if not already submitting
|
|
78
|
+
if (submitOnEnter && e.key === "Enter" && !e.shiftKey) {
|
|
79
|
+
// Only prevent default and submit if conditions are met
|
|
80
|
+
if (value.trim() && !isSubmitting && !disabled) {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
onSubmit();
|
|
83
|
+
}
|
|
84
|
+
else if (isSubmitting || disabled) {
|
|
85
|
+
// Block Enter when submitting or disabled - don't add newline
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
onKeyDown?.(e);
|
|
90
|
+
};
|
|
91
|
+
const handleChange = (e) => {
|
|
92
|
+
onChange(e.target.value);
|
|
93
|
+
// Auto-resize
|
|
94
|
+
const textarea = textareaRef.current;
|
|
95
|
+
if (!textarea)
|
|
96
|
+
return;
|
|
97
|
+
textarea.style.height = "auto";
|
|
98
|
+
const newHeight = Math.min(textarea.scrollHeight, 164);
|
|
99
|
+
textarea.style.height = `${newHeight}px`;
|
|
100
|
+
if (textarea.scrollHeight > 164) {
|
|
101
|
+
textarea.style.overflowY = "auto";
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
textarea.style.overflowY = "hidden";
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const fieldProps = {
|
|
108
|
+
ref: handleRef,
|
|
109
|
+
name: "chat-input",
|
|
110
|
+
value,
|
|
111
|
+
onChange: handleChange,
|
|
112
|
+
onKeyDown: handleKeyDown,
|
|
113
|
+
disabled: disabled,
|
|
114
|
+
...props,
|
|
115
|
+
};
|
|
116
|
+
if (asChild && React.isValidElement(children)) {
|
|
117
|
+
return React.cloneElement(children, fieldProps);
|
|
118
|
+
}
|
|
119
|
+
return (_jsx("textarea", { ...fieldProps, className: cn("w-full resize-none rounded-none border-none p-3 shadow-none", "outline-none ring-0 field-sizing-content max-h-[6lh]", "bg-transparent dark:bg-transparent focus-visible:ring-0", "text-sm placeholder:text-muted-foreground", "disabled:cursor-not-allowed disabled:opacity-50", className) }));
|
|
120
|
+
});
|
|
162
121
|
ChatInputField.displayName = "ChatInput.Field";
|
|
163
|
-
const ChatInputSubmit = React.forwardRef(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
disabledProp || disabled || isSubmitting || !value.trim();
|
|
171
|
-
const Comp = asChild ? Slot : Button;
|
|
172
|
-
return _jsx(Comp, {
|
|
173
|
-
ref: ref,
|
|
174
|
-
type: "submit",
|
|
175
|
-
disabled: isDisabled,
|
|
176
|
-
size: "icon",
|
|
177
|
-
className: cn(
|
|
178
|
-
!asChild &&
|
|
179
|
-
"gap-1.5 rounded-lg bg-transparent text-foreground hover:bg-transparent",
|
|
180
|
-
className,
|
|
181
|
-
),
|
|
182
|
-
...props,
|
|
183
|
-
children: children,
|
|
184
|
-
});
|
|
185
|
-
},
|
|
186
|
-
);
|
|
122
|
+
const ChatInputSubmit = React.forwardRef(({ asChild = false, className, disabled: disabledProp, children, ...props }, ref) => {
|
|
123
|
+
const { value, disabled, isSubmitting } = useChatInputContext();
|
|
124
|
+
const isDisabled = disabledProp || disabled || isSubmitting || !value.trim();
|
|
125
|
+
const Comp = asChild ? Slot : Button;
|
|
126
|
+
return (_jsx(Comp, { ref: ref, type: "submit", disabled: isDisabled, size: "icon", className: cn(!asChild &&
|
|
127
|
+
"gap-1.5 rounded-lg bg-transparent text-foreground hover:bg-transparent", className), ...props, children: children }));
|
|
128
|
+
});
|
|
187
129
|
ChatInputSubmit.displayName = "ChatInput.Submit";
|
|
188
|
-
const ChatInputToolbar = React.forwardRef(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
ref: ref,
|
|
192
|
-
className: cn("flex items-center justify-between p-1", className),
|
|
193
|
-
...props,
|
|
194
|
-
children: children,
|
|
195
|
-
});
|
|
196
|
-
},
|
|
197
|
-
);
|
|
130
|
+
const ChatInputToolbar = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
131
|
+
return (_jsx("div", { ref: ref, className: cn("flex items-center justify-between p-1", className), ...props, children: children }));
|
|
132
|
+
});
|
|
198
133
|
ChatInputToolbar.displayName = "ChatInput.Toolbar";
|
|
199
134
|
/* -------------------------------------------------------------------------------------------------
|
|
200
135
|
* Exports
|
|
201
136
|
* -----------------------------------------------------------------------------------------------*/
|
|
202
|
-
export {
|
|
203
|
-
ChatInputRoot as Root,
|
|
204
|
-
ChatInputField as Field,
|
|
205
|
-
ChatInputSubmit as Submit,
|
|
206
|
-
ChatInputToolbar as Toolbar,
|
|
207
|
-
};
|
|
137
|
+
export { ChatInputRoot as Root, ChatInputField as Field, ChatInputSubmit as Submit, ChatInputToolbar as Toolbar, };
|
|
@@ -6,18 +6,15 @@ import type { TodoItem } from "./TodoListItem.js";
|
|
|
6
6
|
* 1. Hook-based: Pass `client` prop (future support when todos are in store)
|
|
7
7
|
* 2. Prop-based: Pass `todos` prop directly
|
|
8
8
|
*/
|
|
9
|
-
export interface ChatSecondaryPanelProps
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
todos?: TodoItem[];
|
|
9
|
+
export interface ChatSecondaryPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/**
|
|
11
|
+
* ACP Client for hook-based todo fetching (future support)
|
|
12
|
+
*/
|
|
13
|
+
client?: AcpClient | null;
|
|
14
|
+
/**
|
|
15
|
+
* Todos to display (prop-based pattern)
|
|
16
|
+
* Either client or todos should be provided
|
|
17
|
+
*/
|
|
18
|
+
todos?: TodoItem[];
|
|
20
19
|
}
|
|
21
|
-
export declare const ChatSecondaryPanel: React.ForwardRefExoticComponent<
|
|
22
|
-
ChatSecondaryPanelProps & React.RefAttributes<HTMLDivElement>
|
|
23
|
-
>;
|
|
20
|
+
export declare const ChatSecondaryPanel: React.ForwardRefExoticComponent<ChatSecondaryPanelProps & React.RefAttributes<HTMLDivElement>>;
|