@townco/ui 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/dist/core/hooks/index.d.ts +1 -0
- package/dist/core/hooks/index.js +1 -0
- package/dist/core/hooks/use-chat-input.d.ts +17 -17
- package/dist/core/hooks/use-chat-input.js +55 -64
- package/dist/core/hooks/use-chat-messages.d.ts +11 -11
- package/dist/core/hooks/use-chat-messages.js +114 -121
- package/dist/core/hooks/use-chat-session.d.ts +5 -5
- package/dist/core/hooks/use-chat-session.js +80 -78
- package/dist/core/hooks/use-media-query.d.ts +5 -5
- package/dist/core/hooks/use-media-query.js +42 -38
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/schemas/chat.d.ts +56 -83
- package/dist/core/schemas/chat.js +25 -27
- package/dist/core/store/chat-store.d.ts +22 -28
- package/dist/core/store/chat-store.js +50 -59
- package/dist/gui/components/Button.d.ts +7 -23
- package/dist/gui/components/Button.js +27 -40
- package/dist/gui/components/Card.d.ts +7 -26
- package/dist/gui/components/Card.js +8 -54
- package/dist/gui/components/ChatHeader.d.ts +31 -58
- package/dist/gui/components/ChatHeader.js +68 -171
- package/dist/gui/components/ChatInput.d.ts +54 -58
- package/dist/gui/components/ChatInput.js +207 -194
- package/dist/gui/components/ChatInputCommandMenu.d.ts +20 -0
- package/dist/gui/components/ChatInputCommandMenu.js +62 -0
- package/dist/gui/components/ChatLayout.d.ts +41 -71
- package/dist/gui/components/ChatLayout.js +87 -214
- package/dist/gui/components/ChatPanelTabContent.d.ts +9 -18
- package/dist/gui/components/ChatPanelTabContent.js +10 -88
- package/dist/gui/components/ChatSecondaryPanel.d.ts +11 -14
- package/dist/gui/components/ChatSecondaryPanel.js +38 -115
- package/dist/gui/components/ChatSidebar.d.ts +13 -26
- package/dist/gui/components/ChatSidebar.js +14 -48
- package/dist/gui/components/ChatStatus.d.ts +2 -4
- package/dist/gui/components/ChatStatus.js +34 -45
- package/dist/gui/components/Conversation.d.ts +14 -17
- package/dist/gui/components/Conversation.js +83 -143
- package/dist/gui/components/Dialog.d.ts +11 -57
- package/dist/gui/components/Dialog.js +8 -84
- package/dist/gui/components/DropdownMenu.d.ts +20 -101
- package/dist/gui/components/DropdownMenu.js +14 -161
- package/dist/gui/components/HeightTransition.d.ts +7 -12
- package/dist/gui/components/HeightTransition.js +77 -88
- package/dist/gui/components/Input.d.ts +6 -13
- package/dist/gui/components/Input.js +16 -27
- package/dist/gui/components/Label.d.ts +1 -7
- package/dist/gui/components/Label.js +2 -12
- package/dist/gui/components/MarkdownRenderer.d.ts +4 -6
- package/dist/gui/components/MarkdownRenderer.js +81 -178
- package/dist/gui/components/Message.d.ts +22 -25
- package/dist/gui/components/Message.js +97 -44
- package/dist/gui/components/MessageContent.d.ts +22 -29
- package/dist/gui/components/MessageContent.js +85 -157
- package/dist/gui/components/Reasoning.d.ts +24 -30
- package/dist/gui/components/Reasoning.js +60 -187
- package/dist/gui/components/Response.d.ts +9 -11
- package/dist/gui/components/Response.js +90 -229
- package/dist/gui/components/Select.d.ts +10 -69
- package/dist/gui/components/Select.js +12 -118
- package/dist/gui/components/Sonner.d.ts +1 -3
- package/dist/gui/components/Sonner.js +18 -29
- package/dist/gui/components/Tabs.d.ts +4 -24
- package/dist/gui/components/Tabs.js +4 -32
- package/dist/gui/components/Task.d.ts +24 -28
- package/dist/gui/components/Task.js +31 -164
- package/dist/gui/components/Textarea.d.ts +7 -15
- package/dist/gui/components/Textarea.js +46 -63
- package/dist/gui/components/ThinkingBlock.d.ts +10 -20
- package/dist/gui/components/ThinkingBlock.js +35 -134
- package/dist/gui/components/TodoList.d.ts +10 -12
- package/dist/gui/components/TodoList.js +7 -22
- package/dist/gui/components/TodoListItem.d.ts +6 -9
- package/dist/gui/components/TodoListItem.js +4 -18
- package/dist/gui/components/index.d.ts +16 -59
- package/dist/gui/components/index.js +18 -42
- package/dist/gui/lib/utils.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.test.js +1 -0
- package/dist/sdk/client/acp-client.d.ts +76 -88
- package/dist/sdk/client/acp-client.js +217 -215
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/schemas/agent.d.ts +64 -111
- package/dist/sdk/schemas/agent.js +24 -24
- package/dist/sdk/schemas/message.d.ts +147 -245
- package/dist/sdk/schemas/message.js +40 -40
- package/dist/sdk/schemas/session.d.ts +135 -219
- package/dist/sdk/schemas/session.js +27 -27
- package/dist/sdk/transports/http.d.ts +55 -55
- package/dist/sdk/transports/http.js +469 -472
- package/dist/sdk/transports/stdio.d.ts +20 -20
- package/dist/sdk/transports/stdio.js +286 -289
- package/dist/sdk/transports/types.d.ts +42 -42
- package/dist/sdk/transports/websocket.d.ts +12 -12
- package/dist/sdk/transports/websocket.js +46 -52
- package/dist/tui/components/ChatView.d.ts +2 -4
- package/dist/tui/components/ChatView.js +18 -51
- package/dist/tui/components/GameOfLife.js +35 -64
- package/dist/tui/components/InputBox.d.ts +11 -18
- package/dist/tui/components/InputBox.js +10 -70
- package/dist/tui/components/MessageList.d.ts +2 -4
- package/dist/tui/components/MessageList.js +10 -37
- package/dist/tui/components/MultiSelect.d.ts +10 -15
- package/dist/tui/components/MultiSelect.js +73 -116
- package/dist/tui/components/ReadlineInput.d.ts +6 -12
- package/dist/tui/components/ReadlineInput.js +237 -252
- package/dist/tui/components/SingleSelect.d.ts +9 -15
- package/dist/tui/components/SingleSelect.js +43 -84
- package/dist/tui/components/StatusBar.d.ts +6 -11
- package/dist/tui/components/StatusBar.js +67 -102
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/package.json +6 -4
- package/src/styles/global.css +2 -0
- package/dist/core/hooks/index.d.ts.map +0 -1
- package/dist/core/hooks/index.js.map +0 -1
- package/dist/core/hooks/use-chat-input.d.ts.map +0 -1
- package/dist/core/hooks/use-chat-input.js.map +0 -1
- package/dist/core/hooks/use-chat-messages.d.ts.map +0 -1
- package/dist/core/hooks/use-chat-messages.js.map +0 -1
- package/dist/core/hooks/use-chat-session.d.ts.map +0 -1
- package/dist/core/hooks/use-chat-session.js.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/schemas/chat.d.ts.map +0 -1
- package/dist/core/schemas/chat.js.map +0 -1
- package/dist/core/schemas/index.d.ts.map +0 -1
- package/dist/core/schemas/index.js.map +0 -1
- package/dist/core/store/chat-store.d.ts.map +0 -1
- package/dist/core/store/chat-store.js.map +0 -1
- package/dist/gui/components/Button.d.ts.map +0 -1
- package/dist/gui/components/Button.js.map +0 -1
- package/dist/gui/components/Card.d.ts.map +0 -1
- package/dist/gui/components/Card.js.map +0 -1
- package/dist/gui/components/ChatInput.d.ts.map +0 -1
- package/dist/gui/components/ChatInput.js.map +0 -1
- package/dist/gui/components/ChatInterface.d.ts +0 -12
- package/dist/gui/components/ChatInterface.d.ts.map +0 -1
- package/dist/gui/components/ChatInterface.js +0 -204
- package/dist/gui/components/ChatInterface.js.map +0 -1
- package/dist/gui/components/ChatPreview.d.ts +0 -12
- package/dist/gui/components/ChatPreview.d.ts.map +0 -1
- package/dist/gui/components/ChatPreview.js +0 -214
- package/dist/gui/components/ChatPreview.js.map +0 -1
- package/dist/gui/components/ChatSecondaryPanel.d.ts.map +0 -1
- package/dist/gui/components/ChatSecondaryPanel.js.map +0 -1
- package/dist/gui/components/ChatStatus.d.ts.map +0 -1
- package/dist/gui/components/ChatStatus.js.map +0 -1
- package/dist/gui/components/ChatView.d.ts +0 -8
- package/dist/gui/components/ChatView.d.ts.map +0 -1
- package/dist/gui/components/ChatView.js +0 -42
- package/dist/gui/components/ChatView.js.map +0 -1
- package/dist/gui/components/ConfigPanel.d.ts +0 -20
- package/dist/gui/components/ConfigPanel.d.ts.map +0 -1
- package/dist/gui/components/ConfigPanel.js +0 -225
- package/dist/gui/components/ConfigPanel.js.map +0 -1
- package/dist/gui/components/Conversation.d.ts.map +0 -1
- package/dist/gui/components/Conversation.js.map +0 -1
- package/dist/gui/components/Dialog.d.ts.map +0 -1
- package/dist/gui/components/Dialog.js.map +0 -1
- package/dist/gui/components/HeightTransition.d.ts.map +0 -1
- package/dist/gui/components/HeightTransition.js.map +0 -1
- package/dist/gui/components/Input.d.ts.map +0 -1
- package/dist/gui/components/Input.js.map +0 -1
- package/dist/gui/components/InputBox.d.ts +0 -21
- package/dist/gui/components/InputBox.d.ts.map +0 -1
- package/dist/gui/components/InputBox.js +0 -90
- package/dist/gui/components/InputBox.js.map +0 -1
- package/dist/gui/components/Label.d.ts.map +0 -1
- package/dist/gui/components/Label.js.map +0 -1
- package/dist/gui/components/MarkdownRenderer.d.ts.map +0 -1
- package/dist/gui/components/MarkdownRenderer.js.map +0 -1
- package/dist/gui/components/Message.d.ts.map +0 -1
- package/dist/gui/components/Message.js.map +0 -1
- package/dist/gui/components/MessageContent.d.ts.map +0 -1
- package/dist/gui/components/MessageContent.js.map +0 -1
- package/dist/gui/components/MessageList.d.ts.map +0 -1
- package/dist/gui/components/MessageList.js.map +0 -1
- package/dist/gui/components/PlaygroundLayout.d.ts +0 -14
- package/dist/gui/components/PlaygroundLayout.d.ts.map +0 -1
- package/dist/gui/components/PlaygroundLayout.js +0 -49
- package/dist/gui/components/PlaygroundLayout.js.map +0 -1
- package/dist/gui/components/Reasoning.d.ts.map +0 -1
- package/dist/gui/components/Reasoning.js.map +0 -1
- package/dist/gui/components/Response.d.ts.map +0 -1
- package/dist/gui/components/Response.js.map +0 -1
- package/dist/gui/components/Select.d.ts.map +0 -1
- package/dist/gui/components/Select.js.map +0 -1
- package/dist/gui/components/StatusBar.d.ts +0 -12
- package/dist/gui/components/StatusBar.d.ts.map +0 -1
- package/dist/gui/components/StatusBar.js +0 -58
- package/dist/gui/components/StatusBar.js.map +0 -1
- package/dist/gui/components/Tabs.d.ts.map +0 -1
- package/dist/gui/components/Tabs.js.map +0 -1
- package/dist/gui/components/Task.d.ts.map +0 -1
- package/dist/gui/components/Task.js.map +0 -1
- package/dist/gui/components/Textarea.d.ts.map +0 -1
- package/dist/gui/components/Textarea.js.map +0 -1
- package/dist/gui/components/ThinkingBlock.d.ts.map +0 -1
- package/dist/gui/components/ThinkingBlock.js.map +0 -1
- package/dist/gui/components/TodoList.d.ts.map +0 -1
- package/dist/gui/components/TodoList.js.map +0 -1
- package/dist/gui/components/TodoListItem.d.ts.map +0 -1
- package/dist/gui/components/TodoListItem.js.map +0 -1
- package/dist/gui/components/index.d.ts.map +0 -1
- package/dist/gui/components/index.js.map +0 -1
- package/dist/gui/index.d.ts.map +0 -1
- package/dist/gui/index.js.map +0 -1
- package/dist/gui/lib/utils.d.ts.map +0 -1
- package/dist/gui/lib/utils.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/sdk/client/acp-client.d.ts.map +0 -1
- package/dist/sdk/client/acp-client.js.map +0 -1
- package/dist/sdk/client/index.d.ts.map +0 -1
- package/dist/sdk/client/index.js.map +0 -1
- package/dist/sdk/index.d.ts.map +0 -1
- package/dist/sdk/index.js.map +0 -1
- package/dist/sdk/schemas/agent.d.ts.map +0 -1
- package/dist/sdk/schemas/agent.js.map +0 -1
- package/dist/sdk/schemas/index.d.ts.map +0 -1
- package/dist/sdk/schemas/index.js.map +0 -1
- package/dist/sdk/schemas/message.d.ts.map +0 -1
- package/dist/sdk/schemas/message.js.map +0 -1
- package/dist/sdk/schemas/session.d.ts.map +0 -1
- package/dist/sdk/schemas/session.js.map +0 -1
- package/dist/sdk/transports/http.d.ts.map +0 -1
- package/dist/sdk/transports/http.js.map +0 -1
- package/dist/sdk/transports/index.d.ts.map +0 -1
- package/dist/sdk/transports/index.js.map +0 -1
- package/dist/sdk/transports/stdio.d.ts.map +0 -1
- package/dist/sdk/transports/stdio.js.map +0 -1
- package/dist/sdk/transports/types.d.ts.map +0 -1
- package/dist/sdk/transports/types.js.map +0 -1
- package/dist/sdk/transports/websocket.d.ts.map +0 -1
- package/dist/sdk/transports/websocket.js.map +0 -1
- package/dist/tui/components/ChatView.d.ts.map +0 -1
- package/dist/tui/components/ChatView.js.map +0 -1
- package/dist/tui/components/GameOfLife.d.ts.map +0 -1
- package/dist/tui/components/GameOfLife.js.map +0 -1
- package/dist/tui/components/InputBox.d.ts.map +0 -1
- package/dist/tui/components/InputBox.js.map +0 -1
- package/dist/tui/components/MessageList.d.ts.map +0 -1
- package/dist/tui/components/MessageList.js.map +0 -1
- package/dist/tui/components/ReadlineInput.d.ts.map +0 -1
- package/dist/tui/components/ReadlineInput.js.map +0 -1
- package/dist/tui/components/StatusBar.d.ts.map +0 -1
- package/dist/tui/components/StatusBar.js.map +0 -1
- package/dist/tui/components/index.d.ts.map +0 -1
- package/dist/tui/components/index.js.map +0 -1
- package/dist/tui/index.d.ts.map +0 -1
- package/dist/tui/index.js.map +0 -1
|
@@ -1,232 +1,105 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { ArrowDown } from "lucide-react";
|
|
2
3
|
import * as React from "react";
|
|
3
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
5
|
import { Toaster } from "./Sonner.js";
|
|
6
|
-
|
|
7
6
|
const ChatLayoutContext = React.createContext(undefined);
|
|
8
7
|
const useChatLayoutContext = () => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
return context;
|
|
8
|
+
const context = React.useContext(ChatLayoutContext);
|
|
9
|
+
if (!context) {
|
|
10
|
+
throw new Error("ChatLayout components must be used within ChatLayout.Root");
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
16
13
|
};
|
|
17
|
-
const ChatLayoutRoot = React.forwardRef(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const [panelSize, setPanelSize] = React.useState(defaultPanelSize);
|
|
31
|
-
const [activeTab, setActiveTab] = React.useState(defaultActiveTab);
|
|
32
|
-
return _jsx(ChatLayoutContext.Provider, {
|
|
33
|
-
value: {
|
|
34
|
-
sidebarOpen,
|
|
35
|
-
setSidebarOpen,
|
|
36
|
-
panelSize,
|
|
37
|
-
setPanelSize,
|
|
38
|
-
activeTab,
|
|
39
|
-
setActiveTab,
|
|
40
|
-
},
|
|
41
|
-
children: _jsx("div", {
|
|
42
|
-
ref: ref,
|
|
43
|
-
className: cn(
|
|
44
|
-
"flex h-screen flex-row bg-background text-foreground",
|
|
45
|
-
className,
|
|
46
|
-
),
|
|
47
|
-
...props,
|
|
48
|
-
children: children,
|
|
49
|
-
}),
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
);
|
|
14
|
+
const ChatLayoutRoot = React.forwardRef(({ defaultSidebarOpen = false, defaultPanelSize = "hidden", defaultActiveTab = "todo", className, children, ...props }, ref) => {
|
|
15
|
+
const [sidebarOpen, setSidebarOpen] = React.useState(defaultSidebarOpen);
|
|
16
|
+
const [panelSize, setPanelSize] = React.useState(defaultPanelSize);
|
|
17
|
+
const [activeTab, setActiveTab] = React.useState(defaultActiveTab);
|
|
18
|
+
return (_jsx(ChatLayoutContext.Provider, { value: {
|
|
19
|
+
sidebarOpen,
|
|
20
|
+
setSidebarOpen,
|
|
21
|
+
panelSize,
|
|
22
|
+
setPanelSize,
|
|
23
|
+
activeTab,
|
|
24
|
+
setActiveTab,
|
|
25
|
+
}, children: _jsx("div", { ref: ref, className: cn("flex h-screen flex-row bg-background text-foreground", className), ...props, children: children }) }));
|
|
26
|
+
});
|
|
53
27
|
ChatLayoutRoot.displayName = "ChatLayout.Root";
|
|
54
|
-
const ChatLayoutHeader = React.forwardRef(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
ref: ref,
|
|
58
|
-
className: cn(
|
|
59
|
-
"relative z-10 border-b border-border bg-card shrink-0",
|
|
60
|
-
className,
|
|
61
|
-
),
|
|
62
|
-
...props,
|
|
63
|
-
children: children,
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
);
|
|
28
|
+
const ChatLayoutHeader = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
29
|
+
return (_jsx("div", { ref: ref, className: cn("relative z-10 border-b border-border bg-card shrink-0", className), ...props, children: children }));
|
|
30
|
+
});
|
|
67
31
|
ChatLayoutHeader.displayName = "ChatLayout.Header";
|
|
68
|
-
const ChatLayoutMain = React.forwardRef(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
ref: ref,
|
|
72
|
-
className: cn("flex flex-1 flex-col overflow-hidden", className),
|
|
73
|
-
...props,
|
|
74
|
-
children: children,
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
);
|
|
32
|
+
const ChatLayoutMain = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
33
|
+
return (_jsx("div", { ref: ref, className: cn("flex flex-1 flex-col overflow-hidden", className), ...props, children: children }));
|
|
34
|
+
});
|
|
78
35
|
ChatLayoutMain.displayName = "ChatLayout.Main";
|
|
79
|
-
const ChatLayoutBody = React.forwardRef(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
ref: ref,
|
|
83
|
-
className: cn("relative flex flex-1 flex-col overflow-hidden", className),
|
|
84
|
-
...props,
|
|
85
|
-
children: [children, showToaster && _jsx(Toaster, {})],
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
);
|
|
36
|
+
const ChatLayoutBody = React.forwardRef(({ showToaster = true, className, children, ...props }, ref) => {
|
|
37
|
+
return (_jsxs("div", { ref: ref, className: cn("relative flex flex-1 flex-col overflow-hidden", className), ...props, children: [children, showToaster && _jsx(Toaster, {})] }));
|
|
38
|
+
});
|
|
89
39
|
ChatLayoutBody.displayName = "ChatLayout.Body";
|
|
90
|
-
const ChatLayoutMessages = React.forwardRef(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
// Check scroll position on mount and when children change
|
|
129
|
-
React.useEffect(() => {
|
|
130
|
-
checkScrollPosition();
|
|
131
|
-
}, [checkScrollPosition]);
|
|
132
|
-
return _jsxs("div", {
|
|
133
|
-
className: "relative flex-1 overflow-hidden",
|
|
134
|
-
children: [
|
|
135
|
-
_jsx("div", {
|
|
136
|
-
ref: scrollContainerRef,
|
|
137
|
-
className: cn("h-full overflow-y-auto", className),
|
|
138
|
-
onScroll: handleScroll,
|
|
139
|
-
...props,
|
|
140
|
-
children: children,
|
|
141
|
-
}),
|
|
142
|
-
showScrollButton &&
|
|
143
|
-
_jsx("button", {
|
|
144
|
-
type: "button",
|
|
145
|
-
onClick: scrollToBottom,
|
|
146
|
-
className: cn(
|
|
147
|
-
"absolute bottom-4 left-1/2 -translate-x-1/2 z-10",
|
|
148
|
-
"flex items-center justify-center p-2 rounded-full",
|
|
149
|
-
"bg-card border border-border shadow-lg",
|
|
150
|
-
"text-foreground",
|
|
151
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
152
|
-
"transition-all duration-200 ease-in-out",
|
|
153
|
-
"animate-in fade-in slide-in-from-bottom-2",
|
|
154
|
-
),
|
|
155
|
-
"aria-label": "Scroll to bottom",
|
|
156
|
-
children: _jsx(ArrowDown, { className: "h-4 w-4" }),
|
|
157
|
-
}),
|
|
158
|
-
],
|
|
159
|
-
});
|
|
160
|
-
},
|
|
161
|
-
);
|
|
40
|
+
const ChatLayoutMessages = React.forwardRef(({ className, children, onScrollChange, showScrollToBottom = true, ...props }, ref) => {
|
|
41
|
+
const [showScrollButton, setShowScrollButton] = React.useState(false);
|
|
42
|
+
const scrollContainerRef = React.useRef(null);
|
|
43
|
+
// Merge refs
|
|
44
|
+
React.useImperativeHandle(ref, () => scrollContainerRef.current);
|
|
45
|
+
// Check if user is at bottom of scroll
|
|
46
|
+
const checkScrollPosition = React.useCallback(() => {
|
|
47
|
+
const container = scrollContainerRef.current;
|
|
48
|
+
if (!container)
|
|
49
|
+
return;
|
|
50
|
+
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
51
|
+
const distanceFromBottom = scrollHeight - scrollTop - clientHeight;
|
|
52
|
+
const isAtBottom = distanceFromBottom < 100; // 100px threshold
|
|
53
|
+
setShowScrollButton(!isAtBottom && showScrollToBottom);
|
|
54
|
+
onScrollChange?.(isAtBottom);
|
|
55
|
+
}, [onScrollChange, showScrollToBottom]);
|
|
56
|
+
// Handle scroll events
|
|
57
|
+
const handleScroll = React.useCallback(() => {
|
|
58
|
+
checkScrollPosition();
|
|
59
|
+
}, [checkScrollPosition]);
|
|
60
|
+
// Scroll to bottom function
|
|
61
|
+
const scrollToBottom = React.useCallback(() => {
|
|
62
|
+
const container = scrollContainerRef.current;
|
|
63
|
+
if (!container)
|
|
64
|
+
return;
|
|
65
|
+
container.scrollTo({
|
|
66
|
+
top: container.scrollHeight,
|
|
67
|
+
behavior: "smooth",
|
|
68
|
+
});
|
|
69
|
+
}, []);
|
|
70
|
+
// Check scroll position on mount and when children change
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
checkScrollPosition();
|
|
73
|
+
}, [checkScrollPosition]);
|
|
74
|
+
return (_jsxs("div", { className: "relative flex-1 overflow-hidden", children: [_jsx("div", { ref: scrollContainerRef, className: cn("h-full overflow-y-auto", className), onScroll: handleScroll, ...props, children: children }), showScrollButton && (_jsx("button", { type: "button", onClick: scrollToBottom, className: cn("absolute bottom-4 left-1/2 -translate-x-1/2 z-10", "flex items-center justify-center p-2 rounded-full", "bg-card border border-border shadow-lg", "text-foreground", "hover:bg-accent hover:text-accent-foreground", "transition-all duration-200 ease-in-out", "animate-in fade-in slide-in-from-bottom-2"), "aria-label": "Scroll to bottom", children: _jsx(ArrowDown, { className: "h-4 w-4" }) }))] }));
|
|
75
|
+
});
|
|
162
76
|
ChatLayoutMessages.displayName = "ChatLayout.Messages";
|
|
163
|
-
const ChatLayoutFooter = React.forwardRef(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
ref: ref,
|
|
167
|
-
className: cn(
|
|
168
|
-
"bg-linear-to-t from-background to-transparent px-4 pb-4",
|
|
169
|
-
className,
|
|
170
|
-
),
|
|
171
|
-
...props,
|
|
172
|
-
children: children,
|
|
173
|
-
});
|
|
174
|
-
},
|
|
175
|
-
);
|
|
77
|
+
const ChatLayoutFooter = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
78
|
+
return (_jsx("div", { ref: ref, className: cn("bg-linear-to-t from-background to-transparent px-4 pb-4", className), ...props, children: children }));
|
|
79
|
+
});
|
|
176
80
|
ChatLayoutFooter.displayName = "ChatLayout.Footer";
|
|
177
|
-
const ChatLayoutSidebar = React.forwardRef(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
className: cn(
|
|
184
|
-
"border-r border-border bg-card w-64 overflow-y-auto",
|
|
185
|
-
className,
|
|
186
|
-
),
|
|
187
|
-
...props,
|
|
188
|
-
children: children,
|
|
189
|
-
});
|
|
190
|
-
},
|
|
191
|
-
);
|
|
81
|
+
const ChatLayoutSidebar = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
82
|
+
const { sidebarOpen } = useChatLayoutContext();
|
|
83
|
+
if (!sidebarOpen)
|
|
84
|
+
return null;
|
|
85
|
+
return (_jsx("div", { ref: ref, className: cn("border-r border-border bg-card w-64 overflow-y-auto", className), ...props, children: children }));
|
|
86
|
+
});
|
|
192
87
|
ChatLayoutSidebar.displayName = "ChatLayout.Sidebar";
|
|
193
|
-
const ChatLayoutAside = React.forwardRef(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
breakpoint === "xl" && "xl:block",
|
|
207
|
-
breakpoint === "2xl" && "2xl:block",
|
|
208
|
-
// Size variants
|
|
209
|
-
panelSize === "small" && "w-80",
|
|
210
|
-
panelSize === "large" && "w-[32rem]",
|
|
211
|
-
className,
|
|
212
|
-
),
|
|
213
|
-
...props,
|
|
214
|
-
children: children,
|
|
215
|
-
});
|
|
216
|
-
},
|
|
217
|
-
);
|
|
88
|
+
const ChatLayoutAside = React.forwardRef(({ breakpoint = "lg", className, children, ...props }, ref) => {
|
|
89
|
+
const { panelSize } = useChatLayoutContext();
|
|
90
|
+
// Hidden state - don't render
|
|
91
|
+
if (panelSize === "hidden")
|
|
92
|
+
return null;
|
|
93
|
+
return (_jsx("div", { ref: ref, className: cn(
|
|
94
|
+
// Hidden by default, visible at breakpoint
|
|
95
|
+
"hidden border-l border-border bg-card overflow-y-auto transition-all duration-300",
|
|
96
|
+
// Breakpoint visibility
|
|
97
|
+
breakpoint === "md" && "md:block", breakpoint === "lg" && "lg:block", breakpoint === "xl" && "xl:block", breakpoint === "2xl" && "2xl:block",
|
|
98
|
+
// Size variants
|
|
99
|
+
panelSize === "small" && "w-80", panelSize === "large" && "w-lg", className), ...props, children: children }));
|
|
100
|
+
});
|
|
218
101
|
ChatLayoutAside.displayName = "ChatLayout.Aside";
|
|
219
102
|
/* -------------------------------------------------------------------------------------------------
|
|
220
103
|
* Exports
|
|
221
104
|
* -----------------------------------------------------------------------------------------------*/
|
|
222
|
-
export {
|
|
223
|
-
ChatLayoutRoot as Root,
|
|
224
|
-
ChatLayoutHeader as Header,
|
|
225
|
-
ChatLayoutMain as Main,
|
|
226
|
-
ChatLayoutBody as Body,
|
|
227
|
-
ChatLayoutMessages as Messages,
|
|
228
|
-
ChatLayoutFooter as Footer,
|
|
229
|
-
ChatLayoutSidebar as Sidebar,
|
|
230
|
-
ChatLayoutAside as Aside,
|
|
231
|
-
useChatLayoutContext,
|
|
232
|
-
};
|
|
105
|
+
export { ChatLayoutRoot as Root, ChatLayoutHeader as Header, ChatLayoutMain as Main, ChatLayoutBody as Body, ChatLayoutMessages as Messages, ChatLayoutFooter as Footer, ChatLayoutSidebar as Sidebar, ChatLayoutAside as Aside, useChatLayoutContext, };
|
|
@@ -4,24 +4,15 @@ import type { TodoItem } from "./TodoListItem.js";
|
|
|
4
4
|
* Shared tab content components for both mobile (ChatHeader) and desktop (Panel) views
|
|
5
5
|
* Following component architecture best practices
|
|
6
6
|
*/
|
|
7
|
-
export interface TodoTabContentProps
|
|
8
|
-
|
|
9
|
-
todos: TodoItem[];
|
|
7
|
+
export interface TodoTabContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
todos: TodoItem[];
|
|
10
9
|
}
|
|
11
|
-
export declare const TodoTabContent: React.ForwardRefExoticComponent<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export interface FilesTabContentProps
|
|
15
|
-
extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
|
-
files?: string[];
|
|
10
|
+
export declare const TodoTabContent: React.ForwardRefExoticComponent<TodoTabContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export interface FilesTabContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
files?: string[];
|
|
17
13
|
}
|
|
18
|
-
export declare const FilesTabContent: React.ForwardRefExoticComponent<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export interface DatabaseTabContentProps
|
|
22
|
-
extends React.HTMLAttributes<HTMLDivElement> {
|
|
23
|
-
data?: unknown;
|
|
14
|
+
export declare const FilesTabContent: React.ForwardRefExoticComponent<FilesTabContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export interface DatabaseTabContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
|
+
data?: unknown;
|
|
24
17
|
}
|
|
25
|
-
export declare const DatabaseTabContent: React.ForwardRefExoticComponent<
|
|
26
|
-
DatabaseTabContentProps & React.RefAttributes<HTMLDivElement>
|
|
27
|
-
>;
|
|
18
|
+
export declare const DatabaseTabContent: React.ForwardRefExoticComponent<DatabaseTabContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,93 +1,15 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
4
|
-
export const TodoTabContent = React.forwardRef(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ref: ref,
|
|
8
|
-
className: cn("space-y-4", className),
|
|
9
|
-
...props,
|
|
10
|
-
children: [
|
|
11
|
-
_jsx("h3", { className: "font-semibold text-lg", children: "Tasks" }),
|
|
12
|
-
_jsx("div", {
|
|
13
|
-
className: "space-y-2",
|
|
14
|
-
children:
|
|
15
|
-
todos.length === 0
|
|
16
|
-
? _jsx("p", {
|
|
17
|
-
className: "text-sm text-muted-foreground",
|
|
18
|
-
children: "No tasks yet",
|
|
19
|
-
})
|
|
20
|
-
: todos.map((todo) =>
|
|
21
|
-
_jsx(
|
|
22
|
-
"div",
|
|
23
|
-
{ className: "text-sm", children: todo.text },
|
|
24
|
-
todo.id,
|
|
25
|
-
),
|
|
26
|
-
),
|
|
27
|
-
}),
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
);
|
|
4
|
+
export const TodoTabContent = React.forwardRef(({ todos, className, ...props }, ref) => {
|
|
5
|
+
return (_jsx("div", { ref: ref, className: cn("space-y-2", className), ...props, children: todos.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-full min-h-[200px]", children: _jsx("p", { className: "text-sm text-muted-foreground", children: "No todos yet" }) })) : (todos.map((todo) => (_jsx("div", { className: "text-sm", children: todo.text }, todo.id)))) }));
|
|
6
|
+
});
|
|
32
7
|
TodoTabContent.displayName = "TodoTabContent";
|
|
33
|
-
export const FilesTabContent = React.forwardRef(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
ref: ref,
|
|
37
|
-
className: cn("space-y-4", className),
|
|
38
|
-
...props,
|
|
39
|
-
children: [
|
|
40
|
-
_jsx("h3", { className: "font-semibold text-lg", children: "Files" }),
|
|
41
|
-
files.length === 0
|
|
42
|
-
? _jsx("p", {
|
|
43
|
-
className: "text-sm text-muted-foreground",
|
|
44
|
-
children: "No files attached",
|
|
45
|
-
})
|
|
46
|
-
: _jsx("div", {
|
|
47
|
-
className: "space-y-2",
|
|
48
|
-
children: files.map((file) =>
|
|
49
|
-
_jsx("div", { className: "text-sm", children: file }, file),
|
|
50
|
-
),
|
|
51
|
-
}),
|
|
52
|
-
],
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
);
|
|
8
|
+
export const FilesTabContent = React.forwardRef(({ files = [], className, ...props }, ref) => {
|
|
9
|
+
return (_jsx("div", { ref: ref, className: cn("space-y-2", className), ...props, children: files.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-full min-h-[200px]", children: _jsx("p", { className: "text-sm text-muted-foreground", children: "No files attached" }) })) : (files.map((file) => (_jsx("div", { className: "text-sm", children: file }, file)))) }));
|
|
10
|
+
});
|
|
56
11
|
FilesTabContent.displayName = "FilesTabContent";
|
|
57
|
-
export const DatabaseTabContent = React.forwardRef(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
ref: ref,
|
|
61
|
-
className: cn("space-y-4", className),
|
|
62
|
-
...props,
|
|
63
|
-
children: [
|
|
64
|
-
_jsx("h3", {
|
|
65
|
-
className: "font-semibold text-lg",
|
|
66
|
-
children: "Database",
|
|
67
|
-
}),
|
|
68
|
-
_jsxs("div", {
|
|
69
|
-
className: "text-sm text-muted-foreground",
|
|
70
|
-
children: [
|
|
71
|
-
_jsx("p", {
|
|
72
|
-
children:
|
|
73
|
-
"Database viewer - panel automatically expanded to large size",
|
|
74
|
-
}),
|
|
75
|
-
_jsxs("div", {
|
|
76
|
-
className: "mt-4 p-4 border border-border rounded",
|
|
77
|
-
children: [
|
|
78
|
-
_jsx("p", { children: "Your large data table would go here" }),
|
|
79
|
-
data && typeof data === "object"
|
|
80
|
-
? _jsx("pre", {
|
|
81
|
-
className: "mt-2 text-xs overflow-auto",
|
|
82
|
-
children: JSON.stringify(data, null, 2),
|
|
83
|
-
})
|
|
84
|
-
: null,
|
|
85
|
-
],
|
|
86
|
-
}),
|
|
87
|
-
],
|
|
88
|
-
}),
|
|
89
|
-
],
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
);
|
|
12
|
+
export const DatabaseTabContent = React.forwardRef(({ data, className, ...props }, ref) => {
|
|
13
|
+
return (_jsxs("div", { ref: ref, className: cn("space-y-4", className), ...props, children: [_jsx("h3", { className: "font-semibold text-lg", children: "Database" }), _jsxs("div", { className: "text-sm text-muted-foreground", children: [_jsx("p", { children: "Database viewer - panel automatically expanded to large size" }), _jsxs("div", { className: "mt-4 p-4 border border-border rounded", children: [_jsx("p", { children: "Your large data table would go here" }), data && typeof data === "object" ? (_jsx("pre", { className: "mt-2 text-xs overflow-auto", children: JSON.stringify(data, null, 2) })) : null] })] })] }));
|
|
14
|
+
});
|
|
93
15
|
DatabaseTabContent.displayName = "DatabaseTabContent";
|
|
@@ -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>>;
|
|
@@ -1,121 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
5
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./Tabs.js";
|
|
6
6
|
import { TodoList } from "./TodoList.js";
|
|
7
|
-
export const ChatSecondaryPanel = React.forwardRef(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
...props,
|
|
45
|
-
children: _jsxs(Tabs, {
|
|
46
|
-
value: activeTab,
|
|
47
|
-
onValueChange: setActiveTab,
|
|
48
|
-
className: "w-full",
|
|
49
|
-
children: [
|
|
50
|
-
_jsxs("div", {
|
|
51
|
-
className: "relative mb-4 border-border",
|
|
52
|
-
children: [
|
|
53
|
-
_jsx(TabsList, {
|
|
54
|
-
className:
|
|
55
|
-
"bg-transparent p-0 h-auto rounded-none w-full border-none",
|
|
56
|
-
children: tabs.map((tab) =>
|
|
57
|
-
_jsx(
|
|
58
|
-
TabsTrigger,
|
|
59
|
-
{
|
|
60
|
-
value: tab.id,
|
|
61
|
-
className:
|
|
62
|
-
"px-3 py-1 text-sm font-[var(--font-family)] font-medium rounded-none text-foreground opacity-60 data-[state=active]:opacity-100 data-[state=active]:bg-transparent data-[state=active]:shadow-none",
|
|
63
|
-
children: tab.label,
|
|
64
|
-
},
|
|
65
|
-
tab.id,
|
|
66
|
-
),
|
|
67
|
-
),
|
|
68
|
-
}),
|
|
69
|
-
_jsx("div", {
|
|
70
|
-
ref: containerRef,
|
|
71
|
-
className:
|
|
72
|
-
"absolute top-0 left-0 w-full overflow-hidden z-10 pointer-events-none",
|
|
73
|
-
style: {
|
|
74
|
-
clipPath: "inset(0 100% 0 0% round 999px)",
|
|
75
|
-
transition: "clip-path 0.25s ease-out",
|
|
76
|
-
},
|
|
77
|
-
children: _jsx(TabsList, {
|
|
78
|
-
className:
|
|
79
|
-
"bg-secondary p-0 h-auto rounded-none w-full border-none",
|
|
80
|
-
children: tabs.map((tab) =>
|
|
81
|
-
_jsx(
|
|
82
|
-
TabsTrigger,
|
|
83
|
-
{
|
|
84
|
-
value: tab.id,
|
|
85
|
-
ref: activeTab === tab.id ? activeTabElementRef : null,
|
|
86
|
-
className:
|
|
87
|
-
"px-3 py-1 text-sm font-[var(--font-family)] font-medium rounded-none text-primary bg-transparent data-[state=active]:shadow-none shadow-none",
|
|
88
|
-
tabIndex: -1,
|
|
89
|
-
children: tab.label,
|
|
90
|
-
},
|
|
91
|
-
tab.id,
|
|
92
|
-
),
|
|
93
|
-
),
|
|
94
|
-
}),
|
|
95
|
-
}),
|
|
96
|
-
],
|
|
97
|
-
}),
|
|
98
|
-
_jsx(TabsContent, {
|
|
99
|
-
value: "todo",
|
|
100
|
-
children: _jsx(TodoList, { todos: todosToDisplay }),
|
|
101
|
-
}),
|
|
102
|
-
_jsx(TabsContent, {
|
|
103
|
-
value: "files",
|
|
104
|
-
children: _jsx("div", {
|
|
105
|
-
className: "text-sm text-foreground opacity-60 italic",
|
|
106
|
-
children: "Files tab coming soon...",
|
|
107
|
-
}),
|
|
108
|
-
}),
|
|
109
|
-
_jsx(TabsContent, {
|
|
110
|
-
value: "database",
|
|
111
|
-
children: _jsx("div", {
|
|
112
|
-
className: "text-sm text-foreground opacity-60 italic",
|
|
113
|
-
children: "Database tab coming soon...",
|
|
114
|
-
}),
|
|
115
|
-
}),
|
|
116
|
-
],
|
|
117
|
-
}),
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
);
|
|
7
|
+
export const ChatSecondaryPanel = React.forwardRef(({ client, todos, className, ...props }, ref) => {
|
|
8
|
+
// For now, just use prop-based todos
|
|
9
|
+
// Future: Add hook to get todos from store when available
|
|
10
|
+
const todosToDisplay = todos || [];
|
|
11
|
+
const [activeTab, setActiveTab] = useState("todo");
|
|
12
|
+
const containerRef = useRef(null);
|
|
13
|
+
const activeTabElementRef = useRef(null);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const updateClipPath = () => {
|
|
16
|
+
const container = containerRef.current;
|
|
17
|
+
if (activeTab && container) {
|
|
18
|
+
const activeTabElement = activeTabElementRef.current;
|
|
19
|
+
if (activeTabElement) {
|
|
20
|
+
const containerRect = container.getBoundingClientRect();
|
|
21
|
+
const tabRect = activeTabElement.getBoundingClientRect();
|
|
22
|
+
const offsetLeft = tabRect.left - containerRect.left;
|
|
23
|
+
const offsetWidth = tabRect.width;
|
|
24
|
+
const clipLeftPercent = (offsetLeft / containerRect.width) * 100;
|
|
25
|
+
const clipRightPercent = 100 - ((offsetLeft + offsetWidth) / containerRect.width) * 100;
|
|
26
|
+
container.style.clipPath = `inset(0 ${clipRightPercent.toFixed(2)}% 0 ${clipLeftPercent.toFixed(2)}% round 999px)`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
// Small delay to ensure DOM is ready
|
|
31
|
+
const timeoutId = setTimeout(updateClipPath, 0);
|
|
32
|
+
return () => clearTimeout(timeoutId);
|
|
33
|
+
}, [activeTab]);
|
|
34
|
+
const tabs = [
|
|
35
|
+
{ id: "todo", label: "To-Do List" },
|
|
36
|
+
{ id: "files", label: "Files" },
|
|
37
|
+
{ id: "database", label: "Database" },
|
|
38
|
+
];
|
|
39
|
+
return (_jsx("div", { ref: ref, className: cn("select-none", className), ...props, children: _jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, className: "w-full", children: [_jsxs("div", { className: "relative mb-4 border-border", children: [_jsx(TabsList, { className: "bg-transparent p-0 h-auto rounded-none w-full border-none", children: tabs.map((tab) => (_jsx(TabsTrigger, { value: tab.id, className: "px-3 py-1 text-sm font-[var(--font-family)] font-medium rounded-none text-foreground opacity-60 data-[state=active]:opacity-100 data-[state=active]:bg-transparent data-[state=active]:shadow-none", children: tab.label }, tab.id))) }), _jsx("div", { ref: containerRef, className: "absolute top-0 left-0 w-full overflow-hidden z-10 pointer-events-none", style: {
|
|
40
|
+
clipPath: "inset(0 100% 0 0% round 999px)",
|
|
41
|
+
transition: "clip-path 0.25s ease-out",
|
|
42
|
+
}, children: _jsx(TabsList, { className: "bg-secondary p-0 h-auto rounded-none w-full border-none", children: tabs.map((tab) => (_jsx(TabsTrigger, { value: tab.id, ref: activeTab === tab.id ? activeTabElementRef : null, className: "px-3 py-1 text-sm font-[var(--font-family)] font-medium rounded-none text-primary bg-transparent data-[state=active]:shadow-none shadow-none", tabIndex: -1, children: tab.label }, tab.id))) }) })] }), _jsx(TabsContent, { value: "todo", children: _jsx(TodoList, { todos: todosToDisplay }) }), _jsx(TabsContent, { value: "files", children: _jsx("div", { className: "text-sm text-foreground opacity-60 italic", children: "Files tab coming soon..." }) }), _jsx(TabsContent, { value: "database", children: _jsx("div", { className: "text-sm text-foreground opacity-60 italic", children: "Database tab coming soon..." }) })] }) }));
|
|
43
|
+
});
|
|
121
44
|
ChatSecondaryPanel.displayName = "ChatSecondaryPanel";
|