@townco/ui 0.1.0 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/core/hooks/use-chat-input.d.ts +17 -17
  2. package/dist/core/hooks/use-chat-input.js +64 -55
  3. package/dist/core/hooks/use-chat-messages.d.ts +11 -11
  4. package/dist/core/hooks/use-chat-messages.js +121 -114
  5. package/dist/core/hooks/use-chat-session.d.ts +5 -5
  6. package/dist/core/hooks/use-chat-session.js +78 -80
  7. package/dist/core/hooks/use-media-query.d.ts +5 -5
  8. package/dist/core/hooks/use-media-query.js +38 -38
  9. package/dist/core/index.d.ts +1 -1
  10. package/dist/core/index.js +1 -1
  11. package/dist/core/schemas/chat.d.ts +83 -56
  12. package/dist/core/schemas/chat.js +27 -25
  13. package/dist/core/store/chat-store.d.ts +28 -22
  14. package/dist/core/store/chat-store.js +59 -50
  15. package/dist/gui/components/Button.d.ts +23 -7
  16. package/dist/gui/components/Button.js +40 -27
  17. package/dist/gui/components/Card.d.ts +26 -7
  18. package/dist/gui/components/Card.js +54 -8
  19. package/dist/gui/components/ChatHeader.d.ts +58 -31
  20. package/dist/gui/components/ChatHeader.js +171 -66
  21. package/dist/gui/components/ChatInput.d.ts +58 -36
  22. package/dist/gui/components/ChatInput.js +191 -121
  23. package/dist/gui/components/ChatInterface.d.ts +9 -6
  24. package/dist/gui/components/ChatInterface.js +162 -90
  25. package/dist/gui/components/ChatLayout.d.ts +71 -41
  26. package/dist/gui/components/ChatLayout.js +214 -87
  27. package/dist/gui/components/ChatPanelTabContent.d.ts +18 -9
  28. package/dist/gui/components/ChatPanelTabContent.js +88 -10
  29. package/dist/gui/components/ChatPreview.d.ts +9 -6
  30. package/dist/gui/components/ChatPreview.js +212 -162
  31. package/dist/gui/components/ChatSecondaryPanel.d.ts +14 -11
  32. package/dist/gui/components/ChatSecondaryPanel.js +115 -38
  33. package/dist/gui/components/ChatSidebar.d.ts +26 -13
  34. package/dist/gui/components/ChatSidebar.js +48 -14
  35. package/dist/gui/components/ChatStatus.d.ts +4 -2
  36. package/dist/gui/components/ChatStatus.js +45 -34
  37. package/dist/gui/components/ChatView.d.ts +5 -3
  38. package/dist/gui/components/ChatView.js +38 -9
  39. package/dist/gui/components/ConfigPanel.d.ts +16 -12
  40. package/dist/gui/components/ConfigPanel.js +218 -41
  41. package/dist/gui/components/Conversation.d.ts +17 -14
  42. package/dist/gui/components/Conversation.js +143 -83
  43. package/dist/gui/components/Dialog.d.ts +57 -11
  44. package/dist/gui/components/Dialog.js +84 -8
  45. package/dist/gui/components/DropdownMenu.d.ts +101 -20
  46. package/dist/gui/components/DropdownMenu.js +161 -14
  47. package/dist/gui/components/HeightTransition.d.ts +12 -7
  48. package/dist/gui/components/HeightTransition.js +88 -77
  49. package/dist/gui/components/Input.d.ts +13 -6
  50. package/dist/gui/components/Input.js +27 -16
  51. package/dist/gui/components/InputBox.d.ts +19 -12
  52. package/dist/gui/components/InputBox.js +86 -14
  53. package/dist/gui/components/Label.d.ts +7 -1
  54. package/dist/gui/components/Label.js +12 -2
  55. package/dist/gui/components/MarkdownRenderer.d.ts +6 -4
  56. package/dist/gui/components/MarkdownRenderer.js +178 -81
  57. package/dist/gui/components/Message.d.ts +25 -18
  58. package/dist/gui/components/Message.js +44 -23
  59. package/dist/gui/components/MessageContent.d.ts +29 -22
  60. package/dist/gui/components/MessageContent.js +157 -85
  61. package/dist/gui/components/PlaygroundLayout.d.ts +9 -5
  62. package/dist/gui/components/PlaygroundLayout.js +43 -12
  63. package/dist/gui/components/Reasoning.d.ts +30 -24
  64. package/dist/gui/components/Reasoning.js +187 -60
  65. package/dist/gui/components/Response.d.ts +11 -9
  66. package/dist/gui/components/Response.js +229 -90
  67. package/dist/gui/components/Select.d.ts +69 -10
  68. package/dist/gui/components/Select.js +118 -12
  69. package/dist/gui/components/Sonner.d.ts +3 -1
  70. package/dist/gui/components/Sonner.js +29 -18
  71. package/dist/gui/components/StatusBar.d.ts +9 -5
  72. package/dist/gui/components/StatusBar.js +56 -9
  73. package/dist/gui/components/Tabs.d.ts +24 -4
  74. package/dist/gui/components/Tabs.js +32 -4
  75. package/dist/gui/components/Task.d.ts +28 -24
  76. package/dist/gui/components/Task.js +164 -31
  77. package/dist/gui/components/Textarea.d.ts +15 -7
  78. package/dist/gui/components/Textarea.js +63 -46
  79. package/dist/gui/components/ThinkingBlock.d.ts +20 -10
  80. package/dist/gui/components/ThinkingBlock.js +134 -35
  81. package/dist/gui/components/TodoList.d.ts +12 -10
  82. package/dist/gui/components/TodoList.js +22 -7
  83. package/dist/gui/components/TodoListItem.d.ts +9 -6
  84. package/dist/gui/components/TodoListItem.js +18 -4
  85. package/dist/gui/components/index.d.ts +59 -8
  86. package/dist/gui/components/index.js +42 -8
  87. package/dist/gui/lib/utils.js +1 -1
  88. package/dist/index.d.ts +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/index.test.js +0 -1
  91. package/dist/sdk/client/acp-client.d.ts +88 -76
  92. package/dist/sdk/client/acp-client.js +215 -217
  93. package/dist/sdk/index.d.ts +1 -1
  94. package/dist/sdk/index.js +1 -1
  95. package/dist/sdk/schemas/agent.d.ts +111 -64
  96. package/dist/sdk/schemas/agent.js +24 -24
  97. package/dist/sdk/schemas/message.d.ts +245 -147
  98. package/dist/sdk/schemas/message.js +40 -40
  99. package/dist/sdk/schemas/session.d.ts +219 -135
  100. package/dist/sdk/schemas/session.js +27 -27
  101. package/dist/sdk/transports/http.d.ts +55 -55
  102. package/dist/sdk/transports/http.js +472 -469
  103. package/dist/sdk/transports/stdio.d.ts +20 -20
  104. package/dist/sdk/transports/stdio.js +289 -286
  105. package/dist/sdk/transports/types.d.ts +42 -42
  106. package/dist/sdk/transports/websocket.d.ts +12 -12
  107. package/dist/sdk/transports/websocket.js +52 -46
  108. package/dist/tui/components/ChatView.d.ts +4 -2
  109. package/dist/tui/components/ChatView.js +51 -18
  110. package/dist/tui/components/GameOfLife.js +64 -35
  111. package/dist/tui/components/InputBox.d.ts +18 -11
  112. package/dist/tui/components/InputBox.js +70 -10
  113. package/dist/tui/components/MessageList.d.ts +4 -2
  114. package/dist/tui/components/MessageList.js +37 -10
  115. package/dist/tui/components/MultiSelect.d.ts +15 -9
  116. package/dist/tui/components/MultiSelect.js +116 -69
  117. package/dist/tui/components/ReadlineInput.d.ts +12 -6
  118. package/dist/tui/components/ReadlineInput.js +252 -237
  119. package/dist/tui/components/SingleSelect.d.ts +15 -9
  120. package/dist/tui/components/SingleSelect.js +84 -43
  121. package/dist/tui/components/StatusBar.d.ts +11 -6
  122. package/dist/tui/components/StatusBar.js +102 -67
  123. package/dist/tui/index.d.ts +1 -1
  124. package/dist/tui/index.js +1 -1
  125. package/package.json +2 -3
