@ant-design/agentic-ui 2.30.30 → 2.30.31

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 (50) hide show
  1. package/dist/Bubble/AIBubble.js +6 -3
  2. package/dist/Bubble/List/PureBubbleList.js +22 -1
  3. package/dist/Bubble/List/index.js +7 -5
  4. package/dist/Bubble/MessagesContent/BubbleExtra.js +4 -2
  5. package/dist/Components/ActionIconBox/index.js +8 -8
  6. package/dist/Hooks/useLanguage.d.ts +1 -0
  7. package/dist/I18n/locales.d.ts +1 -0
  8. package/dist/I18n/locales.js +2 -0
  9. package/dist/MarkdownEditor/editor/parser/parse/parseHtml.js +15 -6
  10. package/dist/MarkdownEditor/style.js +0 -4
  11. package/dist/MarkdownInputField/SendButton/index.d.ts +2 -2
  12. package/dist/MarkdownInputField/SendButton/index.js +44 -26
  13. package/dist/MarkdownInputField/SendButton/sendButtonPalette.d.ts +36 -0
  14. package/dist/MarkdownInputField/SendButton/sendButtonPalette.js +247 -0
  15. package/dist/MarkdownInputField/SendButton/style.js +3 -3
  16. package/dist/MarkdownInputField/style.js +3 -1
  17. package/dist/MarkdownRenderer/AnimationText.js +1 -2
  18. package/dist/MarkdownRenderer/CharacterQueue.js +3 -0
  19. package/dist/MarkdownRenderer/MarkdownRenderer.js +5 -18
  20. package/dist/MarkdownRenderer/markdownReactShared.d.ts +2 -1
  21. package/dist/MarkdownRenderer/markdownReactShared.js +57 -19
  22. package/dist/MarkdownRenderer/streaming/MarkdownBlockPiece.js +14 -10
  23. package/dist/MarkdownRenderer/streaming/fenceTracker.d.ts +7 -0
  24. package/dist/MarkdownRenderer/streaming/fenceTracker.js +28 -0
  25. package/dist/MarkdownRenderer/streaming/lastBlockThrottle.js +3 -1
  26. package/dist/MarkdownRenderer/streaming/useShallowMemo.d.ts +1 -0
  27. package/dist/MarkdownRenderer/streaming/useShallowMemo.js +36 -0
  28. package/dist/MarkdownRenderer/streaming/useStreamingMarkdownReact.js +6 -3
  29. package/dist/MarkdownRenderer/useStreaming.js +43 -41
  30. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +2 -0
  31. package/dist/TaskList/TaskList.js +25 -13
  32. package/dist/TaskList/constants.d.ts +1 -1
  33. package/dist/TaskList/constants.js +9 -4
  34. package/dist/TaskList/style.js +29 -11
  35. package/dist/ToolUseBarThink/index.d.ts +0 -23
  36. package/dist/ToolUseBarThink/index.js +178 -315
  37. package/dist/ToolUseBarThink/style.js +64 -48
  38. package/dist/Types/quicklink.d.ts +1 -1
  39. package/dist/Workspace/File/FileTree/FileTreeComponent.d.ts +4 -0
  40. package/dist/Workspace/File/FileTree/FileTreeComponent.js +283 -0
  41. package/dist/Workspace/File/FileTree/index.d.ts +2 -0
  42. package/dist/Workspace/File/FileTree/index.js +1 -0
  43. package/dist/Workspace/File/FileTree/style.d.ts +8 -0
  44. package/dist/Workspace/File/FileTree/style.js +80 -0
  45. package/dist/Workspace/File/index.d.ts +2 -1
  46. package/dist/Workspace/File/index.js +1 -0
  47. package/dist/Workspace/index.d.ts +4 -2
  48. package/dist/Workspace/index.js +73 -36
  49. package/dist/Workspace/types.d.ts +70 -2
  50. package/package.json +2 -1
