@jbpark/use-hooks 4.0.0 → 4.0.1

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 (95) hide show
  1. package/dist/hooks/index.d.mts +31 -30
  2. package/dist/hooks/index.mjs +1 -2
  3. package/dist/hooks/use-body-scroll-lock.d.mts +1 -1
  4. package/dist/hooks/use-body-scroll-lock.mjs +1 -2
  5. package/dist/hooks/use-body-scroll-lock.mjs.map +1 -1
  6. package/dist/hooks/use-click-outside.d.mts +1 -2
  7. package/dist/hooks/use-click-outside.mjs +3 -3
  8. package/dist/hooks/use-click-outside.mjs.map +1 -1
  9. package/dist/hooks/use-controllable-state.d.mts +1 -1
  10. package/dist/hooks/use-controllable-state.mjs +1 -2
  11. package/dist/hooks/use-controllable-state.mjs.map +1 -1
  12. package/dist/hooks/use-debounced-callback.d.mts +2 -6
  13. package/dist/hooks/use-debounced-callback.mjs +9 -9
  14. package/dist/hooks/use-debounced-callback.mjs.map +1 -1
  15. package/dist/hooks/use-debounced-value.d.mts +1 -1
  16. package/dist/hooks/use-debounced-value.mjs +1 -2
  17. package/dist/hooks/use-debounced-value.mjs.map +1 -1
  18. package/dist/hooks/use-element-position.d.mts +1 -2
  19. package/dist/hooks/use-element-position.mjs +1 -2
  20. package/dist/hooks/use-element-position.mjs.map +1 -1
  21. package/dist/hooks/use-element-scroll.d.mts +2 -4
  22. package/dist/hooks/use-element-scroll.mjs +3 -3
  23. package/dist/hooks/use-element-scroll.mjs.map +1 -1
  24. package/dist/hooks/use-event-listener.d.mts +1 -2
  25. package/dist/hooks/use-event-listener.mjs +1 -2
  26. package/dist/hooks/use-event-listener.mjs.map +1 -1
  27. package/dist/hooks/use-file-drop.d.mts +1 -1
  28. package/dist/hooks/use-file-drop.mjs +7 -6
  29. package/dist/hooks/use-file-drop.mjs.map +1 -1
  30. package/dist/hooks/use-file-to-data-url.d.mts +1 -1
  31. package/dist/hooks/use-file-to-data-url.mjs +1 -2
  32. package/dist/hooks/use-file-to-data-url.mjs.map +1 -1
  33. package/dist/hooks/use-history-state.d.mts +1 -1
  34. package/dist/hooks/use-history-state.mjs +3 -3
  35. package/dist/hooks/use-history-state.mjs.map +1 -1
  36. package/dist/hooks/use-image.d.mts +1 -1
  37. package/dist/hooks/use-image.mjs +24 -8
  38. package/dist/hooks/use-image.mjs.map +1 -1
  39. package/dist/hooks/use-intersection-observer.d.mts +1 -1
  40. package/dist/hooks/use-intersection-observer.mjs +1 -2
  41. package/dist/hooks/use-intersection-observer.mjs.map +1 -1
  42. package/dist/hooks/use-interval.d.mts +1 -1
  43. package/dist/hooks/use-interval.mjs +1 -2
  44. package/dist/hooks/use-interval.mjs.map +1 -1
  45. package/dist/hooks/use-key-press.d.mts +1 -2
  46. package/dist/hooks/use-key-press.mjs +7 -5
  47. package/dist/hooks/use-key-press.mjs.map +1 -1
  48. package/dist/hooks/use-local-storage.d.mts +1 -1
  49. package/dist/hooks/use-local-storage.mjs +5 -3
  50. package/dist/hooks/use-local-storage.mjs.map +1 -1
  51. package/dist/hooks/use-merged-ref.d.mts +1 -2
  52. package/dist/hooks/use-merged-ref.mjs +1 -2
  53. package/dist/hooks/use-merged-ref.mjs.map +1 -1
  54. package/dist/hooks/use-multi-select.d.mts +1 -1
  55. package/dist/hooks/use-multi-select.mjs +10 -9
  56. package/dist/hooks/use-multi-select.mjs.map +1 -1
  57. package/dist/hooks/use-mutation-observer.d.mts +1 -2
  58. package/dist/hooks/use-mutation-observer.mjs +3 -3
  59. package/dist/hooks/use-mutation-observer.mjs.map +1 -1
  60. package/dist/hooks/use-previous.d.mts +1 -1
  61. package/dist/hooks/use-previous.mjs +1 -2
  62. package/dist/hooks/use-previous.mjs.map +1 -1
  63. package/dist/hooks/use-recursive-timeout.d.mts +1 -1
  64. package/dist/hooks/use-recursive-timeout.mjs +1 -2
  65. package/dist/hooks/use-recursive-timeout.mjs.map +1 -1
  66. package/dist/hooks/use-resize-observer.d.mts +1 -1
  67. package/dist/hooks/use-resize-observer.mjs +1 -2
  68. package/dist/hooks/use-resize-observer.mjs.map +1 -1
  69. package/dist/hooks/use-responsive-size.d.mts +1 -1
  70. package/dist/hooks/use-responsive-size.mjs +1 -2
  71. package/dist/hooks/use-responsive-size.mjs.map +1 -1
  72. package/dist/hooks/use-scroll-to-elements.d.mts +1 -2
  73. package/dist/hooks/use-scroll-to-elements.mjs +1 -2
  74. package/dist/hooks/use-scroll-to-elements.mjs.map +1 -1
  75. package/dist/hooks/use-throttled-callback.d.mts +2 -5
  76. package/dist/hooks/use-throttled-callback.mjs +6 -8
  77. package/dist/hooks/use-throttled-callback.mjs.map +1 -1
  78. package/dist/hooks/use-throttled-value.d.mts +1 -1
  79. package/dist/hooks/use-throttled-value.mjs +1 -2
  80. package/dist/hooks/use-throttled-value.mjs.map +1 -1
  81. package/dist/hooks/use-timeout.d.mts +1 -1
  82. package/dist/hooks/use-timeout.mjs +1 -2
  83. package/dist/hooks/use-timeout.mjs.map +1 -1
  84. package/dist/hooks/use-toggle.d.mts +1 -1
  85. package/dist/hooks/use-toggle.mjs +1 -2
  86. package/dist/hooks/use-toggle.mjs.map +1 -1
  87. package/dist/hooks/use-viewport.d.mts +1 -1
  88. package/dist/hooks/use-viewport.mjs +1 -2
  89. package/dist/hooks/use-viewport.mjs.map +1 -1
  90. package/dist/hooks/use-window-scroll.d.mts +1 -2
  91. package/dist/hooks/use-window-scroll.mjs +1 -2
  92. package/dist/hooks/use-window-scroll.mjs.map +1 -1
  93. package/dist/index.d.mts +30 -30
  94. package/dist/index.mjs +1 -2
  95. package/package.json +26 -26