@@ -1,8 +1,27 @@
1
1
  import * as React from "react";
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, };
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
+ };
@@ -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
- 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 })));
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) => (_jsx("div", { ref: ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })));
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) => (_jsx("div", { ref: ref, className: cn("text-2xl font-semibold leading-none tracking-tight", className), ...props })));
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) => (_jsx("div", { ref: ref, className: cn("text-sm text-muted-foreground", className), ...props })));
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) => (_jsx("div", { ref: ref, className: cn("p-6 pt-0", className), ...props })));
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) => (_jsx("div", { ref: ref, className: cn("flex items-center p-6 pt-0", className), ...props })));
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 { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent, };
55
+ export {
56
+ Card,
57
+ CardHeader,
58
+ CardFooter,
59
+ CardTitle,
60
+ CardDescription,
61
+ CardContent,
62
+ };
@@ -1,38 +1,65 @@
1
1
  import * as React from "react";
2
2
  interface ChatHeaderContextValue {
3
- isExpanded: boolean;
4
- setIsExpanded: (expanded: boolean) => void;
3
+ isExpanded: boolean;
4
+ setIsExpanded: (expanded: boolean) => void;
5
5
  }
6
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;
7
+ export interface ChatHeaderRootProps
8
+ extends React.HTMLAttributes<HTMLDivElement> {
9
+ /** Initial expanded state */
10
+ defaultExpanded?: boolean;
11
+ /** Controlled expanded state */
12
+ expanded?: boolean;
13
+ /** Callback when expanded state changes */
14
+ onExpandedChange?: (expanded: boolean) => void;
14
15
  }
