@wealthx/shadcn 1.5.37 → 1.5.38
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/.turbo/turbo-build.log +99 -93
- package/CHANGELOG.md +6 -0
- package/dist/{chunk-734FOOJC.mjs → chunk-B5PSUONN.mjs} +25 -58
- package/dist/chunk-EFHPSKVF.mjs +192 -0
- package/dist/{chunk-NB3ZL36B.mjs → chunk-MZI77ZMX.mjs} +17 -2
- package/dist/chunk-R7M657QL.mjs +587 -0
- package/dist/{chunk-DIH2NZZ3.mjs → chunk-RRROLESJ.mjs} +33 -23
- package/dist/components/ui/ai-assistant-drawer.js +269 -121
- package/dist/components/ui/ai-assistant-drawer.mjs +2 -1
- package/dist/components/ui/ai-conversations/index.js +474 -286
- package/dist/components/ui/ai-conversations/index.mjs +2 -1
- package/dist/components/ui/chat-input-area.js +429 -0
- package/dist/components/ui/chat-input-area.mjs +11 -0
- package/dist/components/ui/page-top-bar.js +182 -5
- package/dist/components/ui/page-top-bar.mjs +3 -1
- package/dist/components/ui/support-agent/index.js +1131 -0
- package/dist/components/ui/support-agent/index.mjs +27 -0
- package/dist/index.js +4760 -4027
- package/dist/index.mjs +54 -36
- package/dist/styles.css +1 -1
- package/package.json +11 -1
- package/src/components/index.tsx +24 -0
- package/src/components/ui/ai-assistant-drawer.tsx +24 -51
- package/src/components/ui/ai-conversations/index.tsx +16 -8
- package/src/components/ui/ai-conversations/thread.tsx +38 -27
- package/src/components/ui/chat-input-area.tsx +244 -0
- package/src/components/ui/page-top-bar.tsx +31 -5
- package/src/components/ui/support-agent/index.tsx +25 -0
- package/src/components/ui/support-agent/support-agent-fab.tsx +116 -0
- package/src/components/ui/support-agent/support-agent-panel.tsx +498 -0
- package/src/components/ui/support-agent/support-agent-primitives.tsx +354 -0
- package/src/styles/globals.css +1 -0
- package/src/styles/styles-css.ts +1 -1
- package/tsup.config.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChatInputArea
|
|
3
|
+
} from "./chunk-EFHPSKVF.mjs";
|
|
1
4
|
import {
|
|
2
5
|
Sheet,
|
|
3
6
|
SheetContent
|
|
4
7
|
} from "./chunk-H3PTREG6.mjs";
|
|
5
|
-
import {
|
|
6
|
-
Textarea
|
|
7
|
-
} from "./chunk-BS75ICOO.mjs";
|
|
8
8
|
import {
|
|
9
9
|
Spinner
|
|
10
10
|
} from "./chunk-JVMXMFBB.mjs";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
|
|
21
21
|
// src/components/ui/ai-assistant-drawer.tsx
|
|
22
22
|
import * as React from "react";
|
|
23
|
-
import { Bot, RotateCcw,
|
|
23
|
+
import { Bot, RotateCcw, X } from "lucide-react";
|
|
24
24
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
25
25
|
function AiTypingIndicator() {
|
|
26
26
|
return /* @__PURE__ */ jsx("span", { className: "flex items-center gap-1 py-1", "aria-label": "AI is thinking", children: [0, 150, 300].map((delay) => /* @__PURE__ */ jsx(
|
|
@@ -106,16 +106,16 @@ function AiAssistantDrawer({
|
|
|
106
106
|
isStreaming = false,
|
|
107
107
|
isLoading = false,
|
|
108
108
|
onSendMessage,
|
|
109
|
+
onAttachFile,
|
|
110
|
+
onAttachImage,
|
|
109
111
|
onReset,
|
|
110
112
|
className
|
|
111
113
|
}) {
|
|
112
114
|
var _a;
|
|
113
115
|
const [inputValue, setInputValue] = React.useState("");
|
|
114
116
|
const messagesEndRef = React.useRef(null);
|
|
115
|
-
const textareaRef = React.useRef(null);
|
|
116
117
|
const suggestions = taskSuggestions != null ? taskSuggestions : DEFAULT_SUGGESTIONS;
|
|
117
118
|
const hasMessages = messages.length > 0;
|
|
118
|
-
const canSend = inputValue.trim().length > 0 && !isStreaming && !isLoading;
|
|
119
119
|
React.useEffect(() => {
|
|
120
120
|
if (!messagesEndRef.current) return;
|
|
121
121
|
messagesEndRef.current.scrollIntoView({
|
|
@@ -123,28 +123,15 @@ function AiAssistantDrawer({
|
|
|
123
123
|
block: "nearest"
|
|
124
124
|
});
|
|
125
125
|
}, [messages.length]);
|
|
126
|
-
React.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const text = inputValue.trim();
|
|
134
|
-
if (!text || !canSend) return;
|
|
135
|
-
onSendMessage == null ? void 0 : onSendMessage(text);
|
|
136
|
-
setInputValue("");
|
|
137
|
-
}, [inputValue, canSend, onSendMessage]);
|
|
138
|
-
const handleKeyDown = (e) => {
|
|
139
|
-
if (e.key === "Enter" && !e.shiftKey) {
|
|
140
|
-
e.preventDefault();
|
|
141
|
-
handleSend();
|
|
142
|
-
}
|
|
143
|
-
};
|
|
126
|
+
const handleSend = React.useCallback(
|
|
127
|
+
(text) => {
|
|
128
|
+
onSendMessage == null ? void 0 : onSendMessage(text);
|
|
129
|
+
setInputValue("");
|
|
130
|
+
},
|
|
131
|
+
[onSendMessage]
|
|
132
|
+
);
|
|
144
133
|
const handleSuggestionSelect = (text) => {
|
|
145
|
-
var _a2;
|
|
146
134
|
setInputValue(text);
|
|
147
|
-
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
148
135
|
};
|
|
149
136
|
return /* @__PURE__ */ jsx(Sheet, { open, onOpenChange: (o) => !o && onClose(), children: /* @__PURE__ */ jsxs(
|
|
150
137
|
SheetContent,
|
|
@@ -252,38 +239,18 @@ function AiAssistantDrawer({
|
|
|
252
239
|
/* @__PURE__ */ jsx("div", { ref: messagesEndRef })
|
|
253
240
|
] })
|
|
254
241
|
) }),
|
|
255
|
-
/* @__PURE__ */
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
className: "min-h-0 flex-1 resize-none overflow-hidden py-2 text-sm"
|
|
268
|
-
}
|
|
269
|
-
),
|
|
270
|
-
/* @__PURE__ */ jsxs(
|
|
271
|
-
Button,
|
|
272
|
-
{
|
|
273
|
-
size: "icon",
|
|
274
|
-
onClick: handleSend,
|
|
275
|
-
disabled: !canSend,
|
|
276
|
-
className: "shrink-0",
|
|
277
|
-
title: "Send",
|
|
278
|
-
children: [
|
|
279
|
-
/* @__PURE__ */ jsx(Send, { className: "size-4" }),
|
|
280
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Send message" })
|
|
281
|
-
]
|
|
282
|
-
}
|
|
283
|
-
)
|
|
284
|
-
] }),
|
|
285
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1.5 text-[10px] text-muted-foreground", children: "Enter to send \xB7 Shift+Enter for new line" })
|
|
286
|
-
] })
|
|
242
|
+
/* @__PURE__ */ jsx("div", { className: "border-t border-border p-3", children: /* @__PURE__ */ jsx(
|
|
243
|
+
ChatInputArea,
|
|
244
|
+
{
|
|
245
|
+
value: inputValue,
|
|
246
|
+
onChange: setInputValue,
|
|
247
|
+
onSend: handleSend,
|
|
248
|
+
onAttachFile,
|
|
249
|
+
onAttachImage,
|
|
250
|
+
disabled: isLoading || isStreaming,
|
|
251
|
+
placeholder: "Ask me anything\u2026"
|
|
252
|
+
}
|
|
253
|
+
) })
|
|
287
254
|
]
|
|
288
255
|
}
|
|
289
256
|
) });
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Textarea
|
|
3
|
+
} from "./chunk-BS75ICOO.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Button
|
|
6
|
+
} from "./chunk-NOOEKOWY.mjs";
|
|
7
|
+
import {
|
|
8
|
+
cn
|
|
9
|
+
} from "./chunk-AFML43VJ.mjs";
|
|
10
|
+
|
|
11
|
+
// src/components/ui/chat-input-area.tsx
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
import { ImagePlus, Paperclip, Send } from "lucide-react";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var DEFAULT_HINT = "Enter to send \xB7 Shift+Enter for new line";
|
|
16
|
+
function ChatInputArea({
|
|
17
|
+
value,
|
|
18
|
+
onChange,
|
|
19
|
+
onSend,
|
|
20
|
+
onAttachFile,
|
|
21
|
+
onAttachImage,
|
|
22
|
+
disabled = false,
|
|
23
|
+
placeholder = "Type your message\u2026",
|
|
24
|
+
hint = DEFAULT_HINT,
|
|
25
|
+
maxHeight = 160,
|
|
26
|
+
autoFocus = false,
|
|
27
|
+
className
|
|
28
|
+
}) {
|
|
29
|
+
const textareaRef = React.useRef(null);
|
|
30
|
+
const fileInputRef = React.useRef(null);
|
|
31
|
+
const imageInputRef = React.useRef(null);
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
if (autoFocus) {
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
var _a;
|
|
36
|
+
return (_a = textareaRef.current) == null ? void 0 : _a.focus();
|
|
37
|
+
}, 50);
|
|
38
|
+
}
|
|
39
|
+
}, [autoFocus]);
|
|
40
|
+
const handleSend = React.useCallback(() => {
|
|
41
|
+
const text = value.trim();
|
|
42
|
+
if (!text || disabled) return;
|
|
43
|
+
onSend(text);
|
|
44
|
+
if (textareaRef.current) {
|
|
45
|
+
textareaRef.current.style.height = "auto";
|
|
46
|
+
}
|
|
47
|
+
}, [value, disabled, onSend]);
|
|
48
|
+
const handleKeyDown = React.useCallback(
|
|
49
|
+
(e) => {
|
|
50
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
handleSend();
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
[handleSend]
|
|
56
|
+
);
|
|
57
|
+
const handleTextareaChange = React.useCallback(
|
|
58
|
+
(e) => {
|
|
59
|
+
onChange(e.target.value);
|
|
60
|
+
const el = e.target;
|
|
61
|
+
el.style.height = "auto";
|
|
62
|
+
el.style.height = `${Math.min(el.scrollHeight, maxHeight)}px`;
|
|
63
|
+
},
|
|
64
|
+
[onChange, maxHeight]
|
|
65
|
+
);
|
|
66
|
+
const handleFileChange = React.useCallback(
|
|
67
|
+
(e) => {
|
|
68
|
+
var _a;
|
|
69
|
+
if ((_a = e.target.files) == null ? void 0 : _a.length) {
|
|
70
|
+
onAttachFile == null ? void 0 : onAttachFile(e.target.files);
|
|
71
|
+
e.target.value = "";
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
[onAttachFile]
|
|
75
|
+
);
|
|
76
|
+
const handleImageChange = React.useCallback(
|
|
77
|
+
(e) => {
|
|
78
|
+
var _a;
|
|
79
|
+
if ((_a = e.target.files) == null ? void 0 : _a.length) {
|
|
80
|
+
onAttachImage == null ? void 0 : onAttachImage(e.target.files);
|
|
81
|
+
e.target.value = "";
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
[onAttachImage]
|
|
85
|
+
);
|
|
86
|
+
const showFileButton = typeof onAttachFile === "function";
|
|
87
|
+
const showImageButton = typeof onAttachImage === "function";
|
|
88
|
+
return /* @__PURE__ */ jsxs(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
"data-slot": "chat-input-area",
|
|
92
|
+
className: cn("flex flex-col gap-1.5", className),
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsxs("div", { className: "border border-border bg-background flex flex-col focus-within:ring-1 focus-within:ring-ring", children: [
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
Textarea,
|
|
97
|
+
{
|
|
98
|
+
ref: textareaRef,
|
|
99
|
+
value,
|
|
100
|
+
onChange: handleTextareaChange,
|
|
101
|
+
onKeyDown: handleKeyDown,
|
|
102
|
+
placeholder,
|
|
103
|
+
disabled,
|
|
104
|
+
rows: 3,
|
|
105
|
+
className: "resize-none text-sm border-0 shadow-none focus-visible:ring-0 px-3 pt-3 pb-1 min-h-[72px]",
|
|
106
|
+
"aria-label": placeholder
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-2 pb-2", children: [
|
|
110
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
|
|
111
|
+
showFileButton && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
Button,
|
|
114
|
+
{
|
|
115
|
+
variant: "ghost",
|
|
116
|
+
size: "icon-sm",
|
|
117
|
+
type: "button",
|
|
118
|
+
title: "Attach file",
|
|
119
|
+
"aria-label": "Attach file",
|
|
120
|
+
disabled,
|
|
121
|
+
onClick: () => {
|
|
122
|
+
var _a;
|
|
123
|
+
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
124
|
+
},
|
|
125
|
+
children: /* @__PURE__ */ jsx(Paperclip, { className: "size-3.5", "aria-hidden": "true" })
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
/* @__PURE__ */ jsx(
|
|
129
|
+
"input",
|
|
130
|
+
{
|
|
131
|
+
ref: fileInputRef,
|
|
132
|
+
type: "file",
|
|
133
|
+
multiple: true,
|
|
134
|
+
className: "sr-only",
|
|
135
|
+
tabIndex: -1,
|
|
136
|
+
onChange: handleFileChange
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
] }),
|
|
140
|
+
showImageButton && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
141
|
+
/* @__PURE__ */ jsx(
|
|
142
|
+
Button,
|
|
143
|
+
{
|
|
144
|
+
variant: "ghost",
|
|
145
|
+
size: "icon-sm",
|
|
146
|
+
type: "button",
|
|
147
|
+
title: "Upload image",
|
|
148
|
+
"aria-label": "Upload image",
|
|
149
|
+
disabled,
|
|
150
|
+
onClick: () => {
|
|
151
|
+
var _a;
|
|
152
|
+
return (_a = imageInputRef.current) == null ? void 0 : _a.click();
|
|
153
|
+
},
|
|
154
|
+
children: /* @__PURE__ */ jsx(ImagePlus, { className: "size-3.5", "aria-hidden": "true" })
|
|
155
|
+
}
|
|
156
|
+
),
|
|
157
|
+
/* @__PURE__ */ jsx(
|
|
158
|
+
"input",
|
|
159
|
+
{
|
|
160
|
+
ref: imageInputRef,
|
|
161
|
+
type: "file",
|
|
162
|
+
multiple: true,
|
|
163
|
+
accept: "image/*",
|
|
164
|
+
className: "sr-only",
|
|
165
|
+
tabIndex: -1,
|
|
166
|
+
onChange: handleImageChange
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
] })
|
|
170
|
+
] }),
|
|
171
|
+
/* @__PURE__ */ jsx(
|
|
172
|
+
Button,
|
|
173
|
+
{
|
|
174
|
+
size: "icon-sm",
|
|
175
|
+
type: "button",
|
|
176
|
+
"aria-label": "Send message",
|
|
177
|
+
disabled: !value.trim() || disabled,
|
|
178
|
+
onClick: handleSend,
|
|
179
|
+
children: /* @__PURE__ */ jsx(Send, { className: "size-3.5", "aria-hidden": "true" })
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] })
|
|
183
|
+
] }),
|
|
184
|
+
hint !== false && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: hint })
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export {
|
|
191
|
+
ChatInputArea
|
|
192
|
+
};
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button
|
|
3
|
+
} from "./chunk-NOOEKOWY.mjs";
|
|
1
4
|
import {
|
|
2
5
|
cn
|
|
3
6
|
} from "./chunk-AFML43VJ.mjs";
|
|
4
7
|
|
|
5
8
|
// src/components/ui/page-top-bar.tsx
|
|
9
|
+
import { Bot } from "lucide-react";
|
|
6
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
function PageTopBar({
|
|
11
|
+
function PageTopBar({
|
|
12
|
+
title,
|
|
13
|
+
actions,
|
|
14
|
+
onAskSupport,
|
|
15
|
+
className
|
|
16
|
+
}) {
|
|
8
17
|
return /* @__PURE__ */ jsxs(
|
|
9
18
|
"div",
|
|
10
19
|
{
|
|
@@ -16,7 +25,13 @@ function PageTopBar({ title, actions, className }) {
|
|
|
16
25
|
),
|
|
17
26
|
children: [
|
|
18
27
|
/* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold leading-tight", children: title }),
|
|
19
|
-
|
|
28
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
29
|
+
actions,
|
|
30
|
+
onAskSupport && /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: onAskSupport, children: [
|
|
31
|
+
/* @__PURE__ */ jsx(Bot, { className: "size-3.5", "aria-hidden": "true" }),
|
|
32
|
+
"Ask Support"
|
|
33
|
+
] })
|
|
34
|
+
] })
|
|
20
35
|
]
|
|
21
36
|
}
|
|
22
37
|
);
|