@cloudtower/eagle 0.34.3 → 0.34.5

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.
Files changed (39) hide show
  1. package/dist/cjs/core/BlankState/index.js +89 -0
  2. package/dist/cjs/core/BlankState/style.js +5 -0
  3. package/dist/cjs/core/ImmersiveDialog/index.js +33 -11
  4. package/dist/cjs/core/MediumDialog/MediumDialog.js +6 -3
  5. package/dist/cjs/core/SmallDialog/SmallDialog.js +30 -10
  6. package/dist/cjs/core/SmallDialog/SmallDialog.style.js +6 -0
  7. package/dist/cjs/core/SmallDialog/SmallDialog.widget.js +28 -0
  8. package/dist/cjs/core/index.js +21 -21
  9. package/dist/cjs/index.js +279 -274
  10. package/dist/cjs/stats1.html +1 -1
  11. package/dist/components.css +3226 -3130
  12. package/dist/esm/core/BlankState/index.js +83 -0
  13. package/dist/esm/core/BlankState/style.js +3 -0
  14. package/dist/esm/core/ImmersiveDialog/index.js +32 -11
  15. package/dist/esm/core/MediumDialog/MediumDialog.js +6 -3
  16. package/dist/esm/core/SmallDialog/SmallDialog.js +30 -10
  17. package/dist/esm/core/SmallDialog/SmallDialog.style.js +4 -1
  18. package/dist/esm/core/SmallDialog/SmallDialog.widget.js +20 -0
  19. package/dist/esm/index.js +2 -1
  20. package/dist/esm/stats1.html +1 -1
  21. package/dist/linaria.merged.scss +3893 -3784
  22. package/dist/src/core/BlankState/index.d.ts +4 -0
  23. package/dist/src/core/BlankState/style.d.ts +1 -0
  24. package/dist/src/core/BlankState/type.d.ts +49 -0
  25. package/dist/src/core/ImmersiveDialog/type.d.ts +4 -0
  26. package/dist/src/core/MediumDialog/MediumDialog.d.ts +2 -2
  27. package/dist/src/core/MediumDialog/MediumDialog.type.d.ts +5 -0
  28. package/dist/src/core/SmallDialog/SmallDialog.style.d.ts +3 -0
  29. package/dist/src/core/SmallDialog/SmallDialog.type.d.ts +8 -0
  30. package/dist/src/core/SmallDialog/SmallDialog.widget.d.ts +8 -0
  31. package/dist/src/core/index.d.ts +2 -0
  32. package/dist/stories/docs/core/BlankState.stories.d.ts +43 -0
  33. package/dist/stories/docs/core/ImmersiveDialog.stories.d.ts +6 -0
  34. package/dist/stories/docs/core/MediumDialog.stories.d.ts +8 -0
  35. package/dist/stories/docs/core/SmallDialog.stories.d.ts +4 -0
  36. package/dist/stories/docs/core/WizardDialog.stories.d.ts +3 -0
  37. package/dist/stories/utils.d.ts +12 -0
  38. package/dist/style.css +3226 -3130
  39. package/package.json +4 -4
