@siberiacancode/reactuse 0.0.43 → 0.0.45

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 (262) hide show
  1. package/dist/cjs/{_rollupPluginBabelHelpers-BRE4VASD.js → _rollupPluginBabelHelpers-Cgdvu90u.js} +2 -2
  2. package/dist/cjs/_rollupPluginBabelHelpers-Cgdvu90u.js.map +1 -0
  3. package/dist/cjs/hooks/index.js +2 -2
  4. package/dist/cjs/hooks/useBattery/useBattery.js +2 -2
  5. package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
  6. package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
  7. package/dist/cjs/hooks/useClickOutside/useClickOutside.js +2 -2
  8. package/dist/cjs/hooks/useClickOutside/useClickOutside.js.map +1 -1
  9. package/dist/cjs/hooks/useClipboard/useClipboard.js +3 -0
  10. package/dist/cjs/hooks/useClipboard/useClipboard.js.map +1 -0
  11. package/dist/cjs/hooks/useCounter/useCounter.js +2 -2
  12. package/dist/cjs/hooks/useCounter/useCounter.js.map +1 -1
  13. package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
  14. package/dist/cjs/hooks/useDebounceValue/useDebounceValue.js +2 -2
  15. package/dist/cjs/hooks/useDefault/useDefault.js +2 -2
  16. package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js +1 -1
  17. package/dist/cjs/hooks/useDisclosure/useDisclosure.js +2 -2
  18. package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
  19. package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js.map +1 -1
  20. package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  21. package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  22. package/dist/cjs/hooks/useEvent/useEvent.js +2 -2
  23. package/dist/cjs/hooks/useEvent/useEvent.js.map +1 -1
  24. package/dist/cjs/hooks/useEventListener/useEventListener.js +2 -2
  25. package/dist/cjs/hooks/useEventListener/useEventListener.js.map +1 -1
  26. package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js +2 -2
  27. package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
  28. package/dist/cjs/hooks/useField/useField.js +2 -2
  29. package/dist/cjs/hooks/useFileDialog/useFileDialog.js +3 -0
  30. package/dist/cjs/hooks/useFileDialog/useFileDialog.js.map +1 -0
  31. package/dist/cjs/hooks/useFps/useFps.js +2 -2
  32. package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
  33. package/dist/cjs/hooks/useFullscreen/useFullscreen.js.map +1 -1
  34. package/dist/cjs/hooks/useGeolocation/useGeolocation.js +2 -2
  35. package/dist/cjs/hooks/useHash/useHash.js +2 -2
  36. package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
  37. package/dist/cjs/hooks/useHover/useHover.js +2 -2
  38. package/dist/cjs/hooks/useHover/useHover.js.map +1 -1
  39. package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
  40. package/dist/cjs/hooks/useImage/useImage.js +3 -0
  41. package/dist/cjs/hooks/useImage/useImage.js.map +1 -0
  42. package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  43. package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
  44. package/dist/cjs/hooks/useInterval/useInterval.js +2 -2
  45. package/dist/cjs/hooks/useInterval/useInterval.js.map +1 -1
  46. package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  47. package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  48. package/dist/cjs/hooks/useKeyPress/useKeyPress.js +2 -2
  49. package/dist/cjs/hooks/useKeyPress/useKeyPress.js.map +1 -1
  50. package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
  51. package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js.map +1 -1
  52. package/dist/cjs/hooks/useKeyboard/useKeyboard.js +2 -2
  53. package/dist/cjs/hooks/useKeyboard/useKeyboard.js.map +1 -1
  54. package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
  55. package/dist/cjs/hooks/useList/useList.js +2 -2
  56. package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
  57. package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
  58. package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
  59. package/dist/cjs/hooks/useLongPress/useLongPress.js.map +1 -1
  60. package/dist/cjs/hooks/useMap/useMap.js +2 -2
  61. package/dist/cjs/hooks/useMeasure/useMeasure.js +3 -0
  62. package/dist/cjs/hooks/useMeasure/useMeasure.js.map +1 -0
  63. package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
  64. package/dist/cjs/hooks/useMemory/useMemory.js +2 -2
  65. package/dist/cjs/hooks/useMemory/useMemory.js.map +1 -1
  66. package/dist/cjs/hooks/useMount/useMount.js +1 -1
  67. package/dist/cjs/hooks/useMouse/useMouse.js +2 -2
  68. package/dist/cjs/hooks/useMutation/useMutation.js +2 -2
  69. package/dist/cjs/hooks/useMutationObserver.js +1 -1
  70. package/dist/cjs/hooks/useNetwork/useNetwork.js +2 -2
  71. package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
  72. package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
  73. package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
  74. package/dist/cjs/hooks/usePageLeave/usePageLeave.js +2 -2
  75. package/dist/cjs/hooks/usePageLeave/usePageLeave.js.map +1 -1
  76. package/dist/cjs/hooks/usePaint/helpers/Paint.js +2 -2
  77. package/dist/cjs/hooks/usePaint/helpers/Pointer.js +2 -2
  78. package/dist/cjs/hooks/usePaint/usePaint.js +2 -2
  79. package/dist/cjs/hooks/usePaint/usePaint.js.map +1 -1
  80. package/dist/cjs/hooks/usePermission/usePermission.js +2 -2
  81. package/dist/cjs/hooks/usePermission/usePermission.js.map +1 -1
  82. package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
  83. package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
  84. package/dist/cjs/hooks/usePrevious/usePrevious.js +1 -1
  85. package/dist/cjs/hooks/useQuery/useQuery.js +2 -2
  86. package/dist/cjs/hooks/useQuery/useQuery.js.map +1 -1
  87. package/dist/cjs/hooks/useQueue/useQueue.js +2 -2
  88. package/dist/cjs/hooks/useRenderCount/useRenderCount.js +1 -1
  89. package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js +1 -1
  90. package/dist/cjs/hooks/useRerender/useRerender.js +2 -2
  91. package/dist/cjs/hooks/useResizeObserver/useResizeObserver.js +3 -0
  92. package/dist/cjs/hooks/useResizeObserver/useResizeObserver.js.map +1 -0
  93. package/dist/cjs/hooks/useScript/useScript.js +2 -2
  94. package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
  95. package/dist/cjs/hooks/useSet/useSet.js +2 -2
  96. package/dist/cjs/hooks/useShare/useShare.js +2 -2
  97. package/dist/cjs/hooks/useStep/useStep.js +2 -2
  98. package/dist/cjs/hooks/useStopwatch/useStopwatch.js +3 -0
  99. package/dist/cjs/hooks/useStopwatch/useStopwatch.js.map +1 -0
  100. package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
  101. package/dist/cjs/hooks/useTextSelection/useTextSelection.js +2 -2
  102. package/dist/cjs/hooks/useTime/useTime.js +2 -2
  103. package/dist/cjs/hooks/useTime/useTime.js.map +1 -1
  104. package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
  105. package/dist/cjs/hooks/useTimeout/useTimeout.js.map +1 -1
  106. package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
  107. package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
  108. package/dist/cjs/hooks/useUnmount/useUnmount.js.map +1 -1
  109. package/dist/cjs/hooks/useWebSocket/useWebSocket.js +2 -2
  110. package/dist/cjs/hooks/useWebSocket/useWebSocket.js.map +1 -1
  111. package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +2 -2
  112. package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js.map +1 -1
  113. package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
  114. package/dist/cjs/hooks/useWizard/useWizard.js +2 -2
  115. package/dist/cjs/index-CzItxmKR.js +3 -0
  116. package/dist/cjs/index-CzItxmKR.js.map +1 -0
  117. package/dist/cjs/index.js +2 -2
  118. package/dist/cjs/utils/helpers/debounce.js +1 -1
  119. package/dist/cjs/utils/helpers/getRetry.js +1 -1
  120. package/dist/cjs/utils/helpers/index.js +2 -2
  121. package/dist/cjs/utils/helpers/isClient.js +1 -1
  122. package/dist/cjs/utils/helpers/isPermissionAllowed.js +3 -0
  123. package/dist/cjs/utils/helpers/isPermissionAllowed.js.map +1 -0
  124. package/dist/cjs/utils/helpers/throttle.js +1 -1
  125. package/dist/cjs/utils/helpers/time/getDate.js +1 -1
  126. package/dist/cjs/utils/types/index.js +1 -1
  127. package/dist/esm/{_rollupPluginBabelHelpers-q3sUYXUv.js → _rollupPluginBabelHelpers-1nJS3N_r.js} +3 -3
  128. package/dist/esm/_rollupPluginBabelHelpers-1nJS3N_r.js.map +1 -0
  129. package/dist/esm/hooks/index.js +2 -2
  130. package/dist/esm/hooks/useBattery/useBattery.js +2 -2
  131. package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
  132. package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
  133. package/dist/esm/hooks/useClickOutside/useClickOutside.js +2 -2
  134. package/dist/esm/hooks/useClickOutside/useClickOutside.js.map +1 -1
  135. package/dist/esm/hooks/useClipboard/useClipboard.js +3 -0
  136. package/dist/esm/hooks/useClipboard/useClipboard.js.map +1 -0
  137. package/dist/esm/hooks/useCounter/useCounter.js +2 -2
  138. package/dist/esm/hooks/useCounter/useCounter.js.map +1 -1
  139. package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
  140. package/dist/esm/hooks/useDebounceValue/useDebounceValue.js +2 -2
  141. package/dist/esm/hooks/useDefault/useDefault.js +2 -2
  142. package/dist/esm/hooks/useDidUpdate/useDidUpdate.js +1 -1
  143. package/dist/esm/hooks/useDisclosure/useDisclosure.js +2 -2
  144. package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js +2 -2
  145. package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js.map +1 -1
  146. package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  147. package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  148. package/dist/esm/hooks/useEvent/useEvent.js +2 -2
  149. package/dist/esm/hooks/useEvent/useEvent.js.map +1 -1
  150. package/dist/esm/hooks/useEventListener/useEventListener.js +2 -2
  151. package/dist/esm/hooks/useEventListener/useEventListener.js.map +1 -1
  152. package/dist/esm/hooks/useEyeDropper/useEyeDropper.js +2 -2
  153. package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
  154. package/dist/esm/hooks/useField/useField.js +2 -2
  155. package/dist/esm/hooks/useFileDialog/useFileDialog.js +3 -0
  156. package/dist/esm/hooks/useFileDialog/useFileDialog.js.map +1 -0
  157. package/dist/esm/hooks/useFps/useFps.js +2 -2
  158. package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
  159. package/dist/esm/hooks/useFullscreen/useFullscreen.js.map +1 -1
  160. package/dist/esm/hooks/useGeolocation/useGeolocation.js +2 -2
  161. package/dist/esm/hooks/useHash/useHash.js +2 -2
  162. package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
  163. package/dist/esm/hooks/useHover/useHover.js +2 -2
  164. package/dist/esm/hooks/useHover/useHover.js.map +1 -1
  165. package/dist/esm/hooks/useIdle/useIdle.js +2 -2
  166. package/dist/esm/hooks/useImage/useImage.js +3 -0
  167. package/dist/esm/hooks/useImage/useImage.js.map +1 -0
  168. package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  169. package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
  170. package/dist/esm/hooks/useInterval/useInterval.js +2 -2
  171. package/dist/esm/hooks/useInterval/useInterval.js.map +1 -1
  172. package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  173. package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  174. package/dist/esm/hooks/useKeyPress/useKeyPress.js +2 -2
  175. package/dist/esm/hooks/useKeyPress/useKeyPress.js.map +1 -1
  176. package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js +2 -2
  177. package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js.map +1 -1
  178. package/dist/esm/hooks/useKeyboard/useKeyboard.js +2 -2
  179. package/dist/esm/hooks/useKeyboard/useKeyboard.js.map +1 -1
  180. package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
  181. package/dist/esm/hooks/useList/useList.js +2 -2
  182. package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
  183. package/dist/esm/hooks/useLogger/useLogger.js +2 -2
  184. package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
  185. package/dist/esm/hooks/useLongPress/useLongPress.js.map +1 -1
  186. package/dist/esm/hooks/useMap/useMap.js +2 -2
  187. package/dist/esm/hooks/useMeasure/useMeasure.js +3 -0
  188. package/dist/esm/hooks/useMeasure/useMeasure.js.map +1 -0
  189. package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +1 -1
  190. package/dist/esm/hooks/useMemory/useMemory.js +2 -2
  191. package/dist/esm/hooks/useMemory/useMemory.js.map +1 -1
  192. package/dist/esm/hooks/useMount/useMount.js +1 -1
  193. package/dist/esm/hooks/useMouse/useMouse.js +2 -2
  194. package/dist/esm/hooks/useMutation/useMutation.js +2 -2
  195. package/dist/esm/hooks/useMutationObserver.js +1 -1
  196. package/dist/esm/hooks/useNetwork/useNetwork.js +2 -2
  197. package/dist/esm/hooks/useOnline/useOnline.js +1 -1
  198. package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
  199. package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
  200. package/dist/esm/hooks/usePageLeave/usePageLeave.js +2 -2
  201. package/dist/esm/hooks/usePageLeave/usePageLeave.js.map +1 -1
  202. package/dist/esm/hooks/usePaint/helpers/Paint.js +2 -2
  203. package/dist/esm/hooks/usePaint/helpers/Pointer.js +2 -2
  204. package/dist/esm/hooks/usePaint/usePaint.js +2 -2
  205. package/dist/esm/hooks/usePaint/usePaint.js.map +1 -1
  206. package/dist/esm/hooks/usePermission/usePermission.js +2 -2
  207. package/dist/esm/hooks/usePermission/usePermission.js.map +1 -1
  208. package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
  209. package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
  210. package/dist/esm/hooks/usePrevious/usePrevious.js +1 -1
  211. package/dist/esm/hooks/useQuery/useQuery.js +2 -2
  212. package/dist/esm/hooks/useQuery/useQuery.js.map +1 -1
  213. package/dist/esm/hooks/useQueue/useQueue.js +2 -2
  214. package/dist/esm/hooks/useRenderCount/useRenderCount.js +1 -1
  215. package/dist/esm/hooks/useRenderInfo/useRenderInfo.js +1 -1
  216. package/dist/esm/hooks/useRerender/useRerender.js +2 -2
  217. package/dist/esm/hooks/useResizeObserver/useResizeObserver.js +3 -0
  218. package/dist/esm/hooks/useResizeObserver/useResizeObserver.js.map +1 -0
  219. package/dist/esm/hooks/useScript/useScript.js +2 -2
  220. package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
  221. package/dist/esm/hooks/useSessionStorage/useSessionStorage.js.map +1 -1
  222. package/dist/esm/hooks/useSet/useSet.js +2 -2
  223. package/dist/esm/hooks/useShare/useShare.js +2 -2
  224. package/dist/esm/hooks/useShare/useShare.js.map +1 -1
  225. package/dist/esm/hooks/useStep/useStep.js +2 -2
  226. package/dist/esm/hooks/useStopwatch/useStopwatch.js +3 -0
  227. package/dist/esm/hooks/useStopwatch/useStopwatch.js.map +1 -0
  228. package/dist/esm/hooks/useStorage/useStorage.js +2 -2
  229. package/dist/esm/hooks/useTextSelection/useTextSelection.js +2 -2
  230. package/dist/esm/hooks/useTime/useTime.js +2 -2
  231. package/dist/esm/hooks/useTime/useTime.js.map +1 -1
  232. package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
  233. package/dist/esm/hooks/useTimeout/useTimeout.js.map +1 -1
  234. package/dist/esm/hooks/useToggle/useToggle.js +2 -2
  235. package/dist/esm/hooks/useUnmount/useUnmount.js +1 -1
  236. package/dist/esm/hooks/useUnmount/useUnmount.js.map +1 -1
  237. package/dist/esm/hooks/useWebSocket/useWebSocket.js +2 -2
  238. package/dist/esm/hooks/useWebSocket/useWebSocket.js.map +1 -1
  239. package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +2 -2
  240. package/dist/esm/hooks/useWindowEvent/useWindowEvent.js.map +1 -1
  241. package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
  242. package/dist/esm/hooks/useWizard/useWizard.js +2 -2
  243. package/dist/esm/index-Bk2X3AFm.js +3 -0
  244. package/dist/esm/index-Bk2X3AFm.js.map +1 -0
  245. package/dist/esm/index.js +2 -2
  246. package/dist/esm/utils/helpers/debounce.js +1 -1
  247. package/dist/esm/utils/helpers/getRetry.js +1 -1
  248. package/dist/esm/utils/helpers/index.js +2 -2
  249. package/dist/esm/utils/helpers/isClient.js +1 -1
  250. package/dist/esm/utils/helpers/isPermissionAllowed.js +3 -0
  251. package/dist/esm/utils/helpers/isPermissionAllowed.js.map +1 -0
  252. package/dist/esm/utils/helpers/throttle.js +1 -1
  253. package/dist/esm/utils/helpers/time/getDate.js +1 -1
  254. package/dist/esm/utils/types/index.js +1 -1
  255. package/dist/index.d.ts +346 -58
  256. package/package.json +1 -1
  257. package/dist/cjs/_rollupPluginBabelHelpers-BRE4VASD.js.map +0 -1
  258. package/dist/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js +0 -3
  259. package/dist/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js.map +0 -1
  260. package/dist/esm/_rollupPluginBabelHelpers-q3sUYXUv.js.map +0 -1
  261. package/dist/esm/hooks/useCopyToClipboard/useCopyToClipboard.js +0 -3
  262. package/dist/esm/hooks/useCopyToClipboard/useCopyToClipboard.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BatteryManager, EyeDropperConstructor, ColorSelectionOptions, ColorSelectionResult, Connection } from '@/utils/types';
