@oneplatformdev/hooks 0.0.1-beta.7 → 0.1.0-11

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 (183) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -2
  3. package/index.js +74 -0
  4. package/package.json +35 -16
  5. package/index.d.ts +0 -35
  6. package/index.mjs +0 -72
  7. package/useBoolean/index.d.ts +0 -1
  8. package/useBoolean/index.mjs +0 -4
  9. package/useBoolean/package.json +0 -7
  10. package/useBoolean/useBoolean.d.ts +0 -29
  11. package/useBoolean/useBoolean.mjs +0 -16
  12. package/useClickAnyWhere/index.d.ts +0 -1
  13. package/useClickAnyWhere/index.mjs +0 -4
  14. package/useClickAnyWhere/package.json +0 -7
  15. package/useClickAnyWhere/useClickAnyWhere.d.ts +0 -16
  16. package/useClickAnyWhere/useClickAnyWhere.mjs +0 -9
  17. package/useCopyToClipboard/index.d.ts +0 -1
  18. package/useCopyToClipboard/index.mjs +0 -4
  19. package/useCopyToClipboard/package.json +0 -7
  20. package/useCopyToClipboard/useCopyToClipboard.d.ts +0 -33
  21. package/useCopyToClipboard/useCopyToClipboard.mjs +0 -16
  22. package/useCountdown/index.d.ts +0 -1
  23. package/useCountdown/index.mjs +0 -4
  24. package/useCountdown/package.json +0 -7
  25. package/useCountdown/useCountdown.d.ts +0 -46
  26. package/useCountdown/useCountdown.mjs +0 -33
  27. package/useCounter/index.d.ts +0 -1
  28. package/useCounter/index.mjs +0 -4
  29. package/useCounter/package.json +0 -7
  30. package/useCounter/useCounter.d.ts +0 -28
  31. package/useCounter/useCounter.mjs +0 -20
  32. package/useDarkMode/index.d.ts +0 -1
  33. package/useDarkMode/index.mjs +0 -4
  34. package/useDarkMode/package.json +0 -7
  35. package/useDarkMode/useDarkMode.d.ts +0 -45
  36. package/useDarkMode/useDarkMode.mjs +0 -38
  37. package/useDebounceCallback/index.d.ts +0 -2
  38. package/useDebounceCallback/index.mjs +0 -5
  39. package/useDebounceCallback/package.json +0 -7
  40. package/useDebounceCallback/useDebounceCallback.d.ts +0 -61
  41. package/useDebounceCallback/useDebounceCallback.mjs +0 -101
  42. package/useDebounceValue/index.d.ts +0 -1
  43. package/useDebounceValue/index.mjs +0 -4
  44. package/useDebounceValue/package.json +0 -7
  45. package/useDebounceValue/useDebounceValue.d.ts +0 -40
  46. package/useDebounceValue/useDebounceValue.mjs +0 -13
  47. package/useDocumentTitle/index.d.ts +0 -1
  48. package/useDocumentTitle/index.mjs +0 -4
  49. package/useDocumentTitle/package.json +0 -7
  50. package/useDocumentTitle/useDocumentTitle.d.ts +0 -18
  51. package/useDocumentTitle/useDocumentTitle.mjs +0 -16
  52. package/useEventCallback/index.d.ts +0 -1
  53. package/useEventCallback/index.mjs +0 -4
  54. package/useEventCallback/package.json +0 -7
  55. package/useEventCallback/useEventCallback.d.ts +0 -17
  56. package/useEventCallback/useEventCallback.mjs +0 -16
  57. package/useEventListener/index.d.ts +0 -1
  58. package/useEventListener/index.mjs +0 -4
  59. package/useEventListener/package.json +0 -7
  60. package/useEventListener/useEventListener.d.ts +0 -7
  61. package/useEventListener/useEventListener.mjs +0 -20
  62. package/useHover/index.d.ts +0 -1
  63. package/useHover/index.mjs +0 -4
  64. package/useHover/package.json +0 -7
  65. package/useHover/useHover.d.ts +0 -17
  66. package/useHover/useHover.mjs +0 -13
  67. package/useIntersectionObserver/index.d.ts +0 -1
  68. package/useIntersectionObserver/index.mjs +0 -4
  69. package/useIntersectionObserver/package.json +0 -7
  70. package/useIntersectionObserver/useIntersectionObserver.d.ts +0 -71
  71. package/useIntersectionObserver/useIntersectionObserver.mjs +0 -55
  72. package/useInterval/index.d.ts +0 -1
  73. package/useInterval/index.mjs +0 -4
  74. package/useInterval/package.json +0 -7
  75. package/useInterval/useInterval.d.ts +0 -15
  76. package/useInterval/useInterval.mjs +0 -20
  77. package/useIsClient/index.d.ts +0 -1
  78. package/useIsClient/index.mjs +0 -4
  79. package/useIsClient/package.json +0 -7
  80. package/useIsClient/useIsClient.d.ts +0 -12
  81. package/useIsClient/useIsClient.mjs +0 -10
  82. package/useIsMobile/index.d.ts +0 -2
  83. package/useIsMobile/index.mjs +0 -4
  84. package/useIsMobile/package.json +0 -7
  85. package/useIsMobile/types.d.ts +0 -3
  86. package/useIsMobile/types.mjs +0 -1
  87. package/useIsMobile/useIsMobile.d.ts +0 -3
  88. package/useIsMobile/useIsMobile.mjs +0 -16
  89. package/useIsMounted/index.d.ts +0 -1
  90. package/useIsMounted/index.mjs +0 -4
  91. package/useIsMounted/package.json +0 -7
  92. package/useIsMounted/useIsMounted.d.ts +0 -1
  93. package/useIsMounted/useIsMounted.mjs +0 -10
  94. package/useIsomorphicLayoutEffect/index.d.ts +0 -1
  95. package/useIsomorphicLayoutEffect/index.mjs +0 -4
  96. package/useIsomorphicLayoutEffect/package.json +0 -7
  97. package/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +0 -16
  98. package/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs +0 -5
  99. package/useLocalStorage/index.d.ts +0 -1
  100. package/useLocalStorage/index.mjs +0 -4
  101. package/useLocalStorage/package.json +0 -7
  102. package/useLocalStorage/useLocalStorage.d.ts +0 -39
  103. package/useLocalStorage/useLocalStorage.mjs +0 -65
  104. package/useLockBody/index.d.ts +0 -1
  105. package/useLockBody/index.mjs +0 -4
  106. package/useLockBody/package.json +0 -7
  107. package/useLockBody/useLockBody.d.ts +0 -1
  108. package/useLockBody/useLockBody.mjs +0 -12
  109. package/useMap/index.d.ts +0 -1
  110. package/useMap/index.mjs +0 -4
  111. package/useMap/package.json +0 -7
  112. package/useMap/useMap.d.ts +0 -47
  113. package/useMap/useMap.mjs +0 -27
  114. package/useMediaQuery/index.d.ts +0 -1
  115. package/useMediaQuery/index.mjs +0 -4
  116. package/useMediaQuery/package.json +0 -7
  117. package/useMediaQuery/useMediaQuery.d.ts +0 -28
  118. package/useMediaQuery/useMediaQuery.mjs +0 -21
  119. package/useOnClickOutside/index.d.ts +0 -1
  120. package/useOnClickOutside/index.mjs +0 -4
  121. package/useOnClickOutside/package.json +0 -7
  122. package/useOnClickOutside/useOnClickOutside.d.ts +0 -24
  123. package/useOnClickOutside/useOnClickOutside.mjs +0 -17
  124. package/useReadLocalStorage/index.d.ts +0 -1
  125. package/useReadLocalStorage/index.mjs +0 -4
  126. package/useReadLocalStorage/package.json +0 -7
  127. package/useReadLocalStorage/useReadLocalStorage.d.ts +0 -13
  128. package/useReadLocalStorage/useReadLocalStorage.mjs +0 -48
  129. package/useResizeObserver/index.d.ts +0 -1
  130. package/useResizeObserver/index.mjs +0 -4
  131. package/useResizeObserver/package.json +0 -7
  132. package/useResizeObserver/useResizeObserver.d.ts +0 -44
  133. package/useResizeObserver/useResizeObserver.mjs +0 -31
  134. package/useScreen/index.d.ts +0 -1
  135. package/useScreen/index.mjs +0 -4
  136. package/useScreen/package.json +0 -7
  137. package/useScreen/useScreen.d.ts +0 -19
  138. package/useScreen/useScreen.mjs +0 -48
  139. package/useScript/index.d.ts +0 -1
  140. package/useScript/index.mjs +0 -4
  141. package/useScript/package.json +0 -7
  142. package/useScript/useScript.d.ts +0 -23
  143. package/useScript/useScript.mjs +0 -45
  144. package/useScrollLock/index.d.ts +0 -1
  145. package/useScrollLock/index.mjs +0 -4
  146. package/useScrollLock/package.json +0 -7
  147. package/useScrollLock/useScrollLock.d.ts +0 -53
  148. package/useScrollLock/useScrollLock.mjs +0 -26
  149. package/useSessionStorage/index.d.ts +0 -1
  150. package/useSessionStorage/index.mjs +0 -4
  151. package/useSessionStorage/package.json +0 -7
  152. package/useSessionStorage/useSessionStorage.d.ts +0 -39
  153. package/useSessionStorage/useSessionStorage.mjs +0 -65
  154. package/useStep/index.d.ts +0 -1
  155. package/useStep/index.mjs +0 -4
  156. package/useStep/package.json +0 -7
  157. package/useStep/useStep.d.ts +0 -31
  158. package/useStep/useStep.mjs +0 -34
  159. package/useTernaryDarkMode/index.d.ts +0 -1
  160. package/useTernaryDarkMode/index.mjs +0 -4
  161. package/useTernaryDarkMode/package.json +0 -7
  162. package/useTernaryDarkMode/useTernaryDarkMode.d.ts +0 -46
  163. package/useTernaryDarkMode/useTernaryDarkMode.mjs +0 -27
  164. package/useTimeout/index.d.ts +0 -1
  165. package/useTimeout/index.mjs +0 -4
  166. package/useTimeout/package.json +0 -7
  167. package/useTimeout/useTimeout.d.ts +0 -16
  168. package/useTimeout/useTimeout.mjs +0 -20
  169. package/useToggle/index.d.ts +0 -1
  170. package/useToggle/index.mjs +0 -4
  171. package/useToggle/package.json +0 -7
  172. package/useToggle/useToggle.d.ts +0 -18
  173. package/useToggle/useToggle.mjs +0 -10
  174. package/useUnmount/index.d.ts +0 -1
  175. package/useUnmount/index.mjs +0 -4
  176. package/useUnmount/package.json +0 -7
  177. package/useUnmount/useUnmount.d.ts +0 -13
  178. package/useUnmount/useUnmount.mjs +0 -13
  179. package/useWindowSize/index.d.ts +0 -1
  180. package/useWindowSize/index.mjs +0 -4
  181. package/useWindowSize/package.json +0 -7
  182. package/useWindowSize/useWindowSize.d.ts +0 -29
  183. package/useWindowSize/useWindowSize.mjs +0 -31
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Oleh Maksimenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # hooks
1
+ # @oneplatformdev/hooks
2
2
 
