@cloudtower/eagle 0.32.46 → 0.32.48

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,117 @@
1
+ import { Loading8GradientBlueIcon } from '@cloudtower/icons-react';
2
+ import { styled } from '@linaria/react';
3
+ import Icon from '../Icon/index.js';
4
+ import { Typo } from '../Typo/index.js';
5
+ import OverflowTooltip from '../../coreX/OverflowTooltip/index.js';
6
+ import cs from 'classnames';
7
+ import React__default from 'react';
8
+
9
+ var __defProp = Object.defineProperty;
10
+ var __defProps = Object.defineProperties;
11
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
12
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
15
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value
20
+ }) : obj[key] = value;
21
+ var __spreadValues = (a, b) => {
22
+ for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
23
+ if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
24
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
25
+ }
26
+ return a;
27
+ };
28
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
29
+ var __objRest = (source, exclude) => {
30
+ var target = {};
31
+ for (var prop in source) if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
32
+ if (source != null && __getOwnPropSymbols) for (var prop of __getOwnPropSymbols(source)) {
33
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ const LegendPresetColors = ["blue", "red", "yellow", "green", "gray", "purple"];
38
+ const LegendStyle = "E_l1ucdodl";
39
+ const StatusCodeCircle = /*#__PURE__*/styled('i')({
40
+ name: "StatusCodeCircle",
41
+ class: "E_s1qj66nc",
42
+ propsAsIs: false
43
+ });
44
+ const StatusCodeSquare = /*#__PURE__*/styled('i')({
45
+ name: "StatusCodeSquare",
46
+ class: "E_s5x1boq",
47
+ propsAsIs: false
48
+ });
49
+ const LegendIcon = ({
50
+ shape
51
+ }) => {
52
+ switch (shape) {
53
+ case "loading":
54
+ return /* @__PURE__ */React__default.createElement(Icon, {
55
+ className: "ui-kit-status-legend-icon ui-kit-status-legend-icon-loading",
56
+ iconWidth: 8,
57
+ iconHeight: 8,
58
+ isRotate: true,
59
+ src: Loading8GradientBlueIcon
60
+ });
61
+ case "square":
62
+ return /* @__PURE__ */React__default.createElement(StatusCodeSquare, {
63
+ className: "ui-kit-status-legend-icon"
64
+ });
65
+ case "circle":
66
+ return /* @__PURE__ */React__default.createElement(StatusCodeCircle, {
67
+ className: "ui-kit-status-legend-icon"
68
+ });
69
+ }
70
+ };
71
+ const ColorMap = {
72
+ success: "green",
73
+ danger: "red",
74
+ warning: "yellow"
75
+ };
76
+ const Legend = _a => {
77
+ var _b = _a,
78
+ {
79
+ label,
80
+ color = "gray",
81
+ className,
82
+ hoverable = false,
83
+ children,
84
+ number,
85
+ shape = "circle",
86
+ onTintMode = false
87
+ } = _b,
88
+ props = __objRest(_b, ["label", "color", "className", "hoverable", "children", "number", "shape", "onTintMode"]);
89
+ const computedColor = ColorMap[color] || color;
90
+ const content = /* @__PURE__ */React__default.createElement(React__default.Fragment, null, label || children, !!number && /* @__PURE__ */React__default.createElement("span", {
91
+ className: cs("E_c1xm185", "ui-kit-status-legend-number", {
92
+ "on-tint": onTintMode
93
+ })
94
+ }, number));
95
+ return /* @__PURE__ */React__default.createElement("div", __spreadProps(__spreadValues({}, props), {
96
+ className: cs(className, LegendStyle, Typo.Label.l4_regular, "ui-kit-status-legend", {
97
+ [`eagle-legend-${computedColor}`]: shape !== "loading" && LegendPresetColors.includes(computedColor),
98
+ "tag-hover": hoverable,
99
+ "on-tint": onTintMode
100
+ }),
101
+ color: computedColor,
102
+ onClick: e => {
103
+ if (props.onClick) {
104
+ props.onClick(e, props.key);
105
+ }
106
+ }
107
+ }), /* @__PURE__ */React__default.createElement(LegendIcon, {
108
+ shape
109
+ }), /* @__PURE__ */React__default.createElement(OverflowTooltip, {
110
+ content,
111
+ tooltip: content,
112
+ className: "E_c1x5l5qc"
113
+ }));
114
+ };
115
+ var Legend$1 = Legend;
116
+
117
+ export { LegendIcon, LegendPresetColors, Legend$1 as default };
@@ -60,14 +60,15 @@ const CheckPointList = ({
60
60
  emptyRender,
61
61
  emptyText,
62
62
  emptyTextClassName,
63
- onClickSwitch
63
+ onClickSwitch,
64
+ defaultChecked = false
64
65
  }) => {
65
66
  const { t } = useParrotTranslation();
66
- const [checked, setChecked] = useState(false);
67
+ const [checked, setChecked] = useState(defaultChecked);
67
68
  const onClickSwitchFn = useCallback(() => {
68
69
  const nextChecked = !checked;
69
70
  setChecked(nextChecked);
70
- onClickSwitch == null ? void 0 : onClickSwitch(checked);
71
+ onClickSwitch == null ? void 0 : onClickSwitch(nextChecked);
71
72
  }, [onClickSwitch, checked]);
72
73
  const isEmpty = !items.length;
73
74
  return /* @__PURE__ */ React__default.createElement("div", { className: cx(CheckPointListStyle) }, /* @__PURE__ */ React__default.createElement("header", { className: cx(Typo.Label.l4_bold) }, title, /* @__PURE__ */ React__default.createElement(Show, { condition: showSwitchControl }, /* @__PURE__ */ React__default.createElement("span", { className: "switch-text" }, /* @__PURE__ */ React__default.createElement(Switch, { checked, onChange: onClickSwitchFn, size: "small" }), /* @__PURE__ */ React__default.createElement("span", null, switchText || t("common.show_unpassed"))))), /* @__PURE__ */ React__default.createElement(
package/dist/esm/index.js CHANGED
@@ -48,6 +48,7 @@ export { default as LegacySelect } from './core/LegacySelect/index.js';
48
48
  export { default as LineChart } from './core/LineChart/index.js';
49
49
  export { default as Link } from './core/Link/index.js';
50
50
  export { default as Loading } from './core/Loading/index.js';
51
+ export { default as Legend, LegendIcon, LegendPresetColors } from './core/Legend/index.js';
51
52
  export { DEFAULT_DURATION, attachTypeApi, getKeyThenIncreaseKey, default as message } from './core/message/index.js';
52
53
  export { default as Metric } from './core/Metric/index.js';
53
54
  export { default as Modal } from './core/Modal/index.js';