@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
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { XmarkRemove16RegularTertiaryCapsOffIcon, XmarkRemove16RegularPrimaryCapsOffIcon } from '@cloudtower/icons-react';
|
|
1
|
+
import { ArrowChevronUpSmall16BlueIcon, ArrowChevronDownSmall16BlueIcon, XmarkRemove16RegularTertiaryCapsOffIcon, XmarkRemove16RegularPrimaryCapsOffIcon } from '@cloudtower/icons-react';
|
|
2
2
|
import Icon from '../Icon/index.js';
|
|
3
|
+
import Link from '../Link/index.js';
|
|
4
|
+
import useParrotTranslation from '../../hooks/useParrotTranslation.js';
|
|
3
5
|
import { Alert as Alert$2 } from 'antd';
|
|
4
6
|
import cs from 'classnames';
|
|
5
|
-
import React__default from 'react';
|
|
7
|
+
import React__default, { useState, useCallback } from 'react';
|
|
8
|
+
import { AlertStyle, MessageWrapperStyle } from './alert.style.js';
|
|
6
9
|
import { getAlertIcon } from '../../utils/icon.js';
|
|
7
10
|
|
|
8
11
|
var __defProp = Object.defineProperty;
|
|
@@ -11,76 +14,116 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
|
11
14
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
12
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
16
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
14
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true,
|
|
18
|
-
value
|
|
19
|
-
}) : obj[key] = value;
|
|
17
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
20
18
|
var __spreadValues = (a, b) => {
|
|
21
|
-
for (var prop in b || (b = {}))
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
for (var prop in b || (b = {}))
|
|
20
|
+
if (__hasOwnProp.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
if (__getOwnPropSymbols)
|
|
23
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
24
|
+
if (__propIsEnum.call(b, prop))
|
|
25
|
+
__defNormalProp(a, prop, b[prop]);
|
|
26
|
+
}
|
|
25
27
|
return a;
|
|
26
28
|
};
|
|
27
29
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
28
30
|
var __objRest = (source, exclude) => {
|
|
29
31
|
var target = {};
|
|
30
|
-
for (var prop in source)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
for (var prop in source)
|
|
33
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
34
|
+
target[prop] = source[prop];
|
|
35
|
+
if (source != null && __getOwnPropSymbols)
|
|
36
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
37
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
38
|
+
target[prop] = source[prop];
|
|
39
|
+
}
|
|
34
40
|
return target;
|
|
35
41
|
};
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
const Alert = (_a) => {
|
|
43
|
+
var _b = _a, {
|
|
44
|
+
type,
|
|
45
|
+
icon,
|
|
46
|
+
showIcon = true,
|
|
47
|
+
className,
|
|
48
|
+
onClose,
|
|
49
|
+
closeText,
|
|
50
|
+
action,
|
|
51
|
+
message,
|
|
52
|
+
description,
|
|
53
|
+
closable,
|
|
54
|
+
expandConfig,
|
|
55
|
+
"data-testid": dataTestId
|
|
56
|
+
} = _b, props = __objRest(_b, [
|
|
57
|
+
"type",
|
|
58
|
+
"icon",
|
|
59
|
+
"showIcon",
|
|
60
|
+
"className",
|
|
61
|
+
"onClose",
|
|
62
|
+
"closeText",
|
|
63
|
+
"action",
|
|
64
|
+
"message",
|
|
65
|
+
"description",
|
|
66
|
+
"closable",
|
|
67
|
+
"expandConfig",
|
|
68
|
+
"data-testid"
|
|
69
|
+
]);
|
|
70
|
+
var _a2;
|
|
71
|
+
const { t } = useParrotTranslation();
|
|
72
|
+
const _icon = /* @__PURE__ */ React__default.createElement(Icon, { alt: type, src: getAlertIcon(type) });
|
|
57
73
|
const _type = type === "normal" ? "info" : type;
|
|
58
74
|
const _closable = closable || Boolean(onClose) || Boolean(closeText);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
const [internalExpanded, setInternalExpanded] = useState(
|
|
76
|
+
(_a2 = expandConfig == null ? void 0 : expandConfig.defaultExpanded) != null ? _a2 : false
|
|
77
|
+
);
|
|
78
|
+
const isControlled = (expandConfig == null ? void 0 : expandConfig.expanded) !== void 0;
|
|
79
|
+
const expanded = isControlled ? expandConfig.expanded : internalExpanded;
|
|
80
|
+
const handleToggle = useCallback(() => {
|
|
81
|
+
var _a3;
|
|
82
|
+
const next = !expanded;
|
|
83
|
+
if (!isControlled) {
|
|
84
|
+
setInternalExpanded(next);
|
|
85
|
+
}
|
|
86
|
+
(_a3 = expandConfig == null ? void 0 : expandConfig.onExpandChange) == null ? void 0 : _a3.call(expandConfig, next);
|
|
87
|
+
}, [expanded, isControlled, expandConfig == null ? void 0 : expandConfig.onExpandChange]);
|
|
88
|
+
const showExpandToggle = expandConfig && description;
|
|
89
|
+
const expandToggle = showExpandToggle ? /* @__PURE__ */ React__default.createElement(
|
|
90
|
+
Link,
|
|
91
|
+
{
|
|
92
|
+
onClick: handleToggle,
|
|
93
|
+
"data-testid": "alert-expand-toggle",
|
|
94
|
+
suffixIcon: /* @__PURE__ */ React__default.createElement(
|
|
95
|
+
Icon,
|
|
96
|
+
{
|
|
97
|
+
src: expanded ? ArrowChevronUpSmall16BlueIcon : ArrowChevronDownSmall16BlueIcon
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
},
|
|
101
|
+
expanded ? t("alert_collapse") : t("alert_expand")
|
|
102
|
+
) : null;
|
|
103
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
104
|
+
Alert$2,
|
|
105
|
+
__spreadProps(__spreadValues({}, props), {
|
|
106
|
+
"data-testid": dataTestId,
|
|
107
|
+
className: cs(AlertStyle, type ? `alert-${type}` : "", className, {
|
|
108
|
+
action: action || expandToggle
|
|
109
|
+
}),
|
|
110
|
+
type: _type,
|
|
111
|
+
message: /* @__PURE__ */ React__default.createElement("div", { className: MessageWrapperStyle }, /* @__PURE__ */ React__default.createElement("div", { style: { flex: 1 } }, message, showExpandToggle && expanded ? /* @__PURE__ */ React__default.createElement("div", null, description) : null), action ? /* @__PURE__ */ React__default.createElement("span", { className: cs("action") }, action) : null, expandToggle ? /* @__PURE__ */ React__default.createElement("span", { className: cs("action") }, expandToggle) : null),
|
|
112
|
+
description: expandConfig ? void 0 : description,
|
|
113
|
+
icon: icon || _icon,
|
|
114
|
+
showIcon,
|
|
115
|
+
onClose,
|
|
116
|
+
closeText: closeText || _closable && /* @__PURE__ */ React__default.createElement(
|
|
117
|
+
Icon,
|
|
118
|
+
{
|
|
119
|
+
src: XmarkRemove16RegularTertiaryCapsOffIcon,
|
|
120
|
+
hoverSrc: XmarkRemove16RegularPrimaryCapsOffIcon
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
closable: _closable
|
|
124
|
+
})
|
|
125
|
+
);
|
|
83
126
|
};
|
|
84
127
|
var Alert$1 = Alert;
|
|
85
128
|
|
|
86
|
-
export { Alert$1 as default };
|
|
129
|
+
export { AlertStyle, MessageWrapperStyle, Alert$1 as default };
|
package/dist/esm/index.js
CHANGED
|
@@ -80,6 +80,7 @@ export { default as TimeZoneSelect } from './core/TimeZoneSelect/index.js';
|
|
|
80
80
|
export { default as Token, TokenPresetColors } from './core/Token/index.js';
|
|
81
81
|
export { default as Tooltip } from './core/Tooltip/index.js';
|
|
82
82
|
export { default as Truncate } from './core/Truncate/index.js';
|
|
83
|
+
export { AlertStyle, MessageWrapperStyle } from './core/Alert/alert.style.js';
|
|
83
84
|
export { Antd5Dropdown } from './core/Antd5Dropdown/Antd5Dropdown.js';
|
|
84
85
|
export { Flex as Antd5Flex, Tree as Antd5Tree } from 'antd5';
|
|
85
86
|
export { Architecture } from './core/Arch/arch.type.js';
|