@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.
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ const MessageWrapperStyle = "E_meo40fy";
4
+ const AlertStyle = "E_a1ctixr3";
5
+
6
+ exports.AlertStyle = AlertStyle;
7
+ exports.MessageWrapperStyle = MessageWrapperStyle;
@@ -1,10 +1,15 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var iconsReact = require('@cloudtower/icons-react');
4
- var index = require('../Icon/index.js');
6
+ var index$1 = require('../Icon/index.js');
7
+ var index = require('../Link/index.js');
8
+ var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
5
9
  var antd = require('antd');
6
10
  var cs = require('classnames');
7
11
  var React = require('react');
12
+ var alert_style = require('./alert.style.js');
8
13
  var icon = require('../../utils/icon.js');
9
14
 
10
15
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -18,76 +23,118 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
18
23
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
19
24
  var __hasOwnProp = Object.prototype.hasOwnProperty;
20
25
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
21
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
22
- enumerable: true,
23
- configurable: true,
24
- writable: true,
25
- value
26
- }) : obj[key] = value;
26
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
27
27
  var __spreadValues = (a, b) => {
28
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
29
- if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
30
- if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
31
- }
28
+ for (var prop in b || (b = {}))
29
+ if (__hasOwnProp.call(b, prop))
30
+ __defNormalProp(a, prop, b[prop]);
31
+ if (__getOwnPropSymbols)
32
+ for (var prop of __getOwnPropSymbols(b)) {
33
+ if (__propIsEnum.call(b, prop))
34
+ __defNormalProp(a, prop, b[prop]);
35
+ }
32
36
  return a;
33
37
  };
34
38
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
35
39
  var __objRest = (source, exclude) => {
36
40
  var target = {};
37
- for (var prop in source) if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
38
- if (source != null && __getOwnPropSymbols) for (var prop of __getOwnPropSymbols(source)) {
39
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop];
40
- }
41
+ for (var prop in source)
42
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
43
+ target[prop] = source[prop];
44
+ if (source != null && __getOwnPropSymbols)
45
+ for (var prop of __getOwnPropSymbols(source)) {
46
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
47
+ target[prop] = source[prop];
48
+ }
41
49
  return target;
42
50
  };