15
- declare const ChatHeaderRoot: React.ForwardRefExoticComponent<ChatHeaderRootProps & React.RefAttributes<HTMLDivElement>>;
16
- export interface ChatHeaderTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
16
+ declare const ChatHeaderRoot: React.ForwardRefExoticComponent<
17
+ ChatHeaderRootProps & React.RefAttributes<HTMLDivElement>
18
+ >;
19
+ export interface ChatHeaderTitleProps
20
+ extends React.HTMLAttributes<HTMLHeadingElement> {}
21
+ declare const ChatHeaderTitle: React.ForwardRefExoticComponent<
22
+ ChatHeaderTitleProps & React.RefAttributes<HTMLHeadingElement>
23
+ >;
24
+ export interface ChatHeaderActionsProps
25
+ extends React.HTMLAttributes<HTMLDivElement> {}
26
+ declare const ChatHeaderActions: React.ForwardRefExoticComponent<
27
+ ChatHeaderActionsProps & React.RefAttributes<HTMLDivElement>
28
+ >;
29
+ export type ConnectionStatus =
30
+ | "connected"
31
+ | "connecting"
32
+ | "error"
33
+ | "disconnected";
34
+ export interface ChatHeaderStatusIndicatorProps
35
+ extends React.HTMLAttributes<HTMLDivElement> {
36
+ /** Connection status */
37
+ status: ConnectionStatus;
38
+ /** Optional status text override */
39
+ statusText?: string;
17
40
  }
18
- declare const ChatHeaderTitle: React.ForwardRefExoticComponent<ChatHeaderTitleProps & React.RefAttributes<HTMLHeadingElement>>;
19
- export interface ChatHeaderActionsProps extends React.HTMLAttributes<HTMLDivElement> {
41
+ declare const ChatHeaderStatusIndicator: React.ForwardRefExoticComponent<
42
+ ChatHeaderStatusIndicatorProps & React.RefAttributes<HTMLDivElement>
43
+ >;
44
+ export interface ChatHeaderToggleProps
45
+ extends React.ButtonHTMLAttributes<HTMLButtonElement> {
46
+ /** Icon to display (should rotate based on expanded state) */
47
+ icon?: React.ReactNode;
20
48
  }
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, };
49
+ declare const ChatHeaderToggle: React.ForwardRefExoticComponent<
50
+ ChatHeaderToggleProps & React.RefAttributes<HTMLButtonElement>
51
+ >;
52
+ export interface ChatHeaderExpandablePanelProps
53
+ extends React.HTMLAttributes<HTMLDivElement> {}
54
+ declare const ChatHeaderExpandablePanel: React.ForwardRefExoticComponent<
55
+ ChatHeaderExpandablePanelProps & React.RefAttributes<HTMLDivElement>
56
+ >;
57
+ export {
58
+ ChatHeaderRoot as Root,
59
+ ChatHeaderTitle as Title,
60
+ ChatHeaderActions as Actions,
61
+ ChatHeaderStatusIndicator as StatusIndicator,
62
+ ChatHeaderToggle as Toggle,
63
+ ChatHeaderExpandablePanel as ExpandablePanel,
64
+ useChatHeaderContext,
65
+ };
@@ -1,84 +1,189 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import * as React from "react";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cn } from "../lib/utils.js";
4
+
4
5
  const ChatHeaderContext = React.createContext(undefined);
