kitzo 2.3.19 → 2.3.20
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 +2 -0
- package/dist/index.js +8 -6
- package/dist/react/hooks/useThrottle.js +14 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -111,6 +111,8 @@ declare type UseCopyReturn = {
|
|
|
111
111
|
|
|
112
112
|
export declare function useDebounce<T>(value: T, delay?: number): T;
|
|
113
113
|
|
|
114
|
+
export declare function useThrottle<T>(value: T, delay?: number): T;
|
|
115
|
+
|
|
114
116
|
export declare function useWindowSize(options?: UseWindowSizeOptions): {
|
|
115
117
|
screenWidth: number;
|
|
116
118
|
screenHeight: number;
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { default as t } from "./react/hooks/useWindowSize.js";
|
|
2
2
|
import { default as r } from "./react/hooks/useDebounce.js";
|
|
3
3
|
import { default as s } from "./react/hooks/useCopy.js";
|
|
4
|
-
import { default as
|
|
5
|
-
import { default as
|
|
6
|
-
import { default as x } from "./react/components/toast/
|
|
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";
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
x as Toaster,
|
|
10
|
+
d as Tooltip,
|
|
11
|
+
T as toast,
|
|
11
12
|
s as useCopy,
|
|
12
13
|
r as useDebounce,
|
|
14
|
+
l as useThrottle,
|
|
13
15
|
t as useWindowSize
|
|
14
16
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useState as c, useRef as f, useEffect as i } from "react";
|
|
2
|
+
function a(t, e = 500) {
|
|
3
|
+
const [n, u] = c(t), r = f(0);
|
|
4
|
+
return i(() => {
|
|
5
|
+
function s() {
|
|
6
|
+
const o = Date.now();
|
|
7
|
+
o - r.current >= e && (u(t), r.current = o);
|
|
8
|
+
}
|
|
9
|
+
return s;
|
|
10
|
+
}, [t, e]), n;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
a as default
|
|
14
|
+
};
|