@oneplatformdev/hooks 0.1.0-15 → 0.1.0-150

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.
Files changed (223) hide show
  1. package/CHANGELOG.md +585 -0
  2. package/index.d.ts +37 -0
  3. package/index.d.ts.map +1 -0
  4. package/package.json +14 -20
  5. package/useBoolean/index.d.ts +2 -0
  6. package/useBoolean/index.d.ts.map +1 -0
  7. package/useBoolean/index.js +4 -0
  8. package/useBoolean/useBoolean.d.ts +29 -0
  9. package/useBoolean/useBoolean.d.ts.map +1 -0
  10. package/useBoolean/useBoolean.js +16 -0
  11. package/useClickAnyWhere/index.d.ts +2 -0
  12. package/useClickAnyWhere/index.d.ts.map +1 -0
  13. package/useClickAnyWhere/index.js +4 -0
  14. package/useClickAnyWhere/useClickAnyWhere.d.ts +17 -0
  15. package/useClickAnyWhere/useClickAnyWhere.d.ts.map +1 -0
  16. package/useClickAnyWhere/useClickAnyWhere.js +9 -0
  17. package/useCopyToClipboard/index.d.ts +2 -0
  18. package/useCopyToClipboard/index.d.ts.map +1 -0
  19. package/useCopyToClipboard/index.js +4 -0
  20. package/useCopyToClipboard/useCopyToClipboard.d.ts +34 -0
  21. package/useCopyToClipboard/useCopyToClipboard.d.ts.map +1 -0
  22. package/useCopyToClipboard/useCopyToClipboard.js +16 -0
  23. package/useCountdown/index.d.ts +2 -0
  24. package/useCountdown/index.d.ts.map +1 -0
  25. package/useCountdown/index.js +4 -0
  26. package/useCountdown/useCountdown.d.ts +47 -0
  27. package/useCountdown/useCountdown.d.ts.map +1 -0
  28. package/useCountdown/useCountdown.js +33 -0
  29. package/useCounter/index.d.ts +2 -0
  30. package/useCounter/index.d.ts.map +1 -0
  31. package/useCounter/index.js +4 -0
  32. package/useCounter/useCounter.d.ts +28 -0
  33. package/useCounter/useCounter.d.ts.map +1 -0
  34. package/useCounter/useCounter.js +20 -0
  35. package/useDarkMode/index.d.ts +2 -0
  36. package/useDarkMode/index.d.ts.map +1 -0
  37. package/useDarkMode/index.js +4 -0
  38. package/useDarkMode/useDarkMode.d.ts +46 -0
  39. package/useDarkMode/useDarkMode.d.ts.map +1 -0
  40. package/useDarkMode/useDarkMode.js +38 -0
  41. package/useDebounceCallback/index.d.ts +3 -0
  42. package/useDebounceCallback/index.d.ts.map +1 -0
  43. package/useDebounceCallback/index.js +5 -0
  44. package/useDebounceCallback/useDebounceCallback.d.ts +62 -0
  45. package/useDebounceCallback/useDebounceCallback.d.ts.map +1 -0
  46. package/useDebounceCallback/useDebounceCallback.js +21 -0
  47. package/useDebounceValue/index.d.ts +2 -0
  48. package/useDebounceValue/index.d.ts.map +1 -0
  49. package/useDebounceValue/index.js +4 -0
  50. package/useDebounceValue/useDebounceValue.d.ts +40 -0
  51. package/useDebounceValue/useDebounceValue.d.ts.map +1 -0
  52. package/useDebounceValue/useDebounceValue.js +13 -0
  53. package/useDocumentTitle/index.d.ts +2 -0
  54. package/useDocumentTitle/index.d.ts.map +1 -0
  55. package/useDocumentTitle/index.js +4 -0
  56. package/useDocumentTitle/useDocumentTitle.d.ts +19 -0
  57. package/useDocumentTitle/useDocumentTitle.d.ts.map +1 -0
  58. package/useDocumentTitle/useDocumentTitle.js +16 -0
  59. package/useEventCallback/index.d.ts +2 -0
  60. package/useEventCallback/index.d.ts.map +1 -0
  61. package/useEventCallback/index.js +4 -0
  62. package/useEventCallback/useEventCallback.d.ts +18 -0
  63. package/useEventCallback/useEventCallback.d.ts.map +1 -0
  64. package/useEventCallback/useEventCallback.js +13 -0
  65. package/useEventListener/index.d.ts +2 -0
  66. package/useEventListener/index.d.ts.map +1 -0
  67. package/useEventListener/index.js +4 -0
  68. package/useEventListener/useEventListener.d.ts +9 -0
  69. package/useEventListener/useEventListener.d.ts.map +1 -0
  70. package/useEventListener/useEventListener.js +20 -0
  71. package/useHover/index.d.ts +2 -0
  72. package/useHover/index.d.ts.map +1 -0
  73. package/useHover/index.js +4 -0
  74. package/useHover/useHover.d.ts +17 -0
  75. package/useHover/useHover.d.ts.map +1 -0
  76. package/useHover/useHover.js +13 -0
  77. package/useIntersectionObserver/index.d.ts +2 -0
  78. package/useIntersectionObserver/index.d.ts.map +1 -0
  79. package/useIntersectionObserver/index.js +4 -0
  80. package/useIntersectionObserver/useIntersectionObserver.d.ts +72 -0
  81. package/useIntersectionObserver/useIntersectionObserver.d.ts.map +1 -0
  82. package/useIntersectionObserver/useIntersectionObserver.js +53 -0
  83. package/useInterval/index.d.ts +2 -0
  84. package/useInterval/index.d.ts.map +1 -0
  85. package/useInterval/index.js +4 -0
  86. package/useInterval/useInterval.d.ts +16 -0
  87. package/useInterval/useInterval.d.ts.map +1 -0
  88. package/useInterval/useInterval.js +20 -0
  89. package/useIsClient/index.d.ts +2 -0
  90. package/useIsClient/index.d.ts.map +1 -0
  91. package/useIsClient/index.js +4 -0
  92. package/useIsClient/useIsClient.d.ts +13 -0
  93. package/useIsClient/useIsClient.d.ts.map +1 -0
  94. package/useIsClient/useIsClient.js +10 -0
  95. package/useIsMobile/index.d.ts +3 -0
  96. package/useIsMobile/index.d.ts.map +1 -0
  97. package/useIsMobile/index.js +4 -0
  98. package/useIsMobile/types.d.ts +4 -0
  99. package/useIsMobile/types.d.ts.map +1 -0
  100. package/useIsMobile/types.js +1 -0
  101. package/useIsMobile/useIsMobile.d.ts +3 -0
  102. package/useIsMobile/useIsMobile.d.ts.map +1 -0
  103. package/useIsMobile/useIsMobile.js +16 -0
  104. package/useIsMounted/index.d.ts +2 -0
  105. package/useIsMounted/index.d.ts.map +1 -0
  106. package/useIsMounted/index.js +4 -0
  107. package/useIsMounted/useIsMounted.d.ts +2 -0
  108. package/useIsMounted/useIsMounted.d.ts.map +1 -0
  109. package/useIsMounted/useIsMounted.js +10 -0
  110. package/useIsomorphicLayoutEffect/index.d.ts +2 -0
  111. package/useIsomorphicLayoutEffect/index.d.ts.map +1 -0
  112. package/useIsomorphicLayoutEffect/index.js +4 -0
  113. package/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +16 -0
  114. package/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts.map +1 -0
  115. package/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +5 -0
  116. package/useLocalStorage/index.d.ts +2 -0
  117. package/useLocalStorage/index.d.ts.map +1 -0
  118. package/useLocalStorage/index.js +4 -0
  119. package/useLocalStorage/useLocalStorage.d.ts +39 -0
  120. package/useLocalStorage/useLocalStorage.d.ts.map +1 -0
  121. package/useLocalStorage/useLocalStorage.js +65 -0
  122. package/useLockBody/index.d.ts +2 -0
  123. package/useLockBody/index.d.ts.map +1 -0
  124. package/useLockBody/index.js +4 -0
  125. package/useLockBody/useLockBody.d.ts +2 -0
  126. package/useLockBody/useLockBody.d.ts.map +1 -0
  127. package/useLockBody/useLockBody.js +12 -0
  128. package/useMap/index.d.ts +2 -0
  129. package/useMap/index.d.ts.map +1 -0
  130. package/useMap/index.js +4 -0
  131. package/useMap/useMap.d.ts +48 -0
  132. package/useMap/useMap.d.ts.map +1 -0
  133. package/useMap/useMap.js +27 -0
  134. package/useMediaQuery/index.d.ts +2 -0
  135. package/useMediaQuery/index.d.ts.map +1 -0
  136. package/useMediaQuery/index.js +4 -0
  137. package/useMediaQuery/useMediaQuery.d.ts +29 -0
  138. package/useMediaQuery/useMediaQuery.d.ts.map +1 -0
  139. package/useMediaQuery/useMediaQuery.js +21 -0
  140. package/useOnClickOutside/index.d.ts +2 -0
  141. package/useOnClickOutside/index.d.ts.map +1 -0
  142. package/useOnClickOutside/index.js +4 -0
  143. package/useOnClickOutside/useOnClickOutside.d.ts +24 -0
  144. package/useOnClickOutside/useOnClickOutside.d.ts.map +1 -0
  145. package/useOnClickOutside/useOnClickOutside.js +17 -0
  146. package/useQueryString/index.d.ts +2 -0
  147. package/useQueryString/index.d.ts.map +1 -0
  148. package/useQueryString/index.js +4 -0
  149. package/useQueryString/useQueryString.d.ts +10 -0
  150. package/useQueryString/useQueryString.d.ts.map +1 -0
  151. package/useQueryString/useQueryString.js +10 -0
  152. package/useReadLocalStorage/index.d.ts +2 -0
  153. package/useReadLocalStorage/index.d.ts.map +1 -0
  154. package/useReadLocalStorage/index.js +4 -0
  155. package/useReadLocalStorage/useReadLocalStorage.d.ts +14 -0
  156. package/useReadLocalStorage/useReadLocalStorage.d.ts.map +1 -0
  157. package/useReadLocalStorage/useReadLocalStorage.js +48 -0
  158. package/useResizeObserver/index.d.ts +2 -0
  159. package/useResizeObserver/index.d.ts.map +1 -0
  160. package/useResizeObserver/index.js +4 -0
  161. package/useResizeObserver/useResizeObserver.d.ts +44 -0
  162. package/useResizeObserver/useResizeObserver.d.ts.map +1 -0
  163. package/useResizeObserver/useResizeObserver.js +31 -0
  164. package/useScreen/index.d.ts +2 -0
  165. package/useScreen/index.d.ts.map +1 -0
  166. package/useScreen/index.js +4 -0
  167. package/useScreen/useScreen.d.ts +20 -0
  168. package/useScreen/useScreen.d.ts.map +1 -0
  169. package/useScreen/useScreen.js +48 -0
  170. package/useScript/index.d.ts +2 -0
  171. package/useScript/index.d.ts.map +1 -0
  172. package/useScript/index.js +4 -0
  173. package/useScript/useScript.d.ts +24 -0
  174. package/useScript/useScript.d.ts.map +1 -0
  175. package/useScript/useScript.js +45 -0
  176. package/useScrollLock/index.d.ts +2 -0
  177. package/useScrollLock/index.d.ts.map +1 -0
  178. package/useScrollLock/index.js +4 -0
  179. package/useScrollLock/useScrollLock.d.ts +54 -0
  180. package/useScrollLock/useScrollLock.d.ts.map +1 -0
  181. package/useScrollLock/useScrollLock.js +26 -0
  182. package/useSessionStorage/index.d.ts +2 -0
  183. package/useSessionStorage/index.d.ts.map +1 -0
  184. package/useSessionStorage/index.js +4 -0
  185. package/useSessionStorage/useSessionStorage.d.ts +39 -0
  186. package/useSessionStorage/useSessionStorage.d.ts.map +1 -0
  187. package/useSessionStorage/useSessionStorage.js +65 -0
  188. package/useStep/index.d.ts +2 -0
  189. package/useStep/index.d.ts.map +1 -0
  190. package/useStep/index.js +4 -0
  191. package/useStep/useStep.d.ts +31 -0
  192. package/useStep/useStep.d.ts.map +1 -0
  193. package/useStep/useStep.js +34 -0
  194. package/useTernaryDarkMode/index.d.ts +2 -0
  195. package/useTernaryDarkMode/index.d.ts.map +1 -0
  196. package/useTernaryDarkMode/index.js +4 -0
  197. package/useTernaryDarkMode/useTernaryDarkMode.d.ts +46 -0
  198. package/useTernaryDarkMode/useTernaryDarkMode.d.ts.map +1 -0
  199. package/useTernaryDarkMode/useTernaryDarkMode.js +27 -0
  200. package/useTimeout/index.d.ts +2 -0
  201. package/useTimeout/index.d.ts.map +1 -0
  202. package/useTimeout/index.js +4 -0
  203. package/useTimeout/useTimeout.d.ts +17 -0
  204. package/useTimeout/useTimeout.d.ts.map +1 -0
  205. package/useTimeout/useTimeout.js +20 -0
  206. package/useToggle/index.d.ts +2 -0
  207. package/useToggle/index.d.ts.map +1 -0
  208. package/useToggle/index.js +4 -0
  209. package/useToggle/useToggle.d.ts +18 -0
  210. package/useToggle/useToggle.d.ts.map +1 -0
  211. package/useToggle/useToggle.js +10 -0
  212. package/useUnmount/index.d.ts +2 -0
  213. package/useUnmount/index.d.ts.map +1 -0
  214. package/useUnmount/index.js +4 -0
  215. package/useUnmount/useUnmount.d.ts +14 -0
  216. package/useUnmount/useUnmount.d.ts.map +1 -0
  217. package/useUnmount/useUnmount.js +13 -0
  218. package/useWindowSize/index.d.ts +2 -0
  219. package/useWindowSize/index.d.ts.map +1 -0
  220. package/useWindowSize/index.js +4 -0
  221. package/useWindowSize/useWindowSize.d.ts +30 -0
  222. package/useWindowSize/useWindowSize.d.ts.map +1 -0
  223. package/useWindowSize/useWindowSize.js +31 -0
