kitzo 2.3.8 → 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}px` | `${number}rem` | `${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 v, useCallback as x, useLayoutEffect as E } from "react";
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 A(p) {
6
+ function w(p) {
7
7
  const {
8
- position: u = "top-center",
9
- richColors: l = !0,
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 = v(null), r = x(() => {
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) ? +o : 8;
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 ?? 16
45
+ padding: n != null ? `${Math.max(Math.min(+n, 200), 0)}px` : 16
46
46
  },
47
- className: `kitzo-toaster ${l ? "kitzo-toaster-rich-colors" : ""} ${d ? "kitzo-toaster-dark" : ""}`,
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: u,
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
- A as default
70
+ w as default
71
71
  };
@@ -1,14 +1,13 @@
1
- const i = {
1
+ const a = {
2
2
  duration: 2800,
3
3
  showIcon: !0,
4
- animateTransformOrigin: void 0,
5
- position: "top-center"
4
+ animateTransformOrigin: void 0
6
5
  };
7
6
  let e = 0;
8
7
  const s = () => crypto.randomUUID?.() ?? `kitzo_toast_id_${++e}`;
9
8
  let d = 1;
10
- function u({
11
- type: a,
9
+ function c({
10
+ type: i,
12
11
  action: r,
13
12
  content: o,
14
13
  options: n
@@ -16,30 +15,30 @@ function u({
16
15
  const t = typeof n == "object" && n !== null ? n : {};
17
16
  return {
18
17
  id: t.id ?? s(),
19
- duration: t.duration ?? i.duration,
20
- showIcon: t.showIcon ?? i.showIcon,
21
- animateTransformOrigin: t.animateTransformOrigin ?? i.animateTransformOrigin,
22
- position: t.position ?? i.position,
18
+ duration: t.duration ?? a.duration,
19
+ showIcon: t.showIcon ?? a.showIcon,
20
+ animateTransformOrigin: t.animateTransformOrigin ?? a.animateTransformOrigin,
21
+ position: t.position,
23
22
  icon: t.icon,
24
- type: a,
23
+ type: i,
25
24
  status: "entering",
26
25
  zIndex: ++d,
27
26
  content: o,
28
27
  action: r
29
28
  };
30
29
  }
31
- function p({ id: a, content: r, options: o }) {
30
+ function T({ id: i, content: r, options: o }) {
32
31
  const n = typeof o == "object" && o !== null ? o : {};
33
32
  return {
34
33
  ...n,
35
- id: a,
34
+ id: i,
36
35
  content: r,
37
36
  action: "update",
38
- duration: n.duration ?? i.duration
37
+ duration: n.duration ?? a.duration
39
38
  };
40
39
  }
41
40
  export {
42
- u as createToast,
41
+ c as createToast,
43
42
  s as genId,
44
- p as updateToast
43
+ T as updateToast
45
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitzo",
3
- "version": "2.3.8",
3
+ "version": "2.3.10",
4
4
  "description": "A lightweight React micro-utility.",
5
5
  "type": "module",
6
6
  "files": [