@ant-design/agentic-ui 2.0.17 → 2.0.20

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.
Files changed (46) hide show
  1. package/dist/Bubble/FileView.js +1 -1
  2. package/dist/Bubble/type.d.ts +2 -2
  3. package/dist/ChatBootPage/ButtonTabStyle.js +2 -2
  4. package/dist/ChatBootPage/CaseReply.d.ts +10 -2
  5. package/dist/ChatBootPage/CaseReply.js +20 -2
  6. package/dist/ChatBootPage/CaseReplyStyle.js +51 -9
  7. package/dist/Components/ActionIconBox/index.js +102 -46
  8. package/dist/Components/Button/ToggleButton/index.js +3 -3
  9. package/dist/Components/Button/ToggleButton/style.js +1 -1
  10. package/dist/Components/GradientText/index.d.ts +8 -0
  11. package/dist/Components/GradientText/index.js +32 -0
  12. package/dist/Components/GradientText/style.d.ts +5 -0
  13. package/dist/Components/GradientText/style.js +76 -0
  14. package/dist/Components/TextAnimate/index.d.ts +56 -0
  15. package/dist/Components/TextAnimate/index.js +388 -0
  16. package/dist/Components/TextAnimate/style.d.ts +5 -0
  17. package/dist/Components/TextAnimate/style.js +53 -0
  18. package/dist/Components/TypingAnimation/index.d.ts +19 -0
  19. package/dist/Components/TypingAnimation/index.js +182 -0
  20. package/dist/Components/TypingAnimation/style.d.ts +5 -0
  21. package/dist/Components/TypingAnimation/style.js +59 -0
  22. package/dist/Components/lotties/ShinyText/index.d.ts +69 -0
  23. package/dist/Components/lotties/ShinyText/index.js +60 -0
  24. package/dist/Components/lotties/ShinyText/style.d.ts +5 -0
  25. package/dist/Components/lotties/ShinyText/style.js +84 -0
  26. package/dist/Components/lotties/index.d.ts +1 -2
  27. package/dist/Components/lotties/index.js +1 -2
  28. package/dist/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.js +6 -32
  29. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +1 -1
  30. package/dist/MarkdownInputField/AttachmentButton/index.js +5 -3
  31. package/dist/MarkdownInputField/FileMapView/FileMapViewItem.d.ts +2 -2
  32. package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +166 -152
  33. package/dist/MarkdownInputField/FileMapView/index.d.ts +3 -3
  34. package/dist/MarkdownInputField/FileMapView/index.js +12 -26
  35. package/dist/MarkdownInputField/FileMapView/style.js +8 -3
  36. package/dist/MarkdownInputField/MarkdownInputField.js +156 -174
  37. package/dist/MarkdownInputField/QuickActions/index.js +6 -0
  38. package/dist/MarkdownInputField/VoiceInput/index.js +2 -1
  39. package/dist/MarkdownInputField/style.js +5 -9
  40. package/dist/WelcomeMessage/index.d.ts +12 -2
  41. package/dist/WelcomeMessage/index.js +40 -4
  42. package/dist/WelcomeMessage/style.js +1 -0
  43. package/dist/Workspace/File/FileComponent.js +23 -1
  44. package/dist/index.d.ts +4 -0
  45. package/dist/index.js +4 -0
  46. package/package.json +4 -4
@@ -1,209 +1,223 @@
1
1
  // src/MarkdownInputField/FileMapView/FileMapViewItem.tsx
2
- import { EllipsisOutlined } from "@ant-design/icons";
3
- import { Download, Eye } from "@sofa-design/icons";
2
+ import { Download, EllipsisVertical, Eye } from "@sofa-design/icons";
4
3
  import { Tooltip } from "antd";
5
4
  import classNames from "classnames";
6
5
  import dayjs from "dayjs";
7
6
  import { motion } from "framer-motion";
8
- import React, { useContext, useMemo } from "react";
7
+ import React, { useContext } from "react";
9
8
  import { ActionIconBox } from "../../Components/ActionIconBox";
10
9
  import { I18nContext } from "../../I18n";
