@rolder/kit 3.0.0-alpha.74 → 3.0.0-alpha.76
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.
|
@@ -11,4 +11,35 @@ export interface ConversationRootProps extends PaperProps {
|
|
|
11
11
|
stackProps?: StackProps;
|
|
12
12
|
chatOptions?: UseChatOptions<UIMessage> & ChatInit<UIMessage>;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Корневой компонент чата
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { Chat } from '@rolder/kit';
|
|
20
|
+
*
|
|
21
|
+
* const MyChat = () => {
|
|
22
|
+
* return (
|
|
23
|
+
* <Chat.Root h="calc(100vh - 202px)">
|
|
24
|
+
* {(messageIds) => (
|
|
25
|
+
* <>
|
|
26
|
+
* {messageIds.map((messageId) => (
|
|
27
|
+
* <Chat.Message key={messageId} messageId={messageId} />
|
|
28
|
+
* ))}
|
|
29
|
+
* <Chat.Empty />
|
|
30
|
+
* <Chat.Loader />
|
|
31
|
+
* </>
|
|
32
|
+
* )}
|
|
33
|
+
* </Chat.Root>
|
|
34
|
+
* );
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param children - Render-функция, принимающая массив ID сообщений
|
|
39
|
+
* @param h - Высота компонента (обязательный параметр)
|
|
40
|
+
* @param chatOptions - Опции для инициализации чата (API endpoint, начальные сообщения и т.д.)
|
|
41
|
+
* @param scrollAreaProps - Пропсы для ScrollArea
|
|
42
|
+
* @param withScrollButton - Показывать кнопку прокрутки (по умолчанию true)
|
|
43
|
+
* @param stackProps - Пропсы для Stack контейнера
|
|
44
|
+
*/
|
|
14
45
|
export declare const Root: ({ children, h, scrollAreaProps, withScrollButton, stackProps, chatOptions, ...props }: ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -60,10 +60,10 @@ const useScrollAreaState = (options = {})=>{
|
|
|
60
60
|
]);
|
|
61
61
|
const performAutoScroll = useCallback(()=>{
|
|
62
62
|
if (!autoScroll || isUserInteractingRef.current || !scrollAreaRef.current) return;
|
|
63
|
-
if (
|
|
63
|
+
if (isNearBottom) scrollToBottom(false);
|
|
64
64
|
}, [
|
|
65
65
|
autoScroll,
|
|
66
|
-
|
|
66
|
+
isNearBottom,
|
|
67
67
|
scrollToBottom
|
|
68
68
|
]);
|
|
69
69
|
const handleUserInteraction = useCallback(()=>{
|