kitzo 2.3.9 → 2.3.10
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/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ declare type ToasterProps = {
|
|
|
38
38
|
richColors?: boolean;
|
|
39
39
|
animateTransformOrigin?: boolean;
|
|
40
40
|
gap?: number | `${number}`;
|
|
41
|
-
edgeOffset?: number | `${number}
|
|
41
|
+
edgeOffset?: number | `${number}`;
|
|
42
42
|
isDark?: boolean;
|
|
43
43
|
};
|
|
44
44
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useState as b, useEffect as k, useRef as
|
|
2
|
+
import { useState as b, useEffect as k, useRef as x, useCallback as v, useLayoutEffect as E } from "react";
|
|
3
3
|
import { subscribe as T } from "./helpers/listenar.js";
|
|
4
4
|
import z from "./helpers/manageToasts/manageToasts.js";
|
|
5
5
|
import O from "./partials/ToastContainer.js";
|
|
6
|
-
function
|
|
6
|
+
function w(p) {
|
|
7
7
|
const {
|
|
8
|
-
position:
|
|
9
|
-
richColors:
|
|
8
|
+
position: l = "top-center",
|
|
9
|
+
richColors: u = !1,
|
|
10
10
|
animateTransformOrigin: m = !0,
|
|
11
11
|
gap: o = 8,
|
|
12
12
|
edgeOffset: n = 16,
|
|
13
13
|
isDark: d = window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
14
14
|
} = p, [c, h] = b([]);
|
|
15
15
|
k(() => T((e) => z({ toast: e, setToasts: h })), []);
|
|
16
|
-
const s =
|
|
16
|
+
const s = x(null), r = v(() => {
|
|
17
17
|
if (!s.current) return;
|
|
18
18
|
const t = s.current.querySelectorAll("[data-toast-container]"), e = {
|
|
19
19
|
"top-left": 0,
|
|
@@ -26,7 +26,7 @@ function A(p) {
|
|
|
26
26
|
t.forEach((a) => {
|
|
27
27
|
const f = a.getAttribute("data-toast-position") || "top-center", g = parseFloat(a.style.getPropertyValue("--toast-height")) || 0;
|
|
28
28
|
a.style.setProperty("--toast-offset-y", `${e[f]}px`);
|
|
29
|
-
const y = isNaN(+o) ?
|
|
29
|
+
const y = isNaN(+o) ? 8 : +o;
|
|
30
30
|
e[f] += g + y;
|
|
31
31
|
});
|
|
32
32
|
}, [o]);
|
|
@@ -42,9 +42,9 @@ function A(p) {
|
|
|
42
42
|
zIndex: 2147483647,
|
|
43
43
|
pointerEvents: "none",
|
|
44
44
|
display: "grid",
|
|
45
|
-
padding: n
|
|
45
|
+
padding: n != null ? `${Math.max(Math.min(+n, 200), 0)}px` : 16
|
|
46
46
|
},
|
|
47
|
-
className: `kitzo-toaster ${
|
|
47
|
+
className: `kitzo-toaster ${u ? "kitzo-toaster-rich-colors" : ""} ${d ? "kitzo-toaster-dark" : ""}`,
|
|
48
48
|
children: /* @__PURE__ */ i(
|
|
49
49
|
"div",
|
|
50
50
|
{
|
|
@@ -56,7 +56,7 @@ function A(p) {
|
|
|
56
56
|
{
|
|
57
57
|
t,
|
|
58
58
|
animateTransformOrigin: m,
|
|
59
|
-
containerPosition:
|
|
59
|
+
containerPosition: l,
|
|
60
60
|
updateOffsets: r
|
|
61
61
|
},
|
|
62
62
|
t.id
|
|
@@ -67,5 +67,5 @@ function A(p) {
|
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
export {
|
|
70
|
-
|
|
70
|
+
w as default
|
|
71
71
|
};
|