43
- const MessageWrapperStyle = "E_m74vjol";
44
- const AlertStyle = "E_a1o35uvh";
45
- const Alert = _a => {
46
- var _b = _a,
47
- {
48
- type,
49
- icon: icon$1,
50
- showIcon = true,
51
- className,
52
- onClose,
53
- closeText,
54
- action,
55
- message,
56
- closable,
57
- "data-testid": dataTestId
58
- } = _b,
59
- props = __objRest(_b, ["type", "icon", "showIcon", "className", "onClose", "closeText", "action", "message", "closable", "data-testid"]);
60
- const _icon = /* @__PURE__ */React__default.default.createElement(index, {
61
- alt: type,
62
- src: icon.getAlertIcon(type)
63
- });
51
+ const Alert = (_a) => {
52
+ var _b = _a, {
53
+ type,
54
+ icon: icon$1,
55
+ showIcon = true,
56
+ className,
57
+ onClose,
58
+ closeText,
59
+ action,
60
+ message,
61
+ description,
62
+ closable,
63
+ expandConfig,
64
+ "data-testid": dataTestId
65
+ } = _b, props = __objRest(_b, [
66
+ "type",
67
+ "icon",
68
+ "showIcon",
69
+ "className",
70
+ "onClose",
71
+ "closeText",
72
+ "action",
73
+ "message",
74
+ "description",
75
+ "closable",
76
+ "expandConfig",
77
+ "data-testid"
78
+ ]);
79
+ var _a2;
80
+ const { t } = useParrotTranslation();
81
+ const _icon = /* @__PURE__ */ React__default.default.createElement(index$1, { alt: type, src: icon.getAlertIcon(type) });
64
82
  const _type = type === "normal" ? "info" : type;
65
83
  const _closable = closable || Boolean(onClose) || Boolean(closeText);
66
- return /* @__PURE__ */React__default.default.createElement(antd.Alert, __spreadProps(__spreadValues({}, props), {
67
- "data-testid": dataTestId,
68
- className: cs__default.default(AlertStyle, type ? `alert-${type}` : "", className, {
69
- action
70
- }),
71
- type: _type,
72
- message: /* @__PURE__ */React__default.default.createElement("div", {
73
- className: MessageWrapperStyle
74
- }, /* @__PURE__ */React__default.default.createElement("span", {
75
- style: {
76
- flex: 1
77
- }
78
- }, message), action ? /* @__PURE__ */React__default.default.createElement("span", {
79
- className: cs__default.default("action")
80
- }, action) : null),
81
- icon: icon$1 || _icon,
82
- showIcon,
83
- onClose,
84
- closeText: closeText || _closable && /* @__PURE__ */React__default.default.createElement(index, {
85
- src: iconsReact.XmarkRemove16RegularTertiaryCapsOffIcon,
86
- hoverSrc: iconsReact.XmarkRemove16RegularPrimaryCapsOffIcon
87
- }),
88
- closable: _closable
89
- }));
84
+ const [internalExpanded, setInternalExpanded] = React.useState(
85
+ (_a2 = expandConfig == null ? void 0 : expandConfig.defaultExpanded) != null ? _a2 : false
86
+ );
87
+ const isControlled = (expandConfig == null ? void 0 : expandConfig.expanded) !== void 0;
88
+ const expanded = isControlled ? expandConfig.expanded : internalExpanded;
89
+ const handleToggle = React.useCallback(() => {
90
+ var _a3;
91
+ const next = !expanded;
92
+ if (!isControlled) {
93
+ setInternalExpanded(next);
94
+ }
95
+ (_a3 = expandConfig == null ? void 0 : expandConfig.onExpandChange) == null ? void 0 : _a3.call(expandConfig, next);
96
+ }, [expanded, isControlled, expandConfig == null ? void 0 : expandConfig.onExpandChange]);
97
+ const showExpandToggle = expandConfig && description;
98
+ const expandToggle = showExpandToggle ? /* @__PURE__ */ React__default.default.createElement(
99
+ index,
100
+ {
101
+ onClick: handleToggle,
102
+ "data-testid": "alert-expand-toggle",
103
+ suffixIcon: /* @__PURE__ */ React__default.default.createElement(
104
+ index$1,
105
+ {
106
+ src: expanded ? iconsReact.ArrowChevronUpSmall16BlueIcon : iconsReact.ArrowChevronDownSmall16BlueIcon
107
+ }
108
+ )
109
+ },
110
+ expanded ? t("alert_collapse") : t("alert_expand")
111
+ ) : null;
112
+ return /* @__PURE__ */ React__default.default.createElement(
113
+ antd.Alert,
114
+ __spreadProps(__spreadValues({}, props), {
115
+ "data-testid": dataTestId,
116
+ className: cs__default.default(alert_style.AlertStyle, type ? `alert-${type}` : "", className, {
117
+ action: action || expandToggle
118
+ }),
119
+ type: _type,
120
+ message: /* @__PURE__ */ React__default.default.createElement("div", { className: alert_style.MessageWrapperStyle }, /* @__PURE__ */ React__default.default.createElement("div", { style: { flex: 1 } }, message, showExpandToggle && expanded ? /* @__PURE__ */ React__default.default.createElement("div", null, description) : null), action ? /* @__PURE__ */ React__default.default.createElement("span", { className: cs__default.default("action") }, action) : null, expandToggle ? /* @__PURE__ */ React__default.default.createElement("span", { className: cs__default.default("action") }, expandToggle) : null),
121
+ description: expandConfig ? void 0 : description,
122
+ icon: icon$1 || _icon,
123
+ showIcon,
124
+ onClose,
125
+ closeText: closeText || _closable && /* @__PURE__ */ React__default.default.createElement(
126
+ index$1,
127
+ {
128
+ src: iconsReact.XmarkRemove16RegularTertiaryCapsOffIcon,
129
+ hoverSrc: iconsReact.XmarkRemove16RegularPrimaryCapsOffIcon
130
+ }
131
+ ),
132
+ closable: _closable
133
+ })
134
+ );
90
135
  };
91
136
  var Alert$1 = Alert;
92
137
 
93
- module.exports = Alert$1;
138
+ exports.AlertStyle = alert_style.AlertStyle;
139
+ exports.MessageWrapperStyle = alert_style.MessageWrapperStyle;
140
+ exports.default = Alert$1;
@@ -127,7 +127,7 @@ const Timeline = ({
127
127
  ),
128
128
  /* @__PURE__ */ React__default.default.createElement("div", { className: "item-time" }, subInfoRender ? subInfoRender(subInfo) : subInfo ? /* @__PURE__ */ React__default.default.createElement(Timeline_widget.TimelineArea, __spreadValues({}, subInfo)) : /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null), finalDetailMessages.length > 0 ? finalDetailMessages.map(
129
129
  (detailMessage2, index2) => detailMessageRender ? detailMessageRender(detailMessage2, index2) : /* @__PURE__ */ React__default.default.createElement(
130
- index$1,
130
+ index$1.default,
131
131
  __spreadValues({
132
132
  key: `detail-message-${index2}`,
133
133
  showIcon: false,
@@ -72,7 +72,7 @@ const CheckPointItem = ({
72
72
  if (action.type === "icon") {
73
73
  return /* @__PURE__ */ React__default.default.createElement(index$1, __spreadValues({}, action.props));
74
74
  }
75
- })), /* @__PURE__ */ React__default.default.createElement(index.Show, { condition: Boolean(tagProps) }, /* @__PURE__ */ React__default.default.createElement(index$5.default, __spreadValues({}, tagProps))))), /* @__PURE__ */ React__default.default.createElement(index.Show, { condition: Boolean(alertProps) }, /* @__PURE__ */ React__default.default.createElement(index$6, __spreadValues({ showIcon: false }, alertProps))));
75
+ })), /* @__PURE__ */ React__default.default.createElement(index.Show, { condition: Boolean(tagProps) }, /* @__PURE__ */ React__default.default.createElement(index$5.default, __spreadValues({}, tagProps))))), /* @__PURE__ */ React__default.default.createElement(index.Show, { condition: Boolean(alertProps) }, /* @__PURE__ */ React__default.default.createElement(index$6.default, __spreadValues({ showIcon: false }, alertProps))));
76
76
  };