11
10
  import { AttachmentFileIcon } from "../AttachmentButton/AttachmentFileList/AttachmentFileIcon";
12
11
  import { kbToSize } from "../AttachmentButton/utils";
13
12
  var FileMapViewItem = (props) => {
13
+ var _a;
14
14
  const file = props.file;
15
15
  const { locale } = useContext(I18nContext);
16
16
  const [hovered, setHovered] = React.useState(false);
17
- return useMemo(() => {
18
- return /* @__PURE__ */ React.createElement(
19
- Tooltip,
17
+ const handleMouseEnter = () => setHovered(true);
18
+ const handleMouseLeave = () => setHovered(false);
19
+ const fileName = (_a = file == null ? void 0 : file.name) != null ? _a : "";
20
+ const lastDotIndex = fileName.lastIndexOf(".");
21
+ const displayName = lastDotIndex > 0 ? fileName.slice(0, lastDotIndex) : fileName;
22
+ const displayExtension = lastDotIndex > 0 && lastDotIndex < fileName.length - 1 ? fileName.slice(lastDotIndex + 1) : "";
23
+ return /* @__PURE__ */ React.createElement(
24
+ Tooltip,
25
+ {
26
+ title: /* @__PURE__ */ React.createElement("div", null, locale == null ? void 0 : locale.clickToPreview),
27
+ placement: "topLeft",
28
+ arrow: false
29
+ },
30
+ /* @__PURE__ */ React.createElement(
31
+ motion.div,
20
32
  {
21
- title: /* @__PURE__ */ React.createElement("div", null, locale == null ? void 0 : locale.clickToPreview),
22
- placement: "topLeft",
23
- arrow: false
33
+ onMouseEnter: handleMouseEnter,
34
+ onMouseLeave: handleMouseLeave,
35
+ onClick: () => {
36
+ var _a2;
37
+ if (file.status === "error")
38
+ return;
39
+ if (props.onPreview) {
40
+ (_a2 = props.onPreview) == null ? void 0 : _a2.call(props);
41
+ } else {
42
+ if (typeof window === "undefined")
43
+ return;
44
+ window.open(file.previewUrl || file.url, "_blank");
45
+ }
46
+ },
47
+ variants: {
48
+ hidden: { x: 20, opacity: 0 },
49
+ visible: { x: 0, opacity: 1 },
50
+ exit: { x: -20, opacity: 0 }
51
+ },
52
+ exit: { opacity: 0, x: -20 },
53
+ className: props.className,
54
+ "data-testid": "file-item"
24
55
  },
25
56
  /* @__PURE__ */ React.createElement(
26
- motion.div,
57
+ "div",
27
58
  {
28
- onMouseEnter: () => setHovered(true),
29
- onMouseLeave: () => setHovered(false),
30
- onClick: () => {
31
- var _a;
32
- if (file.status === "error")
33
- return;
34
- (_a = props.onPreview) == null ? void 0 : _a.call(props);
35
- },
36
- variants: {
37
- hidden: { x: 20, opacity: 0 },
38
- visible: { x: 0, opacity: 1 },
39
- exit: { x: -20, opacity: 0 }
40
- },
41
- exit: { opacity: 0, x: -20 },
42
- className: props.className,
43
- "data-testid": "file-item"
59
+ className: classNames(`${props.prefixCls}-file-icon`, props.hashId)
44
60
  },
45
61
  /* @__PURE__ */ React.createElement(
46
- "div",
62
+ AttachmentFileIcon,
47
63
  {
48
- className: classNames(`${props.prefixCls}-file-icon`, props.hashId)
49
- },
50
- /* @__PURE__ */ React.createElement(
51
- AttachmentFileIcon,
52
- {
53
- file,
54
- className: classNames(
55
- `${props.prefixCls}-file-icon-img`,
56
- props.hashId
57
- )
58
- }
59
- )
60
- ),
64
+ file,
65
+ className: classNames(
66
+ `${props.prefixCls}-file-icon-img`,
67
+ props.hashId
68
+ )
69
+ }
70
+ )
71
+ ),
72
+ /* @__PURE__ */ React.createElement(
73
+ "div",
74
+ {
75
+ className: classNames(`${props.prefixCls}-file-info`, props.hashId)
76
+ },
61
77
  /* @__PURE__ */ React.createElement(
62
78
  "div",
63
79
  {
64
- className: classNames(`${props.prefixCls}-file-info`, props.hashId)
80
+ className: classNames(`${props.prefixCls}-file-name`, props.hashId)
65
81
  },
66
82
  /* @__PURE__ */ React.createElement(
67
- "div",
83
+ "span",
68
84
  {
69
85
  className: classNames(
70
- `${props.prefixCls}-file-name`,
86
+ `${props.prefixCls}-file-name-text`,
71
87
  props.hashId
72
- )
88
+ ),
89
+ title: file == null ? void 0 : file.name
73
90
  },
74
- /* @__PURE__ */ React.createElement(
75
- "span",
76
- {
77
- className: classNames(
78
- `${props.prefixCls}-file-name-text`,
79
- props.hashId
80
- ),
81
- title: file == null ? void 0 : file.name
82
- },
83
- file == null ? void 0 : file.name.split(".").slice(0, -1).join(".")
84
- )
85
- ),
86
- /* @__PURE__ */ React.createElement(
87
- "div",
88
- {
89
- className: classNames(
90
- `${props.prefixCls}-file-name-extension-container`,
91
- props.hashId
92
- )
93
- },
94
- /* @__PURE__ */ React.createElement(
95
- "span",
96
- {
97
- className: classNames(
98
- `${props.prefixCls}-file-name-extension`,
99
- props.hashId
100
- )
101
- },
102
- file == null ? void 0 : file.name.split(".").slice(-1)
103
- ),
104
- /* @__PURE__ */ React.createElement(
105
- "span",
106
- {
107
- className: classNames(
108
- `${props.prefixCls}-separator`,
109
- props.hashId
110
- )
111
- },
112
- "|"
113
- ),
114
- /* @__PURE__ */ React.createElement(
115
- "div",
116
- {
117
- className: classNames(
118
- `${props.prefixCls}-file-size`,
119
- props.hashId
120
- )
121
- },
122
- kbToSize(file.size / 1024)
123
- ),
124
- /* @__PURE__ */ React.createElement(
125
- "span",
126
- {
127
- className: classNames(
128
- `${props.prefixCls}-separator`,
129
- props.hashId
130
- )
131
- },
132
- "|"
133
- ),
134
- /* @__PURE__ */ React.createElement("div", null, (file == null ? void 0 : file.lastModified) ? dayjs(file == null ? void 0 : file.lastModified).format("HH:mm") : "")
91
+ displayName
135
92
  )
136
93
  ),
137
- hovered ? /* @__PURE__ */ React.createElement(
94
+ /* @__PURE__ */ React.createElement(
138
95
  "div",
139
96
  {
140
97
  className: classNames(
141
- `${props.prefixCls}-action-bar`,
98
+ `${props.prefixCls}-file-name-extension-container`,
142
99
  props.hashId
143
100
  )
144
101
  },
145
- props.customSlot ? /* @__PURE__ */ React.createElement(
146
- ActionIconBox,
102
+ /* @__PURE__ */ React.createElement(
103
+ "span",
147
104
  {
148
- title: "更多",
149
- onClick: (e) => {
150
- e.stopPropagation();
151
- },
152
105
  className: classNames(
153
- `${props.prefixCls}-action-btn`,
106
+ `${props.prefixCls}-file-name-extension`,
154
107
  props.hashId
155
108
  )
156
109
  },
157
- typeof props.customSlot === "function" ? props.customSlot(file) : props.customSlot
158
- ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
159
- ActionIconBox,
110
+ displayExtension
111
+ ),
112
+ /* @__PURE__ */ React.createElement(
113
+ "span",
160
114
  {
161
- title: (locale == null ? void 0 : locale.preview) || "预览",
162
- onClick: (e) => {
163
- var _a;
164
- e.stopPropagation();
165
- (_a = props.onPreview) == null ? void 0 : _a.call(props);
166
- },
167
115
  className: classNames(
168
- `${props.prefixCls}-action-btn`,
116
+ `${props.prefixCls}-separator`,
169
117
  props.hashId
170
118
  )
171
119
  },
172
- /* @__PURE__ */ React.createElement(Eye, { color: "var(--color-gray-text-secondary)" })
173
- ), /* @__PURE__ */ React.createElement(
174
- ActionIconBox,
120
+ "|"
121
+ ),
122
+ /* @__PURE__ */ React.createElement(
123
+ "div",
175
124
  {
176
- title: (locale == null ? void 0 : locale.download) || "下载",
177
- onClick: (e) => {
178
- var _a;
179
- e.stopPropagation();
180
- (_a = props.onDownload) == null ? void 0 : _a.call(props);
181
- },
182
125
  className: classNames(
183
- `${props.prefixCls}-action-btn`,
126
+ `${props.prefixCls}-file-size`,
184
127
  props.hashId
185
128
  )
186
129
  },
187
- /* @__PURE__ */ React.createElement(Download, { color: "var(--color-gray-text-secondary)" })
188
- ), props.renderMoreAction ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
189
- ActionIconBox,
130
+ kbToSize(file.size / 1024)
131
+ ),
132
+ /* @__PURE__ */ React.createElement(
133
+ "span",
190
134
  {
191
- title: "更多操作",
192
- onClick: (e) => {
193
- e.stopPropagation();
194
- },
195
135
  className: classNames(
196
- `${props.prefixCls}-action-btn`,
136
+ `${props.prefixCls}-separator`,
197
137
  props.hashId
198
138
  )
199
139
  },
200
- /* @__PURE__ */ React.createElement(
201
- EllipsisOutlined,
202
- {
203
- style: { color: "var(--color-gray-text-secondary)" }
140
+ "|"
141
+ ),
142
+ /* @__PURE__ */ React.createElement("div", null, (file == null ? void 0 : file.lastModified) ? dayjs(file == null ? void 0 : file.lastModified).format("HH:mm") : "")
143
+ )
144
+ ),
145
+ hovered ? /* @__PURE__ */ React.createElement(
146
+ "div",
147
+ {
148
+ className: classNames(
149
+ `${props.prefixCls}-action-bar`,
150
+ props.hashId
151
+ )
152
+ },
153
+ props.customSlot ? /* @__PURE__ */ React.createElement(
154
+ ActionIconBox,
155
+ {
156
+ title: "更多",
157
+ onClick: (e) => {
158
+ e.stopPropagation();
159
+ },
160
+ className: classNames(
161
+ `${props.prefixCls}-action-btn`,
162
+ props.hashId
163
+ )
164
+ },
165
+ typeof props.customSlot === "function" ? props.customSlot(file) : props.customSlot
166
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
167
+ ActionIconBox,
168
+ {
169
+ title: (locale == null ? void 0 : locale.preview) || "预览",
170
+ onClick: (e) => {
171
+ var _a2;
172
+ e.stopPropagation();
173
+ if (props.onPreview) {
174
+ (_a2 = props.onPreview) == null ? void 0 : _a2.call(props);
175
+ } else {
176
+ if (typeof window === "undefined")
177
+ return;
178
+ window.open(file.previewUrl || file.url, "_blank");
204
179
  }
180
+ },
181
+ className: classNames(
182
+ `${props.prefixCls}-action-btn`,
183
+ props.hashId
205
184
  )
206
- ), props.renderMoreAction ? /* @__PURE__ */ React.createElement(
185
+ },
186
+ /* @__PURE__ */ React.createElement(Eye, { color: "var(--color-gray-text-secondary)" })
187
+ ), props.onDownload && /* @__PURE__ */ React.createElement(
188
+ ActionIconBox,
189
+ {
190
+ title: (locale == null ? void 0 : locale.download) || "下载",
191
+ onClick: (e) => {
192
+ var _a2;
193
+ e.stopPropagation();
194
+ (_a2 = props.onDownload) == null ? void 0 : _a2.call(props);
195
+ },
196
+ className: classNames(
197
+ `${props.prefixCls}-action-btn`,
198
+ props.hashId
199
+ )
200
+ },
201
+ /* @__PURE__ */ React.createElement(Download, { color: "var(--color-gray-text-secondary)" })
202
+ ), props.renderMoreAction && /* @__PURE__ */ React.createElement(
203
+ ActionIconBox,
204
+ {
205
+ title: "更多操作",
206
+ onClick: (e) => {
207
+ e.stopPropagation();
208
+ },
209
+ className: classNames(
210
+ `${props.prefixCls}-action-btn`,
211
+ props.hashId
212
+ )
213
+ },
214
+ /* @__PURE__ */ React.createElement(
215
+ EllipsisVertical,
216
+ {
217
+ style: { color: "var(--color-gray-text-secondary)" }
218
+ }
219
+ ),
220
+ /* @__PURE__ */ React.createElement(
207
221
  "div",
208
222
  {
209
223
  className: classNames(
@@ -212,11 +226,11 @@ var FileMapViewItem = (props) => {
212
226
  )
213
227
  },
214
228
  props.renderMoreAction(file)
215
- ) : null) : null)
216
- ) : null
217
- )
218
- );
219
- }, [file, file.status, hovered, props.onPreview, props.onDownload]);
229
+ )
230
+ ))
231
+ ) : null
232
+ )
233
+ );
220
234
  };
