@chatsdk-dev/elements 0.0.1
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 +43 -0
- package/dist/chunk-2LHKM7RD.js +14 -0
- package/dist/chunk-5UMYP6MD.js +10 -0
- package/dist/chunk-AP4MG32M.js +36 -0
- package/dist/chunk-CFM57HOS.js +358 -0
- package/dist/chunk-EGIUE7H2.js +37 -0
- package/dist/chunk-M5OONVIO.js +90 -0
- package/dist/chunk-MXTBCHYC.js +31 -0
- package/dist/chunk-NIC3MOMY.js +55 -0
- package/dist/chunk-QTRMNIG3.js +83 -0
- package/dist/chunk-R7G3RQLU.js +36 -0
- package/dist/chunk-RJG5D2TM.js +113 -0
- package/dist/chunk-SLJNKQ2G.js +125 -0
- package/dist/chunk-TDEFIW2L.js +9 -0
- package/dist/chunk-TDP6D7U7.js +551 -0
- package/dist/chunk-V2ITXC65.js +24 -0
- package/dist/chunk-VS55HRUS.js +16 -0
- package/dist/chunk-VYDYCGJL.js +25 -0
- package/dist/chunk-X5YUF2YM.js +113 -0
- package/dist/chunk-YX46JVQN.js +78 -0
- package/dist/chunk-YXAMLTTT.js +16 -0
- package/dist/chunk-YXFVHSY4.js +51 -0
- package/dist/chunk-ZCSZX3OI.js +4 -0
- package/dist/common/use-copy-to-clipboard.d.ts +3 -0
- package/dist/common/use-copy-to-clipboard.js +33 -0
- package/dist/common/utilts.d.ts +8 -0
- package/dist/common/utilts.js +28 -0
- package/dist/components/ai-elements/actions.d.ts +13 -0
- package/dist/components/ai-elements/actions.js +42 -0
- package/dist/components/ai-elements/agent.d.ts +31 -0
- package/dist/components/ai-elements/agent.js +77 -0
- package/dist/components/ai-elements/artifact.d.ts +27 -0
- package/dist/components/ai-elements/artifact.js +108 -0
- package/dist/components/ai-elements/attachments.d.ts +57 -0
- package/dist/components/ai-elements/attachments.js +258 -0
- package/dist/components/ai-elements/audio-player.d.ts +33 -0
- package/dist/components/ai-elements/audio-player.js +199 -0
- package/dist/components/ai-elements/canvas.d.ts +10 -0
- package/dist/components/ai-elements/canvas.js +24 -0
- package/dist/components/ai-elements/chain-of-thought.d.ts +34 -0
- package/dist/components/ai-elements/chain-of-thought.js +159 -0
- package/dist/components/ai-elements/checkpoint.d.ts +16 -0
- package/dist/components/ai-elements/checkpoint.js +47 -0
- package/dist/components/ai-elements/code-block.d.ts +48 -0
- package/dist/components/ai-elements/code-block.js +1 -0
- package/dist/components/ai-elements/commit.d.ts +68 -0
- package/dist/components/ai-elements/commit.js +314 -0
- package/dist/components/ai-elements/confirmation.d.ts +52 -0
- package/dist/components/ai-elements/confirmation.js +76 -0
- package/dist/components/ai-elements/connection.d.ts +5 -0
- package/dist/components/ai-elements/connection.js +34 -0
- package/dist/components/ai-elements/context.d.ts +36 -0
- package/dist/components/ai-elements/context.js +320 -0
- package/dist/components/ai-elements/controls.d.ts +8 -0
- package/dist/components/ai-elements/controls.js +17 -0
- package/dist/components/ai-elements/conversation.d.ts +27 -0
- package/dist/components/ai-elements/conversation.js +119 -0
- package/dist/components/ai-elements/edge.d.ts +9 -0
- package/dist/components/ai-elements/edge.js +111 -0
- package/dist/components/ai-elements/environment-variables.d.ts +42 -0
- package/dist/components/ai-elements/environment-variables.js +208 -0
- package/dist/components/ai-elements/file-tree.d.ts +30 -0
- package/dist/components/ai-elements/file-tree.js +212 -0
- package/dist/components/ai-elements/image.d.ts +10 -0
- package/dist/components/ai-elements/image.js +23 -0
- package/dist/components/ai-elements/inline-citation.d.ts +42 -0
- package/dist/components/ai-elements/inline-citation.js +203 -0
- package/dist/components/ai-elements/jsx-preview.d.ts +33 -0
- package/dist/components/ai-elements/jsx-preview.js +206 -0
- package/dist/components/ai-elements/loader.d.ts +9 -0
- package/dist/components/ai-elements/loader.js +115 -0
- package/dist/components/ai-elements/message.d.ts +42 -0
- package/dist/components/ai-elements/message.js +259 -0
- package/dist/components/ai-elements/mic-selector.d.ts +49 -0
- package/dist/components/ai-elements/mic-selector.js +252 -0
- package/dist/components/ai-elements/model-selector.d.ts +39 -0
- package/dist/components/ai-elements/model-selector.js +73 -0
- package/dist/components/ai-elements/node.d.ts +25 -0
- package/dist/components/ai-elements/node.js +41 -0
- package/dist/components/ai-elements/open-in-chat.d.ts +32 -0
- package/dist/components/ai-elements/open-in-chat.js +366 -0
- package/dist/components/ai-elements/package-info.d.ts +32 -0
- package/dist/components/ai-elements/package-info.js +162 -0
- package/dist/components/ai-elements/panel.d.ts +8 -0
- package/dist/components/ai-elements/panel.js +17 -0
- package/dist/components/ai-elements/persona.d.ts +50 -0
- package/dist/components/ai-elements/persona.js +209 -0
- package/dist/components/ai-elements/plan.d.ts +29 -0
- package/dist/components/ai-elements/plan.js +95 -0
- package/dist/components/ai-elements/prompt-input.d.ts +153 -0
- package/dist/components/ai-elements/prompt-input.js +939 -0
- package/dist/components/ai-elements/queue.d.ts +65 -0
- package/dist/components/ai-elements/queue.js +179 -0
- package/dist/components/ai-elements/reasoning.d.ts +30 -0
- package/dist/components/ai-elements/reasoning.js +161 -0
- package/dist/components/ai-elements/response.d.ts +9 -0
- package/dist/components/ai-elements/response.js +33 -0
- package/dist/components/ai-elements/sandbox.d.ts +28 -0
- package/dist/components/ai-elements/sandbox.js +98 -0
- package/dist/components/ai-elements/schema-display.d.ts +58 -0
- package/dist/components/ai-elements/schema-display.js +313 -0
- package/dist/components/ai-elements/shimmer.d.ts +14 -0
- package/dist/components/ai-elements/shimmer.js +1 -0
- package/dist/components/ai-elements/snippet.d.ts +22 -0
- package/dist/components/ai-elements/snippet.js +90 -0
- package/dist/components/ai-elements/sources.d.ts +16 -0
- package/dist/components/ai-elements/sources.js +62 -0
- package/dist/components/ai-elements/speech-input.d.ts +57 -0
- package/dist/components/ai-elements/speech-input.js +206 -0
- package/dist/components/ai-elements/stack-trace.d.ts +42 -0
- package/dist/components/ai-elements/stack-trace.js +377 -0
- package/dist/components/ai-elements/suggestion.d.ts +14 -0
- package/dist/components/ai-elements/suggestion.js +41 -0
- package/dist/components/ai-elements/task.d.ts +18 -0
- package/dist/components/ai-elements/task.js +60 -0
- package/dist/components/ai-elements/terminal.d.ts +31 -0
- package/dist/components/ai-elements/terminal.js +203 -0
- package/dist/components/ai-elements/test-results.d.ts +61 -0
- package/dist/components/ai-elements/test-results.js +349 -0
- package/dist/components/ai-elements/tool.d.ts +35 -0
- package/dist/components/ai-elements/tool.js +2 -0
- package/dist/components/ai-elements/toolbar.d.ts +8 -0
- package/dist/components/ai-elements/toolbar.js +18 -0
- package/dist/components/ai-elements/transcription.d.ts +19 -0
- package/dist/components/ai-elements/transcription.js +90 -0
- package/dist/components/ai-elements/voice-selector.d.ts +66 -0
- package/dist/components/ai-elements/voice-selector.js +332 -0
- package/dist/components/ai-elements/web-preview.d.ts +38 -0
- package/dist/components/ai-elements/web-preview.js +214 -0
- package/dist/components/info-card.d.ts +14 -0
- package/dist/components/info-card.js +1 -0
- package/dist/components/responsive-alert-dialog.d.ts +19 -0
- package/dist/components/responsive-alert-dialog.js +1 -0
- package/dist/components/responsive-dialog.d.ts +14 -0
- package/dist/components/responsive-dialog.js +1 -0
- package/dist/config-IcWUmjwj.d.ts +239 -0
- package/dist/features/chat/chat-card.d.ts +5 -0
- package/dist/features/chat/chat-card.js +14 -0
- package/dist/features/chat/chat-element/chat-element.d.ts +8 -0
- package/dist/features/chat/chat-element/chat-element.js +14 -0
- package/dist/features/chat/chat-element/use-chat.d.ts +21 -0
- package/dist/features/chat/chat-element/use-chat.js +14 -0
- package/dist/features/chat/chat-element/use-initial-messages.d.ts +20 -0
- package/dist/features/chat/chat-element/use-initial-messages.js +14 -0
- package/dist/features/chat/chat-header/chat-header.d.ts +8 -0
- package/dist/features/chat/chat-header/chat-header.js +14 -0
- package/dist/features/chat/chat-header/chat-menu.d.ts +5 -0
- package/dist/features/chat/chat-header/chat-menu.js +2 -0
- package/dist/features/chat/chat-history/chat-history-empty.d.ts +5 -0
- package/dist/features/chat/chat-history/chat-history-empty.js +1 -0
- package/dist/features/chat/chat-history/chat-history.d.ts +5 -0
- package/dist/features/chat/chat-history/chat-history.js +14 -0
- package/dist/features/chat/chat-message.d.ts +10 -0
- package/dist/features/chat/chat-message.js +1 -0
- package/dist/features/chat/chat-molecule.d.ts +35 -0
- package/dist/features/chat/chat-molecule.js +14 -0
- package/dist/features/chat/chat-prompt-input.d.ts +16 -0
- package/dist/features/chat/chat-prompt-input.js +14 -0
- package/dist/features/chat/chat.context.d.ts +26 -0
- package/dist/features/chat/chat.context.js +13 -0
- package/dist/features/chat/index.d.ts +14 -0
- package/dist/features/chat/index.js +14 -0
- package/dist/features/chat/queries/query-keys.d.ts +8 -0
- package/dist/features/chat/queries/query-keys.js +1 -0
- package/dist/features/chat/queries/use-create-conversation-mutation.d.ts +29 -0
- package/dist/features/chat/queries/use-create-conversation-mutation.js +38 -0
- package/dist/features/chat/queries/use-get-chat-query.d.ts +9 -0
- package/dist/features/chat/queries/use-get-chat-query.js +14 -0
- package/dist/features/chat/queries/use-get-conversation-query.d.ts +62 -0
- package/dist/features/chat/queries/use-get-conversation-query.js +14 -0
- package/dist/features/chat/queries/use-list-conversations-query.d.ts +29 -0
- package/dist/features/chat/queries/use-list-conversations-query.js +14 -0
- package/dist/features/chat/store.d.ts +13 -0
- package/dist/features/chat/store.js +1 -0
- package/dist/features/chat/utils.d.ts +5 -0
- package/dist/features/chat/utils.js +1 -0
- package/dist/features/data-fetching/use-api-client.d.ts +5 -0
- package/dist/features/data-fetching/use-api-client.js +14 -0
- package/dist/features/logger/logger.d.ts +9 -0
- package/dist/features/logger/logger.js +1 -0
- package/dist/features/molecule/chatsdk-provider.d.ts +19 -0
- package/dist/features/molecule/chatsdk-provider.js +26 -0
- package/dist/features/molecule/constants.d.ts +3 -0
- package/dist/features/molecule/constants.js +1 -0
- package/dist/features/molecule/molecule-provider.d.ts +39 -0
- package/dist/features/molecule/molecule-provider.js +1 -0
- package/dist/features/molecule/store.d.ts +53 -0
- package/dist/features/molecule/store.js +3 -0
- package/dist/features/molecule/types/api.d.ts +8 -0
- package/dist/features/molecule/types/api.js +1 -0
- package/dist/features/molecule/types/callbacks.d.ts +22 -0
- package/dist/features/molecule/types/callbacks.js +1 -0
- package/dist/features/molecule/types/config.d.ts +10 -0
- package/dist/features/molecule/types/config.js +1 -0
- package/dist/features/molecule/types/context.d.ts +11 -0
- package/dist/features/molecule/types/context.js +1 -0
- package/dist/features/molecule/types/locale.d.ts +9 -0
- package/dist/features/molecule/types/locale.js +1 -0
- package/dist/features/molecule/types/theme.d.ts +38 -0
- package/dist/features/molecule/types/theme.js +1 -0
- package/dist/features/molecule/types/translations.d.ts +10 -0
- package/dist/features/molecule/types/translations.js +1 -0
- package/dist/features/molecule/use-merge-global-config.d.ts +22 -0
- package/dist/features/molecule/use-merge-global-config.js +5 -0
- package/dist/features/molecule/use-molecule-config.d.ts +41 -0
- package/dist/features/molecule/use-molecule-config.js +6 -0
- package/dist/features/molecule/utils.d.ts +10 -0
- package/dist/features/molecule/utils.js +1 -0
- package/dist/i18n/config.d.ts +61 -0
- package/dist/i18n/config.js +1 -0
- package/dist/i18n/i18next.d.ts +11 -0
- package/dist/i18n/i18next.js +2 -0
- package/dist/i18n/utils.d.ts +11 -0
- package/dist/i18n/utils.js +6 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/styles.css +6811 -0
- package/package.json +123 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { cn } from '@chatsdk-dev/ui/lib/utils';
|
|
2
|
+
import { AlertCircle } from 'lucide-react';
|
|
3
|
+
import { createContext, memo, useState, useMemo, useRef, useEffect, useCallback, useContext } from 'react';
|
|
4
|
+
import JsxParser from 'react-jsx-parser';
|
|
5
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var JSXPreviewContext = createContext(null);
|
|
8
|
+
var TAG_REGEX = /<\/?([a-zA-Z][a-zA-Z0-9]*)\s*([^>]*?)(\/)?>/;
|
|
9
|
+
var useJSXPreview = () => {
|
|
10
|
+
const context = useContext(JSXPreviewContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error("JSXPreview components must be used within JSXPreview");
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
};
|
|
16
|
+
var matchJsxTag = (code) => {
|
|
17
|
+
if (code.trim() === "") {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const match = code.match(TAG_REGEX);
|
|
21
|
+
if (!match || match.index === void 0) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const [fullMatch, tagName, attributes, selfClosing] = match;
|
|
25
|
+
let type;
|
|
26
|
+
if (selfClosing) {
|
|
27
|
+
type = "self-closing";
|
|
28
|
+
} else if (fullMatch.startsWith("</")) {
|
|
29
|
+
type = "closing";
|
|
30
|
+
} else {
|
|
31
|
+
type = "opening";
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
attributes: attributes?.trim(),
|
|
35
|
+
endIndex: match.index + fullMatch.length,
|
|
36
|
+
startIndex: match.index,
|
|
37
|
+
tag: fullMatch,
|
|
38
|
+
tagName,
|
|
39
|
+
type
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
var stripIncompleteTag = (text) => {
|
|
43
|
+
const lastOpen = text.lastIndexOf("<");
|
|
44
|
+
if (lastOpen === -1) {
|
|
45
|
+
return text;
|
|
46
|
+
}
|
|
47
|
+
const afterOpen = text.slice(lastOpen);
|
|
48
|
+
if (!afterOpen.includes(">")) {
|
|
49
|
+
return text.slice(0, lastOpen);
|
|
50
|
+
}
|
|
51
|
+
return text;
|
|
52
|
+
};
|
|
53
|
+
var completeJsxTag = (code) => {
|
|
54
|
+
const stack = [];
|
|
55
|
+
let result = "";
|
|
56
|
+
let currentPosition = 0;
|
|
57
|
+
while (currentPosition < code.length) {
|
|
58
|
+
const match = matchJsxTag(code.slice(currentPosition));
|
|
59
|
+
if (!match) {
|
|
60
|
+
result += stripIncompleteTag(code.slice(currentPosition));
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
const { tagName, type, endIndex } = match;
|
|
64
|
+
result += code.slice(currentPosition, currentPosition + endIndex);
|
|
65
|
+
if (type === "opening") {
|
|
66
|
+
stack.push(tagName ?? "");
|
|
67
|
+
} else if (type === "closing") {
|
|
68
|
+
stack.pop();
|
|
69
|
+
}
|
|
70
|
+
currentPosition += endIndex;
|
|
71
|
+
}
|
|
72
|
+
return result + stack.reverse().map((tag) => `</${tag}>`).join("");
|
|
73
|
+
};
|
|
74
|
+
var JSXPreview = memo(
|
|
75
|
+
({
|
|
76
|
+
jsx: jsx2,
|
|
77
|
+
isStreaming = false,
|
|
78
|
+
components,
|
|
79
|
+
bindings,
|
|
80
|
+
onError,
|
|
81
|
+
className,
|
|
82
|
+
children,
|
|
83
|
+
...props
|
|
84
|
+
}) => {
|
|
85
|
+
const [prevJsx, setPrevJsx] = useState(jsx2);
|
|
86
|
+
const [error, setError] = useState(null);
|
|
87
|
+
const [_lastGoodJsx, setLastGoodJsx] = useState("");
|
|
88
|
+
if (jsx2 !== prevJsx) {
|
|
89
|
+
setPrevJsx(jsx2);
|
|
90
|
+
setError(null);
|
|
91
|
+
}
|
|
92
|
+
const processedJsx = useMemo(
|
|
93
|
+
() => isStreaming ? completeJsxTag(jsx2) : jsx2,
|
|
94
|
+
[jsx2, isStreaming]
|
|
95
|
+
);
|
|
96
|
+
const contextValue = useMemo(
|
|
97
|
+
() => ({
|
|
98
|
+
bindings,
|
|
99
|
+
components,
|
|
100
|
+
error,
|
|
101
|
+
isStreaming,
|
|
102
|
+
jsx: jsx2,
|
|
103
|
+
onErrorProp: onError,
|
|
104
|
+
processedJsx,
|
|
105
|
+
setError,
|
|
106
|
+
setLastGoodJsx
|
|
107
|
+
}),
|
|
108
|
+
[
|
|
109
|
+
bindings,
|
|
110
|
+
components,
|
|
111
|
+
error,
|
|
112
|
+
isStreaming,
|
|
113
|
+
jsx2,
|
|
114
|
+
onError,
|
|
115
|
+
processedJsx,
|
|
116
|
+
setError
|
|
117
|
+
]
|
|
118
|
+
);
|
|
119
|
+
return /* @__PURE__ */ jsx(JSXPreviewContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { className: cn("relative", className), ...props, children }) });
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
JSXPreview.displayName = "JSXPreview";
|
|
123
|
+
var JSXPreviewContent = memo(
|
|
124
|
+
({ className, ...props }) => {
|
|
125
|
+
const {
|
|
126
|
+
processedJsx,
|
|
127
|
+
isStreaming,
|
|
128
|
+
components,
|
|
129
|
+
bindings,
|
|
130
|
+
setError,
|
|
131
|
+
setLastGoodJsx,
|
|
132
|
+
onErrorProp
|
|
133
|
+
} = useJSXPreview();
|
|
134
|
+
const errorReportedRef = useRef(null);
|
|
135
|
+
const lastGoodJsxRef = useRef("");
|
|
136
|
+
const [hadError, setHadError] = useState(false);
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
errorReportedRef.current = null;
|
|
139
|
+
setHadError(false);
|
|
140
|
+
}, [processedJsx]);
|
|
141
|
+
const handleError = useCallback(
|
|
142
|
+
(err) => {
|
|
143
|
+
if (errorReportedRef.current === processedJsx) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
errorReportedRef.current = processedJsx;
|
|
147
|
+
if (isStreaming) {
|
|
148
|
+
setHadError(true);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
setError(err);
|
|
152
|
+
onErrorProp?.(err);
|
|
153
|
+
},
|
|
154
|
+
[processedJsx, isStreaming, onErrorProp, setError]
|
|
155
|
+
);
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
if (!errorReportedRef.current) {
|
|
158
|
+
lastGoodJsxRef.current = processedJsx;
|
|
159
|
+
setLastGoodJsx(processedJsx);
|
|
160
|
+
}
|
|
161
|
+
}, [processedJsx, setLastGoodJsx]);
|
|
162
|
+
const displayJsx = isStreaming && hadError ? lastGoodJsxRef.current : processedJsx;
|
|
163
|
+
return /* @__PURE__ */ jsx("div", { className: cn("jsx-preview-content", className), ...props, children: /* @__PURE__ */ jsx(
|
|
164
|
+
JsxParser,
|
|
165
|
+
{
|
|
166
|
+
bindings,
|
|
167
|
+
components,
|
|
168
|
+
jsx: displayJsx,
|
|
169
|
+
onError: handleError,
|
|
170
|
+
renderInWrapper: false
|
|
171
|
+
}
|
|
172
|
+
) });
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
JSXPreviewContent.displayName = "JSXPreviewContent";
|
|
176
|
+
var renderChildren = (children, error) => {
|
|
177
|
+
if (typeof children === "function") {
|
|
178
|
+
return children(error);
|
|
179
|
+
}
|
|
180
|
+
return children;
|
|
181
|
+
};
|
|
182
|
+
var JSXPreviewError = memo(
|
|
183
|
+
({ className, children, ...props }) => {
|
|
184
|
+
const { error } = useJSXPreview();
|
|
185
|
+
if (!error) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
return /* @__PURE__ */ jsx(
|
|
189
|
+
"div",
|
|
190
|
+
{
|
|
191
|
+
className: cn(
|
|
192
|
+
"flex items-center gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-destructive text-sm",
|
|
193
|
+
className
|
|
194
|
+
),
|
|
195
|
+
...props,
|
|
196
|
+
children: children ? renderChildren(children, error) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
197
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "size-4 shrink-0" }),
|
|
198
|
+
/* @__PURE__ */ jsx("span", { children: error.message })
|
|
199
|
+
] })
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
JSXPreviewError.displayName = "JSXPreviewError";
|
|
205
|
+
|
|
206
|
+
export { JSXPreview, JSXPreviewContent, JSXPreviewError, useJSXPreview };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
type LoaderProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
size?: number;
|
|
6
|
+
};
|
|
7
|
+
declare const Loader: ({ className, size, ...props }: LoaderProps) => react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { Loader, type LoaderProps };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { cn } from '@chatsdk-dev/ui/lib/utils';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/components/ai-elements/loader.tsx
|
|
5
|
+
var LoaderIcon = ({ size = 16 }) => /* @__PURE__ */ jsxs(
|
|
6
|
+
"svg",
|
|
7
|
+
{
|
|
8
|
+
height: size,
|
|
9
|
+
strokeLinejoin: "round",
|
|
10
|
+
style: { color: "currentcolor" },
|
|
11
|
+
viewBox: "0 0 16 16",
|
|
12
|
+
width: size,
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ jsx("title", { children: "Loader" }),
|
|
15
|
+
/* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_2393_1490)", children: [
|
|
16
|
+
/* @__PURE__ */ jsx("path", { d: "M8 0V4", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
18
|
+
"path",
|
|
19
|
+
{
|
|
20
|
+
d: "M8 16V12",
|
|
21
|
+
opacity: "0.5",
|
|
22
|
+
stroke: "currentColor",
|
|
23
|
+
strokeWidth: "1.5"
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
"path",
|
|
28
|
+
{
|
|
29
|
+
d: "M3.29773 1.52783L5.64887 4.7639",
|
|
30
|
+
opacity: "0.9",
|
|
31
|
+
stroke: "currentColor",
|
|
32
|
+
strokeWidth: "1.5"
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
"path",
|
|
37
|
+
{
|
|
38
|
+
d: "M12.7023 1.52783L10.3511 4.7639",
|
|
39
|
+
opacity: "0.1",
|
|
40
|
+
stroke: "currentColor",
|
|
41
|
+
strokeWidth: "1.5"
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
"path",
|
|
46
|
+
{
|
|
47
|
+
d: "M12.7023 14.472L10.3511 11.236",
|
|
48
|
+
opacity: "0.4",
|
|
49
|
+
stroke: "currentColor",
|
|
50
|
+
strokeWidth: "1.5"
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
"path",
|
|
55
|
+
{
|
|
56
|
+
d: "M3.29773 14.472L5.64887 11.236",
|
|
57
|
+
opacity: "0.6",
|
|
58
|
+
stroke: "currentColor",
|
|
59
|
+
strokeWidth: "1.5"
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
"path",
|
|
64
|
+
{
|
|
65
|
+
d: "M15.6085 5.52783L11.8043 6.7639",
|
|
66
|
+
opacity: "0.2",
|
|
67
|
+
stroke: "currentColor",
|
|
68
|
+
strokeWidth: "1.5"
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
"path",
|
|
73
|
+
{
|
|
74
|
+
d: "M0.391602 10.472L4.19583 9.23598",
|
|
75
|
+
opacity: "0.7",
|
|
76
|
+
stroke: "currentColor",
|
|
77
|
+
strokeWidth: "1.5"
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
"path",
|
|
82
|
+
{
|
|
83
|
+
d: "M15.6085 10.4722L11.8043 9.2361",
|
|
84
|
+
opacity: "0.3",
|
|
85
|
+
stroke: "currentColor",
|
|
86
|
+
strokeWidth: "1.5"
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
"path",
|
|
91
|
+
{
|
|
92
|
+
d: "M0.391602 5.52783L4.19583 6.7639",
|
|
93
|
+
opacity: "0.8",
|
|
94
|
+
stroke: "currentColor",
|
|
95
|
+
strokeWidth: "1.5"
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_2393_1490", children: /* @__PURE__ */ jsx("rect", { fill: "white", height: "16", width: "16" }) }) })
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
var Loader = ({ className, size = 16, ...props }) => /* @__PURE__ */ jsx(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
className: cn(
|
|
107
|
+
"inline-flex animate-spin items-center justify-center",
|
|
108
|
+
className
|
|
109
|
+
),
|
|
110
|
+
...props,
|
|
111
|
+
children: /* @__PURE__ */ jsx(LoaderIcon, { size })
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
export { Loader };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ComponentProps } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { Button } from '@chatsdk-dev/ui/components/button';
|
|
5
|
+
import { ButtonGroup } from '@chatsdk-dev/ui/components/button-group';
|
|
6
|
+
import { UIMessage } from 'ai';
|
|
7
|
+
import { Streamdown } from 'streamdown';
|
|
8
|
+
|
|
9
|
+
type MessageProps = HTMLAttributes<HTMLDivElement> & {
|
|
10
|
+
from: UIMessage["role"];
|
|
11
|
+
};
|
|
12
|
+
declare const Message: ({ className, from, ...props }: MessageProps) => react_jsx_runtime.JSX.Element;
|
|
13
|
+
type MessageContentProps = HTMLAttributes<HTMLDivElement>;
|
|
14
|
+
declare const MessageContent: ({ children, className, ...props }: MessageContentProps) => react_jsx_runtime.JSX.Element;
|
|
15
|
+
type MessageActionsProps = ComponentProps<"div">;
|
|
16
|
+
declare const MessageActions: ({ className, children, ...props }: MessageActionsProps) => react_jsx_runtime.JSX.Element;
|
|
17
|
+
type MessageActionProps = ComponentProps<typeof Button> & {
|
|
18
|
+
tooltip?: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
};
|
|
21
|
+
declare const MessageAction: ({ tooltip, children, label, variant, size, ...props }: MessageActionProps) => react_jsx_runtime.JSX.Element;
|
|
22
|
+
type MessageBranchProps = HTMLAttributes<HTMLDivElement> & {
|
|
23
|
+
defaultBranch?: number;
|
|
24
|
+
onBranchChange?: (branchIndex: number) => void;
|
|
25
|
+
};
|
|
26
|
+
declare const MessageBranch: ({ defaultBranch, onBranchChange, className, ...props }: MessageBranchProps) => react_jsx_runtime.JSX.Element;
|
|
27
|
+
type MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;
|
|
28
|
+
declare const MessageBranchContent: ({ children, ...props }: MessageBranchContentProps) => react_jsx_runtime.JSX.Element[];
|
|
29
|
+
type MessageBranchSelectorProps = ComponentProps<typeof ButtonGroup>;
|
|
30
|
+
declare const MessageBranchSelector: ({ className, ...props }: MessageBranchSelectorProps) => react_jsx_runtime.JSX.Element | null;
|
|
31
|
+
type MessageBranchPreviousProps = ComponentProps<typeof Button>;
|
|
32
|
+
declare const MessageBranchPrevious: ({ children, ...props }: MessageBranchPreviousProps) => react_jsx_runtime.JSX.Element;
|
|
33
|
+
type MessageBranchNextProps = ComponentProps<typeof Button>;
|
|
34
|
+
declare const MessageBranchNext: ({ children, ...props }: MessageBranchNextProps) => react_jsx_runtime.JSX.Element;
|
|
35
|
+
type MessageBranchPageProps = HTMLAttributes<HTMLSpanElement>;
|
|
36
|
+
declare const MessageBranchPage: ({ className, ...props }: MessageBranchPageProps) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
type MessageResponseProps = ComponentProps<typeof Streamdown>;
|
|
38
|
+
declare const MessageResponse: react.MemoExoticComponent<({ className, ...props }: MessageResponseProps) => react_jsx_runtime.JSX.Element>;
|
|
39
|
+
type MessageToolbarProps = ComponentProps<"div">;
|
|
40
|
+
declare const MessageToolbar: ({ className, children, ...props }: MessageToolbarProps) => react_jsx_runtime.JSX.Element;
|
|
41
|
+
|
|
42
|
+
export { Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps };
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { Button } from '@chatsdk-dev/ui/components/button';
|
|
2
|
+
import { ButtonGroup, ButtonGroupText } from '@chatsdk-dev/ui/components/button-group';
|
|
3
|
+
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '@chatsdk-dev/ui/components/tooltip';
|
|
4
|
+
import { cn } from '@chatsdk-dev/ui/lib/utils';
|
|
5
|
+
import { cjk } from '@streamdown/cjk';
|
|
6
|
+
import { code } from '@streamdown/code';
|
|
7
|
+
import { math } from '@streamdown/math';
|
|
8
|
+
import { mermaid } from '@streamdown/mermaid';
|
|
9
|
+
import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
|
|
10
|
+
import { createContext, memo, useState, useCallback, useMemo, useEffect, useContext } from 'react';
|
|
11
|
+
import { Streamdown } from 'streamdown';
|
|
12
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
var Message = ({ className, from, ...props }) => /* @__PURE__ */ jsx(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: cn(
|
|
18
|
+
"group flex w-full max-w-[95%] flex-col gap-2",
|
|
19
|
+
from === "user" ? "is-user ml-auto justify-end" : "is-assistant",
|
|
20
|
+
className
|
|
21
|
+
),
|
|
22
|
+
...props
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
var MessageContent = ({
|
|
26
|
+
children,
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
}) => /* @__PURE__ */ jsx(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: cn(
|
|
33
|
+
"is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm",
|
|
34
|
+
"group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground",
|
|
35
|
+
"group-[.is-assistant]:text-foreground",
|
|
36
|
+
className
|
|
37
|
+
),
|
|
38
|
+
...props,
|
|
39
|
+
children
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
var MessageActions = ({
|
|
43
|
+
className,
|
|
44
|
+
children,
|
|
45
|
+
...props
|
|
46
|
+
}) => /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-1", className), ...props, children });
|
|
47
|
+
var MessageAction = ({
|
|
48
|
+
tooltip,
|
|
49
|
+
children,
|
|
50
|
+
label,
|
|
51
|
+
variant = "ghost",
|
|
52
|
+
size = "icon",
|
|
53
|
+
...props
|
|
54
|
+
}) => {
|
|
55
|
+
const button = /* @__PURE__ */ jsxs(Button, { size, type: "button", variant, ...props, children: [
|
|
56
|
+
children,
|
|
57
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: label || tooltip })
|
|
58
|
+
] });
|
|
59
|
+
if (tooltip) {
|
|
60
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
61
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { render: () => button }),
|
|
62
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tooltip }) })
|
|
63
|
+
] }) });
|
|
64
|
+
}
|
|
65
|
+
return button;
|
|
66
|
+
};
|
|
67
|
+
var MessageBranchContext = createContext(
|
|
68
|
+
null
|
|
69
|
+
);
|
|
70
|
+
var useMessageBranch = () => {
|
|
71
|
+
const context = useContext(MessageBranchContext);
|
|
72
|
+
if (!context) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
"MessageBranch components must be used within MessageBranch"
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return context;
|
|
78
|
+
};
|
|
79
|
+
var MessageBranch = ({
|
|
80
|
+
defaultBranch = 0,
|
|
81
|
+
onBranchChange,
|
|
82
|
+
className,
|
|
83
|
+
...props
|
|
84
|
+
}) => {
|
|
85
|
+
const [currentBranch, setCurrentBranch] = useState(defaultBranch);
|
|
86
|
+
const [branches, setBranches] = useState([]);
|
|
87
|
+
const handleBranchChange = useCallback(
|
|
88
|
+
(newBranch) => {
|
|
89
|
+
setCurrentBranch(newBranch);
|
|
90
|
+
onBranchChange?.(newBranch);
|
|
91
|
+
},
|
|
92
|
+
[onBranchChange]
|
|
93
|
+
);
|
|
94
|
+
const goToPrevious = useCallback(() => {
|
|
95
|
+
const newBranch = currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
|
|
96
|
+
handleBranchChange(newBranch);
|
|
97
|
+
}, [currentBranch, branches.length, handleBranchChange]);
|
|
98
|
+
const goToNext = useCallback(() => {
|
|
99
|
+
const newBranch = currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
|
|
100
|
+
handleBranchChange(newBranch);
|
|
101
|
+
}, [currentBranch, branches.length, handleBranchChange]);
|
|
102
|
+
const contextValue = useMemo(
|
|
103
|
+
() => ({
|
|
104
|
+
branches,
|
|
105
|
+
currentBranch,
|
|
106
|
+
goToNext,
|
|
107
|
+
goToPrevious,
|
|
108
|
+
setBranches,
|
|
109
|
+
totalBranches: branches.length
|
|
110
|
+
}),
|
|
111
|
+
[branches, currentBranch, goToNext, goToPrevious]
|
|
112
|
+
);
|
|
113
|
+
return /* @__PURE__ */ jsx(MessageBranchContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
className: cn("grid w-full gap-2 [&>div]:pb-0", className),
|
|
117
|
+
...props
|
|
118
|
+
}
|
|
119
|
+
) });
|
|
120
|
+
};
|
|
121
|
+
var MessageBranchContent = ({
|
|
122
|
+
children,
|
|
123
|
+
...props
|
|
124
|
+
}) => {
|
|
125
|
+
const { currentBranch, setBranches, branches } = useMessageBranch();
|
|
126
|
+
const childrenArray = useMemo(
|
|
127
|
+
() => Array.isArray(children) ? children : [children],
|
|
128
|
+
[children]
|
|
129
|
+
);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (branches.length !== childrenArray.length) {
|
|
132
|
+
setBranches(childrenArray);
|
|
133
|
+
}
|
|
134
|
+
}, [childrenArray, branches, setBranches]);
|
|
135
|
+
return childrenArray.map((branch, index) => /* @__PURE__ */ jsx(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
className: cn(
|
|
139
|
+
"grid gap-2 overflow-hidden [&>div]:pb-0",
|
|
140
|
+
index === currentBranch ? "block" : "hidden"
|
|
141
|
+
),
|
|
142
|
+
...props,
|
|
143
|
+
children: branch
|
|
144
|
+
},
|
|
145
|
+
branch.key
|
|
146
|
+
));
|
|
147
|
+
};
|
|
148
|
+
var MessageBranchSelector = ({
|
|
149
|
+
className,
|
|
150
|
+
...props
|
|
151
|
+
}) => {
|
|
152
|
+
const { totalBranches } = useMessageBranch();
|
|
153
|
+
if (totalBranches <= 1) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
return /* @__PURE__ */ jsx(
|
|
157
|
+
ButtonGroup,
|
|
158
|
+
{
|
|
159
|
+
className: cn(
|
|
160
|
+
"[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
|
|
161
|
+
className
|
|
162
|
+
),
|
|
163
|
+
orientation: "horizontal",
|
|
164
|
+
...props
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
};
|
|
168
|
+
var MessageBranchPrevious = ({
|
|
169
|
+
children,
|
|
170
|
+
...props
|
|
171
|
+
}) => {
|
|
172
|
+
const { goToPrevious, totalBranches } = useMessageBranch();
|
|
173
|
+
return /* @__PURE__ */ jsx(
|
|
174
|
+
Button,
|
|
175
|
+
{
|
|
176
|
+
"aria-label": "Previous branch",
|
|
177
|
+
disabled: totalBranches <= 1,
|
|
178
|
+
onClick: goToPrevious,
|
|
179
|
+
size: "icon",
|
|
180
|
+
type: "button",
|
|
181
|
+
variant: "ghost",
|
|
182
|
+
...props,
|
|
183
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronLeftIcon, { size: 14 })
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
var MessageBranchNext = ({
|
|
188
|
+
children,
|
|
189
|
+
...props
|
|
190
|
+
}) => {
|
|
191
|
+
const { goToNext, totalBranches } = useMessageBranch();
|
|
192
|
+
return /* @__PURE__ */ jsx(
|
|
193
|
+
Button,
|
|
194
|
+
{
|
|
195
|
+
"aria-label": "Next branch",
|
|
196
|
+
disabled: totalBranches <= 1,
|
|
197
|
+
onClick: goToNext,
|
|
198
|
+
size: "icon",
|
|
199
|
+
type: "button",
|
|
200
|
+
variant: "ghost",
|
|
201
|
+
...props,
|
|
202
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRightIcon, { size: 14 })
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
var MessageBranchPage = ({
|
|
207
|
+
className,
|
|
208
|
+
...props
|
|
209
|
+
}) => {
|
|
210
|
+
const { currentBranch, totalBranches } = useMessageBranch();
|
|
211
|
+
return /* @__PURE__ */ jsxs(
|
|
212
|
+
ButtonGroupText,
|
|
213
|
+
{
|
|
214
|
+
className: cn(
|
|
215
|
+
"border-none bg-transparent text-muted-foreground shadow-none",
|
|
216
|
+
className
|
|
217
|
+
),
|
|
218
|
+
...props,
|
|
219
|
+
children: [
|
|
220
|
+
currentBranch + 1,
|
|
221
|
+
" of ",
|
|
222
|
+
totalBranches
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
};
|
|
227
|
+
var streamdownPlugins = { cjk, code, math, mermaid };
|
|
228
|
+
var MessageResponse = memo(
|
|
229
|
+
({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
230
|
+
Streamdown,
|
|
231
|
+
{
|
|
232
|
+
className: cn(
|
|
233
|
+
"size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
234
|
+
className
|
|
235
|
+
),
|
|
236
|
+
plugins: streamdownPlugins,
|
|
237
|
+
...props
|
|
238
|
+
}
|
|
239
|
+
),
|
|
240
|
+
(prevProps, nextProps) => prevProps.children === nextProps.children && nextProps.isAnimating === prevProps.isAnimating
|
|
241
|
+
);
|
|
242
|
+
MessageResponse.displayName = "MessageResponse";
|
|
243
|
+
var MessageToolbar = ({
|
|
244
|
+
className,
|
|
245
|
+
children,
|
|
246
|
+
...props
|
|
247
|
+
}) => /* @__PURE__ */ jsx(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
className: cn(
|
|
251
|
+
"mt-4 flex w-full items-center justify-between gap-4",
|
|
252
|
+
className
|
|
253
|
+
),
|
|
254
|
+
...props,
|
|
255
|
+
children
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
export { Message, MessageAction, MessageActions, MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, MessageContent, MessageResponse, MessageToolbar };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Button } from '@chatsdk-dev/ui/components/button';
|
|
3
|
+
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from '@chatsdk-dev/ui/components/command';
|
|
4
|
+
import { Popover, PopoverContent } from '@chatsdk-dev/ui/components/popover';
|
|
5
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
declare const useAudioDevices: () => {
|
|
8
|
+
devices: MediaDeviceInfo[];
|
|
9
|
+
error: string | null;
|
|
10
|
+
hasPermission: boolean;
|
|
11
|
+
loadDevices: () => Promise<void>;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
};
|
|
14
|
+
type MicSelectorProps = ComponentProps<typeof Popover> & {
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
value?: string | undefined;
|
|
17
|
+
onValueChange?: (value: string | undefined) => void;
|
|
18
|
+
open?: boolean;
|
|
19
|
+
onOpenChange?: (open: boolean) => void;
|
|
20
|
+
};
|
|
21
|
+
declare const MicSelector: ({ defaultValue, value: controlledValue, onValueChange: controlledOnValueChange, defaultOpen, open: controlledOpen, onOpenChange: controlledOnOpenChange, ...props }: MicSelectorProps) => react_jsx_runtime.JSX.Element;
|
|
22
|
+
type MicSelectorTriggerProps = ComponentProps<typeof Button>;
|
|
23
|
+
declare const MicSelectorTrigger: ({ children, ...props }: MicSelectorTriggerProps) => react_jsx_runtime.JSX.Element;
|
|
24
|
+
type MicSelectorContentProps = ComponentProps<typeof Command> & {
|
|
25
|
+
popoverOptions?: ComponentProps<typeof PopoverContent>;
|
|
26
|
+
};
|
|
27
|
+
declare const MicSelectorContent: ({ className, popoverOptions, ...props }: MicSelectorContentProps) => react_jsx_runtime.JSX.Element;
|
|
28
|
+
type MicSelectorInputProps = ComponentProps<typeof CommandInput> & {
|
|
29
|
+
value?: string;
|
|
30
|
+
defaultValue?: string;
|
|
31
|
+
onValueChange?: (value: string) => void;
|
|
32
|
+
};
|
|
33
|
+
declare const MicSelectorInput: ({ ...props }: MicSelectorInputProps) => react_jsx_runtime.JSX.Element;
|
|
34
|
+
type MicSelectorListProps = Omit<ComponentProps<typeof CommandList>, "children"> & {
|
|
35
|
+
children: (devices: MediaDeviceInfo[]) => ReactNode;
|
|
36
|
+
};
|
|
37
|
+
declare const MicSelectorList: ({ children, ...props }: MicSelectorListProps) => react_jsx_runtime.JSX.Element;
|
|
38
|
+
type MicSelectorEmptyProps = ComponentProps<typeof CommandEmpty>;
|
|
39
|
+
declare const MicSelectorEmpty: ({ children, ...props }: MicSelectorEmptyProps) => react_jsx_runtime.JSX.Element;
|
|
40
|
+
type MicSelectorItemProps = ComponentProps<typeof CommandItem>;
|
|
41
|
+
declare const MicSelectorItem: (props: MicSelectorItemProps) => react_jsx_runtime.JSX.Element;
|
|
42
|
+
type MicSelectorLabelProps = ComponentProps<"span"> & {
|
|
43
|
+
device: MediaDeviceInfo;
|
|
44
|
+
};
|
|
45
|
+
declare const MicSelectorLabel: ({ device, className, ...props }: MicSelectorLabelProps) => react_jsx_runtime.JSX.Element;
|
|
46
|
+
type MicSelectorValueProps = ComponentProps<"span">;
|
|
47
|
+
declare const MicSelectorValue: ({ className, ...props }: MicSelectorValueProps) => react_jsx_runtime.JSX.Element;
|
|
48
|
+
|
|
49
|
+
export { MicSelector, MicSelectorContent, type MicSelectorContentProps, MicSelectorEmpty, type MicSelectorEmptyProps, MicSelectorInput, type MicSelectorInputProps, MicSelectorItem, type MicSelectorItemProps, MicSelectorLabel, type MicSelectorLabelProps, MicSelectorList, type MicSelectorListProps, type MicSelectorProps, MicSelectorTrigger, type MicSelectorTriggerProps, MicSelectorValue, type MicSelectorValueProps, useAudioDevices };
|