highsoft-ui 1.0.85 → 1.0.87

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.
@@ -1,50 +1,80 @@
1
- import { jsx as n, jsxs as a } from "react/jsx-runtime";
2
- import "react";
3
- import { X as r } from "../../XClose-CCu1vrNS.js";
4
- import { c as l } from "../../clsx-OuTLNxxd.js";
5
- import { Button as R } from "../Button/index.js";
6
- import { Container as d } from "../Container/index.js";
7
- const m = "MhRkRW_attention", f = "MhRkRW_close", h = "MhRkRW_container", p = "MhRkRW_danger", u = "MhRkRW_description", k = "MhRkRW_notification", M = "MhRkRW_success", W = "MhRkRW_title", t = {
8
- attention: m,
9
- close: f,
10
- container: h,
11
- danger: p,
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,
12
15
  default: "MhRkRW_default",
13
- description: u,
14
- notification: k,
15
- success: M,
16
- title: W
16
+ description: A,
17
+ notification: I,
18
+ slide: b,
19
+ success: j,
20
+ title: X
17
21
  };
18
- function j({
19
- children: e,
22
+ function q({
23
+ content: c,
20
24
  variant: o = "default",
21
- description: i,
22
- closable: s = !0,
23
- onClose: c
25
+ closable: h = !0,
26
+ onClose: R
24
27
  }) {
25
- return /* @__PURE__ */ n(
28
+ const n = Array.isArray(c) ? c : [c], [u, f] = p(
29
+ () => n.length > 1 ? Math.floor(Math.random() * n.length) : 0
30
+ );
31
+ v(() => {
32
+ if (n.length <= 1) return;
33
+ const t = window.setInterval(() => {
34
+ f((s) => (s + 1) % n.length);
35
+ }, 15e3);
36
+ 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 })
42
+ ] });
43
+ return t.url ? /* @__PURE__ */ i("a", { href: t.url, className: e.content, children: s }) : /* @__PURE__ */ i("div", { className: e.content, children: s });
44
+ };
45
+ return n.length ? /* @__PURE__ */ i(
26
46
  "div",
27
47
  {
28
- className: l(t.notification, t[o]),
48
+ className: d(e.notification, e[o]),
29
49
  "data-theme": "light",
30
- children: /* @__PURE__ */ a(d, { className: t.container, children: [
31
- /* @__PURE__ */ n("span", { className: t.title, children: e }),
32
- i && /* @__PURE__ */ n("span", { className: t.description, children: i }),
33
- s && /* @__PURE__ */ n(
34
- R,
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(
54
+ "div",
55
+ {
56
+ className: d(e.slide, { [e.active]: r }),
57
+ "aria-hidden": !r,
58
+ children: a(t)
59
+ },
60
+ `${t.title ?? t.description ?? "item"}-${s}`
61
+ );
62
+ }) }) : a(n[0]),
63
+ h && /* @__PURE__ */ i(
64
+ k,
35
65
  {
36
66
  variant: o === "default" ? "brand" : "transparent",
37
67
  size: 100,
38
- className: t.close,
68
+ className: e.close,
39
69
  "aria-label": "Close notification",
40
- onClick: () => c?.(),
41
- children: /* @__PURE__ */ n(r, {})
70
+ onClick: () => R?.(),
71
+ children: /* @__PURE__ */ i(M, {})
42
72
  }
43
73
  )
44
74
  ] })
45
75
  }
46
- );
76
+ ) : null;
47
77
  }
48
78
  export {
49
- j as Notification
79
+ q as Notification
50
80
  };