77
77
  const CheckPointList = ({
78
78
  items = [],
package/dist/cjs/index.js CHANGED
@@ -82,6 +82,7 @@ var index$16 = require('./core/TimeZoneSelect/index.js');
82
82
  var index$17 = require('./core/Token/index.js');
83
83
  var index$18 = require('./core/Tooltip/index.js');
84
84
  var index$19 = require('./core/Truncate/index.js');
85
+ var alert_style = require('./core/Alert/alert.style.js');
85
86
  var Antd5Dropdown = require('./core/Antd5Dropdown/Antd5Dropdown.js');
86
87
  var antd5 = require('antd5');
87
88
  var arch_type = require('./core/Arch/arch.type.js');
@@ -203,7 +204,7 @@ exports.MessageContext = useMessage.MessageContext;
203
204
  exports.useMessage = useMessage.useMessage;
204
205
  exports.ModalActions = modal.ModalActions;
205
206
  exports.AccordionCard = index$3;
206
- exports.Alert = index$4;
207
+ exports.Alert = index$4.default;
207
208
  exports.Antd5Anchor = index$5;
208
209
  exports.Arch = index$6.default;
209
210
  exports.Avatar = index$7;
@@ -428,6 +429,8 @@ exports.Token = index$17.default;
428
429
  exports.TokenPresetColors = index$17.TokenPresetColors;
429
430
  exports.Tooltip = index$18;
430
431
  exports.Truncate = index$19;
432
+ exports.AlertStyle = alert_style.AlertStyle;
433
+ exports.MessageWrapperStyle = alert_style.MessageWrapperStyle;
431
434
  exports.Antd5Dropdown = Antd5Dropdown.Antd5Dropdown;
432
435
  Object.defineProperty(exports, 'Antd5Flex', {
433
436
  enumerable: true,
@@ -113,7 +113,7 @@ function getAntdKit() {
113
113
  },
114
114
  inputGroup: index$n,
115
115
  Empty: /* @__PURE__ */ React__default.default.createElement(index$o, null),
116
- alert: index$p,
116
+ alert: index$p.default,
117
117
  searchInput: SearchInput.SearchInput,
118
118
  badge: index$q,
119
119
  radio: index$r.default,