@cloudtower/eagle 490.0.11 → 490.0.12
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/cjs/core/Alert/alert.style.js +7 -0
- package/dist/cjs/core/Alert/index.js +108 -61
- package/dist/cjs/core/Timeline/index.js +1 -1
- package/dist/cjs/coreX/CheckPointList/index.js +1 -1
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/legacy-antd.js +1 -1
- package/dist/cjs/stats1.html +1 -1
- package/dist/components.css +3436 -3435
- package/dist/esm/core/Alert/alert.style.js +4 -0
- package/dist/esm/core/Alert/index.js +105 -62
- package/dist/esm/index.js +1 -0
- package/dist/esm/stats1.html +1 -1
- package/dist/linaria.merged.scss +4114 -4113
- package/dist/src/core/Alert/__test__/Alert.test.d.ts +1 -0
- package/dist/src/core/Alert/alert.style.d.ts +2 -0
- package/dist/src/core/Alert/alert.type.d.ts +49 -0
- package/dist/src/core/Alert/index.d.ts +1 -0
- package/dist/stories/docs/core/Alert.stories.d.ts +120 -11
- package/dist/style.css +3436 -3435
- package/docs/core/Alert/guide.md +126 -0
- package/docs/llms.txt +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,57 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AlertProps as AntdAlertProps } from "antd/lib/alert";
|
|
3
|
+
export interface ExpandableConfig {
|
|
4
|
+
/** 默认展开状态(非受控模式) */
|
|
5
|
+
defaultExpanded?: boolean;
|
|
6
|
+
/** 展开状态(受控模式),传入后组件变为受控 */
|
|
7
|
+
expanded?: boolean;
|
|
8
|
+
/** 展开/收起状态变化回调 */
|
|
9
|
+
onExpandChange?: (expanded: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 提示框组件 Props,基于 antd Alert 封装。
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* 用于页面内的警告或提示信息展示,支持 info / error / warning / success / normal 五种类型。
|
|
16
|
+
* 扩展了 action 操作区、展开/收起等功能。
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import React from "react";
|
|
21
|
+
* import Alert from "@cloudtower/eagle/Alert";
|
|
22
|
+
*
|
|
23
|
+
* // 基本用法
|
|
24
|
+
* <Alert type="info" message="集群升级已完成。" />
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* import React from "react";
|
|
30
|
+
* import Alert from "@cloudtower/eagle/Alert";
|
|
31
|
+
*
|
|
32
|
+
* // 带展开/收起
|
|
33
|
+
* <Alert
|
|
34
|
+
* type="info"
|
|
35
|
+
* message="以下服务版本不兼容:"
|
|
36
|
+
* description={<ul><li>服务 A 需升级至 1.4.5</li></ul>}
|
|
37
|
+
* expandConfig={{}}
|
|
38
|
+
* />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @see Banner 全局横幅通知,固定在页面顶部
|
|
42
|
+
* @see message 全局提示,自动消失
|
|
43
|
+
*/
|
|
3
44
|
export type AlertProps = Omit<AntdAlertProps, "type"> & {
|
|
45
|
+
/** 提示类型,"normal" 为无色信息提示 */
|
|
4
46
|
type?: AntdAlertProps["type"] | "normal";
|
|
47
|
+
/** 右侧操作区域,渲染在 message 右侧 */
|
|
5
48
|
action?: React.ReactNode;
|
|
49
|
+
/** 测试标识,透传到根元素 */
|
|
6
50
|
"data-testid"?: string;
|
|
51
|
+
/**
|
|
52
|
+
* 启用展开/收起功能。启用后 description 内容在收起状态下隐藏,
|
|
53
|
+
* 展开后在 message 下方内联展示,不会触发 antd 的 with-description 布局。
|
|
54
|
+
*/
|
|
55
|
+
expandConfig?: ExpandableConfig;
|
|
7
56
|
};
|
|
8
57
|
export type AlertComponentType = React.FunctionComponent<AlertProps>;
|
|
@@ -1,12 +1,121 @@
|
|
|
1
1
|
import Alert from "../../../src/core/Alert";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import type { StoryObj } from "@storybook/react";
|
|
3
|
+
/**
|
|
4
|
+
* 提示框组件,基于 antd Alert 封装。
|
|
5
|
+
*
|
|
6
|
+
* * 支持 info / error / warning / success / normal 五种类型
|
|
7
|
+
* * 支持 action、closable、expandConfig 等功能
|
|
8
|
+
* * 更多 props 请参考:https://ant.design/components/alert-cn#api
|
|
9
|
+
*/
|
|
10
|
+
declare const meta: {
|
|
11
|
+
component: import("../../../src/core/Alert").AlertComponentType;
|
|
12
|
+
title: "Core/Alert | 提示框";
|
|
13
|
+
argTypes: {
|
|
14
|
+
type: {
|
|
15
|
+
control: string;
|
|
16
|
+
options: string[];
|
|
17
|
+
description: string;
|
|
18
|
+
table: {
|
|
19
|
+
defaultValue: {
|
|
20
|
+
summary: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
message: {
|
|
25
|
+
control: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
description: {
|
|
29
|
+
control: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
showIcon: {
|
|
33
|
+
control: string;
|
|
34
|
+
description: string;
|
|
35
|
+
table: {
|
|
36
|
+
defaultValue: {
|
|
37
|
+
summary: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
closable: {
|
|
42
|
+
control: string;
|
|
43
|
+
description: string;
|
|
44
|
+
table: {
|
|
45
|
+
defaultValue: {
|
|
46
|
+
summary: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
expandConfig: {
|
|
51
|
+
control: boolean;
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
54
|
+
action: {
|
|
55
|
+
control: boolean;
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
"data-testid": {
|
|
59
|
+
control: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
args: {
|
|
64
|
+
type: "info";
|
|
65
|
+
message: string;
|
|
66
|
+
showIcon: true;
|
|
67
|
+
closable: false;
|
|
68
|
+
};
|
|
69
|
+
parameters: {
|
|
70
|
+
design: {
|
|
71
|
+
type: string;
|
|
72
|
+
url: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export default meta;
|
|
77
|
+
type Story = StoryObj<typeof Alert>;
|
|
78
|
+
/**
|
|
79
|
+
* 通过下方 Controls 面板调整各 Props 查看效果。
|
|
80
|
+
*/
|
|
81
|
+
export declare const Playground: Story;
|
|
82
|
+
/**
|
|
83
|
+
* 五种类型:info、error、warning、success、normal。
|
|
84
|
+
*/
|
|
85
|
+
export declare const Basic: Story;
|
|
86
|
+
/**
|
|
87
|
+
* 通过 `action` 属性在右侧添加操作区域。
|
|
88
|
+
*/
|
|
89
|
+
export declare const WithAction: Story;
|
|
90
|
+
/**
|
|
91
|
+
* 通过 `closable` 或 `onClose` 启用关闭按钮。
|
|
92
|
+
*/
|
|
93
|
+
export declare const Closable: Story;
|
|
94
|
+
/**
|
|
95
|
+
* 同时使用 `closable` 和 `action`。
|
|
96
|
+
*/
|
|
97
|
+
export declare const ClosableWithAction: Story;
|
|
98
|
+
/**
|
|
99
|
+
* `message` 支持传入 ReactNode,可自定义复杂内容。
|
|
100
|
+
*/
|
|
101
|
+
export declare const CustomMessage: Story;
|
|
102
|
+
/**
|
|
103
|
+
* 通过 `expandConfig` 启用展开/收起功能,`description` 内容会被折叠。
|
|
104
|
+
*
|
|
105
|
+
* * `expandConfig={{}}` — 非受控模式,默认收起
|
|
106
|
+
* * `expandConfig={{ defaultExpanded: true }}` — 非受控模式,默认展开
|
|
107
|
+
* * `expandConfig={{ expanded, onExpandChange }}` — 受控模式
|
|
108
|
+
*/
|
|
109
|
+
export declare const Expandable: Story;
|
|
110
|
+
/**
|
|
111
|
+
* 设置 `defaultExpanded: true` 使组件初始即为展开状态。
|
|
112
|
+
*/
|
|
113
|
+
export declare const ExpandableDefaultExpanded: Story;
|
|
114
|
+
/**
|
|
115
|
+
* 通过 `expanded` 和 `onExpandChange` 实现受控模式。
|
|
116
|
+
*/
|
|
117
|
+
export declare const ExpandableControlled: Story;
|
|
118
|
+
/**
|
|
119
|
+
* `expandConfig` 与 `action` 可同时使用。
|
|
120
|
+
*/
|
|
121
|
+
export declare const ExpandableWithAction: Story;
|