@@ -6,9 +6,6 @@ function _array_like_to_array(arr, len) {
6
6
  function _array_with_holes(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
- function _array_without_holes(arr) {
10
- if (Array.isArray(arr)) return _array_like_to_array(arr);
11
- }
12
9
  function _define_property(obj, key, value) {
13
10
  if (key in obj) {
14
11
  Object.defineProperty(obj, key, {
@@ -22,9 +19,6 @@ function _define_property(obj, key, value) {
22
19
  }
23
20
  return obj;
24
21
  }
25
- function _iterable_to_array(iter) {
26
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
27
- }
28
22
  function _iterable_to_array_limit(arr, i) {
29
23
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
30
24
  if (_i == null) return;
@@ -52,30 +46,9 @@ function _iterable_to_array_limit(arr, i) {
52
46
  function _non_iterable_rest() {
53
47
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
54
48
  }
55
- function _non_iterable_spread() {
56
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
57
- }
58
- function _object_spread(target) {
59
- for(var i = 1; i < arguments.length; i++){
60
- var source = arguments[i] != null ? arguments[i] : {};
61
- var ownKeys = Object.keys(source);
62
- if (typeof Object.getOwnPropertySymbols === "function") {
63
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
64
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
65
- }));
66
- }
67
- ownKeys.forEach(function(key) {
68
- _define_property(target, key, source[key]);
69
- });
70
- }
71
- return target;
72
- }
73
49
  function _sliced_to_array(arr, i) {
74
50
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
75
51
  }
76
- function _to_consumable_array(arr) {
77
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
78
- }
79
52
  function _unsupported_iterable_to_array(o, minLen) {
80
53
  if (!o) return;
81
54
  if (typeof o === "string") return _array_like_to_array(o, minLen);
@@ -87,141 +60,92 @@ function _unsupported_iterable_to_array(o, minLen) {
87
60
  import { Brain, ChevronDown, ChevronsDownUp, ChevronsUpDown } from "@sofa-design/icons";
88
61
  import { ConfigProvider } from "antd";
89
62
  import classNames from "clsx";
90
- import { motion } from "framer-motion";
91
63
  import { useMergedState } from "rc-util";
92
64
  import React, { memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
93
65
  import { useRefFunction } from "../Hooks/useRefFunction";
94
66
  import { useLocale } from "../I18n";
95
67
  import { useStyle } from "./style";
96
- var getChevronStyle = function getChevronStyle(expanded) {
97
- return {
98
- transform: expanded ? 'rotate(0deg)' : 'rotate(-90deg)',
99
- transition: 'transform 0.2s'
100
- };
101
- };
68
+ if (typeof CSS !== 'undefined' && CSS.registerProperty) {
69
+ try {
70
+ CSS.registerProperty({
71
+ name: '--think-rotate',
72
+ syntax: '<angle>',
73
+ inherits: true,
74
+ initialValue: '0deg'
75
+ });
76
+ } catch (unused) {
77
+ // already registered
78
+ }
79
+ }
102
80
  var FLOATING_ICON_STYLE = {
103
81
  fontSize: 16,
104
82
  color: 'var(--color-gray-text-light)'
105
83
  };
106
- /** 内容超出此高度时自动收起 */ var CONTENT_COLLAPSE_THRESHOLD = 200;
107
- var LOADING_ANIMATION = {
108
- animate: {
109
- '--rotate': [
110
- '0deg',
111
- '360deg'
112
- ]
113
- },
114
- transition: {
115
- '--rotate': {
116
- duration: 1,
117
- repeat: Infinity,
118
- ease: 'linear'
119
- }
120
- },
121
- style: {
122
- '--rotation': '360deg'
123
- }
124
- };
125
- var IDLE_ANIMATION = {
126
- animate: {},
127
- transition: {},
128
- style: {
129
- '--rotation': '0deg'
130
- }
131
- };
132
- var HEADER_RIGHT_LOADING_ANIMATION = {
133
- animate: {
134
- maskImage: [
135
- 'linear-gradient(to right, rgba(0,0,0,0.99) -50%, rgba(0,0,0,0.15) -50%,rgba(0,0,0,0.99) 150%)',
136
- 'linear-gradient(to right, rgba(0,0,0,0.99) -50%, rgba(0,0,0,0.15) 150%,rgba(0,0,0,0.99) 150%)'
137
- ]
138
- },
139
- transition: {
140
- maskImage: {
141
- duration: 1,
142
- repeat: Infinity,
143
- ease: 'linear'
144
- }
145
- },
146
- style: {
147
- maskImage: 'linear-gradient(to right, rgba(0,0,0,0.99) -30%, rgba(0,0,0,0.15) -50%, rgba(0,0,0,0.99) 120%)'
148
- }
84
+ var CONTENT_COLLAPSE_THRESHOLD = 200;
85
+ var CHEVRON_EXPANDED = {
86
+ transform: 'rotate(0deg)',
87
+ transition: 'transform 0.2s'
149
88
  };
150
- var buildClassName = function buildClassName() {
151
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
152
- args[_key] = arguments[_key];
153
- }
154
- return classNames.apply(void 0, _to_consumable_array(args));
89
+ var CHEVRON_COLLAPSED = {
90
+ transform: 'rotate(-90deg)',
91
+ transition: 'transform 0.2s'
155
92
  };
156
- var LightModeIcon = function LightModeIcon(param) {
157
- var prefixCls = param.prefixCls, hashId = param.hashId, hover = param.hover, expandedState = param.expandedState;
158
- var iconClassName = buildClassName("".concat(prefixCls, "-header-left-icon"), "".concat(prefixCls, "-header-left-icon-light"), hashId);
159
- var chevronStyle = getChevronStyle(expandedState);
160
- var icon = hover ? /*#__PURE__*/ React.createElement(ChevronDown, {
161
- style: chevronStyle
162
- }) : /*#__PURE__*/ React.createElement(Brain, null);
163
- return /*#__PURE__*/ React.createElement("div", {
164
- className: iconClassName
165
- }, icon);
93
+ var CONTENT_CLAMPED_STYLE = {
94
+ maxHeight: CONTENT_COLLAPSE_THRESHOLD,
95
+ overflow: 'hidden'
166
96
  };
167
- var HeaderContent = function HeaderContent(param) {
168
- var toolName = param.toolName, toolTarget = param.toolTarget, prefixCls = param.prefixCls, hashId = param.hashId, light = param.light, customClassNames = param.classNames, styles = param.styles;
169
- var nameClassName = buildClassName("".concat(prefixCls, "-name"), _define_property({}, "".concat(prefixCls, "-name-light"), light), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.name);
170
- var targetClassName = buildClassName("".concat(prefixCls, "-target"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.target);
171
- return /*#__PURE__*/ React.createElement(React.Fragment, null, toolName && /*#__PURE__*/ React.createElement("div", {
172
- className: nameClassName,
173
- style: styles === null || styles === void 0 ? void 0 : styles.name
174
- }, toolName), toolTarget ? /*#__PURE__*/ React.createElement("div", {
175
- className: targetClassName,
176
- style: styles === null || styles === void 0 ? void 0 : styles.target
177
- }, toolTarget) : /*#__PURE__*/ React.createElement("div", null));
97
+ var CONTAINER_STYLE = {
98
+ overflow: 'hidden'
178
99
  };
179
- var TimeElement = function TimeElement(param) {
180
- var time = param.time, prefixCls = param.prefixCls, hashId = param.hashId, customClassNames = param.classNames, styles = param.styles;
181
- if (!time) return null;
182
- var timeClassName = buildClassName("".concat(prefixCls, "-time"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.time);
183
- return /*#__PURE__*/ React.createElement("div", {
184
- className: timeClassName,
185
- style: styles === null || styles === void 0 ? void 0 : styles.time
186
- }, time);
187
- };
188
- var ExpandButton = function ExpandButton(param) {
189
- var thinkContent = param.thinkContent, light = param.light, expandedState = param.expandedState, prefixCls = param.prefixCls, hashId = param.hashId, customClassNames = param.classNames, styles = param.styles, onToggleExpand = param.onToggleExpand;
190
- if (!thinkContent || light) return null;
191
- var expandClassName = buildClassName("".concat(prefixCls, "-expand"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.expand);
192
- var expandIcon = expandedState ? /*#__PURE__*/ React.createElement(ChevronsDownUp, null) : /*#__PURE__*/ React.createElement(ChevronsUpDown, null);
193
- return /*#__PURE__*/ React.createElement("div", {
194
- className: expandClassName,
195
- onClick: onToggleExpand,
196
- style: styles === null || styles === void 0 ? void 0 : styles.expand
197
- }, expandIcon);
198
- };
199
- var ThinkContainer = function ThinkContainer(param) {
200
- var thinkContent = param.thinkContent, expandedState = param.expandedState, floatingExpandedState = param.floatingExpandedState, status = param.status, light = param.light, prefixCls = param.prefixCls, hashId = param.hashId, customClassNames = param.classNames, styles = param.styles, onToggleFloatingExpand = param.onToggleFloatingExpand;
100
+ var ToolUseBarThinkComponent = function ToolUseBarThinkComponent(param) {
101
+ var toolName = param.toolName, toolTarget = param.toolTarget, time = param.time, icon = param.icon, thinkContent = param.thinkContent, status = param.status, testId = param.testId, expanded = param.expanded, _param_defaultExpanded = param.defaultExpanded, defaultExpanded = _param_defaultExpanded === void 0 ? false : _param_defaultExpanded, onExpandedChange = param.onExpandedChange, floatingExpanded = param.floatingExpanded, _param_defaultFloatingExpanded = param.defaultFloatingExpanded, defaultFloatingExpanded = _param_defaultFloatingExpanded === void 0 ? false : _param_defaultFloatingExpanded, onFloatingExpandedChange = param.onFloatingExpandedChange, customClassNames = param.classNames, styles = param.styles, _param_light = param.light, light = _param_light === void 0 ? false : _param_light;
102
+ var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
103
+ var prefixCls = getPrefixCls('agentic-tool-use-bar-think');
104
+ var _useStyle = useStyle(prefixCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
201
105
  var locale = useLocale();
202
- var contentInnerRef = useRef(null);
203
- var _useState = _sliced_to_array(useState(false), 2), isContentOverflowing = _useState[0], setIsContentOverflowing = _useState[1];
204
- var _useState1 = _sliced_to_array(useState(false), 2), contentExpanded = _useState1[0], setContentExpanded = _useState1[1];
205
- var _obj;
206
- var containerClassName = buildClassName("".concat(prefixCls, "-container"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.container, (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-container-expanded"), expandedState), _define_property(_obj, "".concat(prefixCls, "-container-loading"), status === 'loading' && !floatingExpandedState), _define_property(_obj, "".concat(prefixCls, "-container-light"), light), _define_property(_obj, "".concat(prefixCls, "-container-floating-expanded"), floatingExpandedState), _obj));
207
- var contentClassName = buildClassName("".concat(prefixCls, "-content"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.content);
208
- var floatingExpandClassName = buildClassName("".concat(prefixCls, "-floating-expand"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.floatingExpand);
209
- var contentExpandClassName = buildClassName("".concat(prefixCls, "-content-expand"), hashId);
210
- var floatingIcon = floatingExpandedState ? /*#__PURE__*/ React.createElement(ChevronsDownUp, {
211
- style: FLOATING_ICON_STYLE
212
- }) : /*#__PURE__*/ React.createElement(ChevronsUpDown, {
213
- style: FLOATING_ICON_STYLE
106
+ var _useMergedState = _sliced_to_array(useMergedState(defaultExpanded, {
107
+ value: expanded,
108
+ onChange: onExpandedChange
109
+ }), 2), expandedState = _useMergedState[0], setExpandedState = _useMergedState[1];
110
+ var _useMergedState1 = _sliced_to_array(useMergedState(defaultFloatingExpanded, {
111
+ value: floatingExpanded,
112
+ onChange: onFloatingExpandedChange
113
+ }), 2), floatingExpandedState = _useMergedState1[0], setFloatingExpandedState = _useMergedState1[1];
114
+ var _useState = _sliced_to_array(useState(false), 2), hover = _useState[0], setHover = _useState[1];
115
+ var onMouseMove = useCallback(function() {
116
+ return setHover(true);
117
+ }, []);
118
+ var onMouseLeave = useCallback(function() {
119
+ return setHover(false);
120
+ }, []);
121
+ var handleToggleExpand = useRefFunction(function() {
122
+ setExpandedState(!expandedState);
123
+ });
124
+ var handleToggleFloatingExpand = useRefFunction(function() {
125
+ setFloatingExpandedState(!floatingExpandedState);
214
126
  });
215
- var floatingText = floatingExpandedState ? locale.collapse : locale.expand;
216
- var showFloatingExpand = status === 'loading' && !light;
127
+ var isLoading = status === 'loading';
128
+ useEffect(function() {
129
+ if (isLoading) {
130
+ setExpandedState(true);
131
+ }
132
+ }, [
133
+ isLoading,
134
+ setExpandedState
135
+ ]);
136
+ // --- Container overflow detection ---
137
+ // Only active when expanded AND not loading (overflow UI is hidden during loading)
138
+ var contentInnerRef = useRef(null);
139
+ var _useState1 = _sliced_to_array(useState(false), 2), isContentOverflowing = _useState1[0], setIsContentOverflowing = _useState1[1];
140
+ var _useState2 = _sliced_to_array(useState(false), 2), contentExpanded = _useState2[0], setContentExpanded = _useState2[1];
141
+ var needOverflowCheck = expandedState && !isLoading && !!thinkContent;
217
142
  var checkOverflow = useCallback(function() {
218
143
  var el = contentInnerRef.current;
219
144
  if (!el) return;
220
- var scrollHeight = el.scrollHeight;
221
- setIsContentOverflowing(scrollHeight > CONTENT_COLLAPSE_THRESHOLD);
145
+ setIsContentOverflowing(el.scrollHeight > CONTENT_COLLAPSE_THRESHOLD);
222
146
  }, []);
223
147
  useEffect(function() {
224
- if (!expandedState || !thinkContent) return;
148
+ if (!needOverflowCheck) return;
225
149
  checkOverflow();
226
150
  var el = contentInnerRef.current;
227
151
  if (!el) return;
@@ -231,8 +155,7 @@ var ThinkContainer = function ThinkContainer(param) {
231
155
  return observer.disconnect();
232
156
  };
233
157
  }, [
234
- expandedState,
235
- thinkContent,
158
+ needOverflowCheck,
236
159
  checkOverflow
237
160
  ]);
238
161
  var handleContentExpandToggle = useRefFunction(function() {
@@ -240,195 +163,135 @@ var ThinkContainer = function ThinkContainer(param) {
240
163
  return !prev;
241
164
  });
242
165
  });
243
- var showContentExpand = expandedState && thinkContent && status !== 'loading' && isContentOverflowing;
166
+ var showContentExpand = needOverflowCheck && isContentOverflowing;
167
+ var showFloatingExpand = isLoading && !light;
244
168
  var contentInnerStyle = useMemo(function() {
245
- if (!showContentExpand) return undefined;
246
- if (contentExpanded) return undefined;
247
- return {
248
- maxHeight: CONTENT_COLLAPSE_THRESHOLD,
249
- overflow: 'hidden'
250
- };
169
+ return showContentExpand && !contentExpanded ? CONTENT_CLAMPED_STYLE : undefined;
251
170
  }, [
252
171
  showContentExpand,
253
172
  contentExpanded
254
173
  ]);
255
- var contentExpandButton = useMemo(function() {
256
- if (!showContentExpand) return null;
257
- var icon = contentExpanded ? /*#__PURE__*/ React.createElement(ChevronsDownUp, null) : /*#__PURE__*/ React.createElement(ChevronsUpDown, null);
258
- var text = contentExpanded ? locale.collapse : locale.expand;
259
- return /*#__PURE__*/ React.createElement("div", {
260
- className: contentExpandClassName,
261
- onClick: handleContentExpandToggle,
262
- "data-testid": "tool-use-bar-think-content-expand",
263
- role: "button",
264
- tabIndex: 0,
265
- onKeyDown: function onKeyDown(e) {
266
- if (e.key === 'Enter' || e.key === ' ') {
267
- e.preventDefault();
268
- handleContentExpandToggle();
269
- }
270
- }
271
- }, icon, text);
272
- }, [
273
- showContentExpand,
274
- contentExpanded,
275
- contentExpandClassName,
276
- handleContentExpandToggle,
277
- locale
278
- ]);
279
- var innerContent = /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
280
- ref: contentInnerRef,
281
- style: contentInnerStyle
282
- }, /*#__PURE__*/ React.createElement("div", {
283
- className: contentClassName,
284
- style: styles === null || styles === void 0 ? void 0 : styles.content
285
- }, thinkContent)), contentExpandButton, showFloatingExpand ? /*#__PURE__*/ React.createElement("div", {
286
- className: floatingExpandClassName,
287
- onClick: onToggleFloatingExpand,
288
- "data-testid": "tool-use-bar-think-floating-expand",
289
- style: styles === null || styles === void 0 ? void 0 : styles.floatingExpand
290
- }, floatingIcon, floatingText) : null);
291
- // 收起时不渲染 thinkContent,无动画避免展开/收起卡顿
292
- if (expandedState) {
293
- return /*#__PURE__*/ React.createElement("div", {
294
- className: containerClassName,
295
- "data-testid": "tool-use-bar-think-container",
296
- style: {
297
- overflow: 'hidden'
298
- }
299
- }, innerContent);
300
- }
301
- if (showFloatingExpand) {
302
- return /*#__PURE__*/ React.createElement("div", {
303
- className: floatingExpandClassName,
304
- onClick: onToggleFloatingExpand,
305
- "data-testid": "tool-use-bar-think-floating-expand",
306
- style: styles === null || styles === void 0 ? void 0 : styles.floatingExpand
307
- }, floatingIcon, floatingText);
308
- }
309
- return null;
310
- };
311
- /**
312
- * ToolUseBarThink 组件
313
- *
314
- * 用于显示工具使用过程中的思考内容和状态
315
- *
316
- * @example
317
- * ```tsx
318
- * <ToolUseBarThink
319
- * toolName="思考"
320
- * toolTarget="分析问题"
321
- * status="loading"
322
- * thinkContent={<div>思考内容...</div>}
323
- * />
324
- * ```
325
- */ var ToolUseBarThinkComponent = function ToolUseBarThinkComponent(param) {
326
- var toolName = param.toolName, toolTarget = param.toolTarget, time = param.time, icon = param.icon, thinkContent = param.thinkContent, status = param.status, testId = param.testId, expanded = param.expanded, _param_defaultExpanded = param.defaultExpanded, defaultExpanded = _param_defaultExpanded === void 0 ? false : _param_defaultExpanded, onExpandedChange = param.onExpandedChange, floatingExpanded = param.floatingExpanded, _param_defaultFloatingExpanded = param.defaultFloatingExpanded, defaultFloatingExpanded = _param_defaultFloatingExpanded === void 0 ? false : _param_defaultFloatingExpanded, onFloatingExpandedChange = param.onFloatingExpandedChange, customClassNames = param.classNames, styles = param.styles, _param_light = param.light, light = _param_light === void 0 ? false : _param_light;
327
- var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
328
- var prefixCls = getPrefixCls('agentic-tool-use-bar-think');
329
- var _useStyle = useStyle(prefixCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
330
- var _useMergedState = _sliced_to_array(useMergedState(defaultExpanded, {
331
- value: expanded,
332
- onChange: onExpandedChange
333
- }), 2), expandedState = _useMergedState[0], setExpandedState = _useMergedState[1];
334
- var _useMergedState1 = _sliced_to_array(useMergedState(defaultFloatingExpanded, {
335
- value: floatingExpanded,
336
- onChange: onFloatingExpandedChange
337
- }), 2), floatingExpandedState = _useMergedState1[0], setFloatingExpandedState = _useMergedState1[1];
338
- var _React_useState = _sliced_to_array(React.useState(false), 2), hover = _React_useState[0], setHover = _React_useState[1];
339
- var handleToggleExpand = useRefFunction(function() {
340
- setExpandedState(!expandedState);
341
- });
342
- var handleToggleFloatingExpand = useRefFunction(function() {
343
- setFloatingExpandedState(!floatingExpandedState);
344
- });
345
- useEffect(function() {
346
- if (status === 'loading') {
347
- setExpandedState(true);
348
- }
174
+ // --- Class names (memoized) ---
175
+ var cls = useMemo(function() {
176
+ var _obj;
177
+ var root = classNames(prefixCls, hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.root, (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-expanded"), !expandedState), _define_property(_obj, "".concat(prefixCls, "-loading"), isLoading), _define_property(_obj, "".concat(prefixCls, "-active"), expandedState), _define_property(_obj, "".concat(prefixCls, "-success"), status === 'success'), _define_property(_obj, "".concat(prefixCls, "-light"), light), _obj));
178
+ var bar = classNames("".concat(prefixCls, "-bar"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.bar);
179
+ var header = classNames("".concat(prefixCls, "-header"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.header, _define_property({}, "".concat(prefixCls, "-header-light"), light));
180
+ var imageWrapper = classNames("".concat(prefixCls, "-image-wrapper"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.imageWrapper, _define_property({}, "".concat(prefixCls, "-image-wrapper-loading"), isLoading));
181
+ var headerRight = classNames("".concat(prefixCls, "-header-right"), hashId, _define_property({}, "".concat(prefixCls, "-header-right-loading"), isLoading));
182
+ var name = classNames("".concat(prefixCls, "-name"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.name, _define_property({}, "".concat(prefixCls, "-name-light"), light));
183
+ var _obj1;
184
+ var container = classNames("".concat(prefixCls, "-container"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.container, (_obj1 = {}, _define_property(_obj1, "".concat(prefixCls, "-container-expanded"), expandedState), _define_property(_obj1, "".concat(prefixCls, "-container-loading"), isLoading && !floatingExpandedState), _define_property(_obj1, "".concat(prefixCls, "-container-light"), light), _define_property(_obj1, "".concat(prefixCls, "-container-floating-expanded"), floatingExpandedState), _obj1));
185
+ var content = classNames("".concat(prefixCls, "-content"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.content, _define_property({}, "".concat(prefixCls, "-content-light"), light));
186
+ var floatingExpand = classNames("".concat(prefixCls, "-floating-expand"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.floatingExpand);
187
+ var target = classNames("".concat(prefixCls, "-target"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.target);
188
+ var timeEl = classNames("".concat(prefixCls, "-time"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.time);
189
+ var expand = classNames("".concat(prefixCls, "-expand"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.expand);
190
+ var contentExpand = classNames("".concat(prefixCls, "-content-expand"), hashId);
191
+ var lightIcon = classNames("".concat(prefixCls, "-header-left-icon"), "".concat(prefixCls, "-header-left-icon-light"), hashId);
192
+ return {
193
+ root: root,
194
+ bar: bar,
195
+ header: header,
196
+ imageWrapper: imageWrapper,
197
+ headerRight: headerRight,
198
+ name: name,
199
+ container: container,
200
+ content: content,
201
+ floatingExpand: floatingExpand,
202
+ target: target,
203
+ time: timeEl,
204
+ expand: expand,
205
+ contentExpand: contentExpand,
206
+ lightIcon: lightIcon
207
+ };
349
208
  }, [
209
+ prefixCls,
210
+ hashId,
211
+ customClassNames,
212
+ expandedState,
213
+ isLoading,
350
214
  status,
351
- setExpandedState
215
+ light,
216
+ floatingExpandedState
352
217
  ]);
353
- var _obj;
354
- var rootClassName = buildClassName(prefixCls, hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.root, (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-expanded"), !expandedState), _define_property(_obj, "".concat(prefixCls, "-loading"), status === 'loading'), _define_property(_obj, "".concat(prefixCls, "-active"), expandedState), _define_property(_obj, "".concat(prefixCls, "-success"), status === 'success'), _define_property(_obj, "".concat(prefixCls, "-light"), light), _obj));
355
- var barClassName = buildClassName("".concat(prefixCls, "-bar"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.bar);
356
- var headerClassName = buildClassName("".concat(prefixCls, "-header"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.header, _define_property({}, "".concat(prefixCls, "-header-light"), light));
357
- var headerLeftClassName = buildClassName("".concat(prefixCls, "-header-left"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.headerLeft);
358
- var imageAnimationProps = status === 'loading' ? LOADING_ANIMATION : IDLE_ANIMATION;
359
- var headerRightAnimation = status === 'loading' ? HEADER_RIGHT_LOADING_ANIMATION : {};
360
- var _obj1;
361
- var imageWrapperClassName = buildClassName("".concat(prefixCls, "-image-wrapper"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.imageWrapper, (_obj1 = {}, _define_property(_obj1, "".concat(prefixCls, "-image-wrapper-rotating"), status === 'loading'), _define_property(_obj1, "".concat(prefixCls, "-image-wrapper-loading"), status === 'loading'), _obj1));
362
- var imageClassName = buildClassName("".concat(prefixCls, "-image"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.image);
363
- var headerRightClassName = buildClassName("".concat(prefixCls, "-header-right"), hashId);
364
218
  return wrapSSR(/*#__PURE__*/ React.createElement("div", {
365
219
  "data-testid": testId || 'ToolUseBarThink',
366
- className: rootClassName,
220
+ className: cls.root,
367
221
  style: styles === null || styles === void 0 ? void 0 : styles.root
368
222
  }, /*#__PURE__*/ React.createElement("div", {
369
- className: barClassName,
223
+ className: cls.bar,
370
224
  "data-testid": "tool-use-bar-think-bar",
371
225
  style: styles === null || styles === void 0 ? void 0 : styles.bar,
372
226
  onClick: handleToggleExpand
373
227
  }, /*#__PURE__*/ React.createElement("div", {
374
- className: headerClassName,
228
+ className: cls.header,
375
229
  "data-testid": "tool-use-bar-think-header",
376
230
  style: styles === null || styles === void 0 ? void 0 : styles.header,
377
- onMouseMove: function onMouseMove() {
378
- return setHover(true);
379
- },
380
- onMouseLeave: function onMouseLeave() {
381
- return setHover(false);
382
- }
231
+ onMouseMove: onMouseMove,
232
+ onMouseLeave: onMouseLeave
233
+ }, light ? /*#__PURE__*/ React.createElement("div", {
234
+ className: cls.lightIcon
235
+ }, hover ? /*#__PURE__*/ React.createElement(ChevronDown, {
236
+ style: expandedState ? CHEVRON_EXPANDED : CHEVRON_COLLAPSED
237
+ }) : /*#__PURE__*/ React.createElement(Brain, null)) : /*#__PURE__*/ React.createElement("div", {
238
+ className: cls.imageWrapper,
239
+ style: styles === null || styles === void 0 ? void 0 : styles.imageWrapper
240
+ }, icon || /*#__PURE__*/ React.createElement(Brain, null)), /*#__PURE__*/ React.createElement("div", {
241
+ className: cls.headerRight
242
+ }, toolName && /*#__PURE__*/ React.createElement("div", {
243
+ className: cls.name,
244
+ style: styles === null || styles === void 0 ? void 0 : styles.name
245
+ }, toolName), toolTarget && /*#__PURE__*/ React.createElement("div", {
246
+ className: cls.target,
247
+ style: styles === null || styles === void 0 ? void 0 : styles.target
248
+ }, toolTarget))), time && /*#__PURE__*/ React.createElement("div", {
249
+ className: cls.time,
250
+ style: styles === null || styles === void 0 ? void 0 : styles.time
251
+ }, time), thinkContent && !light && /*#__PURE__*/ React.createElement("div", {
252
+ className: cls.expand,
253
+ onClick: handleToggleExpand,
254
+ style: styles === null || styles === void 0 ? void 0 : styles.expand
255
+ }, expandedState ? /*#__PURE__*/ React.createElement(ChevronsDownUp, null) : /*#__PURE__*/ React.createElement(ChevronsUpDown, null))), thinkContent && expandedState && /*#__PURE__*/ React.createElement("div", {
256
+ className: cls.container,
257
+ "data-testid": "tool-use-bar-think-container",
258
+ style: CONTAINER_STYLE
259
+ }, /*#__PURE__*/ React.createElement("div", {
260
+ ref: contentInnerRef,
261
+ style: contentInnerStyle
383
262
  }, /*#__PURE__*/ React.createElement("div", {
384
- className: headerLeftClassName,
385
- style: styles === null || styles === void 0 ? void 0 : styles.headerLeft
386
- }, light ? /*#__PURE__*/ React.createElement(LightModeIcon, {
387
- prefixCls: prefixCls,
388
- hashId: hashId,
389
- hover: hover,
390
- expandedState: expandedState
391
- }) : /*#__PURE__*/ React.createElement(motion.div, _object_spread({
392
- className: imageWrapperClassName
393
- }, imageAnimationProps), icon || /*#__PURE__*/ React.createElement("div", {
394
- className: imageClassName,
395
- style: styles === null || styles === void 0 ? void 0 : styles.image
396
- }, /*#__PURE__*/ React.createElement(Brain, null)))), /*#__PURE__*/ React.createElement(motion.div, _object_spread({
397
- className: headerRightClassName
398
- }, headerRightAnimation), /*#__PURE__*/ React.createElement(HeaderContent, {
399
- toolName: toolName,
400
- toolTarget: toolTarget,
401
- prefixCls: prefixCls,
402
- hashId: hashId,
403
- light: light,
404
- classNames: customClassNames,
405
- styles: styles
406
- }))), /*#__PURE__*/ React.createElement(TimeElement, {
407
- time: time,
408
- prefixCls: prefixCls,
409
- hashId: hashId,
410
- classNames: customClassNames,
411
- styles: styles
412
- }), /*#__PURE__*/ React.createElement(ExpandButton, {
413
- thinkContent: thinkContent,
414
- light: light,
415
- expandedState: expandedState,
416
- prefixCls: prefixCls,
417
- hashId: hashId,
418
- classNames: customClassNames,
419
- styles: styles,
420
- onToggleExpand: handleToggleExpand
421
- })), thinkContent ? /*#__PURE__*/ React.createElement(ThinkContainer, {
422
- thinkContent: thinkContent,
423
- expandedState: expandedState,
424
- floatingExpandedState: floatingExpandedState,
425
- status: status,
426
- light: light,
427
- prefixCls: prefixCls,
428
- hashId: hashId,
429
- classNames: customClassNames,
430
- styles: styles,
431
- onToggleFloatingExpand: handleToggleFloatingExpand
432
- }) : null));
263
+ className: cls.content,
264
+ style: styles === null || styles === void 0 ? void 0 : styles.content
265
+ }, thinkContent)), showContentExpand && /*#__PURE__*/ React.createElement("div", {
266
+ className: cls.contentExpand,
267
+ onClick: handleContentExpandToggle,
268
+ "data-testid": "tool-use-bar-think-content-expand",
269
+ role: "button",
270
+ tabIndex: 0,
271
+ onKeyDown: function onKeyDown(e) {
272
+ if (e.key === 'Enter' || e.key === ' ') {
273
+ e.preventDefault();
274
+ handleContentExpandToggle();
275
+ }
276
+ }
277
+ }, contentExpanded ? /*#__PURE__*/ React.createElement(ChevronsDownUp, null) : /*#__PURE__*/ React.createElement(ChevronsUpDown, null), contentExpanded ? locale.collapse : locale.expand), showFloatingExpand && /*#__PURE__*/ React.createElement("div", {
278
+ className: cls.floatingExpand,
279
+ onClick: handleToggleFloatingExpand,
280
+ "data-testid": "tool-use-bar-think-floating-expand",
281
+ style: styles === null || styles === void 0 ? void 0 : styles.floatingExpand
282
+ }, floatingExpandedState ? /*#__PURE__*/ React.createElement(ChevronsDownUp, {
283
+ style: FLOATING_ICON_STYLE
284
+ }) : /*#__PURE__*/ React.createElement(ChevronsUpDown, {
285
+ style: FLOATING_ICON_STYLE
286
+ }), floatingExpandedState ? locale.collapse : locale.expand)), thinkContent && !expandedState && showFloatingExpand && /*#__PURE__*/ React.createElement("div", {
287
+ className: cls.floatingExpand,
288
+ onClick: handleToggleFloatingExpand,
289
+ "data-testid": "tool-use-bar-think-floating-expand",
290
+ style: styles === null || styles === void 0 ? void 0 : styles.floatingExpand
291
+ }, floatingExpandedState ? /*#__PURE__*/ React.createElement(ChevronsDownUp, {
292
+ style: FLOATING_ICON_STYLE
293
+ }) : /*#__PURE__*/ React.createElement(ChevronsUpDown, {
294
+ style: FLOATING_ICON_STYLE
295
+ }), floatingExpandedState ? locale.collapse : locale.expand)));
433
296
  };
434
297
  export var ToolUseBarThink = /*#__PURE__*/ memo(ToolUseBarThinkComponent);