@townco/ui 0.1.0 → 0.1.3

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,9 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
3
2
  import { Check, ChevronRight, Circle } from "lucide-react";
4
3
  import * as React from "react";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { cn } from "../lib/utils.js";
6
+
6
7
  /* -------------------------------------------------------------------------------------------------
7
8
  * DropdownMenu Root
8
9
  * -----------------------------------------------------------------------------------------------*/
@@ -15,54 +16,200 @@ const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
15
16
  /* -------------------------------------------------------------------------------------------------
16
17
  * DropdownMenuSubTrigger
17
18
  * -----------------------------------------------------------------------------------------------*/
18
- const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.SubTrigger, { ref: ref, className: cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none", "focus:bg-muted data-[state=open]:bg-muted", inset && "pl-8", className), ...props, children: [children, _jsx(ChevronRight, { className: "ml-auto h-4 w-4" })] })));
19
+ const DropdownMenuSubTrigger = React.forwardRef(
20
+ ({ className, inset, children, ...props }, ref) =>
21
+ _jsxs(DropdownMenuPrimitive.SubTrigger, {
22
+ ref: ref,
23
+ className: cn(
24
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
25
+ "focus:bg-muted data-[state=open]:bg-muted",
26
+ inset && "pl-8",
27
+ className,
28
+ ),
29
+ ...props,
30
+ children: [
31
+ children,
32
+ _jsx(ChevronRight, { className: "ml-auto h-4 w-4" }),
33
+ ],
34
+ }),
35
+ );
19
36
  DropdownMenuSubTrigger.displayName =
20
- DropdownMenuPrimitive.SubTrigger.displayName;
37
+ DropdownMenuPrimitive.SubTrigger.displayName;
21
38
  /* -------------------------------------------------------------------------------------------------
22
39
  * DropdownMenuSubContent
23
40
  * -----------------------------------------------------------------------------------------------*/
24
- const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => (_jsx(DropdownMenuPrimitive.SubContent, { ref: ref, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-card p-1 shadow-lg", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[side=bottom]:slide-in-from-top-2", "data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2", "data-[side=top]:slide-in-from-bottom-2", className), ...props })));
41
+ const DropdownMenuSubContent = React.forwardRef(
42
+ ({ className, ...props }, ref) =>
43
+ _jsx(DropdownMenuPrimitive.SubContent, {
44
+ ref: ref,
45
+ className: cn(
46
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-card p-1 shadow-lg",
47
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
48
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
49
+ "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
50
+ "data-[side=bottom]:slide-in-from-top-2",
51
+ "data-[side=left]:slide-in-from-right-2",
52
+ "data-[side=right]:slide-in-from-left-2",
53
+ "data-[side=top]:slide-in-from-bottom-2",
54
+ className,
55
+ ),
56
+ ...props,
57
+ }),
58
+ );
25
59
  DropdownMenuSubContent.displayName =
26
- DropdownMenuPrimitive.SubContent.displayName;
60
+ DropdownMenuPrimitive.SubContent.displayName;
27
61
  /* -------------------------------------------------------------------------------------------------
28
62
  * DropdownMenuContent
29
63
  * -----------------------------------------------------------------------------------------------*/
30
- const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-card p-1 shadow-md", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[side=bottom]:slide-in-from-top-2", "data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2", "data-[side=top]:slide-in-from-bottom-2", className), ...props }) })));
64
+ const DropdownMenuContent = React.forwardRef(
65
+ ({ className, sideOffset = 4, ...props }, ref) =>
66
+ _jsx(DropdownMenuPrimitive.Portal, {
67
+ children: _jsx(DropdownMenuPrimitive.Content, {
68
+ ref: ref,
69
+ sideOffset: sideOffset,
70
+ className: cn(
71
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",
72
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
73
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
74
+ "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
75
+ "data-[side=bottom]:slide-in-from-top-2",
76
+ "data-[side=left]:slide-in-from-right-2",
77
+ "data-[side=right]:slide-in-from-left-2",
78
+ "data-[side=top]:slide-in-from-bottom-2",
79
+ className,
80
+ ),
81
+ ...props,
82
+ }),
83
+ }),
84
+ );
31
85
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
32
86
  /* -------------------------------------------------------------------------------------------------
33
87
  * DropdownMenuItem
34
88
  * -----------------------------------------------------------------------------------------------*/
