@ant-design/agentic-ui 2.0.3 → 2.0.5

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.
@@ -23,4 +23,4 @@ export interface ToolUseBarItemProps {
23
23
  defaultExpanded?: boolean;
24
24
  light?: boolean;
25
25
  }
26
- export declare const ToolUseBarItem: React.FC<ToolUseBarItemProps>;
26
+ export declare const ToolUseBarItem: React.NamedExoticComponent<ToolUseBarItemProps>;
@@ -1,10 +1,15 @@
1
1
  // src/ToolUseBar/ToolUseBarItem.tsx
2
- import { Api, ChevronUp, X } from "@sofa-design/icons";
3
2
  import classnames from "classnames";
4
- import { motion } from "framer-motion";
5
3
  import { useMergedState } from "rc-util";
6
- import React, { useMemo } from "react";
7
- var ToolUseBarItem = ({
4
+ import React, { memo, useCallback, useMemo } from "react";
5
+ import {
6
+ ToolContent,
7
+ ToolExpand,
8
+ ToolHeaderRight,
9
+ ToolImage,
10
+ ToolTime
11
+ } from "./ToolUseBarItemComponents";
12
+ var ToolUseBarItemComponent = ({
8
13
  tool,
9
14
  prefixCls,
10
15
  hashId,
@@ -16,194 +21,116 @@ var ToolUseBarItem = ({
16
21
  defaultExpanded,
17
22
  light = false
18
23
  }) => {
19
- var _a, _b;
20
24
  const [expanded, setExpanded] = useMergedState(defaultExpanded != null ? defaultExpanded : false, {
21
25
  value: isExpanded,
22
26
  onChange: onExpandedChange ? (value) => onExpandedChange(tool.id, value) : void 0
23
27
  });
24
- const errorDom = useMemo(() => {
25
- return tool.status === "error" && tool.errorMessage ? /* @__PURE__ */ React.createElement("div", { className: classnames(`${prefixCls}-tool-content-error`, hashId) }, /* @__PURE__ */ React.createElement(
26
- "div",
27
- {
28
- className: classnames(`${prefixCls}-tool-content-error-icon`, hashId)
29
- },
30
- /* @__PURE__ */ React.createElement(X, null)
31
- ), /* @__PURE__ */ React.createElement(
32
- "div",
33
- {
34
- className: classnames(`${prefixCls}-tool-content-error-text`, hashId)
35
- },
36
- tool.errorMessage
37
- )) : null;
38
- }, [tool.status, tool.errorMessage, prefixCls, hashId]);
39
- const contentDom = useMemo(() => {
40
- return tool.content ? /* @__PURE__ */ React.createElement("div", { className: classnames(`${prefixCls}-tool-content`, hashId) }, tool.content) : null;
41
- }, [tool.content, prefixCls, hashId]);
42
28
  const showContent = useMemo(() => {
43
- return !!errorDom || !!contentDom;
44
- }, [errorDom, contentDom]);
45
- const handleClick = (e) => {
46
- onClick == null ? void 0 : onClick(tool.id);
47
- if (onActiveChange && !showContent) {
48
- onActiveChange(tool.id, !isActive);
49
- }
50
- if (!showContent)
51
- return;
52
- if (e.target instanceof Element) {
53
- const tag = e.target.tagName.toLowerCase();
54
- if (["a", "button", "input", "textarea", "select", "label"].includes(tag))
29
+ return !!(tool.status === "error" && tool.errorMessage) || !!tool.content;
30
+ }, [tool.status, tool.errorMessage, tool.content]);
31
+ const toolClassName = useMemo(() => {
32
+ return classnames(`${prefixCls}-tool ${hashId}`, {
33
+ [`${prefixCls}-tool-success`]: tool.status === "success",
34
+ [`${prefixCls}-tool-loading`]: tool.status === "loading",
35
+ [`${prefixCls}-tool-loading-light`]: tool.status === "loading" && light,
36
+ [`${prefixCls}-tool-error`]: tool.status === "error",
37
+ [`${prefixCls}-tool-idle`]: tool.status === "idle",
38
+ [`${prefixCls}-tool-active`]: isActive && !expanded,
39
+ [`${prefixCls}-tool-expanded`]: expanded,
40
+ [`${prefixCls}-tool-light`]: light
41
+ });
42
+ }, [prefixCls, hashId, tool.status, light, isActive, expanded]);
43
+ const toolBarClassName = useMemo(() => {
44
+ return classnames(`${prefixCls}-tool-bar`, hashId);
45
+ }, [prefixCls, hashId]);
46
+ const toolHeaderClassName = useMemo(() => {
47
+ return classnames(`${prefixCls}-tool-header`, hashId);
48
+ }, [prefixCls, hashId]);
49
+ const handleClick = useCallback(
50
+ (e) => {
51
+ onClick == null ? void 0 : onClick(tool.id);
52
+ if (onActiveChange && !showContent) {
53
+ onActiveChange(tool.id, !isActive);
54
+ }
55
+ if (!showContent)
55
56
  return;
56
- }
57
- setExpanded((prev) => !prev);
58
- };
59
- const handleExpandClick = (e) => {
60
- e.stopPropagation();
61
- setExpanded((prev) => !prev);
62
- };
57
+ if (e.target instanceof Element) {
58
+ const tag = e.target.tagName.toLowerCase();
59
+ if (["a", "button", "input", "textarea", "select", "label"].includes(tag))
60
+ return;
61
+ }
62
+ setExpanded((prev) => !prev);
63
+ },
64
+ [onClick, tool.id, onActiveChange, showContent, isActive, setExpanded]
65
+ );
66
+ const handleExpandClick = useCallback(
67
+ (e) => {
68
+ e.stopPropagation();
69
+ setExpanded((prev) => !prev);
70
+ },
71
+ [setExpanded]
72
+ );
63
73
  if (tool.type === "summary") {
64
74
  return /* @__PURE__ */ React.createElement(
65
- "div",
75
+ ToolContent,
66
76
  {
67
- className: classnames(`${prefixCls}-tool-container`, hashId),
68
- "data-testid": "tool-user-item-tool-container "
69
- },
70
- contentDom
77
+ tool,
78
+ prefixCls,
79
+ hashId,
80
+ light,
81
+ showContent: true,
82
+ expanded: true
83
+ }
71
84
  );
72
85
  }
73
- return /* @__PURE__ */ React.createElement(
86
+ return /* @__PURE__ */ React.createElement("div", { key: tool.id, "data-testid": "ToolUserItem", className: toolClassName }, /* @__PURE__ */ React.createElement(
74
87
  "div",
75
88
  {
76
- key: tool.id,
77
- "data-testid": "ToolUserItem",
78
- className: classnames(`${prefixCls}-tool ${hashId}`, {
79
- [`${prefixCls}-tool-success`]: tool.status === "success",
80
- [`${prefixCls}-tool-loading`]: tool.status === "loading",
81
- [`${prefixCls}-tool-loading-light`]: tool.status === "loading" && light,
82
- [`${prefixCls}-tool-error`]: tool.status === "error",
83
- [`${prefixCls}-tool-idle`]: tool.status === "idle",
84
- [`${prefixCls}-tool-active`]: isActive && !expanded,
85
- [`${prefixCls}-tool-expanded`]: expanded,
86
- [`${prefixCls}-tool-light`]: light
87
- })
89
+ className: toolBarClassName,
90
+ "data-testid": "tool-user-item-tool-bar",
91
+ onClick: handleClick
88
92
  },
89
93
  /* @__PURE__ */ React.createElement(
90
94
  "div",
91
95
  {
92
- className: classnames(`${prefixCls}-tool-bar`, hashId),
93
- "data-testid": "tool-user-item-tool-bar",
94
- onClick: (e) => {
95
- handleClick(e);
96
- }
96
+ className: toolHeaderClassName,
97
+ "data-testid": "tool-user-item-tool-header"
97
98
  },
98
- /* @__PURE__ */ React.createElement(
99
- "div",
100
- {
101
- className: classnames(`${prefixCls}-tool-header`, hashId),
102
- "data-testid": "tool-user-item-tool-header"
103
- },
104
- /* @__PURE__ */ React.createElement(
105
- motion.div,
106
- {
107
- className: classnames(`${prefixCls}-tool-image-wrapper`, hashId, {
108
- [`${prefixCls}-tool-image-wrapper-rotating`]: tool.status === "loading",
109
- [`${prefixCls}-tool-image-wrapper-loading`]: tool.status === "loading"
110
- }),
111
- animate: tool.status === "loading" ? {
112
- "--rotate": ["0deg", "360deg"]
113
- } : {},
114
- transition: tool.status === "loading" ? {
115
- "--rotate": {
116
- duration: 1,
117
- repeat: Infinity,
118
- ease: "linear"
119
- }
120
- } : {},
121
- style: {
122
- "--rotation": tool.status === "loading" ? "360deg" : "0deg"
123
- }
124
- },
125
- /* @__PURE__ */ React.createElement("div", { className: classnames(`${prefixCls}-tool-image`, hashId) }, tool.icon ? tool.icon : /* @__PURE__ */ React.createElement(Api, null))
126
- )
127
- ),
128
- /* @__PURE__ */ React.createElement(
129
- motion.div,
130
- {
131
- className: classnames(
132
- `${prefixCls}-tool-header-right`,
133
- {
134
- [`${prefixCls}-tool-header-right-light`]: light
135
- },
136
- hashId
137
- ),
138
- animate: tool.status === "loading" ? {
139
- maskImage: [
140
- "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%)",
141
- "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%)"
142
- ]
143
- } : {},
144
- transition: tool.status === "loading" ? {
145
- maskImage: {
146
- duration: 1,
147
- repeat: Infinity,
148
- ease: "linear"
149
- }
150
- } : {},
151
- style: {
152
- maskImage: tool.status === "loading" ? "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%)" : void 0
153
- }
154
- },
155
- tool.toolName && /* @__PURE__ */ React.createElement(
156
- "div",
157
- {
158
- className: classnames(`${prefixCls}-tool-name`, hashId, {
159
- [`${prefixCls}-tool-name-loading`]: tool.status === "loading"
160
- })
161
- },
162
- tool.toolName
163
- ),
164
- tool.toolTarget && /* @__PURE__ */ React.createElement(
165
- "div",
166
- {
167
- className: classnames(`${prefixCls}-tool-target`, hashId, {
168
- [`${prefixCls}-tool-target-loading`]: tool.status === "loading",
169
- [`${prefixCls}-tool-target-light`]: light
170
- }),
171
- title: (_b = (_a = tool.toolTarget) == null ? void 0 : _a.toString()) != null ? _b : void 0
172
- },
173
- tool.toolTarget
174
- )
175
- ),
176
- tool.time && /* @__PURE__ */ React.createElement("div", { className: classnames(`${prefixCls}-tool-time`, hashId) }, tool.time),
177
- showContent && /* @__PURE__ */ React.createElement(
178
- "div",
179
- {
180
- className: classnames(`${prefixCls}-tool-expand`, hashId),
181
- onClick: handleExpandClick
182
- },
183
- /* @__PURE__ */ React.createElement(
184
- ChevronUp,
185
- {
186
- style: {
187
- transition: "transform 0.3s ease-in-out",
188
- transform: expanded ? "rotate(180deg)" : "rotate(0deg)"
189
- }
190
- }
191
- )
192
- )
99
+ /* @__PURE__ */ React.createElement(ToolImage, { tool, prefixCls, hashId })
193
100
  ),
194
- showContent && expanded ? /* @__PURE__ */ React.createElement(
195
- "div",
101
+ /* @__PURE__ */ React.createElement(
102
+ ToolHeaderRight,
196
103
  {
197
- className: classnames(`${prefixCls}-tool-container`, hashId, {
198
- [`${prefixCls}-tool-container-light`]: light
199
- }),
200
- "data-testid": "tool-user-item-tool-container "
201
- },
202
- contentDom,
203
- errorDom
204
- ) : null
205
- );
104
+ tool,
105
+ prefixCls,
106
+ hashId,
107
+ light
108
+ }
109
+ ),
110
+ /* @__PURE__ */ React.createElement(ToolTime, { tool, prefixCls, hashId }),
111
+ /* @__PURE__ */ React.createElement(
112
+ ToolExpand,
113
+ {
114
+ showContent,
115
+ expanded,
116
+ prefixCls,
117
+ hashId,
118
+ onExpandClick: handleExpandClick
119
+ }
120
+ )
121
+ ), /* @__PURE__ */ React.createElement(
122
+ ToolContent,
123
+ {
124
+ tool,
125
+ prefixCls,
126
+ hashId,
127
+ light,
128
+ showContent,
129
+ expanded
130
+ }
131
+ ));
206
132
  };
