@banbox/chat 1.0.4 → 1.0.6
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.cjs +276 -413
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -13
- package/dist/index.d.ts +19 -13
- package/dist/index.js +276 -413
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
- package/src/chat/ChatRoot.tsx +15 -10
- package/src/chat/InboxPopup.tsx +105 -176
- package/src/chat/SinglePopup.tsx +39 -43
- package/src/index.ts +7 -0
- package/src/styles/index.css +231 -0
- package/src/types/css.d.ts +5 -0
- package/src/ui/chat/ChatHeader.tsx +3 -14
- package/src/ui/chat/ChatListHeader.tsx +74 -103
- package/src/ui/chat/ChatScroll.tsx +5 -24
- package/src/ui/chat/TypingIndicator.tsx +8 -38
package/dist/index.d.cts
CHANGED
|
@@ -290,26 +290,34 @@ interface ChatUICallbacks {
|
|
|
290
290
|
renderKebabMenu?: (opts: KebabMenuOpts) => React__default.ReactNode;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
type ChatTheme = "marketplace" | "admin" | {
|
|
294
|
+
primary?: string;
|
|
295
|
+
primaryActive?: string;
|
|
296
|
+
surfaceLow?: string;
|
|
297
|
+
};
|
|
298
|
+
|
|
293
299
|
type ChatRootProps = {
|
|
294
300
|
/**
|
|
295
301
|
* The unified data adapter — provides all threads, messages, and send logic.
|
|
296
|
-
*
|
|
297
|
-
* Implement this in your host app:
|
|
298
|
-
* ```ts
|
|
299
|
-
* const adapter = createDemoChatAdapter(); // or createApiChatAdapter(...)
|
|
300
|
-
* ```
|
|
301
302
|
*/
|
|
302
303
|
adapter: ChatAdapter;
|
|
303
304
|
/**
|
|
304
305
|
* Optional UI callbacks — controls toast notifications, navigation,
|
|
305
306
|
* and the kebab (⋮) menu renderer.
|
|
306
|
-
*
|
|
307
|
-
* These delegate UI side-effects back to the host app so the package
|
|
308
|
-
* stays decoupled from the host's routing and notification systems.
|
|
309
307
|
*/
|
|
310
308
|
uiCallbacks?: ChatUICallbacks;
|
|
309
|
+
/**
|
|
310
|
+
* Visual theme:
|
|
311
|
+
* - "marketplace" (default) — orange primary (#ff5300)
|
|
312
|
+
* - "admin" — black primary (#1a1a1a)
|
|
313
|
+
* - custom object — { primary, primaryActive, surfaceLow }
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* <ChatRoot adapter={adapter} theme="admin" />
|
|
317
|
+
*/
|
|
318
|
+
theme?: ChatTheme;
|
|
311
319
|
};
|
|
312
|
-
declare function ChatRoot({ adapter, uiCallbacks }: ChatRootProps): React$1.ReactPortal | null;
|
|
320
|
+
declare function ChatRoot({ adapter, uiCallbacks, theme }: ChatRootProps): React$1.ReactPortal | null;
|
|
313
321
|
|
|
314
322
|
declare function ChatUIProvider({ children }: {
|
|
315
323
|
children: React__default.ReactNode;
|
|
@@ -401,7 +409,7 @@ type Props$7 = {
|
|
|
401
409
|
below?: React__default.ReactNode;
|
|
402
410
|
className?: string;
|
|
403
411
|
};
|
|
404
|
-
declare function ChatHeader({ left, right, below }: Props$7): React__default.JSX.Element;
|
|
412
|
+
declare function ChatHeader({ left, right, below, className }: Props$7): React__default.JSX.Element;
|
|
405
413
|
|
|
406
414
|
type SubtitleVariant = "live" | "muted";
|
|
407
415
|
type BaseProps = {
|
|
@@ -471,9 +479,7 @@ type Props$6 = {
|
|
|
471
479
|
children: React__default.ReactNode;
|
|
472
480
|
className?: string;
|
|
473
481
|
style?: React__default.CSSProperties;
|
|
474
|
-
/** set true if you want short threads anchored at the bottom */
|
|
475
482
|
bottomAlignWhenShort?: boolean;
|
|
476
|
-
/** when this value changes, we auto-scroll to the bottom */
|
|
477
483
|
scrollKey?: string | number;
|
|
478
484
|
};
|
|
479
485
|
declare const ChatScroll: React__default.FC<Props$6>;
|
|
@@ -555,4 +561,4 @@ interface PortalProps {
|
|
|
555
561
|
}
|
|
556
562
|
declare function Portal({ children, containerId }: PortalProps): React$1.ReactPortal | null;
|
|
557
563
|
|
|
558
|
-
export { type AddressCard$1 as AddressCard, type BusinessCard$1 as BusinessCard, type ChatAdapter, ChatFooter, ChatHeader, ChatIdentity, ChatInquiryBar, ChatListHeader, ChatMessageItem, ChatRoot, type ChatRootProps, ChatScroll, ChatSpinner, ChatThreadItem, type ChatThreadStatus, type ChatUICallbacks, ChatUIContext, ChatUIProvider, type ChatUIState, type ChatVariant, type KebabMenuOpts, type Message, type MessageAudio, type MessageFile, type MessageRef$1 as MessageRef, Portal, type Reference, ReplyCard, type SendPayload, type Thread, type ThreadStatus, type ToastOpts, TypingIndicator, cn, useChatUI };
|
|
564
|
+
export { type AddressCard$1 as AddressCard, type BusinessCard$1 as BusinessCard, type ChatAdapter, ChatFooter, ChatHeader, ChatIdentity, ChatInquiryBar, ChatListHeader, ChatMessageItem, ChatRoot, type ChatRootProps, ChatScroll, ChatSpinner, type ChatTheme, ChatThreadItem, type ChatThreadStatus, type ChatUICallbacks, ChatUIContext, ChatUIProvider, type ChatUIState, type ChatVariant, type KebabMenuOpts, type Message, type MessageAudio, type MessageFile, type MessageRef$1 as MessageRef, Portal, type Reference, ReplyCard, type SendPayload, type Thread, type ThreadStatus, type ToastOpts, TypingIndicator, cn, useChatUI };
|
package/dist/index.d.ts
CHANGED
|
@@ -290,26 +290,34 @@ interface ChatUICallbacks {
|
|
|
290
290
|
renderKebabMenu?: (opts: KebabMenuOpts) => React__default.ReactNode;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
type ChatTheme = "marketplace" | "admin" | {
|
|
294
|
+
primary?: string;
|
|
295
|
+
primaryActive?: string;
|
|
296
|
+
surfaceLow?: string;
|
|
297
|
+
};
|
|
298
|
+
|
|
293
299
|
type ChatRootProps = {
|
|
294
300
|
/**
|
|
295
301
|
* The unified data adapter — provides all threads, messages, and send logic.
|
|
296
|
-
*
|
|
297
|
-
* Implement this in your host app:
|
|
298
|
-
* ```ts
|
|
299
|
-
* const adapter = createDemoChatAdapter(); // or createApiChatAdapter(...)
|
|
300
|
-
* ```
|
|
301
302
|
*/
|
|
302
303
|
adapter: ChatAdapter;
|
|
303
304
|
/**
|
|
304
305
|
* Optional UI callbacks — controls toast notifications, navigation,
|
|
305
306
|
* and the kebab (⋮) menu renderer.
|
|
306
|
-
*
|
|
307
|
-
* These delegate UI side-effects back to the host app so the package
|
|
308
|
-
* stays decoupled from the host's routing and notification systems.
|
|
309
307
|
*/
|
|
310
308
|
uiCallbacks?: ChatUICallbacks;
|
|
309
|
+
/**
|
|
310
|
+
* Visual theme:
|
|
311
|
+
* - "marketplace" (default) — orange primary (#ff5300)
|
|
312
|
+
* - "admin" — black primary (#1a1a1a)
|
|
313
|
+
* - custom object — { primary, primaryActive, surfaceLow }
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* <ChatRoot adapter={adapter} theme="admin" />
|
|
317
|
+
*/
|
|
318
|
+
theme?: ChatTheme;
|
|
311
319
|
};
|
|
312
|
-
declare function ChatRoot({ adapter, uiCallbacks }: ChatRootProps): React$1.ReactPortal | null;
|
|
320
|
+
declare function ChatRoot({ adapter, uiCallbacks, theme }: ChatRootProps): React$1.ReactPortal | null;
|
|
313
321
|
|
|
314
322
|
declare function ChatUIProvider({ children }: {
|
|
315
323
|
children: React__default.ReactNode;
|
|
@@ -401,7 +409,7 @@ type Props$7 = {
|
|
|
401
409
|
below?: React__default.ReactNode;
|
|
402
410
|
className?: string;
|
|
403
411
|
};
|
|
404
|
-
declare function ChatHeader({ left, right, below }: Props$7): React__default.JSX.Element;
|
|
412
|
+
declare function ChatHeader({ left, right, below, className }: Props$7): React__default.JSX.Element;
|
|
405
413
|
|
|
406
414
|
type SubtitleVariant = "live" | "muted";
|
|
407
415
|
type BaseProps = {
|
|
@@ -471,9 +479,7 @@ type Props$6 = {
|
|
|
471
479
|
children: React__default.ReactNode;
|
|
472
480
|
className?: string;
|
|
473
481
|
style?: React__default.CSSProperties;
|
|
474
|
-
/** set true if you want short threads anchored at the bottom */
|
|
475
482
|
bottomAlignWhenShort?: boolean;
|
|
476
|
-
/** when this value changes, we auto-scroll to the bottom */
|
|
477
483
|
scrollKey?: string | number;
|
|
478
484
|
};
|
|
479
485
|
declare const ChatScroll: React__default.FC<Props$6>;
|
|
@@ -555,4 +561,4 @@ interface PortalProps {
|
|
|
555
561
|
}
|
|
556
562
|
declare function Portal({ children, containerId }: PortalProps): React$1.ReactPortal | null;
|
|
557
563
|
|
|
558
|
-
export { type AddressCard$1 as AddressCard, type BusinessCard$1 as BusinessCard, type ChatAdapter, ChatFooter, ChatHeader, ChatIdentity, ChatInquiryBar, ChatListHeader, ChatMessageItem, ChatRoot, type ChatRootProps, ChatScroll, ChatSpinner, ChatThreadItem, type ChatThreadStatus, type ChatUICallbacks, ChatUIContext, ChatUIProvider, type ChatUIState, type ChatVariant, type KebabMenuOpts, type Message, type MessageAudio, type MessageFile, type MessageRef$1 as MessageRef, Portal, type Reference, ReplyCard, type SendPayload, type Thread, type ThreadStatus, type ToastOpts, TypingIndicator, cn, useChatUI };
|
|
564
|
+
export { type AddressCard$1 as AddressCard, type BusinessCard$1 as BusinessCard, type ChatAdapter, ChatFooter, ChatHeader, ChatIdentity, ChatInquiryBar, ChatListHeader, ChatMessageItem, ChatRoot, type ChatRootProps, ChatScroll, ChatSpinner, type ChatTheme, ChatThreadItem, type ChatThreadStatus, type ChatUICallbacks, ChatUIContext, ChatUIProvider, type ChatUIState, type ChatVariant, type KebabMenuOpts, type Message, type MessageAudio, type MessageFile, type MessageRef$1 as MessageRef, Portal, type Reference, ReplyCard, type SendPayload, type Thread, type ThreadStatus, type ToastOpts, TypingIndicator, cn, useChatUI };
|