35
- const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Item, { ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors", "focus:bg-muted focus:text-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", inset && "pl-8", className), ...props })));
89
+ const DropdownMenuItem = React.forwardRef(
90
+ ({ className, inset, ...props }, ref) =>
91
+ _jsx(DropdownMenuPrimitive.Item, {
92
+ ref: ref,
93
+ className: cn(
94
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
95
+ "focus:bg-muted focus:text-foreground",
96
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
97
+ inset && "pl-8",
98
+ className,
99
+ ),
100
+ ...props,
101
+ }),
102
+ );
36
103
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
37
104
  /* -------------------------------------------------------------------------------------------------
38
105
  * DropdownMenuCheckboxItem
39
106
  * -----------------------------------------------------------------------------------------------*/
40
- const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.CheckboxItem, { ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors", "focus:bg-muted focus:text-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props, children: [_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(Check, { className: "h-4 w-4" }) }) }), children] })));
107
+ const DropdownMenuCheckboxItem = React.forwardRef(
108
+ ({ className, children, ...props }, ref) =>
109
+ _jsxs(DropdownMenuPrimitive.CheckboxItem, {
110
+ ref: ref,
111
+ className: cn(
112
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors",
113
+ "focus:bg-muted focus:text-foreground",
114
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
115
+ className,
116
+ ),
117
+ ...props,
118
+ children: [
119
+ _jsx("span", {
120
+ className:
121
+ "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
122
+ children: _jsx(DropdownMenuPrimitive.ItemIndicator, {
123
+ children: _jsx(Check, { className: "h-4 w-4" }),
124
+ }),
125
+ }),
126
+ children,
127
+ ],
128
+ }),
129
+ );
41
130
  DropdownMenuCheckboxItem.displayName =
42
- DropdownMenuPrimitive.CheckboxItem.displayName;
131
+ DropdownMenuPrimitive.CheckboxItem.displayName;
43
132
  /* -------------------------------------------------------------------------------------------------
44
133
  * DropdownMenuRadioItem
45
134
  * -----------------------------------------------------------------------------------------------*/
46
- const DropdownMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.RadioItem, { ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors", "focus:bg-muted focus:text-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props, children: [_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }), children] })));
135
+ const DropdownMenuRadioItem = React.forwardRef(
136
+ ({ className, children, ...props }, ref) =>
137
+ _jsxs(DropdownMenuPrimitive.RadioItem, {
138
+ ref: ref,
139
+ className: cn(
140
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors",
141
+ "focus:bg-muted focus:text-foreground",
142
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
143
+ className,
144
+ ),
145
+ ...props,
146
+ children: [
147
+ _jsx("span", {
148
+ className:
149
+ "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
150
+ children: _jsx(DropdownMenuPrimitive.ItemIndicator, {
151
+ children: _jsx(Circle, { className: "h-2 w-2 fill-current" }),
152
+ }),
153
+ }),
154
+ children,
155
+ ],
156
+ }),
157
+ );
47
158
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
48
159
  /* -------------------------------------------------------------------------------------------------
49
160
  * DropdownMenuLabel
50
161
  * -----------------------------------------------------------------------------------------------*/
