@lobehub/ui 1.157.0 → 1.158.0
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/es/A/index.js +2 -2
- package/es/ActionIcon/index.js +11 -15
- package/es/ActionIconGroup/index.js +45 -47
- package/es/Alert/index.js +43 -50
- package/es/Avatar/index.js +10 -12
- package/es/Burger/index.js +30 -35
- package/es/CodeEditor/index.js +38 -41
- package/es/Collapse/index.js +3 -3
- package/es/ColorScales/ScaleRow.js +39 -43
- package/es/ColorScales/index.js +57 -59
- package/es/ConfigProvider/index.js +3 -5
- package/es/ContextMenu/index.js +2 -3
- package/es/CopyButton/index.js +3 -4
- package/es/DraggablePanel/components/DraggablePanelBody.js +2 -3
- package/es/DraggablePanel/components/DraggablePanelContainer.js +2 -3
- package/es/DraggablePanel/components/DraggablePanelFooter.js +2 -3
- package/es/DraggablePanel/components/DraggablePanelHeader.js +5 -9
- package/es/DraggablePanel/index.js +28 -35
- package/es/EditableText/index.js +13 -16
- package/es/EmojiPicker/AvatarUploader.js +60 -71
- package/es/EmojiPicker/index.js +101 -110
- package/es/EmptyCard/index.js +23 -31
- package/es/FileTypeIcon/index.js +44 -55
- package/es/FluentEmoji/index.js +4 -6
- package/es/Footer/index.js +8 -10
- package/es/Form/components/FormDivider.js +2 -2
- package/es/Form/components/FormFlatGroup.js +4 -9
- package/es/Form/components/FormFooter.js +3 -6
- package/es/Form/components/FormGroup.js +15 -21
- package/es/Form/components/FormItem.js +10 -17
- package/es/Form/components/FormTitle.js +15 -23
- package/es/Form/index.js +26 -30
- package/es/FormModal/index.js +30 -34
- package/es/Grid/index.js +3 -6
- package/es/Header/index.js +49 -65
- package/es/Highlighter/FullFeatured.js +41 -51
- package/es/Highlighter/SyntaxHighlighter/index.js +19 -30
- package/es/Highlighter/index.js +23 -32
- package/es/Icon/icons/DiscordIcon.js +2 -3
- package/es/Icon/index.js +13 -16
- package/es/Image/ImageGallery.js +3 -5
- package/es/Image/Preview.js +5 -6
- package/es/Image/index.js +34 -38
- package/es/Image/usePreview.js +33 -37
- package/es/Img/index.js +2 -2
- package/es/Input/index.js +3 -3
- package/es/Layout/index.js +35 -63
- package/es/List/ListItem/index.js +53 -67
- package/es/Markdown/CodeBlock.js +10 -16
- package/es/Markdown/Typography.js +3 -6
- package/es/Markdown/index.js +18 -22
- package/es/MaterialFileTypeIcon/index.js +17 -20
- package/es/MaterialFileTypeIcon/utils.d.ts +2 -2
- package/es/Mermaid/FullFeatured.js +35 -45
- package/es/Mermaid/index.js +17 -26
- package/es/Mermaid/useMermaid.d.ts +2 -1
- package/es/Mermaid/useMermaid.js +3 -5
- package/es/Modal/index.js +48 -60
- package/es/SearchBar/index.js +48 -52
- package/es/SelectWithImg/index.js +34 -40
- package/es/SideNav/index.js +15 -22
- package/es/SliderWithInput/index.js +35 -38
- package/es/Snippet/index.js +11 -15
- package/es/SortableList/DragHandle.js +3 -3
- package/es/SortableList/SortableItem.js +16 -19
- package/es/SortableList/SortableOverlay.js +3 -5
- package/es/SortableList/index.js +15 -23
- package/es/Swatches/index.js +18 -20
- package/es/TabsNav/index.js +2 -3
- package/es/Tag/index.js +7 -12
- package/es/ThemeProvider/Meta.js +53 -58
- package/es/ThemeProvider/index.js +17 -23
- package/es/ThemeSwitch/index.js +15 -19
- package/es/Toc/TocMobile.js +47 -52
- package/es/Toc/index.js +8 -13
- package/es/Tooltip/index.js +2 -3
- package/es/Video/index.js +41 -47
- package/es/awesome/AuroraBackground/index.js +11 -18
- package/es/awesome/Features/Item.js +37 -45
- package/es/awesome/Features/index.js +5 -4
- package/es/awesome/GaussianBackground/index.js +8 -13
- package/es/awesome/GaussianBackground/useGaussianBackground.d.ts +1 -1
- package/es/awesome/GaussianBackground/useGaussianBackground.js +1 -1
- package/es/awesome/Giscus/index.js +13 -15
- package/es/awesome/GradientButton/index.js +5 -9
- package/es/awesome/GridBackground/Grid.js +49 -61
- package/es/awesome/GridBackground/GridShowcase.js +24 -28
- package/es/awesome/GridBackground/index.js +27 -33
- package/es/awesome/Hero/index.js +63 -74
- package/es/awesome/Spline/ParentSize.js +7 -8
- package/es/awesome/Spline/index.js +10 -13
- package/es/awesome/Spotlight/index.js +3 -4
- package/es/awesome/SpotlightCard/SpotlightCardItem.js +5 -8
- package/es/awesome/SpotlightCard/index.js +9 -12
- package/es/brand/BrandLoading/index.js +2 -3
- package/es/brand/LobeChat/index.js +29 -38
- package/es/brand/LobeChatText/index.js +8 -13
- package/es/brand/LobeHub/index.js +29 -38
- package/es/brand/LobeHubText/index.js +4 -9
- package/es/brand/Logo3d/index.js +2 -3
- package/es/brand/LogoFlat/index.js +44 -49
- package/es/brand/LogoMono/index.js +48 -53
- package/es/brand/LogoThree/Loading.js +9 -11
- package/es/brand/LogoThree/LogoSpline.js +10 -12
- package/es/brand/LogoThree/index.js +23 -25
- package/es/brand/components/Divider.js +4 -6
- package/es/chat/BackBottom/index.js +4 -6
- package/es/chat/ChatHeader/ChatHeaderTitle.js +22 -31
- package/es/chat/ChatHeader/index.js +35 -42
- package/es/chat/ChatInputArea/ChatInputActionBar.js +16 -21
- package/es/chat/ChatInputArea/ChatInputArea.d.ts +1 -1
- package/es/chat/ChatInputArea/ChatInputArea.js +19 -23
- package/es/chat/ChatInputArea/ChatInputAreaInner.d.ts +1 -1
- package/es/chat/ChatInputArea/ChatInputAreaInner.js +2 -3
- package/es/chat/ChatInputArea/SendButton.js +36 -51
- package/es/chat/ChatItem/components/Actions.js +3 -5
- package/es/chat/ChatItem/components/Avatar.js +17 -21
- package/es/chat/ChatItem/components/BorderSpacing.js +1 -2
- package/es/chat/ChatItem/components/ErrorContent.js +9 -11
- package/es/chat/ChatItem/components/Loading.js +10 -12
- package/es/chat/ChatItem/components/MessageContent.js +6 -10
- package/es/chat/ChatItem/components/Title.js +3 -8
- package/es/chat/ChatItem/index.js +47 -53
- package/es/chat/ChatList/ActionsBar.js +2 -3
- package/es/chat/ChatList/HistoryDivider.js +6 -11
- package/es/chat/ChatList/Item.js +14 -12
- package/es/chat/ChatList/index.js +25 -29
- package/es/chat/EditableMessage/index.js +26 -32
- package/es/chat/EditableMessageList/index.js +72 -76
- package/es/chat/MessageInput/index.js +35 -43
- package/es/chat/MessageModal/index.js +41 -51
- package/es/chat/TokenTag/index.js +7 -11
- package/es/components/ControlInput.js +18 -22
- package/es/hooks/useHighlight.d.ts +1 -1
- package/es/mdx/Callout/index.js +13 -19
- package/es/mdx/Cards/Card.js +46 -59
- package/es/mdx/Cards/index.js +3 -6
- package/es/mdx/FileTree/File.js +5 -11
- package/es/mdx/FileTree/Folder.js +13 -22
- package/es/mdx/FileTree/index.js +3 -6
- package/es/mdx/Mdx/index.d.ts +1 -0
- package/es/mdx/Mdx/index.js +24 -11
- package/es/mdx/Steps/index.js +3 -6
- package/es/mdx/Tabs/Tab.js +3 -8
- package/es/mdx/Tabs/index.js +17 -21
- package/es/mdx/mdxComponents/CodeBlock.js +9 -14
- package/es/mdx/mdxComponents/Image.js +2 -2
- package/es/mdx/mdxComponents/Link.js +2 -3
- package/es/mdx/mdxComponents/Pre.js +7 -14
- package/es/mdx/mdxComponents/Video.js +2 -2
- package/es/mobile/MobileChatInputArea/SendButton.js +3 -4
- package/es/mobile/MobileChatInputArea/index.js +69 -79
- package/es/mobile/MobileNavBar/MobileNavBarTitle.js +26 -37
- package/es/mobile/MobileNavBar/index.js +41 -48
- package/es/mobile/MobileSafeArea/index.js +2 -3
- package/es/mobile/MobileTabBar/index.js +29 -35
- package/es/storybook/StoryBook/index.js +19 -26
- package/package.json +41 -45
|
@@ -3,7 +3,6 @@ import { memo } from 'react';
|
|
|
3
3
|
import { Flexbox } from 'react-layout-kit';
|
|
4
4
|
import Icon from "../../../Icon";
|
|
5
5
|
import { useStyles } from "../style";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
6
|
var Loading = /*#__PURE__*/memo(function (_ref) {
|
|
8
7
|
var loading = _ref.loading,
|
|
9
8
|
placement = _ref.placement;
|
|
@@ -12,18 +11,17 @@ var Loading = /*#__PURE__*/memo(function (_ref) {
|
|
|
12
11
|
}),
|
|
13
12
|
styles = _useStyles.styles;
|
|
14
13
|
if (!loading) return null;
|
|
15
|
-
return /*#__PURE__*/
|
|
14
|
+
return /*#__PURE__*/React.createElement(Flexbox, {
|
|
16
15
|
align: 'center',
|
|
17
16
|
className: styles.loading,
|
|
18
|
-
justify: 'center'
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
17
|
+
justify: 'center'
|
|
18
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
19
|
+
icon: Loader2,
|
|
20
|
+
size: {
|
|
21
|
+
fontSize: 12,
|
|
22
|
+
strokeWidth: 3
|
|
23
|
+
},
|
|
24
|
+
spin: true
|
|
25
|
+
}));
|
|
28
26
|
});
|
|
29
27
|
export default Loading;
|
|
@@ -3,8 +3,6 @@ import { memo } from 'react';
|
|
|
3
3
|
import { Flexbox } from 'react-layout-kit';
|
|
4
4
|
import EditableMessage from "../../EditableMessage";
|
|
5
5
|
import { useStyles } from "../style";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
6
|
var MessageContent = /*#__PURE__*/memo(function (_ref) {
|
|
9
7
|
var editing = _ref.editing,
|
|
10
8
|
onChange = _ref.onChange,
|
|
@@ -29,7 +27,7 @@ var MessageContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
29
27
|
styles = _useStyles.styles;
|
|
30
28
|
var _useResponsive = useResponsive(),
|
|
31
29
|
mobile = _useResponsive.mobile;
|
|
32
|
-
var content = /*#__PURE__*/
|
|
30
|
+
var content = /*#__PURE__*/React.createElement(EditableMessage, {
|
|
33
31
|
classNames: {
|
|
34
32
|
input: styles.editingInput
|
|
35
33
|
},
|
|
@@ -45,13 +43,11 @@ var MessageContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
45
43
|
value: message ? String(message) : ''
|
|
46
44
|
});
|
|
47
45
|
var messageContent = renderMessage ? renderMessage(content) : content;
|
|
48
|
-
return /*#__PURE__*/
|
|
46
|
+
return /*#__PURE__*/React.createElement(Flexbox, {
|
|
49
47
|
className: cx(styles.message, editing && styles.editingContainer),
|
|
50
|
-
onDoubleClick: onDoubleClick
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}) : null]
|
|
55
|
-
});
|
|
48
|
+
onDoubleClick: onDoubleClick
|
|
49
|
+
}, messageContent, messageExtra && !editing ? /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: styles.messageExtra
|
|
51
|
+
}, messageExtra) : null);
|
|
56
52
|
});
|
|
57
53
|
export default MessageContent;
|
|
@@ -2,8 +2,6 @@ import { memo } from 'react';
|
|
|
2
2
|
import { Flexbox } from 'react-layout-kit';
|
|
3
3
|
import { formatTime } from "../../../utils/formatTime";
|
|
4
4
|
import { useStyles } from "../style";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
5
|
var Title = /*#__PURE__*/memo(function (_ref) {
|
|
8
6
|
var showTitle = _ref.showTitle,
|
|
9
7
|
placement = _ref.placement,
|
|
@@ -15,13 +13,10 @@ var Title = /*#__PURE__*/memo(function (_ref) {
|
|
|
15
13
|
time: time
|
|
16
14
|
}),
|
|
17
15
|
styles = _useStyles.styles;
|
|
18
|
-
return /*#__PURE__*/
|
|
16
|
+
return /*#__PURE__*/React.createElement(Flexbox, {
|
|
19
17
|
className: styles.name,
|
|
20
18
|
direction: placement === 'left' ? 'horizontal' : 'horizontal-reverse',
|
|
21
|
-
gap: 4
|
|
22
|
-
|
|
23
|
-
children: formatTime(time)
|
|
24
|
-
})]
|
|
25
|
-
});
|
|
19
|
+
gap: 4
|
|
20
|
+
}, showTitle ? avatar.title || 'untitled' : undefined, time && /*#__PURE__*/React.createElement("time", null, formatTime(time)));
|
|
26
21
|
});
|
|
27
22
|
export default Title;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["avatarAddon", "onAvatarClick", "avatarProps", "actions", "className", "primary", "loading", "message", "placement", "type", "avatar", "error", "showTitle", "time", "editing", "onChange", "onEditingChange", "messageExtra", "renderMessage", "text", "errorMessage", "onDoubleClick", "fontSize", "aboveMessage", "belowMessage", "markdownProps"];
|
|
6
6
|
import { useResponsive } from 'antd-style';
|
|
@@ -13,8 +13,6 @@ import ErrorContent from "./components/ErrorContent";
|
|
|
13
13
|
import MessageContent from "./components/MessageContent";
|
|
14
14
|
import Title from "./components/Title";
|
|
15
15
|
import { useStyles } from "./style";
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
16
|
var MOBILE_AVATAR_SIZE = 32;
|
|
19
17
|
var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
20
18
|
var avatarAddon = _ref.avatarAddon,
|
|
@@ -59,59 +57,55 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
59
57
|
}),
|
|
60
58
|
cx = _useStyles.cx,
|
|
61
59
|
styles = _useStyles.styles;
|
|
62
|
-
return /*#__PURE__*/
|
|
60
|
+
return /*#__PURE__*/React.createElement(Flexbox, _extends({
|
|
63
61
|
className: cx(styles.container, className),
|
|
64
62
|
direction: placement === 'left' ? 'horizontal' : 'horizontal-reverse',
|
|
65
63
|
gap: mobile ? 6 : 12
|
|
66
|
-
}, rest), {}, {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}), belowMessage]
|
|
112
|
-
}), mobile && type === 'block' && /*#__PURE__*/_jsx(BorderSpacing, {
|
|
113
|
-
borderSpacing: MOBILE_AVATAR_SIZE
|
|
114
|
-
})]
|
|
64
|
+
}, rest), /*#__PURE__*/React.createElement(Avatar, _extends({}, avatarProps, {
|
|
65
|
+
addon: avatarAddon,
|
|
66
|
+
avatar: avatar,
|
|
67
|
+
loading: loading,
|
|
68
|
+
onClick: onAvatarClick,
|
|
69
|
+
placement: placement,
|
|
70
|
+
size: mobile ? MOBILE_AVATAR_SIZE : undefined
|
|
71
|
+
})), /*#__PURE__*/React.createElement(Flexbox, {
|
|
72
|
+
align: placement === 'left' ? 'flex-start' : 'flex-end',
|
|
73
|
+
className: styles.messageContainer
|
|
74
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
75
|
+
avatar: avatar,
|
|
76
|
+
placement: placement,
|
|
77
|
+
showTitle: showTitle,
|
|
78
|
+
time: time
|
|
79
|
+
}), aboveMessage, /*#__PURE__*/React.createElement(Flexbox, {
|
|
80
|
+
align: placement === 'left' ? 'flex-start' : 'flex-end',
|
|
81
|
+
className: styles.messageContent,
|
|
82
|
+
direction: type === 'block' ? placement === 'left' ? 'horizontal' : 'horizontal-reverse' : 'vertical',
|
|
83
|
+
gap: 8
|
|
84
|
+
}, error ? /*#__PURE__*/React.createElement(ErrorContent, {
|
|
85
|
+
error: error,
|
|
86
|
+
message: errorMessage,
|
|
87
|
+
placement: placement
|
|
88
|
+
}) : /*#__PURE__*/React.createElement(MessageContent, {
|
|
89
|
+
editing: editing,
|
|
90
|
+
fontSize: fontSize,
|
|
91
|
+
markdownProps: markdownProps,
|
|
92
|
+
message: message,
|
|
93
|
+
messageExtra: messageExtra,
|
|
94
|
+
onChange: onChange,
|
|
95
|
+
onDoubleClick: onDoubleClick,
|
|
96
|
+
onEditingChange: onEditingChange,
|
|
97
|
+
placement: placement,
|
|
98
|
+
primary: primary,
|
|
99
|
+
renderMessage: renderMessage,
|
|
100
|
+
text: text,
|
|
101
|
+
type: type
|
|
102
|
+
}), /*#__PURE__*/React.createElement(Actions, {
|
|
103
|
+
actions: actions,
|
|
104
|
+
editing: editing,
|
|
105
|
+
placement: placement,
|
|
106
|
+
type: type
|
|
107
|
+
})), belowMessage), mobile && type === 'block' && /*#__PURE__*/React.createElement(BorderSpacing, {
|
|
108
|
+
borderSpacing: MOBILE_AVATAR_SIZE
|
|
115
109
|
}));
|
|
116
110
|
});
|
|
117
111
|
export default ChatItem;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["text"];
|
|
4
4
|
import { memo } from 'react';
|
|
5
5
|
import ActionIconGroup from "../../ActionIconGroup";
|
|
6
6
|
import { useChatListActionsBar } from "../../hooks/useChatListActionsBar";
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
7
|
var ActionsBar = /*#__PURE__*/memo(function (_ref) {
|
|
9
8
|
var text = _ref.text,
|
|
10
9
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -14,7 +13,7 @@ var ActionsBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
14
13
|
copy = _useChatListActionsBa.copy,
|
|
15
14
|
divider = _useChatListActionsBa.divider,
|
|
16
15
|
del = _useChatListActionsBa.del;
|
|
17
|
-
return /*#__PURE__*/
|
|
16
|
+
return /*#__PURE__*/React.createElement(ActionIconGroup, _extends({
|
|
18
17
|
dropdownMenu: [edit, copy, regenerate, divider, del],
|
|
19
18
|
items: [regenerate, edit],
|
|
20
19
|
type: "ghost"
|
|
@@ -3,23 +3,18 @@ import { Timer } from 'lucide-react';
|
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
import Icon from "../../Icon";
|
|
5
5
|
import Tag from "../../Tag";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
6
|
var HistoryDivider = /*#__PURE__*/memo(function (_ref) {
|
|
8
7
|
var enable = _ref.enable,
|
|
9
8
|
text = _ref.text;
|
|
10
9
|
if (!enable) return null;
|
|
11
|
-
return /*#__PURE__*/
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
11
|
style: {
|
|
13
12
|
padding: '0 20px'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
icon: Timer
|
|
19
|
-
}),
|
|
20
|
-
children: text || 'History Message'
|
|
21
|
-
})
|
|
13
|
+
}
|
|
14
|
+
}, /*#__PURE__*/React.createElement(Divider, null, /*#__PURE__*/React.createElement(Tag, {
|
|
15
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
16
|
+
icon: Timer
|
|
22
17
|
})
|
|
23
|
-
});
|
|
18
|
+
}, text || 'History Message')));
|
|
24
19
|
});
|
|
25
20
|
export default HistoryDivider;
|
package/es/chat/ChatList/Item.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
1
2
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
-
import
|
|
4
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
7
|
var _excluded = ["renderMessagesExtra", "showTitle", "onActionsClick", "onAvatarsClick", "onMessageChange", "type", "text", "renderMessages", "renderErrorMessages", "renderActions", "loading", "groupNav", "renderItems"];
|
|
@@ -9,7 +10,6 @@ import { memo, useCallback, useMemo, useState } from 'react';
|
|
|
9
10
|
import ChatItem from "../ChatItem";
|
|
10
11
|
import { copyToClipboard } from "../../utils/copyToClipboard";
|
|
11
12
|
import ActionsBar from "./ActionsBar";
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
var Item = /*#__PURE__*/memo(function (props) {
|
|
14
14
|
var renderMessagesExtra = props.renderMessagesExtra,
|
|
15
15
|
showTitle = props.showTitle,
|
|
@@ -47,7 +47,7 @@ var Item = /*#__PURE__*/memo(function (props) {
|
|
|
47
47
|
if (renderMessages !== null && renderMessages !== void 0 && renderMessages[item.role]) RenderFunction = renderMessages[item.role];
|
|
48
48
|
if (!RenderFunction && renderMessages !== null && renderMessages !== void 0 && renderMessages['default']) RenderFunction = renderMessages['default'];
|
|
49
49
|
if (!RenderFunction) return;
|
|
50
|
-
return /*#__PURE__*/
|
|
50
|
+
return /*#__PURE__*/React.createElement(RenderFunction, _extends({}, data, {
|
|
51
51
|
editableContent: editableContent
|
|
52
52
|
}));
|
|
53
53
|
}, [renderMessages === null || renderMessages === void 0 ? void 0 : renderMessages[item.role]]);
|
|
@@ -58,7 +58,7 @@ var Item = /*#__PURE__*/memo(function (props) {
|
|
|
58
58
|
if (renderMessagesExtra !== null && renderMessagesExtra !== void 0 && renderMessagesExtra[item.role]) RenderFunction = renderMessagesExtra[item.role];
|
|
59
59
|
if (renderMessagesExtra !== null && renderMessagesExtra !== void 0 && renderMessagesExtra['default']) RenderFunction = renderMessagesExtra['default'];
|
|
60
60
|
if (!RenderFunction) return;
|
|
61
|
-
return /*#__PURE__*/
|
|
61
|
+
return /*#__PURE__*/React.createElement(RenderFunction, data);
|
|
62
62
|
}, [renderMessagesExtra === null || renderMessagesExtra === void 0 ? void 0 : renderMessagesExtra[item.role]]);
|
|
63
63
|
var ErrorMessage = useCallback(function (_ref3) {
|
|
64
64
|
var _item$error;
|
|
@@ -68,7 +68,7 @@ var Item = /*#__PURE__*/memo(function (props) {
|
|
|
68
68
|
if (renderErrorMessages !== null && renderErrorMessages !== void 0 && renderErrorMessages[item.error.type]) RenderFunction = renderErrorMessages[item.error.type].Render;
|
|
69
69
|
if (!RenderFunction && renderErrorMessages !== null && renderErrorMessages !== void 0 && renderErrorMessages['default']) RenderFunction = renderErrorMessages['default'].Render;
|
|
70
70
|
if (!RenderFunction) return;
|
|
71
|
-
return /*#__PURE__*/
|
|
71
|
+
return /*#__PURE__*/React.createElement(RenderFunction, data);
|
|
72
72
|
}, [renderErrorMessages]);
|
|
73
73
|
var Actions = useCallback(function (_ref4) {
|
|
74
74
|
var data = _ref4.data;
|
|
@@ -105,7 +105,7 @@ var Item = /*#__PURE__*/memo(function (props) {
|
|
|
105
105
|
return _ref5.apply(this, arguments);
|
|
106
106
|
};
|
|
107
107
|
}();
|
|
108
|
-
return /*#__PURE__*/
|
|
108
|
+
return /*#__PURE__*/React.createElement(RenderFunction, _extends({}, data, {
|
|
109
109
|
onActionClick: function onActionClick(actionKey) {
|
|
110
110
|
return handleActionClick === null || handleActionClick === void 0 ? void 0 : handleActionClick(actionKey, data);
|
|
111
111
|
},
|
|
@@ -125,21 +125,23 @@ var Item = /*#__PURE__*/memo(function (props) {
|
|
|
125
125
|
message: message
|
|
126
126
|
}, alertConfig);
|
|
127
127
|
}, [renderErrorMessages, item.error]);
|
|
128
|
-
if (RenderItem) return /*#__PURE__*/
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
if (RenderItem) return /*#__PURE__*/React.createElement(RenderItem, _extends({
|
|
129
|
+
key: item.id
|
|
130
|
+
}, props));
|
|
131
|
+
return /*#__PURE__*/React.createElement(ChatItem, {
|
|
132
|
+
actions: /*#__PURE__*/React.createElement(Actions, {
|
|
131
133
|
data: item
|
|
132
134
|
}),
|
|
133
135
|
avatar: item.meta,
|
|
134
136
|
avatarAddon: groupNav,
|
|
135
137
|
editing: editing,
|
|
136
138
|
error: error,
|
|
137
|
-
errorMessage: /*#__PURE__*/
|
|
139
|
+
errorMessage: /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
138
140
|
data: item
|
|
139
141
|
}),
|
|
140
142
|
loading: loading,
|
|
141
143
|
message: item.content,
|
|
142
|
-
messageExtra: /*#__PURE__*/
|
|
144
|
+
messageExtra: /*#__PURE__*/React.createElement(MessageExtra, {
|
|
143
145
|
data: item
|
|
144
146
|
}),
|
|
145
147
|
onAvatarClick: onAvatarsClick === null || onAvatarsClick === void 0 ? void 0 : onAvatarsClick(item.role),
|
|
@@ -156,7 +158,7 @@ var Item = /*#__PURE__*/memo(function (props) {
|
|
|
156
158
|
placement: type === 'chat' ? item.role === 'user' ? 'right' : 'left' : 'left',
|
|
157
159
|
primary: item.role === 'user',
|
|
158
160
|
renderMessage: function renderMessage(editableContent) {
|
|
159
|
-
return /*#__PURE__*/
|
|
161
|
+
return /*#__PURE__*/React.createElement(RenderMessage, {
|
|
160
162
|
data: item,
|
|
161
163
|
editableContent: editableContent
|
|
162
164
|
});
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["onActionsClick", "onAvatarsClick", "renderMessagesExtra", "className", "data", "type", "text", "showTitle", "onMessageChange", "renderMessages", "renderErrorMessages", "loadingId", "renderItems", "enableHistoryCount", "renderActions", "historyCount"];
|
|
6
6
|
import { Fragment, memo } from 'react';
|
|
7
7
|
import HistoryDivider from "./HistoryDivider";
|
|
8
8
|
import Item from "./Item";
|
|
9
9
|
import { useStyles } from "./style";
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
10
|
var ChatList = /*#__PURE__*/memo(function (_ref) {
|
|
13
11
|
var onActionsClick = _ref.onActionsClick,
|
|
14
12
|
onAvatarsClick = _ref.onAvatarsClick,
|
|
@@ -32,33 +30,31 @@ var ChatList = /*#__PURE__*/memo(function (_ref) {
|
|
|
32
30
|
var _useStyles = useStyles(),
|
|
33
31
|
cx = _useStyles.cx,
|
|
34
32
|
styles = _useStyles.styles;
|
|
35
|
-
return /*#__PURE__*/
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
36
34
|
className: cx(styles.container, className)
|
|
37
|
-
}, rest),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, item.id);
|
|
61
|
-
})
|
|
35
|
+
}, rest), data.map(function (item, index) {
|
|
36
|
+
var itemProps = {
|
|
37
|
+
loading: loadingId === item.id,
|
|
38
|
+
onActionsClick: onActionsClick,
|
|
39
|
+
onAvatarsClick: onAvatarsClick,
|
|
40
|
+
onMessageChange: onMessageChange,
|
|
41
|
+
renderActions: renderActions,
|
|
42
|
+
renderErrorMessages: renderErrorMessages,
|
|
43
|
+
renderItems: renderItems,
|
|
44
|
+
renderMessages: renderMessages,
|
|
45
|
+
renderMessagesExtra: renderMessagesExtra,
|
|
46
|
+
showTitle: showTitle,
|
|
47
|
+
text: text,
|
|
48
|
+
type: type
|
|
49
|
+
};
|
|
50
|
+
var historyLength = data.length;
|
|
51
|
+
var enableHistoryDivider = enableHistoryCount && historyLength > historyCount && historyCount === historyLength - index + 1;
|
|
52
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
53
|
+
key: item.id
|
|
54
|
+
}, /*#__PURE__*/React.createElement(HistoryDivider, {
|
|
55
|
+
enable: enableHistoryDivider,
|
|
56
|
+
text: text === null || text === void 0 ? void 0 : text.history
|
|
57
|
+
}), /*#__PURE__*/React.createElement(Item, _extends({}, itemProps, item)));
|
|
62
58
|
}));
|
|
63
59
|
});
|
|
64
60
|
export default ChatList;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
6
|
import { memo } from 'react';
|
|
@@ -7,9 +8,6 @@ import useControlledState from 'use-merge-value';
|
|
|
7
8
|
import Markdown from "../../Markdown";
|
|
8
9
|
import MessageInput from "../MessageInput";
|
|
9
10
|
import MessageModal from "../MessageModal";
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
11
|
var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
14
12
|
var value = _ref.value,
|
|
15
13
|
onChange = _ref.onChange,
|
|
@@ -46,7 +44,7 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
46
44
|
expand = _useControlledState4[0],
|
|
47
45
|
setExpand = _useControlledState4[1];
|
|
48
46
|
var isAutoSize = height === 'auto';
|
|
49
|
-
var input = /*#__PURE__*/
|
|
47
|
+
var input = /*#__PURE__*/React.createElement(MessageInput, {
|
|
50
48
|
className: classNames === null || classNames === void 0 ? void 0 : classNames.input,
|
|
51
49
|
classNames: {
|
|
52
50
|
textarea: classNames === null || classNames === void 0 ? void 0 : classNames.textarea
|
|
@@ -68,33 +66,29 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
68
66
|
type: inputType
|
|
69
67
|
});
|
|
70
68
|
if (!value && showEditWhenEmpty) return input;
|
|
71
|
-
return /*#__PURE__*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
text: text,
|
|
96
|
-
value: value
|
|
97
|
-
})]
|
|
98
|
-
});
|
|
69
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !expand && isEdit ? input : /*#__PURE__*/React.createElement(Markdown, _extends({
|
|
70
|
+
className: classNames === null || classNames === void 0 ? void 0 : classNames.markdown,
|
|
71
|
+
fontSize: fontSize,
|
|
72
|
+
fullFeaturedCodeBlock: fullFeaturedCodeBlock,
|
|
73
|
+
style: _objectSpread({
|
|
74
|
+
height: isAutoSize ? 'unset' : height
|
|
75
|
+
}, stylesProps === null || stylesProps === void 0 ? void 0 : stylesProps.markdown),
|
|
76
|
+
variant: 'chat'
|
|
77
|
+
}, markdownProps), value || placeholder || ''), expand && /*#__PURE__*/React.createElement(MessageModal, {
|
|
78
|
+
editing: isEdit,
|
|
79
|
+
extra: model === null || model === void 0 ? void 0 : model.extra,
|
|
80
|
+
footer: model === null || model === void 0 ? void 0 : model.footer,
|
|
81
|
+
height: height,
|
|
82
|
+
onChange: onChange,
|
|
83
|
+
onEditingChange: setTyping,
|
|
84
|
+
onOpenChange: function onOpenChange(e) {
|
|
85
|
+
setExpand(e);
|
|
86
|
+
setTyping(false);
|
|
87
|
+
},
|
|
88
|
+
open: expand,
|
|
89
|
+
placeholder: placeholder,
|
|
90
|
+
text: text,
|
|
91
|
+
value: value
|
|
92
|
+
}));
|
|
99
93
|
});
|
|
100
94
|
export default EditableMessage;
|