@melony/react 0.1.26 → 0.1.27

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/dist/index.d.cts CHANGED
@@ -76,6 +76,22 @@ interface MelonyClientProviderProps {
76
76
  }
77
77
  declare const MelonyClientProvider: React__default.FC<MelonyClientProviderProps>;
78
78
 
79
+ interface WelcomeScreenProps {
80
+ title?: string;
81
+ description?: string;
82
+ features?: {
83
+ title: string;
84
+ description: string;
85
+ }[];
86
+ className?: string;
87
+ onLoginClick?: () => void;
88
+ termsUrl?: string;
89
+ privacyUrl?: string;
90
+ imageUrl?: string;
91
+ imageAlt?: string;
92
+ }
93
+ declare function WelcomeScreen({ title, description, features, className, onLoginClick, termsUrl, privacyUrl, imageUrl, imageAlt, }: WelcomeScreenProps): react_jsx_runtime.JSX.Element;
94
+
79
95
  interface AuthContextValue {
80
96
  user: User | null;
81
97
  isAuthenticated: boolean;
@@ -88,6 +104,7 @@ declare const AuthContext: React__default.Context<AuthContextValue | undefined>;
88
104
  interface AuthProviderProps {
89
105
  children: ReactNode;
90
106
  service: AuthService;
107
+ welcomeScreenProps?: WelcomeScreenProps;
91
108
  }
92
109
  declare const AuthProvider: React__default.FC<AuthProviderProps>;
93
110
 
@@ -111,6 +128,23 @@ interface ThreadProviderProps {
111
128
  }
112
129
  declare const ThreadProvider: React__default.FC<ThreadProviderProps>;
113
130
 
131
+ interface SidebarContextValue {
132
+ leftCollapsed: boolean;
133
+ rightCollapsed: boolean;
134
+ setLeftCollapsed: (collapsed: boolean) => void;
135
+ setRightCollapsed: (collapsed: boolean) => void;
136
+ leftCollapsible: boolean;
137
+ rightCollapsible: boolean;
138
+ }
139
+ declare const SidebarContext: React__default.Context<SidebarContextValue | undefined>;
140
+ declare function useSidebar(): SidebarContextValue;
141
+ interface SidebarProviderProps {
142
+ children: React__default.ReactNode;
143
+ defaultLeftCollapsed?: boolean;
144
+ defaultRightCollapsed?: boolean;
145
+ }
146
+ declare function SidebarProvider({ children, defaultLeftCollapsed, defaultRightCollapsed, }: SidebarProviderProps): react_jsx_runtime.JSX.Element;
147
+
114
148
  type Theme = "light" | "dark" | "system";
115
149
  interface ThemeContextType {
116
150
  theme: Theme;
@@ -207,7 +241,7 @@ interface ChatHeaderProps {
207
241
  */
208
242
  declare function ChatHeader({ leftContent, rightContent, className, children, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
209
243
 
210
- interface ChatPopupProps {
244
+ interface PopupChatProps {
211
245
  title?: string;
212
246
  placeholder?: string;
213
247
  starterPrompts?: StarterPrompt[];
@@ -223,42 +257,20 @@ interface ChatPopupProps {
223
257
  */
224
258
  defaultSelectedIds?: string[];
225
259
  }
226
- declare function ChatPopup({ title, placeholder, starterPrompts, options, defaultOpen, headerProps, defaultSelectedIds, }: ChatPopupProps): react_jsx_runtime.JSX.Element;
227
-
228
- interface ChatSidebarProps {
229
- title?: string;
230
- placeholder?: string;
231
- starterPrompts?: StarterPrompt[];
232
- options?: ComposerOptionGroup[];
233
- className?: string;
234
- /**
235
- * Props for customizing the header. If provided, title prop will be passed to header.
236
- */
237
- headerProps?: Omit<ChatHeaderProps, "title">;
238
- /**
239
- * IDs of options to be selected by default
240
- */
241
- defaultSelectedIds?: string[];
242
- }
243
- declare function ChatSidebar({ title, placeholder, starterPrompts, options, className, headerProps, defaultSelectedIds, }: ChatSidebarProps): react_jsx_runtime.JSX.Element;
260
+ declare function PopupChat({ title, placeholder, starterPrompts, options, defaultOpen, headerProps, defaultSelectedIds, }: PopupChatProps): react_jsx_runtime.JSX.Element;
244
261
 
245
- interface WelcomeScreenProps {
246
- title?: string;
247
- description?: string;
248
- features?: {
249
- title: string;
250
- description: string;
251
- }[];
262
+ interface SidebarProps {
263
+ side: "left" | "right";
264
+ children: React__default.ReactNode;
252
265
  className?: string;
253
- onLoginClick?: () => void;
254
- termsUrl?: string;
255
- privacyUrl?: string;
256
- imageUrl?: string;
257
- imageAlt?: string;
258
266
  }
259
- declare function WelcomeScreen({ title, description, features, className, onLoginClick, termsUrl, privacyUrl, imageUrl, imageAlt, }: WelcomeScreenProps): react_jsx_runtime.JSX.Element;
267
+ /**
268
+ * A sidebar component that responds to ChatSidebarContext.
269
+ * Typically used within ChatFull or a layout with ChatSidebarProvider.
270
+ */
271
+ declare function Sidebar({ side, children, className }: SidebarProps): react_jsx_runtime.JSX.Element;
260
272
 
261
- interface ChatFullProps {
273
+ interface FullChatProps {
262
274
  title?: string;
263
275
  placeholder?: string;
264
276
  starterPrompts?: StarterPrompt[];
@@ -268,22 +280,6 @@ interface ChatFullProps {
268
280
  * Props for customizing the header. If provided, title prop will be passed to header.
269
281
  */
270
282
  headerProps?: Omit<ChatHeaderProps, "title">;
271
- /**
272
- * Customizable left sidebar content. Typically used for navigation, thread list, etc.
273
- */
274
- leftSidebar?: React__default.ReactNode;
275
- /**
276
- * Customizable right sidebar content. Typically used as a canvas, additional info, etc.
277
- */
278
- rightSidebar?: React__default.ReactNode;
279
- /**
280
- * Custom className for the left sidebar container
281
- */
282
- leftSidebarClassName?: string;
283
- /**
284
- * Custom className for the right sidebar container
285
- */
286
- rightSidebarClassName?: string;
287
283
  /**
288
284
  * Whether the composer should be auto focused
289
285
  */
@@ -292,17 +288,8 @@ interface ChatFullProps {
292
288
  * IDs of options to be selected by default
293
289
  */
294
290
  defaultSelectedIds?: string[];
295
- /**
296
- * Whether to show a welcome screen when the user is not authenticated.
297
- * Defaults to false.
298
- */
299
- showWelcomeScreen?: boolean;
300
- /**
301
- * Props to customize the welcome screen
302
- */
303
- welcomeScreenProps?: WelcomeScreenProps;
304
291
  }
305
- declare function ChatFull({ title, placeholder, starterPrompts, options, className, headerProps, leftSidebar, rightSidebar, leftSidebarClassName, rightSidebarClassName, autoFocus, defaultSelectedIds, showWelcomeScreen, welcomeScreenProps, }: ChatFullProps): react_jsx_runtime.JSX.Element;
292
+ declare function FullChat({ title, placeholder, starterPrompts, options, className, headerProps, autoFocus, defaultSelectedIds, }: FullChatProps): react_jsx_runtime.JSX.Element;
306
293
 
307
294
  interface SidebarToggleProps {
308
295
  side: "left" | "right";
@@ -310,17 +297,6 @@ interface SidebarToggleProps {
310
297
  }
311
298
  declare function SidebarToggle({ side, className }: SidebarToggleProps): react_jsx_runtime.JSX.Element | null;
312
299
 
313
- interface ChatSidebarContextValue {
314
- leftCollapsed: boolean;
315
- rightCollapsed: boolean;
316
- setLeftCollapsed: (collapsed: boolean) => void;
317
- setRightCollapsed: (collapsed: boolean) => void;
318
- leftCollapsible: boolean;
319
- rightCollapsible: boolean;
320
- }
321
- declare const ChatSidebarContext: React__default.Context<ChatSidebarContextValue | undefined>;
322
- declare function useChatSidebar(): ChatSidebarContextValue;
323
-
324
300
  interface ThreadListProps {
325
301
  className?: string;
326
302
  emptyState?: React$1.ReactNode;
@@ -498,4 +474,4 @@ declare const Badge: React__default.FC<BadgeProps>;
498
474
 
499
475
  declare function groupEventsToMessages(events: Event[]): Message[];
500
476
 
501
- export { AccountDialog, type AccountDialogProps, AuthContext, type AuthContextValue, AuthProvider, type AuthProviderProps, type AuthService, Badge, Box, Button, Card, Chart, ChatFull, type ChatFullProps, ChatHeader, type ChatHeaderProps, ChatPopup, type ChatPopupProps, ChatSidebar, ChatSidebarContext, type ChatSidebarContextValue, type ChatSidebarProps, Checkbox, Col, Composer, type ComposerOption, type ComposerOptionGroup, CreateThreadButton, type CreateThreadButtonProps, Divider, Form, Heading, Image, Input, Label, List, ListItem, MelonyClientProvider, type MelonyClientProviderProps, MelonyContext, type MelonyContextValue, type Message, RadioGroup, Row, type ScreenSize, Select, SidebarToggle, type SidebarToggleProps, Spacer, type StarterPrompt, Text, Textarea, 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, WelcomeScreen, type WelcomeScreenProps, groupEventsToMessages, useAuth, useChatSidebar, useMelony, useScreenSize, useTheme, useThreads };
477
+ export { AccountDialog, type AccountDialogProps, AuthContext, type AuthContextValue, AuthProvider, type AuthProviderProps, type AuthService, Badge, Box, Button, Card, Chart, ChatHeader, type ChatHeaderProps, Checkbox, Col, Composer, type ComposerOption, type ComposerOptionGroup, CreateThreadButton, type CreateThreadButtonProps, Divider, Form, FullChat, type FullChatProps, Heading, Image, Input, Label, List, ListItem, MelonyClientProvider, type MelonyClientProviderProps, MelonyContext, type MelonyContextValue, type Message, PopupChat, type PopupChatProps, RadioGroup, Row, type ScreenSize, Select, Sidebar, SidebarContext, type SidebarContextValue, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarToggle, type SidebarToggleProps, Spacer, type StarterPrompt, Text, Textarea, 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, WelcomeScreen, type WelcomeScreenProps, groupEventsToMessages, useAuth, useMelony, useScreenSize, useSidebar, useTheme, useThreads };
package/dist/index.d.ts CHANGED
@@ -76,6 +76,22 @@ interface MelonyClientProviderProps {
76
76
  }
77
77
  declare const MelonyClientProvider: React__default.FC<MelonyClientProviderProps>;
78
78
 
79
+ interface WelcomeScreenProps {
80
+ title?: string;
81
+ description?: string;
82
+ features?: {
83
+ title: string;
84
+ description: string;
85
+ }[];
86
+ className?: string;
87
+ onLoginClick?: () => void;
88
+ termsUrl?: string;
89
+ privacyUrl?: string;
90
+ imageUrl?: string;
91
+ imageAlt?: string;
92
+ }
93
+ declare function WelcomeScreen({ title, description, features, className, onLoginClick, termsUrl, privacyUrl, imageUrl, imageAlt, }: WelcomeScreenProps): react_jsx_runtime.JSX.Element;
94
+
79
95
  interface AuthContextValue {
80
96
  user: User | null;
81
97
  isAuthenticated: boolean;
@@ -88,6 +104,7 @@ declare const AuthContext: React__default.Context<AuthContextValue | undefined>;
88
104
  interface AuthProviderProps {
89
105
  children: ReactNode;
90
106
  service: AuthService;
107
+ welcomeScreenProps?: WelcomeScreenProps;
91
108
  }
92
109
  declare const AuthProvider: React__default.FC<AuthProviderProps>;
93
110
 
@@ -111,6 +128,23 @@ interface ThreadProviderProps {
111
128
  }
112
129
  declare const ThreadProvider: React__default.FC<ThreadProviderProps>;
113
130
 
131
+ interface SidebarContextValue {
132
+ leftCollapsed: boolean;
133
+ rightCollapsed: boolean;
134
+ setLeftCollapsed: (collapsed: boolean) => void;
135
+ setRightCollapsed: (collapsed: boolean) => void;
136
+ leftCollapsible: boolean;
137
+ rightCollapsible: boolean;
138
+ }
139
+ declare const SidebarContext: React__default.Context<SidebarContextValue | undefined>;
140
+ declare function useSidebar(): SidebarContextValue;
141
+ interface SidebarProviderProps {
142
+ children: React__default.ReactNode;
143
+ defaultLeftCollapsed?: boolean;
144
+ defaultRightCollapsed?: boolean;
145
+ }
146
+ declare function SidebarProvider({ children, defaultLeftCollapsed, defaultRightCollapsed, }: SidebarProviderProps): react_jsx_runtime.JSX.Element;
147
+
114
148
  type Theme = "light" | "dark" | "system";
115
149
  interface ThemeContextType {
116
150
  theme: Theme;
@@ -207,7 +241,7 @@ interface ChatHeaderProps {
207
241
  */
208
242
  declare function ChatHeader({ leftContent, rightContent, className, children, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
209
243
 
210
- interface ChatPopupProps {
244
+ interface PopupChatProps {
211
245
  title?: string;
212
246
  placeholder?: string;
213
247
  starterPrompts?: StarterPrompt[];
@@ -223,42 +257,20 @@ interface ChatPopupProps {
223
257
  */
224
258
  defaultSelectedIds?: string[];
225
259
  }
226
- declare function ChatPopup({ title, placeholder, starterPrompts, options, defaultOpen, headerProps, defaultSelectedIds, }: ChatPopupProps): react_jsx_runtime.JSX.Element;
227
-
228
- interface ChatSidebarProps {
229
- title?: string;
230
- placeholder?: string;
231
- starterPrompts?: StarterPrompt[];
232
- options?: ComposerOptionGroup[];
233
- className?: string;
234
- /**
235
- * Props for customizing the header. If provided, title prop will be passed to header.
236
- */
237
- headerProps?: Omit<ChatHeaderProps, "title">;
238
- /**
239
- * IDs of options to be selected by default
240
- */
241
- defaultSelectedIds?: string[];
242
- }
243
- declare function ChatSidebar({ title, placeholder, starterPrompts, options, className, headerProps, defaultSelectedIds, }: ChatSidebarProps): react_jsx_runtime.JSX.Element;
260
+ declare function PopupChat({ title, placeholder, starterPrompts, options, defaultOpen, headerProps, defaultSelectedIds, }: PopupChatProps): react_jsx_runtime.JSX.Element;
244
261
 
245
- interface WelcomeScreenProps {
246
- title?: string;
247
- description?: string;
248
- features?: {
249
- title: string;
250
- description: string;
251
- }[];
262
+ interface SidebarProps {
263
+ side: "left" | "right";
264
+ children: React__default.ReactNode;
252
265
  className?: string;
253
- onLoginClick?: () => void;
254
- termsUrl?: string;
255
- privacyUrl?: string;
256
- imageUrl?: string;
257
- imageAlt?: string;
258
266
  }
259
- declare function WelcomeScreen({ title, description, features, className, onLoginClick, termsUrl, privacyUrl, imageUrl, imageAlt, }: WelcomeScreenProps): react_jsx_runtime.JSX.Element;
267
+ /**
268
+ * A sidebar component that responds to ChatSidebarContext.
269
+ * Typically used within ChatFull or a layout with ChatSidebarProvider.
270
+ */
271
+ declare function Sidebar({ side, children, className }: SidebarProps): react_jsx_runtime.JSX.Element;
260
272
 
261
- interface ChatFullProps {
273
+ interface FullChatProps {
262
274
  title?: string;
263
275
  placeholder?: string;
264
276
  starterPrompts?: StarterPrompt[];
@@ -268,22 +280,6 @@ interface ChatFullProps {
268
280
  * Props for customizing the header. If provided, title prop will be passed to header.
269
281
  */
270
282
  headerProps?: Omit<ChatHeaderProps, "title">;
271
- /**
272
- * Customizable left sidebar content. Typically used for navigation, thread list, etc.
273
- */
274
- leftSidebar?: React__default.ReactNode;
275
- /**
276
- * Customizable right sidebar content. Typically used as a canvas, additional info, etc.
277
- */
278
- rightSidebar?: React__default.ReactNode;
279
- /**
280
- * Custom className for the left sidebar container
281
- */
282
- leftSidebarClassName?: string;
283
- /**
284
- * Custom className for the right sidebar container
285
- */
286
- rightSidebarClassName?: string;
287
283
  /**
288
284
  * Whether the composer should be auto focused
289
285
  */
@@ -292,17 +288,8 @@ interface ChatFullProps {
292
288
  * IDs of options to be selected by default
293
289
  */
294
290
  defaultSelectedIds?: string[];
295
- /**
296
- * Whether to show a welcome screen when the user is not authenticated.
297
- * Defaults to false.
298
- */
299
- showWelcomeScreen?: boolean;
300
- /**
301
- * Props to customize the welcome screen
302
- */
303
- welcomeScreenProps?: WelcomeScreenProps;
304
291
  }
305
- declare function ChatFull({ title, placeholder, starterPrompts, options, className, headerProps, leftSidebar, rightSidebar, leftSidebarClassName, rightSidebarClassName, autoFocus, defaultSelectedIds, showWelcomeScreen, welcomeScreenProps, }: ChatFullProps): react_jsx_runtime.JSX.Element;
292
+ declare function FullChat({ title, placeholder, starterPrompts, options, className, headerProps, autoFocus, defaultSelectedIds, }: FullChatProps): react_jsx_runtime.JSX.Element;
306
293
 
307
294
  interface SidebarToggleProps {
308
295
  side: "left" | "right";
@@ -310,17 +297,6 @@ interface SidebarToggleProps {
310
297
  }
311
298
  declare function SidebarToggle({ side, className }: SidebarToggleProps): react_jsx_runtime.JSX.Element | null;
312
299
 
313
- interface ChatSidebarContextValue {
314
- leftCollapsed: boolean;
315
- rightCollapsed: boolean;
316
- setLeftCollapsed: (collapsed: boolean) => void;
317
- setRightCollapsed: (collapsed: boolean) => void;
318
- leftCollapsible: boolean;
319
- rightCollapsible: boolean;
320
- }
321
- declare const ChatSidebarContext: React__default.Context<ChatSidebarContextValue | undefined>;
322
- declare function useChatSidebar(): ChatSidebarContextValue;
323
-
324
300
  interface ThreadListProps {
325
301
  className?: string;
326
302
  emptyState?: React$1.ReactNode;
@@ -498,4 +474,4 @@ declare const Badge: React__default.FC<BadgeProps>;
498
474
 
499
475
  declare function groupEventsToMessages(events: Event[]): Message[];
500
476
 
501
- export { AccountDialog, type AccountDialogProps, AuthContext, type AuthContextValue, AuthProvider, type AuthProviderProps, type AuthService, Badge, Box, Button, Card, Chart, ChatFull, type ChatFullProps, ChatHeader, type ChatHeaderProps, ChatPopup, type ChatPopupProps, ChatSidebar, ChatSidebarContext, type ChatSidebarContextValue, type ChatSidebarProps, Checkbox, Col, Composer, type ComposerOption, type ComposerOptionGroup, CreateThreadButton, type CreateThreadButtonProps, Divider, Form, Heading, Image, Input, Label, List, ListItem, MelonyClientProvider, type MelonyClientProviderProps, MelonyContext, type MelonyContextValue, type Message, RadioGroup, Row, type ScreenSize, Select, SidebarToggle, type SidebarToggleProps, Spacer, type StarterPrompt, Text, Textarea, 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, WelcomeScreen, type WelcomeScreenProps, groupEventsToMessages, useAuth, useChatSidebar, useMelony, useScreenSize, useTheme, useThreads };
477
+ export { AccountDialog, type AccountDialogProps, AuthContext, type AuthContextValue, AuthProvider, type AuthProviderProps, type AuthService, Badge, Box, Button, Card, Chart, ChatHeader, type ChatHeaderProps, Checkbox, Col, Composer, type ComposerOption, type ComposerOptionGroup, CreateThreadButton, type CreateThreadButtonProps, Divider, Form, FullChat, type FullChatProps, Heading, Image, Input, Label, List, ListItem, MelonyClientProvider, type MelonyClientProviderProps, MelonyContext, type MelonyContextValue, type Message, PopupChat, type PopupChatProps, RadioGroup, Row, type ScreenSize, Select, Sidebar, SidebarContext, type SidebarContextValue, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarToggle, type SidebarToggleProps, Spacer, type StarterPrompt, Text, Textarea, 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, WelcomeScreen, type WelcomeScreenProps, groupEventsToMessages, useAuth, useMelony, useScreenSize, useSidebar, useTheme, useThreads };