@banbox/chat 1.0.3 → 1.0.5
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 +214 -192
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2273 -0
- package/dist/index.d.cts +20 -14
- package/dist/index.d.ts +20 -14
- package/dist/index.js +212 -190
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
- package/src/chat/ChatRoot.tsx +15 -10
- package/src/chat/InboxPopup.tsx +97 -75
- package/src/chat/SinglePopup.tsx +40 -29
- package/src/index.ts +3 -0
- package/src/styles/index.css +231 -0
- package/src/ui/chat/ChatHeader.tsx +21 -24
- package/src/ui/chat/ChatListHeader.tsx +128 -156
- package/src/ui/chat/ChatScroll.tsx +52 -64
- package/src/ui/chat/TypingIndicator.tsx +10 -21
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;
|
|
@@ -470,9 +478,8 @@ type Props$6 = {
|
|
|
470
478
|
top?: React__default.ReactNode;
|
|
471
479
|
children: React__default.ReactNode;
|
|
472
480
|
className?: string;
|
|
473
|
-
|
|
481
|
+
style?: React__default.CSSProperties;
|
|
474
482
|
bottomAlignWhenShort?: boolean;
|
|
475
|
-
/** when this value changes, we auto-scroll to the bottom */
|
|
476
483
|
scrollKey?: string | number;
|
|
477
484
|
};
|
|
478
485
|
declare const ChatScroll: React__default.FC<Props$6>;
|
|
@@ -520,13 +527,12 @@ type Props$3 = {
|
|
|
520
527
|
declare const ChatInquiryBar: React__default.FC<Props$3>;
|
|
521
528
|
|
|
522
529
|
type Props$2 = {
|
|
523
|
-
/** Pixel box for the animation area */
|
|
524
530
|
size?: number;
|
|
525
531
|
loop?: boolean;
|
|
526
532
|
autoplay?: boolean;
|
|
527
533
|
className?: string;
|
|
534
|
+
style?: React__default.CSSProperties;
|
|
528
535
|
ariaLabel?: string;
|
|
529
|
-
/** Avatar size in px */
|
|
530
536
|
avatarSize?: number;
|
|
531
537
|
};
|
|
532
538
|
declare const TypingIndicator: React__default.FC<Props$2>;
|
|
@@ -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;
|
|
@@ -470,9 +478,8 @@ type Props$6 = {
|
|
|
470
478
|
top?: React__default.ReactNode;
|
|
471
479
|
children: React__default.ReactNode;
|
|
472
480
|
className?: string;
|
|
473
|
-
|
|
481
|
+
style?: React__default.CSSProperties;
|
|
474
482
|
bottomAlignWhenShort?: boolean;
|
|
475
|
-
/** when this value changes, we auto-scroll to the bottom */
|
|
476
483
|
scrollKey?: string | number;
|
|
477
484
|
};
|
|
478
485
|
declare const ChatScroll: React__default.FC<Props$6>;
|
|
@@ -520,13 +527,12 @@ type Props$3 = {
|
|
|
520
527
|
declare const ChatInquiryBar: React__default.FC<Props$3>;
|
|
521
528
|
|
|
522
529
|
type Props$2 = {
|
|
523
|
-
/** Pixel box for the animation area */
|
|
524
530
|
size?: number;
|
|
525
531
|
loop?: boolean;
|
|
526
532
|
autoplay?: boolean;
|
|
527
533
|
className?: string;
|
|
534
|
+
style?: React__default.CSSProperties;
|
|
528
535
|
ariaLabel?: string;
|
|
529
|
-
/** Avatar size in px */
|
|
530
536
|
avatarSize?: number;
|
|
531
537
|
};
|
|
532
538
|
declare const TypingIndicator: React__default.FC<Props$2>;
|
|
@@ -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 };
|