@@ -0,0 +1,83 @@
1
+ import { cx } from '@linaria/core';
2
+ import { Typo } from '../Typo/index.js';
3
+ import React__default from 'react';
4
+ import { BlankStateWrapper } from './style.js';
5
+ import Button from '../Button/index.js';
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ const SIZE_FONT_MAP = {
24
+ large: {
25
+ title: Typo.Display.d2_bold_title,
26
+ desc: Typo.Label.l2_regular
27
+ },
28
+ medium: {
29
+ title: Typo.Display.d3_bold_title,
30
+ desc: Typo.Label.l3_regular
31
+ },
32
+ small: {
33
+ title: Typo.Heading.h2_bold_title,
34
+ desc: Typo.Label.l4_regular
35
+ },
36
+ area: {
37
+ title: Typo.Heading.h2_bold_title,
38
+ desc: Typo.Label.l4_regular
39
+ },
40
+ xSmall: {
41
+ title: Typo.Heading.h2_regular_title
42
+ }
43
+ };
44
+ const BlankState = (props) => {
45
+ const {
46
+ className,
47
+ style,
48
+ width,
49
+ height,
50
+ title,
51
+ description,
52
+ action,
53
+ backgroundColor,
54
+ size = "medium"
55
+ } = props;
56
+ const fontStyle = SIZE_FONT_MAP[size];
57
+ const buttonSize = size === "large" || size === "medium" ? "middle" : "small";
58
+ return /* @__PURE__ */ React__default.createElement(
59
+ "div",
60
+ {
61
+ className: cx(className, BlankStateWrapper, size, backgroundColor),
62
+ style: __spreadValues({
63
+ width: typeof width === "number" ? `${width}px` : width,
64
+ height: typeof height === "number" ? `${height}px` : height
65
+ }, style || {})
66
+ },
67
+ /* @__PURE__ */ React__default.createElement("div", { className: cx("title", fontStyle.title) }, title),
68
+ size !== "xSmall" && description ? /* @__PURE__ */ React__default.createElement("div", { className: cx("desc", fontStyle.desc) }, description) : null,
69
+ action ? /* @__PURE__ */ React__default.createElement(
70
+ Button,
71
+ {
72
+ type: "ordinary",
73
+ size: buttonSize,
74
+ className: cx("action-button", buttonSize),
75
+ onClick: action.onClick
76
+ },
77
+ action.label
78
+ ) : null
79
+ );
80
+ };
81
+ var BlankState$1 = BlankState;
82
+
83
+ export { BlankState$1 as default };
@@ -0,0 +1,3 @@
1
+ const BlankStateWrapper = "E_b1lj76ty";
2
+
3
+ export { BlankStateWrapper };
@@ -7,7 +7,9 @@ import Icon from '../Icon/index.js';
7
7
  import OverflowTooltip from '../../coreX/OverflowTooltip/index.js';
8
8
  import useParrotTranslation from '../../hooks/useParrotTranslation.js';
9
9
  import { Modal } from 'antd';
10
+ import cs from 'classnames';
10
11
  import React__default, { useMemo } from 'react';
12
+ import { ModelTitleSkeleton, ModelContentSkeleton, ModelInitializingError } from '../SmallDialog/SmallDialog.widget.js';
11
13
  import { FooterStyle, FooterButtonStyle, ErrorStyle, ErrorIconStyle, ErrorTextStyle, FooterButtonRightStyle, TitleStyle, ImmersiveDialogStyle, FullContentStyle, MultiAreaStyle, CloseIconStyle, BodyStyle, MultiAreaBodyStyle, CancelButtonStyle } from './styles.js';
12
14
 
13
15
  var __defProp = Object.defineProperty;