@@ -1,5 +1,4 @@
1
1
  import { RefObject } from "react";
2
-
3
2
  //#region src/hooks/use-window-scroll.d.ts
4
3
  declare const useWindowScroll: (targetRef?: RefObject<Element | null>) => {
5
4
  x: number;
@@ -10,5 +9,5 @@ declare const useWindowScroll: (targetRef?: RefObject<Element | null>) => {
10
9
  };
11
10
  };
12
11
  //#endregion
13
- export { useWindowScroll };
12
+ export { useWindowScroll as default };
14
13
  //# sourceMappingURL=use-window-scroll.d.mts.map
@@ -1,5 +1,4 @@
1
1
  import { useEffect, useState } from "react";
2
-
3
2
  //#region src/hooks/use-window-scroll.ts
4
3
  const useWindowScroll = (targetRef) => {
5
4
  const [state, setState] = useState({
@@ -78,7 +77,7 @@ const useWindowScroll = (targetRef) => {
78
77
  }, [targetRef]);
79
78
  return state;
80
79
  };
81
-
82
80
  //#endregion
83
81
  export { useWindowScroll as default };
82
+
84
83
  //# sourceMappingURL=use-window-scroll.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-window-scroll.mjs","names":[],"sources":["../../src/hooks/use-window-scroll.ts"],"sourcesContent":["import { type RefObject, useEffect, useState } from 'react';\n\n// Pass a ref to an element rendered inside the window you actually want to\n// track (e.g. a node portaled into an iframe). Without one, this defaults\n// to the host `window`, which is wrong whenever the caller doesn't live in\n// the top-level document.\nconst useWindowScroll = (targetRef?: RefObject<Element | null>) => {\n const [state, setState] = useState({\n x: 0,\n y: 0,\n percent: {\n x: 0,\n y: 0,\n },\n });\n\n useEffect(() => {\n let cancelled = false;\n let rafId: number | undefined;\n let cleanup: (() => void) | undefined;\n\n const attach = () => {\n if (cancelled) {\n return;\n }\n\n // `targetRef.current` can still be null right after mount (e.g. a\n // conditionally-rendered or portaled node) — retry every frame\n // until it's populated instead of permanently falling back to the\n // host `window`.\n if (targetRef && !targetRef.current) {\n rafId = requestAnimationFrame(attach);\n return;\n }\n\n const target = targetRef?.current?.ownerDocument.defaultView ?? window;\n const doc = target.document;\n\n const calculate = () => {\n const x = target.scrollX || 0;\n const y = target.scrollY || 0;\n\n const isIOS = /iPad|iPhone|iPod/.test(target.navigator.userAgent);\n const visualViewport = target.visualViewport;\n\n const viewportWidth =\n isIOS && visualViewport ? visualViewport.width : target.innerWidth;\n\n const viewportHeight =\n isIOS && visualViewport ? visualViewport.height : target.innerHeight;\n\n const maxScrollX = Math.max(\n 0,\n doc.documentElement.scrollWidth - viewportWidth,\n );\n const maxScrollY = Math.max(\n 0,\n doc.documentElement.scrollHeight - viewportHeight,\n );\n\n const percentX =\n maxScrollX === 0 ? 0 : Math.min(100, (x / maxScrollX) * 100);\n const percentY =\n maxScrollY === 0 ? 0 : Math.min(100, (y / maxScrollY) * 100);\n\n setState({\n x,\n y,\n percent: {\n // Rounded (not floored) so reaching the true bottom/right edge\n // reads as 100 instead of falling just short of it.\n x: Math.round(Math.max(0, percentX)),\n y: Math.round(Math.max(0, percentY)),\n },\n });\n };\n\n calculate();\n\n const onScroll = () => {\n calculate();\n };\n\n const onResize = () => {\n setTimeout(calculate, 100);\n };\n\n const onVisualViewportChange = () => {\n setTimeout(calculate, 50);\n };\n\n target.addEventListener('scroll', onScroll, { passive: true });\n target.addEventListener('resize', onResize);\n target.addEventListener('orientationchange', onResize);\n\n if (target.visualViewport) {\n target.visualViewport.addEventListener(\n 'resize',\n onVisualViewportChange,\n );\n }\n\n // `resize`/`orientationchange` only fire for the viewport itself —\n // content that grows/shrinks the document height without resizing\n // the window (images loading, dynamic content) needs its own\n // observer to keep maxScrollY accurate.\n let resizeObserver: ResizeObserver | undefined;\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(() => calculate());\n resizeObserver.observe(doc.documentElement);\n }\n\n cleanup = () => {\n target.removeEventListener('scroll', onScroll);\n target.removeEventListener('resize', onResize);\n target.removeEventListener('orientationchange', onResize);\n\n if (target.visualViewport) {\n target.visualViewport.removeEventListener(\n 'resize',\n onVisualViewportChange,\n );\n }\n\n resizeObserver?.disconnect();\n };\n };\n\n attach();\n\n return () => {\n cancelled = true;\n if (rafId !== undefined) {\n cancelAnimationFrame(rafId);\n }\n cleanup?.();\n };\n }, [targetRef]);\n\n return state;\n};\n\nexport default useWindowScroll;\n"],"mappings":";;;AAMA,MAAM,mBAAmB,cAA0C;CACjE,MAAM,CAAC,OAAO,YAAY,SAAS;EACjC,GAAG;EACH,GAAG;EACH,SAAS;GACP,GAAG;GACH,GAAG;GACJ;EAC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AAe,iBACpB,UACA,uBACD;GAOH,IAAI;AACJ,OAAI,OAAO,mBAAmB,aAAa;AACzC,qBAAiB,IAAI,qBAAqB,WAAW,CAAC;AACtD,mBAAe,QAAQ,IAAI,gBAAgB;;AAG7C,mBAAgB;AACd,WAAO,oBAAoB,UAAU,SAAS;AAC9C,WAAO,oBAAoB,UAAU,SAAS;AAC9C,WAAO,oBAAoB,qBAAqB,SAAS;AAEzD,QAAI,OAAO,eACT,QAAO,eAAe,oBACpB,UACA,uBACD;AAGH,oBAAgB,YAAY;;;AAIhC,UAAQ;AAER,eAAa;AACX,eAAY;AACZ,OAAI,UAAU,OACZ,sBAAqB,MAAM;AAE7B,cAAW;;IAEZ,CAAC,UAAU,CAAC;AAEf,QAAO"}
1
+ {"version":3,"file":"use-window-scroll.mjs","names":[],"sources":["../../src/hooks/use-window-scroll.ts"],"sourcesContent":["import { type RefObject, useEffect, useState } from 'react';\n\n// Pass a ref to an element rendered inside the window you actually want to\n// track (e.g. a node portaled into an iframe). Without one, this defaults\n// to the host `window`, which is wrong whenever the caller doesn't live in\n// the top-level document.\nconst useWindowScroll = (targetRef?: RefObject<Element | null>) => {\n const [state, setState] = useState({\n x: 0,\n y: 0,\n percent: {\n x: 0,\n y: 0,\n },\n });\n\n useEffect(() => {\n let cancelled = false;\n let rafId: number | undefined;\n let cleanup: (() => void) | undefined;\n\n const attach = () => {\n if (cancelled) {\n return;\n }\n\n // `targetRef.current` can still be null right after mount (e.g. a\n // conditionally-rendered or portaled node) — retry every frame\n // until it's populated instead of permanently falling back to the\n // host `window`.\n if (targetRef && !targetRef.current) {\n rafId = requestAnimationFrame(attach);\n return;\n }\n\n const target = targetRef?.current?.ownerDocument.defaultView ?? window;\n const doc = target.document;\n\n const calculate = () => {\n const x = target.scrollX || 0;\n const y = target.scrollY || 0;\n\n const isIOS = /iPad|iPhone|iPod/.test(target.navigator.userAgent);\n const visualViewport = target.visualViewport;\n\n const viewportWidth =\n isIOS && visualViewport ? visualViewport.width : target.innerWidth;\n\n const viewportHeight =\n isIOS && visualViewport ? visualViewport.height : target.innerHeight;\n\n const maxScrollX = Math.max(\n 0,\n doc.documentElement.scrollWidth - viewportWidth,\n );\n const maxScrollY = Math.max(\n 0,\n doc.documentElement.scrollHeight - viewportHeight,\n );\n\n const percentX =\n maxScrollX === 0 ? 0 : Math.min(100, (x / maxScrollX) * 100);\n const percentY =\n maxScrollY === 0 ? 0 : Math.min(100, (y / maxScrollY) * 100);\n\n setState({\n x,\n y,\n percent: {\n // Rounded (not floored) so reaching the true bottom/right edge\n // reads as 100 instead of falling just short of it.\n x: Math.round(Math.max(0, percentX)),\n y: Math.round(Math.max(0, percentY)),\n },\n });\n };\n\n calculate();\n\n const onScroll = () => {\n calculate();\n };\n\n const onResize = () => {\n setTimeout(calculate, 100);\n };\n\n const onVisualViewportChange = () => {\n setTimeout(calculate, 50);\n };\n\n target.addEventListener('scroll', onScroll, { passive: true });\n target.addEventListener('resize', onResize);\n target.addEventListener('orientationchange', onResize);\n\n if (target.visualViewport) {\n target.visualViewport.addEventListener(\n 'resize',\n onVisualViewportChange,\n );\n }\n\n // `resize`/`orientationchange` only fire for the viewport itself —\n // content that grows/shrinks the document height without resizing\n // the window (images loading, dynamic content) needs its own\n // observer to keep maxScrollY accurate.\n let resizeObserver: ResizeObserver | undefined;\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(() => calculate());\n resizeObserver.observe(doc.documentElement);\n }\n\n cleanup = () => {\n target.removeEventListener('scroll', onScroll);\n target.removeEventListener('resize', onResize);\n target.removeEventListener('orientationchange', onResize);\n\n if (target.visualViewport) {\n target.visualViewport.removeEventListener(\n 'resize',\n onVisualViewportChange,\n );\n }\n\n resizeObserver?.disconnect();\n };\n };\n\n attach();\n\n return () => {\n cancelled = true;\n if (rafId !== undefined) {\n cancelAnimationFrame(rafId);\n }\n cleanup?.();\n };\n }, [targetRef]);\n\n return state;\n};\n\nexport default useWindowScroll;\n"],"mappings":";;AAMA,MAA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B,UAAU,UAAU,EAAE,SAAS,KAAK,CAAC;GAC7D,OAAO,iBAAiB,UAAU,QAAQ;GAC1C,OAAO,iBAAiB,qBAAqB,QAAQ;GAErD,IAAI,OAAO,gBACT,OAAO,eAAe,iBACpB,UACA,sBACF;GAOF,IAAI;GACJ,IAAI,OAAO,mBAAmB,aAAa;IACzC,iBAAiB,IAAI,qBAAqB,UAAU,CAAC;IACrD,eAAe,QAAQ,IAAI,eAAe;GAC5C;GAEA,gBAAgB;IACd,OAAO,oBAAoB,UAAU,QAAQ;IAC7C,OAAO,oBAAoB,UAAU,QAAQ;IAC7C,OAAO,oBAAoB,qBAAqB,QAAQ;IAExD,IAAI,OAAO,gBACT,OAAO,eAAe,oBACpB,UACA,sBACF;IAGF,gBAAgB,WAAW;GAC7B;EACF;EAEA,OAAO;EAEP,aAAa;GACX,YAAY;GACZ,IAAI,UAAU,KAAA,GACZ,qBAAqB,KAAK;GAE5B,UAAU;EACZ;CACF,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;AACT"}
package/dist/index.d.mts CHANGED
@@ -1,32 +1,32 @@
1
- import { useDebouncedCallback } from "./hooks/use-debounced-callback.mjs";
2
- import { useDebouncedValue } from "./hooks/use-debounced-value.mjs";
3
- import { useBodyScrollLock } from "./hooks/use-body-scroll-lock.mjs";
4
- import { useClickOutside } from "./hooks/use-click-outside.mjs";
5
- import { useControllableState } from "./hooks/use-controllable-state.mjs";
6
- import { useElementPosition } from "./hooks/use-element-position.mjs";
7
- import { useElementScroll } from "./hooks/use-element-scroll.mjs";
8
- import { useEventListener } from "./hooks/use-event-listener.mjs";
9
- import { useFileDrop } from "./hooks/use-file-drop.mjs";
10
- import { useFileToDataUrl } from "./hooks/use-file-to-data-url.mjs";
11
- import { useHistoryState } from "./hooks/use-history-state.mjs";
12
- import { useIntersectionObserver } from "./hooks/use-intersection-observer.mjs";
13
- import { useInterval } from "./hooks/use-interval.mjs";
14
- import { useResponsiveSize } from "./hooks/use-responsive-size.mjs";
15
- import { useImage } from "./hooks/use-image.mjs";
16
- import { useKeyPress } from "./hooks/use-key-press.mjs";
17
- import { useLocalStorage } from "./hooks/use-local-storage.mjs";
18
- import { useMergedRef } from "./hooks/use-merged-ref.mjs";
19
- import { useMultiSelect } from "./hooks/use-multi-select.mjs";
20
- import { useMutationObserver } from "./hooks/use-mutation-observer.mjs";
21
- import { usePrevious } from "./hooks/use-previous.mjs";
22
- import { useRecursiveTimeout } from "./hooks/use-recursive-timeout.mjs";
23
- import { useResizeObserver } from "./hooks/use-resize-observer.mjs";
24
- import { useScrollToElements } from "./hooks/use-scroll-to-elements.mjs";
25
- import { useThrottledValue } from "./hooks/use-throttled-value.mjs";
26
- import { useThrottledCallback } from "./hooks/use-throttled-callback.mjs";
27
- import { useTimeout } from "./hooks/use-timeout.mjs";
28
- import { useToggle } from "./hooks/use-toggle.mjs";
29
- import { useWindowScroll } from "./hooks/use-window-scroll.mjs";
30
- import { useViewport } from "./hooks/use-viewport.mjs";
1
+ import useDebouncedCallback from "./hooks/use-debounced-callback.mjs";
2
+ import useDebouncedValue from "./hooks/use-debounced-value.mjs";
3
+ import useBodyScrollLock from "./hooks/use-body-scroll-lock.mjs";
4
+ import useClickOutside from "./hooks/use-click-outside.mjs";
5
+ import useControllableState from "./hooks/use-controllable-state.mjs";
6
+ import useElementPosition from "./hooks/use-element-position.mjs";
7
+ import useElementScroll from "./hooks/use-element-scroll.mjs";
8
+ import useEventListener from "./hooks/use-event-listener.mjs";
9
+ import useFileDrop from "./hooks/use-file-drop.mjs";
10
+ import useFileToDataUrl from "./hooks/use-file-to-data-url.mjs";
11
+ import useHistoryState from "./hooks/use-history-state.mjs";
12
+ import useIntersectionObserver from "./hooks/use-intersection-observer.mjs";
13
+ import useInterval from "./hooks/use-interval.mjs";
14
+ import useResponsiveSize from "./hooks/use-responsive-size.mjs";
15
+ import useImage from "./hooks/use-image.mjs";
16
+ import useKeyPress from "./hooks/use-key-press.mjs";
17
+ import useLocalStorage from "./hooks/use-local-storage.mjs";
18
+ import useMergedRef from "./hooks/use-merged-ref.mjs";
19
+ import useMultiSelect from "./hooks/use-multi-select.mjs";
20
+ import useMutationObserver from "./hooks/use-mutation-observer.mjs";
21
+ import usePrevious from "./hooks/use-previous.mjs";
22
+ import useRecursiveTimeout from "./hooks/use-recursive-timeout.mjs";
23
+ import useResizeObserver from "./hooks/use-resize-observer.mjs";
24
+ import useScrollToElements from "./hooks/use-scroll-to-elements.mjs";
25
+ import useThrottledValue from "./hooks/use-throttled-value.mjs";
26
+ import useThrottledCallback from "./hooks/use-throttled-callback.mjs";
27
+ import useTimeout from "./hooks/use-timeout.mjs";
28
+ import useToggle from "./hooks/use-toggle.mjs";
29
+ import useWindowScroll from "./hooks/use-window-scroll.mjs";
30
+ import useViewport from "./hooks/use-viewport.mjs";
31
31
  import "./hooks/index.mjs";
32
32
  export { useBodyScrollLock, useClickOutside, useControllableState, useDebouncedCallback as useDebounce, useDebouncedCallback, useDebouncedValue, useElementPosition, useElementScroll, useEventListener, useFileDrop, useFileToDataUrl, useHistoryState, useImage, useIntersectionObserver, useInterval, useKeyPress, useLocalStorage, useMergedRef, useMultiSelect, useMutationObserver, usePrevious, useRecursiveTimeout, useResizeObserver, useResponsiveSize, useScrollToElements, useThrottledValue as useThrottle, useThrottledCallback, useThrottledValue, useTimeout, useToggle, useViewport, useWindowScroll };
package/dist/index.mjs CHANGED
@@ -29,5 +29,4 @@ import useToggle from "./hooks/use-toggle.mjs";
29
29
  import useWindowScroll from "./hooks/use-window-scroll.mjs";
30
30
  import useViewport from "./hooks/use-viewport.mjs";
31
31
  import "./hooks/index.mjs";
32
-
33
- export { useBodyScrollLock, useClickOutside, useControllableState, useDebouncedCallback as useDebounce, useDebouncedCallback, useDebouncedValue, useElementPosition, useElementScroll, useEventListener, useFileDrop, useFileToDataUrl, useHistoryState, useImage, useIntersectionObserver, useInterval, useKeyPress, useLocalStorage, useMergedRef, useMultiSelect, useMutationObserver, usePrevious, useRecursiveTimeout, useResizeObserver, useResponsiveSize, useScrollToElements, useThrottledValue as useThrottle, useThrottledCallback, useThrottledValue, useTimeout, useToggle, useViewport, useWindowScroll };
32
+ export { useBodyScrollLock, useClickOutside, useControllableState, useDebouncedCallback as useDebounce, useDebouncedCallback, useDebouncedValue, useElementPosition, useElementScroll, useEventListener, useFileDrop, useFileToDataUrl, useHistoryState, useImage, useIntersectionObserver, useInterval, useKeyPress, useLocalStorage, useMergedRef, useMultiSelect, useMutationObserver, usePrevious, useRecursiveTimeout, useResizeObserver, useResponsiveSize, useScrollToElements, useThrottledValue as useThrottle, useThrottledCallback, useThrottledValue, useTimeout, useToggle, useViewport, useWindowScroll };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbpark/use-hooks",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "A collection of reusable React 19 hooks for common UI and interaction patterns",
5
5
  "keywords": [
6
6
  "react",
@@ -52,33 +52,33 @@
52
52
  "react-dom": "^19.1.1"
53
53
  },
54
54
  "devDependencies": {
55
- "@changesets/cli": "^2.31.1",
56
- "@eslint/js": "^9.33.0",
57
- "@jbpark/ui-kit": "^3.0.0",
55
+ "@changesets/cli": "^3.0.0",
56
+ "@eslint/js": "^9.39.5",
57
+ "@jbpark/ui-kit": "^5.2.0",
58
58
  "@radix-ui/react-icons": "^1.3.2",
59
- "@trivago/prettier-plugin-sort-imports": "^5.2.2",
60
- "@types/node": "^24.5.2",
61
- "@types/react": "^19.1.10",
62
- "@types/react-dom": "^19.1.7",
63
- "@vitejs/plugin-react": "^5.0.0",
64
- "eslint": "^9.33.0",
65
- "eslint-plugin-react-hooks": "^5.2.0",
66
- "eslint-plugin-react-refresh": "^0.4.20",
67
- "globals": "^16.3.0",
59
+ "@trivago/prettier-plugin-sort-imports": "^6.0.2",
60
+ "@types/node": "^26.2.0",
61
+ "@types/react": "^19.2.18",
62
+ "@types/react-dom": "^19.2.4",
63
+ "@vitejs/plugin-react": "^6.0.5",
64
+ "eslint": "^9.39.5",
65
+ "eslint-plugin-react-hooks": "^6.1.1",
66
+ "eslint-plugin-react-refresh": "^0.5.4",
67
+ "globals": "^17.11.0",
68
68
  "husky": "^9.1.7",
69
- "lint-staged": "^16.1.6",
70
- "prettier": "^3.8.0",
71
- "prettier-plugin-classnames": "^0.8.3",
72
- "prettier-plugin-merge": "^0.8.0",
73
- "prettier-plugin-tailwindcss": "^0.6.14",
74
- "react": "^19.1.1",
75
- "react-dom": "^19.1.1",
76
- "react-router-dom": "^7.18.1",
77
- "tsdown": "^0.20.3",
78
- "typescript": "~5.8.3",
79
- "typescript-eslint": "^8.39.1",
80
- "vite": "^7.1.2",
81
- "vite-plugin-dts": "^4.5.4"
69
+ "lint-staged": "^17.3.0",
70
+ "prettier": "^3.9.6",
71
+ "prettier-plugin-classnames": "^0.10.4",
72
+ "prettier-plugin-merge": "^0.10.1",
73
+ "prettier-plugin-tailwindcss": "^0.8.1",
74
+ "react": "^19.2.8",
75
+ "react-dom": "^19.2.8",
76
+ "react-router-dom": "^7.18.2",
77
+ "tsdown": "^0.22.14",
78
+ "typescript": "~6.0.3",
79
+ "typescript-eslint": "^8.67.0",
80
+ "vite": "^8.2.1",
81
+ "vite-plugin-dts": "^5.0.3"
82
82
  },
83
83
  "lint-staged": {
84
84
  "**/*.{js,jsx,ts,tsx,css,scss,md}": "prettier --write",