5
6
  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;
7
+ const context = React.useContext(ChatHeaderContext);
8
+ if (!context) {
9
+ throw new Error(
10
+ "ChatHeader components must be used within ChatHeader.Root",
11
+ );
12
+ }
13
+ return context;
11
14
  };
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
- child.type?.displayName === "ChatHeader.ExpandablePanel");
23
- const mainContent = childrenArray.filter((child) => child !== expandablePanel);
24
- 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] }));
25
- });
15
+ const ChatHeaderRoot = React.forwardRef(
16
+ (
17
+ {
18
+ defaultExpanded = false,
19
+ expanded: expandedProp,
20
+ onExpandedChange,
21
+ className,
22
+ children,
23
+ ...props
24
+ },
25
+ ref,
26
+ ) => {
27
+ const [isExpandedInternal, setIsExpandedInternal] =
28
+ React.useState(defaultExpanded);
29
+ const isExpanded = expandedProp ?? isExpandedInternal;
30
+ const setIsExpanded = React.useCallback(
31
+ (expanded) => {
32
+ setIsExpandedInternal(expanded);
33
+ onExpandedChange?.(expanded);
34
+ },
35
+ [onExpandedChange],
36
+ );
37
+ // Separate children into main content and expandable panel
38
+ const childrenArray = React.Children.toArray(children);
39
+ const expandablePanel = childrenArray.find(
40
+ (child) =>
41
+ React.isValidElement(child) &&
42
+ child.type?.displayName === "ChatHeader.ExpandablePanel",
43
+ );
44
+ const mainContent = childrenArray.filter(
45
+ (child) => child !== expandablePanel,
46
+ );
47
+ return _jsxs(ChatHeaderContext.Provider, {
48
+ value: { isExpanded, setIsExpanded },
49
+ children: [
50
+ _jsx("div", {
51
+ ref: ref,
52
+ className: cn(
53
+ "flex items-center justify-between px-6 py-4",
54
+ className,
55
+ ),
56
+ ...props,
57
+ children: mainContent,
58
+ }),
59
+ expandablePanel,
60
+ ],
61
+ });
62
+ },
63
+ );
26
64
  ChatHeaderRoot.displayName = "ChatHeader.Root";
27
- const ChatHeaderTitle = React.forwardRef(({ className, children, ...props }, ref) => {
28
- return (_jsx("h1", { ref: ref, className: cn("m-0 text-xl font-semibold", className), ...props, children: children }));
29
- });
65
+ const ChatHeaderTitle = React.forwardRef(
66
+ ({ className, children, ...props }, ref) => {
67
+ return _jsx("h1", {
68
+ ref: ref,
69
+ className: cn("m-0 text-xl font-semibold", className),
70
+ ...props,
71
+ children: children,
72
+ });
73
+ },
74
+ );
30
75
  ChatHeaderTitle.displayName = "ChatHeader.Title";
31
- const ChatHeaderActions = React.forwardRef(({ className, children, ...props }, ref) => {
32
- return (_jsx("div", { ref: ref, className: cn("flex items-center gap-3", className), ...props, children: children }));
33
- });
76
+ const ChatHeaderActions = React.forwardRef(
77
+ ({ className, children, ...props }, ref) => {
78
+ return _jsx("div", {
79
+ ref: ref,
80
+ className: cn("flex items-center gap-3", className),
81
+ ...props,
82
+ children: children,
83
+ });
84
+ },
85
+ );
34
86
  ChatHeaderActions.displayName = "ChatHeader.Actions";
