beca-ui 2.1.0-beta.92 → 2.1.0-beta.94
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/beca-ui.js +57829 -49738
- package/dist/components/AIChat/AIChat.d.ts +11 -0
- package/dist/components/AIChat/AIChat.types.d.ts +21 -0
- package/dist/components/AIChat/index.d.ts +2 -0
- package/dist/components/BecaChatBox/BecaChatBox.d.ts +24 -0
- package/dist/components/BecaChatBox/Composer.d.ts +20 -0
- package/dist/components/BecaChatBox/MainChat.d.ts +36 -0
- package/dist/components/BecaChatBox/MessageBubble.d.ts +27 -0
- package/dist/components/BecaChatBox/Sidebar.d.ts +11 -0
- package/dist/components/BecaChatBox/index.d.ts +1 -0
- package/dist/components/BecaChatBox/types.d.ts +26 -0
- package/dist/components/BecaChatBox/utils.d.ts +3 -0
- package/dist/components/BodyCard/BodyCard.types.d.ts +5 -0
- package/dist/components/TextEditor/BubbleMenu/TextEditorBubbleMenu.d.ts +3 -1
- package/dist/components/TextEditor/Image/index.d.ts +3 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/data/LocalesTexts/EnglishTexts.d.ts +9 -0
- package/dist/data/LocalesTexts/VietnameseTexts.d.ts +9 -0
- package/dist/hooks/LocaleHook.d.ts +9 -0
- package/dist/main.css +1 -1
- package/dist/theme/styles.d.ts +55 -0
- package/package.json +4 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AIChatStreamChunk, AISessionModel } from "./AIChat.types";
|
|
3
|
+
export interface AIChatProps {
|
|
4
|
+
userWorkflowId: number;
|
|
5
|
+
onGetSession: () => Promise<AISessionModel>;
|
|
6
|
+
onChat: (threadId: React.Key, message: string) => AsyncGenerator<AIChatStreamChunk, void, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface AIChatRef {
|
|
9
|
+
fetchSession: () => void | Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare const AIChat: React.ForwardRefExoticComponent<AIChatProps & React.RefAttributes<AIChatRef>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface AISessionMessageModel {
|
|
2
|
+
query: string;
|
|
3
|
+
answer: string;
|
|
4
|
+
created_at: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AISessionModel {
|
|
7
|
+
user_id: number;
|
|
8
|
+
session_id: string;
|
|
9
|
+
userworkflow_id: number;
|
|
10
|
+
workflow_status: string;
|
|
11
|
+
messages: AISessionMessageModel[];
|
|
12
|
+
user_summary: string;
|
|
13
|
+
is_not_found: boolean;
|
|
14
|
+
detail: null;
|
|
15
|
+
}
|
|
16
|
+
export interface AIChatStreamChunk {
|
|
17
|
+
type: string;
|
|
18
|
+
token?: string;
|
|
19
|
+
status?: string;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BecaChatBoxStyles, BecaChatMessageModel, BecaChatThreadModel, HeaderCustom, NewChatMessageModel } from "./types";
|
|
3
|
+
import { MainChatBoxProps } from "./MainChat";
|
|
4
|
+
import { MessageBubbleProps } from "./MessageBubble";
|
|
5
|
+
interface SideBarCustom {
|
|
6
|
+
visible?: boolean;
|
|
7
|
+
showSearch?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface BecaChatBoxProps extends MainChatBoxProps, MessageBubbleProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
threads?: BecaChatThreadModel[];
|
|
12
|
+
initialThreadId?: string;
|
|
13
|
+
onSend?: (threadId: React.Key, message: NewChatMessageModel) => Promise<void>;
|
|
14
|
+
styles?: BecaChatBoxStyles;
|
|
15
|
+
sidebar?: SideBarCustom;
|
|
16
|
+
header?: HeaderCustom;
|
|
17
|
+
}
|
|
18
|
+
export interface BecaChatBoxRef {
|
|
19
|
+
focusInput: () => void;
|
|
20
|
+
receiveMessage: (threadId: React.Key, message: BecaChatMessageModel) => void;
|
|
21
|
+
updateMessage: (threadId: React.Key, messageId: React.Key, newText: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const BecaChatBox: React.ForwardRefExoticComponent<BecaChatBoxProps & React.RefAttributes<BecaChatBoxRef>>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BecaChatBoxStyles } from "./types";
|
|
3
|
+
export interface ComposerProps {
|
|
4
|
+
placeHolder?: string;
|
|
5
|
+
attachment?: {
|
|
6
|
+
showIcon?: boolean;
|
|
7
|
+
onUpload?: (files: File[]) => void | Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
interface Props extends ComposerProps {
|
|
11
|
+
draft: string;
|
|
12
|
+
hasDraft: boolean;
|
|
13
|
+
autoResize: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
14
|
+
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
15
|
+
send: () => void;
|
|
16
|
+
textareaRef: React.RefObject<HTMLTextAreaElement>;
|
|
17
|
+
styles: BecaChatBoxStyles;
|
|
18
|
+
}
|
|
19
|
+
export declare const Composer: React.FC<Props>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BecaChatBoxStyles, BecaChatThreadModel, HeaderCustom } from "./types";
|
|
3
|
+
import { MessageBubbleProps } from "./MessageBubble";
|
|
4
|
+
import { ComposerProps } from "./Composer";
|
|
5
|
+
export interface MainChatBoxProps {
|
|
6
|
+
onRemoveThread?: (threadId: React.Key) => void | Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* @default true
|
|
9
|
+
* show date divider between messages
|
|
10
|
+
*/
|
|
11
|
+
showDateDivider?: boolean;
|
|
12
|
+
otherStatus?: ChatStatusProps;
|
|
13
|
+
ownStatus?: ChatStatusProps;
|
|
14
|
+
hasMore?: boolean;
|
|
15
|
+
onLoadMore?: () => void | Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
interface MainChatProps extends MainChatBoxProps, ComposerProps, MessageBubbleProps {
|
|
18
|
+
header: HeaderCustom;
|
|
19
|
+
activeThread: BecaChatThreadModel | undefined;
|
|
20
|
+
draft: string;
|
|
21
|
+
hasDraft: boolean;
|
|
22
|
+
autoResize: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
23
|
+
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
24
|
+
send: () => void;
|
|
25
|
+
textareaRef: React.RefObject<HTMLTextAreaElement>;
|
|
26
|
+
bottomRef: React.RefObject<HTMLDivElement>;
|
|
27
|
+
styles: BecaChatBoxStyles;
|
|
28
|
+
}
|
|
29
|
+
export declare const MainChat: React.FC<MainChatProps>;
|
|
30
|
+
export interface ChatStatusProps {
|
|
31
|
+
loading: boolean;
|
|
32
|
+
content: string;
|
|
33
|
+
isOwn: boolean;
|
|
34
|
+
icon?: React.JSX.Element;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BecaChatMessageModel } from "./types";
|
|
3
|
+
type MessageBubbleMode = "card" | "text";
|
|
4
|
+
interface MessageBubbleStyle {
|
|
5
|
+
mode: MessageBubbleMode;
|
|
6
|
+
}
|
|
7
|
+
export interface MessageBubbleProps {
|
|
8
|
+
/**
|
|
9
|
+
* Message bubble style of other users
|
|
10
|
+
*/
|
|
11
|
+
otherMessageBubble?: MessageBubbleStyle;
|
|
12
|
+
/**
|
|
13
|
+
* Message bubble style of own user
|
|
14
|
+
*/
|
|
15
|
+
ownMessageBubble?: MessageBubbleStyle;
|
|
16
|
+
/**
|
|
17
|
+
* Show time of message
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
showTime?: boolean;
|
|
21
|
+
onClick?: (id: React.Key, item?: BecaChatMessageModel) => void;
|
|
22
|
+
}
|
|
23
|
+
interface Props extends MessageBubbleProps {
|
|
24
|
+
message: BecaChatMessageModel;
|
|
25
|
+
}
|
|
26
|
+
export declare const MessageBubble: React.FC<Props>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BecaChatThreadModel } from "./types";
|
|
3
|
+
interface SidebarProps {
|
|
4
|
+
threads: BecaChatThreadModel[];
|
|
5
|
+
activeId: React.Key;
|
|
6
|
+
setActiveId: (id: React.Key) => void;
|
|
7
|
+
query: string;
|
|
8
|
+
setQuery: (q: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const Sidebar: React.FC<SidebarProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BecaChatBox';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface BecaChatMessageModel {
|
|
3
|
+
id: string;
|
|
4
|
+
text: string;
|
|
5
|
+
sentAt: string;
|
|
6
|
+
isOwn: boolean;
|
|
7
|
+
type?: string;
|
|
8
|
+
}
|
|
9
|
+
export type NewChatMessageModel = Partial<BecaChatMessageModel> & Pick<BecaChatMessageModel, 'text' | 'sentAt' | 'isOwn'>;
|
|
10
|
+
export interface BecaChatThreadModel {
|
|
11
|
+
id: React.Key;
|
|
12
|
+
title: string;
|
|
13
|
+
subtitle?: string;
|
|
14
|
+
lastMessageAt: string;
|
|
15
|
+
unread?: number;
|
|
16
|
+
messages: BecaChatMessageModel[];
|
|
17
|
+
avatarColor?: string;
|
|
18
|
+
}
|
|
19
|
+
export type BecaChatMode = 'chat' | 'ai';
|
|
20
|
+
export interface BecaChatBoxStyles {
|
|
21
|
+
messages?: React.CSSProperties;
|
|
22
|
+
composer?: React.CSSProperties;
|
|
23
|
+
}
|
|
24
|
+
export interface HeaderCustom {
|
|
25
|
+
visible?: boolean;
|
|
26
|
+
}
|
|
@@ -12,4 +12,9 @@ export interface BodyCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
12
12
|
cardBodyDependencies?: any[];
|
|
13
13
|
backUrl?: string;
|
|
14
14
|
LinkComponent?: any;
|
|
15
|
+
styles?: {
|
|
16
|
+
header?: React.CSSProperties;
|
|
17
|
+
body?: React.CSSProperties;
|
|
18
|
+
content?: React.CSSProperties;
|
|
19
|
+
};
|
|
15
20
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export interface TextEditorMenuItem {
|
|
3
3
|
icon: React.ReactNode;
|
|
4
|
-
onClick
|
|
4
|
+
onClick?: () => void;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
title?: string;
|
|
7
|
+
actived?: boolean;
|
|
8
|
+
subItems?: TextEditorMenuItem[];
|
|
7
9
|
}
|
|
8
10
|
interface BubbleMenuItemType {
|
|
9
11
|
subItems: TextEditorMenuItem[];
|
|
@@ -15,6 +15,9 @@ declare module "@tiptap/core" {
|
|
|
15
15
|
}) => ReturnType;
|
|
16
16
|
setMediaAlign: (align: "left" | "center" | "right") => ReturnType;
|
|
17
17
|
};
|
|
18
|
+
tableCell: {
|
|
19
|
+
setCellVerticalAlign: (value: "top" | "middle" | "bottom") => ReturnType;
|
|
20
|
+
};
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
export interface MediaOptions {
|
|
@@ -31,6 +31,7 @@ declare const _default: {
|
|
|
31
31
|
redo: string;
|
|
32
32
|
refresh: string;
|
|
33
33
|
table: string;
|
|
34
|
+
addTable: string;
|
|
34
35
|
darkMode: string;
|
|
35
36
|
lightMode: string;
|
|
36
37
|
english: string;
|
|
@@ -45,5 +46,13 @@ declare const _default: {
|
|
|
45
46
|
totalDisplay: string;
|
|
46
47
|
sortAppMenuItems: string;
|
|
47
48
|
custom: string;
|
|
49
|
+
horizontalAlign: string;
|
|
50
|
+
verticalAlign: string;
|
|
51
|
+
top: string;
|
|
52
|
+
bottom: string;
|
|
53
|
+
left: string;
|
|
54
|
+
right: string;
|
|
55
|
+
center: string;
|
|
56
|
+
systemColor: string;
|
|
48
57
|
};
|
|
49
58
|
export default _default;
|
|
@@ -31,6 +31,7 @@ declare const _default: {
|
|
|
31
31
|
redo: string;
|
|
32
32
|
refresh: string;
|
|
33
33
|
table: string;
|
|
34
|
+
addTable: string;
|
|
34
35
|
darkMode: string;
|
|
35
36
|
lightMode: string;
|
|
36
37
|
english: string;
|
|
@@ -45,5 +46,13 @@ declare const _default: {
|
|
|
45
46
|
totalDisplay: string;
|
|
46
47
|
sortAppMenuItems: string;
|
|
47
48
|
custom: string;
|
|
49
|
+
horizontalAlign: string;
|
|
50
|
+
verticalAlign: string;
|
|
51
|
+
top: string;
|
|
52
|
+
bottom: string;
|
|
53
|
+
left: string;
|
|
54
|
+
right: string;
|
|
55
|
+
center: string;
|
|
56
|
+
systemColor: string;
|
|
48
57
|
};
|
|
49
58
|
export default _default;
|
|
@@ -33,6 +33,7 @@ export declare function useTranslation(): {
|
|
|
33
33
|
redo: string;
|
|
34
34
|
refresh: string;
|
|
35
35
|
table: string;
|
|
36
|
+
addTable: string;
|
|
36
37
|
darkMode: string;
|
|
37
38
|
lightMode: string;
|
|
38
39
|
english: string;
|
|
@@ -47,5 +48,13 @@ export declare function useTranslation(): {
|
|
|
47
48
|
totalDisplay: string;
|
|
48
49
|
sortAppMenuItems: string;
|
|
49
50
|
custom: string;
|
|
51
|
+
horizontalAlign: string;
|
|
52
|
+
verticalAlign: string;
|
|
53
|
+
top: string;
|
|
54
|
+
bottom: string;
|
|
55
|
+
left: string;
|
|
56
|
+
right: string;
|
|
57
|
+
center: string;
|
|
58
|
+
systemColor: string;
|
|
50
59
|
};
|
|
51
60
|
export {};
|