51
- const DropdownMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Label, { ref: ref, className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className), ...props })));
162
+ const DropdownMenuLabel = React.forwardRef(
163
+ ({ className, inset, ...props }, ref) =>
164
+ _jsx(DropdownMenuPrimitive.Label, {
165
+ ref: ref,
166
+ className: cn(
167
+ "px-2 py-1.5 text-sm font-semibold",
168
+ inset && "pl-8",
169
+ className,
170
+ ),
171
+ ...props,
172
+ }),
173
+ );
52
174
  DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
53
175
  /* -------------------------------------------------------------------------------------------------
54
176
  * DropdownMenuSeparator
55
177
  * -----------------------------------------------------------------------------------------------*/
56
- const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-border", className), ...props })));
178
+ const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) =>
179
+ _jsx(DropdownMenuPrimitive.Separator, {
180
+ ref: ref,
181
+ className: cn("-mx-1 my-1 h-px bg-border", className),
182
+ ...props,
183
+ }),
184
+ );
57
185
  DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
58
186
  /* -------------------------------------------------------------------------------------------------
59
187
  * DropdownMenuShortcut
60
188
  * -----------------------------------------------------------------------------------------------*/
61
189
  const DropdownMenuShortcut = ({ className, ...props }) => {
62
- return (_jsx("span", { className: cn("ml-auto text-xs tracking-widest opacity-60", className), ...props }));
190
+ return _jsx("span", {
191
+ className: cn("ml-auto text-xs tracking-widest opacity-60", className),
192
+ ...props,
193
+ });
63
194
  };
64
195
  DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
65
196
  /* -------------------------------------------------------------------------------------------------
66
197
  * Exports
67
198
  * -----------------------------------------------------------------------------------------------*/
68
- export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };
199
+ export {
200
+ DropdownMenu,
201
+ DropdownMenuTrigger,
202
+ DropdownMenuContent,
203
+ DropdownMenuItem,
204
+ DropdownMenuCheckboxItem,
205
+ DropdownMenuRadioItem,
206
+ DropdownMenuLabel,
207
+ DropdownMenuSeparator,
208
+ DropdownMenuShortcut,
209
+ DropdownMenuGroup,
210
+ DropdownMenuPortal,
211
+ DropdownMenuSub,
212
+ DropdownMenuSubContent,
213
+ DropdownMenuSubTrigger,
214
+ DropdownMenuRadioGroup,
215
+ };
@@ -1,10 +1,15 @@
1
1
  import { type ReactNode } from "react";
2
2
  interface HeightTransitionProps {
3
- children: ReactNode;
4
- durationMs?: number;
5
- easing?: string;
6
- pinContentTo?: "top" | "bottom";
7
- className?: string;
3
+ children: ReactNode;
4
+ durationMs?: number;
5
+ easing?: string;
6
+ pinContentTo?: "top" | "bottom";
7
+ className?: string;
8
8
  }