@@ -61,7 +63,9 @@ function ImmersiveDialog(props) {
61
63
  visible = true,
62
64
  isContentFull,
63
65
  onCancel,
64
- onOk
66
+ onOk,
67
+ initializing,
68
+ initializingError
65
69
  } = _a, restProps = __objRest(_a, [
66
70
  "className",
67
71
  "title",
@@ -84,15 +88,27 @@ function ImmersiveDialog(props) {
84
88
  "visible",
85
89
  "isContentFull",
86
90
  "onCancel",
87
- "onOk"
91
+ "onOk",
92
+ "initializing",
93
+ "initializingError"
88
94
  ]);
89
95
  const { t } = useParrotTranslation();
90
96
  const popModal = usePopModal();
97
+ const defaultTitle = initializingError ? t("common.load_failed") : "";
98
+ const defaultCancelText = showOk ? t("common.cancel") : t("common.close");
99
+ const defaultOkText = initializingError ? t("common.retry") : t("common.confirm");
100
+ const _cancelText = useMemo(() => {
101
+ let text = cancelText || defaultCancelText;
102
+ return text;
103
+ }, [cancelText, defaultCancelText]);
91
104
  const _confirmText = useMemo(() => {
92
- let text = okText || t("common.confirm");
105
+ let text = okText || defaultOkText;
93
106
  return text;
94
- }, [okText, t]);
107
+ }, [okText, defaultOkText]);
95
108
  const finalFooter = useMemo(() => {
109
+ if (initializing) {
110
+ return null;
111
+ }
96
112
  return footer || /* @__PURE__ */ React__default.createElement("div", { className: FooterStyle }, /* @__PURE__ */ React__default.createElement("div", { className: FooterButtonStyle }, footerLeftAction, error && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("span", { className: cx(ErrorStyle, Typo.Label.l2_regular) }, /* @__PURE__ */ React__default.createElement(
97
113
  ExclamationErrorCircleFill16RedIcon,
98
114
  {
@@ -109,6 +125,7 @@ function ImmersiveDialog(props) {
109
125
  )))), /* @__PURE__ */ React__default.createElement("div", { className: FooterButtonRightStyle }, showCancel ? /* @__PURE__ */ React__default.createElement(
110
126
  Button,
111
127
  __spreadValues({
128
+ size: "large",
112
129
  type: "quiet",
113
130
  className: CancelButtonStyle,
114
131
  onMouseDown: (e) => {
@@ -119,10 +136,11 @@ function ImmersiveDialog(props) {
119
136
  onCancel == null ? void 0 : onCancel(e);
120
137
  }
121
138
  }, cancelButtonProps),
122
- cancelText || t("common.cancel")
139
+ /* @__PURE__ */ React__default.createElement("span", { className: Typo.Label.l1_bold_title }, _cancelText)
123
140
  ) : null, showOk ? /* @__PURE__ */ React__default.createElement(
124
141
  Button,
125
142
  __spreadValues({
143
+ size: "large",
126
144
  onClick: (e) => {
127
145
  onOk == null ? void 0 : onOk(e);
128
146
  },
@@ -135,7 +153,7 @@ function ImmersiveDialog(props) {
135
153
  footerLeftAction,
136
154
  _confirmText,
137
155
  cancelButtonProps,
138
- cancelText,
156
+ _cancelText,
139
157
  error,
140
158
  footer,
141
159
  okButtonProps,
@@ -145,17 +163,20 @@ function ImmersiveDialog(props) {
145
163
  popModal,
146
164
  showCancel,
147
165
  showOk,
148
- t
166
+ initializing
149
167
  ]);
150
168
  return /* @__PURE__ */ React__default.createElement(
151
169
  Modal,
152
170
  __spreadValues({
153
171
  width: "calc(100% - 20px)",
154
- title: /* @__PURE__ */ React__default.createElement("span", { className: cx(Typo.Display.d1_bold_title, TitleStyle) }, title),
155
- className: cx(
172
+ title: initializing ? /* @__PURE__ */ React__default.createElement(ModelTitleSkeleton, null) : /* @__PURE__ */ React__default.createElement("span", { className: cx(Typo.Display.d1_bold_title, TitleStyle) }, title || defaultTitle),
173
+ className: cs(
156
174
  ImmersiveDialogStyle,
157
175
  isContentFull ? FullContentStyle : MultiAreaStyle,
158
- className
176
+ className,
177
+ {
178
+ "initializing-error": initializingError
179
+ }
159
180
  ),
160
181
  closeIcon: closeIcon != null ? closeIcon : /* @__PURE__ */ React__default.createElement(
161
182
  Icon,
@@ -175,7 +196,7 @@ function ImmersiveDialog(props) {
175
196
  visible,
176
197
  destroyOnClose: true
177
198
  }, restProps),
178
- /* @__PURE__ */ React__default.createElement("div", { className: cx(BodyStyle, isContentFull ? "" : MultiAreaBodyStyle) }, isContentFull ? null : /* @__PURE__ */ React__default.createElement("div", { className: cx("left", leftClassName) }, left), /* @__PURE__ */ React__default.createElement("div", { className: "middle" }, children), isContentFull ? null : /* @__PURE__ */ React__default.createElement("div", { className: cx("right", rightClassName) }, right))
199
+ /* @__PURE__ */ React__default.createElement("div", { className: cx(BodyStyle, isContentFull ? "" : MultiAreaBodyStyle) }, initializing || initializingError ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "middle" }, initializing ? /* @__PURE__ */ React__default.createElement(ModelContentSkeleton, { num: 4 }) : /* @__PURE__ */ React__default.createElement(ModelInitializingError, { error: initializingError }))) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, isContentFull ? null : /* @__PURE__ */ React__default.createElement("div", { className: cx("left", leftClassName) }, left), /* @__PURE__ */ React__default.createElement("div", { className: "middle" }, children), isContentFull ? null : /* @__PURE__ */ React__default.createElement("div", { className: cx("right", rightClassName) }, right)))
179
200
  );
180
201
  }
181
202
 
@@ -32,16 +32,19 @@ const MediumDialogStyle = "E_m5foqp8";
32
32
  const MediumDialog = _a => {
33
33
  var _b = _a,
34
34
  {
35
- className
35
+ className,
36
+ isContentFull = false
36
37
  } = _b,
37
- restProps = __objRest(_b, ["className"]);
38
+ restProps = __objRest(_b, ["className", "isContentFull"]);
38
39
  return /* @__PURE__ */React__default.createElement(SmallDialog, __spreadValues({
39
40
  TitleRender: ({
40
41
  title
41
42
  }) => /* @__PURE__ */React__default.createElement("span", {
42
43
  className: Typo.Display.d1s_bold_title
43
44
  }, title),
44
- className: cx(MediumDialogStyle, className)
45
+ className: cx(MediumDialogStyle, isContentFull && "content-full", className),
46
+ initializingSkeletonRows: 3,
47
+ width: isContentFull ? "calc(100vw - 160px)" : 720
45
48
  }, restProps));
46
49
  };
47
50
 
@@ -7,6 +7,8 @@ import cs from 'classnames';
7
7
  import OverflowTooltip from '../../coreX/OverflowTooltip/index.js';
8
8
  import { Show } from '../../coreX/Show/index.js';
9
9
  import { FooterStyle, ErrorTextStyle, DialogStyle, CloseIconStyle } from './SmallDialog.style.js';
10
+ import { ModelTitleSkeleton, ModelContentSkeleton, ModelInitializingError } from './SmallDialog.widget.js';
11
+ import useParrotTranslation from '../../hooks/useParrotTranslation.js';
10
12
  import Icon from '../Icon/index.js';
11
13
  import Button from '../Button/index.js';
12
14
  import { Flex } from 'antd5';
@@ -34,10 +36,11 @@ const DefaultTitleRender = ({
34
36
  return /* @__PURE__ */ React__default.createElement("span", { className: cs(Typo.Display.d2_bold_title) }, title);
35
37
  };
36
38
  const SmallDialog = ({
39
+ width = 492,
37
40
  title,
38
41
  TitleRender,
39
- cancelText = "\u5173\u95ED",
40
- okText = "\u786E\u5B9A",
42
+ cancelText,
43
+ okText,
41
44
  showOk = true,
42
45
  onOk,
43
46
  onCancel,
@@ -50,8 +53,12 @@ const SmallDialog = ({
50
53
  children,
51
54
  showFooterErrorIcon = true,
52
55
  error,
53
- confirmLoading
56
+ confirmLoading,
57
+ initializing,
58
+ initializingError,
59
+ initializingSkeletonRows
54
60
  }) => {
61
+ const { t } = useParrotTranslation();
55
62
  const popModal = usePopModal();
56
63
  const handleClose = () => {
57
64
  if (onCancel) {
@@ -68,12 +75,16 @@ const SmallDialog = ({
68
75
  }
69
76
  };
70
77
  const CustomTitleRender = TitleRender || DefaultTitleRender;
78
+ const defaultTitle = initializingError ? t("common.load_failed") : "";
79
+ const defaultCancelText = showOk ? t("common.cancel") : t("common.close");
80
+ const defaultOkText = initializingError ? t("common.retry") : t("common.confirm");
71
81
  return /* @__PURE__ */ React__default.createElement(
72
82
  Modal,
73
83
  {
74
84
  visible: true,
75
- title: /* @__PURE__ */ React__default.createElement(CustomTitleRender, { title }),
76
- footer: /* @__PURE__ */ React__default.createElement(
85
+ width,
86
+ title: initializing ? /* @__PURE__ */ React__default.createElement(ModelTitleSkeleton, null) : /* @__PURE__ */ React__default.createElement(CustomTitleRender, { title: title || defaultTitle }),
87
+ footer: initializing ? null : /* @__PURE__ */ React__default.createElement(
77
88
  "div",
78
89
  {
79
90
  className: cs(FooterStyle, footerClassName, {
@@ -95,7 +106,14 @@ const SmallDialog = ({
95
106
  iconWidth: 16
96
107
  }
97
108
  )),
98
- /* @__PURE__ */ React__default.createElement(OverflowTooltip, { multiLines: 3, content: error, tooltip: error })
109
+ /* @__PURE__ */ React__default.createElement(
110
+ OverflowTooltip,
111
+ {
112
+ multiLines: 3,
113
+ content: error,
114
+ tooltip: error
115
+ }
116
+ )
99
117
  )),
100
118
  /* @__PURE__ */ React__default.createElement(Flex, null, /* @__PURE__ */ React__default.createElement(
101
119
  Button,
@@ -104,7 +122,7 @@ const SmallDialog = ({
104
122
  onClick: handleClose,
105
123
  className: Typo.Label.l2_bold_title
106
124
  }, cancelButtonProps),
107
- cancelText
125
+ cancelText || defaultCancelText
108
126
  ), showOk && /* @__PURE__ */ React__default.createElement(
109
127
  Button,
110
128
  __spreadValues({
@@ -112,13 +130,15 @@ const SmallDialog = ({
112
130
  onClick: handleOk,
113
131
  loading: confirmLoading
114
132
  }, okButtonProps),
115
- okText
133
+ okText || defaultOkText
116
134
  ))
117
135
  ),
118
136
  onCancel: handleClose,
119
137
  closable,
120
138
  maskClosable,
121
- className: cx(DialogStyle, className),
139
+ className: cs(DialogStyle, className, {
140
+ "initializing-error": initializingError
141
+ }),
122
142
  closeIcon: /* @__PURE__ */ React__default.createElement(
123
143
  Icon,
124
144
  {
@@ -130,7 +150,7 @@ const SmallDialog = ({
130
150
  }
131
151
  )
132
152
  },
133
- children
153
+ initializing ? /* @__PURE__ */ React__default.createElement(ModelContentSkeleton, { num: initializingSkeletonRows }) : initializingError ? /* @__PURE__ */ React__default.createElement(ModelInitializingError, { error: initializingError }) : children
134
154
  );
135
155
  };
136
156
 
@@ -2,5 +2,8 @@ const DialogStyle = "E_dxyv8bv";
2
2
  const FooterStyle = "E_fbgo4wr";
3
3
  const ErrorTextStyle = "E_ekxnz54";
4
4
  const CloseIconStyle = "E_ct1041x";
5
+ const ModelTitleSkeletonStyle = "E_m1k84ymw";
6
+ const ModelContentSkeletonStyle = "E_m15ds5xe";
7
+ const ModelInitializingErrorStyle = "E_ma56n19";
5
8
 
6
- export { CloseIconStyle, DialogStyle, ErrorTextStyle, FooterStyle };
9
+ export { CloseIconStyle, DialogStyle, ErrorTextStyle, FooterStyle, ModelContentSkeletonStyle, ModelInitializingErrorStyle, ModelTitleSkeletonStyle };
@@ -0,0 +1,20 @@
1
+ import { cx } from '@linaria/core';
2
+ import React__default from 'react';
3
+ import { ModelTitleSkeletonStyle, ModelContentSkeletonStyle, ModelInitializingErrorStyle } from './SmallDialog.style.js';
4
+ import useParrotTranslation from '../../hooks/useParrotTranslation.js';
5
+ import Skeleton from '../Skeleton/index.js';
6
+ import { Space } from 'antd';
7
+ import { Typo } from '../Typo/index.js';
8
+
9
+ const ModelTitleSkeleton = () => {
10
+ return /* @__PURE__ */ React__default.createElement("div", { className: cx(ModelTitleSkeletonStyle, "initializing-title") }, /* @__PURE__ */ React__default.createElement(Skeleton.Content, null));
11
+ };
12
+ const ModelContentSkeleton = ({ num = 2 }) => {
13
+ return /* @__PURE__ */ React__default.createElement(Space, { direction: "vertical", size: 16, className: ModelContentSkeletonStyle }, Array.from({ length: num }).map((_, index) => /* @__PURE__ */ React__default.createElement("div", { key: index, className: "skeleton-wrapper" }, /* @__PURE__ */ React__default.createElement(Skeleton.Content, null))));
14
+ };
15
+ const ModelInitializingError = ({ error }) => {
16
+ const { t } = useParrotTranslation();
17
+ return /* @__PURE__ */ React__default.createElement("div", { className: ModelInitializingErrorStyle }, /* @__PURE__ */ React__default.createElement("p", { className: Typo.Display.d3_bold_title }, t("components.initializing_failed")), /* @__PURE__ */ React__default.createElement("div", { className: Typo.Label.l3_regular }, error));
18
+ };
19
+
20
+ export { ModelContentSkeleton, ModelInitializingError, ModelTitleSkeleton };
package/dist/esm/index.js CHANGED
@@ -17,6 +17,7 @@ export { default as Badge } from './core/Badge/index.js';
17
17
  export { default as BaseIcon } from './core/BaseIcon/index.js';
18
18
  export { default as Bit } from './core/Bit/index.js';
19
19
  export { default as BitPerSecond } from './core/BitPerSecond/index.js';
20
+ export { default as BlankState } from './core/BlankState/index.js';
20
21
  export { default as Bps } from './core/Bps/index.js';
21
22
  export { BreadWrapper, default as Breadcrumb } from './core/Breadcrumb/index.js';
22
23
  export { default as Button } from './core/Button/index.js';
@@ -113,7 +114,7 @@ export { SidebarMenu } from './core/SidebarMenu/SidebarMenu.js';
113
114
  export { default as Skeleton } from './core/Skeleton/index.js';
114
115
  export { default as SkeletonContent } from './core/Skeleton/Content.js';
115
116
  export { SmallDialog } from './core/SmallDialog/SmallDialog.js';
116
- export { CloseIconStyle, DialogStyle, ErrorTextStyle, FooterStyle } from './core/SmallDialog/SmallDialog.style.js';
117
+ export { CloseIconStyle, DialogStyle, ErrorTextStyle, FooterStyle, ModelContentSkeletonStyle, ModelInitializingErrorStyle, ModelTitleSkeletonStyle } from './core/SmallDialog/SmallDialog.style.js';
117
118
  export { CircleProgress } from './core/StepProgress/index.js';
118
119
  export { CannotOperationInfo, CommonContent, ContentWrapper, Desc, Description, Divider, Dot, ErrorSpan, ExpandArrow, FieldTitle, FormField, FormItemDiv, FormSectionTitle, FormWrapper, FullView, HorizontalWizardModalCompactStyle, HorizontalWizardModalLooseStyle, InfoAlert, InputStyle, KitInputStyle, LeftEndInputStyle, LeftEndSelectStyle, LightDesc, LoadingWrapper, ModalBody, ModalWrapper, NameTag, NormalAlert, NoticeAlert, OperationWraper, RadioDesc, RightEndInputStyle, RightEndSelectStyle, SelectOptionDisabledText, TagSpan, TertiaryText, UnitStyle, WarningAlert, WizardBody, radioStyle } from './core/Styled/index.js';
119
120
  export { useTableBodyHasScrollBar } from './core/Table/common.js';