@reportportal/ui-kit 0.0.1-alpha.191 → 0.0.1-alpha.192
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/systemAlert.js +32 -30
- package/package.json +1 -1
package/dist/systemAlert.js
CHANGED
|
@@ -1,51 +1,53 @@
|
|
|
1
1
|
import { jsxs as g, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useState as h, useRef as
|
|
3
|
-
import { c as
|
|
2
|
+
import { useState as h, useRef as R, useEffect as _ } from "react";
|
|
3
|
+
import { c as v } from "./bind-06a7ff84.js";
|
|
4
4
|
import { S as I } from "./close-4d480ef7.js";
|
|
5
|
-
import { S as
|
|
6
|
-
var
|
|
7
|
-
const k = "_error_jbf1d_14",
|
|
5
|
+
import { S as E, b as S, a as p } from "./success-8fd8bd2c.js";
|
|
6
|
+
var n = /* @__PURE__ */ ((t) => (t.INFO = "info", t.SUCCESS = "success", t.WARNING = "warning", t.ERROR = "error", t))(n || {}), f = /* @__PURE__ */ ((t) => (t.WHITE = "white", t.BLACK = "black", t))(f || {});
|
|
7
|
+
const k = "_error_jbf1d_14", O = "_success_jbf1d_17", x = "_info_jbf1d_20", H = "_warning_jbf1d_23", W = "_title_jbf1d_38", F = {
|
|
8
8
|
"system-alert": "_system-alert_jbf1d_1",
|
|
9
9
|
"system-alert--black": "_system-alert--black_jbf1d_11",
|
|
10
10
|
error: k,
|
|
11
|
-
success:
|
|
12
|
-
info:
|
|
11
|
+
success: O,
|
|
12
|
+
info: x,
|
|
13
13
|
warning: H,
|
|
14
14
|
"icon-wrapper": "_icon-wrapper_jbf1d_26",
|
|
15
15
|
"content-wrapper": "_content-wrapper_jbf1d_32",
|
|
16
|
-
title:
|
|
16
|
+
title: W,
|
|
17
17
|
"title--white": "_title--white_jbf1d_50",
|
|
18
18
|
"title--black": "_title--black_jbf1d_53",
|
|
19
19
|
"close-button": "_close-button_jbf1d_56"
|
|
20
|
-
}, s =
|
|
20
|
+
}, s = v.bind(F), T = 4e3, A = ({
|
|
21
21
|
title: t,
|
|
22
|
-
onClose:
|
|
22
|
+
onClose: a,
|
|
23
23
|
icon: u = null,
|
|
24
|
-
type:
|
|
25
|
-
typographyColor:
|
|
26
|
-
duration:
|
|
24
|
+
type: r = n.INFO,
|
|
25
|
+
typographyColor: o = f.WHITE,
|
|
26
|
+
duration: l = T,
|
|
27
27
|
className: m,
|
|
28
28
|
dataAutomationId: b
|
|
29
29
|
}) => {
|
|
30
|
-
const
|
|
30
|
+
const [d, w] = h(""), c = R(null);
|
|
31
31
|
_(() => {
|
|
32
|
-
const { offsetHeight:
|
|
33
|
-
|
|
32
|
+
const { offsetHeight: i, scrollHeight: N } = c == null ? void 0 : c.current;
|
|
33
|
+
i < N && w(t);
|
|
34
34
|
}, [t]), _(() => {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
if ([n.WARNING, n.ERROR].includes(r))
|
|
36
|
+
return;
|
|
37
|
+
const i = setTimeout(() => {
|
|
38
|
+
a();
|
|
37
39
|
}, l);
|
|
38
|
-
return () => clearTimeout(
|
|
39
|
-
}, [l,
|
|
40
|
-
const
|
|
41
|
-
switch (
|
|
40
|
+
return () => clearTimeout(i);
|
|
41
|
+
}, [r, l, a]);
|
|
42
|
+
const j = () => {
|
|
43
|
+
switch (r) {
|
|
42
44
|
case "info":
|
|
43
|
-
return /* @__PURE__ */ e(
|
|
45
|
+
return /* @__PURE__ */ e(p, {});
|
|
44
46
|
case "success":
|
|
45
47
|
return /* @__PURE__ */ e(S, {});
|
|
46
48
|
case "warning":
|
|
47
49
|
case "error":
|
|
48
|
-
return /* @__PURE__ */ e(
|
|
50
|
+
return /* @__PURE__ */ e(E, {});
|
|
49
51
|
default:
|
|
50
52
|
return u;
|
|
51
53
|
}
|
|
@@ -53,17 +55,17 @@ const k = "_error_jbf1d_14", x = "_success_jbf1d_17", D = "_info_jbf1d_20", H =
|
|
|
53
55
|
return /* @__PURE__ */ g(
|
|
54
56
|
"div",
|
|
55
57
|
{
|
|
56
|
-
className: s("system-alert",
|
|
57
|
-
title:
|
|
58
|
+
className: s("system-alert", r, m, `system-alert--${o}`),
|
|
59
|
+
title: d,
|
|
58
60
|
"data-automation-id": b,
|
|
59
61
|
children: [
|
|
60
|
-
/* @__PURE__ */ e("div", { className: s("icon-wrapper"), children:
|
|
61
|
-
/* @__PURE__ */ e("div", { className: s("content-wrapper"), children: /* @__PURE__ */ e("h2", { ref:
|
|
62
|
-
/* @__PURE__ */ e("button", { className: s("close-button"), onClick:
|
|
62
|
+
/* @__PURE__ */ e("div", { className: s("icon-wrapper"), children: j() }),
|
|
63
|
+
/* @__PURE__ */ e("div", { className: s("content-wrapper"), children: /* @__PURE__ */ e("h2", { ref: c, className: s("title", `title--${o}`), children: t }) }),
|
|
64
|
+
/* @__PURE__ */ e("button", { className: s("close-button"), onClick: a, "aria-label": "close system alert", children: /* @__PURE__ */ e(I, {}) })
|
|
63
65
|
]
|
|
64
66
|
}
|
|
65
67
|
);
|
|
66
68
|
};
|
|
67
69
|
export {
|
|
68
|
-
|
|
70
|
+
A as SystemAlert
|
|
69
71
|
};
|