133
+ var ToolUseBarItem = memo(ToolUseBarItemComponent);
207
134
  export {
208
135
  ToolUseBarItem
209
136
  };
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { ToolCall } from './ToolUseBarItem';
3
+ interface ToolImageProps {
4
+ tool: ToolCall;
5
+ prefixCls: string;
6
+ hashId: string;
7
+ }
8
+ export declare const ToolImage: React.NamedExoticComponent<ToolImageProps>;
9
+ interface ToolHeaderRightProps {
10
+ tool: ToolCall;
11
+ prefixCls: string;
12
+ hashId: string;
13
+ light: boolean;
14
+ }
15
+ export declare const ToolHeaderRight: React.NamedExoticComponent<ToolHeaderRightProps>;
16
+ interface ToolTimeProps {
17
+ tool: ToolCall;
18
+ prefixCls: string;
19
+ hashId: string;
20
+ }
21
+ export declare const ToolTime: React.NamedExoticComponent<ToolTimeProps>;
22
+ interface ToolExpandProps {
23
+ showContent: boolean;
24
+ expanded: boolean;
25
+ prefixCls: string;
26
+ hashId: string;
27
+ onExpandClick: (e: React.MouseEvent<HTMLDivElement>) => void;
28
+ }
29
+ export declare const ToolExpand: React.NamedExoticComponent<ToolExpandProps>;
30
+ interface ToolContentProps {
31
+ tool: ToolCall;
32
+ prefixCls: string;
33
+ hashId: string;
34
+ light: boolean;
35
+ showContent: boolean;
36
+ expanded: boolean;
37
+ }
38
+ export declare const ToolContent: React.NamedExoticComponent<ToolContentProps>;
39
+ export {};
@@ -0,0 +1,242 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+
18
+ // src/ToolUseBar/ToolUseBarItemComponents.tsx
19
+ import { Api, ChevronUp, X } from "@sofa-design/icons";
20
+ import classnames from "classnames";
21
+ import { motion } from "framer-motion";
22
+ import React, { memo, useCallback, useMemo } from "react";
23
+ var ToolImageComponent = ({
24
+ tool,
25
+ prefixCls,
26
+ hashId
27
+ }) => {
28
+ const toolImageWrapperClassName = useMemo(() => {
29
+ return classnames(`${prefixCls}-tool-image-wrapper`, hashId, {
30
+ [`${prefixCls}-tool-image-wrapper-rotating`]: tool.status === "loading",
31
+ [`${prefixCls}-tool-image-wrapper-loading`]: tool.status === "loading"
32
+ });
33
+ }, [prefixCls, hashId, tool.status]);
34
+ const toolImageClassName = useMemo(() => {
35
+ return classnames(`${prefixCls}-tool-image`, hashId);
36
+ }, [prefixCls, hashId]);
37
+ const loadingAnimationConfig = useMemo(
38
+ () => ({
39
+ animate: {
40
+ "--rotate": ["0deg", "360deg"]
41
+ },
42
+ transition: {
43
+ "--rotate": {
44
+ duration: 1,
45
+ repeat: Infinity,
46
+ ease: "linear"
47
+ }
48
+ },
49
+ style: {
50
+ "--rotation": "360deg"
51
+ }
52
+ }),
53
+ []
54
+ );
55
+ const idleAnimationConfig = useMemo(
56
+ () => ({
57
+ style: {
58
+ "--rotation": "0deg"
59
+ }
60
+ }),
61
+ []
62
+ );
63
+ const animationProps = useMemo(() => {
64
+ return tool.status === "loading" ? loadingAnimationConfig : idleAnimationConfig;
65
+ }, [tool.status, loadingAnimationConfig, idleAnimationConfig]);
66
+ const iconElement = useMemo(() => {
67
+ return tool.icon ? tool.icon : /* @__PURE__ */ React.createElement(Api, null);
68
+ }, [tool.icon]);
69
+ return /* @__PURE__ */ React.createElement(motion.div, __spreadValues({ className: toolImageWrapperClassName }, animationProps), /* @__PURE__ */ React.createElement("div", { className: toolImageClassName }, iconElement));
70
+ };
71
+ var ToolImage = memo(ToolImageComponent);
72
+ var ToolHeaderRightComponent = ({
73
+ tool,
74
+ prefixCls,
75
+ hashId,
76
+ light
77
+ }) => {
78
+ const toolHeaderRightClassName = useMemo(() => {
79
+ return classnames(
80
+ `${prefixCls}-tool-header-right`,
81
+ {
82
+ [`${prefixCls}-tool-header-right-light`]: light
83
+ },
84
+ hashId
85
+ );
86
+ }, [prefixCls, hashId, light]);
87
+ const toolNameClassName = useMemo(() => {
88
+ return classnames(`${prefixCls}-tool-name`, hashId, {
89
+ [`${prefixCls}-tool-name-loading`]: tool.status === "loading"
90
+ });
91
+ }, [prefixCls, hashId, tool.status]);
92
+ const toolTargetClassName = useMemo(() => {
93
+ return classnames(`${prefixCls}-tool-target`, hashId, {
94
+ [`${prefixCls}-tool-target-loading`]: tool.status === "loading",
95
+ [`${prefixCls}-tool-target-light`]: light
96
+ });
97
+ }, [prefixCls, hashId, tool.status, light]);
98
+ const loadingAnimationConfig = useMemo(
99
+ () => ({
100
+ animate: {
101
+ maskImage: [
102
+ "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%)",
103
+ "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%)"
104
+ ]
105
+ },
106
+ transition: {
107
+ maskImage: {
108
+ duration: 1,
109
+ repeat: Infinity,
110
+ ease: "linear"
111
+ }
112
+ },
113
+ style: {
114
+ 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%)"
115
+ }
116
+ }),
117
+ []
118
+ );
119
+ const animationProps = useMemo(() => {
120
+ return tool.status === "loading" ? loadingAnimationConfig : {};
121
+ }, [tool.status, loadingAnimationConfig]);
122
+ const toolNameElement = useMemo(() => {
123
+ return tool.toolName ? /* @__PURE__ */ React.createElement("div", { className: toolNameClassName }, tool.toolName) : null;
124
+ }, [tool.toolName, toolNameClassName]);
125
+ const toolTargetElement = useMemo(() => {
126
+ var _a, _b;
127
+ return tool.toolTarget ? /* @__PURE__ */ React.createElement(
128
+ "div",
129
+ {
130
+ className: toolTargetClassName,
131
+ title: (_b = (_a = tool.toolTarget) == null ? void 0 : _a.toString()) != null ? _b : void 0
132
+ },
133
+ tool.toolTarget
134
+ ) : null;
135
+ }, [tool.toolTarget, toolTargetClassName]);
136
+ return /* @__PURE__ */ React.createElement(motion.div, __spreadValues({ className: toolHeaderRightClassName }, animationProps), toolNameElement, toolTargetElement);
137
+ };
138
+ var ToolHeaderRight = memo(ToolHeaderRightComponent);
139
+ var ToolTimeComponent = ({
140
+ tool,
141
+ prefixCls,
142
+ hashId
143
+ }) => {
144
+ const toolTimeClassName = useMemo(() => {
145
+ return classnames(`${prefixCls}-tool-time`, hashId);
146
+ }, [prefixCls, hashId]);
147
+ const timeElement = useMemo(() => {
148
+ return tool.time ? /* @__PURE__ */ React.createElement("div", { className: toolTimeClassName }, tool.time) : null;
149
+ }, [tool.time, toolTimeClassName]);
150
+ return timeElement;
151
+ };
152
+ var ToolTime = memo(ToolTimeComponent);
153
+ var ToolExpandComponent = ({
154
+ showContent,
155
+ expanded,
156
+ prefixCls,
157
+ hashId,
158
+ onExpandClick
159
+ }) => {
160
+ const toolExpandClassName = useMemo(() => {
161
+ return classnames(`${prefixCls}-tool-expand`, hashId);
162
+ }, [prefixCls, hashId]);
163
+ const chevronStyle = useMemo(() => {
164
+ return {
165
+ transition: "transform 0.3s ease-in-out",
166
+ transform: expanded ? "rotate(180deg)" : "rotate(0deg)"
167
+ };
168
+ }, [expanded]);
169
+ const handleClick = useCallback(
170
+ (e) => {
171
+ onExpandClick(e);
172
+ },
173
+ [onExpandClick]
174
+ );
175
+ const expandElement = useMemo(() => {
176
+ if (!showContent)
177
+ return null;
178
+ return /* @__PURE__ */ React.createElement("div", { className: toolExpandClassName, onClick: handleClick }, /* @__PURE__ */ React.createElement(ChevronUp, { style: chevronStyle }));
179
+ }, [showContent, toolExpandClassName, handleClick, chevronStyle]);
180
+ return expandElement;
181
+ };
182
+ var ToolExpand = memo(ToolExpandComponent);
183
+ var ToolContentComponent = ({
184
+ tool,
185
+ prefixCls,
186
+ hashId,
187
+ light,
188
+ showContent,
189
+ expanded
190
+ }) => {
191
+ const toolContainerClassName = useMemo(() => {
192
+ return classnames(`${prefixCls}-tool-container`, hashId, {
193
+ [`${prefixCls}-tool-container-light`]: light
194
+ });
195
+ }, [prefixCls, hashId, light]);
196
+ const errorClassName = useMemo(() => {
197
+ return classnames(`${prefixCls}-tool-content-error`, hashId);
198
+ }, [prefixCls, hashId]);
199
+ const errorIconClassName = useMemo(() => {
200
+ return classnames(`${prefixCls}-tool-content-error-icon`, hashId);
201
+ }, [prefixCls, hashId]);
202
+ const errorTextClassName = useMemo(() => {
203
+ return classnames(`${prefixCls}-tool-content-error-text`, hashId);
204
+ }, [prefixCls, hashId]);
205
+ const contentClassName = useMemo(() => {
206
+ return classnames(`${prefixCls}-tool-content`, hashId);
207
+ }, [prefixCls, hashId]);
208
+ const errorDom = useMemo(() => {
209
+ return tool.status === "error" && tool.errorMessage ? /* @__PURE__ */ React.createElement("div", { className: errorClassName }, /* @__PURE__ */ React.createElement("div", { className: errorIconClassName }, /* @__PURE__ */ React.createElement(X, null)), /* @__PURE__ */ React.createElement("div", { className: errorTextClassName }, tool.errorMessage)) : null;
210
+ }, [
211
+ tool.status,
212
+ tool.errorMessage,
213
+ errorClassName,
214
+ errorIconClassName,
215
+ errorTextClassName
216
+ ]);
217
+ const contentDom = useMemo(() => {
218
+ return tool.content ? /* @__PURE__ */ React.createElement("div", { className: contentClassName }, tool.content) : null;
219
+ }, [tool.content, contentClassName]);
220
+ const containerElement = useMemo(() => {
221
+ if (!showContent || !expanded)
222
+ return null;
223
+ return /* @__PURE__ */ React.createElement(
224
+ "div",
225
+ {
226
+ className: toolContainerClassName,
227
+ "data-testid": "tool-user-item-tool-container "
228
+ },
229
+ contentDom,
230
+ errorDom
231
+ );
232
+ }, [showContent, expanded, toolContainerClassName, contentDom, errorDom]);
233
+ return containerElement;
234
+ };
235
+ var ToolContent = memo(ToolContentComponent);
236
+ export {
237
+ ToolContent,
238
+ ToolExpand,
239
+ ToolHeaderRight,
240
+ ToolImage,
241
+ ToolTime
242
+ };
@@ -45,4 +45,4 @@ export interface ToolUseBarThinkProps {
45
45
  floatingExpand?: React.CSSProperties;
46
46
  };
47
47
  }
48
- export declare const ToolUseBarThink: React.FC<ToolUseBarThinkProps>;
48
+ export declare const ToolUseBarThink: React.NamedExoticComponent<ToolUseBarThinkProps>;