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.
@@ -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 i, jsxs as l, Fragment as m } from "react/jsx-runtime";
2
- import { useState as p, useEffect as v } from "react";
3
- import { X as M } from "../../XClose-CCu1vrNS.js";
4
- import { c as d } from "../../clsx-OuTLNxxd.js";
5
- import { Button as k } from "../Button/index.js";
6
- import { Container as W } from "../Container/index.js";
7
- const _ = "MhRkRW_active", g = "MhRkRW_attention", N = "MhRkRW_carousel", x = "MhRkRW_close", C = "MhRkRW_container", w = "MhRkRW_content", y = "MhRkRW_danger", A = "MhRkRW_description", I = "MhRkRW_notification", b = "MhRkRW_slide", j = "MhRkRW_success", X = "MhRkRW_title", e = {
8
- active: _,
9
- attention: g,
10
- carousel: N,
11
- close: x,
12
- container: C,
13
- content: w,
14
- danger: y,
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: A,
17
- notification: I,
18
- slide: b,
19
- success: j,
20
- title: X
17
+ description: z,
18
+ notification: D,
19
+ slide: S,
20
+ success: U,
21
+ title: q,
22
+ titleText: G
21
23
  };
22
- function q({
24
+ function et({
25
+ id: v,
23
26
  content: c,
24
- variant: o = "default",
25
- closable: h = !0,
26
- onClose: R
27
+ variant: d = "default",
28
+ closable: M = !0,
29
+ onClose: g
27
30
  }) {
28
- const n = Array.isArray(c) ? c : [c], [u, f] = p(
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
- v(() => {
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
- f((s) => (s + 1) % n.length);
37
+ k((s) => (s + 1) % n.length);
35
38
  }, 15e3);
36
39
  return () => window.clearInterval(t);
37
- }, [n.length]);
38
- const a = (t) => {
39
- const s = /* @__PURE__ */ l(m, { children: [
40
- t.title && /* @__PURE__ */ i("span", { className: e.title, children: t.title }),
41
- t.description && /* @__PURE__ */ i("span", { className: e.description, children: t.description })
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 t.url ? /* @__PURE__ */ i("a", { href: t.url, className: e.content, children: s }) : /* @__PURE__ */ i("div", { className: e.content, children: s });
51
+ return /* @__PURE__ */ a("div", { className: e.content, "aria-hidden": !s, children: o });
44
52
  };
45
- return n.length ? /* @__PURE__ */ i(
46
- "div",
53
+ return n.length ? /* @__PURE__ */ a(
54
+ N,
47
55
  {
48
- className: d(e.notification, e[o]),
56
+ className: m(e.notification, e[d]),
49
57
  "data-theme": "light",
50
- children: /* @__PURE__ */ l(W, { className: e.container, children: [
51
- n.length > 1 ? /* @__PURE__ */ i("div", { className: e.carousel, "aria-live": "polite", children: n.map((t, s) => {
52
- const r = s === u;
53
- return /* @__PURE__ */ i(
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: d(e.slide, { [e.active]: r }),
57
- "aria-hidden": !r,
58
- children: a(t)
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
- }) }) : a(n[0]),
63
- h && /* @__PURE__ */ i(
64
- k,
80
+ }) }) : p(n[0]),
81
+ M && /* @__PURE__ */ a(
82
+ y,
65
83
  {
66
- variant: o === "default" ? "brand" : "transparent",
84
+ variant: d === "default" ? "brand" : "transparent",
67
85
  size: 100,
68
86
  className: e.close,
69
87
  "aria-label": "Close notification",
70
- onClick: () => R?.(),
71
- children: /* @__PURE__ */ i(M, {})
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
- q as Notification
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, b as qe } from "../../utils-CT0G9Gzw.js";
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
+ };