@cloudtower/eagle 490.0.11 → 490.0.13

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.
@@ -0,0 +1,126 @@
1
+ # Alert
2
+
3
+ ## 简介
4
+
5
+ 提示框组件,基于 antd Alert 封装。用于页面内的警告或提示信息展示,支持 info / error / warning / success / normal 五种类型。扩展了 action 操作区和展开/收起功能。
6
+
7
+ ## 何时使用
8
+
9
+ - 表单或页面中展示操作提示、警告、错误信息
10
+ - 内容较长需要折叠展示时,使用 expandConfig 模式
11
+ - 需要在提示信息旁边放置操作按钮(如跳转链接)
12
+
13
+ 不要使用:
14
+
15
+ - 全局横幅通知 --> 请用 `Banner`
16
+ - 自动消失的轻提示 --> 请用 `message`
17
+ - 需要用户确认的模态提示 --> 请用 `SmallDialog`
18
+
19
+ ## 基础用法
20
+
21
+ ```tsx
22
+ import React from "react";
23
+ import Alert from "@cloudtower/eagle/Alert";
24
+
25
+ const App = () => <Alert type="info" message="集群升级已完成。" />;
26
+ ```
27
+
28
+ ## 常见模式
29
+
30
+ ### 模式一:带操作按钮
31
+
32
+ 适用于提示信息旁需要放置操作入口的场景,如跳转到详情页。
33
+
34
+ ```tsx
35
+ import React from "react";
36
+ import Alert from "@cloudtower/eagle/Alert";
37
+
38
+ const App = () => (
39
+ <Alert
40
+ type="warning"
41
+ message="主机 node-1 存在未处理的告警。"
42
+ action={<a>查看详情</a>}
43
+ />
44
+ );
45
+ ```
46
+
47
+ ### 模式二:展开/收起(非受控)
48
+
49
+ 适用于提示内容较长、需要折叠展示的场景。收起时仅显示 message,展开后在 message 下方内联显示 description。
50
+
51
+ ```tsx
52
+ import React from "react";
53
+ import Alert from "@cloudtower/eagle/Alert";
54
+
55
+ const App = () => (
56
+ <Alert
57
+ type="info"
58
+ message="以下系统服务的版本不适配多管理 IP 模式:"
59
+ description={
60
+ <ul>
61
+ <li>可观测性服务 service-A,需升级至 1.4.5 及以上版本</li>
62
+ <li>CloudTower 代理 agent-A,需升级至 1.3.7 及以上版本</li>
63
+ </ul>
64
+ }
65
+ expandConfig={{}}
66
+ />
67
+ );
68
+ ```
69
+
70
+ 设置默认展开:`expandConfig={{ defaultExpanded: true }}`。
71
+
72
+ ### 模式三:展开/收起(受控)
73
+
74
+ 适用于需要从外部控制展开状态的场景。
75
+
76
+ ```tsx
77
+ import React, { useState } from "react";
78
+ import Alert from "@cloudtower/eagle/Alert";
79
+
80
+ const App = () => {
81
+ const [expanded, setExpanded] = useState(false);
82
+
83
+ return (
84
+ <Alert
85
+ type="info"
86
+ message="以下系统服务的版本不适配多管理 IP 模式:"
87
+ description={
88
+ <ul>
89
+ <li>可观测性服务 service-A,需升级至 1.4.5 及以上版本</li>
90
+ </ul>
91
+ }
92
+ expandConfig={{ expanded, onExpandChange: setExpanded }}
93
+ />
94
+ );
95
+ };
96
+ ```
97
+
98
+ ### 模式四:可关闭 + 操作 + 展开/收起
99
+
100
+ 多种功能可组合使用。
101
+
102
+ ```tsx
103
+ import React from "react";
104
+ import Alert from "@cloudtower/eagle/Alert";
105
+
106
+ const App = () => (
107
+ <Alert
108
+ type="info"
109
+ message="以下服务需要升级:"
110
+ description={
111
+ <ul>
112
+ <li>备份服务 v2.3.0 -> v2.3.1</li>
113
+ </ul>
114
+ }
115
+ action={<a>立即升级</a>}
116
+ expandConfig
117
+ closable
118
+ />
119
+ );
120
+ ```
121
+
122
+ ## 相关组件
123
+
124
+ - `Banner`:全局横幅通知,固定在页面顶部
125
+ - `message`:全局提示,自动消失
126
+ - `SmallDialog`:需要用户确认的模态提示
package/docs/llms.txt CHANGED
@@ -19,7 +19,7 @@ npm 包名:@cloudtower/eagle
19
19
  - [RejectDialog](coreX/RejectDialog/guide.md): 操作拒绝反馈对话框,支持 Single/All/Part/Custom 四种模式
20
20
  - message: 全局提示,支持 success/error/warning/info/loading 类型
21
21
  - message-group: 消息分组,将多条消息合并为一组展示
22
- - Alert: 警告提示条,支持 success/info/warning/error 类型,可关闭
22
+ - [Alert](core/Alert/guide.md): 提示框,支持 info/error/warning/success/normal 类型,可关闭,支持展开/收起
23
23
  - Banner: 全局横幅通知,支持 error/info/warning 类型,固定在页面顶部
24
24
  - notification: 通知提醒(继承 antd notification)
25
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudtower/eagle",
3
- "version": "490.0.11",
3
+ "version": "490.0.13",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -27,8 +27,8 @@
27
27
  "sync:color": "node tools/fetch-figma-color.js"
28
28
  },
29
29
  "dependencies": {
30
- "@cloudtower/icons-react": "^490.0.11",
31
- "@cloudtower/parrot": "^490.0.11",
30
+ "@cloudtower/icons-react": "^490.0.13",
31
+ "@cloudtower/parrot": "^490.0.13",
32
32
  "@cloudtower/rc-notification": "^4.6.1",
33
33
  "@linaria/core": "^4.2.2",
34
34
  "@linaria/react": "^4.3.0",
@@ -116,5 +116,5 @@
116
116
  "vite": "^4.5.1",
117
117
  "vitest": "^3.1.1"
118
118
  },
119
- "gitHead": "c874b1f818bc130dbb3b85bedaec0ac806f6760f"
119
+ "gitHead": "79870f95e3886aa1da21b0a8d8541002cc2e5583"
120
120
  }