35
87
  const getStatusColor = (status) => {
36
- switch (status) {
37
- case "connected":
38
- return "bg-green-500";
39
- case "connecting":
40
- return "bg-yellow-500";
41
- case "error":
42
- return "bg-red-500";
43
- default:
44
- return "bg-gray-500";
45
- }
88
+ switch (status) {
89
+ case "connected":
90
+ return "bg-green-500";
91
+ case "connecting":
92
+ return "bg-yellow-500";
93
+ case "error":
94
+ return "bg-red-500";
95
+ default:
96
+ return "bg-gray-500";
97
+ }
46
98
  };
47
99
  const getDefaultStatusText = (status) => {
48
- switch (status) {
49
- case "connected":
50
- return "Connected";
51
- case "connecting":
52
- return "Connecting...";
53
- case "error":
54
- return "Connection Error";
55
- default:
56
- return "No Server";
57
- }
100
+ switch (status) {
101
+ case "connected":
102
+ return "Connected";
103
+ case "connecting":
104
+ return "Connecting...";
105
+ case "error":
106
+ return "Connection Error";
107
+ default:
108
+ return "No Server";
109
+ }
58
110
  };
59
- const ChatHeaderStatusIndicator = React.forwardRef(({ status, statusText, className, ...props }, ref) => {
60
- const text = statusText ?? getDefaultStatusText(status);
61
- const colorClass = getStatusColor(status);
62
- 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 })] }));
63
- });
111
+ const ChatHeaderStatusIndicator = React.forwardRef(
112
+ ({ status, statusText, className, ...props }, ref) => {
113
+ const text = statusText ?? getDefaultStatusText(status);
114
+ const colorClass = getStatusColor(status);
115
+ return _jsxs("div", {
116
+ ref: ref,
117
+ className: cn("flex items-center gap-2", className),
118
+ ...props,
119
+ children: [
120
+ _jsx("div", { className: cn("h-2 w-2 rounded-full", colorClass) }),
121
+ _jsx("span", {
122
+ className: "text-sm text-muted-foreground",
123
+ children: text,
124
+ }),
125
+ ],
126
+ });
127
+ },
128
+ );
64
129
  ChatHeaderStatusIndicator.displayName = "ChatHeader.StatusIndicator";
65
- const ChatHeaderToggle = React.forwardRef(({ icon, className, children, onClick, ...props }, ref) => {
66
- const { isExpanded, setIsExpanded } = useChatHeaderContext();
67
- const handleClick = (e) => {
68
- setIsExpanded(!isExpanded);
69
- onClick?.(e);
70
- };
71
- 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] }));
72
- });
130
+ const ChatHeaderToggle = React.forwardRef(
131
+ ({ icon, className, children, onClick, ...props }, ref) => {
132
+ const { isExpanded, setIsExpanded } = useChatHeaderContext();
133
+ const handleClick = (e) => {
134
+ setIsExpanded(!isExpanded);
135
+ onClick?.(e);
136
+ };
137
+ return _jsxs("button", {
138
+ ref: ref,
139
+ type: "button",
140
+ onClick: handleClick,
141
+ className: cn(
142
+ "rounded p-1 transition-colors hover:bg-background lg:hidden",
143
+ className,
144
+ ),
145
+ "aria-label": isExpanded ? "Collapse header" : "Expand header",
146
+ ...props,
147
+ children: [
148
+ icon &&
149
+ _jsx("div", {
150
+ className: cn(
151
+ "transition-transform duration-200",
152
+ isExpanded && "rotate-180",
153
+ ),
154
+ children: icon,
155
+ }),
156
+ children,
157
+ ],
158
+ });
159
+ },
160
+ );
73
161
  ChatHeaderToggle.displayName = "ChatHeader.Toggle";