9
- export declare function HeightTransition({ children, durationMs, easing, pinContentTo, className, }: HeightTransitionProps): import("react/jsx-runtime").JSX.Element;
10
- export {};
9
+ export declare function HeightTransition({
10
+ children,
11
+ durationMs,
12
+ easing,
13
+ pinContentTo,
14
+ className,
15
+ }: HeightTransitionProps): import("react/jsx-runtime").JSX.Element;
@@ -1,80 +1,91 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { useCallback, useEffect, useRef } from "react";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { cn } from "../lib/utils.js";
4
- export function HeightTransition({ children, durationMs = 320, easing = "ease", pinContentTo = "top", className, }) {
5
- const containerRef = useRef(null);
6
- const contentRef = useRef(null);
7
- const prevHeightRef = useRef(null);
8
- const isAnimatingRef = useRef(false);
9
- const durationRef = useRef(durationMs);
10
- const easingRef = useRef(easing);
11
- useEffect(() => {
12
- durationRef.current = durationMs;
13
- easingRef.current = easing;
14
- }, [durationMs, easing]);
15
- const transitionTo = useCallback((next) => {
16
- const el = containerRef.current;
17
- const contentEl = contentRef.current;
18
- if (!el || !contentEl)
19
- return;
20
- const prev = prevHeightRef.current ?? el.getBoundingClientRect().height;
21
- if (Math.abs(prev - next) < 0.5) {
22
- prevHeightRef.current = next;
23
- el.style.height = `${next}px`;
24
- return;
25
- }
26
- if (isAnimatingRef.current)
27
- return;
28
- isAnimatingRef.current = true;
29
- el.style.transition = "none";
30
- el.style.height = `${prev}px`;
31
- void el.getBoundingClientRect();
32
- el.style.transition = `height ${durationRef.current}ms ${easingRef.current}`;
33
- el.style.height = `${next}px`;
34
- contentEl.style.position = "absolute";
35
- if (pinContentTo === "top") {
36
- contentEl.style.top = "0";
37
- }
38
- else {
39
- contentEl.style.bottom = "0";
40
- }
41
- prevHeightRef.current = next;
42
- }, [pinContentTo]);
43
- const onEndTransition = useCallback((e) => {
44
- const el = containerRef.current;
45
- const contentEl = contentRef.current;
46
- if (!el || !contentEl)
47
- return;
48
- if (e.propertyName !== "height")
49
- return;
50
- if (e.target !== el)
51
- return;
52
- el.style.transition = "";
53
- el.style.height = `auto`;
54
- contentEl.style.removeProperty("position");
55
- contentEl.style.removeProperty("top");
56
- contentEl.style.removeProperty("bottom");
57
- isAnimatingRef.current = false;
58
- }, []);
59
- // Observe intrinsic content height changes and animate container height accordingly
60
- useEffect(() => {
61
- const el = containerRef.current;
62
- const contentEl = contentRef.current;
63
- if (!el || !contentEl)
64
- return;
65
- const initial = contentEl.scrollHeight;
66
- prevHeightRef.current = initial;
67
- const ro = new ResizeObserver(() => {
68
- const next = contentEl.scrollHeight;
69
- transitionTo(next);
70
- });
71
- ro.observe(contentEl);
72
- el.addEventListener("transitionend", onEndTransition);
73
- return () => {
74
- ro.disconnect();
75
- el.removeEventListener("transitionend", onEndTransition);
76
- };
77
- // eslint-disable-next-line react-hooks/exhaustive-deps
78
- }, [onEndTransition, transitionTo]);
79
- return (_jsx("div", { ref: containerRef, className: cn("overflow-hidden relative", className), style: { willChange: "height" }, children: _jsx("div", { ref: contentRef, className: "w-full", children: children }) }));
4
+ export function HeightTransition({
5
+ children,
6
+ durationMs = 320,
7
+ easing = "ease",
8
+ pinContentTo = "top",
9
+ className,
10
+ }) {
11
+ const containerRef = useRef(null);
12
+ const contentRef = useRef(null);
13
+ const prevHeightRef = useRef(null);
14
+ const isAnimatingRef = useRef(false);
15
+ const durationRef = useRef(durationMs);
16
+ const easingRef = useRef(easing);
17
+ useEffect(() => {
18
+ durationRef.current = durationMs;
19
+ easingRef.current = easing;
20
+ }, [durationMs, easing]);
21
+ const transitionTo = useCallback(
22
+ (next) => {
23
+ const el = containerRef.current;
24
+ const contentEl = contentRef.current;
25
+ if (!el || !contentEl) return;
26
+ const prev = prevHeightRef.current ?? el.getBoundingClientRect().height;
27
+ if (Math.abs(prev - next) < 0.5) {
28
+ prevHeightRef.current = next;
29
+ el.style.height = `${next}px`;
30
+ return;
31
+ }
32
+ if (isAnimatingRef.current) return;
33
+ isAnimatingRef.current = true;
34
+ el.style.transition = "none";
35
+ el.style.height = `${prev}px`;
36
+ void el.getBoundingClientRect();
37
+ el.style.transition = `height ${durationRef.current}ms ${easingRef.current}`;
38
+ el.style.height = `${next}px`;
39
+ contentEl.style.position = "absolute";
40
+ if (pinContentTo === "top") {
41
+ contentEl.style.top = "0";
42
+ } else {
43
+ contentEl.style.bottom = "0";
44
+ }
45
+ prevHeightRef.current = next;
46
+ },
47
+ [pinContentTo],
48
+ );
49
+ const onEndTransition = useCallback((e) => {
50
+ const el = containerRef.current;
51
+ const contentEl = contentRef.current;
52
+ if (!el || !contentEl) return;
53
+ if (e.propertyName !== "height") return;
54
+ if (e.target !== el) return;
55
+ el.style.transition = "";
56
+ el.style.height = `auto`;
57
+ contentEl.style.removeProperty("position");
58
+ contentEl.style.removeProperty("top");
59
+ contentEl.style.removeProperty("bottom");
60
+ isAnimatingRef.current = false;
61
+ }, []);
62
+ // Observe intrinsic content height changes and animate container height accordingly
63
+ useEffect(() => {
64
+ const el = containerRef.current;
65
+ const contentEl = contentRef.current;
66
+ if (!el || !contentEl) return;
67
+ const initial = contentEl.scrollHeight;
68
+ prevHeightRef.current = initial;
69
+ const ro = new ResizeObserver(() => {
70
+ const next = contentEl.scrollHeight;
71
+ transitionTo(next);
72
+ });
73
+ ro.observe(contentEl);
74
+ el.addEventListener("transitionend", onEndTransition);
75
+ return () => {
76
+ ro.disconnect();
77
+ el.removeEventListener("transitionend", onEndTransition);
78
+ };
79
+ // eslint-disable-next-line react-hooks/exhaustive-deps
80
+ }, [onEndTransition, transitionTo]);
81
+ return _jsx("div", {
82
+ ref: containerRef,
83
+ className: cn("overflow-hidden relative", className),
84
+ style: { willChange: "height" },
85
+ children: _jsx("div", {
86
+ ref: contentRef,
87
+ className: "w-full",
88
+ children: children,
89
+ }),
90
+ });
80
91
  }
@@ -1,9 +1,16 @@
1
1
  import { type VariantProps } from "class-variance-authority";
2
2
  import * as React from "react";
3
- declare const inputVariants: (props?: ({
4
- variant?: "default" | "error" | "success" | null | undefined;
5
- } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
- export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>, VariantProps<typeof inputVariants> {
7
- }
8
- declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
3
+ declare const inputVariants: (
4
+ props?:
5
+ | ({
6
+ variant?: "default" | "error" | "success" | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp)
8
+ | undefined,
9
+ ) => string;
10
+ export interface InputProps
11
+ extends React.InputHTMLAttributes<HTMLInputElement>,
12
+ VariantProps<typeof inputVariants> {}
13
+ declare const Input: React.ForwardRefExoticComponent<
14
+ InputProps & React.RefAttributes<HTMLInputElement>
15
+ >;
9
16
  export { Input, inputVariants };
@@ -1,21 +1,32 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { cva } from "class-variance-authority";
3
2
  import * as React from "react";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import { cn } from "../lib/utils.js";
5
- const inputVariants = cva("flex h-10 w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", {
6
- variants: {
7
- variant: {
8
- default: "border-input focus-visible:ring-ring",
9
- error: "border-destructive focus-visible:ring-destructive",
10
- success: "border-green-500 focus-visible:ring-green-500",
11
- },
12
- },
13
- defaultVariants: {
14
- variant: "default",
15
- },
16
- });
17
- const Input = React.forwardRef(({ className, type, variant, ...props }, ref) => {
18
- return (_jsx("input", { type: type, className: cn(inputVariants({ variant, className })), ref: ref, ...props }));
19
- });
5
+
6
+ const inputVariants = cva(
7
+ "flex h-10 w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "border-input focus-visible:ring-ring",
12
+ error: "border-destructive focus-visible:ring-destructive",
13
+ success: "border-green-500 focus-visible:ring-green-500",
14
+ },
15
+ },
16
+ defaultVariants: {
17
+ variant: "default",
18
+ },
19
+ },
20
+ );
21
+ const Input = React.forwardRef(
22
+ ({ className, type, variant, ...props }, ref) => {
23
+ return _jsx("input", {
24
+ type: type,
25
+ className: cn(inputVariants({ variant, className })),
26
+ ref: ref,
27
+ ...props,
28
+ });
29
+ },
30
+ );
20
31
  Input.displayName = "Input";
21
32
  export { Input, inputVariants };
@@ -1,14 +1,21 @@
1
1
  export interface InputBoxProps {
2
- value: string;
3
- isSubmitting: boolean;
4
- attachedFiles: Array<{
5
- name: string;
6
- path: string;
7
- size: number;
8
- }>;
9
- onChange: (value: string) => void;
10
- onSubmit: () => void;
11
- onRemoveFile?: (index: number) => void;
2
+ value: string;
3
+ isSubmitting: boolean;
4
+ attachedFiles: Array<{
5
+ name: string;
6
+ path: string;
7
+ size: number;
8
+ }>;
9
+ onChange: (value: string) => void;
10
+ onSubmit: () => void;
11
+ onRemoveFile?: (index: number) => void;
12
12
  }
13
- export declare function InputBox({ value, isSubmitting, attachedFiles, onChange, onSubmit, onRemoveFile, }: InputBoxProps): import("react/jsx-runtime").JSX.Element;
14
- //# sourceMappingURL=InputBox.d.ts.map
13
+ export declare function InputBox({
14
+ value,
15
+ isSubmitting,
16
+ attachedFiles,
17
+ onChange,
18
+ onSubmit,
19
+ onRemoveFile,
20
+ }: InputBoxProps): import("react/jsx-runtime").JSX.Element;
21
+ //# sourceMappingURL=InputBox.d.ts.map
@@ -1,18 +1,90 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export function InputBox({ value, isSubmitting, attachedFiles, onChange, onSubmit, onRemoveFile, }) {
3
- const handleKeyDown = (e) => {
4
- if (e.key === "Enter" && !e.shiftKey) {
5
- e.preventDefault();
6
- onSubmit();
7
- }
8
- };
9
- return (_jsxs("div", { className: "border-t border-gray-200 bg-white p-4", children: [attachedFiles.length > 0 && (_jsxs("div", { className: "mb-3 space-y-1", children: [_jsx("p", { className: "text-xs text-gray-500", children: "Attached files:" }), _jsx("div", { className: "flex flex-wrap gap-2", children: attachedFiles.map((file, index) => (_jsxs("div", { className: "flex items-center gap-2 px-3 py-1 bg-cyan-50 text-cyan-700 rounded-full text-xs", children: [_jsx("span", { children: file.name }), _jsxs("span", { className: "text-gray-400", children: ["(", formatFileSize(file.size), ")"] }), onRemoveFile && (_jsx("button", { onClick: () => onRemoveFile(index), className: "hover:text-cyan-900", children: "\u00D7" }))] }, index))) })] })), _jsxs("div", { className: "flex items-end gap-2", children: [_jsx("textarea", { value: value, onChange: (e) => onChange(e.target.value), onKeyDown: handleKeyDown, disabled: isSubmitting, placeholder: "Type your message... (Press Enter to send, Shift+Enter for new line)", className: "flex-1 resize-none rounded-lg border border-gray-300 px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed", rows: 3 }), _jsx("button", { onClick: onSubmit, disabled: isSubmitting || !value.trim(), className: "px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors", children: isSubmitting ? "Sending..." : "Send" })] }), _jsx("p", { className: "mt-2 text-xs text-gray-500", children: "Press Enter to send \u2022 Shift+Enter for new line" })] }));
2
+ export function InputBox({
3
+ value,
4
+ isSubmitting,
5
+ attachedFiles,
6
+ onChange,
7
+ onSubmit,
8
+ onRemoveFile,
9
+ }) {
10
+ const handleKeyDown = (e) => {
11
+ if (e.key === "Enter" && !e.shiftKey) {
12
+ e.preventDefault();
13
+ onSubmit();
14
+ }
15
+ };
16
+ return _jsxs("div", {
17
+ className: "border-t border-gray-200 bg-white p-4",
18
+ children: [
19
+ attachedFiles.length > 0 &&
20
+ _jsxs("div", {
21
+ className: "mb-3 space-y-1",
22
+ children: [
23
+ _jsx("p", {
24
+ className: "text-xs text-gray-500",
25
+ children: "Attached files:",
26
+ }),
27
+ _jsx("div", {
28
+ className: "flex flex-wrap gap-2",
29
+ children: attachedFiles.map((file, index) =>
30
+ _jsxs(
31
+ "div",
32
+ {
33
+ className:
34
+ "flex items-center gap-2 px-3 py-1 bg-cyan-50 text-cyan-700 rounded-full text-xs",
35
+ children: [
36
+ _jsx("span", { children: file.name }),
37
+ _jsxs("span", {
38
+ className: "text-gray-400",
39
+ children: ["(", formatFileSize(file.size), ")"],
40
+ }),
41
+ onRemoveFile &&
42
+ _jsx("button", {
43
+ onClick: () => onRemoveFile(index),
44
+ className: "hover:text-cyan-900",
45
+ children: "\u00D7",
46
+ }),
47
+ ],
48
+ },
49
+ index,
50
+ ),
51
+ ),
52
+ }),
53
+ ],
54
+ }),
55
+ _jsxs("div", {
56
+ className: "flex items-end gap-2",
57
+ children: [
58
+ _jsx("textarea", {
59
+ value: value,
60
+ onChange: (e) => onChange(e.target.value),
61
+ onKeyDown: handleKeyDown,
62
+ disabled: isSubmitting,
63
+ placeholder:
64
+ "Type your message... (Press Enter to send, Shift+Enter for new line)",
65
+ className:
66
+ "flex-1 resize-none rounded-lg border border-gray-300 px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed",
67
+ rows: 3,
68
+ }),
69
+ _jsx("button", {
70
+ onClick: onSubmit,
71
+ disabled: isSubmitting || !value.trim(),
72
+ className:
73
+ "px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors",
74
+ children: isSubmitting ? "Sending..." : "Send",
75
+ }),
76
+ ],
77
+ }),
78
+ _jsx("p", {
79
+ className: "mt-2 text-xs text-gray-500",
80
+ children: "Press Enter to send \u2022 Shift+Enter for new line",
81
+ }),
82
+ ],
83
+ });
10
84
  }
11
85
  function formatFileSize(bytes) {
12
- if (bytes < 1024)
13
- return `${bytes} B`;
14
- if (bytes < 1024 * 1024)
15
- return `${(bytes / 1024).toFixed(1)} KB`;
16
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
86
+ if (bytes < 1024) return `${bytes} B`;
87
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
88
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
17
89
  }
18
- //# sourceMappingURL=InputBox.js.map
90
+ //# sourceMappingURL=InputBox.js.map
@@ -1,4 +1,10 @@
1
1
  import * as LabelPrimitive from "@radix-ui/react-label";
2
2
  import * as React from "react";
3
- declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
3
+ declare const Label: React.ForwardRefExoticComponent<
4
+ Omit<
5
+ LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>,
6
+ "ref"
7
+ > &
8
+ React.RefAttributes<HTMLLabelElement>
9
+ >;
4
10
  export { Label };