221
235
  export {
222
236
  FileMapViewItem
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { AttachmentFile } from '../AttachmentButton/types';
3
3
  export type FileMapViewProps = {
4
+ /** 是否显示"查看更多"按钮 */
5
+ showMoreButton?: boolean;
4
6
  /** 文件映射表 */
5
7
  fileMap?: Map<string, AttachmentFile>;
6
8
  /** 预览文件回调 */
@@ -17,10 +19,8 @@ export type FileMapViewProps = {
17
19
  style?: React.CSSProperties;
18
20
  /** 自定义根容器类名 */
19
21
  className?: string;
20
- /** 最多展示的非图片文件数量,传入则开启溢出控制并在超出时显示"查看所有文件"按钮,不传则使用默认值3 */
22
+ /** 最多展示的非图片文件数量,传入则开启溢出控制并在超出时显示"查看所有文件"按钮,不传则展示所有文件且不显示按钮 */
21
23
  maxDisplayCount?: number;
22
- /** 是否显示"查看全部"按钮,当为 false 时忽略 maxDisplayCount 限制,显示所有文件 */
23
- showMoreButton?: boolean;
24
24
  placement?: 'left' | 'right';
25
25
  };
26
26
  /**
@@ -8,12 +8,11 @@ import { isImageFile } from "../AttachmentButton/utils";
8
8
  import { FileMapViewItem } from "./FileMapViewItem";
9
9
  import { useStyle } from "./style";
10
10
  var FileMapView = (props) => {
11
- var _a, _b;
11
+ var _a;
12
12
  const { placement = "left", showMoreButton = true } = props;
13
13
  const context = useContext(ConfigProvider.ConfigContext);
14
14
  const prefix = context == null ? void 0 : context.getPrefixCls("agentic-md-editor-file-view-list");
15
15
  const { wrapSSR, hashId } = useStyle(prefix);
16
- const maxDisplayCount = (_a = props.maxDisplayCount) != null ? _a : 3;
17
16
  const fileList = useMemo(() => {
18
17
  var _a2;
19
18
  if (!props.fileMap) {
@@ -21,25 +20,18 @@ var FileMapView = (props) => {
21
20
  }
22
21
  return Array.from(((_a2 = props.fileMap) == null ? void 0 : _a2.values()) || []);
23
22
  }, [props.fileMap]);
24
- const allImgFiles = useMemo(() => {
23
+ const imgList = useMemo(() => {
25
24
  return fileList.filter((file) => isImageFile(file));
26
25
  }, [fileList]);
27
26
  const allNoImageFiles = useMemo(() => {
28
27
  return fileList.filter((file) => !isImageFile(file));
29
28
  }, [fileList]);
30
- const imgList = useMemo(() => {
31
- if (!showMoreButton) {
32
- return allImgFiles;
33
- }
34
- return allImgFiles.slice(0, Math.max(0, maxDisplayCount));
35
- }, [allImgFiles, maxDisplayCount, showMoreButton]);
36
29
  const noImageFileList = useMemo(() => {
37
- if (!showMoreButton) {
30
+ if (props.maxDisplayCount === void 0) {
38
31
  return allNoImageFiles;
39
32
  }
40
- const remainingCount = Math.max(0, maxDisplayCount - imgList.length);
41
- return allNoImageFiles.slice(0, remainingCount);
42
- }, [allNoImageFiles, maxDisplayCount, imgList.length, showMoreButton]);
33
+ return allNoImageFiles.slice(0, Math.max(0, props.maxDisplayCount));
34
+ }, [allNoImageFiles, props.maxDisplayCount]);
43
35
  return wrapSSR(
44
36
  /* @__PURE__ */ React.createElement(
45
37
  "div",
@@ -138,20 +130,14 @@ var FileMapView = (props) => {
138
130
  FileMapViewItem,
139
131
  {
140
132
  style: { width: (_a2 = props.style) == null ? void 0 : _a2.width },
141
- onPreview: () => {
133
+ onPreview: props.onPreview ? () => {
142
134
  var _a3;
143
- if (props.onPreview) {
144
- (_a3 = props.onPreview) == null ? void 0 : _a3.call(props, file);
145
- return;
146
- }
147
- if (typeof window === "undefined")
148
- return;
149
- window.open(file.previewUrl || file.url, "_blank");
150
- },
151
- onDownload: () => {
135
+ (_a3 = props.onPreview) == null ? void 0 : _a3.call(props, file);
136
+ } : void 0,
137
+ onDownload: props.onDownload ? () => {
152
138
  var _a3;
153
139
  (_a3 = props.onDownload) == null ? void 0 : _a3.call(props, file);
154
- },
140
+ } : void 0,
155
141
  renderMoreAction: props.renderMoreAction,
156
142
  customSlot: props.customSlot,
157
143
  key: (file == null ? void 0 : file.uuid) || (file == null ? void 0 : file.name) || index,
@@ -162,10 +148,10 @@ var FileMapView = (props) => {
162
148
  }
163
149
  );
164
150
  }),
165
- showMoreButton && maxDisplayCount !== void 0 && fileList.length > maxDisplayCount ? /* @__PURE__ */ React.createElement(
151
+ showMoreButton && props.maxDisplayCount !== void 0 && allNoImageFiles.length > props.maxDisplayCount ? /* @__PURE__ */ React.createElement(
166
152
  "div",
167
153
  {
168
- style: { width: (_b = props.style) == null ? void 0 : _b.width },
154
+ style: { width: (_a = props.style) == null ? void 0 : _a.width },
169
155
  className: classNames(hashId, `${prefix}-more-file-container`),
170
156
  onClick: () => {
171
157
  var _a2;
@@ -199,7 +199,7 @@ var genStyle = (token) => {
199
199
  background: "var(--color-gray-bg-card-white)",
200
200
  boxSizing: "border-box",
201
201
  boxShadow: "var(--shadow-control-base)",
202
- borderRadius: "var(--radius-card-base)",
202
+ borderRadius: "var(--radius-base)",
203
203
  border: "none",
204
204
  overflow: "hidden",
205
205
  img: {
@@ -235,15 +235,20 @@ var genStyle = (token) => {
235
235
  lineHeight: "18px",
236
236
  fontFamily: token.fontFamily,
237
237
  gap: -1,
238
+ display: "flex",
239
+ overflow: "hidden",
238
240
  "&-text": {
239
241
  maxWidth: "160px",
240
- whiteSpace: "nowrap",
242
+ whiteSpace: "nowrap !important",
243
+ wordWrap: "normal",
244
+ wordBreak: "keep-all",
241
245
  width: "100%",
242
246
  overflow: "hidden",
243
247
  display: "inline-block",
244
248
  textOverflow: "ellipsis",
245
249
  height: 18,
246
- lineHeight: 1
250
+ lineHeight: 1,
251
+ verticalAlign: "top"
247
252
  }
248
253
  },
249
254
  "&-file-name-extension-container": {