74
- const ChatHeaderExpandablePanel = React.forwardRef(({ className, children, ...props }, ref) => {
75
- const { isExpanded } = useChatHeaderContext();
76
- if (!isExpanded)
77
- return null;
78
- 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 }));
79
- });
162
+ const ChatHeaderExpandablePanel = React.forwardRef(
163
+ ({ className, children, ...props }, ref) => {
164
+ const { isExpanded } = useChatHeaderContext();
165
+ if (!isExpanded) return null;
166
+ return _jsx("div", {
167
+ ref: ref,
168
+ className: cn(
169
+ "absolute top-full left-0 right-0 z-50 border-b border-border bg-card px-6 py-4 shadow-lg lg:hidden",
170
+ className,
171
+ ),
172
+ ...props,
173
+ children: children,
174
+ });
175
+ },
176
+ );
80
177
  ChatHeaderExpandablePanel.displayName = "ChatHeader.ExpandablePanel";
81
178
  /* -------------------------------------------------------------------------------------------------
82
179
  * Exports
83
180
  * -----------------------------------------------------------------------------------------------*/
84
- export { ChatHeaderRoot as Root, ChatHeaderTitle as Title, ChatHeaderActions as Actions, ChatHeaderStatusIndicator as StatusIndicator, ChatHeaderToggle as Toggle, ChatHeaderExpandablePanel as ExpandablePanel, useChatHeaderContext, };
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
+ };
@@ -1,42 +1,64 @@
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 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;
4
+ export interface ChatInputRootProps
5
+ extends Omit<
6
+ React.FormHTMLAttributes<HTMLFormElement>,
7
+ "onChange" | "onSubmit"
8
+ > {
9
+ /**
10
+ * ACP Client for hook-based input management (recommended pattern)
11
+ * Either client or value/onChange/onSubmit must be provided
12
+ */
13
+ client?: AcpClient | null;
14
+ /**
15
+ * Input value (legacy prop-based pattern)
16
+ * Either client or value/onChange/onSubmit must be provided
17
+ */
18
+ value?: string;
19
+ /**
20
+ * Input change handler (legacy prop-based pattern)
21
+ */
22
+ onChange?: (value: string) => void;
23
+ /**
24
+ * Submit handler (legacy prop-based pattern)
25
+ */
26
+ onSubmit?: () => void | Promise<void>;
27
+ /** Whether input is disabled */
28
+ disabled?: boolean;
29
+ /** Whether input is currently submitting */
30
+ isSubmitting?: boolean;
31
+ /** Whether to submit on Enter key (default: true) */
32
+ submitOnEnter?: boolean;
29
33
  }
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;
34
+ declare const ChatInputRoot: React.ForwardRefExoticComponent<
35
+ ChatInputRootProps & React.RefAttributes<HTMLFormElement>
36
+ >;
37
+ export interface ChatInputFieldProps
38
+ extends Omit<
39
+ React.ComponentPropsWithoutRef<typeof Textarea>,
40
+ "value" | "onChange"
41
+ > {
42
+ asChild?: boolean;
33
43
  }
34
- declare const ChatInputField: React.ForwardRefExoticComponent<ChatInputFieldProps & React.RefAttributes<HTMLTextAreaElement>>;
35
- export interface ChatInputSubmitProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
36
- asChild?: boolean;
44
+ declare const ChatInputField: React.ForwardRefExoticComponent<
45
+ ChatInputFieldProps & React.RefAttributes<HTMLTextAreaElement>
46
+ >;
47
+ export interface ChatInputSubmitProps
48
+ extends React.ButtonHTMLAttributes<HTMLButtonElement> {
49
+ asChild?: boolean;
37
50
  }
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, };
51
+ declare const ChatInputSubmit: React.ForwardRefExoticComponent<
52
+ ChatInputSubmitProps & React.RefAttributes<HTMLButtonElement>
53
+ >;
54
+ export interface ChatInputToolbarProps
55
+ extends React.HTMLAttributes<HTMLDivElement> {}
56
+ declare const ChatInputToolbar: React.ForwardRefExoticComponent<
57
+ ChatInputToolbarProps & React.RefAttributes<HTMLDivElement>
58
+ >;
59
+ export {
60
+ ChatInputRoot as Root,
61
+ ChatInputField as Field,
62
+ ChatInputSubmit as Submit,
63
+ ChatInputToolbar as Toolbar,
64
+ };