3
3
  This library was generated with [Nx](https://nx.dev).
4
4
 
5
5
  ## Running unit tests
6
6
 
7
- Run `nx test hooks` to execute the unit tests via [Vitest](https://vitest.dev/).
7
+ Run `nx test @oneplatformdev/hooks` to execute the unit tests via [Vitest](https://vitest.dev/).
package/index.js ADDED
@@ -0,0 +1,74 @@
1
+ import { useBoolean as r } from "./useBoolean/useBoolean.js";
2
+ import { useClickAnyWhere as u } from "./useClickAnyWhere/useClickAnyWhere.js";
3
+ import { useCopyToClipboard as p } from "./useCopyToClipboard/useCopyToClipboard.js";
4
+ import { useCountdown as f } from "./useCountdown/useCountdown.js";
5
+ import { useCounter as n } from "./useCounter/useCounter.js";
6
+ import { useDarkMode as i } from "./useDarkMode/useDarkMode.js";
7
+ import { useDebounceCallback as c } from "./useDebounceCallback/useDebounceCallback.js";
8
+ import { useDebounceValue as S } from "./useDebounceValue/useDebounceValue.js";
9
+ import { useDocumentTitle as b } from "./useDocumentTitle/useDocumentTitle.js";
10
+ import { useEventCallback as y } from "./useEventCallback/useEventCallback.js";
11
+ import { useEventListener as v } from "./useEventListener/useEventListener.js";
12
+ import { useHover as L } from "./useHover/useHover.js";
13
+ import { useIntersectionObserver as D } from "./useIntersectionObserver/useIntersectionObserver.js";
14
+ import { useInterval as O } from "./useInterval/useInterval.js";
15
+ import { useIsClient as h } from "./useIsClient/useIsClient.js";
16
+ import { useIsMobile as z } from "./useIsMobile/useIsMobile.js";
17
+ import { useIsMounted as Q } from "./useIsMounted/useIsMounted.js";
18
+ import { useIsomorphicLayoutEffect as W } from "./useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
19
+ import { useLocalStorage as H } from "./useLocalStorage/useLocalStorage.js";
20
+ import { useLockBody as V } from "./useLockBody/useLockBody.js";
21
+ import { useMap as q } from "./useMap/useMap.js";
22
+ import { useMediaQuery as G } from "./useMediaQuery/useMediaQuery.js";
23
+ import { useOnClickOutside as K } from "./useOnClickOutside/useOnClickOutside.js";
24
+ import { useReadLocalStorage as P } from "./useReadLocalStorage/useReadLocalStorage.js";
25
+ import { useResizeObserver as Y } from "./useResizeObserver/useResizeObserver.js";
26
+ import { useScreen as _ } from "./useScreen/useScreen.js";
27
+ import { useScript as ee } from "./useScript/useScript.js";
28
+ import { useScrollLock as re } from "./useScrollLock/useScrollLock.js";
29
+ import { useSessionStorage as ue } from "./useSessionStorage/useSessionStorage.js";
30
+ import { useStep as pe } from "./useStep/useStep.js";
31
+ import { useTernaryDarkMode as fe } from "./useTernaryDarkMode/useTernaryDarkMode.js";
32
+ import { useTimeout as ne } from "./useTimeout/useTimeout.js";
33
+ import { useToggle as ie } from "./useToggle/useToggle.js";
34
+ import { useUnmount as ce } from "./useUnmount/useUnmount.js";
35
+ import { useWindowSize as Se } from "./useWindowSize/useWindowSize.js";
36
+ import { useQueryString as be } from "./useQueryString/useQueryString.js";
37
+ export {
38
+ r as useBoolean,
39
+ u as useClickAnyWhere,
40
+ p as useCopyToClipboard,
41
+ f as useCountdown,
42
+ n as useCounter,
43
+ i as useDarkMode,
44
+ c as useDebounceCallback,
45
+ S as useDebounceValue,
46
+ b as useDocumentTitle,
47
+ y as useEventCallback,
48
+ v as useEventListener,
49
+ L as useHover,
50
+ D as useIntersectionObserver,
51
+ O as useInterval,
52
+ h as useIsClient,
53
+ z as useIsMobile,
54
+ Q as useIsMounted,
55
+ W as useIsomorphicLayoutEffect,
56
+ H as useLocalStorage,
57
+ V as useLockBody,
58
+ q as useMap,
59
+ G as useMediaQuery,
60
+ K as useOnClickOutside,
61
+ be as useQueryString,
62
+ P as useReadLocalStorage,
63
+ Y as useResizeObserver,
64
+ _ as useScreen,
65
+ ee as useScript,
66
+ re as useScrollLock,
67
+ ue as useSessionStorage,
68
+ pe as useStep,
69
+ fe as useTernaryDarkMode,
70
+ ne as useTimeout,
71
+ ie as useToggle,
72
+ ce as useUnmount,
73
+ Se as useWindowSize
74
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneplatformdev/hooks",
3
- "version": "0.0.1-beta.7",
3
+ "version": "0.1.0-11",
4
4
  "description": "React hook library",
5
5
  "author": "One Platform Development Team",
6
6
  "keywords": [
@@ -18,21 +18,43 @@
18
18
  "url": "https://github.com/oneplatformdev/core/issues"
19
19
  },
20
20
  "homepage": "private package",
21
+ "private": false,
22
+ "license": "MIT",
21
23
  "type": "module",
22
- "source": "./index.ts",
23
- "main": "./index.mjs",
24
- "module": "./index.mjs",
25
- "default": "./index.mjs",
24
+ "main": "./index.js",
25
+ "module": "./index.js",
26
26
  "types": "./index.d.ts",
27
- "sideEffects": false,
27
+ "exports": {
28
+ "./package.json": "./package.json",
29
+ ".": {
30
+ "@oneplatformdev/source": "./src/index.ts",
31
+ "types": "./index.d.ts",
32
+ "import": "./index.js",
33
+ "default": "./index.js"
34
+ },
35
+ "./*": {
36
+ "types": "./*.d.ts",
37
+ "import": "./*.js",
38
+ "default": "./*.js"
39
+ }
40
+ },
28
41
  "publishConfig": {
29
- "directory": "build",
30
- "registry": "https://registry.npmjs.org/"
42
+ "directory": "dist"
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "README.md",
47
+ "LICENSE",
48
+ "package.json",
49
+ "!**/*.tsbuildinfo"
50
+ ],
51
+ "dependencies": {
52
+ "lodash.debounce": "^4.0.8"
31
53
  },
32
- "peerDependency": {
33
- "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
34
- "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
35
- "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
54
+ "peerDependencies": {
55
+ "react": ">=18",
56
+ "react-dom": ">=18",
57
+ "@types/react": ">=18",
36
58
  "@types/lodash.debounce": "^4.0.9"
37
59
  },
38
60
  "peerDependenciesMeta": {
@@ -45,8 +67,5 @@
45
67
  "@types/lodash.debounce": {
46
68
  "optional": true
47
69
  }
48
- },
49
- "dependencies": {
50
- "lodash.debounce": "^4.0.8"
51
70
  }
52
- }
71
+ }
package/index.d.ts DELETED
@@ -1,35 +0,0 @@
1
- export * from './useBoolean';
2
- export * from './useClickAnyWhere';
3
- export * from './useCopyToClipboard';
4
- export * from './useCountdown';
5
- export * from './useCounter';
6
- export * from './useDarkMode';
7
- export * from './useDebounceCallback';
8
- export * from './useDebounceValue';
9
- export * from './useDocumentTitle';
10
- export * from './useEventCallback';
11
- export * from './useEventListener';
12
- export * from './useHover';
13
- export * from './useIntersectionObserver';
14
- export * from './useInterval';
15
- export * from './useIsClient';
16
- export * from './useIsMobile';
17
- export * from './useIsMounted';
18
- export * from './useIsomorphicLayoutEffect';
19
- export * from './useLocalStorage';
20
- export * from './useLockBody';
21
- export * from './useMap';
22
- export * from './useMediaQuery';
23
- export * from './useOnClickOutside';
24
- export * from './useReadLocalStorage';
25
- export * from './useResizeObserver';
26
- export * from './useScreen';
27
- export * from './useScript';
28
- export * from './useScrollLock';
29
- export * from './useSessionStorage';
30
- export * from './useStep';
31
- export * from './useTernaryDarkMode';
32
- export * from './useTimeout';
33
- export * from './useToggle';
34
- export * from './useUnmount';
35
- export * from './useWindowSize';
package/index.mjs DELETED
@@ -1,72 +0,0 @@
1
- import { useBoolean as r } from "./useBoolean/useBoolean.mjs";
2
- import { useClickAnyWhere as s } from "./useClickAnyWhere/useClickAnyWhere.mjs";
3
- import { useCopyToClipboard as p } from "./useCopyToClipboard/useCopyToClipboard.mjs";
4
- import { useCountdown as f } from "./useCountdown/useCountdown.mjs";
5
- import { useCounter as n } from "./useCounter/useCounter.mjs";
6
- import { useDarkMode as l } from "./useDarkMode/useDarkMode.mjs";
7
- import { useDebounceCallback as i } from "./useDebounceCallback/useDebounceCallback.mjs";
8
- import { useDebounceValue as C } from "./useDebounceValue/useDebounceValue.mjs";
9
- import { useDocumentTitle as b } from "./useDocumentTitle/useDocumentTitle.mjs";
10
- import { useEventCallback as v } from "./useEventCallback/useEventCallback.mjs";
11
- import { useEventListener as I } from "./useEventListener/useEventListener.mjs";
12
- import { useHover as M } from "./useHover/useHover.mjs";
13
- import { useIntersectionObserver as D } from "./useIntersectionObserver/useIntersectionObserver.mjs";
14
- import { useInterval as O } from "./useInterval/useInterval.mjs";
15
- import { useIsClient as h } from "./useIsClient/useIsClient.mjs";
16
- import { useIsMobile as z } from "./useIsMobile/useIsMobile.mjs";
17
- import { useIsMounted as R } from "./useIsMounted/useIsMounted.mjs";
18
- import { useIsomorphicLayoutEffect as A } from "./useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
19
- import { useLocalStorage as Q } from "./useLocalStorage/useLocalStorage.mjs";
20
- import { useLockBody as V } from "./useLockBody/useLockBody.mjs";
21
- import { useMap as q } from "./useMap/useMap.mjs";
22
- import { useMediaQuery as G } from "./useMediaQuery/useMediaQuery.mjs";
23
- import { useOnClickOutside as K } from "./useOnClickOutside/useOnClickOutside.mjs";
24
- import { useReadLocalStorage as P } from "./useReadLocalStorage/useReadLocalStorage.mjs";
25
- import { useResizeObserver as Y } from "./useResizeObserver/useResizeObserver.mjs";
26
- import { useScreen as _ } from "./useScreen/useScreen.mjs";
27
- import { useScript as ee } from "./useScript/useScript.mjs";
28
- import { useScrollLock as re } from "./useScrollLock/useScrollLock.mjs";
29
- import { useSessionStorage as se } from "./useSessionStorage/useSessionStorage.mjs";
30
- import { useStep as pe } from "./useStep/useStep.mjs";
31
- import { useTernaryDarkMode as fe } from "./useTernaryDarkMode/useTernaryDarkMode.mjs";
32
- import { useTimeout as ne } from "./useTimeout/useTimeout.mjs";
33
- import { useToggle as le } from "./useToggle/useToggle.mjs";
34
- import { useUnmount as ie } from "./useUnmount/useUnmount.mjs";
35
- import { useWindowSize as Ce } from "./useWindowSize/useWindowSize.mjs";
36
- export {
37
- r as useBoolean,
38
- s as useClickAnyWhere,
39
- p as useCopyToClipboard,
40
- f as useCountdown,
41
- n as useCounter,
42
- l as useDarkMode,
43
- i as useDebounceCallback,
44
- C as useDebounceValue,
45
- b as useDocumentTitle,
46
- v as useEventCallback,
47
- I as useEventListener,
48
- M as useHover,
49
- D as useIntersectionObserver,
50
- O as useInterval,
51
- h as useIsClient,
52
- z as useIsMobile,
53
- R as useIsMounted,
54
- A as useIsomorphicLayoutEffect,
55
- Q as useLocalStorage,
56
- V as useLockBody,
57
- q as useMap,
58
- G as useMediaQuery,
59
- K as useOnClickOutside,
60
- P as useReadLocalStorage,
61
- Y as useResizeObserver,
62
- _ as useScreen,
63
- ee as useScript,
64
- re as useScrollLock,
65
- se as useSessionStorage,
66
- pe as useStep,
67
- fe as useTernaryDarkMode,
68
- ne as useTimeout,
69
- le as useToggle,
70
- ie as useUnmount,
71
- Ce as useWindowSize
72
- };
@@ -1 +0,0 @@
1
- export * from './useBoolean';
@@ -1,4 +0,0 @@
1
- import { useBoolean as r } from "./useBoolean.mjs";
2
- export {
3
- r as useBoolean
4
- };
@@ -1,7 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "main": "./index.mjs",
4
- "module": "./index.mjs",
5
- "default": "./index.mjs",
6
- "types": "./index.d.ts"
7
- }
@@ -1,29 +0,0 @@
1
- import { Dispatch, SetStateAction } from 'react';
2
-
3
- /** The useBoolean return type. */
4
- type UseBooleanReturn = {
5
- /** The current boolean state value. */
6
- value: boolean;
7
- /** Function to set the boolean state directly. */
8
- setValue: Dispatch<SetStateAction<boolean>>;
9
- /** Function to set the boolean state to `true`. */
10
- setTrue: () => void;
11
- /** Function to set the boolean state to `false`. */
12
- setFalse: () => void;
13
- /** Function to toggle the boolean state. */
14
- toggle: () => void;
15
- };
16
- /**
17
- * Custom hook that handles boolean state with useful utility functions.
18
- * @param {boolean} [defaultValue] - The initial value for the boolean state (default is `false`).
19
- * @returns {UseBooleanReturn} An object containing the boolean state value and utility functions to manipulate the state.
20
- * @throws Will throw an error if `defaultValue` is an invalid boolean value.
21
- * @public
22
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-boolean)
23
- * @example
24
- * ```tsx
25
- * const { value, setTrue, setFalse, toggle } = useBoolean(true);
26
- * ```
27
- */
28
- export declare function useBoolean(defaultValue?: boolean): UseBooleanReturn;
29
- export {};
@@ -1,16 +0,0 @@
1
- import { useState as n, useCallback as t } from "react";
2
- function c(o = !1) {
3
- if (typeof o != "boolean")
4
- throw new Error("defaultValue must be `true` or `false`");
5
- const [s, e] = n(o), r = t(() => {
6
- e(!0);
7
- }, []), a = t(() => {
8
- e(!1);
9
- }, []), l = t(() => {
10
- e((u) => !u);
11
- }, []);
12
- return { value: s, setValue: e, setTrue: r, setFalse: a, toggle: l };
13
- }
14
- export {
15
- c as useBoolean
16
- };
@@ -1 +0,0 @@
1
- export * from './useClickAnyWhere';
@@ -1,4 +0,0 @@
1
- import { useClickAnyWhere as o } from "./useClickAnyWhere.mjs";
2
- export {
3
- o as useClickAnyWhere
4
- };
@@ -1,7 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "main": "./index.mjs",
4
- "module": "./index.mjs",
5
- "default": "./index.mjs",
6
- "types": "./index.d.ts"
7
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Custom hook that handles click events anywhere on the document.
3
- * @param {Function} handler - The function to be called when a click event is detected anywhere on the document.
4
- * @public
5
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-click-any-where)
6
- * @example
7
- * ```tsx
8
- * const handleClick = (event) => {
9
- * console.log('Document clicked!', event);
10
- * };
11
- *
12
- * // Attach click event handler to document
13
- * useClickAnywhere(handleClick);
14
- * ```
15
- */
16
- export declare function useClickAnyWhere(handler: (event: MouseEvent) => void): void;
@@ -1,9 +0,0 @@
1
- import { useEventListener as n } from "../useEventListener/useEventListener.mjs";
2
- function t(e) {
3
- n("click", (i) => {
4
- e(i);
5
- });
6
- }
7
- export {
8
- t as useClickAnyWhere
9
- };
@@ -1 +0,0 @@
1
- export * from './useCopyToClipboard';
@@ -1,4 +0,0 @@
1
- import { useCopyToClipboard as r } from "./useCopyToClipboard.mjs";
2
- export {
3
- r as useCopyToClipboard
4
- };
@@ -1,7 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "main": "./index.mjs",
4
- "module": "./index.mjs",
5
- "default": "./index.mjs",
6
- "types": "./index.d.ts"
7
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * The copied text as `string` or `null` if nothing has been copied yet.
3
- */
4
- type CopiedValue = string | null;
5
- /**
6
- * Function to copy text to the clipboard.
7
- * @param text - The text to copy to the clipboard.
8
- * @returns {Promise<boolean>} A promise that resolves to `true` if the text was copied successfully, or `false` otherwise.
9
- */
10
- type CopyFn = (text: string) => Promise<boolean>;
11
- /**
12
- * Custom hook that copies text to the clipboard using the [`Clipboard API`](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API).
13
- * @returns {[CopiedValue, CopyFn]} An tuple containing the copied text and a function to copy text to the clipboard.
14
- * @public
15
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-copy-to-clipboard)
16
- * @example
17
- * ```tsx
18
- * const [copiedText, copyToClipboard] = useCopyToClipboard();
19
- * const textToCopy = 'Hello, world!';
20
- *
21
- * // Attempt to copy text to the clipboard
22
- * copyToClipboard(textToCopy)
23
- * .then(success => {
24
- * if (success) {
25
- * console.log(`Text "${textToCopy}" copied to clipboard successfully.`);
26
- * } else {
27
- * console.error('Failed to copy text to clipboard.');
28
- * }
29
- * });
30
- * ```
31
- */
32
- export declare function useCopyToClipboard(): [CopiedValue, CopyFn];
33
- export {};
@@ -1,16 +0,0 @@
1
- import { useState as n, useCallback as l } from "react";
2
- function c() {
3
- const [e, r] = n(null), t = l(async (o) => {
4
- if (!(navigator != null && navigator.clipboard))
5
- return console.warn("Clipboard not supported"), !1;
6
- try {
7
- return await navigator.clipboard.writeText(o), r(o), !0;
8
- } catch (a) {
9
- return console.warn("Copy failed", a), r(null), !1;
10
- }
11
- }, []);
12
- return [e, t];
13
- }
14
- export {
15
- c as useCopyToClipboard
16
- };
@@ -1 +0,0 @@
1
- export * from './useCountdown';
@@ -1,4 +0,0 @@
1
- import { useCountdown as n } from "./useCountdown.mjs";
2
- export {
3
- n as useCountdown
4
- };
@@ -1,7 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "main": "./index.mjs",
4
- "module": "./index.mjs",
5
- "default": "./index.mjs",
6
- "types": "./index.d.ts"
7
- }
@@ -1,46 +0,0 @@
1
- /** The countdown's options. */
2
- type CountdownOptions = {
3
- /** The countdown's starting number, initial value of the returned number. */
4
- countStart: number;
5
- /**
6
- * The countdown's interval, in milliseconds.
7
- * @default 1000
8
- */
9
- intervalMs?: number;
10
- /**
11
- * True if the countdown is increment.
12
- * @default false
13
- */
14
- isIncrement?: boolean;
15
- /**
16
- * The countdown's stopping number. Pass `-Infinity` to decrease forever.
17
- * @default 0
18
- */
19
- countStop?: number;
20
- };
21
- /** The countdown's controllers. */
22
- type CountdownControllers = {
23
- /** Start the countdown. */
24
- startCountdown: () => void;
25
- /** Stop the countdown. */
26
- stopCountdown: () => void;
27
- /** Reset the countdown. */
28
- resetCountdown: () => void;
29
- };
30
- /**
31
- * Custom hook that manages countdown.
32
- * @param {CountdownOptions} countdownOptions - The countdown's options.
33
- * @returns {[number, CountdownControllers]} An array containing the countdown's count and its controllers.
34
- * @public
35
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-countdown)
36
- * @example
37
- * ```tsx
38
- * const [counter, { start, stop, reset }] = useCountdown({
39
- * countStart: 10,
40
- * intervalMs: 1000,
41
- * isIncrement: false,
42
- * });
43
- * ```
44
- */
45
- export declare function useCountdown({ countStart, countStop, intervalMs, isIncrement, }: CountdownOptions): [number, CountdownControllers];
46
- export {};
@@ -1,33 +0,0 @@
1
- import { useCallback as l } from "react";
2
- import { useBoolean as d } from "../useBoolean/useBoolean.mjs";
3
- import { useCounter as w } from "../useCounter/useCounter.mjs";
4
- import { useInterval as p } from "../useInterval/useInterval.mjs";
5
- function x({
6
- countStart: a,
7
- countStop: n = 0,
8
- intervalMs: c = 1e3,
9
- isIncrement: t = !1
10
- }) {
11
- const {
12
- count: o,
13
- increment: r,
14
- decrement: s,
15
- reset: u
16
- } = w(a), {
17
- value: f,
18
- setTrue: i,
19
- setFalse: e
20
- } = d(!1), m = l(() => {
21
- e(), u();
22
- }, [e, u]), C = l(() => {
23
- if (o === n) {
24
- e();
25
- return;
26
- }
27
- t ? r() : s();
28
- }, [o, n, s, r, t, e]);
29
- return p(C, f ? c : null), [o, { startCountdown: i, stopCountdown: e, resetCountdown: m }];
30
- }
31
- export {
32
- x as useCountdown
33
- };
@@ -1 +0,0 @@
1
- export * from './useCounter';
@@ -1,4 +0,0 @@
1
- import { useCounter as r } from "./useCounter.mjs";
2
- export {
3
- r as useCounter
4
- };
@@ -1,7 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "main": "./index.mjs",
4
- "module": "./index.mjs",
5
- "default": "./index.mjs",
6
- "types": "./index.d.ts"
7
- }
@@ -1,28 +0,0 @@
1
- import { Dispatch, SetStateAction } from 'react';
2
-
3
- /** The hook return type. */
4
- type UseCounterReturn = {
5
- /** The current count value. */
6
- count: number;
7
- /** Function to increment the counter by 1. */
8
- increment: () => void;
9
- /** Function to decrement the counter by 1. */
10
- decrement: () => void;
11
- /** Function to reset the counter to its initial value. */
12
- reset: () => void;
13
- /** Function to set a specific value to the counter. */
14
- setCount: Dispatch<SetStateAction<number>>;
15
- };
16
- /**
17
- * Custom hook that manages a counter with increment, decrement, reset, and setCount functionalities.
18
- * @param {number} [initialValue] - The initial value for the counter.
19
- * @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter.
20
- * @public
21
- * @see [Documentation](https://usehooks-ts.com/react-hook/use-counter)
22
- * @example
23
- * ```tsx
24
- * const { count, increment, decrement, reset, setCount } = useCounter(5);
25
- * ```
26
- */
27
- export declare function useCounter(initialValue?: number): UseCounterReturn;
28
- export {};
@@ -1,20 +0,0 @@
1
- import { useState as m, useCallback as o } from "react";
2
- function f(e) {
3
- const [c, t] = m(e ?? 0), r = o(() => {
4
- t((n) => n + 1);
5
- }, []), s = o(() => {
6
- t((n) => n - 1);
7
- }, []), u = o(() => {
8
- t(e ?? 0);
9
- }, [e]);
10
- return {
11
- count: c,
12
- increment: r,
13
- decrement: s,
14
- reset: u,
15
- setCount: t
16
- };
17
- }
18
- export {
19
- f as useCounter
20
- };
@@ -1 +0,0 @@
1
- export * from './useDarkMode';
@@ -1,4 +0,0 @@
1
- import { useDarkMode as r } from "./useDarkMode.mjs";
2
- export {
3
- r as useDarkMode
4
- };
@@ -1,7 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "main": "./index.mjs",
4
- "module": "./index.mjs",
5
- "default": "./index.mjs",
6
- "types": "./index.d.ts"
7
- }