@melony/react 0.1.12 → 0.1.15
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 +55 -194
- package/dist/index.cjs +1409 -415
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +181 -12
- package/dist/index.d.ts +181 -12
- package/dist/index.js +1358 -371
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { ReactNode } from 'react';
|
|
3
|
-
import { ClientState, MelonyClient } from '
|
|
4
|
-
import { Role, Event, UINode } from '
|
|
3
|
+
import { ClientState, MelonyClient } from 'melony/client';
|
|
4
|
+
import { Role, Event, UINode } from 'melony';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
interface User {
|
|
8
|
-
id
|
|
8
|
+
id?: string;
|
|
9
|
+
uid: string;
|
|
9
10
|
email: string;
|
|
10
|
-
name
|
|
11
|
+
name?: string;
|
|
12
|
+
displayName?: string;
|
|
11
13
|
picture?: string;
|
|
14
|
+
createdAt?: string;
|
|
15
|
+
lastSignIn?: string | null;
|
|
16
|
+
emailVerified?: boolean;
|
|
12
17
|
}
|
|
13
18
|
interface Message {
|
|
14
19
|
role: Role;
|
|
@@ -26,6 +31,17 @@ interface StarterPrompt {
|
|
|
26
31
|
prompt: string;
|
|
27
32
|
icon?: React.ReactNode;
|
|
28
33
|
}
|
|
34
|
+
interface ComposerOption {
|
|
35
|
+
id: string;
|
|
36
|
+
label: string;
|
|
37
|
+
value: any;
|
|
38
|
+
}
|
|
39
|
+
interface ComposerOptionGroup {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
options: ComposerOption[];
|
|
43
|
+
type?: "single" | "multiple";
|
|
44
|
+
}
|
|
29
45
|
interface AuthService {
|
|
30
46
|
getMe: () => Promise<User | null>;
|
|
31
47
|
login: () => void;
|
|
@@ -91,6 +107,17 @@ interface ThreadProviderProps {
|
|
|
91
107
|
}
|
|
92
108
|
declare const ThreadProvider: React__default.FC<ThreadProviderProps>;
|
|
93
109
|
|
|
110
|
+
type Theme = "light" | "dark" | "system";
|
|
111
|
+
interface ThemeContextType {
|
|
112
|
+
theme: Theme;
|
|
113
|
+
setTheme: (theme: Theme) => void;
|
|
114
|
+
resolvedTheme: "light" | "dark";
|
|
115
|
+
}
|
|
116
|
+
declare function ThemeProvider({ children }: {
|
|
117
|
+
children: React.ReactNode;
|
|
118
|
+
}): react_jsx_runtime.JSX.Element;
|
|
119
|
+
declare function useTheme(): ThemeContextType;
|
|
120
|
+
|
|
94
121
|
interface UseMelonyOptions {
|
|
95
122
|
initialEvents?: Event[];
|
|
96
123
|
}
|
|
@@ -100,46 +127,165 @@ declare const useAuth: () => AuthContextValue;
|
|
|
100
127
|
|
|
101
128
|
declare const useThreads: () => ThreadContextValue;
|
|
102
129
|
|
|
103
|
-
|
|
130
|
+
interface ThreadProps {
|
|
104
131
|
className?: string;
|
|
105
132
|
placeholder?: string;
|
|
106
133
|
starterPrompts?: StarterPrompt[];
|
|
107
134
|
onStarterPromptClick?: (prompt: string) => void;
|
|
108
|
-
|
|
135
|
+
options?: ComposerOptionGroup[];
|
|
136
|
+
autoFocus?: boolean;
|
|
137
|
+
defaultSelectedIds?: string[];
|
|
138
|
+
}
|
|
139
|
+
declare function Thread({ className, placeholder, starterPrompts, onStarterPromptClick, options, autoFocus, defaultSelectedIds, }: ThreadProps): react_jsx_runtime.JSX.Element;
|
|
109
140
|
|
|
110
141
|
interface ComposerProps {
|
|
111
142
|
value: string;
|
|
112
143
|
onChange: (value: string) => void;
|
|
113
|
-
onSubmit: (
|
|
144
|
+
onSubmit: (state?: Record<string, any>) => void;
|
|
114
145
|
placeholder?: string;
|
|
115
146
|
isLoading?: boolean;
|
|
116
147
|
className?: string;
|
|
148
|
+
options?: ComposerOptionGroup[];
|
|
149
|
+
autoFocus?: boolean;
|
|
150
|
+
defaultSelectedIds?: string[];
|
|
117
151
|
}
|
|
118
|
-
declare function Composer({ value, onChange, onSubmit, placeholder, isLoading, className, }: ComposerProps): react_jsx_runtime.JSX.Element;
|
|
152
|
+
declare function Composer({ value, onChange, onSubmit, placeholder, isLoading, className, options, autoFocus, defaultSelectedIds, }: ComposerProps): react_jsx_runtime.JSX.Element;
|
|
153
|
+
|
|
154
|
+
interface ChatHeaderProps {
|
|
155
|
+
/**
|
|
156
|
+
* The title to display in the header. Can be a string or a React node for custom content.
|
|
157
|
+
*/
|
|
158
|
+
title?: string | React__default.ReactNode;
|
|
159
|
+
/**
|
|
160
|
+
* Content to render on the left side of the header (e.g., back button).
|
|
161
|
+
*/
|
|
162
|
+
leftContent?: React__default.ReactNode;
|
|
163
|
+
/**
|
|
164
|
+
* Content to render on the right side of the header (e.g., action buttons).
|
|
165
|
+
*/
|
|
166
|
+
rightContent?: React__default.ReactNode;
|
|
167
|
+
/**
|
|
168
|
+
* Custom className for the header container.
|
|
169
|
+
*/
|
|
170
|
+
className?: string;
|
|
171
|
+
/**
|
|
172
|
+
* Custom className for the title element (only applies when title is a string).
|
|
173
|
+
*/
|
|
174
|
+
titleClassName?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Custom children to render inside the header. If provided, this takes precedence over title/leftContent/rightContent.
|
|
177
|
+
*/
|
|
178
|
+
children?: React__default.ReactNode;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* A shared, customizable header component for chat interfaces.
|
|
182
|
+
* Used consistently across ChatFull, ChatSidebar, and ChatPopup components.
|
|
183
|
+
*/
|
|
184
|
+
declare function ChatHeader({ title, leftContent, rightContent, className, titleClassName, children, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
|
|
119
185
|
|
|
120
186
|
interface ChatPopupProps {
|
|
121
187
|
title?: string;
|
|
122
188
|
placeholder?: string;
|
|
123
189
|
starterPrompts?: StarterPrompt[];
|
|
190
|
+
options?: ComposerOptionGroup[];
|
|
124
191
|
defaultOpen?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Props for customizing the header. Note: leftContent and rightContent in headerProps
|
|
194
|
+
* will be merged with the default popup header actions (back, history, new chat, close).
|
|
195
|
+
*/
|
|
196
|
+
headerProps?: Omit<ChatHeaderProps, "title" | "leftContent" | "rightContent">;
|
|
197
|
+
/**
|
|
198
|
+
* IDs of options to be selected by default
|
|
199
|
+
*/
|
|
200
|
+
defaultSelectedIds?: string[];
|
|
125
201
|
}
|
|
126
|
-
declare function ChatPopup({ title, placeholder, starterPrompts, defaultOpen, }: ChatPopupProps): react_jsx_runtime.JSX.Element;
|
|
202
|
+
declare function ChatPopup({ title, placeholder, starterPrompts, options, defaultOpen, headerProps, defaultSelectedIds, }: ChatPopupProps): react_jsx_runtime.JSX.Element;
|
|
127
203
|
|
|
128
204
|
interface ChatSidebarProps {
|
|
129
205
|
title?: string;
|
|
130
206
|
placeholder?: string;
|
|
131
207
|
starterPrompts?: StarterPrompt[];
|
|
208
|
+
options?: ComposerOptionGroup[];
|
|
132
209
|
className?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Props for customizing the header. If provided, title prop will be passed to header.
|
|
212
|
+
*/
|
|
213
|
+
headerProps?: Omit<ChatHeaderProps, "title">;
|
|
214
|
+
/**
|
|
215
|
+
* IDs of options to be selected by default
|
|
216
|
+
*/
|
|
217
|
+
defaultSelectedIds?: string[];
|
|
133
218
|
}
|
|
134
|
-
declare function ChatSidebar({ title, placeholder, starterPrompts, className, }: ChatSidebarProps): react_jsx_runtime.JSX.Element;
|
|
219
|
+
declare function ChatSidebar({ title, placeholder, starterPrompts, options, className, headerProps, defaultSelectedIds, }: ChatSidebarProps): react_jsx_runtime.JSX.Element;
|
|
135
220
|
|
|
136
221
|
interface ChatFullProps {
|
|
137
222
|
title?: string;
|
|
138
223
|
placeholder?: string;
|
|
139
224
|
starterPrompts?: StarterPrompt[];
|
|
225
|
+
options?: ComposerOptionGroup[];
|
|
140
226
|
className?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Props for customizing the header. If provided, title prop will be passed to header.
|
|
229
|
+
*/
|
|
230
|
+
headerProps?: Omit<ChatHeaderProps, "title">;
|
|
231
|
+
/**
|
|
232
|
+
* Customizable left sidebar content. Typically used for navigation, thread list, etc.
|
|
233
|
+
*/
|
|
234
|
+
leftSidebar?: React__default.ReactNode;
|
|
235
|
+
/**
|
|
236
|
+
* Customizable right sidebar content. Typically used as a canvas, additional info, etc.
|
|
237
|
+
*/
|
|
238
|
+
rightSidebar?: React__default.ReactNode;
|
|
239
|
+
/**
|
|
240
|
+
* Custom className for the left sidebar container
|
|
241
|
+
*/
|
|
242
|
+
leftSidebarClassName?: string;
|
|
243
|
+
/**
|
|
244
|
+
* Custom className for the right sidebar container
|
|
245
|
+
*/
|
|
246
|
+
rightSidebarClassName?: string;
|
|
247
|
+
/**
|
|
248
|
+
* Whether the left sidebar is collapsible
|
|
249
|
+
*/
|
|
250
|
+
leftSidebarCollapsible?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Whether the right sidebar is collapsible
|
|
253
|
+
*/
|
|
254
|
+
rightSidebarCollapsible?: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Default collapsed state for the left sidebar
|
|
257
|
+
*/
|
|
258
|
+
defaultLeftSidebarCollapsed?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Default collapsed state for the right sidebar
|
|
261
|
+
*/
|
|
262
|
+
defaultRightSidebarCollapsed?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Controlled collapsed state for the left sidebar. If provided, component becomes controlled.
|
|
265
|
+
*/
|
|
266
|
+
leftSidebarCollapsed?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Controlled collapsed state for the right sidebar. If provided, component becomes controlled.
|
|
269
|
+
*/
|
|
270
|
+
rightSidebarCollapsed?: boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Callback when left sidebar collapse state changes
|
|
273
|
+
*/
|
|
274
|
+
onLeftSidebarCollapseChange?: (collapsed: boolean) => void;
|
|
275
|
+
/**
|
|
276
|
+
* Callback when right sidebar collapse state changes
|
|
277
|
+
*/
|
|
278
|
+
onRightSidebarCollapseChange?: (collapsed: boolean) => void;
|
|
279
|
+
/**
|
|
280
|
+
* Whether the composer should be auto focused
|
|
281
|
+
*/
|
|
282
|
+
autoFocus?: boolean;
|
|
283
|
+
/**
|
|
284
|
+
* IDs of options to be selected by default
|
|
285
|
+
*/
|
|
286
|
+
defaultSelectedIds?: string[];
|
|
141
287
|
}
|
|
142
|
-
declare function ChatFull({ title, placeholder, starterPrompts, className, }: ChatFullProps): react_jsx_runtime.JSX.Element;
|
|
288
|
+
declare function ChatFull({ title, placeholder, starterPrompts, options, className, headerProps, leftSidebar, rightSidebar, leftSidebarClassName, rightSidebarClassName, leftSidebarCollapsible, rightSidebarCollapsible, defaultLeftSidebarCollapsed, defaultRightSidebarCollapsed, leftSidebarCollapsed: controlledLeftCollapsed, rightSidebarCollapsed: controlledRightCollapsed, onLeftSidebarCollapseChange, onRightSidebarCollapseChange, autoFocus, defaultSelectedIds, }: ChatFullProps): react_jsx_runtime.JSX.Element;
|
|
143
289
|
|
|
144
290
|
interface ThreadListProps {
|
|
145
291
|
className?: string;
|
|
@@ -148,6 +294,25 @@ interface ThreadListProps {
|
|
|
148
294
|
}
|
|
149
295
|
declare const ThreadList: React$1.FC<ThreadListProps>;
|
|
150
296
|
|
|
297
|
+
interface ThreadPopoverProps {
|
|
298
|
+
className?: string;
|
|
299
|
+
buttonClassName?: string;
|
|
300
|
+
buttonVariant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link";
|
|
301
|
+
buttonSize?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg";
|
|
302
|
+
emptyState?: React$1.ReactNode;
|
|
303
|
+
onThreadSelect?: (threadId: string) => void;
|
|
304
|
+
}
|
|
305
|
+
declare const ThreadPopover: React$1.FC<ThreadPopoverProps>;
|
|
306
|
+
|
|
307
|
+
interface CreateThreadButtonProps {
|
|
308
|
+
className?: string;
|
|
309
|
+
variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link";
|
|
310
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg";
|
|
311
|
+
children?: React$1.ReactNode;
|
|
312
|
+
onThreadCreated?: (threadId: string) => void;
|
|
313
|
+
}
|
|
314
|
+
declare const CreateThreadButton: React$1.FC<CreateThreadButtonProps>;
|
|
315
|
+
|
|
151
316
|
interface AccountDialogProps {
|
|
152
317
|
className?: string;
|
|
153
318
|
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
@@ -155,6 +320,8 @@ interface AccountDialogProps {
|
|
|
155
320
|
}
|
|
156
321
|
declare const AccountDialog: React$1.FC<AccountDialogProps>;
|
|
157
322
|
|
|
323
|
+
declare function ThemeToggle(): react_jsx_runtime.JSX.Element;
|
|
324
|
+
|
|
158
325
|
interface UIRendererProps {
|
|
159
326
|
node: UINode;
|
|
160
327
|
}
|
|
@@ -165,4 +332,6 @@ interface UIRendererProps {
|
|
|
165
332
|
*/
|
|
166
333
|
declare function UIRenderer({ node }: UIRendererProps): react_jsx_runtime.JSX.Element;
|
|
167
334
|
|
|
168
|
-
|
|
335
|
+
declare function groupEventsToMessages(events: Event[]): Message[];
|
|
336
|
+
|
|
337
|
+
export { AccountDialog, type AccountDialogProps, AuthContext, type AuthContextValue, AuthProvider, type AuthProviderProps, type AuthService, ChatFull, type ChatFullProps, ChatHeader, type ChatHeaderProps, ChatPopup, type ChatPopupProps, ChatSidebar, type ChatSidebarProps, Composer, type ComposerOption, type ComposerOptionGroup, CreateThreadButton, type CreateThreadButtonProps, MelonyClientProvider, type MelonyClientProviderProps, MelonyContext, type MelonyContextValue, type Message, type StarterPrompt, ThemeProvider, ThemeToggle, Thread, ThreadContext, type ThreadContextValue, type ThreadData, ThreadList, type ThreadListProps, ThreadPopover, type ThreadPopoverProps, ThreadProvider, type ThreadProviderProps, type ThreadService, UIRenderer, type UIRendererProps, type UseMelonyOptions, type User, groupEventsToMessages, useAuth, useMelony, useTheme, useThreads };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { ReactNode } from 'react';
|
|
3
|
-
import { ClientState, MelonyClient } from '
|
|
4
|
-
import { Role, Event, UINode } from '
|
|
3
|
+
import { ClientState, MelonyClient } from 'melony/client';
|
|
4
|
+
import { Role, Event, UINode } from 'melony';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
interface User {
|
|
8
|
-
id
|
|
8
|
+
id?: string;
|
|
9
|
+
uid: string;
|
|
9
10
|
email: string;
|
|
10
|
-
name
|
|
11
|
+
name?: string;
|
|
12
|
+
displayName?: string;
|
|
11
13
|
picture?: string;
|
|
14
|
+
createdAt?: string;
|
|
15
|
+
lastSignIn?: string | null;
|
|
16
|
+
emailVerified?: boolean;
|
|
12
17
|
}
|
|
13
18
|
interface Message {
|
|
14
19
|
role: Role;
|
|
@@ -26,6 +31,17 @@ interface StarterPrompt {
|
|
|
26
31
|
prompt: string;
|
|
27
32
|
icon?: React.ReactNode;
|
|
28
33
|
}
|
|
34
|
+
interface ComposerOption {
|
|
35
|
+
id: string;
|
|
36
|
+
label: string;
|
|
37
|
+
value: any;
|
|
38
|
+
}
|
|
39
|
+
interface ComposerOptionGroup {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
options: ComposerOption[];
|
|
43
|
+
type?: "single" | "multiple";
|
|
44
|
+
}
|
|
29
45
|
interface AuthService {
|
|
30
46
|
getMe: () => Promise<User | null>;
|
|
31
47
|
login: () => void;
|
|
@@ -91,6 +107,17 @@ interface ThreadProviderProps {
|
|
|
91
107
|
}
|
|
92
108
|
declare const ThreadProvider: React__default.FC<ThreadProviderProps>;
|
|
93
109
|
|
|
110
|
+
type Theme = "light" | "dark" | "system";
|
|
111
|
+
interface ThemeContextType {
|
|
112
|
+
theme: Theme;
|
|
113
|
+
setTheme: (theme: Theme) => void;
|
|
114
|
+
resolvedTheme: "light" | "dark";
|
|
115
|
+
}
|
|
116
|
+
declare function ThemeProvider({ children }: {
|
|
117
|
+
children: React.ReactNode;
|
|
118
|
+
}): react_jsx_runtime.JSX.Element;
|
|
119
|
+
declare function useTheme(): ThemeContextType;
|
|
120
|
+
|
|
94
121
|
interface UseMelonyOptions {
|
|
95
122
|
initialEvents?: Event[];
|
|
96
123
|
}
|
|
@@ -100,46 +127,165 @@ declare const useAuth: () => AuthContextValue;
|
|
|
100
127
|
|
|
101
128
|
declare const useThreads: () => ThreadContextValue;
|
|
102
129
|
|
|
103
|
-
|
|
130
|
+
interface ThreadProps {
|
|
104
131
|
className?: string;
|
|
105
132
|
placeholder?: string;
|
|
106
133
|
starterPrompts?: StarterPrompt[];
|
|
107
134
|
onStarterPromptClick?: (prompt: string) => void;
|
|
108
|
-
|
|
135
|
+
options?: ComposerOptionGroup[];
|
|
136
|
+
autoFocus?: boolean;
|
|
137
|
+
defaultSelectedIds?: string[];
|
|
138
|
+
}
|
|
139
|
+
declare function Thread({ className, placeholder, starterPrompts, onStarterPromptClick, options, autoFocus, defaultSelectedIds, }: ThreadProps): react_jsx_runtime.JSX.Element;
|
|
109
140
|
|
|
110
141
|
interface ComposerProps {
|
|
111
142
|
value: string;
|
|
112
143
|
onChange: (value: string) => void;
|
|
113
|
-
onSubmit: (
|
|
144
|
+
onSubmit: (state?: Record<string, any>) => void;
|
|
114
145
|
placeholder?: string;
|
|
115
146
|
isLoading?: boolean;
|
|
116
147
|
className?: string;
|
|
148
|
+
options?: ComposerOptionGroup[];
|
|
149
|
+
autoFocus?: boolean;
|
|
150
|
+
defaultSelectedIds?: string[];
|
|
117
151
|
}
|
|
118
|
-
declare function Composer({ value, onChange, onSubmit, placeholder, isLoading, className, }: ComposerProps): react_jsx_runtime.JSX.Element;
|
|
152
|
+
declare function Composer({ value, onChange, onSubmit, placeholder, isLoading, className, options, autoFocus, defaultSelectedIds, }: ComposerProps): react_jsx_runtime.JSX.Element;
|
|
153
|
+
|
|
154
|
+
interface ChatHeaderProps {
|
|
155
|
+
/**
|
|
156
|
+
* The title to display in the header. Can be a string or a React node for custom content.
|
|
157
|
+
*/
|
|
158
|
+
title?: string | React__default.ReactNode;
|
|
159
|
+
/**
|
|
160
|
+
* Content to render on the left side of the header (e.g., back button).
|
|
161
|
+
*/
|
|
162
|
+
leftContent?: React__default.ReactNode;
|
|
163
|
+
/**
|
|
164
|
+
* Content to render on the right side of the header (e.g., action buttons).
|
|
165
|
+
*/
|
|
166
|
+
rightContent?: React__default.ReactNode;
|
|
167
|
+
/**
|
|
168
|
+
* Custom className for the header container.
|
|
169
|
+
*/
|
|
170
|
+
className?: string;
|
|
171
|
+
/**
|
|
172
|
+
* Custom className for the title element (only applies when title is a string).
|
|
173
|
+
*/
|
|
174
|
+
titleClassName?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Custom children to render inside the header. If provided, this takes precedence over title/leftContent/rightContent.
|
|
177
|
+
*/
|
|
178
|
+
children?: React__default.ReactNode;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* A shared, customizable header component for chat interfaces.
|
|
182
|
+
* Used consistently across ChatFull, ChatSidebar, and ChatPopup components.
|
|
183
|
+
*/
|
|
184
|
+
declare function ChatHeader({ title, leftContent, rightContent, className, titleClassName, children, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
|
|
119
185
|
|
|
120
186
|
interface ChatPopupProps {
|
|
121
187
|
title?: string;
|
|
122
188
|
placeholder?: string;
|
|
123
189
|
starterPrompts?: StarterPrompt[];
|
|
190
|
+
options?: ComposerOptionGroup[];
|
|
124
191
|
defaultOpen?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Props for customizing the header. Note: leftContent and rightContent in headerProps
|
|
194
|
+
* will be merged with the default popup header actions (back, history, new chat, close).
|
|
195
|
+
*/
|
|
196
|
+
headerProps?: Omit<ChatHeaderProps, "title" | "leftContent" | "rightContent">;
|
|
197
|
+
/**
|
|
198
|
+
* IDs of options to be selected by default
|
|
199
|
+
*/
|
|
200
|
+
defaultSelectedIds?: string[];
|
|
125
201
|
}
|
|
126
|
-
declare function ChatPopup({ title, placeholder, starterPrompts, defaultOpen, }: ChatPopupProps): react_jsx_runtime.JSX.Element;
|
|
202
|
+
declare function ChatPopup({ title, placeholder, starterPrompts, options, defaultOpen, headerProps, defaultSelectedIds, }: ChatPopupProps): react_jsx_runtime.JSX.Element;
|
|
127
203
|
|
|
128
204
|
interface ChatSidebarProps {
|
|
129
205
|
title?: string;
|
|
130
206
|
placeholder?: string;
|
|
131
207
|
starterPrompts?: StarterPrompt[];
|
|
208
|
+
options?: ComposerOptionGroup[];
|
|
132
209
|
className?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Props for customizing the header. If provided, title prop will be passed to header.
|
|
212
|
+
*/
|
|
213
|
+
headerProps?: Omit<ChatHeaderProps, "title">;
|
|
214
|
+
/**
|
|
215
|
+
* IDs of options to be selected by default
|
|
216
|
+
*/
|
|
217
|
+
defaultSelectedIds?: string[];
|
|
133
218
|
}
|
|
134
|
-
declare function ChatSidebar({ title, placeholder, starterPrompts, className, }: ChatSidebarProps): react_jsx_runtime.JSX.Element;
|
|
219
|
+
declare function ChatSidebar({ title, placeholder, starterPrompts, options, className, headerProps, defaultSelectedIds, }: ChatSidebarProps): react_jsx_runtime.JSX.Element;
|
|
135
220
|
|
|
136
221
|
interface ChatFullProps {
|
|
137
222
|
title?: string;
|
|
138
223
|
placeholder?: string;
|
|
139
224
|
starterPrompts?: StarterPrompt[];
|
|
225
|
+
options?: ComposerOptionGroup[];
|
|
140
226
|
className?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Props for customizing the header. If provided, title prop will be passed to header.
|
|
229
|
+
*/
|
|
230
|
+
headerProps?: Omit<ChatHeaderProps, "title">;
|
|
231
|
+
/**
|
|
232
|
+
* Customizable left sidebar content. Typically used for navigation, thread list, etc.
|
|
233
|
+
*/
|
|
234
|
+
leftSidebar?: React__default.ReactNode;
|
|
235
|
+
/**
|
|
236
|
+
* Customizable right sidebar content. Typically used as a canvas, additional info, etc.
|
|
237
|
+
*/
|
|
238
|
+
rightSidebar?: React__default.ReactNode;
|
|
239
|
+
/**
|
|
240
|
+
* Custom className for the left sidebar container
|
|
241
|
+
*/
|
|
242
|
+
leftSidebarClassName?: string;
|
|
243
|
+
/**
|
|
244
|
+
* Custom className for the right sidebar container
|
|
245
|
+
*/
|
|
246
|
+
rightSidebarClassName?: string;
|
|
247
|
+
/**
|
|
248
|
+
* Whether the left sidebar is collapsible
|
|
249
|
+
*/
|
|
250
|
+
leftSidebarCollapsible?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Whether the right sidebar is collapsible
|
|
253
|
+
*/
|
|
254
|
+
rightSidebarCollapsible?: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Default collapsed state for the left sidebar
|
|
257
|
+
*/
|
|
258
|
+
defaultLeftSidebarCollapsed?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Default collapsed state for the right sidebar
|
|
261
|
+
*/
|
|
262
|
+
defaultRightSidebarCollapsed?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Controlled collapsed state for the left sidebar. If provided, component becomes controlled.
|
|
265
|
+
*/
|
|
266
|
+
leftSidebarCollapsed?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Controlled collapsed state for the right sidebar. If provided, component becomes controlled.
|
|
269
|
+
*/
|
|
270
|
+
rightSidebarCollapsed?: boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Callback when left sidebar collapse state changes
|
|
273
|
+
*/
|
|
274
|
+
onLeftSidebarCollapseChange?: (collapsed: boolean) => void;
|
|
275
|
+
/**
|
|
276
|
+
* Callback when right sidebar collapse state changes
|
|
277
|
+
*/
|
|
278
|
+
onRightSidebarCollapseChange?: (collapsed: boolean) => void;
|
|
279
|
+
/**
|
|
280
|
+
* Whether the composer should be auto focused
|
|
281
|
+
*/
|
|
282
|
+
autoFocus?: boolean;
|
|
283
|
+
/**
|
|
284
|
+
* IDs of options to be selected by default
|
|
285
|
+
*/
|
|
286
|
+
defaultSelectedIds?: string[];
|
|
141
287
|
}
|
|
142
|
-
declare function ChatFull({ title, placeholder, starterPrompts, className, }: ChatFullProps): react_jsx_runtime.JSX.Element;
|
|
288
|
+
declare function ChatFull({ title, placeholder, starterPrompts, options, className, headerProps, leftSidebar, rightSidebar, leftSidebarClassName, rightSidebarClassName, leftSidebarCollapsible, rightSidebarCollapsible, defaultLeftSidebarCollapsed, defaultRightSidebarCollapsed, leftSidebarCollapsed: controlledLeftCollapsed, rightSidebarCollapsed: controlledRightCollapsed, onLeftSidebarCollapseChange, onRightSidebarCollapseChange, autoFocus, defaultSelectedIds, }: ChatFullProps): react_jsx_runtime.JSX.Element;
|
|
143
289
|
|
|
144
290
|
interface ThreadListProps {
|
|
145
291
|
className?: string;
|
|
@@ -148,6 +294,25 @@ interface ThreadListProps {
|
|
|
148
294
|
}
|
|
149
295
|
declare const ThreadList: React$1.FC<ThreadListProps>;
|
|
150
296
|
|
|
297
|
+
interface ThreadPopoverProps {
|
|
298
|
+
className?: string;
|
|
299
|
+
buttonClassName?: string;
|
|
300
|
+
buttonVariant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link";
|
|
301
|
+
buttonSize?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg";
|
|
302
|
+
emptyState?: React$1.ReactNode;
|
|
303
|
+
onThreadSelect?: (threadId: string) => void;
|
|
304
|
+
}
|
|
305
|
+
declare const ThreadPopover: React$1.FC<ThreadPopoverProps>;
|
|
306
|
+
|
|
307
|
+
interface CreateThreadButtonProps {
|
|
308
|
+
className?: string;
|
|
309
|
+
variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link";
|
|
310
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg";
|
|
311
|
+
children?: React$1.ReactNode;
|
|
312
|
+
onThreadCreated?: (threadId: string) => void;
|
|
313
|
+
}
|
|
314
|
+
declare const CreateThreadButton: React$1.FC<CreateThreadButtonProps>;
|
|
315
|
+
|
|
151
316
|
interface AccountDialogProps {
|
|
152
317
|
className?: string;
|
|
153
318
|
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
@@ -155,6 +320,8 @@ interface AccountDialogProps {
|
|
|
155
320
|
}
|
|
156
321
|
declare const AccountDialog: React$1.FC<AccountDialogProps>;
|
|
157
322
|
|
|
323
|
+
declare function ThemeToggle(): react_jsx_runtime.JSX.Element;
|
|
324
|
+
|
|
158
325
|
interface UIRendererProps {
|
|
159
326
|
node: UINode;
|
|
160
327
|
}
|
|
@@ -165,4 +332,6 @@ interface UIRendererProps {
|
|
|
165
332
|
*/
|
|
166
333
|
declare function UIRenderer({ node }: UIRendererProps): react_jsx_runtime.JSX.Element;
|
|
167
334
|
|
|
168
|
-
|
|
335
|
+
declare function groupEventsToMessages(events: Event[]): Message[];
|
|
336
|
+
|
|
337
|
+
export { AccountDialog, type AccountDialogProps, AuthContext, type AuthContextValue, AuthProvider, type AuthProviderProps, type AuthService, ChatFull, type ChatFullProps, ChatHeader, type ChatHeaderProps, ChatPopup, type ChatPopupProps, ChatSidebar, type ChatSidebarProps, Composer, type ComposerOption, type ComposerOptionGroup, CreateThreadButton, type CreateThreadButtonProps, MelonyClientProvider, type MelonyClientProviderProps, MelonyContext, type MelonyContextValue, type Message, type StarterPrompt, ThemeProvider, ThemeToggle, Thread, ThreadContext, type ThreadContextValue, type ThreadData, ThreadList, type ThreadListProps, ThreadPopover, type ThreadPopoverProps, ThreadProvider, type ThreadProviderProps, type ThreadService, UIRenderer, type UIRendererProps, type UseMelonyOptions, type User, groupEventsToMessages, useAuth, useMelony, useTheme, useThreads };
|