@ant-design/agentic-ui 2.0.18 → 2.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Bubble/FileView.js +4 -3
- package/dist/Bubble/type.d.ts +2 -2
- package/dist/ChatBootPage/ButtonTabStyle.js +2 -2
- package/dist/ChatBootPage/CaseReply.d.ts +10 -2
- package/dist/ChatBootPage/CaseReply.js +20 -2
- package/dist/ChatBootPage/CaseReplyStyle.js +51 -9
- package/dist/Components/ActionIconBox/index.js +102 -46
- package/dist/Components/Button/ToggleButton/index.js +3 -3
- package/dist/Components/Button/ToggleButton/style.js +1 -1
- package/dist/Components/GradientText/index.d.ts +8 -0
- package/dist/Components/GradientText/index.js +32 -0
- package/dist/Components/GradientText/style.d.ts +5 -0
- package/dist/Components/GradientText/style.js +76 -0
- package/dist/Components/TextAnimate/index.d.ts +56 -0
- package/dist/Components/TextAnimate/index.js +388 -0
- package/dist/Components/TextAnimate/style.d.ts +5 -0
- package/dist/Components/TextAnimate/style.js +53 -0
- package/dist/Components/TypingAnimation/index.d.ts +19 -0
- package/dist/Components/TypingAnimation/index.js +182 -0
- package/dist/Components/TypingAnimation/style.d.ts +5 -0
- package/dist/Components/TypingAnimation/style.js +59 -0
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +1 -1
- package/dist/MarkdownEditor/editor/plugins/withMarkdown.js +42 -0
- package/dist/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.js +6 -32
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/index.js +5 -3
- package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +1 -1
- package/dist/MarkdownInputField/FileMapView/FileMapViewItem.d.ts +2 -2
- package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +166 -152
- package/dist/MarkdownInputField/FileMapView/index.d.ts +5 -5
- package/dist/MarkdownInputField/FileMapView/index.js +48 -35
- package/dist/MarkdownInputField/FileMapView/style.js +17 -9
- package/dist/MarkdownInputField/MarkdownInputField.js +159 -209
- package/dist/MarkdownInputField/QuickActions/index.js +6 -0
- package/dist/MarkdownInputField/VoiceInput/index.js +2 -1
- package/dist/MarkdownInputField/style.js +4 -55
- package/dist/WelcomeMessage/index.d.ts +12 -2
- package/dist/WelcomeMessage/index.js +40 -4
- package/dist/WelcomeMessage/style.js +1 -0
- package/dist/Workspace/File/FileComponent.js +23 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/package.json +4 -4
package/dist/Bubble/FileView.js
CHANGED
|
@@ -64,11 +64,12 @@ var BubbleFileView = ({
|
|
|
64
64
|
showMoreButton: config.showMoreButton,
|
|
65
65
|
onPreview: createEventHandler(eventOverrides.onPreview),
|
|
66
66
|
onDownload: createEventHandler(eventOverrides.onDownload),
|
|
67
|
-
onViewAll: eventOverrides.onViewAll ? () => {
|
|
67
|
+
onViewAll: eventOverrides.onViewAll ? (files) => {
|
|
68
68
|
var _a;
|
|
69
|
-
|
|
69
|
+
(_a = eventOverrides.onViewAll) == null ? void 0 : _a.call(eventOverrides, files);
|
|
70
|
+
return false;
|
|
70
71
|
} : void 0,
|
|
71
|
-
renderMoreAction: (file) => renderMoreAction(config.renderFileMoreAction, file),
|
|
72
|
+
renderMoreAction: config.renderFileMoreAction ? (file) => renderMoreAction(config.renderFileMoreAction, file) : void 0,
|
|
72
73
|
customSlot: config.customSlot,
|
|
73
74
|
placement,
|
|
74
75
|
fileMap: originData.fileMap,
|
package/dist/Bubble/type.d.ts
CHANGED
|
@@ -479,14 +479,14 @@ export interface BubbleProps<T = Record<string, any>> extends BubbleItemStylePro
|
|
|
479
479
|
* @description 与示例中的 fileViewConfig 对齐:控制样式与更多按钮、数量等
|
|
480
480
|
*/
|
|
481
481
|
fileViewConfig?: {
|
|
482
|
-
/** 是否展示每个文件项的“更多”按钮 */
|
|
483
|
-
showMoreButton?: boolean;
|
|
484
482
|
/** 自定义根容器 className */
|
|
485
483
|
className?: string;
|
|
486
484
|
/** 自定义根容器样式 */
|
|
487
485
|
style?: React.CSSProperties;
|
|
488
486
|
/** 最大展示条目数(默认 3) */
|
|
489
487
|
maxDisplayCount?: number;
|
|
488
|
+
/** 是否显示"查看更多"按钮 */
|
|
489
|
+
showMoreButton?: boolean;
|
|
490
490
|
/** 自定义悬浮动作区 */
|
|
491
491
|
customSlot?: React.ReactNode | ((file: AttachmentFile) => React.ReactNode);
|
|
492
492
|
/**
|
|
@@ -71,8 +71,8 @@ var genStyle = (token) => {
|
|
|
71
71
|
fontSize: "16px",
|
|
72
72
|
lineHeight: 1,
|
|
73
73
|
marginLeft: "6px",
|
|
74
|
-
paddingLeft: "
|
|
75
|
-
borderLeft: "1px solid var(--color-gray-
|
|
74
|
+
paddingLeft: "8px",
|
|
75
|
+
borderLeft: "1px solid var(--color-gray-border-light)",
|
|
76
76
|
"&-clickable": {
|
|
77
77
|
cursor: "pointer",
|
|
78
78
|
"&:hover": {
|
|
@@ -21,11 +21,19 @@ export interface CaseReplyProps {
|
|
|
21
21
|
*/
|
|
22
22
|
description?: React.ReactNode;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* 按钮文本(悬停时显示的按钮文字)
|
|
25
|
+
*/
|
|
26
|
+
buttonText?: string;
|
|
27
|
+
/**
|
|
28
|
+
* 自定义按钮栏内容(优先于 buttonText)
|
|
25
29
|
*/
|
|
26
30
|
buttonBar?: React.ReactNode;
|
|
27
31
|
/**
|
|
28
|
-
*
|
|
32
|
+
* 按钮点击事件
|
|
33
|
+
*/
|
|
34
|
+
onButtonClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
35
|
+
/**
|
|
36
|
+
* 点击卡片事件
|
|
29
37
|
*/
|
|
30
38
|
onClick?: () => void;
|
|
31
39
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/ChatBootPage/CaseReply.tsx
|
|
2
|
+
import { ArrowRight } from "@sofa-design/icons";
|
|
2
3
|
import { ConfigProvider } from "antd";
|
|
3
4
|
import classNames from "classnames";
|
|
4
5
|
import React, { useContext, useState } from "react";
|
|
@@ -9,14 +10,19 @@ var CaseReply = ({
|
|
|
9
10
|
quote,
|
|
10
11
|
title,
|
|
11
12
|
description,
|
|
13
|
+
buttonText = "查看回放",
|
|
12
14
|
buttonBar,
|
|
15
|
+
onButtonClick,
|
|
13
16
|
onClick,
|
|
14
17
|
style,
|
|
15
18
|
className,
|
|
16
19
|
prefixCls: customPrefixCls
|
|
17
20
|
}) => {
|
|
18
21
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
19
|
-
const prefixCls = getPrefixCls(
|
|
22
|
+
const prefixCls = getPrefixCls(
|
|
23
|
+
"agentic-chatboot-case-reply",
|
|
24
|
+
customPrefixCls
|
|
25
|
+
);
|
|
20
26
|
const { wrapSSR, hashId } = useStyle(prefixCls);
|
|
21
27
|
const [isHovered, setIsHovered] = useState(false);
|
|
22
28
|
const containerCls = classNames(prefixCls, hashId, className);
|
|
@@ -36,6 +42,7 @@ var CaseReply = ({
|
|
|
36
42
|
hashId,
|
|
37
43
|
isHovered && `${prefixCls}-button-bar-visible`
|
|
38
44
|
);
|
|
45
|
+
const arrowIconCls = classNames(`${prefixCls}-arrow-icon`, hashId);
|
|
39
46
|
const handleMouseEnter = () => {
|
|
40
47
|
setIsHovered(true);
|
|
41
48
|
};
|
|
@@ -96,7 +103,18 @@ var CaseReply = ({
|
|
|
96
103
|
)
|
|
97
104
|
)), quote && /* @__PURE__ */ React.createElement("div", { className: quoteTextCls }, quote))
|
|
98
105
|
),
|
|
99
|
-
/* @__PURE__ */ React.createElement("div", { className: bottomCls }, title && /* @__PURE__ */ React.createElement("h3", { className: titleCls }, title), description && /* @__PURE__ */ React.createElement("p", { className: descriptionCls }, description), buttonBar && /* @__PURE__ */ React.createElement("div", { className: buttonBarCls }, buttonBar
|
|
106
|
+
/* @__PURE__ */ React.createElement("div", { className: bottomCls }, title && /* @__PURE__ */ React.createElement("h3", { className: titleCls }, title), description && /* @__PURE__ */ React.createElement("p", { className: descriptionCls }, description), (buttonBar || buttonText) && /* @__PURE__ */ React.createElement("div", { className: buttonBarCls }, buttonBar || /* @__PURE__ */ React.createElement(
|
|
107
|
+
"button",
|
|
108
|
+
{
|
|
109
|
+
type: "button",
|
|
110
|
+
onClick: (e) => {
|
|
111
|
+
e.stopPropagation();
|
|
112
|
+
onButtonClick == null ? void 0 : onButtonClick(e);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
buttonText,
|
|
116
|
+
/* @__PURE__ */ React.createElement("span", { className: arrowIconCls }, /* @__PURE__ */ React.createElement(ArrowRight, null))
|
|
117
|
+
)))
|
|
100
118
|
)
|
|
101
119
|
);
|
|
102
120
|
};
|
|
@@ -46,7 +46,7 @@ var genStyle = (token) => {
|
|
|
46
46
|
WebkitMaskImage: "-webkit-linear-gradient(to bottom, black 0%, black 60%, transparent 100%)",
|
|
47
47
|
maskImage: "linear-gradient(to bottom, black 0%, black 60%, transparent 100%)",
|
|
48
48
|
width: "100%",
|
|
49
|
-
height:
|
|
49
|
+
height: 166,
|
|
50
50
|
display: "flex",
|
|
51
51
|
alignItems: "center",
|
|
52
52
|
justifyContent: "center"
|
|
@@ -54,9 +54,9 @@ var genStyle = (token) => {
|
|
|
54
54
|
// coverContent 白色子卡片
|
|
55
55
|
"&-cover-content": {
|
|
56
56
|
width: "80%",
|
|
57
|
-
marginTop: "
|
|
58
|
-
|
|
59
|
-
borderRadius: "
|
|
57
|
+
marginTop: "32px",
|
|
58
|
+
height: 124,
|
|
59
|
+
borderRadius: "var(--radius-modal-base)",
|
|
60
60
|
boxShadow: "0px 0px 1px 0px rgba(71, 98, 234, 0.05), 0px 6px 16px 0px rgba(71, 98, 234, 0.12)",
|
|
61
61
|
background: "#ffffff",
|
|
62
62
|
padding: "16px",
|
|
@@ -74,13 +74,12 @@ var genStyle = (token) => {
|
|
|
74
74
|
marginBottom: "8px",
|
|
75
75
|
"& svg": {
|
|
76
76
|
width: "24px",
|
|
77
|
-
height: "24px"
|
|
78
|
-
transform: "rotate(180deg)"
|
|
77
|
+
height: "24px"
|
|
79
78
|
}
|
|
80
79
|
},
|
|
81
80
|
// 引用文字
|
|
82
81
|
"&-quote-text": {
|
|
83
|
-
fontSize: "
|
|
82
|
+
fontSize: "15px",
|
|
84
83
|
fontWeight: 400,
|
|
85
84
|
lineHeight: "20px",
|
|
86
85
|
color: "var(--color-gray-text-light)",
|
|
@@ -124,14 +123,57 @@ var genStyle = (token) => {
|
|
|
124
123
|
left: "16px",
|
|
125
124
|
right: "16px",
|
|
126
125
|
marginBottom: 0,
|
|
127
|
-
background: "linear-gradient(to right,
|
|
126
|
+
background: "linear-gradient(to right, #ffffff00 0%, #ffffff 40%)",
|
|
128
127
|
borderRadius: "4px",
|
|
129
128
|
padding: "8px",
|
|
130
129
|
width: "auto",
|
|
131
130
|
opacity: 0,
|
|
132
131
|
transform: "translateY(10px)",
|
|
133
132
|
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
134
|
-
pointerEvents: "none"
|
|
133
|
+
pointerEvents: "none",
|
|
134
|
+
// buttonBar 内的按钮样式
|
|
135
|
+
"& button": {
|
|
136
|
+
backgroundColor: "#000000",
|
|
137
|
+
color: "#ffffff",
|
|
138
|
+
borderRadius: "36px",
|
|
139
|
+
padding: "8px 16px",
|
|
140
|
+
cursor: "pointer",
|
|
141
|
+
border: "none",
|
|
142
|
+
fontSize: "14px",
|
|
143
|
+
transition: "all 0.2s ease-in-out",
|
|
144
|
+
display: "inline-flex",
|
|
145
|
+
alignItems: "center",
|
|
146
|
+
gap: "8px",
|
|
147
|
+
"&:hover": {
|
|
148
|
+
backgroundColor: "#333333",
|
|
149
|
+
transform: "translateY(-2px)"
|
|
150
|
+
},
|
|
151
|
+
"&:active": {
|
|
152
|
+
transform: "translateY(0)"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
// 箭头图标
|
|
157
|
+
"&-arrow-icon": {
|
|
158
|
+
width: "18px",
|
|
159
|
+
height: "18px",
|
|
160
|
+
borderRadius: "200px",
|
|
161
|
+
background: "#FFFFFF",
|
|
162
|
+
color: "var(--color-primary-text-secondary)",
|
|
163
|
+
display: "inline-flex",
|
|
164
|
+
alignItems: "center",
|
|
165
|
+
justifyContent: "center",
|
|
166
|
+
flexShrink: 0,
|
|
167
|
+
transition: "transform 300ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
168
|
+
transform: "translateX(0)",
|
|
169
|
+
"& svg": {
|
|
170
|
+
width: "12px",
|
|
171
|
+
height: "12px"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
// 按钮悬停时箭头动画
|
|
175
|
+
"&-button-bar button:hover &-arrow-icon": {
|
|
176
|
+
transform: "translateX(4px)"
|
|
135
177
|
},
|
|
136
178
|
// buttonBar 显示状态
|
|
137
179
|
"&-button-bar-visible": {
|
|
@@ -60,54 +60,98 @@ var ActionIconBox = (props) => {
|
|
|
60
60
|
}, []);
|
|
61
61
|
const icon = useMemo(() => {
|
|
62
62
|
var _a2, _b2, _c2;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
63
|
+
if (loading) {
|
|
64
|
+
return /* @__PURE__ */ React.createElement(LoadingOutlined, { style: props.iconStyle });
|
|
65
|
+
}
|
|
66
|
+
if (React.isValidElement(props.children)) {
|
|
67
|
+
try {
|
|
68
|
+
return React.cloneElement(props.children, __spreadProps(__spreadValues({}, (_a2 = props == null ? void 0 : props.children) == null ? void 0 : _a2.props), {
|
|
69
|
+
style: __spreadValues(__spreadValues({}, (_c2 = (_b2 = props == null ? void 0 : props.children) == null ? void 0 : _b2.props) == null ? void 0 : _c2.style), props.iconStyle)
|
|
70
|
+
}));
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error("ActionIconBox: 克隆元素时出错", error);
|
|
73
|
+
return props.children;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
return React.Children.map(props.children, (child) => {
|
|
78
|
+
var _a3;
|
|
79
|
+
if (React.isValidElement(child)) {
|
|
80
|
+
return React.cloneElement(child, __spreadProps(__spreadValues({}, child == null ? void 0 : child.props), {
|
|
81
|
+
style: __spreadValues(__spreadValues({}, (_a3 = child == null ? void 0 : child.props) == null ? void 0 : _a3.style), props.iconStyle)
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
return child;
|
|
85
|
+
});
|
|
86
|
+
} catch (error) {
|
|
87
|
+
console.error("ActionIconBox: 处理子元素时出错", error);
|
|
88
|
+
return props.children;
|
|
89
|
+
}
|
|
90
|
+
}, [loading, props.loading, props.iconStyle, props.children]);
|
|
67
91
|
return wrapSSR(
|
|
68
|
-
props.title ? /* @__PURE__ */ React.createElement(
|
|
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
|
-
setLoading(false);
|
|
95
|
-
}),
|
|
96
|
-
onKeyDown: (e) => {
|
|
97
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
92
|
+
props.title ? /* @__PURE__ */ React.createElement(
|
|
93
|
+
Tooltip,
|
|
94
|
+
__spreadValues({
|
|
95
|
+
title: props.title,
|
|
96
|
+
arrow: false,
|
|
97
|
+
mouseEnterDelay: 2
|
|
98
|
+
}, props.tooltipProps),
|
|
99
|
+
/* @__PURE__ */ React.createElement(
|
|
100
|
+
"span",
|
|
101
|
+
{
|
|
102
|
+
"data-title": (_a = props.title) == null ? void 0 : _a.toString(),
|
|
103
|
+
"data-testid": props["data-testid"] || "action-icon-box",
|
|
104
|
+
role: "button",
|
|
105
|
+
tabIndex: 0,
|
|
106
|
+
"aria-label": (_b = props.title) == null ? void 0 : _b.toString(),
|
|
107
|
+
className: cx(prefixCls, hashId, props.className, {
|
|
108
|
+
[`${prefixCls}-danger`]: props.type === "danger",
|
|
109
|
+
[`${prefixCls}-primary`]: props.type === "primary",
|
|
110
|
+
[`${prefixCls}-border-less`]: props.borderLess,
|
|
111
|
+
[`${prefixCls}-active`]: props.active,
|
|
112
|
+
[`${prefixCls}-transform`]: props.transform,
|
|
113
|
+
[`${prefixCls}-${props.theme || "light"}`]: props.theme || "light",
|
|
114
|
+
[`${prefixCls}-noPadding`]: props.noPadding
|
|
115
|
+
}),
|
|
116
|
+
onClick: (e) => __async(void 0, null, function* () {
|
|
117
|
+
var _a2;
|
|
98
118
|
e.preventDefault();
|
|
99
119
|
if (!props.onClick)
|
|
100
120
|
return;
|
|
101
121
|
if (loading)
|
|
102
122
|
return;
|
|
103
|
-
|
|
104
|
-
|
|
123
|
+
setLoading(true);
|
|
124
|
+
try {
|
|
125
|
+
yield (_a2 = props.onClick) == null ? void 0 : _a2.call(props, e);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
console.error("ActionIconBox onClick 错误:", error);
|
|
128
|
+
} finally {
|
|
129
|
+
setLoading(false);
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
132
|
+
onKeyDown: (e) => __async(void 0, null, function* () {
|
|
133
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
if (!props.onClick)
|
|
136
|
+
return;
|
|
137
|
+
if (loading)
|
|
138
|
+
return;
|
|
139
|
+
setLoading(true);
|
|
140
|
+
try {
|
|
141
|
+
yield props.onClick(e);
|
|
142
|
+
} catch (error) {
|
|
143
|
+
console.error("ActionIconBox onKeyDown 错误:", error);
|
|
144
|
+
} finally {
|
|
145
|
+
setLoading(false);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}),
|
|
149
|
+
style: props.style
|
|
105
150
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
)) : /* @__PURE__ */ React.createElement(
|
|
151
|
+
icon,
|
|
152
|
+
props.showTitle && /* @__PURE__ */ React.createElement("span", { className: `${prefixCls}-title ${hashId}` }, props.title)
|
|
153
|
+
)
|
|
154
|
+
) : /* @__PURE__ */ React.createElement(
|
|
111
155
|
"span",
|
|
112
156
|
{
|
|
113
157
|
"data-testid": props["data-testid"] || "action-icon-box",
|
|
@@ -132,19 +176,31 @@ var ActionIconBox = (props) => {
|
|
|
132
176
|
if (loading)
|
|
133
177
|
return;
|
|
134
178
|
setLoading(true);
|
|
135
|
-
|
|
136
|
-
|
|
179
|
+
try {
|
|
180
|
+
yield (_a2 = props.onClick) == null ? void 0 : _a2.call(props, e);
|
|
181
|
+
} catch (error) {
|
|
182
|
+
console.error("ActionIconBox onClick 错误:", error);
|
|
183
|
+
} finally {
|
|
184
|
+
setLoading(false);
|
|
185
|
+
}
|
|
137
186
|
}),
|
|
138
|
-
onKeyDown: (e) => {
|
|
187
|
+
onKeyDown: (e) => __async(void 0, null, function* () {
|
|
139
188
|
if (e.key === "Enter" || e.key === " ") {
|
|
140
189
|
e.preventDefault();
|
|
141
190
|
if (!props.onClick)
|
|
142
191
|
return;
|
|
143
192
|
if (loading)
|
|
144
193
|
return;
|
|
145
|
-
|
|
194
|
+
setLoading(true);
|
|
195
|
+
try {
|
|
196
|
+
yield props.onClick(e);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
console.error("ActionIconBox onKeyDown 错误:", error);
|
|
199
|
+
} finally {
|
|
200
|
+
setLoading(false);
|
|
201
|
+
}
|
|
146
202
|
}
|
|
147
|
-
},
|
|
203
|
+
}),
|
|
148
204
|
style: props.style
|
|
149
205
|
},
|
|
150
206
|
icon,
|
|
@@ -50,9 +50,9 @@ var ToggleButton = ({
|
|
|
50
50
|
boxShadow: "none"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
icon && /* @__PURE__ */ React.createElement("span", { className: `${prefixCls}-icon
|
|
54
|
-
children && /* @__PURE__ */ React.createElement("span", { className: `${prefixCls}-text
|
|
55
|
-
triggerIcon && /* @__PURE__ */ React.createElement("span", { className: `${prefixCls}-trigger-icon
|
|
53
|
+
icon && /* @__PURE__ */ React.createElement("span", { className: classNames(`${prefixCls}-icon`, hashId) }, icon),
|
|
54
|
+
children && /* @__PURE__ */ React.createElement("span", { className: classNames(`${prefixCls}-text`, hashId) }, children),
|
|
55
|
+
triggerIcon && /* @__PURE__ */ React.createElement("span", { className: classNames(`${prefixCls}-trigger-icon`, hashId) }, triggerIcon)
|
|
56
56
|
)
|
|
57
57
|
)
|
|
58
58
|
)
|
|
@@ -248,7 +248,6 @@ var genStyle = (token) => {
|
|
|
248
248
|
whiteSpace: "nowrap",
|
|
249
249
|
overflow: "hidden",
|
|
250
250
|
textOverflow: "ellipsis",
|
|
251
|
-
marginRight: "8px",
|
|
252
251
|
font: "var(--font-text-body-base)",
|
|
253
252
|
letterSpacing: "var(--letter-spacing-body-base, normal)",
|
|
254
253
|
color: "var(--color-gray-text-default)"
|
|
@@ -258,6 +257,7 @@ var genStyle = (token) => {
|
|
|
258
257
|
display: "inline-flex",
|
|
259
258
|
alignItems: "center",
|
|
260
259
|
justifyContent: "center",
|
|
260
|
+
color: "var(--color-gray-text-light)",
|
|
261
261
|
fontSize: "inherit",
|
|
262
262
|
lineHeight: 1
|
|
263
263
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface GradientTextProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
colors?: string[];
|
|
6
|
+
animationSpeed?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function GradientText({ children, className, colors, animationSpeed, }: GradientTextProps): React.JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/Components/GradientText/index.tsx
|
|
2
|
+
import { ConfigProvider } from "antd";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import React, { useContext } from "react";
|
|
5
|
+
import { useGradientTextStyle } from "./style";
|
|
6
|
+
function GradientText({
|
|
7
|
+
children,
|
|
8
|
+
className = "",
|
|
9
|
+
colors = ["#40ffaa", "#4079ff", "#40ffaa", "#4079ff", "#40ffaa"],
|
|
10
|
+
animationSpeed = 8
|
|
11
|
+
}) {
|
|
12
|
+
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
13
|
+
const prefixCls = getPrefixCls("gradient-text");
|
|
14
|
+
const { wrapSSR, hashId } = useGradientTextStyle(prefixCls);
|
|
15
|
+
const gradientStyle = {
|
|
16
|
+
backgroundImage: `linear-gradient(to right, ${colors.join(", ")})`,
|
|
17
|
+
animationDuration: `${animationSpeed}s`
|
|
18
|
+
};
|
|
19
|
+
return wrapSSR(
|
|
20
|
+
/* @__PURE__ */ React.createElement("div", { className: classNames(prefixCls, hashId, className) }, /* @__PURE__ */ React.createElement(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
className: classNames(`${prefixCls}-text-content`, hashId),
|
|
24
|
+
style: gradientStyle
|
|
25
|
+
},
|
|
26
|
+
children
|
|
27
|
+
))
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
GradientText
|
|
32
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
21
|
+
// src/Components/GradientText/style.ts
|
|
22
|
+
import { Keyframes } from "@ant-design/cssinjs";
|
|
23
|
+
import {
|
|
24
|
+
useEditorStyleRegister
|
|
25
|
+
} from "../../Hooks/useStyle";
|
|
26
|
+
var animateGradientText = new Keyframes("animateGradientText", {
|
|
27
|
+
"0%": {
|
|
28
|
+
backgroundPosition: "0% 50%"
|
|
29
|
+
},
|
|
30
|
+
"50%": {
|
|
31
|
+
backgroundPosition: "100% 50%"
|
|
32
|
+
},
|
|
33
|
+
"100%": {
|
|
34
|
+
backgroundPosition: "0% 50%"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var genStyle = (token) => {
|
|
38
|
+
return {
|
|
39
|
+
[token.componentCls]: {
|
|
40
|
+
position: "relative",
|
|
41
|
+
margin: "0 auto",
|
|
42
|
+
display: "flex",
|
|
43
|
+
maxWidth: "fit-content",
|
|
44
|
+
flexDirection: "row",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
fontWeight: 500,
|
|
48
|
+
backdropFilter: "blur(10px)",
|
|
49
|
+
transition: "box-shadow 0.5s ease-out",
|
|
50
|
+
overflow: "hidden",
|
|
51
|
+
["&-text-content"]: {
|
|
52
|
+
display: "inline-block",
|
|
53
|
+
position: "relative",
|
|
54
|
+
zIndex: 2,
|
|
55
|
+
backgroundSize: "300% 100%",
|
|
56
|
+
backgroundClip: "text",
|
|
57
|
+
WebkitBackgroundClip: "text",
|
|
58
|
+
color: "transparent",
|
|
59
|
+
animationName: animateGradientText,
|
|
60
|
+
animationTimingFunction: "linear",
|
|
61
|
+
animationIterationCount: "infinite"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
var useGradientTextStyle = (prefixCls) => {
|
|
67
|
+
return useEditorStyleRegister("gradient-text", (token) => {
|
|
68
|
+
const gradientTextToken = __spreadProps(__spreadValues({}, token), {
|
|
69
|
+
componentCls: `.${prefixCls}`
|
|
70
|
+
});
|
|
71
|
+
return [genStyle(gradientTextToken)];
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
useGradientTextStyle
|
|
76
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { MotionProps, Variants } from 'framer-motion';
|
|
2
|
+
import React, { ElementType } from 'react';
|
|
3
|
+
type AnimationType = 'text' | 'word' | 'character' | 'line' | 'mix';
|
|
4
|
+
type AnimationVariant = 'fadeIn' | 'blurIn' | 'blurInUp' | 'blurInDown' | 'slideUp' | 'slideDown' | 'slideLeft' | 'slideRight' | 'scaleUp' | 'scaleDown';
|
|
5
|
+
export interface TextAnimateProps extends MotionProps {
|
|
6
|
+
/**
|
|
7
|
+
* The text content to animate
|
|
8
|
+
*/
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* The class name to be applied to the component
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The class name to be applied to each segment
|
|
16
|
+
*/
|
|
17
|
+
segmentClassName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The delay before the animation starts
|
|
20
|
+
*/
|
|
21
|
+
delay?: number;
|
|
22
|
+
/**
|
|
23
|
+
* The duration of the animation
|
|
24
|
+
*/
|
|
25
|
+
duration?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Custom motion variants for the animation
|
|
28
|
+
*/
|
|
29
|
+
variants?: Variants;
|
|
30
|
+
/**
|
|
31
|
+
* The element type to render
|
|
32
|
+
*/
|
|
33
|
+
as?: ElementType;
|
|
34
|
+
/**
|
|
35
|
+
* How to split the text ("text", "word", "character")
|
|
36
|
+
*/
|
|
37
|
+
by?: AnimationType;
|
|
38
|
+
/**
|
|
39
|
+
* Whether to start animation when component enters viewport
|
|
40
|
+
*/
|
|
41
|
+
startOnView?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to animate only once
|
|
44
|
+
*/
|
|
45
|
+
once?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The animation preset to use
|
|
48
|
+
*/
|
|
49
|
+
animation?: AnimationVariant;
|
|
50
|
+
/**
|
|
51
|
+
* Whether to enable accessibility features (default: true)
|
|
52
|
+
*/
|
|
53
|
+
accessible?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare const TextAnimate: React.MemoExoticComponent<({ children, delay, duration, variants, className, segmentClassName, as: Component, startOnView, once, by, animation, accessible, ...props }: TextAnimateProps) => React.JSX.Element>;
|
|
56
|
+
export {};
|