@@ -0,0 +1,19 @@
1
+ /** Hook options. */
2
+ type UseDocumentTitleOptions = {
3
+ /** Whether to keep the title after unmounting the component (default is `true`). */
4
+ preserveTitleOnUnmount?: boolean;
5
+ };
6
+ /**
7
+ * Custom hook that sets the document title.
8
+ * @param {string} title - The title to set.
9
+ * @param {?UseDocumentTitleOptions} [options] - The options.
10
+ * @public
11
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-document-title)
12
+ * @example
13
+ * ```tsx
14
+ * useDocumentTitle('My new title');
15
+ * ```
16
+ */
17
+ export declare function useDocumentTitle(title: string, options?: UseDocumentTitleOptions): void;
18
+ export {};
19
+ //# sourceMappingURL=useDocumentTitle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDocumentTitle.d.ts","sourceRoot":"","sources":["../../src/useDocumentTitle/useDocumentTitle.ts"],"names":[],"mappings":"AAKA,oBAAoB;AACpB,KAAK,uBAAuB,GAAG;IAC7B,oFAAoF;IACpF,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,uBAA4B,GACpC,IAAI,CAiBN"}
@@ -0,0 +1,16 @@
1
+ import { useRef as r } from "react";
2
+ import { useIsomorphicLayoutEffect as o } from "../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
3
+ import { useUnmount as i } from "../useUnmount/useUnmount.js";
4
+ function l(e, n = {}) {
5
+ const { preserveTitleOnUnmount: u = !0 } = n, t = r(null);
6
+ o(() => {
7
+ t.current = window.document.title;
8
+ }, []), o(() => {
9
+ window.document.title = e;
10
+ }, [e]), i(() => {
11
+ !u && t.current && (window.document.title = t.current);
12
+ });
13
+ }
14
+ export {
15
+ l as useDocumentTitle
16
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useEventCallback';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useEventCallback/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useEventCallback as l } from "./useEventCallback.js";
2
+ export {
3
+ l as useEventCallback
4
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Custom hook that creates a memoized event callback.
3
+ * @template Args - An array of argument types for the event callback.
4
+ * @template R - The return type of the event callback.
5
+ * @param {(...args: Args) => R} fn - The callback function.
6
+ * @returns {(...args: Args) => R} A memoized event callback function.
7
+ * @public
8
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-event-callback)
9
+ * @example
10
+ * ```tsx
11
+ * const handleClick = useEventCallback((event) => {
12
+ * // Handle the event here
13
+ * });
14
+ * ```
15
+ */
16
+ export declare function useEventCallback<Args extends unknown[], R>(fn: (...args: Args) => R): (...args: Args) => R;
17
+ export declare function useEventCallback<Args extends unknown[], R>(fn: ((...args: Args) => R) | undefined): ((...args: Args) => R) | undefined;
18
+ //# sourceMappingURL=useEventCallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEventCallback.d.ts","sourceRoot":"","sources":["../../src/useEventCallback/useEventCallback.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,CAAC,EACxD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,GACvB,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,CAAA;AACvB,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,CAAC,EACxD,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,CAAC,GAAG,SAAS,GACrC,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,CAAC,GAAG,SAAS,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { useRef as t, useCallback as o } from "react";
2
+ import { useIsomorphicLayoutEffect as a } from "../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
3
+ function l(e) {
4
+ const r = t(() => {
5
+ throw new Error("Cannot call an event handler while rendering.");
6
+ });
7
+ return a(() => {
8
+ r.current = e;
9
+ }, [e]), o((...n) => r.current?.(...n), [r]);
10
+ }
11
+ export {
12
+ l as useEventCallback
13
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useEventListener';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useEventListener/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useEventListener as t } from "./useEventListener.js";
2
+ export {
3
+ t as useEventListener
4
+ };
@@ -0,0 +1,9 @@
1
+ import { RefObject } from 'react';
2
+ declare function useEventListener<K extends keyof MediaQueryListEventMap>(eventName: K, handler: (event: MediaQueryListEventMap[K]) => void, element: RefObject<MediaQueryList>, options?: boolean | AddEventListenerOptions): void;
3
+ declare function useEventListener<K extends keyof WindowEventMap>(eventName: K, handler: (event: WindowEventMap[K]) => void, element?: undefined, options?: boolean | AddEventListenerOptions): void;
4
+ declare function useEventListener<K extends keyof HTMLElementEventMap & keyof SVGElementEventMap, T extends Element = K extends keyof HTMLElementEventMap ? HTMLDivElement : SVGElement>(eventName: K, handler: ((event: HTMLElementEventMap[K]) => void) | ((event: SVGElementEventMap[K]) => void), element: RefObject<Document | undefined | null>, options?: boolean | AddEventListenerOptions): void;
5
+ declare function useEventListener<K extends keyof WindowEventMap>(eventName: K, handler: (event: WindowEventMap[K]) => void, element: RefObject<Window | undefined | null>, options?: boolean | AddEventListenerOptions): void;
6
+ declare function useEventListener<K extends keyof DocumentEventMap>(eventName: K, handler: (event: DocumentEventMap[K]) => void, element: RefObject<Document | undefined | null>, options?: boolean | AddEventListenerOptions): void;
7
+ declare function useEventListener<K extends keyof HTMLElementEventMap>(eventName: K, handler: (event: HTMLElementEventMap[K]) => void, element: RefObject<HTMLElement | undefined | null>, options?: boolean | AddEventListenerOptions): void;
8
+ export { useEventListener };
9
+ //# sourceMappingURL=useEventListener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEventListener.d.ts","sourceRoot":"","sources":["../../src/useEventListener/useEventListener.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,iBAAS,gBAAgB,CAAC,CAAC,SAAS,MAAM,sBAAsB,EAC9D,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,EACnD,OAAO,EAAE,SAAS,CAAC,cAAc,CAAC,EAClC,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAA;AAGP,iBAAS,gBAAgB,CAAC,CAAC,SAAS,MAAM,cAAc,EACtD,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3C,OAAO,CAAC,EAAE,SAAS,EACnB,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAA;AAGP,iBAAS,gBAAgB,CACvB,CAAC,SAAS,MAAM,mBAAmB,GAAG,MAAM,kBAAkB,EAC9D,CAAC,SAAS,OAAO,GAAG,CAAC,SAAS,MAAM,mBAAmB,GACnD,cAAc,GACd,UAAU,EAEd,SAAS,EAAE,CAAC,EACZ,OAAO,EACH,CAAC,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,GACzC,CAAC,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,EAC5C,OAAO,EAAE,SAAS,CAAC,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,EAC/C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAA;AAGP,iBAAS,gBAAgB,CAAC,CAAC,SAAS,MAAM,cAAc,EACtD,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3C,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,EAC7C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAC;AACR,iBAAS,gBAAgB,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACxD,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC7C,OAAO,EAAE,SAAS,CAAC,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,EAC/C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAA;AACP,iBAAS,gBAAgB,CAAC,CAAC,SAAS,MAAM,mBAAmB,EAC3D,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,EAChD,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC,EAClD,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAC;AA6ER,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { useRef as f, useEffect as i } from "react";
2
+ import { useIsomorphicLayoutEffect as E } from "../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
3
+ function m(r, t, s, n) {
4
+ const u = f(t);
5
+ E(() => {
6
+ u.current = t;
7
+ }, [t]), i(() => {
8
+ const e = s?.current ?? window;
9
+ if (!(e && e.addEventListener)) return;
10
+ const c = (o) => {
11
+ u.current(o);
12
+ };
13
+ return e.addEventListener(r, c, n), () => {
14
+ e.removeEventListener(r, c, n);
15
+ };
16
+ }, [r, s, n]);
17
+ }
18
+ export {
19
+ m as useEventListener
20
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useHover';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useHover/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useHover as r } from "./useHover.js";
2
+ export {
3
+ r as useHover
4
+ };
@@ -0,0 +1,17 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * Custom hook that tracks whether a DOM element is being hovered over.
4
+ * @template T - The type of the DOM element. Defaults to `HTMLElement`.
5
+ * @param {RefObject<T>} elementRef - The ref object for the DOM element to track.
6
+ * @returns {boolean} A boolean value indicating whether the element is being hovered over.
7
+ * @public
8
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-hover)
9
+ * @example
10
+ * ```tsx
11
+ * const buttonRef = useRef<HTMLButtonElement>(null);
12
+ * const isHovered = useHover(buttonRef);
13
+ * // Access the isHovered variable to determine if the button is being hovered over.
14
+ * ```
15
+ */
16
+ export declare function useHover<T extends HTMLElement = HTMLElement>(elementRef: RefObject<T | undefined | null>): boolean;
17
+ //# sourceMappingURL=useHover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHover.d.ts","sourceRoot":"","sources":["../../src/useHover/useHover.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC1D,UAAU,EAAE,SAAS,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,GAC1C,OAAO,CAcT"}
@@ -0,0 +1,13 @@
1
+ import { useState as n } from "react";
2
+ import { useEventListener as o } from "../useEventListener/useEventListener.js";
3
+ function m(e) {
4
+ const [s, t] = n(!1), r = () => {
5
+ t(!0);
6
+ }, u = () => {
7
+ t(!1);
8
+ };
9
+ return o("mouseenter", r, e), o("mouseleave", u, e), s;
10
+ }
11
+ export {
12
+ m as useHover
13
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useIntersectionObserver';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useIntersectionObserver/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useIntersectionObserver as o } from "./useIntersectionObserver.js";
2
+ export {
3
+ o as useIntersectionObserver
4
+ };
@@ -0,0 +1,72 @@
1
+ /** Represents the options for configuring the Intersection Observer. */
2
+ type UseIntersectionObserverOptions = {
3
+ /**
4
+ * The element that is used as the viewport for checking visibility of the target.
5
+ * @default null
6
+ */
7
+ root?: Element | Document | null;
8
+ /**
9
+ * A margin around the root.
10
+ * @default '0%'
11
+ */
12
+ rootMargin?: string;
13
+ /**
14
+ * A threshold indicating the percentage of the target's visibility needed to trigger the callback.
15
+ * @default 0
16
+ */
17
+ threshold?: number | number[];
18
+ /**
19
+ * If true, freezes the intersection state once the element becomes visible.
20
+ * @default false
21
+ */
22
+ freezeOnceVisible?: boolean;
23
+ /**
24
+ * A callback function to be invoked when the intersection state changes.
25
+ * @param {boolean} isIntersecting - A boolean indicating if the element is intersecting.
26
+ * @param {IntersectionObserverEntry} entry - The intersection observer Entry.
27
+ * @default undefined
28
+ */
29
+ onChange?: (isIntersecting: boolean, entry: IntersectionObserverEntry) => void;
30
+ /**
31
+ * The initial state of the intersection.
32
+ * @default false
33
+ */
34
+ initialIsIntersecting?: boolean;
35
+ };
36
+ /**
37
+ * The return type of the useIntersectionObserver hook.
38
+ *
39
+ * Supports both tuple and object destructing.
40
+ * @param {(node: Element | null) => void} ref - The ref callback function.
41
+ * @param {boolean} isIntersecting - A boolean indicating if the element is intersecting.
42
+ * @param {IntersectionObserverEntry | undefined} entry - The intersection observer Entry.
43
+ */
44
+ type IntersectionReturn = [
45
+ (node?: Element | null) => void,
46
+ boolean,
47
+ IntersectionObserverEntry | undefined
48
+ ] & {
49
+ ref: (node?: Element | null) => void;
50
+ isIntersecting: boolean;
51
+ entry?: IntersectionObserverEntry;
52
+ };
53
+ /**
54
+ * Custom hook that tracks the intersection of a DOM element with its containing element or the viewport using the [`Intersection Observer API`](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API).
55
+ * @param {UseIntersectionObserverOptions} options - The options for the Intersection Observer.
56
+ * @returns {IntersectionReturn} The ref callback, a boolean indicating if the element is intersecting, and the intersection observer entry.
57
+ * @public
58
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-intersection-observer)
59
+ * @example
60
+ * ```tsx
61
+ * // Example 1
62
+ * const [ref, isIntersecting, entry] = useIntersectionObserver({ threshold: 0.5 });
63
+ * ```
64
+ *
65
+ * ```tsx
66
+ * // Example 2
67
+ * const { ref, isIntersecting, entry } = useIntersectionObserver({ threshold: 0.5 });
68
+ * ```
69
+ */
70
+ export declare function useIntersectionObserver({ threshold, root, rootMargin, freezeOnceVisible, initialIsIntersecting, onChange, }?: UseIntersectionObserverOptions): IntersectionReturn;
71
+ export {};
72
+ //# sourceMappingURL=useIntersectionObserver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntersectionObserver.d.ts","sourceRoot":"","sources":["../../src/useIntersectionObserver/useIntersectionObserver.ts"],"names":[],"mappings":"AAUA,wEAAwE;AACxE,KAAK,8BAA8B,GAAG;IACpC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI,CAAA;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC7B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAA;IAC9E;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAED;;;;;;;GAOG;AACH,KAAK,kBAAkB,GAAG;IACxB,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI;IAC/B,OAAO;IACP,yBAAyB,GAAG,SAAS;CACtC,GAAG;IACF,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAA;IACpC,cAAc,EAAE,OAAO,CAAA;IACvB,KAAK,CAAC,EAAE,yBAAyB,CAAA;CAClC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,SAAa,EACb,IAAW,EACX,UAAiB,EACjB,iBAAyB,EACzB,qBAA6B,EAC7B,QAAQ,GACT,GAAE,8BAAmC,GAAG,kBAAkB,CAiG1D"}
@@ -0,0 +1,53 @@
1
+ import { useState as d, useRef as h, useEffect as I } from "react";
2
+ function A({
3
+ threshold: f = 0,
4
+ root: a = null,
5
+ rootMargin: l = "0%",
6
+ freezeOnceVisible: s = !1,
7
+ initialIsIntersecting: i = !1,
8
+ onChange: R
9
+ } = {}) {
10
+ const [r, b] = d(null), [t, y] = d(() => ({
11
+ isIntersecting: i,
12
+ entry: void 0
13
+ })), u = h(null);
14
+ u.current = R;
15
+ const c = t.entry?.isIntersecting && s;
16
+ I(() => {
17
+ if (!r || !("IntersectionObserver" in window) || c) return;
18
+ const n = new IntersectionObserver(
19
+ (m) => {
20
+ const p = Array.isArray(n.thresholds) ? n.thresholds : [n.thresholds];
21
+ m.forEach((o) => {
22
+ const v = o.isIntersecting && p.some((w) => o.intersectionRatio >= w);
23
+ y({ isIntersecting: v, entry: o }), u.current && u.current(v, o);
24
+ });
25
+ },
26
+ { threshold: f, root: a, rootMargin: l }
27
+ );
28
+ return n.observe(r), () => {
29
+ n.disconnect();
30
+ };
31
+ }, [
32
+ r,
33
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34
+ JSON.stringify(f),
35
+ a,
36
+ l,
37
+ c,
38
+ s
39
+ ]);
40
+ const g = h(null);
41
+ I(() => {
42
+ !r && t.entry?.target && !s && !c && g.current !== t.entry.target && (g.current = t.entry.target, y({ isIntersecting: i, entry: void 0 }));
43
+ }, [r, t.entry, s, c, i]);
44
+ const e = [
45
+ b,
46
+ !!t.isIntersecting,
47
+ t.entry
48
+ ];
49
+ return e.ref = e[0], e.isIntersecting = e[1], e.entry = e[2], e;
50
+ }
51
+ export {
52
+ A as useIntersectionObserver
53
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useInterval';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useInterval/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useInterval as o } from "./useInterval.js";
2
+ export {
3
+ o as useInterval
4
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Custom hook that creates an interval that invokes a callback function at a specified delay using the [`setInterval API`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval).
3
+ * @param {() => void} callback - The function to be invoked at each interval.
4
+ * @param {number | null} delay - The time, in milliseconds, between each invocation of the callback. Use `null` to clear the interval.
5
+ * @public
6
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-interval)
7
+ * @example
8
+ * ```tsx
9
+ * const handleInterval = () => {
10
+ * // Code to be executed at each interval
11
+ * };
12
+ * useInterval(handleInterval, 1000);
13
+ * ```
14
+ */
15
+ export declare function useInterval(callback: () => void, delay: number | null): void;
16
+ //# sourceMappingURL=useInterval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInterval.d.ts","sourceRoot":"","sources":["../../src/useInterval/useInterval.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,QAwBrE"}
@@ -0,0 +1,20 @@
1
+ import { useRef as o, useEffect as u } from "react";
2
+ import { useIsomorphicLayoutEffect as f } from "../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
3
+ function i(r, t) {
4
+ const e = o(r);
5
+ f(() => {
6
+ e.current = r;
7
+ }, [r]), u(() => {
8
+ if (t === null)
9
+ return;
10
+ const n = setInterval(() => {
11
+ e.current();
12
+ }, t);
13
+ return () => {
14
+ clearInterval(n);
15
+ };
16
+ }, [t]);
17
+ }
18
+ export {
19
+ i as useInterval
20
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useIsClient';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useIsClient/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useIsClient as r } from "./useIsClient.js";
2
+ export {
3
+ r as useIsClient
4
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Custom hook that determines if the code is running on the client side (in the browser).
3
+ * @returns {boolean} A boolean value indicating whether the code is running on the client side.
4
+ * @public
5
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-is-client)
6
+ * @example
7
+ * ```tsx
8
+ * const isClient = useIsClient();
9
+ * // Use isClient to conditionally render or execute code specific to the client side.
10
+ * ```
11
+ */
12
+ export declare function useIsClient(): boolean;
13
+ //# sourceMappingURL=useIsClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsClient.d.ts","sourceRoot":"","sources":["../../src/useIsClient/useIsClient.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,YAQ1B"}
@@ -0,0 +1,10 @@
1
+ import { useState as s, useEffect as n } from "react";
2
+ function r() {
3
+ const [e, t] = s(!1);
4
+ return n(() => {
5
+ t(!0);
6
+ }, []), e;
7
+ }
8
+ export {
9
+ r as useIsClient
10
+ };
@@ -0,0 +1,3 @@
1
+ export * from './useIsMobile';
2
+ export type * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useIsMobile/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,mBAAmB,SAAS,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useIsMobile as r } from "./useIsMobile.js";
2
+ export {
3
+ r as useIsMobile
4
+ };
@@ -0,0 +1,4 @@
1
+ export interface IUseIsMobileParams {
2
+ mobileBreakpoint?: number;
3
+ }
4
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/useIsMobile/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,3 @@
1
+ import { IUseIsMobileParams } from './types';
2
+ export declare function useIsMobile(params?: IUseIsMobileParams): boolean;
3
+ //# sourceMappingURL=useIsMobile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsMobile.d.ts","sourceRoot":"","sources":["../../src/useIsMobile/useIsMobile.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAI7C,wBAAgB,WAAW,CAAC,MAAM,GAAE,kBAAuB,WAiB1D"}
@@ -0,0 +1,16 @@
1
+ import * as o from "react";
2
+ const a = 768;
3
+ function c(s = {}) {
4
+ const {
5
+ mobileBreakpoint: e = a
6
+ } = s, [r, n] = o.useState(void 0);
7
+ return o.useEffect(() => {
8
+ const t = window.matchMedia(`(max-width: ${e - 1}px)`), i = () => {
9
+ n(window.innerWidth < e);
10
+ };
11
+ return t.addEventListener("change", i), n(window.innerWidth < e), () => t.removeEventListener("change", i);
12
+ }, [e]), !!r;
13
+ }
14
+ export {
15
+ c as useIsMobile
16
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useIsMounted';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useIsMounted/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useIsMounted as r } from "./useIsMounted.js";
2
+ export {
3
+ r as useIsMounted
4
+ };
@@ -0,0 +1,2 @@
1
+ export declare function useIsMounted(): () => boolean;
2
+ //# sourceMappingURL=useIsMounted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsMounted.d.ts","sourceRoot":"","sources":["../../src/useIsMounted/useIsMounted.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,IAAI,MAAM,OAAO,CAY5C"}
@@ -0,0 +1,10 @@
1
+ import { useRef as r, useEffect as t, useCallback as u } from "react";
2
+ function s() {
3
+ const e = r(!1);
4
+ return t(() => (e.current = !0, () => {
5
+ e.current = !1;
6
+ }), []), u(() => e.current, []);
7
+ }
8
+ export {
9
+ s as useIsMounted
10
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useIsomorphicLayoutEffect';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useIsomorphicLayoutEffect/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useIsomorphicLayoutEffect as f } from "./useIsomorphicLayoutEffect.js";
2
+ export {
3
+ f as useIsomorphicLayoutEffect
4
+ };
@@ -0,0 +1,16 @@
1
+ import { useLayoutEffect } from 'react';
2
+ /**
3
+ * Custom hook that uses either `useLayoutEffect` or `useEffect` based on the environment (client-side or server-side).
4
+ * @param {Function} effect - The effect function to be executed.
5
+ * @param {Array<any>} [dependencies] - An array of dependencies for the effect (optional).
6
+ * @public
7
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect)
8
+ * @example
9
+ * ```tsx
10
+ * useIsomorphicLayoutEffect(() => {
11
+ * // Code to be executed during the layout phase on the client side
12
+ * }, [dependency1, dependency2]);
13
+ * ```
14
+ */
15
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
16
+ //# sourceMappingURL=useIsomorphicLayoutEffect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsomorphicLayoutEffect.d.ts","sourceRoot":"","sources":["../../src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,OAAO,CAAA;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,wBACuB,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { useLayoutEffect as e, useEffect as o } from "react";
2
+ const t = typeof window < "u" ? e : o;
3
+ export {
4
+ t as useIsomorphicLayoutEffect
5
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useLocalStorage';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useLocalStorage/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { useLocalStorage as r } from "./useLocalStorage.js";
2
+ export {
3
+ r as useLocalStorage
4
+ };
@@ -0,0 +1,39 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ declare global {
3
+ interface WindowEventMap {
4
+ 'local-storage': CustomEvent;
5
+ }
6
+ }
7
+ /**
8
+ * Options for customizing the behavior of serialization and deserialization.
9
+ * @template T - The type of the state to be stored in local storage.
10
+ */
11
+ type UseLocalStorageOptions<T> = {
12
+ /** A function to serialize the value before storing it. */
13
+ serializer?: (value: T) => string;
14
+ /** A function to deserialize the stored value. */
15
+ deserializer?: (value: string) => T;
16
+ /**
17
+ * If `true` (default), the hook will initialize reading the local storage. In SSR, you should set it to `false`, returning the initial value initially.
18
+ * @default true
19
+ */
20
+ initializeWithValue?: boolean;
21
+ };
22
+ /**
23
+ * Custom hook that uses the [`localStorage API`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) to persist state across page reloads.
24
+ * @template T - The type of the state to be stored in local storage.
25
+ * @param {string} key - The key under which the value will be stored in local storage.
26
+ * @param {T | (() => T)} initialValue - The initial value of the state or a function that returns the initial value.
27
+ * @param {UseLocalStorageOptions<T>} [options] - Options for customizing the behavior of serialization and deserialization (optional).
28
+ * @returns {[T, Dispatch<SetStateAction<T>>, () => void]} A tuple containing the stored value, a function to set the value and a function to remove the key from storage.
29
+ * @public
30
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-local-storage)
31
+ * @example
32
+ * ```tsx
33
+ * const [count, setCount, removeCount] = useLocalStorage('count', 0);
34
+ * // Access the `count` value, the `setCount` function to update it and `removeCount` function to remove the key from storage.
35
+ * ```
36
+ */
37
+ export declare function useLocalStorage<T>(key: string, initialValue: T | (() => T), options?: UseLocalStorageOptions<T>): [T, Dispatch<SetStateAction<T>>, () => void];
38
+ export {};
39
+ //# sourceMappingURL=useLocalStorage.d.ts.map