kitzo 2.3.45 → 2.5.0

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/README.md CHANGED
@@ -1,40 +1,40 @@
1
- # Kitzo
2
-
3
- **Lightweight React UI components and essential hooks.**
4
-
5
- ---
6
-
7
- ### Installation
8
-
9
- ```bash
10
- npm install kitzo
11
- ```
12
-
13
- ---
14
-
15
- ### Core Features
16
-
17
- #### Components
18
-
19
- - **Toast** — Accessible, animated notifications.
20
- - **Tooltip** — Smart-positioned contextual labels.
21
-
22
- #### Hooks
23
-
24
- - **useDebounce** — Optimize performance by delaying execution.
25
- - **useWindowSize** — Real-time viewport dimensions.
26
- - **useCopy** — Simple "copy to clipboard" functionality.
27
- - **useThrottle** — Limits how often a value can change within a specified time interval.
28
-
29
- ---
30
-
31
- ### Documentation
32
-
33
- For usage guides and live demos, visit documentation:
34
- [https://kitzo.vercel.app](https://kitzo.vercel.app)
35
-
36
- ---
37
-
38
- ### License
39
-
40
- MIT
1
+ # Kitzo
2
+
3
+ **Lightweight React UI components and essential hooks.**
4
+
5
+ ---
6
+
7
+ ### Installation
8
+
9
+ ```bash
10
+ npm install kitzo
11
+ ```
12
+
13
+ ---
14
+
15
+ ### Core Features
16
+
17
+ #### Components
18
+
19
+ - **Toast** — Accessible, animated notifications.
20
+ - **Tooltip** — Smart-positioned contextual labels.
21
+
22
+ #### Hooks
23
+
24
+ - **useDebounce** — Optimize performance by delaying execution.
25
+ - **useWindowSize** — Real-time viewport dimensions.
26
+ - **useCopy** — Simple "copy to clipboard" functionality.
27
+ - **useThrottle** — Limits how often a value can change within a specified time interval.
28
+
29
+ ---
30
+
31
+ ### Documentation
32
+
33
+ For usage guides and live demos, visit documentation:
34
+ [https://kitzo.vercel.app](https://kitzo.vercel.app)
35
+
36
+ ---
37
+
38
+ ### License
39
+
40
+ MIT
package/dist/fns.js CHANGED
@@ -1,4 +1,4 @@
1
- import { default as e } from "./functions/copy/copy.js";
1
+ import { copy as r } from "./functions/copy/index.js";
2
2
  export {
3
- e as copy
3
+ r as copy
4
4
  };
@@ -1,27 +1,27 @@
1
- function a(e) {
1
+ function o(e) {
2
2
  const t = document.createElement("textarea");
3
3
  t.value = e, document.body.appendChild(t), t.select(), document.execCommand("copy"), document.body.removeChild(t);
4
4
  }
5
- async function o(e) {
5
+ async function r(e) {
6
6
  if (!navigator.clipboard?.writeText) {
7
- a(e);
7
+ o(e);
8
8
  return;
9
9
  }
10
10
  try {
11
11
  await navigator.clipboard.writeText(e);
12
12
  } catch (t) {
13
- a(e), console.error(t);
13
+ o(e), console.error(t);
14
14
  }
15
15
  }
16
- async function r(e) {
16
+ async function a(e) {
17
17
  let t;
18
18
  try {
19
19
  t = typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : JSON.stringify(e);
20
20
  } catch {
21
21
  t = "[Cannot copy circular object]";
22
22
  }
23
- await o(t);
23
+ await r(t);
24
24
  }
25
25
  export {
26
- r as default
26
+ a as copy
27
27
  };
package/dist/index.d.ts CHANGED
@@ -15,10 +15,6 @@ declare type CopyStatus = 'standby' | 'copying' | 'copied' | 'error';
15
15
 
16
16
  declare type Options = ToastOptionsWithoutType;
17
17
 
18
- declare type Position = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
19
-
20
- declare type Positions = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
21
-
22
18
  declare type PromiseToastFn = <T, E = unknown>(promise: Promise<T>, msgs: PromiseToastMsgs<T, E>, options?: PromiseToastOptions) => Promise<T>;
23
19
 
24
20
  declare type PromiseToastMsgs<T, E = unknown> = {
@@ -35,16 +31,17 @@ declare type ToastContent = ((dismiss: () => void) => ReactNode) | ReactNode;
35
31
 
36
32
  export declare function Toaster(props: ToasterProps): JSX.Element | null;
37
33
 
38
- declare type ToasterProps = {
39
- position?: Positions;
40
- richColors?: boolean;
41
- animateTransformOrigin?: boolean;
34
+ export declare type ToasterProps = {
35
+ position?: ToastPositions;
42
36
  gap?: number | `${number}`;
43
37
  edgeOffset?: number | `${number}`;
44
- isDark?: boolean;
38
+ toasterId?: string | number;
39
+ dark?: boolean;
40
+ compact?: boolean;
41
+ richColors?: boolean;
45
42
  pauseOnHover?: boolean;
46
43
  swipeToClose?: boolean;
47
- toasterId?: string | number;
44
+ animateTransformOrigin?: boolean;
48
45
  };
49
46
 
50
47
  declare type ToastFn = {
@@ -64,7 +61,7 @@ declare type ToastOptions = {
64
61
  duration?: number;
65
62
  showIcon?: boolean;
66
63
  icon?: ReactNode;
67
- position?: Positions;
64
+ position?: ToastPositions;
68
65
  animateTransformOrigin?: boolean;
69
66
  id?: string | number;
70
67
  type?: ToastType;
@@ -74,6 +71,8 @@ declare type ToastOptions = {
74
71
 
75
72
  declare type ToastOptionsWithoutType = Omit<ToastOptions, 'type'>;
76
73
 
74
+ export declare type ToastPositions = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
75
+
77
76
  declare type ToastType = 'default' | 'success' | 'warning' | 'error' | 'info' | 'custom' | 'loading';
78
77
 
79
78
  export declare function Tooltip(props: TooltipProps): ReactNode;
@@ -85,7 +84,7 @@ declare type TooltipCoreProps = {
85
84
  * content is necessary
86
85
  */
87
86
  content: ReactNode;
88
- position?: Position;
87
+ position?: TooltipPosition;
89
88
  offset?: number;
90
89
  smartHover?: boolean;
91
90
  hideOnTouch?: boolean;
@@ -94,6 +93,8 @@ declare type TooltipCoreProps = {
94
93
  isDark?: boolean;
95
94
  };
96
95
 
96
+ export declare type TooltipPosition = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
97
+
97
98
  declare type TooltipProps = PropsWithChildren<TooltipCoreProps>;
98
99
 
99
100
  declare type UpdateToastOptions = Omit<ToastOptions, 'id'>;
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { default as t } from "./react/hooks/useWindowSize.js";
2
- import { default as r } from "./react/hooks/useDebounce.js";
3
- import { default as s } from "./react/hooks/useCopy.js";
4
- import { default as l } from "./react/hooks/useThrottle.js";
5
- import { default as d } from "./react/components/tooltip/Tooltip.js";
6
- import { default as x } from "./react/components/toast/Toaster.js";
7
- import { default as T } from "./react/components/toast/helpers/triggerToasts.js";
1
+ import { Toaster as r } from "./react/components/toast/Toaster.js";
2
+ import { Tooltip as p } from "./react/components/tooltip/Tooltip.js";
3
+ import { toast as m } from "./react/components/toast/helpers/triggerToasts.js";
4
+ import { useCopy as s } from "./react/hooks/useCopy.js";
5
+ import { useDebounce as i } from "./react/hooks/useDebounce.js";
6
+ import { useThrottle as a } from "./react/hooks/useThrottle.js";
7
+ import { useWindowSize as n } from "./react/hooks/useWindowSize.js";
8
8
  export {
9
- x as Toaster,
10
- d as Tooltip,
11
- T as toast,
9
+ r as Toaster,
10
+ p as Tooltip,
11
+ m as toast,
12
12
  s as useCopy,
13
- r as useDebounce,
14
- l as useThrottle,
15
- t as useWindowSize
13
+ i as useDebounce,
14
+ a as useThrottle,
15
+ n as useWindowSize
16
16
  };
@@ -1,37 +1,38 @@
1
- import { jsx as a } from "react/jsx-runtime";
1
+ import { jsx as n } from "react/jsx-runtime";
2
2
  import t from "react";
3
- import { subscribe as E } from "./helpers/listenars.js";
4
- import w from "./helpers/manageToasts/manageToasts.js";
5
- import M from "./partials/ToastContainer.js";
6
- import { ToasterContext as O } from "./context/ToasterContext.js";
7
- import { initSwipeToClose as S } from "./helpers/manageToasts/swipeClose.js";
8
- function D(i) {
3
+ import { subscribe as w } from "./helpers/listenars.js";
4
+ import M from "./helpers/manageToasts/manageToasts.js";
5
+ import O from "./partials/ToastContainer.js";
6
+ import { ToasterContext as S } from "./context/ToasterContext.js";
7
+ import { initSwipeToClose as z } from "./helpers/manageToasts/swipeClose.js";
8
+ function q(s) {
9
9
  const {
10
10
  position: h = "top-center",
11
- richColors: l = !1,
11
+ richColors: u = !1,
12
12
  animateTransformOrigin: g = !0,
13
- gap: s = 8,
14
- edgeOffset: n = 16,
15
- isDark: c,
13
+ gap: r = s?.compact ? 8 : 12,
14
+ edgeOffset: i = 16,
15
+ dark: c,
16
16
  pauseOnHover: b = !0,
17
- swipeToClose: y = !0
18
- } = i, [k, T] = t.useState(!1);
17
+ swipeToClose: y = !0,
18
+ compact: k = !1
19
+ } = s, [T, v] = t.useState(!1);
19
20
  t.useEffect(() => {
20
- T(!0);
21
+ v(!0);
21
22
  }, []);
22
23
  const [p, m] = t.useState([]);
23
24
  t.useEffect(() => {
24
- const e = E(
25
- (o) => w({ toast: o, setToasts: m }),
26
- i.toasterId
27
- ), r = S();
25
+ const e = w(
26
+ (o) => M({ toast: o, setToasts: m }),
27
+ s.toasterId
28
+ ), a = z();
28
29
  return () => {
29
- e(), r();
30
+ e(), a();
30
31
  };
31
- }, [i.toasterId]);
32
- const f = t.useRef(null), u = t.useCallback(() => {
32
+ }, [s.toasterId]);
33
+ const f = t.useRef(null), l = t.useCallback(() => {
33
34
  if (!f.current) return;
34
- const e = f.current.querySelectorAll("[data-toast-container]"), r = {
35
+ const e = f.current.querySelectorAll("[data-toast-container]"), a = {
35
36
  "top-left": 0,
36
37
  "top-center": 0,
37
38
  "top-right": 0,
@@ -40,17 +41,17 @@ function D(i) {
40
41
  "bottom-right": 0
41
42
  };
42
43
  e.forEach((o) => {
43
- const d = o.getAttribute("data-toast-position") || "top-center", x = parseFloat(o.style.getPropertyValue("--toast-height")) || 0;
44
- o.style.setProperty("--toast-offset-y", `${r[d]}px`);
45
- const C = isNaN(+s) ? 8 : +s;
46
- r[d] += x + C;
44
+ const d = o.getAttribute("data-toast-position") || "top-center", C = parseFloat(o.style.getPropertyValue("--toast-height")) || 0;
45
+ o.style.setProperty("--toast-offset-y", `${a[d]}px`);
46
+ const E = isNaN(+r) ? 8 : +r;
47
+ a[d] += C + E;
47
48
  });
48
- }, [s]);
49
+ }, [r]);
49
50
  if (t.useLayoutEffect(() => {
50
- u();
51
- }, [p, u]), !k) return null;
52
- const v = typeof c == "boolean" ? c : window.matchMedia("(prefers-color-scheme: dark)").matches;
53
- return /* @__PURE__ */ a(
51
+ l();
52
+ }, [p, l]), !T) return null;
53
+ const x = typeof c == "boolean" ? c : window.matchMedia("(prefers-color-scheme: dark)").matches;
54
+ return /* @__PURE__ */ n(
54
55
  "div",
55
56
  {
56
57
  ref: f,
@@ -60,31 +61,32 @@ function D(i) {
60
61
  zIndex: 2147483647,
61
62
  pointerEvents: "none",
62
63
  display: "grid",
63
- padding: n != null ? `${Math.max(Math.min(+n, 200), 0)}px` : 16
64
+ padding: i != null ? `${Math.max(Math.min(+i, 200), 0)}px` : 16
64
65
  },
65
- className: `kitzo-toaster ${l ? "kitzo-toaster-rich-colors" : ""} ${v ? "kitzo-toaster-dark" : ""}`,
66
- children: /* @__PURE__ */ a(
66
+ className: `kitzo-toaster ${u ? "kitzo-toaster-rich-colors" : ""} ${x ? "kitzo-toaster-dark" : ""}`,
67
+ children: /* @__PURE__ */ n(
67
68
  "div",
68
69
  {
69
70
  style: {
70
71
  position: "relative"
71
72
  },
72
- children: /* @__PURE__ */ a(
73
- O.Provider,
73
+ children: /* @__PURE__ */ n(
74
+ S.Provider,
74
75
  {
75
76
  value: {
76
77
  position: h,
77
- richColors: l,
78
- isDark: c,
79
- gap: s,
80
- edgeOffset: n,
81
- animateTransformOrigin: g,
82
- pauseOnHover: b,
83
- swipeToClose: y,
78
+ gap: r,
79
+ edgeOffset: i,
84
80
  setToasts: m,
85
- updateOffsets: u
81
+ updateOffsets: l,
82
+ dark: c,
83
+ compact: k,
84
+ richColors: u,
85
+ swipeToClose: y,
86
+ pauseOnHover: b,
87
+ animateTransformOrigin: g
86
88
  },
87
- children: p.map((e) => /* @__PURE__ */ a(M, { t: e }, e.id))
89
+ children: p.map((e) => /* @__PURE__ */ n(O, { t: e }, e.id))
88
90
  }
89
91
  )
90
92
  }
@@ -93,5 +95,5 @@ function D(i) {
93
95
  );
94
96
  }
95
97
  export {
96
- D as default
98
+ q as Toaster
97
99
  };
@@ -85,13 +85,16 @@ const a = `.kitzo-toaster {
85
85
  }
86
86
 
87
87
  .kitzo-toast {
88
- font-family: inherit;
89
- font-size: 0.875rem;
90
88
  transition:
91
89
  transform 280ms,
92
90
  opacity 280ms;
93
91
  will-change: transform, opacity;
94
92
  touch-action: pan-y;
93
+
94
+ font-family: inherit;
95
+ font-size: 0.875rem;
96
+ white-space: pre-wrap;
97
+ text-wrap: balance;
95
98
  }
96
99
 
97
100
  .kitzo-toast.is-swiping {
@@ -145,6 +148,16 @@ const a = `.kitzo-toaster {
145
148
  box-shadow: 0 3px 8px -3px hsl(0, 0%, 0%, 0.15);
146
149
  }
147
150
 
151
+ /*! toast size */
152
+ .kitzo-toast[data-compact='false']:not([data-type='custom']) {
153
+ flex: 1;
154
+ min-height: 40px;
155
+
156
+ @media (width > 380px) {
157
+ max-width: 250px;
158
+ }
159
+ }
160
+
148
161
  /*! toast transition styles */
149
162
  .kitzo-toast {
150
163
  --swipe-x: 0px;
@@ -1,4 +1,4 @@
1
- import b from "../triggerToasts.js";
1
+ import { toast as b } from "../triggerToasts.js";
2
2
  let s = !1, e = null, c = null, m = 0, r = 0, a = !1, l = null;
3
3
  const L = 2, y = 65, S = 20, g = 100;
4
4
  function x(t) {
@@ -1,7 +1,7 @@
1
1
  import { createToast as n, updateToast as s, genId as c } from "./createToast.js";
2
- import { notify as i } from "./listenars.js";
3
- const e = (r, t) => {
4
- r != null && i(
2
+ import { notify as e } from "./listenars.js";
3
+ const i = (r, t) => {
4
+ r != null && e(
5
5
  n({
6
6
  type: "default",
7
7
  action: "add",
@@ -10,15 +10,15 @@ const e = (r, t) => {
10
10
  })
11
11
  );
12
12
  };
13
- e.dismiss = (r, t) => {
14
- i({
13
+ i.dismiss = (r, t) => {
14
+ e({
15
15
  action: "dismiss",
16
16
  id: r,
17
17
  toasterId: t
18
18
  });
19
19
  };
20
- e.info = (r, t) => {
21
- r != null && i(
20
+ i.info = (r, t) => {
21
+ r != null && e(
22
22
  n({
23
23
  action: "add",
24
24
  type: "info",
@@ -27,8 +27,8 @@ e.info = (r, t) => {
27
27
  })
28
28
  );
29
29
  };
30
- e.success = (r, t) => {
31
- r != null && i(
30
+ i.success = (r, t) => {
31
+ r != null && e(
32
32
  n({
33
33
  action: "add",
34
34
  type: "success",
@@ -37,8 +37,8 @@ e.success = (r, t) => {
37
37
  })
38
38
  );
39
39
  };
40
- e.warning = (r, t) => {
41
- r != null && i(
40
+ i.warning = (r, t) => {
41
+ r != null && e(
42
42
  n({
43
43
  action: "add",
44
44
  type: "warning",
@@ -47,8 +47,8 @@ e.warning = (r, t) => {
47
47
  })
48
48
  );
49
49
  };
50
- e.error = (r, t) => {
51
- r != null && i(
50
+ i.error = (r, t) => {
51
+ r != null && e(
52
52
  n({
53
53
  action: "add",
54
54
  type: "error",
@@ -57,8 +57,8 @@ e.error = (r, t) => {
57
57
  })
58
58
  );
59
59
  };
60
- e.loading = (r, t) => {
61
- r != null && i(
60
+ i.loading = (r, t) => {
61
+ r != null && e(
62
62
  n({
63
63
  action: "add",
64
64
  type: "loading",
@@ -67,8 +67,8 @@ e.loading = (r, t) => {
67
67
  })
68
68
  );
69
69
  };
70
- e.custom = (r, t) => {
71
- r != null && i(
70
+ i.custom = (r, t) => {
71
+ r != null && e(
72
72
  n({
73
73
  action: "add",
74
74
  type: "custom",
@@ -77,27 +77,27 @@ e.custom = (r, t) => {
77
77
  })
78
78
  );
79
79
  };
80
- e.update = (r, t, a) => {
81
- r != null && t != null && i(s({ id: `${r}`, content: t, options: a }));
80
+ i.update = (r, t, o) => {
81
+ r != null && t != null && e(s({ id: `${r}`, content: t, options: o }));
82
82
  };
83
- e.promise = (async (r, t, a) => {
83
+ i.promise = (async (r, t, o) => {
84
84
  const u = c();
85
- i(
85
+ e(
86
86
  n({
87
87
  action: "add",
88
88
  type: "loading",
89
89
  content: t.loading,
90
- options: { ...a, id: u, duration: 1 / 0, swipeToClose: !1 }
90
+ options: { ...o, id: u, duration: 1 / 0, swipeToClose: !1 }
91
91
  })
92
92
  );
93
93
  try {
94
- const o = await r, d = typeof t.success == "function" ? await t.success(o) : t.success;
95
- return e.update(u, d, { ...a, type: "success" }), o;
96
- } catch (o) {
97
- const d = typeof t.error == "function" ? await t.error(o) : t.error;
98
- throw e.update(u, d, { ...a, type: "error" }), o;
94
+ const a = await r, d = typeof t.success == "function" ? await t.success(a) : t.success;
95
+ return i.update(u, d, { ...o, type: "success" }), a;
96
+ } catch (a) {
97
+ const d = typeof t.error == "function" ? await t.error(a) : t.error;
98
+ throw i.update(u, d, { ...o, type: "error" }), a;
99
99
  }
100
100
  });
101
101
  export {
102
- e as default
102
+ i as toast
103
103
  };
@@ -1,34 +1,34 @@
1
- import { jsxs as x, jsx as t, Fragment as s } from "react/jsx-runtime";
2
- import { resumeToast as p, pauseToast as u } from "../helpers/manageToasts/timers.js";
3
- import S from "../helpers/triggerToasts.js";
4
- import { InfoSvg as w, ErrorSvg as I, WarningSvg as E, SuccessSvg as k, LoadingSvg as L } from "./Svgs.js";
1
+ import { jsxs as S, jsx as t, Fragment as o } from "react/jsx-runtime";
2
+ import { resumeToast as l, pauseToast as m } from "../helpers/manageToasts/timers.js";
3
+ import { toast as I } from "../helpers/triggerToasts.js";
4
+ import { InfoSvg as E, ErrorSvg as T, WarningSvg as k, SuccessSvg as w, LoadingSvg as L } from "./Svgs.js";
5
5
  import { useToasterContext as M } from "../context/ToasterContext.js";
6
- function P({
7
- t: d,
8
- position: n,
9
- shouldAnimateTransformOrigin: c,
10
- swipeToClose: m
6
+ function z({
7
+ t: c,
8
+ position: s,
9
+ shouldAnimateTransformOrigin: p,
10
+ swipeToClose: u
11
11
  }) {
12
- const { pauseOnHover: o } = M(), {
12
+ const { pauseOnHover: n, compact: f } = M(), {
13
13
  id: e,
14
14
  type: r,
15
- action: f,
15
+ action: g,
16
16
  content: i,
17
- status: g,
18
- showIcon: v,
17
+ status: v,
18
+ showIcon: h,
19
19
  icon: a,
20
- toasterId: h,
21
- updateState: y
22
- } = d, l = {
20
+ toasterId: y,
21
+ updateState: x
22
+ } = c, d = {
23
23
  loading: /* @__PURE__ */ t(L, {}),
24
- success: /* @__PURE__ */ t(k, {}),
25
- warning: /* @__PURE__ */ t(E, {}),
26
- error: /* @__PURE__ */ t(I, {}),
27
- info: /* @__PURE__ */ t(w, {}),
24
+ success: /* @__PURE__ */ t(w, {}),
25
+ warning: /* @__PURE__ */ t(k, {}),
26
+ error: /* @__PURE__ */ t(T, {}),
27
+ info: /* @__PURE__ */ t(E, {}),
28
28
  default: null,
29
29
  custom: null
30
30
  };
31
- return /* @__PURE__ */ x(
31
+ return /* @__PURE__ */ S(
32
32
  "div",
33
33
  {
34
34
  id: e,
@@ -36,27 +36,27 @@ function P({
36
36
  pointerEvents: "all",
37
37
  display: "flex",
38
38
  alignItems: "center",
39
- gap: 8,
40
- whiteSpace: "pre-wrap"
39
+ gap: 8
41
40
  },
42
- "data-toaster-id": h,
43
- "data-action": f,
44
- "data-status": g,
41
+ "data-toaster-id": y,
42
+ "data-action": g,
43
+ "data-status": v,
45
44
  "data-type": r,
46
- "data-position": n,
47
- "data-screen-x": n.split("-")[1],
48
- "data-screen-y": n.split("-")[0],
45
+ "data-position": s,
46
+ "data-screen-x": s.split("-")[1],
47
+ "data-screen-y": s.split("-")[0],
49
48
  "data-exit": "auto",
50
- "data-swipeable": m,
51
- "data-animate-transform-origin": c,
52
- "data-update-state": y,
53
- onPointerEnter: () => o && u(e),
54
- onPointerLeave: () => o && p(e),
55
- onMouseEnter: () => o && u(e),
56
- onMouseLeave: () => o && p(e),
57
- className: `kitzo-toast ${c ? `transform-origin-${n}` : ""}`,
49
+ "data-swipeable": u,
50
+ "data-animate-transform-origin": p,
51
+ "data-compact": f,
52
+ "data-update-state": x,
53
+ onPointerEnter: () => n && m(e),
54
+ onPointerLeave: () => n && l(e),
55
+ onMouseEnter: () => n && m(e),
56
+ onMouseLeave: () => n && l(e),
57
+ className: "kitzo-toast",
58
58
  children: [
59
- v && /* @__PURE__ */ t(s, { children: a ? /* @__PURE__ */ t(s, { children: typeof a == "string" || typeof a == "number" ? /* @__PURE__ */ t(
59
+ h && /* @__PURE__ */ t(o, { children: a ? /* @__PURE__ */ t(o, { children: typeof a == "string" || typeof a == "number" ? /* @__PURE__ */ t(
60
60
  "div",
61
61
  {
62
62
  style: {
@@ -65,14 +65,14 @@ function P({
65
65
  className: "svg-container",
66
66
  children: a
67
67
  }
68
- ) : /* @__PURE__ */ t(s, { children: a }) }) : /* @__PURE__ */ t(s, { children: l[r] && /* @__PURE__ */ t("div", { style: { flexShrink: 0 }, className: "svg-container", children: l[r] }) }) }),
68
+ ) : /* @__PURE__ */ t(o, { children: a }) }) : /* @__PURE__ */ t(o, { children: d[r] && /* @__PURE__ */ t("div", { style: { flexShrink: 0 }, className: "svg-container", children: d[r] }) }) }),
69
69
  /* @__PURE__ */ t(
70
70
  "div",
71
71
  {
72
72
  style: {
73
73
  flex: 1
74
74
  },
75
- children: typeof i == "function" ? i(() => S.dismiss(e, d.toasterId)) : i
75
+ children: typeof i == "function" ? i(() => I.dismiss(e, c.toasterId)) : i
76
76
  }
77
77
  )
78
78
  ]
@@ -80,5 +80,5 @@ function P({
80
80
  );
81
81
  }
82
82
  export {
83
- P as default
83
+ z as default
84
84
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as a, Fragment as r, jsxs as T } from "react/jsx-runtime";
2
- import c from "react";
2
+ import d from "react";
3
3
  import v from "./helpers/addTooltipStyles.js";
4
4
  import w from "./helpers/getPositionClass.js";
5
5
  import O from "./partials/TooltipWrapper.js";
@@ -11,24 +11,24 @@ function C(h) {
11
11
  position: y = "top",
12
12
  animation: i = !0,
13
13
  isHidden: s = !1,
14
- offset: f = 8,
15
- smartHover: m = !0,
14
+ offset: m = 8,
15
+ smartHover: f = !0,
16
16
  hideOnTouch: l = !0,
17
17
  isDark: u
18
- } = h, [D, b] = c.useState(!1);
19
- if (c.useEffect(() => {
18
+ } = h, [D, b] = d.useState(!1);
19
+ if (d.useEffect(() => {
20
20
  b(!0), v();
21
21
  }, []), !D) return /* @__PURE__ */ a(r, { children: t });
22
22
  if (typeof s == "boolean" && s) return /* @__PURE__ */ a(r, { children: t });
23
23
  if (n == null)
24
24
  return /* @__PURE__ */ a(r, { children: t });
25
25
  const o = {
26
- offset: isNaN(Number(f)) ? 8 : Number(f),
27
- smartHover: typeof m == "boolean" ? m : !0,
26
+ offset: isNaN(Number(m)) ? 8 : Number(m),
27
+ smartHover: typeof f == "boolean" ? f : !0,
28
28
  hideOnTouch: typeof l == "boolean" ? l : !0
29
29
  };
30
- let p = !1, d = !1;
31
- if (typeof window < "u" && (d = window.matchMedia("(pointer: coarse)").matches || navigator.maxTouchPoints > 0, p = typeof u == "boolean" ? u : window.matchMedia("(prefers-color-scheme: dark)").matches), d && o.hideOnTouch) return t;
30
+ let p = !1, c = !1;
31
+ if (typeof window < "u" && (c = window.matchMedia("(pointer: coarse)").matches || navigator.maxTouchPoints > 0, p = typeof u == "boolean" ? u : window.matchMedia("(prefers-color-scheme: dark)").matches), c && o.hideOnTouch) return t;
32
32
  const x = w(y), M = !!i, e = k(
33
33
  i === !0 ? {} : i
34
34
  );
@@ -63,5 +63,5 @@ function C(h) {
63
63
  );
64
64
  }
65
65
  export {
66
- C as default
66
+ C as Tooltip
67
67
  };
@@ -1,12 +1,12 @@
1
- import { useState as u, useRef as i, useCallback as y, useEffect as p } from "react";
2
- import m from "../../functions/copy/copy.js";
1
+ import { useState as u, useRef as i, useCallback as l, useEffect as p } from "react";
2
+ import { copy as m } from "../../functions/copy/index.js";
3
3
  function E(c = 1500) {
4
- const [r, e] = u("standby"), [a, s] = u(null), t = i(null), n = i(!1), f = y(
5
- async (l) => {
4
+ const [r, e] = u("standby"), [a, s] = u(null), t = i(null), n = i(!1), f = l(
5
+ async (y) => {
6
6
  if (!n.current) {
7
7
  t.current && clearTimeout(t.current);
8
8
  try {
9
- n.current = !0, s(null), e("copying"), await m(l), e("copied");
9
+ n.current = !0, s(null), e("copying"), await m(y), e("copied");
10
10
  } catch (o) {
11
11
  s(o instanceof Error ? o : new Error(String(o))), e("error");
12
12
  } finally {
@@ -34,5 +34,5 @@ function E(c = 1500) {
34
34
  };
35
35
  }
36
36
  export {
37
- E as default
37
+ E as useCopy
38
38
  };
@@ -1,16 +1,16 @@
1
1
  import { useState as r, useEffect as c } from "react";
2
2
  function f(e, t) {
3
3
  t ??= 500;
4
- const [u, o] = r(e);
4
+ const [o, u] = r(e);
5
5
  return c(() => {
6
6
  const n = setTimeout(() => {
7
- o(e);
7
+ u(e);
8
8
  }, t);
9
9
  return () => {
10
10
  clearTimeout(n);
11
11
  };
12
- }, [e, t]), u;
12
+ }, [e, t]), o;
13
13
  }
14
14
  export {
15
- f as default
15
+ f as useDebounce
16
16
  };
@@ -1,5 +1,5 @@
1
1
  import { useState as c, useRef as f, useEffect as i } from "react";
2
- function a(t, e = 500) {
2
+ function l(t, e = 500) {
3
3
  const [n, u] = c(t), r = f(0);
4
4
  return i(() => {
5
5
  function s() {
@@ -10,5 +10,5 @@ function a(t, e = 500) {
10
10
  }, [t, e]), n;
11
11
  }
12
12
  export {
13
- a as default
13
+ l as useThrottle
14
14
  };
@@ -1,5 +1,5 @@
1
1
  import t from "react";
2
- function c(i = 30) {
2
+ function u(i = 30) {
3
3
  const [r, o] = t.useState({
4
4
  screenWidth: 0,
5
5
  screenHeight: 0
@@ -22,5 +22,5 @@ function c(i = 30) {
22
22
  }, [i]), r;
23
23
  }
24
24
  export {
25
- c as default
25
+ u as useWindowSize
26
26
  };
package/package.json CHANGED
@@ -1,74 +1,77 @@
1
- {
2
- "name": "kitzo",
3
- "version": "2.3.45",
4
- "description": "A lightweight React micro-utility.",
5
- "type": "module",
6
- "files": [
7
- "dist"
8
- ],
9
- "sideEffects": false,
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.ts",
13
- "import": "./dist/index.js",
14
- "default": "./dist/index.js"
15
- },
16
- "./fns": {
17
- "types": "./dist/fns.d.ts",
18
- "import": "./dist/fns.js",
19
- "default": "./dist/fns.js"
20
- }
21
- },
22
- "scripts": {
23
- "dev": "vite",
24
- "dev:host": "vite --host",
25
- "build": "tsc -b && vite build",
26
- "lint": "eslint .",
27
- "preview": "vite preview"
28
- },
29
- "keywords": [
30
- "kitzo",
31
- "components",
32
- "toast",
33
- "tooltip",
34
- "hooks",
35
- "function",
36
- "micro-utility",
37
- "ui",
38
- "react",
39
- "reactjs"
40
- ],
41
- "author": "Riyad",
42
- "license": "MIT",
43
- "repository": {
44
- "type": "git",
45
- "url": "git+https://github.com/riyad-96/kitzo.git"
46
- },
47
- "homepage": "https://github.com/riyad-96/kitzo#readme",
48
- "peerDependencies": {
49
- "react": ">=19",
50
- "react-dom": ">=19"
51
- },
52
- "devDependencies": {
53
- "@eslint/js": "^9.39.2",
54
- "@tailwindcss/vite": "^4.1.18",
55
- "@types/node": "^25.0.6",
56
- "@types/react": "^19.2.8",
57
- "@types/react-dom": "^19.2.3",
58
- "@vitejs/plugin-react-swc": "^4.2.2",
59
- "daisyui": "^5.5.14",
60
- "eslint": "^9.39.2",
61
- "eslint-plugin-react-hooks": "^7.0.1",
62
- "eslint-plugin-react-refresh": "^0.4.26",
63
- "globals": "^17.0.0",
64
- "prettier": "^3.7.4",
65
- "prettier-plugin-tailwindcss": "^0.7.2",
66
- "react": "^19.2.3",
67
- "react-dom": "^19.2.3",
68
- "tailwindcss": "^4.1.18",
69
- "typescript": "~5.9.3",
70
- "typescript-eslint": "^8.52.0",
71
- "vite": "^7.3.1",
72
- "vite-plugin-dts": "^4.5.4"
73
- }
74
- }
1
+ {
2
+ "name": "kitzo",
3
+ "version": "2.5.0",
4
+ "description": "A lightweight React micro-utility.",
5
+ "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "sideEffects": false,
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./fns": {
17
+ "types": "./dist/fns.d.ts",
18
+ "import": "./dist/fns.js",
19
+ "default": "./dist/fns.js"
20
+ }
21
+ },
22
+ "keywords": [
23
+ "kitzo",
24
+ "components",
25
+ "toast",
26
+ "toaster",
27
+ "tooltip",
28
+ "hooks",
29
+ "function",
30
+ "micro-utility",
31
+ "ui",
32
+ "react",
33
+ "reactjs"
34
+ ],
35
+ "author": "Riyad",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/riyad-96/kitzo.git"
40
+ },
41
+ "homepage": "https://github.com/riyad-96/kitzo#readme",
42
+ "peerDependencies": {
43
+ "react": ">=19",
44
+ "react-dom": ">=19"
45
+ },
46
+ "devDependencies": {
47
+ "@changesets/cli": "^2.29.8",
48
+ "@eslint/js": "^9.39.2",
49
+ "@tailwindcss/vite": "^4.1.18",
50
+ "@types/node": "^25.0.6",
51
+ "@types/react": "^19.2.8",
52
+ "@types/react-dom": "^19.2.3",
53
+ "@vitejs/plugin-react-swc": "^4.2.2",
54
+ "daisyui": "^5.5.14",
55
+ "eslint": "^9.39.2",
56
+ "eslint-plugin-react-hooks": "^7.0.1",
57
+ "eslint-plugin-react-refresh": "^0.4.26",
58
+ "globals": "^17.0.0",
59
+ "prettier": "^3.7.4",
60
+ "prettier-plugin-tailwindcss": "^0.7.2",
61
+ "react": "^19.2.3",
62
+ "react-dom": "^19.2.3",
63
+ "tailwindcss": "^4.1.18",
64
+ "typescript": "~5.8.2",
65
+ "typescript-eslint": "^8.52.0",
66
+ "vite": "^7.3.1",
67
+ "vite-plugin-dts": "^4.5.4"
68
+ },
69
+ "scripts": {
70
+ "dev": "vite",
71
+ "dev:host": "vite --host",
72
+ "build": "tsc -b && vite build",
73
+ "lint": "eslint .",
74
+ "preview": "vite preview",
75
+ "cs": "changeset"
76
+ }
77
+ }