2
2
  import * as react from 'react';
3
- import { RefObject, Dispatch, SetStateAction, EffectCallback, DependencyList, useEffect, ComponentProps } from 'react';
3
+ import { RefObject, Dispatch, SetStateAction, EffectCallback, DependencyList, ComponentProps, useEffect } from 'react';
4
4
 
5
5
  declare global {
6
6
  interface Navigator {
@@ -68,11 +68,9 @@ declare const useBrowserLanguage: () => string;
68
68
 
69
69
  /** The use click outside target element type */
70
70
  type UseClickOutsideTarget = RefObject<Element | null> | (() => Element) | Element;
71
- /** The use click outside return type */
72
- type UseClickOutsideReturn<Target extends UseClickOutsideTarget | UseClickOutsideTarget[]> = RefObject<Target>;
73
71
  type UseClickOutside = {
74
72
  <Target extends UseClickOutsideTarget | UseClickOutsideTarget[]>(target: Target, callback: (event: Event) => void): void;
75
- <Target extends UseClickOutsideTarget | UseClickOutsideTarget[]>(callback: (event: Event) => void, target?: never): UseClickOutsideReturn<Target>;
73
+ <Target extends UseClickOutsideTarget | UseClickOutsideTarget[]>(callback: (event: Event) => void, target?: never): RefObject<Target>;
76
74
  };
77
75
  /**
78
76
  * @name useClickOutside
@@ -104,18 +102,20 @@ interface UseCopyToClipboardReturn {
104
102
  value: string | null;
105
103
  /** Function to copy to clipboard */
106
104
  copy: (value: string) => Promise<void>;
105
+ /** Whether the copy to clipboard is supported */
106
+ supported: boolean;
107
107
  }
108
108
  /**
109
- * @name useCopyToClipboard
109
+ * @name useClipboard
110
110
  * @description - Hook that manages a copy to clipboard
111
111
  * @category Browser
112
112
  *
113
113
  * @returns {UseCopyToClipboardReturn} An object containing the boolean state value and utility functions to manipulate the state
114
114
  *
115
115
  * @example
116
- * const { value, copy } = useCopyToClipboard();
116
+ * const { supported, value, copy } = useClipboard();
117
117
  */
118
- declare const useCopyToClipboard: () => UseCopyToClipboardReturn;
118
+ declare const useClipboard: () => UseCopyToClipboardReturn;
119
119
 
120
120
  /** The use counter options */
121
121
  interface UseCounterOptions {
@@ -124,14 +124,6 @@ interface UseCounterOptions {
124
124
  /** The max of count value */
125
125
  max?: number;
126
126
  }
127
- interface UseCounterParams {
128
- /** The initial number value, defaults to 0 */
129
- initialValue?: number;
130
- /** The min of count value */
131
- min?: number;
132
- /** The max of count value */
133
- max?: number;
134
- }
135
127
  /** The use counter return type */
136
128
  interface UseCounterReturn {
137
129
  /** The current count value */
@@ -147,7 +139,9 @@ interface UseCounterReturn {
147
139
  }
148
140
  type UseCounter = {
149
141
  (initialValue?: number, options?: UseCounterOptions): UseCounterReturn;
150
- ({ initialValue, max, min }: UseCounterParams, options?: never): UseCounterReturn;
142
+ (options: UseCounterOptions & {
143
+ initialValue?: number;
144
+ }, initialValue?: never): UseCounterReturn;
151
145
  };
152
146
  /**
153
147
  * @name useCounter
@@ -475,6 +469,52 @@ interface UseFieldReturn<Value> {
475
469
  */
476
470
  declare const useField: <Value extends string | boolean = string, Type = Value extends string ? string : boolean>(params?: UseFieldParams<Value>) => UseFieldReturn<Type>;
477
471
 
472
+ interface UseFileDialogOptions extends Pick<ComponentProps<'input'>, 'multiple' | 'accept'> {
473
+ /** The capture value */
474
+ capture?: string;
475
+ /** The reset value */
476
+ reset?: boolean;
477
+ }
478
+ interface UseFileDialogReturn {
479
+ /** The selected files */
480
+ value: FileList | null;
481
+ /** The open function */
482
+ open: (openParams?: UseFileDialogOptions) => void;
483
+ /** The reset function */
484
+ reset: () => void;
485
+ }
486
+ type UseFileDialog = {
487
+ (callback?: (value: FileList | null) => void, options?: UseFileDialogOptions): UseFileDialogReturn;
488
+ (options?: UseFileDialogOptions, callback?: never): UseFileDialogReturn;
489
+ };
490
+ /**
491
+ * @name useFileDialog
492
+ * @description - Hook to handle file input
493
+ * @category Browser
494
+ *
495
+ * @overload
496
+ * @param {(value: FileList | null) => void} callback The callback to execute when a file is selected
497
+ * @param {boolean} [options.multiple=true] Whether multiple files can be selected
498
+ * @param {string} [options.accept='*'] The accepted file types
499
+ * @param {boolean} [options.reset=false] Whether the input should be reset when the callback is called
500
+ * @param {string} [options.capture] The capture value
501
+ * @returns {UseFileDialogReturn} An object containing the selected files
502
+ *
503
+ * @example
504
+ * const { values, open, reset } = useFileDialog((value) => console.log(value));
505
+ *
506
+ * @overload
507
+ * @param {boolean} [options.multiple=true] Whether multiple files can be selected
508
+ * @param {string} [options.accept='*'] The accepted file types
509
+ * @param {boolean} [options.reset=false] Whether the input should be reset when the callback is called
510
+ * @param {string} [options.capture] The capture value
511
+ * @returns {UseFileDialogReturn} An object containing the selected files
512
+ *
513
+ * @example
514
+ * const { values, open, reset } = useFileDialog({ accept: 'image/*' });
515
+ */
516
+ declare const useFileDialog: UseFileDialog;
517
+
478
518
  /**
479
519
  * @name useFps
480
520
  * @description - Hook that measures frames per second
@@ -539,6 +579,46 @@ type UseFullScreen = {
539
579
  */
540
580
  declare const useFullscreen: UseFullScreen;
541
581
 
582
+ /** The use geolocation return type */
583
+ interface UseGeolocationReturn {
584
+ /** The loading state */
585
+ loading: boolean;
586
+ /** The error of the last position update */
587
+ error: GeolocationPositionError | null;
588
+ /** The timestamp of the last position update */
589
+ timestamp: number | null;
590
+ /** The accuracy of the last position update */
591
+ accuracy: number | null;
592
+ /** The latitude of the last position update */
593
+ latitude: number | null;
594
+ /** The longitude of the last position update */
595
+ longitude: number | null;
596
+ /** The altitude of the last position update */
597
+ altitude: number | null;
598
+ /** The altitude accuracy of the last position update */
599
+ altitudeAccuracy: number | null;
600
+ /** The heading of the last position update */
601
+ heading: number | null;
602
+ /** The speed of the last position update */
603
+ speed: number | null;
604
+ }
605
+ /** The use geolocation params */
606
+ type UseGeolocationParams = PositionOptions;
607
+ /**
608
+ * @name useGeolocation
609
+ * @description - Hook that returns the current geolocation
610
+ * @category Browser
611
+ *
612
+ * @param {boolean} [params.enableHighAccuracy] Enable high accuracy
613
+ * @param {number} [params.maximumAge] Maximum age
614
+ * @param {number} [params.timeout] Timeout
615
+ * @returns {UseGeolocationReturn}
616
+ *
617
+ * @example
618
+ * const { loading, error, timestamp, accuracy, latitude, longitude, altitude, altitudeAccuracy, heading, speed } = useGeolocation();
619
+ */
620
+ declare const useGeolocation: (params?: UseGeolocationParams) => UseGeolocationReturn;
621
+
542
622
  /** The use hash return type */
543
623
  type UseHashReturn = [string, (value: string) => void];
544
624
  /**
@@ -670,12 +750,98 @@ interface UseIdleReturn {
670
750
  */
671
751
  declare const useIdle: (milliseconds?: number, { initialValue, events }?: UseIdleOptions) => UseIdleReturn;
672
752
 
753
+ interface UseQueryOptions<QueryData, Data> {
754
+ keys?: DependencyList;
755
+ onSuccess?: (data: Data) => void;
756
+ onError?: (error: Error) => void;
757
+ select?: (data: QueryData) => Data;
758
+ initialData?: Data | (() => Data);
759
+ placeholderData?: Data | (() => Data);
760
+ retry?: boolean | number;
761
+ refetchInterval?: number;
762
+ }
763
+ interface UseQueryReturn<Data> {
764
+ data?: Data;
765
+ isLoading: boolean;
766
+ isError: boolean;
767
+ isSuccess: boolean;
768
+ error?: Error;
769
+ refetch: () => void;
770
+ isRefetching: boolean;
771
+ }
772
+ /**
773
+ * @name useQuery
774
+ * @description - Hook that defines the logic when query data
775
+ * @category Utilities
776
+ *
777
+ * @template Data The type of the data
778
+ * @param {() => Promise<Data>} callback The callback function to be invoked
779
+ * @param {DependencyList} [options.keys] The dependencies for the hook
780
+ * @param {(data: Data) => void} [options.onSuccess] The callback function to be invoked on success
781
+ * @param {(error: Error) => void} [options.onError] The callback function to be invoked on error
782
+ * @param {UseQueryOptionsSelect<Data>} [options.select] The select function to be invoked
783
+ * @param {Data | (() => Data)} [options.initialData] The initial data for the hook
784
+ * @param {Data | (() => Data)} [options.placeholderData] The placeholder data for the hook
785
+ * @param {number} [options.refetchInterval] The refetch interval
786
+ * @param {boolean | number} [options.retry] The retry count of requests
787
+ * @returns {UseQueryReturn<Data>} An object with the state of the query
788
+ *
789
+ * @example
790
+ * const { data, isLoading, isError, isSuccess, error, refetch, isRefetching } = useQuery(() => fetch('https://example.com/data'));
791
+ */
792
+ declare const useQuery: <QueryData, Data = QueryData>(callback: () => Promise<QueryData>, options?: UseQueryOptions<QueryData, Data>) => UseQueryReturn<Data>;
793
+
794
+ /** The use image options */
795
+ interface UseImageOptions {
796
+ /** The srcset of the image */
797
+ srcset?: string;
798
+ /** The sizes of the image */
799
+ sizes?: string;
800
+ /** The alt of the image */
801
+ alt?: string;
802
+ /** The class of the image */
803
+ class?: string;
804
+ /** The loading of the image */
805
+ loading?: HTMLImageElement['loading'];
806
+ /** The crossorigin of the image */
807
+ crossorigin?: string;
808
+ /** The referrer policy of the image */
809
+ referrerPolicy?: HTMLImageElement['referrerPolicy'];
810
+ }
811
+ /**
812
+ * @name useImage
813
+ * @description - Hook that load an image in the browser
814
+ * @category Browser
815
+ *
816
+ * @param {string} src The source of the image
817
+ * @param {string} [options.srcset] The srcset of the image
818
+ * @param {string} [options.sizes] The sizes of the image
819
+ * @param {string} [options.alt] The alt of the image
820
+ * @param {string} [options.class] The class of the image
821
+ * @param {HTMLImageElement['loading']} [options.loading] The loading of the image
822
+ * @param {string} [options.crossorigin] The crossorigin of the image
823
+ * @param {HTMLImageElement['referrerPolicy']} [options.referrerPolicy] The referrerPolicy of the image
824
+ * @param {DependencyList} [useQueryOptions.keys] The dependencies for the hook
825
+ * @param {(data: Data) => void} [useQueryOptions.onSuccess] The callback function to be invoked on success
826
+ * @param {(error: Error) => void} [useQueryOptions.onError] The callback function to be invoked on error
827
+ * @param {number} [useQueryOptions.refetchInterval] The refetch interval
828
+ * @param {boolean | number} [useQueryOptions.retry] The retry count of requests
829
+ * @returns {UseImageReturn} An object with the state of the image
830
+ *
831
+ * @example
832
+ * const { data, isLoading, isError, isSuccess, error, refetch, isRefetching } = useImage('https://example.com/image.png');
833
+ */
834
+ declare const useImage: (src: string, options?: UseImageOptions, useQueryOptions?: Omit<UseQueryOptions<HTMLImageElement, HTMLImageElement>, 'select' | 'initialData' | 'placeholderData'>) => UseQueryReturn<HTMLImageElement>;
835
+
836
+ /** The intersection observer target element type */
673
837
  type UseIntersectionObserverTarget = RefObject<Element | null> | (() => Element) | Element;
838
+ /** The intersection observer options type */
674
839
  interface UseIntersectionObserverOptions extends Omit<IntersectionObserverInit, 'root'> {
675
840
  enabled?: boolean;
676
841
  onChange?: (entry: IntersectionObserverEntry) => void;
677
842
  root?: IntersectionObserverInit['root'] | RefObject<Element | null>;
678
843
  }
844
+ /** The intersection observer return type */
679
845
  interface UseIntersectionObserverReturn {
680
846
  inView: boolean;
681
847
  entry?: IntersectionObserverEntry;
@@ -686,6 +852,32 @@ type UseIntersectionObserver = {
686
852
  ref: RefObject<Target>;
687
853
  };
688
854
  };
855
+ /**
856
+ * @name useIntersectionObserver
857
+ * @description - Hook that gives you intersection observer state
858
+ * @category Browser
859
+ *
860
+ * @overload
861
+ * @template Target The target element
862
+ * @param {Target} target The target element to detect intersection
863
+ * @param {boolean} [options.enabled=true] The IntersectionObserver options
864
+ * @param {((entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void) | undefined} [options.onChange] The callback to execute when intersection is detected
865
+ * @param {IntersectionObserverInit['root'] | RefObject<Element | null>} [options.root] The root element to observe
866
+ * @returns {UseIntersectionObserverReturn} An object containing the state and the supported status
867
+ *
868
+ * @example
869
+ * const { ref, entry, inView } = useIntersectionObserver();
870
+ *
871
+ * @overload
872
+ * @template Target The target element
873
+ * @param {boolean} [options.enabled=true] The IntersectionObserver options
874
+ * @param {((entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void) | undefined} [options.onChange] The callback to execute when intersection is detected
875
+ * @param {IntersectionObserverInit['root'] | RefObject<Element | null>} [options.root] The root element to observe
876
+ * @returns {UseIntersectionObserverReturn & { ref: RefObject<Target> }} A React ref to attach to the target element
877
+ *
878
+ * @example
879
+ * const { entry, inView } = useIntersectionObserver(ref);
880
+ */
689
881
  declare const useIntersectionObserver: UseIntersectionObserver;
690
882
 
691
883
  /** The use interval options */
@@ -967,6 +1159,38 @@ interface UseMapReturn<Key, Value> {
967
1159
  */
968
1160
  declare const useMap: <Key, Value>(values?: [Key, Value][]) => UseMapReturn<Key, Value>;
969
1161
 
1162
+ /** The use measure target element type */
1163
+ type UseMeasureTarget = RefObject<Element | null> | (() => Element) | Element;
1164
+ /** The use measure return type */
1165
+ type UseMeasureReturn = Pick<DOMRectReadOnly, 'x' | 'y' | 'top' | 'left' | 'right' | 'bottom' | 'height' | 'width'>;
1166
+ type UseMeasureScreen = {
1167
+ <Target extends UseMeasureTarget>(target: Target): UseMeasureReturn;
1168
+ <Target extends UseMeasureTarget>(target?: never): UseMeasureReturn & {
1169
+ ref: RefObject<Target>;
1170
+ };
1171
+ };
1172
+ /**
1173
+ * @name useMeasure
1174
+ * @description - Hook to measure the size and position of an element
1175
+ * @category Browser
1176
+ *
1177
+ * @overload
1178
+ * @template Target The element to measure
1179
+ * @param {Target} [target] The element to measure
1180
+ * @returns {UseMeasureReturn} The element's size and position
1181
+ *
1182
+ * @example
1183
+ * const { x, y, width, height, top, left, bottom, right } = useMeasure(ref);
1184
+ *
1185
+ * @overload
1186
+ * @template Target The element to measure
1187
+ * @returns {UseMeasureReturn & { ref: RefObject<Target> }} The element's size and position
1188
+ *
1189
+ * @example
1190
+ * const { ref, x, y, width, height, top, left, bottom, right } = useMeasure();
1191
+ */
1192
+ declare const useMeasure: UseMeasureScreen;
1193
+
970
1194
  /**
971
1195
  * @name useMediaQuery
972
1196
  * @description - Hook that manages a media query
@@ -1346,47 +1570,6 @@ declare const usePreferredLanguages: () => readonly string[];
1346
1570
  */
1347
1571
  declare const usePrevious: <Value>(value: Value) => Value | undefined;
1348
1572
 
1349
- interface UseQueryOptions<QueryData, Data> {
1350
- keys?: DependencyList;
1351
- onSuccess?: (data: Data) => void;
1352
- onError?: (error: Error) => void;
1353
- select?: (data: QueryData) => Data;
1354
- initialData?: Data | (() => Data);
1355
- placeholderData?: Data | (() => Data);
1356
- retry?: boolean | number;
1357
- refetchInterval?: number;
1358
- }
1359
- interface UseQueryReturn<Data> {
1360
- data?: Data;
1361
- isLoading: boolean;
1362
- isError: boolean;
1363
- isSuccess: boolean;
1364
- error?: Error;
1365
- refetch: () => void;
1366
- isRefetching: boolean;
1367
- }
1368
- /**
1369
- * @name useQuery
1370
- * @description - Hook that defines the logic when query data
1371
- * @category Utilities
1372
- *
1373
- * @template Data The type of the data
1374
- * @param {() => Promise<Data>} callback The callback function to be invoked
1375
- * @param {DependencyList} [options.keys] The dependencies for the hook
1376
- * @param {(data: Data) => void} [options.onSuccess] The callback function to be invoked on success
1377
- * @param {(error: Error) => void} [options.onError] The callback function to be invoked on error
1378
- * @param {UseQueryOptionsSelect<Data>} [options.select] The select function to be invoked
1379
- * @param {Data | (() => Data)} [options.initialData] The initial data for the hook
1380
- * @param {Data | (() => Data)} [options.placeholderData] The placeholder data for the hook
1381
- * @param {number} [options.refetchInterval] The refetch interval
1382
- * @param {boolean | number} [options.retry] The retry count of requests
1383
- * @returns {UseQueryReturn<Data>} An object with the state of the query
1384
- *
1385
- * @example
1386
- * const { data, isLoading, isError, isSuccess, error, refetch, isRefetching } = useQuery(() => fetch('https://example.com/data'));
1387
- */
1388
- declare const useQuery: <QueryData, Data = QueryData>(callback: () => Promise<QueryData>, options?: UseQueryOptions<QueryData, Data>) => UseQueryReturn<Data>;
1389
-
1390
1573
  /** The use queue return type */
1391
1574
  interface UseQueueReturn<Value> {
1392
1575
  /** The current queue */
@@ -1469,6 +1652,51 @@ interface UseRerenderReturns {
1469
1652
  */
1470
1653
  declare const useRerender: () => UseRerenderReturns;
1471
1654
 
1655
+ /** The resize observer target element type */
1656
+ type UseResizeObserverTarget = RefObject<Element | null> | (() => Element) | Element;
1657
+ /** The resize observer options type */
1658
+ interface UseResizeObserverOptions extends ResizeObserverOptions {
1659
+ enabled?: boolean;
1660
+ onChange?: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void;
1661
+ }
1662
+ /** The resize observer return type */
1663
+ interface UseResizeObserverReturn {
1664
+ entries: ResizeObserverEntry[];
1665
+ }
1666
+ type UseResizeObserver = {
1667
+ <Target extends UseResizeObserverTarget | UseResizeObserverTarget[]>(target: Target, options?: UseResizeObserverOptions): UseResizeObserverReturn;
1668
+ <Target extends UseResizeObserverTarget | UseResizeObserverTarget[]>(options?: UseResizeObserverOptions, target?: never): UseResizeObserverReturn & {
1669
+ ref: RefObject<Target>;
1670
+ };
1671
+ };
1672
+ /**
1673
+ * @name useResizeObserver
1674
+ * @description - Hook that gives you resize observer state
1675
+ * @category Browser
1676
+ *
1677
+ * @overload
1678
+ * @template Target The target element
1679
+ * @param {boolean} [options.enabled=true] The IntersectionObserver options
1680
+ * @param {boolean} [options.box] The IntersectionObserver options
1681
+ * @param {(entries: ResizeObserverEntry[], observer: ResizeObserver) => void} [options.onChange] The callback to execute when resize is detected
1682
+ * @returns {UseResizeObserverReturn} An object containing the resize observer state
1683
+ *
1684
+ * @example
1685
+ * const { ref, entries } = useResizeObserver();
1686
+ *
1687
+ * @overload
1688
+ * @template Target The target element
1689
+ * @param {Target} target The target element to observe
1690
+ * @param {boolean} [options.enabled=true] The IntersectionObserver options
1691
+ * @param {boolean} [options.box] The IntersectionObserver options
1692
+ * @param {(entries: ResizeObserverEntry[], observer: ResizeObserver) => void} [options.onChange] The callback to execute when resize is detected
1693
+ * @returns {UseResizeObserverReturn} An object containing the resize observer state
1694
+ *
1695
+ * @example
1696
+ * const { entries } = useResizeObserver(ref);
1697
+ */
1698
+ declare const useResizeObserver: UseResizeObserver;
1699
+
1472
1700
  /** The use script status */
1473
1701
  type UseScriptStatus = 'loading' | 'ready' | 'error' | 'unknown';
1474
1702
  /** The use script options extends from attributes script tag */
@@ -1634,6 +1862,64 @@ interface UseStepReturn {
1634
1862
  */
1635
1863
  declare const useStep: (params: number | UseStepParams) => UseStepReturn;
1636
1864
 
1865
+ /** The use stopwatch return type */
1866
+ interface UseStopwatchReturn {
1867
+ /** The paused state of the stopwatch */
1868
+ paused: boolean;
1869
+ /** The over state of the stopwatch */
1870
+ over: boolean;
1871
+ /** The day count of the stopwatch */
1872
+ days: number;
1873
+ /** The hour count of the stopwatch */
1874
+ hours: number;
1875
+ /** The minute count of the stopwatch */
1876
+ minutes: number;
1877
+ /** The second count of the stopwatch */
1878
+ seconds: number;
1879
+ /** The total count of the stopwatch */
1880
+ count: number;
1881
+ /** The function to pause the stopwatch */
1882
+ pause: () => void;
1883
+ /** The function to start the stopwatch */
1884
+ start: () => void;
1885
+ /** The function to reset the stopwatch */
1886
+ reset: () => void;
1887
+ /** The function to toggle the stopwatch */
1888
+ toggle: () => void;
1889
+ }
1890
+ /** The use stopwatch options */
1891
+ interface UseStopwatchOptions {
1892
+ /** The enabled state of the timer */
1893
+ enabled?: boolean;
1894
+ }
1895
+ type UseStopwatch = {
1896
+ (initialTime?: number, options?: UseStopwatchOptions): UseStopwatchReturn;
1897
+ (options?: UseStopwatchOptions & {
1898
+ initialTime?: number;
1899
+ }): UseStopwatchReturn;
1900
+ };
1901
+ /**
1902
+ * @name useStopwatch
1903
+ * @description - Hook that creates a stopwatch functionality
1904
+ *
1905
+ * @overload
1906
+ * @param {number} [initialTime=0] The initial time of the timer
1907
+ * @param {boolean} [options.enabled=true] The enabled state of the timer
1908
+ * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer
1909
+ *
1910
+ * @example
1911
+ * const { seconds, minutes, start, pause, reset } = useStopwatch(1000, { enabled: false });
1912
+ *
1913
+ * @overload
1914
+ * @param {number} [options.initialTime=0] -The initial time of the timer
1915
+ * @param {boolean} [options.enabled=true] The enabled state of the timer
1916
+ * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer
1917
+ *
1918
+ * @example
1919
+ * const { seconds, minutes, start, pause, reset } = useStopwatch({ initialTime: 1000, enabled: false });
1920
+ */
1921
+ declare const useStopwatch: UseStopwatch;
1922
+
1637
1923
  /** The use text selection return type */
1638
1924
  interface UseTextSelectionReturn {
1639
1925
  /** The current selection text */
@@ -1842,6 +2128,8 @@ declare const getRetry: (retry: number | boolean) => number;
1842
2128
 
1843
2129
  declare const isClient: boolean;
1844
2130
 
2131
+ declare const isPermissionAllowed: (status: PermissionState) => boolean;
2132
+
1845
2133
  declare const throttle: <Params extends any[]>(callback: (...args: Params) => void, delay: number) => ((...args: Params) => void);
1846
2134
 
1847
2135
  declare const getDate: (now?: Date) => {
@@ -1858,4 +2146,4 @@ declare const getDate: (now?: Date) => {
1858
2146
  timestamp: number;
1859
2147
  };
1860
2148
 
1861
- export { debounce, getDate, getRetry, isClient, throttle, useBattery, useBoolean, useBrowserLanguage, useClickOutside, useCopyToClipboard, useCounter, useDebounceCallback, useDebounceValue, useDefault, useDidUpdate, useDisclosure, useDocumentEvent, useDocumentTitle, useDocumentVisibility, useEvent, useEventListener, useEyeDropper, useFavicon, useField, useFps, useFullscreen, useHash, useHotkeys, useHover, useIdle, useIntersectionObserver, useInterval, useIsFirstRender, useIsomorphicLayoutEffect, useKeyPress, useKeyPressEvent, useKeyboard, useKeysPressed, useList, useLocalStorage, useLogger, useLongPress, useMap, useMediaQuery, useMemory, useMount, useMouse, useMutation, useNetwork, useOnline, useOperatingSystem, useOrientation, usePageLeave, usePaint, usePermission, usePreferredColorScheme, usePreferredLanguages, usePrevious, useQuery, useQueue, useRenderCount, useRenderInfo, useRerender, useScript, useSessionStorage, useSet, useShare, useStep, useStorage, useTextSelection, useTime, useTimeout, useToggle, useUnmount, useWebSocket, useWindowEvent, useWindowSize, useWizard };
2149
+ export { debounce, getDate, getRetry, isClient, isPermissionAllowed, throttle, useBattery, useBoolean, useBrowserLanguage, useClickOutside, useClipboard, useCounter, useDebounceCallback, useDebounceValue, useDefault, useDidUpdate, useDisclosure, useDocumentEvent, useDocumentTitle, useDocumentVisibility, useEvent, useEventListener, useEyeDropper, useFavicon, useField, useFileDialog, useFps, useFullscreen, useGeolocation, useHash, useHotkeys, useHover, useIdle, useImage, useIntersectionObserver, useInterval, useIsFirstRender, useIsomorphicLayoutEffect, useKeyPress, useKeyPressEvent, useKeyboard, useKeysPressed, useList, useLocalStorage, useLogger, useLongPress, useMap, useMeasure, useMediaQuery, useMemory, useMount, useMouse, useMutation, useNetwork, useOnline, useOperatingSystem, useOrientation, usePageLeave, usePaint, usePermission, usePreferredColorScheme, usePreferredLanguages, usePrevious, useQuery, useQueue, useRenderCount, useRenderInfo, useRerender, useResizeObserver, useScript, useSessionStorage, useSet, useShare, useStep, useStopwatch, useStorage, useTextSelection, useTime, useTimeout, useToggle, useUnmount, useWebSocket, useWindowEvent, useWindowSize, useWizard };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siberiacancode/reactuse",
3
- "version": "0.0.43",
3
+ "version": "0.0.45",
4
4
  "description": "Ultimate tool",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"_rollupPluginBabelHelpers-BRE4VASD.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,3 +0,0 @@
1
- /* @license @siberiacancode/reactuse v0.0.43 */
2
- "use strict";var e=require("../../_rollupPluginBabelHelpers-BRE4VASD.js"),r=require("react"),t=function(e){var r=document.createElement("textarea");r.value=e,document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r)};exports.legacyCopyToClipboard=t,exports.useCopyToClipboard=function(){var n=r.useState(null),a=e._slicedToArray(n,2),o=a[0],c=a[1],u=r.useCallback(function(){var r=e._asyncToGenerator(e._regeneratorRuntime().mark((function r(n){var a;return e._regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,null===(a=navigator)||void 0===a||null===(a=a.clipboard)||void 0===a||!a.writeText){e.next=7;break}return e.next=4,navigator.clipboard.writeText(n);case 4:c(n),e.next=8;break;case 7:throw new Error("writeText not supported");case 8:e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),t(n),c(n);case 14:case"end":return e.stop()}}),r,null,[[0,10]])})));return function(e){return r.apply(this,arguments)}}(),[]);return{value:o,copy:u}};
3
- //# sourceMappingURL=useCopyToClipboard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCopyToClipboard.js","sources":["../../../../src/hooks/useCopyToClipboard/useCopyToClipboard.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nexport const legacyCopyToClipboard = (value: string) => {\n const tempTextArea = document.createElement('textarea');\n tempTextArea.value = value;\n document.body.appendChild(tempTextArea);\n tempTextArea.select();\n document.execCommand('copy');\n document.body.removeChild(tempTextArea);\n};\n\n/** The use copy to clipboard return type */\ninterface UseCopyToClipboardReturn {\n /** The copied value */\n value: string | null;\n /** Function to copy to clipboard */\n copy: (value: string) => Promise<void>;\n}\n\n/**\n * @name useCopyToClipboard\n * @description - Hook that manages a copy to clipboard\n * @category Browser\n *\n * @returns {UseCopyToClipboardReturn} An object containing the boolean state value and utility functions to manipulate the state\n *\n * @example\n * const { value, copy } = useCopyToClipboard();\n */\nexport const useCopyToClipboard = (): UseCopyToClipboardReturn => {\n const [value, setValue] = useState<string | null>(null);\n\n const copyToClipboard = useCallback(async (value: string) => {\n try {\n if (navigator?.clipboard?.writeText) {\n await navigator.clipboard.writeText(value);\n setValue(value);\n } else {\n throw new Error('writeText not supported');\n }\n } catch (error) {\n legacyCopyToClipboard(value);\n setValue(value);\n }\n }, []);\n\n return { value, copy: copyToClipboard };\n};\n"],"names":["legacyCopyToClipboard","value","tempTextArea","document","createElement","body","appendChild","select","execCommand","removeChild","_useState","useState","_useState2","_slicedToArray","setValue","copyToClipboard","useCallback","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_navigator","wrap","_context","prev","next","navigator","clipboard","writeText","Error","t0","stop","_x","apply","this","arguments","copy"],"mappings":";6FAEaA,EAAwB,SAACC,GACpC,IAAMC,EAAeC,SAASC,cAAc,YAC5CF,EAAaD,MAAQA,EACrBE,SAASE,KAAKC,YAAYJ,GAC1BA,EAAaK,SACbJ,SAASK,YAAY,QACrBL,SAASE,KAAKI,YAAYP,EAC5B,6DAoBkC,WAChC,IAAAQ,EAA0BC,EAAQA,SAAgB,MAAKC,EAAAC,EAAAA,eAAAH,EAAA,GAAhDT,EAAKW,EAAA,GAAEE,EAAQF,EAAA,GAEhBG,EAAkBC,EAAAA,YAAW,WAAA,IAAAC,EAAAC,EAAAA,kBAAAC,EAAAA,sBAAAC,MAAC,SAAAC,EAAOpB,GAAa,IAAAqB,EAAA,OAAAH,EAAAA,sBAAAI,MAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAAA,GAAAF,EAAAC,KAAA,EAEvCH,QAFuCA,EAEhDK,qBAASL,GAAWA,QAAXA,EAATA,EAAWM,iBAAXN,IAAoBA,IAApBA,EAAsBO,UAAS,CAAAL,EAAAE,KAAA,EAAA,KAAA,CAAA,OAAAF,EAAAE,KAAA,EAC3BC,UAAUC,UAAUC,UAAU5B,GAAM,KAAA,EAC1Ca,EAASb,GAAOuB,EAAAE,KAAA,EAAA,MAAA,KAAA,EAAA,MAEV,IAAII,MAAM,2BAA0B,KAAA,EAAAN,EAAAE,KAAA,GAAA,MAAA,KAAA,GAAAF,EAAAC,KAAA,GAAAD,EAAAO,GAAAP,EAAA,MAAA,GAG5CxB,EAAsBC,GACtBa,EAASb,GAAO,KAAA,GAAA,IAAA,MAAA,OAAAuB,EAAAQ,OAAA,GAAAX,EAAA,KAAA,CAAA,CAAA,EAAA,KAEnB,KAAA,OAAA,SAAAY,GAAA,OAAAhB,EAAAiB,MAAAC,KAAAC,UAAA,CAAA,CAZkC,GAYhC,IAEH,MAAO,CAAEnC,MAAAA,EAAOoC,KAAMtB,EACxB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"_rollupPluginBabelHelpers-q3sUYXUv.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,3 +0,0 @@
1
- /* @license @siberiacancode/reactuse v0.0.43 */
2
- import{_ as e,c as r,d as t}from"../../_rollupPluginBabelHelpers-q3sUYXUv.js";import{useState as n,useCallback as a}from"react";var o=function(e){var r=document.createElement("textarea");r.value=e,document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r)},c=function(){var c=n(null),u=e(c,2),i=u[0],l=u[1],p=a(function(){var e=r(t().mark((function e(r){var n;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,null===(n=navigator)||void 0===n||null===(n=n.clipboard)||void 0===n||!n.writeText){e.next=7;break}return e.next=4,navigator.clipboard.writeText(r);case 4:l(r),e.next=8;break;case 7:throw new Error("writeText not supported");case 8:e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),o(r),l(r);case 14:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(r){return e.apply(this,arguments)}}(),[]);return{value:i,copy:p}};export{o as legacyCopyToClipboard,c as useCopyToClipboard};
3
- //# sourceMappingURL=useCopyToClipboard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCopyToClipboard.js","sources":["../../../../src/hooks/useCopyToClipboard/useCopyToClipboard.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nexport const legacyCopyToClipboard = (value: string) => {\n const tempTextArea = document.createElement('textarea');\n tempTextArea.value = value;\n document.body.appendChild(tempTextArea);\n tempTextArea.select();\n document.execCommand('copy');\n document.body.removeChild(tempTextArea);\n};\n\n/** The use copy to clipboard return type */\ninterface UseCopyToClipboardReturn {\n /** The copied value */\n value: string | null;\n /** Function to copy to clipboard */\n copy: (value: string) => Promise<void>;\n}\n\n/**\n * @name useCopyToClipboard\n * @description - Hook that manages a copy to clipboard\n * @category Browser\n *\n * @returns {UseCopyToClipboardReturn} An object containing the boolean state value and utility functions to manipulate the state\n *\n * @example\n * const { value, copy } = useCopyToClipboard();\n */\nexport const useCopyToClipboard = (): UseCopyToClipboardReturn => {\n const [value, setValue] = useState<string | null>(null);\n\n const copyToClipboard = useCallback(async (value: string) => {\n try {\n if (navigator?.clipboard?.writeText) {\n await navigator.clipboard.writeText(value);\n setValue(value);\n } else {\n throw new Error('writeText not supported');\n }\n } catch (error) {\n legacyCopyToClipboard(value);\n setValue(value);\n }\n }, []);\n\n return { value, copy: copyToClipboard };\n};\n"],"names":["legacyCopyToClipboard","value","tempTextArea","document","createElement","body","appendChild","select","execCommand","removeChild","useCopyToClipboard","_useState","useState","_useState2","_slicedToArray","setValue","copyToClipboard","useCallback","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_navigator","wrap","_context","prev","next","navigator","clipboard","writeText","Error","t0","stop","_x","apply","this","arguments","copy"],"mappings":";oIAEaA,EAAwB,SAACC,GACpC,IAAMC,EAAeC,SAASC,cAAc,YAC5CF,EAAaD,MAAQA,EACrBE,SAASE,KAAKC,YAAYJ,GAC1BA,EAAaK,SACbJ,SAASK,YAAY,QACrBL,SAASE,KAAKI,YAAYP,EAC5B,EAoBaQ,EAAqB,WAChC,IAAAC,EAA0BC,EAAwB,MAAKC,EAAAC,EAAAH,EAAA,GAAhDV,EAAKY,EAAA,GAAEE,EAAQF,EAAA,GAEhBG,EAAkBC,EAAW,WAAA,IAAAC,EAAAC,EAAAC,IAAAC,MAAC,SAAAC,EAAOrB,GAAa,IAAAsB,EAAA,OAAAH,IAAAI,MAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAAA,GAAAF,EAAAC,KAAA,EAEvCH,QAFuCA,EAEhDK,qBAASL,GAAWA,QAAXA,EAATA,EAAWM,iBAAXN,IAAoBA,IAApBA,EAAsBO,UAAS,CAAAL,EAAAE,KAAA,EAAA,KAAA,CAAA,OAAAF,EAAAE,KAAA,EAC3BC,UAAUC,UAAUC,UAAU7B,GAAM,KAAA,EAC1Cc,EAASd,GAAOwB,EAAAE,KAAA,EAAA,MAAA,KAAA,EAAA,MAEV,IAAII,MAAM,2BAA0B,KAAA,EAAAN,EAAAE,KAAA,GAAA,MAAA,KAAA,GAAAF,EAAAC,KAAA,GAAAD,EAAAO,GAAAP,EAAA,MAAA,GAG5CzB,EAAsBC,GACtBc,EAASd,GAAO,KAAA,GAAA,IAAA,MAAA,OAAAwB,EAAAQ,OAAA,GAAAX,EAAA,KAAA,CAAA,CAAA,EAAA,KAEnB,KAAA,OAAA,SAAAY,GAAA,OAAAhB,EAAAiB,MAAAC,KAAAC,UAAA,CAAA,CAZkC,GAYhC,IAEH,MAAO,CAAEpC,MAAAA,EAAOqC,KAAMtB,EACxB"}