highsoft-ui 1.0.87 → 1.0.89
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/components/Footer/index.js +1 -1
- package/dist/components/Header/index.js +375 -325
- package/dist/components/Notification/index.d.ts +3 -1
- package/dist/components/Notification/index.js +71 -51
- package/dist/components/PrefPanel/index.js +1 -1
- package/dist/components/ThemeLoader/index.d.ts +2 -0
- package/dist/components/ThemeLoader/index.js +29 -0
- package/dist/highsoft-ui.css +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.js +19 -16
- package/dist/{utils-CT0G9Gzw.js → utils-BKDJp1i0.js} +4 -3
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +5 -4
- package/package.json +1 -1
|
@@ -3,8 +3,10 @@ export interface NotificationItem {
|
|
|
3
3
|
title?: string;
|
|
4
4
|
description?: string;
|
|
5
5
|
url?: string;
|
|
6
|
+
tag?: 'new';
|
|
6
7
|
}
|
|
7
|
-
export declare function Notification({ content, variant, closable, onClose }: {
|
|
8
|
+
export declare function Notification({ id, content, variant, closable, onClose }: {
|
|
9
|
+
id?: string;
|
|
8
10
|
content: NotificationItem | Array<NotificationItem>;
|
|
9
11
|
variant?: NotificationVariant;
|
|
10
12
|
closable?: boolean;
|
|
@@ -1,74 +1,94 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { X as
|
|
4
|
-
import { c as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Container as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsx as a, jsxs as r, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useEffect as C } from "react";
|
|
3
|
+
import { X as F } from "../../XClose-CCu1vrNS.js";
|
|
4
|
+
import { c as m } from "../../clsx-OuTLNxxd.js";
|
|
5
|
+
import { Button as y } from "../Button/index.js";
|
|
6
|
+
import { Container as A } from "../Container/index.js";
|
|
7
|
+
import { NewTag as B } from "../NewTag/index.js";
|
|
8
|
+
const E = "MhRkRW_active", j = "MhRkRW_attention", H = "MhRkRW_carousel", L = "MhRkRW_close", P = "MhRkRW_container", X = "MhRkRW_content", $ = "MhRkRW_danger", z = "MhRkRW_description", D = "MhRkRW_notification", S = "MhRkRW_slide", U = "MhRkRW_success", q = "MhRkRW_title", G = "MhRkRW_titleText", e = {
|
|
9
|
+
active: E,
|
|
10
|
+
attention: j,
|
|
11
|
+
carousel: H,
|
|
12
|
+
close: L,
|
|
13
|
+
container: P,
|
|
14
|
+
content: X,
|
|
15
|
+
danger: $,
|
|
15
16
|
default: "MhRkRW_default",
|
|
16
|
-
description:
|
|
17
|
-
notification:
|
|
18
|
-
slide:
|
|
19
|
-
success:
|
|
20
|
-
title:
|
|
17
|
+
description: z,
|
|
18
|
+
notification: D,
|
|
19
|
+
slide: S,
|
|
20
|
+
success: U,
|
|
21
|
+
title: q,
|
|
22
|
+
titleText: G
|
|
21
23
|
};
|
|
22
|
-
function
|
|
24
|
+
function et({
|
|
25
|
+
id: v,
|
|
23
26
|
content: c,
|
|
24
|
-
variant:
|
|
25
|
-
closable:
|
|
26
|
-
onClose:
|
|
27
|
+
variant: d = "default",
|
|
28
|
+
closable: M = !0,
|
|
29
|
+
onClose: g
|
|
27
30
|
}) {
|
|
28
|
-
const n = Array.isArray(c) ? c : [c], [
|
|
31
|
+
const n = Array.isArray(c) ? c : [c], [h, k] = l(
|
|
29
32
|
() => n.length > 1 ? Math.floor(Math.random() * n.length) : 0
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
if (n.length <= 1) return;
|
|
33
|
+
), [W, u] = l(!1), [_, f] = l(!1), R = W || _, i = n[h]?.url, N = i ? "a" : "div";
|
|
34
|
+
C(() => {
|
|
35
|
+
if (n.length <= 1 || R) return;
|
|
33
36
|
const t = window.setInterval(() => {
|
|
34
|
-
|
|
37
|
+
k((s) => (s + 1) % n.length);
|
|
35
38
|
}, 15e3);
|
|
36
39
|
return () => window.clearInterval(t);
|
|
37
|
-
}, [n.length]);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
}, [n.length, R]);
|
|
41
|
+
const x = () => u(!0), I = (t) => {
|
|
42
|
+
t.currentTarget.contains(t.relatedTarget) || u(!1);
|
|
43
|
+
}, T = () => f(!0), b = () => f(!1), p = (t, s = !0) => {
|
|
44
|
+
const o = /* @__PURE__ */ r(w, { children: [
|
|
45
|
+
t.title && /* @__PURE__ */ r("span", { className: e.title, children: [
|
|
46
|
+
t.tag === "new" && /* @__PURE__ */ a(B, { variant: "brand", icon: !1 }),
|
|
47
|
+
/* @__PURE__ */ a("span", { className: e.titleText, children: t.title })
|
|
48
|
+
] }),
|
|
49
|
+
t.description && /* @__PURE__ */ a("span", { className: e.description, children: t.description })
|
|
42
50
|
] });
|
|
43
|
-
return
|
|
51
|
+
return /* @__PURE__ */ a("div", { className: e.content, "aria-hidden": !s, children: o });
|
|
44
52
|
};
|
|
45
|
-
return n.length ? /* @__PURE__ */
|
|
46
|
-
|
|
53
|
+
return n.length ? /* @__PURE__ */ a(
|
|
54
|
+
N,
|
|
47
55
|
{
|
|
48
|
-
className:
|
|
56
|
+
className: m(e.notification, e[d]),
|
|
49
57
|
"data-theme": "light",
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
...i ? {
|
|
59
|
+
href: i,
|
|
60
|
+
"data-track": "header-banner",
|
|
61
|
+
"data-track-action": "click",
|
|
62
|
+
"data-track-label": v || i
|
|
63
|
+
} : {},
|
|
64
|
+
onFocus: x,
|
|
65
|
+
onBlur: I,
|
|
66
|
+
onMouseEnter: T,
|
|
67
|
+
onMouseLeave: b,
|
|
68
|
+
children: /* @__PURE__ */ r(A, { className: e.container, children: [
|
|
69
|
+
n.length > 1 ? /* @__PURE__ */ a("div", { className: e.carousel, "aria-live": "polite", children: n.map((t, s) => {
|
|
70
|
+
const o = s === h;
|
|
71
|
+
return /* @__PURE__ */ a(
|
|
54
72
|
"div",
|
|
55
73
|
{
|
|
56
|
-
className:
|
|
57
|
-
"aria-hidden": !
|
|
58
|
-
children:
|
|
74
|
+
className: m(e.slide, { [e.active]: o }),
|
|
75
|
+
"aria-hidden": !o,
|
|
76
|
+
children: p(t, o)
|
|
59
77
|
},
|
|
60
78
|
`${t.title ?? t.description ?? "item"}-${s}`
|
|
61
79
|
);
|
|
62
|
-
}) }) :
|
|
63
|
-
|
|
64
|
-
|
|
80
|
+
}) }) : p(n[0]),
|
|
81
|
+
M && /* @__PURE__ */ a(
|
|
82
|
+
y,
|
|
65
83
|
{
|
|
66
|
-
variant:
|
|
84
|
+
variant: d === "default" ? "brand" : "transparent",
|
|
67
85
|
size: 100,
|
|
68
86
|
className: e.close,
|
|
69
87
|
"aria-label": "Close notification",
|
|
70
|
-
onClick: () =>
|
|
71
|
-
|
|
88
|
+
onClick: (t) => {
|
|
89
|
+
t.preventDefault(), t.stopPropagation(), g?.();
|
|
90
|
+
},
|
|
91
|
+
children: /* @__PURE__ */ a(F, {})
|
|
72
92
|
}
|
|
73
93
|
)
|
|
74
94
|
] })
|
|
@@ -76,5 +96,5 @@ function q({
|
|
|
76
96
|
) : null;
|
|
77
97
|
}
|
|
78
98
|
export {
|
|
79
|
-
|
|
99
|
+
et as Notification
|
|
80
100
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as w, jsxs as q, Fragment as ne } from "react/jsx-runtime";
|
|
2
|
-
import { z as Qe,
|
|
2
|
+
import { z as Qe, c as qe } from "../../utils-BKDJp1i0.js";
|
|
3
3
|
import * as g from "react";
|
|
4
4
|
import { useLayoutEffect as Ge } from "react";
|
|
5
5
|
import { C as Ue } from "../../Check-Cm4roSEj.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const themeLoaderScript = "(() => {\n const THEME_KEY = 'theme';\n const cookie = document.cookie\n .split('; ')\n .find((row) => row.startsWith(`${THEME_KEY}=`));\n\n if (!cookie) return;\n\n const value = decodeURIComponent(cookie.split('=')[1] || '');\n if (!value) return;\n\n try {\n const current = localStorage.getItem(THEME_KEY);\n if (current !== value) {\n localStorage.setItem(THEME_KEY, value);\n }\n } catch (error) {}\n\n document.documentElement.setAttribute('data-theme', value);\n document.documentElement.classList.add(value);\n})();";
|
|
2
|
+
export declare function ThemeLoader(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
const t = `(() => {
|
|
3
|
+
const THEME_KEY = 'theme';
|
|
4
|
+
const cookie = document.cookie
|
|
5
|
+
.split('; ')
|
|
6
|
+
.find((row) => row.startsWith(\`\${THEME_KEY}=\`));
|
|
7
|
+
|
|
8
|
+
if (!cookie) return;
|
|
9
|
+
|
|
10
|
+
const value = decodeURIComponent(cookie.split('=')[1] || '');
|
|
11
|
+
if (!value) return;
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const current = localStorage.getItem(THEME_KEY);
|
|
15
|
+
if (current !== value) {
|
|
16
|
+
localStorage.setItem(THEME_KEY, value);
|
|
17
|
+
}
|
|
18
|
+
} catch (error) {}
|
|
19
|
+
|
|
20
|
+
document.documentElement.setAttribute('data-theme', value);
|
|
21
|
+
document.documentElement.classList.add(value);
|
|
22
|
+
})();`;
|
|
23
|
+
function r() {
|
|
24
|
+
return /* @__PURE__ */ e("script", { dangerouslySetInnerHTML: { __html: t } });
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
r as ThemeLoader,
|
|
28
|
+
t as themeLoaderScript
|
|
29
|
+
};
|